From fb54d97e286629bf4724f49ed34d10f0782b8eea Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Thu, 23 Oct 2003 06:29:27 +0000 Subject: [PATCH] 2003-10-23 10:30 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 4 ++++ harbour/source/rtl/strcase.c | 26 +++++++++++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d480bab79d..50127bee48 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,10 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-10-23 10:30 UTC+0300 Alexander Kresin + * source/rtl/strcase.c + ! hb_strncpyUpper() and hb_strncpyUpperTrim() fixed. + 2003-10-22 9:49 UTC-0800 Luis Krause Mantilla * makefile.bc * $(OBJ_DIR)\msgsrwin.obj added to LANG.LIB dependencies section. diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index 3bdaa7802d..2e75af5031 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -103,7 +103,7 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] ='\0'; - /* some compilers impliment toupper as a macro, and this has side effects! */ + /* some compilers implements toupper as a macro, and this has side effects! */ /* *pDest++ = toupper( *pSource++ ); */ while( ulLen && (*pDest++ = toupper( *pSource ))) { @@ -111,15 +111,13 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ) pSource++; } - if( ulLen ) - { - while (--ulLen) - { - *pDest++ = '\0'; - } - } + while( ulLen > 0 ) + { + *pDest++ = '\0'; + ulLen--; + } - return pBuf; + return pBuf; } /* This function copies and converts szText to upper case AND Trims it @@ -138,7 +136,7 @@ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen ) ulSLen--; } - /* some compilers impliment toupper as a macro, and this has side effects! */ + /* some compilers implements toupper as a macro, and this has side effects! */ /* *pDest++ = toupper( *pSource++ ); */ while( ulLen && ulSLen && (*pDest++ = toupper( *pSource ))) { @@ -147,12 +145,10 @@ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen ) pSource++; } - if( ulLen ) + while( ulLen > 0 ) { - while (--ulLen) - { - *pDest++ = '\0'; - } + *pDest++ = '\0'; + ulLen--; } return pBuf;