ActorsParent.cpp (basilisk-2021.12.14-source.tar.xz) | : | ActorsParent.cpp (basilisk-2022.01.27-source.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 26309 | skipping to change at line 26309 | |||
uint32_t index = mStoredFileInfos.Length() - 1; | uint32_t index = mStoredFileInfos.Length() - 1; | |||
int64_t data = (uint64_t(flags) << 32) | index; | int64_t data = (uint64_t(flags) << 32) | index; | |||
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("data"), data); | rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("data"), data); | |||
if (NS_WARN_IF(NS_FAILED(rv))) { | if (NS_WARN_IF(NS_FAILED(rv))) { | |||
return rv; | return rv; | |||
} | } | |||
} else { | } else { | |||
nsCString flatCloneData; | AutoTArray<char, 4096> flatCloneData; // 4096 from JSStructuredCloneData | |||
flatCloneData.SetLength(cloneDataSize); | if (!flatCloneData.SetLength(cloneDataSize, fallible)) { | |||
auto iter = cloneData.Start(); | return NS_ERROR_OUT_OF_MEMORY; | |||
cloneData.ReadBytes(iter, flatCloneData.BeginWriting(), cloneDataSize); | } | |||
{ // iter scope | ||||
auto iter = cloneData.Start(); | ||||
MOZ_ALWAYS_TRUE(cloneData.ReadBytes(iter, flatCloneData.Elements(), cloneD | ||||
ataSize)); | ||||
} | ||||
// Compress the bytes before adding into the database. | // Compress the bytes before adding into the database. | |||
const char* uncompressed = flatCloneData.BeginReading(); | const char* uncompressed = flatCloneData.Elements(); | |||
size_t uncompressedLength = cloneDataSize; | size_t uncompressedLength = cloneDataSize; | |||
size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength); | size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength); | |||
UniqueFreePtr<char> compressed( | UniqueFreePtr<char> compressed( | |||
static_cast<char*>(malloc(compressedLength))); | static_cast<char*>(malloc(compressedLength))); | |||
if (NS_WARN_IF(!compressed)) { | if (NS_WARN_IF(!compressed)) { | |||
return NS_ERROR_OUT_OF_MEMORY; | return NS_ERROR_OUT_OF_MEMORY; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 10 lines changed or added |