fix last warnings on w64 and turn on w.a.e.
authorbsalomon <bsalomon@google.com>
Mon, 15 Dec 2014 17:13:35 +0000 (09:13 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 15 Dec 2014 17:13:35 +0000 (09:13 -0800)
Review URL: https://codereview.chromium.org/801413002

bench/MemsetBench.cpp
bench/nanobench.cpp
experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp
experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp
gyp/common_variables.gypi
src/device/xps/SkXPSDevice.cpp

index 6a1bd24..3e0e8cd 100644 (file)
@@ -14,8 +14,8 @@ class MemsetBench : public Benchmark {
     SkString    fName;
 
 protected:
-    size_t      fMinSize;
-    size_t      fMaxSize;
+    int      fMinSize;
+    int      fMaxSize;
     enum {
         kBufferSize = 10000,
         VALUE32 = 0x12345678,
@@ -28,12 +28,11 @@ protected:
     };
 
 public:
-    MemsetBench(MemsetType type, size_t minSize, size_t maxSize)  {
+    MemsetBench(MemsetType type, int minSize, int maxSize)  {
         SkASSERT((minSize < maxSize) && (maxSize <= kBufferSize));
         fMinSize = minSize;
         fMaxSize = maxSize;
-        fName.printf("memset%d_" SK_SIZE_T_SPECIFIER "_" SK_SIZE_T_SPECIFIER,
-                     type, minSize, maxSize);
+        fName.printf("memset%d_%d_%d", type, minSize, maxSize);
     }
 
     virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
@@ -60,12 +59,12 @@ private:
 class Memset32Bench : public MemsetBench {
     uint32_t kBuffer[kBufferSize + 3];
 public:
-    Memset32Bench(size_t minSize, size_t maxSize)
+    Memset32Bench(int minSize, int maxSize)
         : INHERITED(MEMSET32, minSize, maxSize) {}
 
 protected:
     virtual void performTest() SK_OVERRIDE {
-        for(size_t j = fMinSize; j < fMaxSize; ++j){
+        for(int j = fMinSize; j < fMaxSize; ++j){
             sk_memset32(kBuffer, VALUE32, j);
             sk_memset32(kBuffer + 1, VALUE32, j);
             sk_memset32(kBuffer + 2, VALUE32, j);
@@ -79,12 +78,12 @@ private:
 class Memset16Bench : public MemsetBench {
     uint16_t kBuffer[kBufferSize + 7];
 public:
-    Memset16Bench(size_t minSize, size_t maxSize)
+    Memset16Bench(int minSize, int maxSize)
         : INHERITED(MEMSET16, minSize, maxSize) {}
 
 protected:
     virtual void performTest() SK_OVERRIDE {
-        for(size_t j = fMinSize; j < fMaxSize; ++j){
+        for(int j = fMinSize; j < fMaxSize; ++j){
             sk_memset16(kBuffer, VALUE16, j);
             sk_memset16(kBuffer + 1, VALUE16, j);
             sk_memset16(kBuffer + 2, VALUE16, j);
index e0d6da8..36a9177 100644 (file)
@@ -525,7 +525,7 @@ public:
             SkString name = SkOSPath::Basename(path.c_str());
             fSourceType = "skp";
             fBenchType  = "recording";
-            fSKPBytes = SkPictureUtils::ApproximateBytesUsed(pic);
+            fSKPBytes = static_cast<double>(SkPictureUtils::ApproximateBytesUsed(pic));
             fSKPOps   = pic->approximateOpCount();
             return SkNEW_ARGS(RecordingBench, (name.c_str(), pic.get(), FLAGS_bbh));
         }
index 2f0c18c..66f3080 100644 (file)
@@ -189,7 +189,7 @@ void SkPdfNativeDoc::loadWithoutXRef() {
                 reset(fObjects.append());
             }
 
-            fObjects[id].fOffset = current - fFileContent;
+            fObjects[id].fOffset = SkToInt(current - fFileContent);
 
             SkPdfNativeObject* obj = fAllocator->allocObject();
             current = nextObject(current, end, obj, fAllocator, this);
index 5dfe14e..5b8ef9b 100644 (file)
@@ -21,7 +21,7 @@
 // There could be 0s between start and end.
 // needle will not contain 0s.
 static char* strrstrk(char* hayStart, char* hayEnd, const char* needle) {
-    int needleLen = strlen(needle);
+    size_t needleLen = strlen(needle);
     if ((isPdfWhiteSpaceOrPdfDelimiter(*(hayStart+needleLen)) || (hayStart+needleLen == hayEnd)) &&
             strncmp(hayStart, needle, needleLen) == 0) {
         return hayStart;
@@ -105,8 +105,8 @@ static const unsigned char* readArray(const unsigned char* start, const unsigned
         // TODO(edisonn): perf/memory: put the variables on the stack, and flush them on the array
         // only when we are sure they are not references!
         if (newObj->isKeywordReference() && array->size() >= 2 &&
-                array->objAtAIndex(array->size() - 1)->isInteger() &&
-                array->objAtAIndex(array->size() - 2)->isInteger()) {
+                array->objAtAIndex(SkToInt(array->size() - 1))->isInteger() &&
+                array->objAtAIndex(SkToInt(array->size() - 2))->isInteger()) {
             SkPdfNativeObject* gen = array->removeLastInArray();
             SkPdfNativeObject* id = array->removeLastInArray();
 
@@ -241,7 +241,7 @@ static const unsigned char* readString(const unsigned char* start, const unsigne
     }
 }
 
-static int readStringLength(const unsigned char* start, const unsigned char* end) {
+static size_t readStringLength(const unsigned char* start, const unsigned char* end) {
     return readString(start, end, NULL) - start;
 }
 
@@ -252,7 +252,7 @@ static const unsigned char* readString(const unsigned char* start, const unsigne
         return end;
     }
 
-    int outLength = readStringLength(start, end);
+    size_t outLength = readStringLength(start, end);
     unsigned char* out = (unsigned char*)allocator->alloc(outLength);
     const unsigned char* now = readString(start, end, out);
     SkPdfNativeObject::makeString(out, out + outLength, str);
@@ -391,7 +391,7 @@ static const unsigned char* readHexString(const unsigned char* start, const unsi
     }
 }
 
-static int readHexStringLength(const unsigned char* start, const unsigned char* end) {
+static size_t readHexStringLength(const unsigned char* start, const unsigned char* end) {
     return readHexString(start, end, NULL) - start;
 }
 
@@ -400,7 +400,7 @@ static const unsigned char* readHexString(const unsigned char* start, const unsi
         // TODO(edisonn): report error/warn/assert
         return end;
     }
-    int outLength = readHexStringLength(start, end);
+    size_t outLength = readHexStringLength(start, end);
     unsigned char* out = (unsigned char*)allocator->alloc(outLength);
     const unsigned char* now = readHexString(start, end, out);
     SkPdfNativeObject::makeHexString(out, out + outLength, str);
@@ -518,7 +518,7 @@ static const unsigned char* readName(const unsigned char* start, const unsigned
     }
 }
 
-static int readNameLength(const unsigned char* start, const unsigned char* end) {
+static size_t readNameLength(const unsigned char* start, const unsigned char* end) {
     return readName(start, end, NULL) - start;
 }
 
@@ -528,7 +528,7 @@ static const unsigned char* readName(const unsigned char* start, const unsigned
         // TODO(edisonn): report error/warn/assert
         return end;
     }
-    int outLength = readNameLength(start, end);
+    size_t outLength = readNameLength(start, end);
     unsigned char* out = (unsigned char*)allocator->alloc(outLength);
     const unsigned char* now = readName(start, end, out);
     SkPdfNativeObject::makeName(out, out + outLength, name);
@@ -671,7 +671,7 @@ static const unsigned char* readInlineImageStream(const unsigned char* start,
     const unsigned char* endEI = endstream ? endstream + 2 : NULL;  // 2 == strlen("EI")
 
     if (endstream) {
-        int length = endstream - start;
+        size_t length = endstream - start;
         if (*(endstream-1) == kLF_PdfWhiteSpace) length--;
         if (*(endstream-2) == kCR_PdfWhiteSpace) length--;
         inlineImage->addStream(start, (size_t)length);
@@ -786,7 +786,7 @@ const unsigned char* nextObject(const unsigned char* start, const unsigned char*
         return end;
     }
 
-    int tokenLen = current - start;
+    size_t tokenLen = current - start;
 
     if (tokenLen == 1) {
         // start array
@@ -922,7 +922,7 @@ SkPdfNativeTokenizer::SkPdfNativeTokenizer(const unsigned char* buffer, int len,
     // but we need to remove this hack for pdfs in the wild
     char* endobj = strrstrk((char*)buffer, (char*)buffer + len, "endobj");
     if (endobj) {
-        len = endobj - (char*)buffer + strlen("endobj");
+        len = SkToInt(endobj - (char*)buffer + strlen("endobj"));
     }
     fUncompressedStreamStart = fUncompressedStream = buffer;
     fUncompressedStreamEnd = fUncompressedStream + len;
index 09d84ec..67b40a5 100644 (file)
     },
 
     'conditions': [
-      [ 'skia_os == "win" and skia_arch_width == 32 or '
-        'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] '
+      [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android", "win"] '
             'and skia_android_framework == 0 or '
         'skia_os == "mac" and skia_arch_width == 32', {
         'skia_warnings_as_errors%': 1,
index 5f24c12..45036b2 100644 (file)
@@ -385,7 +385,7 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) {
         ttcfHeader->numOffsets = SkEndian_SwapBE32(ttcCount);
         SK_OT_ULONG* offsetPtr = SkTAfter<SK_OT_ULONG>(ttcfHeader);
         for (int i = 0; i < ttcCount; ++i, ++offsetPtr) {
-            *offsetPtr = SkEndian_SwapBE32(extra);
+            *offsetPtr = SkEndian_SwapBE32(SkToU32(extra));
         }
 
         // Fix up offsets in sfnt table entries.
@@ -395,7 +395,7 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) {
             SkTAfter<SkSFNTHeader::TableDirectoryEntry>(sfntHeader);
         for (int i = 0; i < numTables; ++i, ++tableDirectory) {
             tableDirectory->offset = SkEndian_SwapBE32(
-                SkEndian_SwapBE32(tableDirectory->offset) + extra);
+                SkToU32(SkEndian_SwapBE32(SkToU32(tableDirectory->offset)) + extra));
         }
     } else {
         extra = 0;
@@ -2074,7 +2074,7 @@ static void text_draw_init(const SkPaint& paint,
                            SkBitSet& glyphsUsed,
                            SkDraw& myDraw, SkXPSDrawProcs& procs) {
     procs.fD1GProc = xps_draw_1_glyph;
-    size_t numGlyphGuess;
+    int numGlyphGuess;
     switch (paint.getTextEncoding()) {
         case SkPaint::kUTF8_TextEncoding:
             numGlyphGuess = SkUTF8_CountUnichars(
@@ -2084,10 +2084,10 @@ static void text_draw_init(const SkPaint& paint,
         case SkPaint::kUTF16_TextEncoding:
             numGlyphGuess = SkUTF16_CountUnichars(
                 static_cast<const uint16_t *>(text),
-                byteLength);
+                SkToInt(byteLength));
             break;
         case SkPaint::kGlyphID_TextEncoding:
-            numGlyphGuess = byteLength / 2;
+            numGlyphGuess = SkToInt(byteLength / 2);
             break;
         default:
             SK_ALWAYSBREAK(true);