Commit df6e53c9 authored by ggaren's avatar ggaren

Reviewed by aliu.

        - Changed CString length from int to size_t. We sould probably do this
        for UString, too. (Darin, if you're reading this: Maciej said so.)
        
        * kjs/function.cpp:
        (KJS::encode):
        * kjs/ustring.cpp:
        (KJS::CString::CString):
        (KJS::operator==):
        * kjs/ustring.h:
        (KJS::CString::size):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 77cb9a9c
2006-06-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by aliu.
- Changed CString length from int to size_t. We sould probably do this
for UString, too. (Darin, if you're reading this: Maciej said so.)
* kjs/function.cpp:
(KJS::encode):
* kjs/ustring.cpp:
(KJS::CString::CString):
(KJS::operator==):
* kjs/ustring.h:
(KJS::CString::size):
2006-06-04 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej.
......
......@@ -569,7 +569,7 @@ static JSValue *encode(ExecState *exec, const List &args, const char *do_not_esc
UString r = "", s, str = args[0]->toString(exec);
CString cstr = str.UTF8String();
const char *p = cstr.c_str();
for (int k = 0; k < cstr.size(); k++, p++) {
for (size_t k = 0; k < cstr.size(); k++, p++) {
char c = *p;
if (c && strchr(do_not_escape, c)) {
r.append(c);
......
......@@ -56,7 +56,7 @@ CString::CString(const char *c)
memcpy(data, c, length + 1);
}
CString::CString(const char *c, int len)
CString::CString(const char *c, size_t len)
{
length = len;
data = new char[len+1];
......@@ -128,7 +128,7 @@ CString &CString::operator=(const CString &str)
bool operator==(const CString& c1, const CString& c2)
{
int len = c1.size();
size_t len = c1.size();
return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0);
}
......
......@@ -150,7 +150,7 @@ namespace KJS {
public:
CString() : data(0), length(0) { }
CString(const char *c);
CString(const char *c, int len);
CString(const char *c, size_t len);
CString(const CString &);
~CString();
......@@ -160,11 +160,11 @@ namespace KJS {
CString &operator=(const CString &);
CString &operator+=(const CString &c) { return append(c); }
int size() const { return length; }
size_t size() const { return length; }
const char *c_str() const { return data; }
private:
char *data;
int length;
size_t length;
};
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment