www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000289

When Created: 06/12/1999 11:00:12
Against DJGPP version: 2.02
By whom: vfg@servidor.unam.mx
Abstract: strlwr and strupr dont work correctly when string contains extended ascii codes like ,, etc.
strlwr and strupr dont work correctly when string contains extended ascii codes like ,,, etc., wich you need in spanish. I extracted de 2.01 versions of this functions and patch the 2.02 libc, and avery thing worked fine.

Note added: 06/14/1999 04:00:50
By whom: eliz@is.elta.co.il
This bug appeared in v2.02 because the ctype macros, including
toupper and tolower, no longer AND their argument with 0xff (the
latter doesn't work with EOF), and because 8-bit characters are
sign-extended to negative values when converted to an int.

Solution added: 06/14/1999 04:00:25
By whom: eliz@is.elta.co.il
Apply the following patch to strlwr.c and strupr.c; this is fixed in CVS
and will be in v2.03.
*** src/libc/compat/string/strlwr.c~0   Sat Mar 11 22:53:40 1995                
--- src/libc/compat/string/strlwr.c     Sun Jun 13 18:33:32 1999                
*************** strlwr(char *_s)                                                
*** 8,14 ****                                                                   
    char *rv = _s;                                                              
    while (*_s)                                                                 
    {                                                                           
!     *_s = tolower(*_s);                                                       
      _s++;                                                                     
    }                                                                           
    return rv;                                                                  
--- 8,14 ----                                                                   
    char *rv = _s;                                                              
    while (*_s)                                                                 
    {                                                                           
!     *_s = tolower((unsigned char)*_s);                                      
      _s++;                                                                     
    }                                                                           
    return rv;                                                                  
*** src/libc/compat/string/strupr.c~0   Sat Mar 11 22:53:48 1995                
--- src/libc/compat/string/strupr.c     Sun Jun 13 18:36:52 1999                
*************** strupr(char *_s)                                                
*** 8,14 ****                                                                   
    char *rv = _s;                                                              
    while (*_s)                                                                 
    {                                                                           
!     *_s = toupper(*_s);                                                       
      _s++;                                                                     
    }                                                                           
    return rv;                                                                  
--- 8,14 ----                                                                   
    char *rv = _s;                                                              
    while (*_s)                                                                 
    {                                                                           
!     *_s = toupper((unsigned char)*_s);                                      
      _s++;                                                                     
    }                                                                           
    return rv;

Fixed in version on 06/14/1999 04:00:02
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010