return void* instead of char* from alignedBytes
Not as many casts needed to use this.
Change-Id: I871b5f3f9658d349d08d396f2cb8ec5498c3b50b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375061
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index f662da1..910bd3b 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -1566,7 +1566,7 @@
: fBlockStart{startOfBlock}
, fPrevious{reinterpret_cast<Block*>(previous)} {}
-char* GrBagOfBytes::alignedBytes(int size, int alignment) {
+void* GrBagOfBytes::alignedBytes(int size, int alignment) {
SkASSERT_RELEASE(0 < size && size < kMaxByteSize);
SkASSERT_RELEASE(0 < alignment && alignment <= kMaxAlignment);
SkASSERT_RELEASE(SkIsPow2(alignment));
@@ -1606,6 +1606,6 @@
GrSubRunAllocator::GrSubRunAllocator(int firstHeapAllocation)
: GrSubRunAllocator(nullptr, 0, firstHeapAllocation) {}
-char* GrSubRunAllocator::alignedBytes(int unsafeSize, int unsafeAlignment) {
+void* GrSubRunAllocator::alignedBytes(int unsafeSize, int unsafeAlignment) {
return fAlloc.alignedBytes(unsafeSize, unsafeAlignment);
}
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 28aa46f..80998a7 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -106,7 +106,7 @@
return this->allocateBytes(size, alignof(T));
}
- char* alignedBytes(int unsafeSize, int unsafeAlignment);
+ void* alignedBytes(int unsafeSize, int unsafeAlignment);
private:
// 16 seems to be a good number for alignment. If a use case for larger alignments is found,
@@ -236,7 +236,7 @@
return std::unique_ptr<T[], ArrayDestroyer>{array, ArrayDestroyer{n}};
}
- char* alignedBytes(int size, int alignment);
+ void* alignedBytes(int size, int alignment);
private:
GrBagOfBytes fAlloc;
diff --git a/tests/GrTextBlobTest.cpp b/tests/GrTextBlobTest.cpp
index 3eac52f..eb20895 100644
--- a/tests/GrTextBlobTest.cpp
+++ b/tests/GrTextBlobTest.cpp
@@ -316,7 +316,7 @@
{
GrSubRunAllocator arena(4096);
- char* ptr = arena.alignedBytes(4081, 8);
+ void* ptr = arena.alignedBytes(4081, 8);
REPORTER_ASSERT(r, ((intptr_t)ptr & 7) == 0);
}
}