Bug 837981 - Remove GetDeflatedStringLength(). r=terrence.

--HG--
extra : rebase_source : 7966380110472b6e164c3689378fdbd788d25301
This commit is contained in:
Nicholas Nethercote 2013-02-05 15:12:05 -08:00
Родитель 88e94604ab
Коммит 373e7a6d2c
4 изменённых файлов: 3 добавлений и 13 удалений

Просмотреть файл

@ -6142,7 +6142,7 @@ JS_GetStringEncodingLength(JSContext *cx, JSString *str)
const jschar *chars = str->getChars(cx);
if (!chars)
return size_t(-1);
return GetDeflatedStringLength(cx, chars, str->length());
return str->length();
}
JS_PUBLIC_API(size_t)
@ -6165,7 +6165,7 @@ JS_EncodeStringToBuffer(JSContext *cx, JSString *str, char *buffer, size_t lengt
return writtenLength;
}
JS_ASSERT(writtenLength <= length);
size_t necessaryLength = GetDeflatedStringLength(NULL, chars, str->length());
size_t necessaryLength = str->length();
if (necessaryLength == size_t(-1))
return size_t(-1);
JS_ASSERT(writtenLength == length); // C strings are NOT encoded.

Просмотреть файл

@ -871,7 +871,7 @@ Sprinter::putString(JSString *s)
if (!chars)
return -1;
size_t size = GetDeflatedStringLength(context, chars, length);
size_t size = length;
if (size == (size_t) -1)
return -1;

Просмотреть файл

@ -3895,12 +3895,6 @@ js::InflateUTF8String(JSContext *cx, const char *bytes, size_t *lengthp)
return NULL;
}
size_t
js::GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars)
{
return nchars;
}
bool
js::DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
char *dst, size_t *dstlenp)

Просмотреть файл

@ -247,10 +247,6 @@ extern bool
InflateUTF8StringToBuffer(JSContext *cx, const char *bytes, size_t length,
jschar *chars, size_t *charsLength);
/* Get number of bytes in the deflated sequence of characters. */
extern size_t
GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t charsLength);
/*
* Deflate JS chars to bytes into a buffer. 'bytes' must be large enough for
* 'length chars. The buffer is NOT null-terminated. The destination length