Ignore:
Timestamp:
Mar 12, 2008, 9:08:18 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.28a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/lib/util_str.c

    r60 r124  
    395395**/
    396396
    397 void string_replace( pstring s, char oldc, char newc )
     397/**
     398 String replace.
     399 NOTE: oldc and newc must be 7 bit characters
     400**/
     401void string_replace( char *s, char oldc, char newc )
    398402{
    399403        char *p;
     
    407411                if (*p & 0x80) /* mb string - slow path. */
    408412                        break;
    409                 if (*p == oldc)
     413                if (*p == oldc) {
    410414                        *p = newc;
     415                }
    411416        }
    412417
     
    419424        p = s;
    420425#endif
    421         push_ucs2(NULL, tmpbuf, p, sizeof(tmpbuf), STR_TERMINATE);
    422         string_replace_w(tmpbuf, UCS2_CHAR(oldc), UCS2_CHAR(newc));
    423         pull_ucs2(NULL, p, tmpbuf, -1, sizeof(tmpbuf), STR_TERMINATE);
     426
     427        while (*p) {
     428                size_t c_size;
     429                next_codepoint(p, &c_size);
     430
     431                if (c_size == 1) {
     432                        if (*p == oldc) {
     433                                *p = newc;
     434                        }
     435                }
     436                p += c_size;
     437        }
    424438}
    425439
Note: See TracChangeset for help on using the changeset viewer.