From b0986091868f928b5e09c1a7f51654e102bf5f54 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 12 Aug 2015 22:17:27 +0200 Subject: Fix various compiler warnings. --- source/blender/blenlib/BLI_alloca.h | 5 +++ source/blender/blenlib/BLI_math_inline.h | 4 +- source/blender/blenlib/BLI_utildefines.h | 4 +- source/blender/blenlib/intern/BLI_filelist.c | 3 +- source/blender/bmesh/intern/bmesh_opdefines.c | 46 +++++++++++----------- .../operations/COM_GaussianBokehBlurOperation.cpp | 2 +- .../compositor/operations/COM_RenderLayersProg.cpp | 1 + source/blender/depsgraph/intern/depsgraph_debug.cc | 2 - source/blender/editors/physics/particle_object.c | 1 + source/blender/editors/space_file/fsmenu.c | 2 +- source/blender/freestyle/intern/geometry/Noise.cpp | 4 +- source/blender/freestyle/intern/stroke/Stroke.cpp | 7 +--- source/blender/gpu/GPU_material.h | 4 +- source/blender/gpu/intern/gpu_debug.c | 2 +- source/blender/imbuf/intern/dds/ColorBlock.cpp | 18 +++++---- source/blender/imbuf/intern/dds/Common.h | 12 +++--- .../blender/imbuf/intern/dds/DirectDrawSurface.cpp | 40 +++++++++---------- source/blender/imbuf/intern/dds/FlipDXT.cpp | 4 +- source/blender/makesrna/intern/makesrna.c | 13 ++++-- source/blender/python/intern/bpy_rna_callback.c | 6 +-- source/blender/quicktime/quicktime_export.h | 2 +- source/gameengine/VideoTexture/VideoFFmpeg.cpp | 2 - 22 files changed, 96 insertions(+), 88 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h index fd814940624..b44e6c66d2a 100644 --- a/source/blender/blenlib/BLI_alloca.h +++ b/source/blender/blenlib/BLI_alloca.h @@ -34,8 +34,13 @@ #endif #if defined(__GNUC__) || defined(__clang__) +#if defined(__cplusplus) && (__cplusplus > 199711L) +#define BLI_array_alloca(arr, realsize) \ + (decltype(arr))alloca(sizeof(*arr) * (realsize)) +#else #define BLI_array_alloca(arr, realsize) \ (typeof(arr))alloca(sizeof(*arr) * (realsize)) +#endif #else #define BLI_array_alloca(arr, realsize) \ alloca(sizeof(*arr) * (realsize)) diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h index 2bf3b9532dd..840cf24f8cf 100644 --- a/source/blender/blenlib/BLI_math_inline.h +++ b/source/blender/blenlib/BLI_math_inline.h @@ -46,9 +46,9 @@ extern "C" { # define MINLINE static inline # if (defined(__APPLE__) && defined(__ppc__)) /* static inline __attribute__ here breaks osx ppc gcc42 build */ -# define MALWAYS_INLINE static __attribute__((always_inline)) +# define MALWAYS_INLINE static __attribute__((always_inline)) __attribute__((unused)) # else -# define MALWAYS_INLINE static inline __attribute__((always_inline)) +# define MALWAYS_INLINE static inline __attribute__((always_inline)) __attribute__((unused)) # endif # endif #else diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 65e8dcdba4a..df6f578f3f2 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -623,9 +623,9 @@ extern "C" { #else # if (defined(__APPLE__) && defined(__ppc__)) /* static inline __attribute__ here breaks osx ppc gcc42 build */ -# define BLI_INLINE static __attribute__((always_inline)) +# define BLI_INLINE static __attribute__((always_inline)) __attribute__((__unused__)) # else -# define BLI_INLINE static inline __attribute__((always_inline)) +# define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__)) # endif #endif diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 62690ff4f3c..527d9934797 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -333,7 +333,8 @@ void BLI_filelist_entry_datetime_to_string( const struct stat *st, const int64_t ts, const bool compact, char r_time[FILELIST_DIRENTRY_TIME_LEN], char r_date[FILELIST_DIRENTRY_DATE_LEN]) { - const struct tm *tm = localtime(st ? &st->st_mtime : &ts); + time_t ts_mtime = ts; + const struct tm *tm = localtime(st ? &st->st_mtime : &ts_mtime); const time_t zero = 0; /* Prevent impossible dates in windows. */ diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 3e814948ade..f3496b31255 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -262,7 +262,7 @@ static BMOpDefine bmo_bisect_edges_def = { /* slots_in */ {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */ - {"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}}, + {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}}, {{'\0'}}, }, /* slots_out */ @@ -322,7 +322,7 @@ static BMOpDefine bmo_find_doubles_def = { {{'\0'}}, }, /* slots_out */ - {{"targetmap.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {{"targetmap.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, {{'\0'}}, }, bmo_find_doubles_exec, @@ -401,7 +401,7 @@ static BMOpDefine bmo_pointmerge_facedata_def = { "pointmerge_facedata", /* slots_in */ {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */ + {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | (int)BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */ {{'\0'}}, }, {{{'\0'}}}, /* no output */ @@ -474,7 +474,7 @@ static BMOpDefine bmo_weld_verts_def = { "weld_verts", /* slots_in */ /* maps welded vertices to verts they should weld to */ - {{"targetmap", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {{"targetmap", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, {{'\0'}}, }, {{{'\0'}}}, /* no output */ @@ -819,8 +819,8 @@ static BMOpDefine bmo_transform_def = { static BMOpDefine bmo_object_load_bmesh_def = { "object_load_bmesh", /* slots_in */ - {{"scene", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_SCENE}}, - {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, + {{"scene", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_SCENE}}, + {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, {{'\0'}}, }, {{{'\0'}}}, /* no output */ @@ -839,9 +839,9 @@ static BMOpDefine bmo_bmesh_to_mesh_def = { /* slots_in */ { /* pointer to a mesh structure to fill in */ - {"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, + {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to an object structure */ - {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, + {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, {"skip_tessface", BMO_OP_SLOT_BOOL}, /* don't calculate mfaces */ {{'\0'}}, }, @@ -861,9 +861,9 @@ static BMOpDefine bmo_mesh_to_bmesh_def = { /* slots_in */ { /* pointer to a Mesh structure */ - {"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, + {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to an Object structure */ - {"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, + {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, {"use_shapekey", BMO_OP_SLOT_BOOL}, /* load active shapekey coordinates into verts */ {{'\0'}}, }, @@ -1035,7 +1035,7 @@ static BMOpDefine bmo_extrude_face_region_def = { "extrude_face_region", /* slots_in */ {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* edges and faces */ - {"edges_exclude", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}}, + {"edges_exclude", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}}, {"use_keep_orig", BMO_OP_SLOT_BOOL}, /* keep original geometry */ {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */ {{'\0'}}, @@ -1170,7 +1170,7 @@ static BMOpDefine bmo_triangulate_def = { /* slots_out */ {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, {{'\0'}}, }, bmo_triangulate_exec, @@ -1215,8 +1215,8 @@ static BMOpDefine bmo_subdivide_edges_def = { {"along_normal", BMO_OP_SLOT_FLT}, {"cuts", BMO_OP_SLOT_INT}, {"seed", BMO_OP_SLOT_INT}, - {"custom_patterns", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */ - {"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}}, + {"custom_patterns", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */ + {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}}, {"quad_corner_type", BMO_OP_SLOT_INT}, /* quad corner type, see bmesh_operators.h */ {"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */ @@ -1322,7 +1322,7 @@ static BMOpDefine bmo_duplicate_def = { /* slots_in */ {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* destination bmesh, if NULL will use current on */ - {"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, + {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, {"use_select_history", BMO_OP_SLOT_BOOL}, {{'\0'}}, }, @@ -1331,11 +1331,11 @@ static BMOpDefine bmo_duplicate_def = { {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* facemap maps from source faces to dupe * faces, and from dupe faces to source faces */ - {"vert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, - {"edge_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, - {"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, - {"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, - {"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"vert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"edge_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, {{'\0'}}, }, bmo_duplicate_exec, @@ -1354,14 +1354,14 @@ static BMOpDefine bmo_split_def = { /* slots_in */ {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* destination bmesh, if NULL will use current one */ - {"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, + {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, {"use_only_faces", BMO_OP_SLOT_BOOL}, /* when enabled. don't duplicate loose verts/edges */ {{'\0'}}, }, /* slots_out */ {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, - {"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, + {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, {{'\0'}}, }, bmo_split_exec, diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 37d59229e50..7c4132238e3 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -273,7 +273,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, float *gausstaby, *gausstabcentx; int i, j; float *src; - register float sum, val; + float sum, val; float rval, gval, bval, aval; int imgx = getWidth(); int imgy = getHeight(); diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index 1a7e775113b..2a45690a9f2 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -150,6 +150,7 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y expected_element_size = 4; } else { + expected_element_size = 0; BLI_assert(!"Something horribly wrong just happened"); } BLI_assert(expected_element_size == actual_element_size); diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc index 54980436733..7f3f328502f 100644 --- a/source/blender/depsgraph/intern/depsgraph_debug.cc +++ b/source/blender/depsgraph/intern/depsgraph_debug.cc @@ -59,8 +59,6 @@ extern "C" { /* ****************** */ /* Graphviz Debugging */ -static SpinLock lock; - #define NL "\r\n" /* Only one should be enabled, defines whether graphviz nodes diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 327ce060df9..337e7e99929 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -1095,6 +1095,7 @@ static bool copy_particle_systems_to_object(Scene *scene, Object *ob_from, Parti break; default: /* should not happen */ + from_mat = to_mat = NULL; BLI_assert(false); break; } diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 2142368f758..33e6990b179 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -304,7 +304,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, FSMenuCategory category, const c for (; tfsm; tfsm = tfsm->next) { if (STREQ(tfsm->path, fsm_iter->path)) { - if (tfsm->name && tfsm->name[0]) { + if (tfsm->name[0]) { name = tfsm->name; } break; diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp index 8ec56e84f95..dd5f2f6ea4c 100644 --- a/source/blender/freestyle/intern/geometry/Noise.cpp +++ b/source/blender/freestyle/intern/geometry/Noise.cpp @@ -147,7 +147,7 @@ float Noise::smoothNoise2(Vec2f& vec) { int bx0, bx1, by0, by1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v; - register int i, j; + int i, j; SETUP(vec.x(), bx0, bx1, rx0, rx1); SETUP(vec.y(), by0, by1, ry0, ry1); @@ -186,7 +186,7 @@ float Noise::smoothNoise3(Vec3f& vec) { int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v; - register int i, j; + int i, j; SETUP(vec.x(), bx0, bx1, rx0, rx1); SETUP(vec.y(), by0, by1, ry0, ry1); diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index b4a3646edef..053015f459d 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -419,12 +419,7 @@ Stroke::Stroke(const Stroke& iBrother) _textureId = iBrother._textureId; _textureStep = iBrother._textureStep; for (int a = 0; a < MAX_MTEX; a++) { - if (iBrother._mtex) { - _mtex[a] = iBrother._mtex[a]; - } - else { - _mtex[a] = NULL; - } + _mtex[a] = iBrother._mtex[a]; } _nodeTree = iBrother._nodeTree; _tips = iBrother._tips; diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index dd08ed83e5a..9a850757496 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -314,13 +314,13 @@ void GPU_mist_update_values(int type, float start, float dist, float inten, floa void GPU_horizon_update_color(float color[3]); void GPU_ambient_update_color(float color[3]); -typedef struct GPUParticleInfo +struct GPUParticleInfo { float scalprops[4]; float location[3]; float velocity[3]; float angular_velocity[3]; -} GPUParticleInfo; +}; #ifdef WITH_OPENSUBDIV struct DerivedMesh; diff --git a/source/blender/gpu/intern/gpu_debug.c b/source/blender/gpu/intern/gpu_debug.c index 1c194f517aa..fdec45fc140 100644 --- a/source/blender/gpu/intern/gpu_debug.c +++ b/source/blender/gpu/intern/gpu_debug.c @@ -166,7 +166,7 @@ const char* gpuErrorString(GLenum err) static void APIENTRY gpu_debug_proc( GLenum source, GLenum type, GLuint UNUSED(id), GLenum UNUSED(severity), GLsizei UNUSED(length), - const GLchar *message, const GLvoid *UNUSED(userParm)) + const GLchar *message, GLvoid *UNUSED(userParm)) { if (source == GL_DEBUG_SOURCE_API && type == GL_DEBUG_TYPE_ERROR) { fprintf(stderr, "GL: %s\n", message); diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 28f31fcad8b..dd4ae3e518e 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -38,6 +38,7 @@ #include #include +#if 0 // Get approximate luminance. inline static uint colorLuminance(Color32 c) { @@ -49,6 +50,7 @@ { return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b); } +#endif /// Default constructor. @@ -86,8 +88,8 @@ void ColorBlock::init(const Image *img, uint x, uint y) void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y) { - const uint bw = min(w - x, 4U); - const uint bh = min(h - y, 4U); + const uint bw = MIN(w - x, 4U); + const uint bh = MIN(h - y, 4U); // Blocks that are smaller than 4x4 are handled by repeating the pixels. // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( @@ -107,8 +109,8 @@ void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y) void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) { - const uint bw = min(w - x, 4U); - const uint bh = min(h - y, 4U); + const uint bw = MIN(w - x, 4U); + const uint bh = MIN(h - y, 4U); // Blocks that are smaller than 4x4 are handled by repeating the pixels. // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( @@ -124,10 +126,10 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) const uint idx = ((y + by) * w + x + bx); Color32 & c = color(e, i); - c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? - c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f)); - c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f)); - c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f)); + c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? + c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f)); + c.b = uint8(255 * CLAMP(data[idx + 2 * srcPlane], 0.0f, 1.0f)); + c.a = uint8(255 * CLAMP(data[idx + 3 * srcPlane], 0.0f, 1.0f)); } } } diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h index ab929b82264..b1beb3f3a1b 100644 --- a/source/blender/imbuf/intern/dds/Common.h +++ b/source/blender/imbuf/intern/dds/Common.h @@ -28,14 +28,14 @@ #ifndef __COMMON_H__ #define __COMMON_H__ -#ifndef min -#define min(a,b) ((a) <= (b) ? (a) : (b)) +#ifndef MIN +#define MIN(a,b) ((a) <= (b) ? (a) : (b)) #endif -#ifndef max -#define max(a,b) ((a) >= (b) ? (a) : (b)) +#ifndef MAX +#define MAX(a,b) ((a) >= (b) ? (a) : (b)) #endif -#ifndef clamp -#define clamp(x,a,b) min(max((x), (a)), (b)) +#ifndef CLAMP +#define CLAMP(x,a,b) MIN(MAX((x), (a)), (b)) #endif template diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 6bf82776afe..a4281514e39 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -83,7 +83,7 @@ static const uint FOURCC_RXGB = DDS_MAKEFOURCC('R', 'X', 'G', 'B'); static const uint FOURCC_ATI1 = DDS_MAKEFOURCC('A', 'T', 'I', '1'); static const uint FOURCC_ATI2 = DDS_MAKEFOURCC('A', 'T', 'I', '2'); -static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y'); +//static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y'); static const uint FOURCC_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0'); @@ -107,25 +107,25 @@ static const uint D3DFMT_X8B8G8R8 = 33; static const uint D3DFMT_G16R16 = 34; static const uint D3DFMT_A2R10G10B10 = 35; -static const uint D3DFMT_A16B16G16R16 = 36; +//static const uint D3DFMT_A16B16G16R16 = 36; // Palette formats. -static const uint D3DFMT_A8P8 = 40; -static const uint D3DFMT_P8 = 41; +//static const uint D3DFMT_A8P8 = 40; +//static const uint D3DFMT_P8 = 41; // Luminance formats. static const uint D3DFMT_L8 = 50; -static const uint D3DFMT_A8L8 = 51; -static const uint D3DFMT_A4L4 = 52; +//static const uint D3DFMT_A8L8 = 51; +//static const uint D3DFMT_A4L4 = 52; static const uint D3DFMT_L16 = 81; // Floating point formats -static const uint D3DFMT_R16F = 111; -static const uint D3DFMT_G16R16F = 112; -static const uint D3DFMT_A16B16G16R16F = 113; -static const uint D3DFMT_R32F = 114; -static const uint D3DFMT_G32R32F = 115; -static const uint D3DFMT_A32B32G32R32F = 116; +//static const uint D3DFMT_R16F = 111; +//static const uint D3DFMT_G16R16F = 112; +//static const uint D3DFMT_A16B16G16R16F = 113; +//static const uint D3DFMT_R32F = 114; +//static const uint D3DFMT_G32R32F = 115; +//static const uint D3DFMT_A32B32G32R32F = 116; static const uint DDSD_CAPS = 0x00000001U; static const uint DDSD_PIXELFORMAT = 0x00001000U; @@ -1102,8 +1102,8 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap) // Compute width and height. for (uint m = 0; m < mipmap; m++) { - w = max(1U, w / 2); - h = max(1U, h / 2); + w = MAX(1U, w / 2); + h = MAX(1U, h / 2); } img->allocate(w, h); @@ -1223,9 +1223,9 @@ void DirectDrawSurface::readBlockImage(Image *img) readBlock(&block); // Write color block. - for (uint y = 0; y < min(4U, h-4*by); y++) + for (uint y = 0; y < MIN(4U, h-4*by); y++) { - for (uint x = 0; x < min(4U, w-4*bx); x++) + for (uint x = 0; x < MIN(4U, w-4*bx); x++) { img->pixel(4*bx+x, 4*by+y) = block.color(x, y); } @@ -1240,7 +1240,7 @@ static Color32 buildNormal(uint8 x, uint8 y) float ny = 2 * (y / 255.0f) - 1; float nz = 0.0f; if (1 - nx*nx - ny*ny > 0) nz = sqrt(1 - nx*nx - ny*ny); - uint8 z = clamp(int(255.0f * (nz + 1) / 2.0f), 0, 255); + uint8 z = CLAMP(int(255.0f * (nz + 1) / 2.0f), 0, 255); return Color32(x, y, z); } @@ -1379,9 +1379,9 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const for (uint m = 0; m < mipmap; m++) { - w = max(1U, w / 2); - h = max(1U, h / 2); - d = max(1U, d / 2); + w = MAX(1U, w / 2); + h = MAX(1U, h / 2); + d = MAX(1U, d / 2); } if (header.pf.flags & DDPF_FOURCC) diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index 4f63d17dc90..604796d1705 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -246,8 +246,8 @@ int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, // mip levels are contiguous. data += block_bytes * blocks; - mip_width = max(1U, mip_width >> 1); - mip_height = max(1U, mip_height >> 1); + mip_width = MAX(1U, mip_width >> 1); + mip_height = MAX(1U, mip_height >> 1); } return 1; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 0f00dd7a586..e887397f4d7 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1079,11 +1079,18 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA fprintf(f, " return %s(ptr);\n", manualfunc); } else { - rna_print_data_get(f, dp); + if (dp->dnaarraylength <= 1 || dp->dnalengthname) + rna_print_data_get(f, dp); + + if (dp->dnaarraylength > 1) + fprintf(f, " return "); + else + fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname); + if (dp->dnalengthname) - fprintf(f, " return (data->%s == NULL) ? 0 : data->%s;\n", dp->dnaname, dp->dnalengthname); + fprintf(f, "data->%s;\n", dp->dnalengthname); else - fprintf(f, " return (data->%s == NULL) ? 0 : %d;\n", dp->dnaname, dp->dnalengthfixed); + fprintf(f, "%d;\n", dp->dnalengthfixed); } fprintf(f, "}\n\n"); } diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index 87c3a6eb4ef..4ae739407eb 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -174,7 +174,7 @@ static eSpace_Type rna_Space_refine_reverse(StructRNA *srna) if (srna == &RNA_SpaceConsole) return SPACE_CONSOLE; if (srna == &RNA_SpaceUserPreferences) return SPACE_USERPREF; if (srna == &RNA_SpaceClipEditor) return SPACE_CLIP; - return -1; + return SPACE_EMPTY; } PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args) @@ -220,7 +220,7 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args) } else { const eSpace_Type spaceid = rna_Space_refine_reverse(srna); - if (spaceid == -1) { + if (spaceid == SPACE_EMPTY) { PyErr_Format(PyExc_TypeError, "unknown space type '%.200s'", RNA_struct_identifier(srna)); return NULL; } @@ -283,7 +283,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar } else { const eSpace_Type spaceid = rna_Space_refine_reverse(srna); - if (spaceid == -1) { + if (spaceid == SPACE_EMPTY) { PyErr_Format(PyExc_TypeError, "unknown space type '%.200s'", RNA_struct_identifier(srna)); return NULL; } diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h index 8a10a4a05d6..41db83fb1c9 100644 --- a/source/blender/quicktime/quicktime_export.h +++ b/source/blender/quicktime/quicktime_export.h @@ -46,7 +46,7 @@ typedef struct QuicktimeCodecTypeDesc { int codecType; int rnatmpvalue; - char *codecName; + const char *codecName; } QuicktimeCodecTypeDesc; // quicktime movie output functions diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index ffe06cff100..9585d8b0138 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -49,8 +49,6 @@ // default framerate const double defFrameRate = 25.0; -// time scale constant -const long timeScale = 1000; // macro for exception handling and logging #define CATCH_EXCP catch (Exception & exp) \ -- cgit v1.2.3