|
Karsten Hopp |
151311 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
151311 |
Subject: Patch 7.2.050
|
|
Karsten Hopp |
151311 |
Fcc: outbox
|
|
Karsten Hopp |
151311 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
151311 |
Mime-Version: 1.0
|
|
Karsten Hopp |
151311 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
151311 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
151311 |
------------
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
Patch 7.2.050
|
|
Karsten Hopp |
151311 |
Problem: Warnings for not checking return value of fwrite(). (Chip Campbell)
|
|
Karsten Hopp |
151311 |
Solution: Use the return value.
|
|
Karsten Hopp |
151311 |
Files: src/spell.c
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
*** ../vim-7.2.049/src/spell.c Mon Aug 25 04:12:38 2008
|
|
Karsten Hopp |
151311 |
--- src/spell.c Thu Nov 20 17:28:01 2008
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 7926,7931 ****
|
|
Karsten Hopp |
151311 |
--- 7926,7933 ----
|
|
Karsten Hopp |
151311 |
char_u *p;
|
|
Karsten Hopp |
151311 |
int rr;
|
|
Karsten Hopp |
151311 |
int retval = OK;
|
|
Karsten Hopp |
151311 |
+ int fwv = 1; /* collect return value of fwrite() to avoid
|
|
Karsten Hopp |
151311 |
+ warnings from picky compiler */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
fd = mch_fopen((char *)fname, "w");
|
|
Karsten Hopp |
151311 |
if (fd == NULL)
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 7936,7946 ****
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* <HEADER>: <fileID> <versionnr> */
|
|
Karsten Hopp |
151311 |
/* <fileID> */
|
|
Karsten Hopp |
151311 |
! if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
|
|
Karsten Hopp |
151311 |
! {
|
|
Karsten Hopp |
151311 |
! EMSG(_(e_write));
|
|
Karsten Hopp |
151311 |
! retval = FAIL;
|
|
Karsten Hopp |
151311 |
! }
|
|
Karsten Hopp |
151311 |
putc(VIMSPELLVERSION, fd); /* <versionnr> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/*
|
|
Karsten Hopp |
151311 |
--- 7938,7944 ----
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* <HEADER>: <fileID> <versionnr> */
|
|
Karsten Hopp |
151311 |
/* <fileID> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
putc(VIMSPELLVERSION, fd); /* <versionnr> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/*
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 7955,7961 ****
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
i = (int)STRLEN(spin->si_info);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_REGION: <regionname> ...
|
|
Karsten Hopp |
151311 |
--- 7953,7959 ----
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
i = (int)STRLEN(spin->si_info);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_REGION: <regionname> ...
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 7966,7972 ****
|
|
Karsten Hopp |
151311 |
putc(SNF_REQUIRED, fd); /* <sectionflags> */
|
|
Karsten Hopp |
151311 |
l = spin->si_region_count * 2;
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
/* <regionname> ... */
|
|
Karsten Hopp |
151311 |
regionmask = (1 << spin->si_region_count) - 1;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
--- 7964,7970 ----
|
|
Karsten Hopp |
151311 |
putc(SNF_REQUIRED, fd); /* <sectionflags> */
|
|
Karsten Hopp |
151311 |
l = spin->si_region_count * 2;
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
/* <regionname> ... */
|
|
Karsten Hopp |
151311 |
regionmask = (1 << spin->si_region_count) - 1;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8016,8022 ****
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
|
|
Karsten Hopp |
151311 |
! fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_MIDWORD: <midword> */
|
|
Karsten Hopp |
151311 |
--- 8014,8020 ----
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_MIDWORD: <midword> */
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8027,8033 ****
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
i = (int)STRLEN(spin->si_midword);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
|
|
Karsten Hopp |
151311 |
--- 8025,8032 ----
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
i = (int)STRLEN(spin->si_midword);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
! /* <midword> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8113,8119 ****
|
|
Karsten Hopp |
151311 |
p = rr == 1 ? ftp->ft_from : ftp->ft_to;
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(p);
|
|
Karsten Hopp |
151311 |
putc(l, fd);
|
|
Karsten Hopp |
151311 |
! fwrite(p, l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
--- 8112,8118 ----
|
|
Karsten Hopp |
151311 |
p = rr == 1 ? ftp->ft_from : ftp->ft_to;
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(p);
|
|
Karsten Hopp |
151311 |
putc(l, fd);
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(p, l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8131,8141 ****
|
|
Karsten Hopp |
151311 |
/* <sectionlen> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(spin->si_sofoto);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_WORDS: <word> ...
|
|
Karsten Hopp |
151311 |
--- 8130,8140 ----
|
|
Karsten Hopp |
151311 |
/* <sectionlen> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(spin->si_sofoto);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* SN_WORDS: <word> ...
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8160,8166 ****
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(hi->hi_key) + 1;
|
|
Karsten Hopp |
151311 |
len += l;
|
|
Karsten Hopp |
151311 |
if (round == 2) /* <word> */
|
|
Karsten Hopp |
151311 |
! fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
--todo;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
if (round == 1)
|
|
Karsten Hopp |
151311 |
--- 8159,8165 ----
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(hi->hi_key) + 1;
|
|
Karsten Hopp |
151311 |
len += l;
|
|
Karsten Hopp |
151311 |
if (round == 2) /* <word> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
--todo;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
if (round == 1)
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8176,8182 ****
|
|
Karsten Hopp |
151311 |
putc(0, fd); /* <sectionflags> */
|
|
Karsten Hopp |
151311 |
l = spin->si_map.ga_len;
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
/* <mapstr> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
--- 8175,8181 ----
|
|
Karsten Hopp |
151311 |
putc(0, fd); /* <sectionflags> */
|
|
Karsten Hopp |
151311 |
l = spin->si_map.ga_len;
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
/* <mapstr> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8232,8241 ****
|
|
Karsten Hopp |
151311 |
{
|
|
Karsten Hopp |
151311 |
p = ((char_u **)(spin->si_comppat.ga_data))[i];
|
|
Karsten Hopp |
151311 |
putc((int)STRLEN(p), fd); /* <comppatlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
/* <compflags> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
|
|
Karsten Hopp |
151311 |
(size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
--- 8231,8241 ----
|
|
Karsten Hopp |
151311 |
{
|
|
Karsten Hopp |
151311 |
p = ((char_u **)(spin->si_comppat.ga_data))[i];
|
|
Karsten Hopp |
151311 |
putc((int)STRLEN(p), fd); /* <comppatlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
! /* <comppattext> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
/* <compflags> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
|
|
Karsten Hopp |
151311 |
(size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8259,8265 ****
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(spin->si_syllable);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* end of <SECTIONS> */
|
|
Karsten Hopp |
151311 |
--- 8259,8266 ----
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
l = (int)STRLEN(spin->si_syllable);
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
|
|
Karsten Hopp |
151311 |
! fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
! /* <syllable> */
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/* end of <SECTIONS> */
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 8295,8307 ****
|
|
Karsten Hopp |
151311 |
(void)put_node(fd, tree, 0, regionmask, round == 3);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
! /* Write another byte to check for errors. */
|
|
Karsten Hopp |
151311 |
if (putc(0, fd) == EOF)
|
|
Karsten Hopp |
151311 |
retval = FAIL;
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
if (fclose(fd) == EOF)
|
|
Karsten Hopp |
151311 |
retval = FAIL;
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
return retval;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
--- 8296,8313 ----
|
|
Karsten Hopp |
151311 |
(void)put_node(fd, tree, 0, regionmask, round == 3);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
! /* Write another byte to check for errors (file system full). */
|
|
Karsten Hopp |
151311 |
if (putc(0, fd) == EOF)
|
|
Karsten Hopp |
151311 |
retval = FAIL;
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
if (fclose(fd) == EOF)
|
|
Karsten Hopp |
151311 |
retval = FAIL;
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
+ if (fwv != 1)
|
|
Karsten Hopp |
151311 |
+ retval = FAIL;
|
|
Karsten Hopp |
151311 |
+ if (retval == FAIL)
|
|
Karsten Hopp |
151311 |
+ EMSG(_(e_write));
|
|
Karsten Hopp |
151311 |
+
|
|
Karsten Hopp |
151311 |
return retval;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 9890,9895 ****
|
|
Karsten Hopp |
151311 |
--- 9896,9902 ----
|
|
Karsten Hopp |
151311 |
char_u *p;
|
|
Karsten Hopp |
151311 |
int len;
|
|
Karsten Hopp |
151311 |
int totlen;
|
|
Karsten Hopp |
151311 |
+ int x = 1; /* collect return value of fwrite() */
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
if (fd != NULL)
|
|
Karsten Hopp |
151311 |
put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 9906,9912 ****
|
|
Karsten Hopp |
151311 |
if (fd != NULL)
|
|
Karsten Hopp |
151311 |
{
|
|
Karsten Hopp |
151311 |
fputc(len, fd);
|
|
Karsten Hopp |
151311 |
! fwrite(p, (size_t)len, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
totlen += len;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
--- 9913,9919 ----
|
|
Karsten Hopp |
151311 |
if (fd != NULL)
|
|
Karsten Hopp |
151311 |
{
|
|
Karsten Hopp |
151311 |
fputc(len, fd);
|
|
Karsten Hopp |
151311 |
! x &= fwrite(p, (size_t)len, (size_t)1, fd);
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
totlen += len;
|
|
Karsten Hopp |
151311 |
}
|
|
Karsten Hopp |
151311 |
*** ../vim-7.2.049/src/version.c Thu Nov 20 17:09:09 2008
|
|
Karsten Hopp |
151311 |
--- src/version.c Fri Nov 28 10:06:13 2008
|
|
Karsten Hopp |
151311 |
***************
|
|
Karsten Hopp |
151311 |
*** 678,679 ****
|
|
Karsten Hopp |
151311 |
--- 678,681 ----
|
|
Karsten Hopp |
151311 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
151311 |
+ /**/
|
|
Karsten Hopp |
151311 |
+ 50,
|
|
Karsten Hopp |
151311 |
/**/
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
--
|
|
Karsten Hopp |
151311 |
You got to work at a mill? Lucky! I got sent back to work in the
|
|
Karsten Hopp |
151311 |
acid-mines for my daily crust of stale bread... which not even the
|
|
Karsten Hopp |
151311 |
birds would eat.
|
|
Karsten Hopp |
151311 |
|
|
Karsten Hopp |
151311 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
151311 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
151311 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
151311 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|