diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2008-07-07 15:51:55 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2008-07-07 15:51:55 +0000 |
commit | 2adedff8b325c10f7efe8a3f4881ed92751eb939 (patch) | |
tree | c7817e64d23ef86da7a79958f045ae859eb1fde7 | |
parent | 6f6b4e11cbaa9eeea5c8375cb97b789336550629 (diff) | |
download | cygnal-2adedff8b325c10f7efe8a3f4881ed92751eb939.tar.gz cygnal-2adedff8b325c10f7efe8a3f4881ed92751eb939.tar.bz2 cygnal-2adedff8b325c10f7efe8a3f4881ed92751eb939.zip |
2008-07-07 Hans-Peter Nilsson <hp@axis.com>
* libc/machine/mips/strncpy.c: Include stdint.h to get uintptr_t.
(strncpy): Cast src to uintptr_t before checking alignment with "&".
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/machine/mips/strncpy.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 820ef098f..5f6203037 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2008-07-07 Hans-Peter Nilsson <hp@axis.com> + + * libc/machine/mips/strncpy.c: Include stdint.h to get uintptr_t. + (strncpy): Cast src to uintptr_t before checking alignment with "&". + 2008-07-02 Jeff Johnston <jjohnstn@redhat.com> * libc/argz/argz_count.c: Include stddef.h to get size_t. diff --git a/newlib/libc/machine/mips/strncpy.c b/newlib/libc/machine/mips/strncpy.c index 324c45209..47413cb7c 100644 --- a/newlib/libc/machine/mips/strncpy.c +++ b/newlib/libc/machine/mips/strncpy.c @@ -18,6 +18,7 @@ #include <string.h> #include <stddef.h> #include <stdlib.h> +#include <stdint.h> #if !defined(__GNUC__) || (__GNUC__ < 3) #define __builtin_expect(a,b) a @@ -88,7 +89,7 @@ strncpy (char *dst0, const char *src0, size_t count) * a segfault for the case where the source pointer is unaligned, * the null terminator is in valid memory, but reading 2 or 4 bytes at a * time blindly eventually goes outside of valid memory. */ - while ((src & (UNROLL_FACTOR - 1)) != 0 && count > 0) + while (((uintptr_t) src & (UNROLL_FACTOR - 1)) != 0 && count > 0) { *dst++ = ch = *src++; --count; |