Bug 787730 - Don't assume NULL to be a character; r=ehsan

This commit is contained in:
Jan Beich 2012-09-06 12:53:00 -04:00
parent 48d1c02b1b
commit 9eb6b4f558
2 changed files with 12 additions and 12 deletions

View File

@ -3592,10 +3592,10 @@ bool setSitesWithData(NPObject* npobj, const NPVariant* args, uint32_t argCount,
// Parse out the three tokens into a siteData struct.
const char* siteEnd = strchr(iterator, ':');
*((char*) siteEnd) = NULL;
*((char*) siteEnd) = '\0';
const char* flagsEnd = strchr(siteEnd + 1, ':');
*((char*) flagsEnd) = NULL;
*((char*) next) = NULL;
*((char*) flagsEnd) = '\0';
*((char*) next) = '\0';
siteData data;
data.site = string(iterator);

View File

@ -36,13 +36,13 @@ Spinner::HandleResult(mozIStorageResultSet *aResultSet)
do_check_eq(row->AsDouble(0), 0.0);
uint32_t len = 100;
do_check_eq(row->AsSharedUTF8String(0, &len), NULL);
do_check_eq(row->AsSharedUTF8String(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(row->AsSharedWString(0, &len), NULL);
do_check_eq(row->AsSharedWString(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(row->AsSharedBlob(0, &len), NULL);
do_check_eq(row->AsSharedBlob(0, &len), '\0');
do_check_eq(len, 0);
do_check_eq(row->IsNull(0), true);
@ -69,13 +69,13 @@ test_NULLFallback()
do_check_eq(stmt->AsInt64(0), 0);
do_check_eq(stmt->AsDouble(0), 0.0);
uint32_t len = 100;
do_check_eq(stmt->AsSharedUTF8String(0, &len), NULL);
do_check_eq(stmt->AsSharedUTF8String(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(stmt->AsSharedWString(0, &len), NULL);
do_check_eq(stmt->AsSharedWString(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(stmt->AsSharedBlob(0, &len), NULL);
do_check_eq(stmt->AsSharedBlob(0, &len), '\0');
do_check_eq(len, 0);
do_check_eq(stmt->IsNull(0), true);
@ -83,13 +83,13 @@ test_NULLFallback()
do_check_eq(valueArray->AsInt64(0), 0);
do_check_eq(valueArray->AsDouble(0), 0.0);
len = 100;
do_check_eq(valueArray->AsSharedUTF8String(0, &len), NULL);
do_check_eq(valueArray->AsSharedUTF8String(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(valueArray->AsSharedWString(0, &len), NULL);
do_check_eq(valueArray->AsSharedWString(0, &len), '\0');
do_check_eq(len, 0);
len = 100;
do_check_eq(valueArray->AsSharedBlob(0, &len), NULL);
do_check_eq(valueArray->AsSharedBlob(0, &len), '\0');
do_check_eq(len, 0);
do_check_eq(valueArray->IsNull(0), true);
}