diff options
author | Joseph Gilbert <ascotan@gmail.com> | 2005-07-18 07:50:37 +0400 |
---|---|---|
committer | Joseph Gilbert <ascotan@gmail.com> | 2005-07-18 07:50:37 +0400 |
commit | e60291d39c0f77282a2d17f79e9264107bbc495e (patch) | |
tree | 274f6c0fc564553bb1484abfc5ad33e758d00903 /source/blender/python/api2_2x/charRGBA.c | |
parent | 9919df089dc34a62ac14f5c151d7815ee852bd81 (diff) |
Header file clean up and warning fixes
- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
Diffstat (limited to 'source/blender/python/api2_2x/charRGBA.c')
-rw-r--r-- | source/blender/python/api2_2x/charRGBA.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/charRGBA.c b/source/blender/python/api2_2x/charRGBA.c index 690361eed5d..76897088166 100644 --- a/source/blender/python/api2_2x/charRGBA.c +++ b/source/blender/python/api2_2x/charRGBA.c @@ -30,7 +30,8 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -#include "charRGBA.h" +#include "charRGBA.h" /*This must come first */ +#include "gen_utils.h" /* This file is heavily based on the old bpython Constant object code in Blender */ @@ -167,10 +168,10 @@ PyObject *charRGBA_setCol( BPy_charRGBA * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected 1-byte ints [b,b,b,b] or b,b,b,b as arguments (or nothing)" ); - *( self->rgba[0] ) = EXPP_ClampInt( r, 0, 255 ); - *( self->rgba[1] ) = EXPP_ClampInt( g, 0, 255 ); - *( self->rgba[2] ) = EXPP_ClampInt( b, 0, 255 ); - *( self->rgba[3] ) = EXPP_ClampInt( a, 0, 255 ); + *( self->rgba[0] ) = (char)EXPP_ClampInt( r, 0, 255 ); + *( self->rgba[1] ) = (char)EXPP_ClampInt( g, 0, 255 ); + *( self->rgba[2] ) = (char)EXPP_ClampInt( b, 0, 255 ); + *( self->rgba[3] ) = (char)EXPP_ClampInt( a, 0, 255 ); return EXPP_incr_ret( Py_None ); } @@ -226,7 +227,7 @@ static int charRGBA_setAttr( BPy_charRGBA * self, char *name, PyObject * v ) return EXPP_ReturnIntError( PyExc_TypeError, "expected char argument" ); - value = EXPP_ClampInt( value, 0, 255 ); + value = (char)EXPP_ClampInt( value, 0, 255 ); if( !strcmp( name, "R" ) || !strcmp( name, "r" ) ) *( self->rgba[0] ) = value; @@ -311,7 +312,7 @@ static int charRGBAAssSubscript( BPy_charRGBA * self, PyObject * key, else return EXPP_ReturnIntError( PyExc_AttributeError, name ); - *( self->rgba[i] ) = EXPP_ClampInt( PyInt_AsLong( v ), 0, 255 ); + *( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( v ), 0, 255 ); return 0; } @@ -361,7 +362,7 @@ static int charRGBAAssItem( BPy_charRGBA * self, int i, PyObject * ob ) return EXPP_ReturnIntError( PyExc_IndexError, "color component must be a number" ); - *( self->rgba[i] ) = EXPP_ClampInt( PyInt_AsLong( ob ), 0, 255 ); + *( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( ob ), 0, 255 ); return 0; } @@ -395,7 +396,7 @@ static int charRGBAAssSlice( BPy_charRGBA * self, int begin, int end, return -1; } - *( self->rgba[count] ) = EXPP_ClampInt( value, 0, 255 ); + *( self->rgba[count] ) = (char)EXPP_ClampInt( value, 0, 255 ); Py_DECREF( ob ); } |