Explicitly cast ints in SkSTArray.

The compiler can complain about these signed to unsigned conversions.
Explicitly cast them in initWithPreallocatedStorage to match the way
this is already done in init [0].

[0] 311b648013 "pack SkTArray"

Change-Id: I0f723094fd356f9c5971b35998c4ecd59c09332f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536099
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2022-05-02 14:55:21 -04:00 committed by SkCQ
parent 432f28c149
commit e54df3563d

View File

@ -478,15 +478,15 @@ private:
SkASSERT(count >= 0); SkASSERT(count >= 0);
SkASSERT(preallocCount > 0); SkASSERT(preallocCount > 0);
SkASSERT(preallocStorage); SkASSERT(preallocStorage);
fCount = count; fCount = SkToU32(count);
fItemArray = nullptr; fItemArray = nullptr;
fReserved = false; fReserved = false;
if (count > preallocCount) { if (count > preallocCount) {
fAllocCount = std::max(count, kMinHeapAllocCount); fAllocCount = SkToU32(std::max(count, kMinHeapAllocCount));
fItemArray = (T*)sk_malloc_throw(fAllocCount, sizeof(T)); fItemArray = (T*)sk_malloc_throw(fAllocCount, sizeof(T));
fOwnMemory = true; fOwnMemory = true;
} else { } else {
fAllocCount = preallocCount; fAllocCount = SkToU32(preallocCount);
fItemArray = (T*)preallocStorage; fItemArray = (T*)preallocStorage;
fOwnMemory = false; fOwnMemory = false;
} }