зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305202 - Use NullString() more and remove superfluous Truncates(). r=smaug
This commit is contained in:
Родитель
5d3595ab73
Коммит
ba6cb5196e
|
@ -3574,10 +3574,7 @@ BlobChild::SetMysteryBlobInfo(const nsString& aContentType, uint64_t aLength)
|
||||||
MOZ_ASSERT(mBlobImpl);
|
MOZ_ASSERT(mBlobImpl);
|
||||||
MOZ_ASSERT(mRemoteBlobImpl);
|
MOZ_ASSERT(mRemoteBlobImpl);
|
||||||
|
|
||||||
nsString voidString;
|
mBlobImpl->SetLazyData(NullString(), aContentType, aLength, INT64_MAX);
|
||||||
voidString.SetIsVoid(true);
|
|
||||||
|
|
||||||
mBlobImpl->SetLazyData(voidString, aContentType, aLength, INT64_MAX);
|
|
||||||
|
|
||||||
NormalBlobConstructorParams params(aContentType,
|
NormalBlobConstructorParams params(aContentType,
|
||||||
aLength,
|
aLength,
|
||||||
|
@ -4400,10 +4397,7 @@ BlobParent::RecvResolveMystery(const ResolveMysteryParams& aParams)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsString voidString;
|
mBlobImpl->SetLazyData(NullString(),
|
||||||
voidString.SetIsVoid(true);
|
|
||||||
|
|
||||||
mBlobImpl->SetLazyData(voidString,
|
|
||||||
params.contentType(),
|
params.contentType(),
|
||||||
params.length(),
|
params.length(),
|
||||||
INT64_MAX);
|
INT64_MAX);
|
||||||
|
|
|
@ -70,7 +70,6 @@ nsJSON::Encode(JS::Handle<JS::Value> aValue, JSContext* cx, uint8_t aArgc,
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if (aArgc == 0) {
|
if (aArgc == 0) {
|
||||||
aJSON.Truncate();
|
|
||||||
aJSON.SetIsVoid(true);
|
aJSON.SetIsVoid(true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,6 @@ nsJSON::Encode(JS::Handle<JS::Value> aValue, JSContext* cx, uint8_t aArgc,
|
||||||
rv = NS_OK;
|
rv = NS_OK;
|
||||||
// if we didn't consume anything, it's not JSON, so return null
|
// if we didn't consume anything, it's not JSON, so return null
|
||||||
if (!writer.DidWrite()) {
|
if (!writer.DidWrite()) {
|
||||||
aJSON.Truncate();
|
|
||||||
aJSON.SetIsVoid(true);
|
aJSON.SetIsVoid(true);
|
||||||
} else {
|
} else {
|
||||||
writer.FlushBuffer();
|
writer.FlushBuffer();
|
||||||
|
|
|
@ -253,9 +253,7 @@ inline nsCString
|
||||||
NullableString(const char* aString)
|
NullableString(const char* aString)
|
||||||
{
|
{
|
||||||
if (!aString) {
|
if (!aString) {
|
||||||
nsCString str;
|
return NullCString();
|
||||||
str.SetIsVoid(true);
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
return nsCString(aString);
|
return nsCString(aString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,7 +640,6 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
|
||||||
{
|
{
|
||||||
if (s.isNull() || s.isUndefined()) {
|
if (s.isNull() || s.isUndefined()) {
|
||||||
nsACString* rs = *((nsACString**)d);
|
nsACString* rs = *((nsACString**)d);
|
||||||
rs->Truncate();
|
|
||||||
rs->SetIsVoid(true);
|
rs->SetIsVoid(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,14 +565,12 @@ nsHtml5TreeOperation::AppendDoctypeToDocument(nsIAtom* aName,
|
||||||
// Adapted from nsXMLContentSink
|
// Adapted from nsXMLContentSink
|
||||||
// Create a new doctype node
|
// Create a new doctype node
|
||||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||||
nsAutoString voidString;
|
|
||||||
voidString.SetIsVoid(true);
|
|
||||||
NS_NewDOMDocumentType(getter_AddRefs(docType),
|
NS_NewDOMDocumentType(getter_AddRefs(docType),
|
||||||
aBuilder->GetNodeInfoManager(),
|
aBuilder->GetNodeInfoManager(),
|
||||||
aName,
|
aName,
|
||||||
aPublicId,
|
aPublicId,
|
||||||
aSystemId,
|
aSystemId,
|
||||||
voidString);
|
NullString());
|
||||||
NS_ASSERTION(docType, "Doctype creation failed.");
|
NS_ASSERTION(docType, "Doctype creation failed.");
|
||||||
nsCOMPtr<nsIContent> asContent = do_QueryInterface(docType);
|
nsCOMPtr<nsIContent> asContent = do_QueryInterface(docType);
|
||||||
return AppendToDocument(asContent, aBuilder);
|
return AppendToDocument(asContent, aBuilder);
|
||||||
|
|
|
@ -357,7 +357,6 @@ public:
|
||||||
NS_IMETHOD GetAsAUTF8String(nsACString &_str)
|
NS_IMETHOD GetAsAUTF8String(nsACString &_str)
|
||||||
{
|
{
|
||||||
// Return a void string.
|
// Return a void string.
|
||||||
_str.Truncate(0);
|
|
||||||
_str.SetIsVoid(true);
|
_str.SetIsVoid(true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -365,7 +364,6 @@ public:
|
||||||
NS_IMETHOD GetAsAString(nsAString &_str)
|
NS_IMETHOD GetAsAString(nsAString &_str)
|
||||||
{
|
{
|
||||||
// Return a void string.
|
// Return a void string.
|
||||||
_str.Truncate(0);
|
|
||||||
_str.SetIsVoid(true);
|
_str.SetIsVoid(true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,6 @@ ArgValueArray::GetUTF8String(uint32_t aIndex,
|
||||||
if (::sqlite3_value_type(mArgv[aIndex]) == SQLITE_NULL) {
|
if (::sqlite3_value_type(mArgv[aIndex]) == SQLITE_NULL) {
|
||||||
// NULL columns should have IsVoid set to distinguish them from an empty
|
// NULL columns should have IsVoid set to distinguish them from an empty
|
||||||
// string.
|
// string.
|
||||||
_value.Truncate(0);
|
|
||||||
_value.SetIsVoid(true);
|
_value.SetIsVoid(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -127,7 +126,6 @@ ArgValueArray::GetString(uint32_t aIndex,
|
||||||
if (::sqlite3_value_type(mArgv[aIndex]) == SQLITE_NULL) {
|
if (::sqlite3_value_type(mArgv[aIndex]) == SQLITE_NULL) {
|
||||||
// NULL columns should have IsVoid set to distinguish them from an empty
|
// NULL columns should have IsVoid set to distinguish them from an empty
|
||||||
// string.
|
// string.
|
||||||
_value.Truncate(0);
|
|
||||||
_value.SetIsVoid(true);
|
_value.SetIsVoid(true);
|
||||||
} else {
|
} else {
|
||||||
_value.Assign(static_cast<const char16_t *>(::sqlite3_value_text16(mArgv[aIndex])),
|
_value.Assign(static_cast<const char16_t *>(::sqlite3_value_text16(mArgv[aIndex])),
|
||||||
|
|
|
@ -772,7 +772,6 @@ Statement::GetUTF8String(uint32_t aIndex,
|
||||||
if (type == mozIStorageStatement::VALUE_TYPE_NULL) {
|
if (type == mozIStorageStatement::VALUE_TYPE_NULL) {
|
||||||
// NULL columns should have IsVoid set to distinguish them from the empty
|
// NULL columns should have IsVoid set to distinguish them from the empty
|
||||||
// string.
|
// string.
|
||||||
_value.Truncate(0);
|
|
||||||
_value.SetIsVoid(true);
|
_value.SetIsVoid(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -795,7 +794,6 @@ Statement::GetString(uint32_t aIndex,
|
||||||
if (type == mozIStorageStatement::VALUE_TYPE_NULL) {
|
if (type == mozIStorageStatement::VALUE_TYPE_NULL) {
|
||||||
// NULL columns should have IsVoid set to distinguish them from the empty
|
// NULL columns should have IsVoid set to distinguish them from the empty
|
||||||
// string.
|
// string.
|
||||||
_value.Truncate(0);
|
|
||||||
_value.SetIsVoid(true);
|
_value.SetIsVoid(true);
|
||||||
} else {
|
} else {
|
||||||
const char16_t *value =
|
const char16_t *value =
|
||||||
|
|
|
@ -799,11 +799,9 @@ nsNavBookmarks::InsertSeparator(int64_t aParent,
|
||||||
|
|
||||||
*aNewItemId = -1;
|
*aNewItemId = -1;
|
||||||
// Set a NULL title rather than an empty string.
|
// Set a NULL title rather than an empty string.
|
||||||
nsCString voidString;
|
|
||||||
voidString.SetIsVoid(true);
|
|
||||||
nsAutoCString guid(aGUID);
|
nsAutoCString guid(aGUID);
|
||||||
PRTime dateAdded = RoundedPRNow();
|
PRTime dateAdded = RoundedPRNow();
|
||||||
rv = InsertBookmarkInDB(-1, SEPARATOR, aParent, index, voidString, dateAdded,
|
rv = InsertBookmarkInDB(-1, SEPARATOR, aParent, index, NullCString(), dateAdded,
|
||||||
0, folderGuid, grandParentId, nullptr, aSource,
|
0, folderGuid, grandParentId, nullptr, aSource,
|
||||||
aNewItemId, guid);
|
aNewItemId, guid);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -814,7 +812,7 @@ nsNavBookmarks::InsertSeparator(int64_t aParent,
|
||||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||||
nsINavBookmarkObserver,
|
nsINavBookmarkObserver,
|
||||||
OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR,
|
OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR,
|
||||||
nullptr, voidString, dateAdded, guid, folderGuid,
|
nullptr, NullCString(), dateAdded, guid, folderGuid,
|
||||||
aSource));
|
aSource));
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -766,7 +766,6 @@ nsDiscriminatedUnion::ToString(nsACString& aOutString) const
|
||||||
|
|
||||||
case nsIDataType::VTYPE_VOID:
|
case nsIDataType::VTYPE_VOID:
|
||||||
case nsIDataType::VTYPE_EMPTY:
|
case nsIDataType::VTYPE_EMPTY:
|
||||||
aOutString.Truncate();
|
|
||||||
aOutString.SetIsVoid(true);
|
aOutString.SetIsVoid(true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче