synced with sh_string.h

This commit is contained in:
Borja Ferrer 2005-11-15 20:21:29 +00:00
parent 79c4d0ca5c
commit db77e12615

View File

@ -66,7 +66,7 @@ public:
return ret; return ret;
} }
String(String &src) String(const String &src)
{ {
v = NULL; v = NULL;
a_size = 0; a_size = 0;
@ -148,13 +148,13 @@ public:
int find(const char c, int index = 0) int find(const char c, int index = 0)
{ {
size_t len = size(); int len = static_cast<int>(size());
if (len < 1) if (len < 1)
return npos; return npos;
if (index >= (int)len || index < 0) if (index >= len || index < 0)
return npos; return npos;
unsigned int i = 0; int i = 0;
for (i=index; i<(int)len; i++) for (i=index; i<len; i++)
{ {
if (v[i] == c) if (v[i] == c)
{ {
@ -247,7 +247,7 @@ public:
unsigned int i = 0; unsigned int i = 0;
size_t len = size(); size_t len = size();
//check for bounds //check for bounds
if (num == npos || start+num > len-num+1) if (num == npos || start+num > len-start)
num = len - start; num = len - start;
//do the erasing //do the erasing
bool copyflag = false; bool copyflag = false;
@ -297,7 +297,7 @@ public:
num = len - index; num = len - index;
} }
unsigned int i = 0, j=0; unsigned int i = 0;
unsigned int nslen = num + 2; unsigned int nslen = num + 2;
ns.Grow(nslen); ns.Grow(nslen);