summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectsetname.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-28 23:00:20 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-28 23:00:20 +0000
commit6fd4d06f395cefdebe2a8e5c02c89e7792ae9a25 (patch)
treef3353a761a7ece94c0bcc4b73b6177622dd8f413 /cpukit/score/src/objectsetname.c
parent2009-09-28 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-6fd4d06f395cefdebe2a8e5c02c89e7792ae9a25.tar.bz2
2009-09-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/objectidtoname.c: Remove error which cannot be reached since API that calls this checks the error first. * score/src/objectsetname.c: Adjust handling of length.
Diffstat (limited to 'cpukit/score/src/objectsetname.c')
-rw-r--r--cpukit/score/src/objectsetname.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
index b7e01102ca..dfc44f18ba 100644
--- a/cpukit/score/src/objectsetname.c
+++ b/cpukit/score/src/objectsetname.c
@@ -37,13 +37,13 @@ bool _Objects_Set_name(
const char *s;
s = name;
- length = strnlen( name, information->name_length ) + 1;
+ length = strnlen( name, information->name_length );
#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
if ( information->is_string ) {
char *d;
- d = _Workspace_Allocate( length );
+ d = _Workspace_Allocate( length + 1 );
if ( !d )
return false;
@@ -58,10 +58,10 @@ bool _Objects_Set_name(
#endif
{
the_object->name.name_u32 = _Objects_Build_name(
- ((0<length) ? s[ 0 ] : ' '),
- ((1<length) ? s[ 1 ] : ' '),
- ((2<length) ? s[ 2 ] : ' '),
- ((3<length) ? s[ 3 ] : ' ')
+ ((0 <= length) ? s[ 0 ] : ' '),
+ ((1 < length) ? s[ 1 ] : ' '),
+ ((2 < length) ? s[ 2 ] : ' '),
+ ((3 < length) ? s[ 3 ] : ' ')
);
}