[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14456] trunk/blender/source: Used GET_INT_FROM_POINTER to get rid of many warnings that only occurred with 64bit os 's
Campbell Barton
ideasman42 at gmail.com
Thu Apr 17 23:15:00 CEST 2008
Revision: 14456
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14456
Author: campbellbarton
Date: 2008-04-17 23:14:55 +0200 (Thu, 17 Apr 2008)
Log Message:
-----------
Used GET_INT_FROM_POINTER to get rid of many warnings that only occurred with 64bit os's
Also use Py_ssize_t which we might need to define for older python's
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/Armature.c
trunk/blender/source/blender/python/api2_2x/Camera.c
trunk/blender/source/blender/python/api2_2x/CurNurb.c
trunk/blender/source/blender/python/api2_2x/IDProp.c
trunk/blender/source/blender/python/api2_2x/Image.c
trunk/blender/source/blender/python/api2_2x/Ipocurve.c
trunk/blender/source/blender/python/api2_2x/Lamp.c
trunk/blender/source/blender/python/api2_2x/Lattice.c
trunk/blender/source/blender/python/api2_2x/Library.c
trunk/blender/source/blender/python/api2_2x/Material.c
trunk/blender/source/blender/python/api2_2x/Mesh.c
trunk/blender/source/blender/python/api2_2x/Node.c
trunk/blender/source/blender/python/api2_2x/Object.c
trunk/blender/source/blender/python/api2_2x/Pose.c
trunk/blender/source/blender/python/api2_2x/Scene.c
trunk/blender/source/blender/python/api2_2x/Text3d.c
trunk/blender/source/blender/python/api2_2x/Texture.c
trunk/blender/source/blender/python/api2_2x/bpy_config.c
trunk/blender/source/blender/src/buttons_editing.c
trunk/blender/source/creator/creator.c
Modified: trunk/blender/source/blender/python/api2_2x/Armature.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Armature.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Armature.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -178,7 +178,7 @@
{
char str[2048];
PyObject *key, *value;
- int pos = 0;
+ Py_ssize_t pos = 0;
char *p = str;
char *keys, *vals;
Modified: trunk/blender/source/blender/python/api2_2x/Camera.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Camera.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Camera.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -33,6 +33,7 @@
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_library.h"
+#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h" /* for M_PI */
#include "BSE_editipo.h"
@@ -682,7 +683,7 @@
float param;
struct Camera *cam= self->camera;
- switch( (int)type ) {
+ switch( GET_INT_FROM_POINTER(type) ) {
case EXPP_CAM_ATTR_LENS:
param = cam->lens;
break;
@@ -735,7 +736,7 @@
float min, max;
int ret;
- switch( (int)type ) {
+ switch( GET_INT_FROM_POINTER(type) ) {
case EXPP_CAM_ATTR_LENS:
min = 1.0;
max = 250.0;
@@ -795,7 +796,7 @@
ret = EXPP_setFloatClamped( value, param, min, max );
if (ret==0) {
- if ((int)type == EXPP_CAM_ATTR_ANGLE) {
+ if (GET_INT_FROM_POINTER(type) == EXPP_CAM_ATTR_ANGLE) {
cam->lens = 16.0f / tan(M_PI*cam->lens/360.0f);
}
}
@@ -809,7 +810,7 @@
static PyObject *getFlagAttr( BPy_Camera *self, void *type )
{
- if (self->camera->flag & (int)type)
+ if (self->camera->flag & GET_INT_FROM_POINTER(type))
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -827,9 +828,9 @@
"expected True/False or 0/1" );
if (param)
- self->camera->flag |= (int)type;
+ self->camera->flag |= GET_INT_FROM_POINTER(type);
else
- self->camera->flag &= ~(int)type;
+ self->camera->flag &= ~GET_INT_FROM_POINTER(type);
return 0;
}
Modified: trunk/blender/source/blender/python/api2_2x/CurNurb.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/CurNurb.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/CurNurb.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -34,6 +34,8 @@
#include "gen_utils.h"
#include "BezTriple.h"
+#include "BKE_utildefines.h"
+
/* Only for ME_SMOOTH */
#include "DNA_meshdata_types.h"
@@ -430,14 +432,14 @@
static PyObject *CurNurb_getFlagBits( BPy_CurNurb * self, void *type )
{
return EXPP_getBitfield( (void *)&self->nurb->flag,
- (int)type, 'h' );
+ GET_INT_FROM_POINTER(type), 'h' );
}
static int CurNurb_setFlagBits( BPy_CurNurb * self, PyObject *value,
void *type )
{
return EXPP_setBitfield( value, (void *)&self->nurb->flag,
- (int)type, 'h' );
+ GET_INT_FROM_POINTER(type), 'h' );
}
/*
Modified: trunk/blender/source/blender/python/api2_2x/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/IDProp.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/IDProp.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -516,7 +516,7 @@
PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
{
PyObject *pyob, *pkey, *pval;
- int i=0;
+ Py_ssize_t i=0;
if (PySequence_Size(vars) != 1)
return EXPP_ReturnPyObjError( PyExc_TypeError,
Modified: trunk/blender/source/blender/python/api2_2x/Image.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Image.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Image.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -1191,7 +1191,7 @@
static PyObject *Image_getFlag(BPy_Image *self, void *flag)
{
- if (self->image->flag & (int)flag)
+ if (self->image->flag & GET_INT_FROM_POINTER(flag))
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -1200,7 +1200,7 @@
static PyObject *Image_getFlagTpage(BPy_Image *self, void *flag)
{
- if (self->image->tpageflag & (int)flag)
+ if (self->image->tpageflag & GET_INT_FROM_POINTER(flag))
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -1235,9 +1235,9 @@
"expected True/False or 0/1" );
if ( param )
- self->image->flag |= (int)flag;
+ self->image->flag |= GET_INT_FROM_POINTER(flag);
else
- self->image->flag &= ~(int)flag;
+ self->image->flag &= ~GET_INT_FROM_POINTER(flag);
return 0;
}
@@ -1249,9 +1249,9 @@
"expected True/False or 0/1" );
if ( param )
- self->image->tpageflag |= (int)flag;
+ self->image->tpageflag |= GET_INT_FROM_POINTER(flag);
else
- self->image->tpageflag &= ~(int)flag;
+ self->image->tpageflag &= ~GET_INT_FROM_POINTER(flag);
return 0;
}
@@ -1263,7 +1263,7 @@
int param;
struct Image *image = self->image;
- switch( (int)type ) {
+ switch( GET_INT_FROM_POINTER(type) ) {
case EXPP_IMAGE_ATTR_XREP:
param = image->xrep;
break;
@@ -1304,7 +1304,7 @@
struct Image *image = self->image;
int min, max, size;
- switch( (int)type ) {
+ switch( GET_INT_FROM_POINTER(type) ) {
case EXPP_IMAGE_ATTR_XREP:
min = EXPP_IMAGE_REP_MIN;
max = EXPP_IMAGE_REP_MAX;
Modified: trunk/blender/source/blender/python/api2_2x/Ipocurve.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Ipocurve.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Ipocurve.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -34,6 +34,7 @@
#include "BKE_main.h"
#include "BKE_depsgraph.h"
#include "BKE_ipo.h"
+#include "BKE_utildefines.h"
#include "BIF_space.h"
#include "BSE_editipo.h"
#include "MEM_guardedalloc.h"
@@ -1017,7 +1018,7 @@
static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type )
{
- if (self->ipocurve->flag & (int)type)
+ if (self->ipocurve->flag & GET_INT_FROM_POINTER(type))
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -1031,9 +1032,9 @@
"expected True/False or 0/1" );
if (param)
- self->ipocurve->flag |= (int)type;
+ self->ipocurve->flag |= GET_INT_FROM_POINTER(type);
else
- self->ipocurve->flag &= ~(int)type;
+ self->ipocurve->flag &= ~GET_INT_FROM_POINTER(type);
return 0;
}
Modified: trunk/blender/source/blender/python/api2_2x/Lamp.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Lamp.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Lamp.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -42,6 +42,7 @@
#include "constant.h"
#include "gen_utils.h"
#include "gen_library.h"
+#include "BKE_utildefines.h"
/*****************************************************************************/
/* Python BPy_Lamp defaults: */
@@ -1175,7 +1176,7 @@
static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure )
{
- switch ( (int)closure ) {
+ switch ( GET_INT_FROM_POINTER(closure) ) {
case EXPP_LAMP_COMP_R:
return PyFloat_FromDouble( self->lamp->r );
case EXPP_LAMP_COMP_G:
@@ -1200,7 +1201,7 @@
color = (float)PyFloat_AsDouble( value );
color = EXPP_ClampFloat( color, EXPP_LAMP_COL_MIN, EXPP_LAMP_COL_MAX );
- switch ( (int)closure ) {
+ switch ( GET_INT_FROM_POINTER(closure) ) {
case EXPP_LAMP_COMP_R:
self->lamp->r = color;
return 0;
Modified: trunk/blender/source/blender/python/api2_2x/Lattice.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Lattice.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Lattice.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -676,7 +676,7 @@
static PyObject *Lattice_getAxisType(BPy_Lattice * self, void * type)
{
char interp_type = 0;
- switch ( (int)type ) {
+ switch ( GET_INT_FROM_POINTER(type) ) {
case 0:
interp_type = self->lattice->typeu;
break;
Modified: trunk/blender/source/blender/python/api2_2x/Library.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Library.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Library.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -941,7 +941,7 @@
static PyObject *LibraryData_CreatePyObject( BPy_Library *self, void *mode )
{
- return CreatePyObject_LibData( (int)mode, OTHER, NULL, NULL,
+ return CreatePyObject_LibData( GET_INT_FROM_POINTER(mode), OTHER, NULL, NULL,
self->filename );
}
Modified: trunk/blender/source/blender/python/api2_2x/Material.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Material.c 2008-04-17 20:29:57 UTC (rev 14455)
+++ trunk/blender/source/blender/python/api2_2x/Material.c 2008-04-17 21:14:55 UTC (rev 14456)
@@ -1601,7 +1601,7 @@
static PyObject* Material_getSssRadius( BPy_Material * self, void * type )
{
- return PyFloat_FromDouble( ( double ) (self->material->sss_radius[(int)type]) );
+ return PyFloat_FromDouble( ( double ) (self->material->sss_radius[GET_INT_FROM_POINTER(type)]) );
}
static PyObject* Material_getSssIOR( BPy_Material * self )
@@ -1813,7 +1813,7 @@
param = (float)PyFloat_AsDouble( value );
param = EXPP_ClampFloat( param, EXPP_MAT_COL_MIN, EXPP_MAT_COL_MAX );
- switch ( (int)closure ) {
+ switch ( GET_INT_FROM_POINTER(closure) ) {
case EXPP_MAT_COMP_R:
self->material->r = param;
return 0;
@@ -2174,7 +2174,7 @@
static int Material_setSssRadius( BPy_Material * self, PyObject * value, void *type )
{
- return EXPP_setFloatClamped ( value, &self->material->sss_radius[(int)type],
+ return EXPP_setFloatClamped ( value, &self->material->sss_radius[GET_INT_FROM_POINTER(type)],
EXPP_MAT_SSS_RADIUS_MIN,
EXPP_MAT_SSS_RADIUS_MAX);
}
@@ -2636,7 +2636,7 @@
static PyObject *Material_getColorComponent( BPy_Material * self,
void * closure )
{
- switch ( (int)closure ) {
+ switch ( GET_INT_FROM_POINTER(closure) ) {
case EXPP_MAT_COMP_R:
return PyFloat_FromDouble( ( double ) self->material->r );
case EXPP_MAT_COMP_G:
Modified: trunk/blender/source/blender/python/api2_2x/Mesh.c
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list