@@ -150,13 +150,13 @@ unsigned char String::changeBuffer(unsigned int maxStrLen)
150
150
/* Copy and Move */
151
151
/* ********************************************/
152
152
153
- String & String::copy (const char *cstr, unsigned int _length )
153
+ String & String::copy (const char *cstr, unsigned int length )
154
154
{
155
- if (!reserve (_length )) {
155
+ if (!reserve (length )) {
156
156
invalidate ();
157
157
return *this ;
158
158
}
159
- len = _length ;
159
+ len = length ;
160
160
strcpy (buffer, cstr);
161
161
return *this ;
162
162
}
@@ -224,11 +224,11 @@ unsigned char String::concat(const String &s)
224
224
return concat (s.buffer , s.len );
225
225
}
226
226
227
- unsigned char String::concat (const char *cstr, unsigned int _length )
227
+ unsigned char String::concat (const char *cstr, unsigned int length )
228
228
{
229
- unsigned int newlen = len + _length ;
229
+ unsigned int newlen = len + length ;
230
230
if (!cstr) return 0 ;
231
- if (_length == 0 ) return 1 ;
231
+ if (length == 0 ) return 1 ;
232
232
if (!reserve (newlen)) return 0 ;
233
233
strcpy (buffer + len, cstr);
234
234
len = newlen;
@@ -549,33 +549,33 @@ String String::substring(unsigned int left, unsigned int right) const
549
549
/* Modification */
550
550
/* ********************************************/
551
551
552
- void String::replace (char find, char _replace )
552
+ void String::replace (char find, char replace )
553
553
{
554
554
if (!buffer) return ;
555
555
for (char *p = buffer; *p; p++) {
556
- if (*p == find) *p = _replace ;
556
+ if (*p == find) *p = replace ;
557
557
}
558
558
}
559
559
560
- void String::replace (const String& find, const String& _replace )
560
+ void String::replace (const String& find, const String& replace )
561
561
{
562
562
if (len == 0 || find.len == 0 ) return ;
563
- int diff = _replace .len - find.len ;
563
+ int diff = replace .len - find.len ;
564
564
char *readFrom = buffer;
565
565
char *foundAt;
566
566
if (diff == 0 ) {
567
567
while ((foundAt = strstr (readFrom, find.buffer )) != NULL ) {
568
- memcpy (foundAt, _replace .buffer , _replace .len );
569
- readFrom = foundAt + _replace .len ;
568
+ memcpy (foundAt, replace .buffer , replace .len );
569
+ readFrom = foundAt + replace .len ;
570
570
}
571
571
} else if (diff < 0 ) {
572
572
char *writeTo = buffer;
573
573
while ((foundAt = strstr (readFrom, find.buffer )) != NULL ) {
574
574
unsigned int n = foundAt - readFrom;
575
575
memcpy (writeTo, readFrom, n);
576
576
writeTo += n;
577
- memcpy (writeTo, _replace .buffer , _replace .len );
578
- writeTo += _replace .len ;
577
+ memcpy (writeTo, replace .buffer , replace .len );
578
+ writeTo += replace .len ;
579
579
readFrom = foundAt + find.len ;
580
580
len += diff;
581
581
}
@@ -594,7 +594,7 @@ void String::replace(const String& find, const String& _replace)
594
594
memmove (readFrom + diff, readFrom, len - (readFrom - buffer));
595
595
len += diff;
596
596
buffer[len] = 0 ;
597
- memcpy (buffer + index , _replace .buffer , _replace .len );
597
+ memcpy (buffer + index , replace .buffer , replace .len );
598
598
index --;
599
599
}
600
600
}
0 commit comments