Is there any reason to not declare these variables as unsigned (int)? IIUC strlen returns an unsigned integral. Sign-correctnesd doesn't hurt and I saw many bugs caused by the lack of it (the last one being pushed few says ago in the Chromium beowser). El 1/9/2015 18:41, "Joel Sherrill" <joel.sherr...@oarcorp.com> escribió:
> Updates #2405. > --- > cpukit/libmisc/dumpbuf/dumpbuf.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/cpukit/libmisc/dumpbuf/dumpbuf.c > b/cpukit/libmisc/dumpbuf/dumpbuf.c > index 9d34d42..36a8656 100644 > --- a/cpukit/libmisc/dumpbuf/dumpbuf.c > +++ b/cpukit/libmisc/dumpbuf/dumpbuf.c > @@ -62,18 +62,20 @@ static inline void Dump_Line( > > int i; > char line_buffer[120]; > + int len; > > line_buffer[0] = '\0'; > > for( i=0 ; i<length ; i++ ) > - sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] ); > + sprintf( &line_buffer[i*3], "%02x ", buffer[ i ] ); > > for( ; i<16 ; i++ ) > strcat( line_buffer, " " ); > > strcat( line_buffer, "|" ); > + len = strlen( line_buffer ); > for( i=0 ; i<length ; i++ ) > - sprintf( line_buffer, "%s%c", line_buffer, > + sprintf( &line_buffer[len+i], "%c", > isprint( buffer[ i ] ) ? buffer[ i ] : '.' ); > > for( ; i<16 ; i++ ) > -- > 1.8.3.1 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel