From: bsalomon@google.com Date: Thu, 3 Feb 2011 21:30:17 +0000 (+0000) Subject: Fix warnings on linux build (strict aliasing, cons init order, vars used only in... X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~19009 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1962832771a435426a0ed6a1cf5069c45918b141;p=platform%2Fupstream%2FlibSkiaSharp.git Fix warnings on linux build (strict aliasing, cons init order, vars used only in asserts) git-svn-id: http://skia.googlecode.com/svn/trunk@756 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/gpu/src/GrDrawTarget.cpp b/gpu/src/GrDrawTarget.cpp index 96afe2f..0f31e9a 100644 --- a/gpu/src/GrDrawTarget.cpp +++ b/gpu/src/GrDrawTarget.cpp @@ -243,13 +243,17 @@ void GrDrawTarget::VertexLayoutUnitTest() { GrAssert(!VertexUsesStage(s2, tcMask)); GrAssert(-1 == VertexTexCoordsForStage(s2, tcMask)); + #if GR_DEBUG GrVertexLayout posAsTex = tcMask | StagePosAsTexCoordVertexLayoutBit(s2); + #endif GrAssert(0 == VertexStageCoordOffset(s2, posAsTex)); GrAssert(VertexUsesStage(s2, posAsTex)); GrAssert(2*sizeof(GrPoint) == VertexSize(posAsTex)); GrAssert(-1 == VertexTexCoordsForStage(s2, posAsTex)); } + #if GR_DEBUG GrVertexLayout withColor = tcMask | kColor_VertexLayoutBit; + #endif GrAssert(2*sizeof(GrPoint) == VertexColorOffset(withColor)); GrAssert(2*sizeof(GrPoint) + sizeof(GrColor) == VertexSize(withColor)); } diff --git a/gpu/src/GrGLUtil.cpp b/gpu/src/GrGLUtil.cpp index 360e84e..a8f06ba 100644 --- a/gpu/src/GrGLUtil.cpp +++ b/gpu/src/GrGLUtil.cpp @@ -15,6 +15,7 @@ */ #include "GrGLConfig.h" +#include "GrTypes.h" #include bool has_gl_extension(const char* ext) { @@ -74,11 +75,11 @@ void gl_version(int* major, int* minor) { typedef void (*glProc)(void); #define GET_PROC(EXT_STRUCT, PROC_NAME) \ - *((glProc*) &(EXT_STRUCT-> PROC_NAME)) = (glProc) GR_GL_PROC_ADDRESS((gl ## PROC_NAME)); \ + *(GrTCast(&(EXT_STRUCT-> PROC_NAME))) = (glProc)GR_GL_PROC_ADDRESS((gl ## PROC_NAME)); \ GrAssert(NULL != EXT_STRUCT-> PROC_NAME) #define GET_SUFFIX_PROC(EXT_STRUCT, PROC_NAME, SUFFIX) \ - *((glProc*) &(EXT_STRUCT-> PROC_NAME)) = (glProc) GR_GL_PROC_ADDRESS((gl ## PROC_NAME ## SUFFIX)); \ + *(GrTCast(&(EXT_STRUCT-> PROC_NAME))) = (glProc)GR_GL_PROC_ADDRESS((gl ## PROC_NAME ## SUFFIX)); \ GrAssert(NULL != EXT_STRUCT-> PROC_NAME) extern void GrGLInitExtensions(GrGLExts* exts) { diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 5059569..cc7cb7b 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -465,8 +465,8 @@ public: dstPosition->fY = SkScalarToGrScalar(fPoints[i].fY); } private: - int fCount; const SkPoint* fPoints; + int fCount; }; class SkTexCoordSource { @@ -506,8 +506,8 @@ public: } private: - int fCount; const uint16_t* fIndices; + int fCount; }; ///////////////////////////////////////////////////////////////////////////////