This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] swprintf corrections, wcsftime() corrections


     Attached is a patch that fixes the following problems with the
string
forms of the new wide printfs (i.e. swprintf and variants):
 
1)  The addition of the terminating wide null did not work when
    sizeof(wchar_t) > 1.
2)  The return values were incorrectly the same as snprintf when the
    output does not fit into the buffer.  While snprintf returns how
    many characters it would take without indicating an error, swprintf
    (and friends) are supposed to indicate an error with a negative
    return.

     In addition to those repairs, the documentation was adjusted to
match.  Additionally, some extra comments were added to identifty
POSIX extensions.  Since swprintf.c started from sprintf.c, sprintf.c
has
been modified with the same basic enhancements.  Since I was editing the
file, I also changed the code to be more clear (no effective change)
where the terminating nulls are added (which was the likely cause of the
#1 swprintf error, due to the port not being obvious).
     Additionally, fixes to strftime.c are included to make wcsftime()
work correctly given the modified return values from swprintf().  Also,
some changes to the (optional) test vectors were made so that they
work properly on targets with sizeof(wchar_t) > 1.
     ChangeLog entries are in the patch file.
     Corinna:  I know we have the question about "if (ret < EOF)
ptr->_errno = EOVERFLOW;" waiting for Jeff, but since that case seems
impossible to both of us and there is a way for EOVERFLOW to be
signalled there, I went ahead and changed it.  I'll restore it as needed
if Jeff points out something that we missed.
				Craig

Attachment: misc2.patch
Description: misc2.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]