# HG changeset patch # User vimboss # Date 1227863331 0 # Node ID 5098908178cdede4656e3f96f2df2847573e6ed9 # Parent a8aae2e1d2ae6c22551400d451e4ecaccceffcd9 updated for version 7.2-050 diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -7926,6 +7926,8 @@ write_vim_spell(spin, fname) char_u *p; int rr; int retval = OK; + int fwv = 1; /* collect return value of fwrite() to avoid + warnings from picky compiler */ fd = mch_fopen((char *)fname, "w"); if (fd == NULL) @@ -7936,11 +7938,7 @@ write_vim_spell(spin, fname) /*
: */ /* */ - if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1) - { - EMSG(_(e_write)); - retval = FAIL; - } + fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); putc(VIMSPELLVERSION, fd); /* */ /* @@ -7955,7 +7953,7 @@ write_vim_spell(spin, fname) i = (int)STRLEN(spin->si_info); put_bytes(fd, (long_u)i, 4); /* */ - fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* */ + fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* */ } /* SN_REGION: ... @@ -7966,7 +7964,7 @@ write_vim_spell(spin, fname) putc(SNF_REQUIRED, fd); /* */ l = spin->si_region_count * 2; put_bytes(fd, (long_u)l, 4); /* */ - fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); + fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); /* ... */ regionmask = (1 << spin->si_region_count) - 1; } @@ -8016,7 +8014,7 @@ write_vim_spell(spin, fname) } put_bytes(fd, (long_u)l, 2); /* */ - fwrite(folchars, (size_t)l, (size_t)1, fd); /* */ + fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* */ } /* SN_MIDWORD: */ @@ -8027,7 +8025,8 @@ write_vim_spell(spin, fname) i = (int)STRLEN(spin->si_midword); put_bytes(fd, (long_u)i, 4); /* */ - fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* */ + fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); + /* */ } /* SN_PREFCOND: ... */ @@ -8113,7 +8112,7 @@ write_vim_spell(spin, fname) p = rr == 1 ? ftp->ft_from : ftp->ft_to; l = (int)STRLEN(p); putc(l, fd); - fwrite(p, l, (size_t)1, fd); + fwv &= fwrite(p, l, (size_t)1, fd); } } @@ -8131,11 +8130,11 @@ write_vim_spell(spin, fname) /* */ put_bytes(fd, (long_u)l, 2); /* */ - fwrite(spin->si_sofofr, l, (size_t)1, fd); /* */ + fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* */ l = (int)STRLEN(spin->si_sofoto); put_bytes(fd, (long_u)l, 2); /* */ - fwrite(spin->si_sofoto, l, (size_t)1, fd); /* */ + fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* */ } /* SN_WORDS: ... @@ -8160,7 +8159,7 @@ write_vim_spell(spin, fname) l = (int)STRLEN(hi->hi_key) + 1; len += l; if (round == 2) /* */ - fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); + fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); --todo; } if (round == 1) @@ -8176,7 +8175,7 @@ write_vim_spell(spin, fname) putc(0, fd); /* */ l = spin->si_map.ga_len; put_bytes(fd, (long_u)l, 4); /* */ - fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); + fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); /* */ } @@ -8232,10 +8231,11 @@ write_vim_spell(spin, fname) { p = ((char_u **)(spin->si_comppat.ga_data))[i]; putc((int)STRLEN(p), fd); /* */ - fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* */ + fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); + /* */ } /* */ - fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), + fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags), (size_t)1, fd); } @@ -8259,7 +8259,8 @@ write_vim_spell(spin, fname) l = (int)STRLEN(spin->si_syllable); put_bytes(fd, (long_u)l, 4); /* */ - fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* */ + fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); + /* */ } /* end of */ @@ -8295,13 +8296,18 @@ write_vim_spell(spin, fname) (void)put_node(fd, tree, 0, regionmask, round == 3); } - /* Write another byte to check for errors. */ + /* Write another byte to check for errors (file system full). */ if (putc(0, fd) == EOF) retval = FAIL; if (fclose(fd) == EOF) retval = FAIL; + if (fwv != 1) + retval = FAIL; + if (retval == FAIL) + EMSG(_(e_write)); + return retval; } @@ -9890,6 +9896,7 @@ write_spell_prefcond(fd, gap) char_u *p; int len; int totlen; + int x = 1; /* collect return value of fwrite() */ if (fd != NULL) put_bytes(fd, (long_u)gap->ga_len, 2); /* */ @@ -9906,7 +9913,7 @@ write_spell_prefcond(fd, gap) if (fd != NULL) { fputc(len, fd); - fwrite(p, (size_t)len, (size_t)1, fd); + x &= fwrite(p, (size_t)len, (size_t)1, fd); } totlen += len; } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 50, +/**/ 49, /**/ 48,