BUG: none
TEST: Build GoogleTalk



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@632 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
dmaclach 2010-07-27 23:21:19 +00:00
parent a2d5da4831
commit b5b8051a23

View file

@ -92,17 +92,17 @@ bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str,
} else { } else {
u_int16_t out[2]; u_int16_t out[2];
int out_idx = 0; int out_idx = 0;
// Copy the string character by character // Copy the string character by character
while (length && result) { while (length && result) {
UTF32ToUTF16Char(*str, out); UTF32ToUTF16Char(*str, out);
if (!out[0]) if (!out[0])
return false; return false;
// Process one character at a time // Process one character at a time
--length; --length;
++str; ++str;
// Append the one or two UTF-16 characters. The first one will be non- // Append the one or two UTF-16 characters. The first one will be non-
// zero, but the second one may be zero, depending on the conversion from // zero, but the second one may be zero, depending on the conversion from
// UTF-32. // UTF-32.
@ -127,11 +127,11 @@ bool MinidumpFileWriter::CopyStringToMDString(const char *str,
int conversion_count = UTF8ToUTF16Char(str, length, out); int conversion_count = UTF8ToUTF16Char(str, length, out);
if (!conversion_count) if (!conversion_count)
return false; return false;
// Move the pointer along based on the nubmer of converted characters // Move the pointer along based on the nubmer of converted characters
length -= conversion_count; length -= conversion_count;
str += conversion_count; str += conversion_count;
// Append the one or two UTF-16 characters // Append the one or two UTF-16 characters
int out_count = out[1] ? 2 : 1; int out_count = out[1] ? 2 : 1;
size_t out_size = sizeof(u_int16_t) * out_count; size_t out_size = sizeof(u_int16_t) * out_count;
@ -161,7 +161,7 @@ bool MinidumpFileWriter::WriteStringCore(const CharType *str,
return false; return false;
// Set length excluding the NULL and copy the string // Set length excluding the NULL and copy the string
mdstring.get()->length = mdstring.get()->length =
static_cast<u_int32_t>(mdstring_length * sizeof(u_int16_t)); static_cast<u_int32_t>(mdstring_length * sizeof(u_int16_t));
bool result = CopyStringToMDString(str, mdstring_length, &mdstring); bool result = CopyStringToMDString(str, mdstring_length, &mdstring);
@ -241,10 +241,10 @@ bool MinidumpFileWriter::Copy(MDRVA position, const void *src, ssize_t size) {
// Seek and write the data // Seek and write the data
#if __linux__ #if __linux__
if (sys_lseek(file_, position, SEEK_SET) == position) { if (sys_lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
if (sys_write(file_, src, size) == size) { if (sys_write(file_, src, size) == size) {
#else #else
if (lseek(file_, position, SEEK_SET) == position) { if (lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
if (write(file_, src, size) == size) { if (write(file_, src, size) == size) {
#endif #endif
return true; return true;