vectors are cleared with "clear()", not with "empty()

A=thakis@chromium.org
R=thestig@chromium.org

Original code review: https://breakpad.appspot.com/377003/
Review URL: https://breakpad.appspot.com/380001

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@949 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
thestig@chromium.org 2012-04-11 03:47:07 +00:00
parent a66d4b272a
commit 88ccbb4804

View file

@ -42,7 +42,7 @@ void UTF8ToUTF16(const char *in, vector<u_int16_t> *out) {
const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in); const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
const UTF8 *source_end_ptr = source_ptr + source_length; const UTF8 *source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size // Erase the contents and zero fill to the expected size
out->empty(); out->clear();
out->insert(out->begin(), source_length, 0); out->insert(out->begin(), source_length, 0);
u_int16_t *target_ptr = &(*out)[0]; u_int16_t *target_ptr = &(*out)[0];
u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t); u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t);
@ -86,7 +86,7 @@ void UTF32ToUTF16(const wchar_t *in, vector<u_int16_t> *out) {
const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(in); const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(in);
const UTF32 *source_end_ptr = source_ptr + source_length; const UTF32 *source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size // Erase the contents and zero fill to the expected size
out->empty(); out->clear();
out->insert(out->begin(), source_length, 0); out->insert(out->begin(), source_length, 0);
u_int16_t *target_ptr = &(*out)[0]; u_int16_t *target_ptr = &(*out)[0];
u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t); u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t);