diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2013-12-20 09:29:29 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2013-12-20 09:29:29 +0100 |
commit | a65dd355fb80a05215e15ae97649de52aec885e3 (patch) | |
tree | 81701bb0c6b648630f2bf1729a85d7f5eb49e67b /libio | |
parent | 296a5732f94abe4d5699dc981e4ccfb950b48cee (diff) | |
parent | b4578bab30f72cddd2cf38abfb39f9c8dc892249 (diff) |
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Diffstat (limited to 'libio')
-rw-r--r-- | libio/Makefile | 4 | ||||
-rw-r--r-- | libio/fileops.c | 21 | ||||
-rw-r--r-- | libio/iofwrite.c | 10 | ||||
-rw-r--r-- | libio/iofwrite_u.c | 10 | ||||
-rw-r--r-- | libio/iopadn.c | 2 | ||||
-rw-r--r-- | libio/iowpadn.c | 2 | ||||
-rw-r--r-- | libio/memstream.c | 5 | ||||
-rw-r--r-- | libio/tst-widetext.input | 2 | ||||
-rw-r--r-- | libio/wmemstream.c | 6 |
9 files changed, 32 insertions, 30 deletions
diff --git a/libio/Makefile b/libio/Makefile index e15cd40911..b2f7627434 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -70,7 +70,7 @@ test-srcs = test-freopen all: # Make this the default target; it will be defined in Rules. -ifeq ($(versioning),yes) +ifeq ($(build-shared),yes) routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \ oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \ oldiofsetpos64 @@ -165,7 +165,7 @@ generated = tst-fopenloc.mtrace tst-fopenloc.check aux := fileops genops stdfiles stdio strops -ifeq ($(versioning),yes) +ifeq ($(build-shared),yes) aux += oldfileops oldstdfiles endif diff --git a/libio/fileops.c b/libio/fileops.c index e92f85b243..c58e860c04 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1245,13 +1245,12 @@ _IO_new_file_write (f, data, n) _IO_ssize_t n; { _IO_ssize_t to_do = n; - _IO_ssize_t count = 0; while (to_do > 0) { - count = (__builtin_expect (f->_flags2 - & _IO_FLAGS2_NOTCANCEL, 0) - ? write_not_cancel (f->_fileno, data, to_do) - : write (f->_fileno, data, to_do)); + _IO_ssize_t count = (__builtin_expect (f->_flags2 + & _IO_FLAGS2_NOTCANCEL, 0) + ? write_not_cancel (f->_fileno, data, to_do) + : write (f->_fileno, data, to_do)); if (count < 0) { f->_flags |= _IO_ERR_SEEN; @@ -1263,7 +1262,7 @@ _IO_new_file_write (f, data, n) n -= to_do; if (f->_offset >= 0) f->_offset += n; - return count < 0 ? count : n; + return n; } _IO_size_t @@ -1323,13 +1322,11 @@ _IO_new_file_xsputn (f, data, n) _IO_size_t block_size, do_write; /* Next flush the (full) buffer. */ if (_IO_OVERFLOW (f, EOF) == EOF) - /* If nothing else has to be written or nothing has been written, we - must not signal the caller that the call was even partially - successful. */ - return (to_do == 0 || to_do == n) ? EOF : n - to_do; + /* If nothing else has to be written we must not signal the + caller that everything has been written. */ + return to_do == 0 ? EOF : n - to_do; - /* Try to maintain alignment: write a whole number of blocks. - dont_write is what gets left over. */ + /* Try to maintain alignment: write a whole number of blocks. */ block_size = f->_IO_buf_end - f->_IO_buf_base; do_write = to_do - (block_size >= 128 ? to_do % block_size : 0); diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 81596a64c4..66542eaea5 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -42,12 +42,12 @@ _IO_fwrite (buf, size, count, fp) if (_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1) written = _IO_sputn (fp, (const char *) buf, request); _IO_release_lock (fp); - /* We are guaranteed to have written all of the input, none of it, or - some of it. */ - if (written == request) + /* We have written all of the input in case the return value indicates + this or EOF is returned. The latter is a special case where we + simply did not manage to flush the buffer. But the data is in the + buffer and therefore written as far as fwrite is concerned. */ + if (written == request || written == EOF) return count; - else if (written == EOF) - return 0; else return written / size; } diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c index 4a9d6caa04..18dc6d032d 100644 --- a/libio/iofwrite_u.c +++ b/libio/iofwrite_u.c @@ -44,12 +44,12 @@ fwrite_unlocked (buf, size, count, fp) if (_IO_fwide (fp, -1) == -1) { written = _IO_sputn (fp, (const char *) buf, request); - /* We are guaranteed to have written all of the input, none of it, or - some of it. */ - if (written == request) + /* We have written all of the input in case the return value indicates + this or EOF is returned. The latter is a special case where we + simply did not manage to flush the buffer. But the data is in the + buffer and therefore written as far as fwrite is concerned. */ + if (written == request || written == EOF) return count; - else if (written == EOF) - return 0; } return written / size; diff --git a/libio/iopadn.c b/libio/iopadn.c index cc93c0f7ac..5ebbcf4551 100644 --- a/libio/iopadn.c +++ b/libio/iopadn.c @@ -59,7 +59,7 @@ _IO_padn (fp, pad, count) w = _IO_sputn (fp, padptr, PADSIZE); written += w; if (w != PADSIZE) - return w == EOF ? w : written; + return written; } if (i > 0) diff --git a/libio/iowpadn.c b/libio/iowpadn.c index d94db71f2b..5600f3711c 100644 --- a/libio/iowpadn.c +++ b/libio/iowpadn.c @@ -65,7 +65,7 @@ _IO_wpadn (fp, pad, count) w = _IO_sputn (fp, (char *) padptr, PADSIZE); written += w; if (w != PADSIZE) - return w == EOF ? w : written; + return written; } if (i > 0) diff --git a/libio/memstream.c b/libio/memstream.c index 34534e2f94..3cb1bd7057 100644 --- a/libio/memstream.c +++ b/libio/memstream.c @@ -84,7 +84,10 @@ open_memstream (bufloc, sizeloc) buf = calloc (1, _IO_BUFSIZ); if (buf == NULL) - return NULL; + { + free (new_f); + return NULL; + } _IO_init (&new_f->fp._sf._sbf._f, 0); _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf) = &_IO_mem_jumps; _IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf); diff --git a/libio/tst-widetext.input b/libio/tst-widetext.input index bef07cef3d..b4382c0008 100644 --- a/libio/tst-widetext.input +++ b/libio/tst-widetext.input @@ -126,7 +126,7 @@ Gujarati (U+0A80-U+0AFF): ◌ઁ◌ંઃઅઆઇઈઉઊઋઌઍએઐઑઓઔકખગઘઙચછજઝઞટઠડઢણતથદધનપફબભમયરલળવશષસહ◌઼ઽાિ ી◌ુ◌ૂ◌ૃ◌ૄ◌ૅ◌ે◌ૈૉોૌ◌્ૐૠૡૢૣ૦૧૨૩૪૫૬૭૮૯૰૱ૹૺૻૼ૽૾૿ -Oriya (U+0B00-U+0B7F): +Odia (U+0B00-U+0B7F): ◌ଁଂଃଅଆଇଈଉଊଋଌଏଐଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହ◌଼ଽା◌ି ୀ◌ୁ◌ୂ◌ୃୄେୈୋୌ◌୍୕◌ୖୗଡ଼ଢ଼ୟୠୡୢୣ୦୧୨୩୪୫୬୭୮୯୰ୱ୲୳୴୵୶୷ diff --git a/libio/wmemstream.c b/libio/wmemstream.c index 65738d4d7f..fd7fe44c4c 100644 --- a/libio/wmemstream.c +++ b/libio/wmemstream.c @@ -85,8 +85,10 @@ open_wmemstream (bufloc, sizeloc) buf = calloc (1, _IO_BUFSIZ); if (buf == NULL) - return NULL; - + { + free (new_f); + return NULL; + } _IO_no_init (&new_f->fp._sf._sbf._f, 0, 0, &new_f->wd, &_IO_wmem_jumps); _IO_fwide (&new_f->fp._sf._sbf._f, 1); _IO_wstr_init_static (&new_f->fp._sf._sbf._f, buf, |