diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2006-12-04 17:29:10 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2006-12-04 17:29:10 +0000 |
commit | 489bb390ceff00454f0f904c8c96cd39405918c6 (patch) | |
tree | 772109c661eb69e3807c35ea9ebfa152c1060d1c | |
parent | 3e2d7a911f66c4c274035daaae8295225c7a7065 (diff) | |
download | cygnal-489bb390ceff00454f0f904c8c96cd39405918c6.tar.gz cygnal-489bb390ceff00454f0f904c8c96cd39405918c6.tar.bz2 cygnal-489bb390ceff00454f0f904c8c96cd39405918c6.zip |
2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp>
* libc/machine/spu/strncpy.c: Add padding.
-rw-r--r-- | newlib/ChangeLog | 4 | ||||
-rw-r--r-- | newlib/libc/machine/spu/strncpy.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 119c0a6be..4be46540d 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,9 @@ 2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp> + * libc/machine/spu/strncpy.c: Add padding. + +2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp> + * testsuite/newlib.string/tstring.c: 2006-12-01 Kazunori Asayama <asayama@sm.sony.co.jp> diff --git a/newlib/libc/machine/spu/strncpy.c b/newlib/libc/machine/spu/strncpy.c index 5e6169f32..334c3bb6c 100644 --- a/newlib/libc/machine/spu/strncpy.c +++ b/newlib/libc/machine/spu/strncpy.c @@ -76,6 +76,11 @@ char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n */ len = spu_extract(spu_sel(spu_promote((unsigned int)len, 0), N, gt), 0); + /* Padding + */ + if (len != n) { + memset(dest + len, 0, n - len); + } /* Perform a memcpy of the resulting length */ return ((char *)memcpy((void *)dest, (const void *)src, len)); |