Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2008-11-25 00:27:33 +0300
committerJeff Johnston <jjohnstn@redhat.com>2008-11-25 00:27:33 +0300
commit0aca33c8236bec45e6acc238a1af0c5f2f6f8959 (patch)
tree11e45ea869c4aadf49a65449195e8c7733089321 /newlib
parent0ef912dfc442abcadcc8a6f01c6a6de86a8a2ea9 (diff)
2008-11-24 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/wcstoull_r.c: Add EINVAL return for bad base value, include wchar.h for prototype, remove extraneous includes, use C99/POSIX ULLONG_MAX (but allow for poor limits.h). * libc/stdlib/wcstoull.c: Fix usage comments (mistakes and to add base value check noted above), remove extraneous includes. * libc/stdio/asnprintf.c: Add #include "local.h" to get function prototype for _svfprintf_r(). * libc/stdio/vasnprintf.c: Ditto. * libc/stdio/local.h: Add function prototype for __submore(). * libc/include/stdio.h: Add function prototypes for _fseeko_r and _ftello_r. * libc/posix/namespace.h: Commented out define for write to eliminate write() prototype being missing for collate.c (which is the only file that presently includes namespace.h). * libc/include/reent.h: Added _rename_r. * libc/reent/renamer.c: Corrected function prototypes in synopses. * libc/locale/ldpart.c: Use struct stat64 when calling fstat64.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog20
-rw-r--r--newlib/libc/include/reent.h2
-rw-r--r--newlib/libc/include/stdio.h2
-rw-r--r--newlib/libc/locale/ldpart.c4
-rw-r--r--newlib/libc/posix/namespace.h2
-rw-r--r--newlib/libc/reent/renamer.c9
-rw-r--r--newlib/libc/stdio/local.h1
-rw-r--r--newlib/libc/stdio/vasnprintf.c1
-rw-r--r--newlib/libc/stdlib/wcstoull.c17
-rw-r--r--newlib/libc/stdlib/wcstoull_r.c18
10 files changed, 58 insertions, 18 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 37e1d6e76..01f34774f 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,23 @@
+2008-11-24 Craig Howland <howland@LGSInnovations.com>
+
+ * libc/stdlib/wcstoull_r.c: Add EINVAL return for bad base value,
+ include wchar.h for prototype, remove extraneous includes, use
+ C99/POSIX ULLONG_MAX (but allow for poor limits.h).
+ * libc/stdlib/wcstoull.c: Fix usage comments (mistakes and to add
+ base value check noted above), remove extraneous includes.
+ * libc/stdio/asnprintf.c: Add #include "local.h" to get function
+ prototype for _svfprintf_r().
+ * libc/stdio/vasnprintf.c: Ditto.
+ * libc/stdio/local.h: Add function prototype for __submore().
+ * libc/include/stdio.h: Add function prototypes for _fseeko_r and
+ _ftello_r.
+ * libc/posix/namespace.h: Commented out define for write to
+ eliminate write() prototype being missing for collate.c (which is
+ the only file that presently includes namespace.h).
+ * libc/include/reent.h: Added _rename_r.
+ * libc/reent/renamer.c: Corrected function prototypes in synopses.
+ * libc/locale/ldpart.c: Use struct stat64 when calling fstat64.
+
2008-11-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/search/hash_func.c: Comment out unused static hash functions.
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index dfd0c9a36..9430e7557 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -118,6 +118,7 @@ struct timezone;
#define _lseek_r(__reent, __fdes, __off, __w) lseek(__fdes, __off, __w)
#define _open_r(__reent, __path, __flag, __m) open(__path, __flag, __m)
#define _read_r(__reent, __fd, __buff, __cnt) read(__fd, __buff, __cnt)
+#define _rename_r(__reent, __old, __new) rename(__old, __new)
#define _sbrk_r(__reent, __incr) sbrk(__incr)
#define _stat_r(__reent, __path, __buff) stat(__path, __buff)
#define _times_r(__reent, __time) times(__time)
@@ -147,6 +148,7 @@ extern int _link_r _PARAMS ((struct _reent *, const char *, const char *));
extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int));
extern int _open_r _PARAMS ((struct _reent *, const char *, int, int));
extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t));
+extern int _rename_r _PARAMS ((struct _reent *, const char *, const char *));
extern void *_sbrk_r _PARAMS ((struct _reent *, ptrdiff_t));
extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *));
extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *));
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 1ef102fb7..b62bc851f 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -382,7 +382,9 @@ size_t _EXFUN(_fread_r, (struct _reent *, _PTR, size_t _size, size_t _n, FILE *)
int _EXFUN(_fscanf_r, (struct _reent *, FILE *, const char *, ...)
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
+int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
long _EXFUN(_ftell_r, (struct _reent *, FILE *));
+_off_t _EXFUN(_ftello_r,(struct _reent *, FILE *));
size_t _EXFUN(_fwrite_r, (struct _reent *, const _PTR , size_t _size, size_t _n, FILE *));
int _EXFUN(_getc_r, (struct _reent *, FILE *));
int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
diff --git a/newlib/libc/locale/ldpart.c b/newlib/libc/locale/ldpart.c
index a284b9db2..595532298 100644
--- a/newlib/libc/locale/ldpart.c
+++ b/newlib/libc/locale/ldpart.c
@@ -57,7 +57,11 @@ __part_load_locale(const char *name,
char *p;
const char *plim;
char filename[PATH_MAX];
+#ifdef __USE_INTERNAL_STAT64
+ struct stat64 st;
+#else
struct stat st;
+#endif
size_t namesize;
size_t bufsize;
int save_using_locale;
diff --git a/newlib/libc/posix/namespace.h b/newlib/libc/posix/namespace.h
index 159b8e33c..807349b2d 100644
--- a/newlib/libc/posix/namespace.h
+++ b/newlib/libc/posix/namespace.h
@@ -112,7 +112,7 @@
#define socket _socket
#define socketpair _socketpair
#define wait4 _wait4
-#define write _write
+/*#define write _write*/
#define writev _writev
diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c
index 0467ae93c..4d2d25635 100644
--- a/newlib/libc/reent/renamer.c
+++ b/newlib/libc/reent/renamer.c
@@ -30,15 +30,14 @@ INDEX
ANSI_SYNOPSIS
#include <reent.h>
int _rename_r(struct _reent *<[ptr]>,
- int <[fd]>, int <[cmd]>, <[arg]>);
+ const char *<[old]>, const char *<[new]>);
TRAD_SYNOPSIS
#include <reent.h>
- int _rename_r(<[ptr]>, <[fd]>, <[cmd]>, <[arg]>)
+ int _rename_r(<[ptr]>, <[old]>, <[new]>)
struct _reent *<[ptr]>;
- int <[fd]>;
- int <[cmd]>;
- int <[arg]>;
+ char *<[old]>;
+ char *<[new]>;
DESCRIPTION
This is a reentrant version of <<rename>>. It
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 5dc2e6223..71d579ee0 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -59,6 +59,7 @@ extern _VOID _EXFUN(__smakebuf_r,(struct _reent *, FILE *));
extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *)));
extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *)));
struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
+extern int _EXFUN(__submore, (struct _reent *, FILE *));
#ifdef __LARGE64_FILES
extern _fpos64_t _EXFUN(__sseek64,(struct _reent *, void *, _fpos64_t, int));
diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c
index 2dda30a7a..cab89beff 100644
--- a/newlib/libc/stdio/vasnprintf.c
+++ b/newlib/libc/stdio/vasnprintf.c
@@ -11,6 +11,7 @@
#include <stdarg.h>
#include <limits.h>
#include <errno.h>
+#include "local.h"
char *
_DEFUN(_vasnprintf_r, (ptr, buf, lenp, fmt, ap),
diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c
index 861009b04..76caadf23 100644
--- a/newlib/libc/stdlib/wcstoull.c
+++ b/newlib/libc/stdlib/wcstoull.c
@@ -16,7 +16,7 @@ ANSI_SYNOPSIS
wchar_t **<[ptr]>, int <[base]>);
TRAD_SYNOPSIS
- #include <stdlib.h>
+ #include <wchar.h>
unsigned long long wcstoull(<[s]>, <[ptr]>, <[base]>)
wchar_t *<[s]>;
wchar_t **<[ptr]>;
@@ -40,8 +40,9 @@ to convert the subject string into an unsigned long long integer, and returns th
result.
If the value of <[base]> is zero, the subject string is expected to look
-like a normal C integer constant (save that no optional sign is permitted):
-a possible <<0x>> indicating hexadecimal radix, and a number.
+like a normal C integer constant: an optional sign (<<+>> or <<->>),
+a possible <<0x>> indicating hexadecimal radix or a possible <0> indicating
+octal radix, and a number.
If <[base]> is between 2 and 36, the expected form of the subject is a
sequence of digits (which may include letters, depending on the
base) representing an integer in the radix specified by <[base]>.
@@ -73,10 +74,13 @@ extra argument <[reent]> is a pointer to a reentrancy structure.
RETURNS
+<<wcstoull>> returns <<0>> and sets <<errno>> to <<EINVAL>> if the value of
+<[base]> is not supported.
+
<<wcstoull>> returns the converted value, if any. If no conversion was
made, <<0>> is returned.
-<<wcstoull>> returns <<ULONG_LONG_MAX>> if the magnitude of the converted
+<<wcstoull>> returns <<ULLONG_MAX>> if the magnitude of the converted
value is too large, and sets <<errno>> to <<ERANGE>>.
PORTABILITY
@@ -119,10 +123,7 @@ PORTABILITY
*/
#include <_ansi.h>
-#include <limits.h>
-#include <wctype.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <wchar.h>
#include <reent.h>
#ifndef _REENT_ONLY
diff --git a/newlib/libc/stdlib/wcstoull_r.c b/newlib/libc/stdlib/wcstoull_r.c
index 81dd320d1..abad681a3 100644
--- a/newlib/libc/stdlib/wcstoull_r.c
+++ b/newlib/libc/stdlib/wcstoull_r.c
@@ -45,11 +45,17 @@
#define _GNU_SOURCE
#include <_ansi.h>
#include <limits.h>
+#include <wchar.h>
#include <wctype.h>
#include <errno.h>
-#include <stdlib.h>
#include <reent.h>
+/* Make up for older non-compliant limits.h. (This is a C99/POSIX function,
+ * and both require ULLONG_MAX in limits.h.) */
+#if !defined(ULLONG_MAX)
+# define ULLONG_MAX ULONG_LONG_MAX
+#endif
+
/*
* Convert a wide string to an unsigned long long integer.
*
@@ -69,6 +75,10 @@ _DEFUN (_wcstoull_r, (rptr, nptr, endptr, base),
register unsigned long long cutoff;
register int neg = 0, any, cutlim;
+ if(base < 0 || base == 1 || base > 36) {
+ rptr->_errno = EINVAL;
+ return(0ULL);
+ }
/*
* See strtol for comments as to the logic used.
*/
@@ -88,8 +98,8 @@ _DEFUN (_wcstoull_r, (rptr, nptr, endptr, base),
}
if (base == 0)
base = c == L'0' ? 8 : 10;
- cutoff = (unsigned long long)ULONG_LONG_MAX / (unsigned long long)base;
- cutlim = (unsigned long long)ULONG_LONG_MAX % (unsigned long long)base;
+ cutoff = (unsigned long long)ULLONG_MAX / (unsigned long long)base;
+ cutlim = (unsigned long long)ULLONG_MAX % (unsigned long long)base;
for (acc = 0, any = 0;; c = *s++) {
if (iswdigit(c))
c -= L'0';
@@ -108,7 +118,7 @@ _DEFUN (_wcstoull_r, (rptr, nptr, endptr, base),
}
}
if (any < 0) {
- acc = ULONG_LONG_MAX;
+ acc = ULLONG_MAX;
rptr->_errno = ERANGE;
} else if (neg)
acc = -acc;