fix int/size_t warnings in pipe
BUG=skia:
R=scroggo@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/256443002
git-svn-id: http://skia.googlecode.com/svn/trunk@14357 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 297e613a6..82848f8 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -59,7 +59,7 @@
typeface->serialize(&stream);
size_t size = stream.getOffset();
if (writer) {
- writer->write32(size);
+ writer->write32(SkToU32(size));
SkAutoDataUnref data(stream.copyToData());
writer->writePad(data->data(), size);
}
@@ -379,7 +379,7 @@
buffer.setNamedFactoryRecorder(fFactorySet);
buffer.writeBitmap(bm);
this->flattenFactoryNames();
- uint32_t size = buffer.bytesWritten();
+ size_t size = buffer.bytesWritten();
if (this->needOpBytes(size)) {
this->writeOp(kDef_Bitmap_DrawOp, 0, slot);
void* dst = static_cast<void*>(fWriter.reserve(size));
@@ -478,7 +478,7 @@
// Before we wipe out any data that has already been written, read it
// out.
this->doNotify();
- size_t blockSize = SkMax32(MIN_BLOCK_SIZE, needed);
+ size_t blockSize = SkTMax<size_t>(MIN_BLOCK_SIZE, needed);
void* block = fController->requestBlock(blockSize, &fBlockSize);
if (NULL == block) {
// Do not notify the readers, which would call this function again.
@@ -704,7 +704,7 @@
this->writePaint(paint);
if (this->needOpBytes(4 + count * sizeof(SkPoint))) {
this->writeOp(kDrawPoints_DrawOp, mode, 0);
- fWriter.write32(count);
+ fWriter.write32(SkToU32(count));
fWriter.write(pts, count * sizeof(SkPoint));
}
}
@@ -855,7 +855,7 @@
this->writePaint(paint);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 2 * sizeof(SkScalar))) {
this->writeOp(kDrawText_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.writeScalar(x);
fWriter.writeScalar(y);
@@ -871,7 +871,7 @@
int count = paint.textToGlyphs(text, byteLength, NULL);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkPoint))) {
this->writeOp(kDrawPosText_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.write32(count);
fWriter.write(pos, count * sizeof(SkPoint));
@@ -887,7 +887,7 @@
int count = paint.textToGlyphs(text, byteLength, NULL);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkScalar) + 4)) {
this->writeOp(kDrawPosTextH_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.write32(count);
fWriter.write(xpos, count * sizeof(SkScalar));
@@ -910,7 +910,7 @@
if (this->needOpBytes(size)) {
this->writeOp(kDrawTextOnPath_DrawOp, flags, 0);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.writePath(path);
@@ -989,7 +989,7 @@
if (this->needOpBytes(4 + SkAlign4(size))) {
this->writeOp(kDrawData_DrawOp, 0, data);
if (0 == data) {
- fWriter.write32(size);
+ fWriter.write32(SkToU32(size));
}
fWriter.writePad(ptr, size);
}
@@ -1139,7 +1139,7 @@
size_t size = (char*)ptr - (char*)storage;
if (size && this->needOpBytes(size)) {
- this->writeOp(kPaintOp_DrawOp, 0, size);
+ this->writeOp(kPaintOp_DrawOp, 0, SkToU32(size));
fWriter.write(storage, size);
for (size_t i = 0; i < size/4; i++) {
// SkDebugf("[%d] %08X\n", i, storage[i]);
@@ -1159,7 +1159,7 @@
paint.getAnnotation()->writeToBuffer(buffer);
const size_t size = buffer.bytesWritten();
if (this->needOpBytes(size)) {
- this->writeOp(kSetAnnotation_DrawOp, 0, size);
+ this->writeOp(kSetAnnotation_DrawOp, 0, SkToU32(size));
buffer.writeToMemory(fWriter.reserve(size));
}
}