From fd0072e77cd28d52e00ea77542ba6d11018889b5 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 17 Aug 2008 17:08:00 +0000 Subject: [PATCH] Win64: please check my changes if you ran across them ;) But should be fine since no additional crashes were reported! --- intern/guardedalloc/BLO_sys_types.h | 112 ++++++++++++++++++ intern/guardedalloc/intern/mallocn.c | 12 +- intern/guardedalloc/intern/mmap_win.c | 2 +- intern/guardedalloc/mmap_win.h | 4 +- intern/opennl/superlu/BLO_sys_types.h | 112 ++++++++++++++++++ intern/opennl/superlu/smemory.c | 10 +- release/datafiles/datatoc.c | 2 +- source/blender/blenkernel/BKE_customdata.h | 4 +- source/blender/blenkernel/BKE_endian.h | 6 +- source/blender/blenkernel/BKE_utildefines.h | 4 +- source/blender/blenkernel/intern/CCGSubSurf.c | 4 +- .../blender/blenkernel/intern/DerivedMesh.c | 20 ++-- source/blender/blenkernel/intern/cloth.c | 22 ++-- source/blender/blenkernel/intern/displist.c | 8 +- source/blender/blenkernel/intern/image.c | 6 +- source/blender/blenkernel/intern/implicit.c | 4 +- source/blender/blenlib/BLI_editVert.h | 8 +- source/blender/blenlib/intern/BLI_ghash.c | 6 +- source/blender/blenlib/intern/fileops.c | 6 +- source/blender/blenlib/intern/psfont.c | 2 +- source/blender/blenlib/intern/util.c | 8 +- .../blender/blenpluginapi/intern/pluginapi.c | 4 +- .../blender/imbuf/intern/cineon/cineonlib.c | 32 ++--- source/blender/imbuf/intern/cineon/dpxlib.c | 36 +++--- .../imbuf/intern/cineon/logImageCore.h | 2 +- .../blender/imbuf/intern/cineon/logmemfile.c | 6 +- .../blender/imbuf/intern/cineon/logmemfile.h | 2 +- source/blender/imbuf/intern/scaling.c | 72 +++++------ source/blender/include/BIF_meshtools.h | 2 +- source/blender/makesdna/intern/makesdna.c | 8 +- source/blender/radiosity/CMakeLists.txt | 2 +- source/blender/radiosity/SConscript | 2 +- .../blender/radiosity/intern/source/Makefile | 1 + .../blender/radiosity/intern/source/radnode.c | 10 +- .../radiosity/intern/source/radpreprocess.c | 4 +- source/blender/render/CMakeLists.txt | 2 +- source/blender/render/SConscript | 2 +- .../render/intern/include/render_types.h | 8 +- .../blender/render/intern/source/occlusion.c | 2 +- .../blender/render/intern/source/pipeline.c | 2 +- .../blender/render/intern/source/rendercore.c | 22 ++-- source/blender/render/intern/source/shadbuf.c | 16 +-- source/blender/render/intern/source/strand.c | 4 +- source/blender/render/intern/source/zbuf.c | 8 +- source/blender/src/buttons_editing.c | 2 +- source/blender/src/buttons_scene.c | 6 +- source/blender/src/drawmesh.c | 8 +- source/blender/src/drawobject.c | 12 +- source/blender/src/editkey.c | 6 +- source/blender/src/editmesh_mods.c | 5 +- source/blender/src/editmesh_tools.c | 8 +- source/blender/src/header_info.c | 4 +- source/blender/src/header_script.c | 8 +- source/blender/src/interface.c | 6 +- source/blender/src/meshlaplacian.c | 8 +- source/blender/src/meshtools.c | 16 +-- source/blender/src/parametrizer.c | 4 +- source/blender/src/parametrizer.h | 2 +- source/blender/src/parametrizer_intern.h | 2 +- source/blender/src/renderwin.c | 2 +- source/blender/src/space.c | 6 +- source/blender/src/toolbox.c | 22 ++-- source/blender/src/transform_conversions.c | 20 ++-- .../blender/yafray/intern/export_Plugin.cpp | 2 +- .../Ketsji/KX_MaterialIpoController.cpp | 10 +- source/kernel/CMakeLists.txt | 2 +- source/kernel/SConscript | 2 +- source/kernel/gen_system/GEN_HashedPtr.cpp | 8 +- source/kernel/gen_system/Makefile | 1 + 69 files changed, 528 insertions(+), 255 deletions(-) create mode 100644 intern/guardedalloc/BLO_sys_types.h create mode 100644 intern/opennl/superlu/BLO_sys_types.h diff --git a/intern/guardedalloc/BLO_sys_types.h b/intern/guardedalloc/BLO_sys_types.h new file mode 100644 index 00000000000..17fa99308e0 --- /dev/null +++ b/intern/guardedalloc/BLO_sys_types.h @@ -0,0 +1,112 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * A platform-independent definition of [u]intXX_t + * Plus the accompanying header include for htonl/ntohl + * + * This file includes to define [u]intXX_t types, where + * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this + * file. + * - Windows uses __intXX compiler-builtin types. These are signed, + * so we have to flip the signs. + * For these rogue platforms, we make the typedefs ourselves. + * + */ + +/* +// DG: original BLO_sys_types.h is in source/blender/blenkernel +// but is not allowed be accessed here because of bad-level-call +*/ + +#ifndef BLO_SYS_TYPES_H +#define BLO_SYS_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FREE_WINDOWS +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +#endif + +#if defined(_WIN32) && !defined(FREE_WINDOWS) + +/* The __intXX are built-in types of the visual complier! So we don't + * need to include anything else here. */ + +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#ifdef _WIN64 +typedef __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else +typedef long intptr_t; +typedef unsigned long uintptr_t; +#endif + +#elif defined(__linux__) + + /* Linux-i386, Linux-Alpha, Linux-ppc */ +#include + +#elif defined (__APPLE__) + +#include + +#else + + /* FreeBSD, Irix, Solaris */ +#include + +#endif /* ifdef platform for types */ + +#ifdef _WIN32 +#define htonl(x) correctByteOrder(x) +#define ntohl(x) correctByteOrder(x) +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#include +#elif defined (__APPLE__) +#include +#else /* irix sun linux */ +#include +#endif /* ifdef platform for htonl/ntohl */ + +#ifdef __cplusplus +} +#endif + +#endif /* eof */ + diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 25f2fd8d269..a36549d0cc7 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -49,6 +49,8 @@ #include "MEM_guardedalloc.h" +#include "BLO_sys_types.h" // needed for intptr_t + /* --------------------------------------------------------------------- */ /* Data definition */ /* --------------------------------------------------------------------- */ @@ -112,7 +114,7 @@ static const char *check_memlist(MemHead *memh); volatile int totblock= 0; -volatile unsigned long mem_in_use= 0, mmap_in_use= 0; +volatile uintptr_t mem_in_use= 0, mmap_in_use= 0; static volatile struct localListBase _membase; static volatile struct localListBase *membase = &_membase; @@ -335,7 +337,7 @@ void *MEM_mapallocN(unsigned int len, const char *str) /* Memory statistics print */ typedef struct MemPrintBlock { const char *name; - unsigned long len; + uintptr_t len; int items; } MemPrintBlock; @@ -485,14 +487,14 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */ return(-1); } - if(sizeof(long)==8) { - if (((long) memh) & 0x7) { + if(sizeof(intptr_t)==8) { + if (((intptr_t) memh) & 0x7) { MemorY_ErroR("free","attempt to free illegal pointer"); return(-1); } } else { - if (((long) memh) & 0x3) { + if (((intptr_t) memh) & 0x3) { MemorY_ErroR("free","attempt to free illegal pointer"); return(-1); } diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c index 436c99344a7..642cc16296e 100644 --- a/intern/guardedalloc/intern/mmap_win.c +++ b/intern/guardedalloc/intern/mmap_win.c @@ -151,7 +151,7 @@ void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset) } /* munmap for windows */ -long munmap(void *ptr, long size) +intptr_t munmap(void *ptr, intptr_t size) { MemMap *mm = mmap_findlink(mmapbase, ptr); if (!mm) { diff --git a/intern/guardedalloc/mmap_win.h b/intern/guardedalloc/mmap_win.h index f83a2d64b18..443c3b6f4ce 100644 --- a/intern/guardedalloc/mmap_win.h +++ b/intern/guardedalloc/mmap_win.h @@ -45,8 +45,10 @@ #define MAP_FAILED ((void *)-1) +#include "BLO_sys_types.h" // needed for intptr_t + void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset); -long munmap(void *ptr, long size); +intptr_t munmap(void *ptr, intptr_t size); #endif diff --git a/intern/opennl/superlu/BLO_sys_types.h b/intern/opennl/superlu/BLO_sys_types.h new file mode 100644 index 00000000000..17fa99308e0 --- /dev/null +++ b/intern/opennl/superlu/BLO_sys_types.h @@ -0,0 +1,112 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * A platform-independent definition of [u]intXX_t + * Plus the accompanying header include for htonl/ntohl + * + * This file includes to define [u]intXX_t types, where + * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this + * file. + * - Windows uses __intXX compiler-builtin types. These are signed, + * so we have to flip the signs. + * For these rogue platforms, we make the typedefs ourselves. + * + */ + +/* +// DG: original BLO_sys_types.h is in source/blender/blenkernel +// but is not allowed be accessed here because of bad-level-call +*/ + +#ifndef BLO_SYS_TYPES_H +#define BLO_SYS_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FREE_WINDOWS +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +#endif + +#if defined(_WIN32) && !defined(FREE_WINDOWS) + +/* The __intXX are built-in types of the visual complier! So we don't + * need to include anything else here. */ + +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#ifdef _WIN64 +typedef __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else +typedef long intptr_t; +typedef unsigned long uintptr_t; +#endif + +#elif defined(__linux__) + + /* Linux-i386, Linux-Alpha, Linux-ppc */ +#include + +#elif defined (__APPLE__) + +#include + +#else + + /* FreeBSD, Irix, Solaris */ +#include + +#endif /* ifdef platform for types */ + +#ifdef _WIN32 +#define htonl(x) correctByteOrder(x) +#define ntohl(x) correctByteOrder(x) +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#include +#elif defined (__APPLE__) +#include +#else /* irix sun linux */ +#include +#endif /* ifdef platform for htonl/ntohl */ + +#ifdef __cplusplus +} +#endif + +#endif /* eof */ + diff --git a/intern/opennl/superlu/smemory.c b/intern/opennl/superlu/smemory.c index 79da748671a..7eefb900673 100644 --- a/intern/opennl/superlu/smemory.c +++ b/intern/opennl/superlu/smemory.c @@ -8,6 +8,8 @@ */ #include "ssp_defs.h" +#include "BLO_sys_types.h" // needed for intptr_t + /* Constants */ #define NO_MEMTYPE 4 /* 0: lusup; 1: ucol; @@ -49,8 +51,8 @@ static int no_expand; /* Macros to manipulate stack */ #define StackFull(x) ( x + stack.used >= stack.size ) -#define NotDoubleAlign(addr) ( (long int)addr & 7 ) -#define DoubleAlign(addr) ( ((long int)addr + 7) & ~7L ) +#define NotDoubleAlign(addr) ( (intptr_t)addr & 7 ) +#define DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L ) #define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \ (w + 1) * m * sizeof(float) ) #define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */ @@ -611,8 +613,8 @@ sStackCompress(GlobalLU_t *Glu) last = (char*)usub + xusub[ndim] * iword; fragment = (char*) (((char*)stack.array + stack.top1) - last); - stack.used -= (long int) fragment; - stack.top1 -= (long int) fragment; + stack.used -= (intptr_t) fragment; + stack.top1 -= (intptr_t) fragment; Glu->ucol = ucol; Glu->lsub = lsub; diff --git a/release/datafiles/datatoc.c b/release/datafiles/datatoc.c index 2e24a0f92ef..46b935c7fd6 100644 --- a/release/datafiles/datatoc.c +++ b/release/datafiles/datatoc.c @@ -35,7 +35,7 @@ int main(int argc, char**argv) { FILE *fpin, *fpout; char cname[256]; char sizest[256]; - long size; + size_t size; int i; if (argc<1) { diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index e84c7d30956..c84b690bc49 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -32,9 +32,11 @@ #ifndef BKE_CUSTOMDATA_H #define BKE_CUSTOMDATA_H +#include "BLO_sys_types.h" // for intptr_t support + struct CustomData; struct CustomDataLayer; -typedef long CustomDataMask; +typedef intptr_t CustomDataMask; extern const CustomDataMask CD_MASK_BAREMESH; extern const CustomDataMask CD_MASK_MESH; diff --git a/source/blender/blenkernel/BKE_endian.h b/source/blender/blenkernel/BKE_endian.h index 1757103eaf6..dc5efd5ea46 100644 --- a/source/blender/blenkernel/BKE_endian.h +++ b/source/blender/blenkernel/BKE_endian.h @@ -33,11 +33,11 @@ #define BKE_ENDIANNESS(a) { \ union { \ - long l; \ - char c[sizeof (long)]; \ + intptr_t l; \ + char c[sizeof (intptr_t)]; \ } u; \ u.l = 1; \ - a = (u.c[sizeof (long) - 1] == 1) ? 1 : 0; \ + a = (u.c[sizeof (intptr_t) - 1] == 1) ? 1 : 0; \ } #endif diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index a96a3e10f40..f389521ffa0 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -197,8 +197,8 @@ /* Warning-free macros for storing ints in pointers. Use these _only_ * for storing an int in a pointer, not a pointer in an int (64bit)! */ -#define SET_INT_IN_POINTER(i) ((void*)(long)(i)) -#define GET_INT_FROM_POINTER(i) ((int)(long)(i)) +#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i)) +#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i)) #endif diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 9dcb6b6e7fa..1652b24e1e5 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -7,6 +7,8 @@ #include "CCGSubSurf.h" +#include "BLO_sys_types.h" // for intptr_t support + /***/ typedef unsigned char byte; @@ -35,7 +37,7 @@ typedef struct _EHash { #define EHASH_alloc(eh, nb) ((eh)->allocatorIFC.alloc((eh)->allocator, nb)) #define EHASH_free(eh, ptr) ((eh)->allocatorIFC.free((eh)->allocator, ptr)) -#define EHASH_hash(eh, item) (((unsigned long) (item))%((unsigned int) (eh)->curSize)) +#define EHASH_hash(eh, item) (((uintptr_t) (item))%((unsigned int) (eh)->curSize)) static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) { EHash *eh = allocatorIFC->alloc(allocator, sizeof(*eh)); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 67cf89d5ee2..1dabab98a6e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -79,6 +79,8 @@ #include "BKE_utildefines.h" #include "BKE_particle.h" +#include "BLO_sys_types.h" // for intptr_t support + #ifdef WITH_VERSE #include "BKE_verse.h" #endif @@ -479,7 +481,7 @@ static void emDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, EditVert *eve; for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; for(i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) func(userData, i, emdm->vertexCos[(int) eed->v1->tmp.l], emdm->vertexCos[(int) eed->v2->tmp.l]); } else { @@ -497,7 +499,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us EditVert *eve; for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; glBegin(GL_LINES); for(i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) { @@ -532,7 +534,7 @@ static void emDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(vo EditVert *eve; for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; glBegin(GL_LINES); for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) { @@ -619,7 +621,7 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use if (emdm->vertexCos) { for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; } for(i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) { @@ -637,7 +639,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us EditVert *eve; for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; for (i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) { int drawSmooth = (efa->flag & ME_SMOOTH); @@ -733,7 +735,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, EditVert *eve; for (i=0,eve=em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) { MTFace *tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); @@ -1053,7 +1055,7 @@ void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r) /* store vertex indices in tmp union */ for(ev = em->verts.first, i = 0; ev; ev = ev->next, ++i) - ev->tmp.l = (long) i; + ev->tmp.l = (intptr_t) i; for( ; ee; ee = ee->next, ++edge_r) { edge_r->crease = (unsigned char) (ee->crease*255.0f); @@ -1081,7 +1083,7 @@ void emDM_copyFaceArray(DerivedMesh *dm, MFace *face_r) /* store vertexes indices in tmp union */ for(ev = em->verts.first, i = 0; ev; ev = ev->next, ++i) - ev->tmp.l = (long) i; + ev->tmp.l = (intptr_t) i; for( ; ef; ef = ef->next, ++face_r) { face_r->mat_nr = ef->mat_nr; @@ -1168,7 +1170,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob, int i; for (i=0,eve=em->verts.first; eve; eve= eve->next) - eve->tmp.l = (long) i++; + eve->tmp.l = (intptr_t) i++; emdm->vertexNos = MEM_callocN(sizeof(*emdm->vertexNos)*i, "emdm_vno"); emdm->faceNos = MEM_mallocN(sizeof(*emdm->faceNos)*totface, "emdm_vno"); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index c7817b017ef..dbc94571cad 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -155,7 +155,7 @@ void cloth_init ( ClothModifierData *clmd ) BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon) { - int i; + unsigned int i; BVHTree *bvhtree; Cloth *cloth = clmd->clothObject; ClothVertex *verts; @@ -196,7 +196,7 @@ BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon) BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon) { - int i; + unsigned int i; BVHTree *bvhtree; Cloth *cloth = clmd->clothObject; ClothVertex *verts; @@ -782,11 +782,11 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh * /* can be optimized to do all groups in one loop */ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) { - unsigned int i = 0; - unsigned int j = 0; + int i = 0; + int j = 0; MDeformVert *dvert = NULL; Cloth *clothObj = NULL; - unsigned int numverts = dm->getNumVerts ( dm ); + int numverts = dm->getNumVerts ( dm ); float goalfac = 0; ClothVertex *verts = NULL; @@ -857,7 +857,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first) { - unsigned int i = 0; + int i = 0; MVert *mvert = NULL; ClothVertex *verts = NULL; float tnull[3] = {0,0,0}; @@ -1082,13 +1082,13 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) Cloth *cloth = clmd->clothObject; ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL; unsigned int struct_springs = 0, shear_springs=0, bend_springs = 0; - unsigned int i = 0; - unsigned int numverts = dm->getNumVerts ( dm ); - unsigned int numedges = dm->getNumEdges ( dm ); - unsigned int numfaces = dm->getNumFaces ( dm ); + int i = 0; + int numverts = dm->getNumVerts ( dm ); + int numedges = dm->getNumEdges ( dm ); + int numfaces = dm->getNumFaces ( dm ); MEdge *medge = CDDM_get_edges ( dm ); MFace *mface = CDDM_get_faces ( dm ); - unsigned int index2 = 0; // our second vertex index + int index2 = 0; // our second vertex index LinkNode **edgelist = NULL; EdgeHash *edgehash = NULL; LinkNode *search = NULL, *search2 = NULL; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 298e4b81d5b..3b79f6689c0 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -88,6 +88,8 @@ #include "RE_pipeline.h" #include "RE_shader_ext.h" +#include "BLO_sys_types.h" // for intptr_t support + static void boundbox_displist(Object *ob); @@ -986,9 +988,9 @@ void filldisplist(ListBase *dispbase, ListBase *to) efa= fillfacebase.first; index= dlnew->index; while(efa) { - index[0]= (long)efa->v1->tmp.l; - index[1]= (long)efa->v2->tmp.l; - index[2]= (long)efa->v3->tmp.l; + index[0]= (intptr_t)efa->v1->tmp.l; + index[1]= (intptr_t)efa->v2->tmp.l; + index[2]= (intptr_t)efa->v3->tmp.l; index+= 3; efa= efa->next; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b6c8ad59e08..f2cf5047d61 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -630,11 +630,11 @@ void free_old_images() } } -static unsigned long image_mem_size(Image *ima) +static uintptr_t image_mem_size(Image *ima) { ImBuf *ibuf, *ibufm; int level; - unsigned long size = 0; + uintptr_t size = 0; size= 0; for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) { @@ -656,7 +656,7 @@ static unsigned long image_mem_size(Image *ima) void BKE_image_print_memlist(void) { Image *ima; - unsigned long size, totsize= 0; + uintptr_t size, totsize= 0; for(ima= G.main->image.first; ima; ima= ima->id.next) totsize += image_mem_size(ima); diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 297ac0b1530..bf3953f999b 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1363,7 +1363,7 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec { /* Collect forces and derivatives: F,dFdX,dFdV */ Cloth *cloth = clmd->clothObject; - long i = 0; + int i = 0; float spring_air = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */ float gravity[3]; float tm2[3][3] = {{-spring_air,0,0}, {0,-spring_air,0},{0,0,-spring_air}}; @@ -1387,7 +1387,7 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec /* multiply lF with mass matrix // force = mass * acceleration (in this case: gravity) */ - for(i = 0; i < (long)numverts; i++) + for(i = 0; i < numverts; i++) { float temp[3]; VECCOPY(temp, lF[i]); diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h index d42663e17c7..447f6a2a485 100644 --- a/source/blender/blenlib/BLI_editVert.h +++ b/source/blender/blenlib/BLI_editVert.h @@ -38,6 +38,8 @@ #include "DNA_customdata_types.h" #include "DNA_mesh_types.h" +#include "BLO_sys_types.h" // for intptr_t support + struct DerivedMesh; struct RetopoPaintData; @@ -53,7 +55,7 @@ typedef struct EditVert struct EditEdge *e; struct EditFace *f; void *p; - long l; + intptr_t l; float fp; } tmp; float no[3]; /*vertex normal */ @@ -95,7 +97,7 @@ typedef struct EditEdge struct EditEdge *e; struct EditFace *f; void *p; - long l; + intptr_t l; float fp; } tmp; short f1, f2; /* short, f1 is (ab)used in subdiv */ @@ -122,7 +124,7 @@ typedef struct EditFace struct EditEdge *e; struct EditFace *f; void *p; - long l; + intptr_t l; float fp; } tmp; float n[3], cent[3]; diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 227cb8f5e9a..4a05285e504 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -256,11 +256,7 @@ int BLI_ghashutil_ptrcmp(void *a, void *b) { } unsigned int BLI_ghashutil_inthash(void *ptr) { -#if defined(_WIN64) - unsigned __int64 key = (unsigned __int64)ptr; -#else - unsigned long key = (unsigned long)ptr; -#endif + uintptr_t key = (uintptr_t)ptr; key += ~(key << 16); key ^= (key >> 5); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 96de5e99f4f..2acbbbe6712 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -62,6 +62,8 @@ #include "BKE_utildefines.h" #include +#include "BLO_sys_types.h" // for intptr_t support + /* implementations: */ char *first_slash(char *string) { char *ffslash, *fbslash; @@ -72,7 +74,7 @@ char *first_slash(char *string) { if (!ffslash) return fbslash; else if (!fbslash) return ffslash; - if ((long)ffslash < (long)fbslash) return ffslash; + if ((intptr_t)ffslash < (intptr_t)fbslash) return ffslash; else return fbslash; } @@ -85,7 +87,7 @@ char *BLI_last_slash(const char *string) { if (!lfslash) return lbslash; else if (!lbslash) return lfslash; - if ((long)lfslash < (long)lbslash) return lbslash; + if ((intptr_t)lfslash < (intptr_t)lbslash) return lbslash; else return lfslash; } diff --git a/source/blender/blenlib/intern/psfont.c b/source/blender/blenlib/intern/psfont.c index 498c87cdef9..a31d0a4d8ec 100644 --- a/source/blender/blenlib/intern/psfont.c +++ b/source/blender/blenlib/intern/psfont.c @@ -54,7 +54,7 @@ typedef struct chardesc { short llx, lly; /* bounding box */ short urx, ury; short *data; /* char data */ - long datalen; + intptr_t datalen; } chardesc; typedef struct objfnt { diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 48ebf770e1b..a31121148e3 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1970,7 +1970,7 @@ void BLI_timestr(double _time, char *str) int BLI_int_from_pointer(void *poin) { - long lval= (long)poin; + intptr_t lval= (intptr_t)poin; return (int)(lval>>3); } @@ -1978,17 +1978,17 @@ int BLI_int_from_pointer(void *poin) void *BLI_pointer_from_int(int val) { static int firsttime= 1; - static long basevalue= 0; + static intptr_t basevalue= 0; if(firsttime) { void *poin= malloc(10000); - basevalue= (long)poin; + basevalue= (intptr_t)poin; basevalue &= ~PMASK; printf("base: %d pointer %p\n", basevalue, poin); /* debug */ firsttime= 0; free(poin); } - return (void *)(basevalue | (((long)val)<<3)); + return (void *)(basevalue | (((intptr_t)val)<<3)); } #else diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c index e65148a0b04..9c08a0b2f9d 100644 --- a/source/blender/blenpluginapi/intern/pluginapi.c +++ b/source/blender/blenpluginapi/intern/pluginapi.c @@ -50,10 +50,12 @@ #include "plugin.h" #include "MEM_guardedalloc.h" +#include "BLO_sys_types.h" // needed for intptr_t + #include "BLI_blenlib.h" /* util and noise functions */ #include "BLI_threads.h" /* For threadsfe guardedalloc malloc/calloc/free */ #include "IMB_imbuf.h" /* image buffer stuff */ -#define GET_INT_FROM_POINTER(i) ((int)(long)(i)) /* should use BKE_utildefines.h */ +#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i)) /* should use BKE_utildefines.h */ /* -------------------------------------------------------------------------- */ /* stuff from util.h */ diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 3b45a9de822..ecee3c7d6c0 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -67,12 +67,12 @@ fillCineonFileInfo(CineonFile* cineon, CineonFileInformation* fileInfo, const ch static void dumpCineonFileInfo(CineonFileInformation* fileInfo) { d_printf("\n--File Information--\n"); - d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num)); - d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->image_offset)); - d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size)); - d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size)); - d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size)); - d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size)); + d_printf("Magic: %8.8lX\n", (uintptr_t)ntohl(fileInfo->magic_num)); + d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->image_offset)); + d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size)); + d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size)); + d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size)); + d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size)); d_printf("Version \"%s\"\n", fileInfo->vers); d_printf("File name \"%s\"\n", fileInfo->file_name); d_printf("Creation date \"%s\"\n", fileInfo->create_date); @@ -112,11 +112,11 @@ dumpCineonChannelInfo(CineonChannelInformation* chan) { default: d_printf(" (unknown)\n"); break; } d_printf(" Bits per pixel %d\n", chan->bits_per_pixel); - d_printf(" Pixels per line %ld\n", (long)ntohl(chan->pixels_per_line)); - d_printf(" Lines per image %ld\n", (long)ntohl(chan->lines_per_image)); - d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data)); + d_printf(" Pixels per line %ld\n", (intptr_t)ntohl(chan->pixels_per_line)); + d_printf(" Lines per image %ld\n", (intptr_t)ntohl(chan->lines_per_image)); + d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data)); d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity)); - d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data)); + d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data)); d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity)); } @@ -231,8 +231,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) { } else { d_printf(" positive\n"); } - d_printf("End of line padding %ld\n", (long)ntohl(formatInfo->line_padding)); - d_printf("End of channel padding %ld\n", (long)ntohl(formatInfo->channel_padding)); + d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding)); + d_printf("End of channel padding %ld\n", (intptr_t)ntohl(formatInfo->channel_padding)); } static void @@ -256,8 +256,8 @@ fillCineonOriginationInfo(CineonFile* cineon, static void dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) { d_printf("\n--Origination Information--\n"); - d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset)); - d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset)); + d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset)); + d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset)); d_printf("File name \"%s\"\n", originInfo->file_name); d_printf("Creation date \"%s\"\n", originInfo->create_date); d_printf("Creation time \"%s\"\n", originInfo->create_time); @@ -529,7 +529,7 @@ cineonOpen(const char* filename) { /* let's assume cineon files are always network order */ if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) { if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n", - (unsigned long)ntohl(header.fileInfo.magic_num), filename); + (uintptr_t)ntohl(header.fileInfo.magic_num), filename); cineonClose(cineon); return 0; } @@ -628,7 +628,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) { /* let's assume cineon files are always network order */ if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) { - if (verbose) d_printf("Bad magic number %8.8lX in\n", (unsigned long)ntohl(header.fileInfo.magic_num)); + if (verbose) d_printf("Bad magic number %8.8lX in\n", (uintptr_t)ntohl(header.fileInfo.magic_num)); cineonClose(cineon); return 0; diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index 500c09ba265..1710cdde501 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -58,15 +58,15 @@ fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { static void dumpDpxChannelInfo(DpxChannelInformation* chan) { - d_printf(" Signage %ld", (long)ntohl(chan->signage)); - d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data)); + d_printf(" Signage %ld", (intptr_t)ntohl(chan->signage)); + d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data)); d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity)); - d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data)); + d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data)); d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity)); d_printf(" Designator1: %d,", chan->designator1); d_printf(" Bits per pixel %d\n", chan->bits_per_pixel); d_printf(" Packing: %d,", ntohs(chan->packing)); - d_printf(" Data Offset: %ld,", (long)ntohl(chan->data_offset)); + d_printf(" Data Offset: %ld,", (intptr_t)ntohl(chan->data_offset)); } static void @@ -110,19 +110,19 @@ static void dumpDpxFileInfo(DpxFileInformation* fileInfo) { d_printf("\n--File Information--\n"); d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num)); - d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->offset)); + d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->offset)); d_printf("Version \"%s\"\n", fileInfo->vers); - d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size)); - d_printf("Ditto key %ld\n", (long)ntohl(fileInfo->ditto_key)); - d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size)); - d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size)); - d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size)); + d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size)); + d_printf("Ditto key %ld\n", (intptr_t)ntohl(fileInfo->ditto_key)); + d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size)); + d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size)); + d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size)); d_printf("File name \"%s\"\n", fileInfo->file_name); d_printf("Creation date \"%s\"\n", fileInfo->create_date); d_printf("Creator \"%s\"\n", fileInfo->creator); d_printf("Project \"%s\"\n", fileInfo->project); d_printf("Copyright \"%s\"\n", fileInfo->copyright); - d_printf("Key %ld\n", (long)ntohl(fileInfo->key)); + d_printf("Key %ld\n", (intptr_t)ntohl(fileInfo->key)); } static void @@ -150,8 +150,8 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) { d_printf("Image orientation %d,", ntohs(imageInfo->orientation)); n = ntohs(imageInfo->channels_per_image); d_printf("Channels %d\n", n); - d_printf("Pixels per line %ld\n", (long)ntohl(imageInfo->pixels_per_line)); - d_printf("Lines per image %ld\n", (long)ntohl(imageInfo->lines_per_image)); + d_printf("Pixels per line %ld\n", (intptr_t)ntohl(imageInfo->pixels_per_line)); + d_printf("Lines per image %ld\n", (intptr_t)ntohl(imageInfo->lines_per_image)); for (i = 0; i < n; ++i) { d_printf(" --Channel %d--\n", i); dumpDpxChannelInfo(&imageInfo->channel[i]); @@ -166,12 +166,12 @@ fillDpxOriginationInfo( static void dumpDpxOriginationInfo(DpxOriginationInformation* originInfo) { d_printf("\n--Origination Information--\n"); - d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset)); - d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset)); + d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset)); + d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset)); d_printf("X centre %f\n", ntohf(originInfo->x_centre)); d_printf("Y centre %f\n", ntohf(originInfo->y_centre)); - d_printf("Original X %ld\n", (long)ntohl(originInfo->x_original_size)); - d_printf("Original Y %ld\n", (long)ntohl(originInfo->y_original_size)); + d_printf("Original X %ld\n", (intptr_t)ntohl(originInfo->x_original_size)); + d_printf("Original Y %ld\n", (intptr_t)ntohl(originInfo->y_original_size)); d_printf("File name \"%s\"\n", originInfo->file_name); d_printf("Creation time \"%s\"\n", originInfo->creation_time); d_printf("Input device \"%s\"\n", originInfo->input_device); @@ -417,7 +417,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { /* let's assume dpx files are always network order */ if (header.fileInfo.magic_num != ntohl(DPX_FILE_MAGIC)) { if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n", - (unsigned long)ntohl(header.fileInfo.magic_num), filename); + (uintptr_t)ntohl(header.fileInfo.magic_num), filename); dpxClose(dpx); return 0; } diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h index 01eff8d570d..b23509bb94d 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.h +++ b/source/blender/imbuf/intern/cineon/logImageCore.h @@ -80,7 +80,7 @@ struct _Log_Image_File_t_ CloseFn* close; unsigned char *membuffer; - unsigned long membuffersize; + uintptr_t membuffersize; unsigned char *memcursor; }; diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c index 20359335933..160e8453713 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.c +++ b/source/blender/imbuf/intern/cineon/logmemfile.c @@ -24,10 +24,10 @@ #include "logImageCore.h" -int logimage_fseek(void* logfile, long offsett, int origin) +int logimage_fseek(void* logfile, intptr_t offsett, int origin) { struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile; - long offset = offsett; + intptr_t offset = offsett; if (file->file) fseek(file->file, offset, origin); else { /*we're seeking in memory*/ @@ -38,7 +38,7 @@ int logimage_fseek(void* logfile, long offsett, int origin) if (offset > file->membuffersize) return 1; file->memcursor = (file->membuffer + file->membuffersize) - offset; } else if (origin==SEEK_CUR) { - unsigned long pos = (unsigned long)file->membuffer - (unsigned long)file->memcursor; + uintptr_t pos = (uintptr_t)file->membuffer - (uintptr_t)file->memcursor; if (pos + offset > file->membuffersize) return 1; if (pos < 0) return 1; file->memcursor += offset; diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h index 6e82cf2b145..39e2f36dad9 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.h +++ b/source/blender/imbuf/intern/cineon/logmemfile.h @@ -22,7 +22,7 @@ #ifndef _LOGMEMFILE_H #define _LOGMEMFILE_H -int logimage_fseek(void* logfile, long offsett, int origin); +int logimage_fseek(void* logfile, intptr_t offsett, int origin); int logimage_fwrite(void *buffer, unsigned int size, unsigned int count, void *logfile); int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *logfile); diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 40c1f83c98c..66a38223b4c 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -490,8 +490,8 @@ static void enlarge_picture_byte( / (double) (src_width - 1.001); double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001); - unsigned long x_src, dx_src, x_dst; - unsigned long y_src, dy_src, y_dst; + uintptr_t x_src, dx_src, x_dst; + uintptr_t y_src, dy_src, y_dst; dx_src = 65536.0 / ratiox; dy_src = 65536.0 / ratioy; @@ -500,8 +500,8 @@ static void enlarge_picture_byte( for (y_dst = 0; y_dst < dst_height; y_dst++) { unsigned char* line1 = src + (y_src >> 16) * 4 * src_width; unsigned char* line2 = line1 + 4 * src_width; - unsigned long weight1y = 65536 - (y_src & 0xffff); - unsigned long weight2y = 65536 - weight1y; + uintptr_t weight1y = 65536 - (y_src & 0xffff); + uintptr_t weight2y = 65536 - weight1y; if ((y_src >> 16) == src_height - 1) { line2 = line1; @@ -509,8 +509,8 @@ static void enlarge_picture_byte( x_src = 0; for (x_dst = 0; x_dst < dst_width; x_dst++) { - unsigned long weight1x = 65536 - (x_src & 0xffff); - unsigned long weight2x = 65536 - weight1x; + uintptr_t weight1x = 65536 - (x_src & 0xffff); + uintptr_t weight2x = 65536 - weight1x; unsigned long x = (x_src >> 16) * 4; @@ -557,12 +557,12 @@ static void enlarge_picture_byte( } struct scale_outpix_byte { - unsigned long r; - unsigned long g; - unsigned long b; - unsigned long a; + uintptr_t r; + uintptr_t g; + uintptr_t b; + uintptr_t a; - unsigned long weight; + uintptr_t weight; }; static void shrink_picture_byte( @@ -571,9 +571,9 @@ static void shrink_picture_byte( { double ratiox = (double) (dst_width) / (double) (src_width); double ratioy = (double) (dst_height) / (double) (src_height); - unsigned long x_src, dx_dst, x_dst; - unsigned long y_src, dy_dst, y_dst; - long y_counter; + uintptr_t x_src, dx_dst, x_dst; + uintptr_t y_src, dy_dst, y_dst; + intptr_t y_counter; unsigned char * dst_begin = dst; struct scale_outpix_byte * dst_line1 = NULL; @@ -593,16 +593,16 @@ static void shrink_picture_byte( y_counter = 65536; for (y_src = 0; y_src < src_height; y_src++) { unsigned char* line = src + y_src * 4 * src_width; - unsigned long weight1y = 65536 - (y_dst & 0xffff); - unsigned long weight2y = 65536 - weight1y; + uintptr_t weight1y = 65536 - (y_dst & 0xffff); + uintptr_t weight2y = 65536 - weight1y; x_dst = 0; for (x_src = 0; x_src < src_width; x_src++) { - unsigned long weight1x = 65536 - (x_dst & 0xffff); - unsigned long weight2x = 65536 - weight1x; + uintptr_t weight1x = 65536 - (x_dst & 0xffff); + uintptr_t weight2x = 65536 - weight1x; - unsigned long x = x_dst >> 16; + uintptr_t x = x_dst >> 16; - unsigned long w; + uintptr_t w; w = (weight1y * weight1x) >> 16; @@ -643,13 +643,13 @@ static void shrink_picture_byte( y_dst += dy_dst; y_counter -= dy_dst; if (y_counter < 0) { - unsigned long x; + uintptr_t x; struct scale_outpix_byte * temp; y_counter += 65536; for (x=0; x < dst_width; x++) { - unsigned long f = 0x80000000UL + uintptr_t f = 0x80000000UL / dst_line1[x].weight; *dst++ = (dst_line1[x].r * f) >> 15; *dst++ = (dst_line1[x].g * f) >> 15; @@ -664,9 +664,9 @@ static void shrink_picture_byte( } } if (dst - dst_begin < dst_width * dst_height * 4) { - unsigned long x; + uintptr_t x; for (x = 0; x < dst_width; x++) { - unsigned long f = 0x80000000UL / dst_line1[x].weight; + uintptr_t f = 0x80000000UL / dst_line1[x].weight; *dst++ = (dst_line1[x].r * f) >> 15; *dst++ = (dst_line1[x].g * f) >> 15; *dst++ = (dst_line1[x].b * f) >> 15; @@ -698,8 +698,8 @@ static void enlarge_picture_float( / (double) (src_width - 1.001); double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001); - unsigned long x_dst; - unsigned long y_dst; + uintptr_t x_dst; + uintptr_t y_dst; double x_src, dx_src; double y_src, dy_src; @@ -727,7 +727,7 @@ static void enlarge_picture_float( float w12 = weight1y * weight2x; float w22 = weight2y * weight2x; - unsigned long x = ((int) x_src) * 4; + uintptr_t x = ((int) x_src) * 4; *dst++ = line1[x] * w11 + line2[x] * w21 @@ -770,8 +770,8 @@ static void shrink_picture_float( { double ratiox = (double) (dst_width) / (double) (src_width); double ratioy = (double) (dst_height) / (double) (src_height); - unsigned long x_src; - unsigned long y_src; + uintptr_t x_src; + uintptr_t y_src; float dx_dst, x_dst; float dy_dst, y_dst; float y_counter; @@ -794,14 +794,14 @@ static void shrink_picture_float( y_counter = 1.0; for (y_src = 0; y_src < src_height; y_src++) { float* line = src + y_src * 4 * src_width; - unsigned long weight1y = 1.0 - (y_dst - (int) y_dst); - unsigned long weight2y = 1.0 - weight1y; + uintptr_t weight1y = 1.0 - (y_dst - (int) y_dst); + uintptr_t weight2y = 1.0 - weight1y; x_dst = 0; for (x_src = 0; x_src < src_width; x_src++) { - unsigned long weight1x = 1.0 - (x_dst - (int) x_dst); - unsigned long weight2x = 1.0 - weight1x; + uintptr_t weight1x = 1.0 - (x_dst - (int) x_dst); + uintptr_t weight2x = 1.0 - weight1x; - unsigned long x = (int) x_dst; + uintptr_t x = (int) x_dst; float w; @@ -844,7 +844,7 @@ static void shrink_picture_float( y_dst += dy_dst; y_counter -= dy_dst; if (y_counter < 0) { - unsigned long x; + uintptr_t x; struct scale_outpix_float * temp; y_counter += 1.0; @@ -864,7 +864,7 @@ static void shrink_picture_float( } } if (dst - dst_begin < dst_width * dst_height * 4) { - unsigned long x; + uintptr_t x; for (x = 0; x < dst_width; x++) { float f = 1.0 / dst_line1[x].weight; *dst++ = dst_line1[x].r * f; diff --git a/source/blender/include/BIF_meshtools.h b/source/blender/include/BIF_meshtools.h index b08c66fd16e..d809d1f21f9 100644 --- a/source/blender/include/BIF_meshtools.h +++ b/source/blender/include/BIF_meshtools.h @@ -40,7 +40,7 @@ extern void objects_bake_render_menu(void); extern void objects_bake_render_ui(short event); extern void objects_bake_render(short event, char **error_msg); -extern long mesh_octree_table(struct Object *ob, float *co, char mode); +extern intptr_t mesh_octree_table(struct Object *ob, float *co, char mode); extern int mesh_get_x_mirror_vert(struct Object *ob, int index); extern struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, float *co); extern int *mesh_get_x_mirror_faces(struct Object *ob); diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 3818d66b39c..b4deb1f2b60 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -55,6 +55,8 @@ #include "MEM_guardedalloc.h" #include "DNA_sdna_types.h" +#include "BLO_sys_types.h" // for intptr_t support + #ifdef HAVE_CONFIG_H #include #endif @@ -955,7 +957,7 @@ int make_structDNA(char *baseDirectory, FILE *file) /* calculate size of datablock with strings */ cp= names[nr_names-1]; cp+= strlen(names[nr_names-1]) + 1; /* +1: null-terminator */ - len= (long) (cp - (char*) names[0]); + len= (intptr_t) (cp - (char*) names[0]); len= (len+3) & ~3; dna_write(file, names[0], len); @@ -968,7 +970,7 @@ int make_structDNA(char *baseDirectory, FILE *file) /* calculate datablock size */ cp= types[nr_types-1]; cp+= strlen(types[nr_types-1]) + 1; /* +1: null-terminator */ - len= (long) (cp - (char*) types[0]); + len= (intptr_t) (cp - (char*) types[0]); len= (len+3) & ~3; dna_write(file, types[0], len); @@ -990,7 +992,7 @@ int make_structDNA(char *baseDirectory, FILE *file) /* calc datablock size */ sp= structs[nr_structs-1]; sp+= 2+ 2*( sp[1] ); - len= (long) ((char*) sp - (char*) structs[0]); + len= (intptr_t) ((char*) sp - (char*) structs[0]); len= (len+3) & ~3; dna_write(file, structs[0], len); diff --git a/source/blender/radiosity/CMakeLists.txt b/source/blender/radiosity/CMakeLists.txt index 36e9ad19770..941da41a5b2 100644 --- a/source/blender/radiosity/CMakeLists.txt +++ b/source/blender/radiosity/CMakeLists.txt @@ -29,7 +29,7 @@ FILE(GLOB SRC intern/source/*.c) SET(INC extern/include ../blenlib ../blenkernel ../makesdna ../include ../../../intern/guardedalloc ../render/extern/include - ../render/intern/include + ../render/intern/include ../blenloader ) BLENDERLIB_NOLIST(blender_radiosity "${SRC}" "${INC}") diff --git a/source/blender/radiosity/SConscript b/source/blender/radiosity/SConscript index 102f79683f9..a86b76bb4b1 100644 --- a/source/blender/radiosity/SConscript +++ b/source/blender/radiosity/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/source/*.c') incs = 'extern/include ../blenlib ../blenkernel ../makesdna ../include' incs += ' #/intern/guardedalloc ../render/extern/include' -incs += ' ../render/intern/include' +incs += ' ../render/intern/include ../blenloader' incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/blender/radiosity/intern/source/Makefile b/source/blender/radiosity/intern/source/Makefile index 19768c959c7..e5ff8c40d08 100644 --- a/source/blender/radiosity/intern/source/Makefile +++ b/source/blender/radiosity/intern/source/Makefile @@ -44,6 +44,7 @@ CPPFLAGS += -I../../../blenlib CPPFLAGS += -I../../../makesdna CPPFLAGS += -I../../../imbuf CPPFLAGS += -I../../../ +CPPFLAGS += -I../../../blenloader CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # first /include is my own includes, second are the external includes diff --git a/source/blender/radiosity/intern/source/radnode.c b/source/blender/radiosity/intern/source/radnode.c index 5517a22eb93..042fe6840fc 100644 --- a/source/blender/radiosity/intern/source/radnode.c +++ b/source/blender/radiosity/intern/source/radnode.c @@ -50,6 +50,8 @@ #include "radio.h" +#include "BLO_sys_types.h" // for intptr_t support + #ifdef HAVE_CONFIG_H #include #endif @@ -167,14 +169,14 @@ void *calloc_fast(int size) void free_fast(void *poin, int size) { MallocGroup *mg; - long val; + intptr_t val; mg= MallocBase.last; while(mg) { if(mg->size==size) { - if( ((long)poin) >= ((long)mg->data) ) { - if( ((long)poin) < ((long)(mg->data+MAL_GROUPSIZE*size)) ) { - val= ((long)poin) - ((long)mg->data); + if( ((intptr_t)poin) >= ((intptr_t)mg->data) ) { + if( ((intptr_t)poin) < ((intptr_t)(mg->data+MAL_GROUPSIZE*size)) ) { + val= ((intptr_t)poin) - ((intptr_t)mg->data); val/= size; mg->curfree= val; mg->flags[val]= 0; diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c index 5f8a39786c1..07b933b6db9 100644 --- a/source/blender/radiosity/intern/source/radpreprocess.c +++ b/source/blender/radiosity/intern/source/radpreprocess.c @@ -68,6 +68,8 @@ #include "radio.h" +#include "BLO_sys_types.h" // for intptr_t support + #ifdef HAVE_CONFIG_H #include #endif @@ -179,7 +181,7 @@ int vergedge(const void *v1,const void *v2) void addedge(float *v1, float *v2, EdSort *es) { - if( ((long)v1)<((long)v2) ) { + if( ((intptr_t)v1)<((intptr_t)v2) ) { es->v1= v1; es->v2= v2; } diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index b543dff49ff..0b659554d1a 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -29,7 +29,7 @@ FILE(GLOB SRC intern/source/*.c) SET(INC intern/include ../../../intern/guardedalloc ../blenlib ../makesdna extern/include ../blenkernel ../radiosity/extern/include ../imbuf - ../quicktime ../include ../../kernel/gen_messaging ../yafray + ../quicktime ../include ../../kernel/gen_messaging ../yafray ../blenloader ) IF(WITH_OPENEXR) diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript index b1bc9673f23..f0d1353b0d3 100644 --- a/source/blender/render/SConscript +++ b/source/blender/render/SConscript @@ -6,7 +6,7 @@ sources = env.Glob('intern/source/*.c') incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna' incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf' -incs += ' ../quicktime ../include ../../kernel/gen_messaging' +incs += ' ../quicktime ../include ../../kernel/gen_messaging ../blenloader' defs = [] diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 2f97b19f75c..f83bbd7e8b2 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -44,6 +44,8 @@ #include "RE_shader_ext.h" /* TexResult, ShadeResult, ShadeInput */ #include "sunsky.h" +#include "BLO_sys_types.h" // for intptr_t support + struct Object; struct MemArena; struct VertTableNode; @@ -89,11 +91,11 @@ typedef struct RenderPart int *rectp; /* polygon index table */ int *rectz; /* zbuffer */ int *rectmask; /* negative zmask */ - long *rectdaps; /* delta acum buffer for pixel structs */ + intptr_t *rectdaps; /* delta acum buffer for pixel structs */ int *rectbacko; /* object table for backside sss */ int *rectbackp; /* polygon index table for backside sss */ int *rectbackz; /* zbuffer for backside sss */ - long *rectall; /* buffer for all faces for sss */ + intptr_t *rectall; /* buffer for all faces for sss */ rcti disprect; /* part coordinates within total picture */ int rectx, recty; /* the size */ @@ -226,7 +228,7 @@ struct ISBData; typedef struct ShadSampleBuf { struct ShadSampleBuf *next, *prev; - long *zbuf; + intptr_t *zbuf; char *cbuf; } ShadSampleBuf; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index d70c51b83bc..15c57eb9362 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1670,7 +1670,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp) OcclusionCacheSample *sample; OccFace exclude; ShadeInput *shi; - long *rd=NULL; + intptr_t *rd=NULL; int *ro=NULL, *rp=NULL, *rz=NULL, onlyshadow; int x, y, step = CACHE_STEP; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 6a0af82b4d7..3cd7bdc6772 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -138,7 +138,7 @@ static void print_error(char *str) {printf("ERROR: %s\n", str);} static void stats_background(RenderStats *rs) { - extern unsigned long mem_in_use; + extern uintptr_t mem_in_use; float megs_used_memory= mem_in_use/(1024.0*1024.0); char str[400], *spos= str; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 4520e4c10bb..4a2ad995b39 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -243,7 +243,7 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl) rcti disprect= pa->disprect, testrect= pa->disprect; float dist, xsq, ysq, xn, yn; float col[4]; - long *rd= NULL; + intptr_t *rd= NULL; int a, *rz, zz, y, sample, totsample, od; short minx, maxx, miny, maxy, x; unsigned int lay= rl->lay; @@ -324,7 +324,7 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl) ShadeInput shi; float *pass; float fac, col[4]; - long *rd= pa->rectdaps; + intptr_t *rd= pa->rectdaps; int *rz= pa->rectz; int x, y, sample, totsample, fullsample, od; @@ -767,7 +767,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl) { RenderResult *rr= pa->result; ShadeSample ssamp; - long *rd, *rectdaps= pa->rectdaps; + intptr_t *rd, *rectdaps= pa->rectdaps; int samp; int x, y, seed, crop=0, offs=0, od; @@ -874,7 +874,7 @@ static void freeps(ListBase *lb) lb->first= lb->last= NULL; } -static void addps(ListBase *lb, long *rd, int obi, int facenr, int z, int maskz, unsigned short mask) +static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int maskz, unsigned short mask) { PixStrMain *psm; PixStr *ps, *last= NULL; @@ -901,7 +901,7 @@ static void addps(ListBase *lb, long *rd, int obi, int facenr, int z, int maskz, ps= psm->ps + psm->counter++; if(last) last->next= ps; - else *rd= (long)ps; + else *rd= (intptr_t)ps; ps->next= NULL; ps->obi= obi; @@ -1027,7 +1027,7 @@ static void reset_sky_speed(RenderPart *pa, RenderLayer *rl) static unsigned short *make_solid_mask(RenderPart *pa) { - long *rd= pa->rectdaps; + intptr_t *rd= pa->rectdaps; unsigned short *solidmask, *sp; int x; @@ -1092,7 +1092,7 @@ void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *data) { ZbufSolidData *sdata= (ZbufSolidData*)data; ListBase *lb= sdata->psmlist; - long *rd= pa->rectdaps; + intptr_t *rd= pa->rectdaps; int *ro= zspan->recto; int *rp= zspan->rectp; int *rz= zspan->rectz; @@ -1133,7 +1133,7 @@ void zbufshadeDA_tile(RenderPart *pa) /* initialize pixelstructs and edge buffer */ addpsmain(&psmlist); - pa->rectdaps= MEM_callocN(sizeof(long)*pa->rectx*pa->recty+4, "zbufDArectd"); + pa->rectdaps= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "zbufDArectd"); if(rl->layflag & SCE_LAY_EDGE) if(R.r.mode & R_EDGE) @@ -1433,7 +1433,7 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z) return; if(pa->rectall) { - long *rs= pa->rectall + pa->rectx*y + x; + intptr_t *rs= pa->rectall + pa->rectx*y + x; addps(&handle->psmlist, rs, obi, facenr, z, 0, 0); handle->totps++; @@ -1569,7 +1569,7 @@ void zbufshade_sss_tile(RenderPart *pa) int *ro, *rz, *rp, *rbo, *rbz, *rbp, lay; #if 0 PixStr *ps; - long *rs; + intptr_t *rs; int z; #endif @@ -1581,7 +1581,7 @@ void zbufshade_sss_tile(RenderPart *pa) handle.psmlist.first= handle.psmlist.last= NULL; addpsmain(&handle.psmlist); - pa->rectall= MEM_callocN(sizeof(long)*pa->rectx*pa->recty+4, "rectall"); + pa->rectall= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "rectall"); #else pa->recto= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "recto"); pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp"); diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index f3258b601de..f477df3ed8c 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -171,7 +171,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) { ShadSampleBuf *shsample; float dist; - unsigned long *ztile; + uintptr_t *ztile; int *rz, *rz1, verg, verg1, size= shb->size; int a, x, y, minx, miny, byt1, byt2; char *rc, *rcline, *ctile, *zt; @@ -179,10 +179,10 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) shsample= MEM_mallocN( sizeof(ShadSampleBuf), "shad sample buf"); BLI_addtail(&shb->buffers, shsample); - shsample->zbuf= MEM_mallocN( sizeof(unsigned long)*(size*size)/256, "initshadbuf2"); + shsample->zbuf= MEM_mallocN( sizeof(uintptr_t)*(size*size)/256, "initshadbuf2"); shsample->cbuf= MEM_callocN( (size*size)/256, "initshadbuf3"); - ztile= (unsigned long *)shsample->zbuf; + ztile= (uintptr_t *)shsample->zbuf; ctile= shsample->cbuf; /* help buffer */ @@ -237,7 +237,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) } if(byt1 && byt2) { /* only store byte */ *ctile= 1; - *ztile= (unsigned long)MEM_mallocN(256+4, "tile1"); + *ztile= (uintptr_t)MEM_mallocN(256+4, "tile1"); rz= (int *)*ztile; *rz= *rz1; @@ -247,7 +247,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) } else if(byt1) { /* only store short */ *ctile= 2; - *ztile= (unsigned long)MEM_mallocN(2*256+4,"Tile2"); + *ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2"); rz= (int *)*ztile; *rz= *rz1; @@ -260,7 +260,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) } else { /* store triple */ *ctile= 3; - *ztile= (unsigned long)MEM_mallocN(3*256,"Tile3"); + *ztile= (uintptr_t)MEM_mallocN(3*256,"Tile3"); zt= (char *)*ztile; rc= rcline; @@ -542,7 +542,7 @@ void freeshadowbuf(LampRen *lar) v= (shb->size*shb->size)/256; for(shsample= shb->buffers.first; shsample; shsample= shsample->next) { - long *ztile= shsample->zbuf; + intptr_t *ztile= shsample->zbuf; char *ctile= shsample->cbuf; for(b=0; brectdaps) { /* find the z of the sample */ PixStr *ps; - long *rd= spart->rectdaps + offset; + intptr_t *rd= spart->rectdaps + offset; bufferz= 0x7FFFFFFF; if(spart->rectmask) maskz= 0x7FFFFFFF; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index c91c9e2f799..29aa6e3be29 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2278,7 +2278,7 @@ static int hashlist_projectvert(float *v1, float winmat[][4], float *hoco) return 0; } - buck= &bucket[ (((long)v1)/16) & 255 ]; + buck= &bucket[ (((intptr_t)v1)/16) & 255 ]; if(buck->vert==v1) { QUATCOPY(hoco, buck->hoco); return buck->clip; @@ -3263,7 +3263,7 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample) { PixStr *ps; int x, y, *rza, *rma; - long *rd; + intptr_t *rd; if(R.osa==0) { memcpy(arectz, pa->rectz, sizeof(int)*pa->rectx*pa->recty); @@ -3484,7 +3484,7 @@ static int zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, Re /* speed pointer NULL = sky, we clear */ /* else if either alpha is full or no solid was filled in: copy speed */ /* else fill in minimum speed */ -void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, long *rdrect) +void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, intptr_t *rdrect) { RenderPass *rpass; @@ -3958,7 +3958,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas ZTranspRow zrow[MAX_ZROW]; StrandShadeCache *sscache= NULL; float sampalpha, alpha, *passrect= pass; - long *rdrect; + intptr_t *rdrect; int x, y, crop=0, a, b, totface, totsample, doztra; int addpassflag, offs= 0, od, addzbuf, osa = (R.osa? R.osa: 1); unsigned short *ztramask= NULL, filled; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index cb6f7e629fa..27ddca1aaa5 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -4145,7 +4145,7 @@ static void validate_posebonebutton_cb(void *bonev, void *namev) static void armature_layer_cb(void *lay_v, void *value_v) { short *layer= lay_v; - int value= (long)value_v; + int value= (intptr_t)value_v; if(*layer==0 || G.qual==0) *layer= value; allqueue(REDRAWBUTSEDIT, 0); diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index fb6a7636e16..dd0a904ab4f 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -3261,7 +3261,7 @@ static void layer_copy_func(void *lay_v, void *lay_p) static void delete_scene_layer_func(void *srl_v, void *act_i) { if(BLI_countlist(&G.scene->r.layers)>1) { - long act= (long)act_i; + intptr_t act= (intptr_t)act_i; BLI_remlink(&G.scene->r.layers, srl_v); MEM_freeN(srl_v); @@ -3322,7 +3322,7 @@ static char *scene_layer_menu(void) static void draw_3d_layer_buttons(uiBlock *block, int type, unsigned int *poin, short xco, short yco, short dx, short dy, char *tip) { uiBut *bt; - long a; + intptr_t a; uiBlockBeginAlign(block); for(a=0; a<5; a++) { @@ -3381,7 +3381,7 @@ static void render_panel_layers(void) uiDefButBitI(block, TOG, R_SINGLE_LAYER, B_NOP, "Single", 230,145,60,20, &G.scene->r.scemode, 0, 0, 0, 0, "Only render this layer"); bt=uiDefIconBut(block, BUT, B_NOP, ICON_X, 285, 145, 25, 20, 0, 0, 0, 0, 0, "Deletes current Render Layer"); - uiButSetFunc(bt, delete_scene_layer_func, srl, (void *)(long)G.scene->r.actlay); + uiButSetFunc(bt, delete_scene_layer_func, srl, (void *)(intptr_t)G.scene->r.actlay); uiBlockEndAlign(block); /* RenderLayer visible-layers */ diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index dd512595ebc..09f74c01c71 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -664,7 +664,7 @@ static int draw_tfaces3D__setHiddenOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; - unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2); + uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); if((G.f & G_DRAWSEAMS) && (med->flag&ME_SEAM)) { return 0; @@ -682,7 +682,7 @@ static int draw_tfaces3D__setSeamOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; - unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2); + uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); if (med->flag&ME_SEAM) { if (G.f&G_HIDDENEDGES) { @@ -698,7 +698,7 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; - unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2); + uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); return flags & eEdge_Select; } @@ -706,7 +706,7 @@ static int draw_tfaces3D__setActiveOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; - unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2); + uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); if (flags & eEdge_Select) { return 1; diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 1a469e8b366..213f49528f0 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -5315,7 +5315,7 @@ void draw_object_ext(Base *base) static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) { - int offset = (long) userData; + int offset = (intptr_t) userData; EditVert *eve = EM_get_vert_for_index(index); if (eve->h==0) { @@ -5327,7 +5327,7 @@ static int bbs_mesh_verts(DerivedMesh *dm, int offset) { glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) ); bglBegin(GL_POINTS); - dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(long) offset); + dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(intptr_t) offset); bglEnd(); glPointSize(1.0); @@ -5336,7 +5336,7 @@ static int bbs_mesh_verts(DerivedMesh *dm, int offset) static int bbs_mesh_wire__setDrawOptions(void *userData, int index) { - int offset = (long) userData; + int offset = (intptr_t) userData; EditEdge *eed = EM_get_edge_for_index(index); if (eed->h==0) { @@ -5348,7 +5348,7 @@ static int bbs_mesh_wire__setDrawOptions(void *userData, int index) } static int bbs_mesh_wire(DerivedMesh *dm, int offset) { - dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(long) offset); + dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset); return offset + G.totedge; } @@ -5382,7 +5382,7 @@ static int bbs_mesh_solid_EM(DerivedMesh *dm, int facecol) cpack(0); if (facecol) { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0); if( CHECK_OB_DRAWFACEDOT(G.scene, G.vd, G.obedit->dt) ) { glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE)); @@ -5415,7 +5415,7 @@ static int bbs_mesh_wire__setDrawOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; int offset; } *data = userData; MEdge *med = data->me->medge + index; - unsigned long flags = (long)BLI_edgehash_lookup(data->eh, med->v1, med->v2); + uintptr_t flags = (intptr_t)BLI_edgehash_lookup(data->eh, med->v1, med->v2); if (flags & 1) { set_framebuffer_index_color(data->offset+index); diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c index 1f24fb07667..ce798064632 100644 --- a/source/blender/src/editkey.c +++ b/source/blender/src/editkey.c @@ -84,6 +84,8 @@ #include "blendef.h" #include "mydevice.h" +#include "BLO_sys_types.h" // for intptr_t support + extern ListBase editNurb; /* in editcurve.c */ /* temporary storage for slider values */ @@ -162,7 +164,7 @@ static void rvk_slider_func(void *voidob, void *voidkeynum) IpoCurve *icu=NULL; BezTriple *bezt=NULL; float cfra, rvkval; - int keynum = (long) voidkeynum; + int keynum = (intptr_t) voidkeynum; cfra = frame_to_float(CFRA); @@ -275,7 +277,7 @@ void make_rvk_slider(uiBlock *block, Object *ob, int keynum, x, y , w, h, meshslidervals+keynum, min, max, 10, 2, tip); - uiButSetFunc(but, rvk_slider_func, ob, (void *)(long)keynum); + uiButSetFunc(but, rvk_slider_func, ob, (void *)(intptr_t)keynum); // no hilite, the winmatrix is not correct later on... uiButSetFlag(but, UI_NO_HILITE); diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 6dfbd67720b..c162c904776 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -109,6 +109,7 @@ editmesh_mods.c, UI level access, no geometry changes #include "editmesh.h" +#include "BLO_sys_types.h" // for intptr_t support /* ****************************** MIRROR **************** */ @@ -2937,7 +2938,7 @@ void select_sharp_edges(void) EditFace *efa; EditFace **efa1; EditFace **efa2; - long edgecount = 0, i; + intptr_t edgecount = 0, i; static short sharpness = 135; float fsharpness; @@ -3041,7 +3042,7 @@ void select_linked_flat_faces(void) EditFace *efa; EditFace **efa1; EditFace **efa2; - long edgecount = 0, i, faceselcount=0, faceselcountold=0; + intptr_t edgecount = 0, i, faceselcount=0, faceselcountold=0; static short sharpness = 135; float fsharpness; diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index f9bb14a08c6..3615a4ad851 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -110,6 +110,8 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "PIL_time.h" +#include "BLO_sys_types.h" // for intptr_t support + /* local prototypes ---------------*/ void bevel_menu(void); static void free_tagged_edges_faces(EditEdge *eed, EditFace *efa); @@ -132,7 +134,7 @@ static int vergxco(const void *v1, const void *v2) } struct facesort { - unsigned long x; + uintptr_t x; struct EditFace *efa; }; @@ -433,8 +435,8 @@ int removedoublesflag(short flag, short automerge, float limit) /* return amoun efa= em->faces.first; while(efa) { if(efa->f1 & 1) { - if(efa->v4) vsb->x= (unsigned long) MIN4( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3, (unsigned long)efa->v4); - else vsb->x= (unsigned long) MIN3( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3); + if(efa->v4) vsb->x= (uintptr_t) MIN4( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3, (uintptr_t)efa->v4); + else vsb->x= (uintptr_t) MIN3( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3); vsb->efa= efa; vsb++; diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index a9280d9dd19..9520cabdf06 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -122,6 +122,8 @@ #include "interface.h" #include "mydevice.h" +#include "BLO_sys_types.h" // for intptr_t support + extern char versionstr[]; /* from blender.c */ /*----------------------------------*/ @@ -2106,7 +2108,7 @@ static void info_text(int x, int y) { Object *ob= OBACT; extern float hashvectf[]; - extern unsigned long mem_in_use, mmap_in_use; + extern uintptr_t mem_in_use, mmap_in_use; unsigned int swatch_color; float fac1, fac2, fac3; char infostr[300], memstr[64]; diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c index 3c96e1692bf..53c4b9b5953 100644 --- a/source/blender/src/header_script.c +++ b/source/blender/src/header_script.c @@ -63,12 +63,14 @@ #include "blendef.h" #include "mydevice.h" +#include "BLO_sys_types.h" // for intptr_t support + /* ********************** SCRIPT ****************************** */ /* action executed after clicking in Scripts menu */ static void do_scripts_submenus(void *int_arg, int event) { - int menutype = (long)int_arg; + int menutype = (intptr_t)int_arg; BPY_menu_do_python (menutype, event); @@ -80,7 +82,7 @@ static uiBlock *script_scripts_submenus(void *int_menutype) uiBlock *block; short yco = 20, menuwidth = 120; BPyMenu *pym; - int i = 0, menutype = (long)int_menutype; + int i = 0, menutype = (intptr_t)int_menutype; if ((menutype < 0) || (menutype > PYMENU_SCRIPTS_MENU_TOTAL)) return NULL; @@ -132,7 +134,7 @@ static uiBlock *script_scriptsmenu(void *arg_unused) uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL); for (i = 0; i < PYMENU_SCRIPTS_MENU_TOTAL; i++) { - uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)(long)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, ""); + uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)(intptr_t)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, ""); } uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index e7b5b176979..a2b2af05083 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -105,6 +105,8 @@ #include "blendef.h" #include "winlay.h" +#include "BLO_sys_types.h" // for intptr_t support + #define INSIDE_BLOCK 1 #define INSIDE_PANEL_HEADER 2 #define INSIDE_PANEL_SCALE 3 @@ -6039,7 +6041,7 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname) /* autocomplete callback for ID buttons */ static void autocomplete_id(char *str, void *arg_v) { - int blocktype= (long)arg_v; + int blocktype= (intptr_t)arg_v; ListBase *listb= wich_libbase(G.main, blocktype); if(listb==NULL) return; @@ -6370,7 +6372,7 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int ui_check_but(but); if(blocktype) - uiButSetCompleteFunc(but, autocomplete_id, (void *)(long)blocktype); + uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype); return but; } diff --git a/source/blender/src/meshlaplacian.c b/source/blender/src/meshlaplacian.c index 60f569ecf0e..2de6367c9ad 100644 --- a/source/blender/src/meshlaplacian.c +++ b/source/blender/src/meshlaplacian.c @@ -63,6 +63,8 @@ #include "ONL_opennl.h" +#include "BLO_sys_types.h" // for intptr_t support + /************************** Laplacian System *****************************/ struct LaplacianSystem { @@ -126,14 +128,14 @@ static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2) void **p = BLI_edgehash_lookup_p(edgehash, v1, v2); if(p) - *p = (void*)((long)*p + (long)1); + *p = (void*)((intptr_t)*p + (intptr_t)1); else - BLI_edgehash_insert(edgehash, v1, v2, (void*)(long)1); + BLI_edgehash_insert(edgehash, v1, v2, (void*)(intptr_t)1); } static int laplacian_edge_count(EdgeHash *edgehash, int v1, int v2) { - return (int)(long)BLI_edgehash_lookup(edgehash, v1, v2); + return (int)(intptr_t)BLI_edgehash_lookup(edgehash, v1, v2); } static float cotan_weight(float *v1, float *v2, float *v3) diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c index 0f30aef04df..99833625baa 100644 --- a/source/blender/src/meshtools.c +++ b/source/blender/src/meshtools.c @@ -107,6 +107,8 @@ void sort_faces(void); #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" +#include "BLO_sys_types.h" // for intptr_t support + /* from rendercode.c */ #define VECMUL(dest, f) dest[0]*= f; dest[1]*= f; dest[2]*= f @@ -592,7 +594,7 @@ void sort_faces(void) typedef struct MocNode { struct MocNode *next; - long index[MOC_NODE_RES]; + intptr_t index[MOC_NODE_RES]; } MocNode; static int mesh_octree_get_base_offs(float *co, float *offs, float *div) @@ -610,7 +612,7 @@ static int mesh_octree_get_base_offs(float *co, float *offs, float *div) return (vx*MOC_RES*MOC_RES) + vy*MOC_RES + vz; } -static void mesh_octree_add_node(MocNode **bt, long index) +static void mesh_octree_add_node(MocNode **bt, intptr_t index) { if(*bt==NULL) { *bt= MEM_callocN(sizeof(MocNode), "MocNode"); @@ -642,7 +644,7 @@ static void mesh_octree_free_node(MocNode **bt) /* temporal define, just to make nicer code below */ #define MOC_ADDNODE(vx, vy, vz) mesh_octree_add_node(basetable + ((vx)*MOC_RES*MOC_RES) + (vy)*MOC_RES + (vz), index) -static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, long index) +static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, intptr_t index) { float fx, fy, fz; int vx, vy, vz; @@ -690,7 +692,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f } -static long mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co) +static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co) { float *vec; int a; @@ -734,7 +736,7 @@ static struct { /* mode is 's' start, or 'e' end, or 'u' use */ /* if end, ob can be NULL */ -long mesh_octree_table(Object *ob, float *co, char mode) +intptr_t mesh_octree_table(Object *ob, float *co, char mode) { MocNode **bt; @@ -805,7 +807,7 @@ long mesh_octree_table(Object *ob, float *co, char mode) EditVert *eve; for(eve= G.editMesh->verts.first; eve; eve= eve->next) { - mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (long)(eve)); + mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (intptr_t)(eve)); } } else { @@ -863,7 +865,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index) EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co) { float vec[3]; - long poinval; + intptr_t poinval; /* ignore nan verts */ if (isnan(co[0]) || !finite(co[0]) || diff --git a/source/blender/src/parametrizer.c b/source/blender/src/parametrizer.c index 096629b01ec..7aa27f99d77 100644 --- a/source/blender/src/parametrizer.c +++ b/source/blender/src/parametrizer.c @@ -22,6 +22,8 @@ #include #include +#include "BLO_sys_types.h" // for intptr_t support + #if defined(_WIN32) #define M_PI 3.14159265358979323846 #endif @@ -38,7 +40,7 @@ static int PHashSizes[] = { 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459 }; -#define PHASH_hash(ph, item) (((unsigned long) (item))%((unsigned int) (ph)->cursize)) +#define PHASH_hash(ph, item) (((uintptr_t) (item))%((unsigned int) (ph)->cursize)) #define PHASH_edge(v1, v2) ((v1)^(v2)) static PHash *phash_new(PHashLink **list, int sizehint) diff --git a/source/blender/src/parametrizer.h b/source/blender/src/parametrizer.h index 80fab110d5f..eea1eab9b21 100644 --- a/source/blender/src/parametrizer.h +++ b/source/blender/src/parametrizer.h @@ -7,7 +7,7 @@ extern "C" { #endif typedef void ParamHandle; /* handle to a set of charts */ -typedef long ParamKey; /* (hash) key for identifying verts and faces */ +typedef intptr_t ParamKey; /* (hash) key for identifying verts and faces */ typedef enum ParamBool { PARAM_TRUE = 1, PARAM_FALSE = 0 diff --git a/source/blender/src/parametrizer_intern.h b/source/blender/src/parametrizer_intern.h index f7a32816b33..bc38cb4bc0f 100644 --- a/source/blender/src/parametrizer_intern.h +++ b/source/blender/src/parametrizer_intern.h @@ -30,7 +30,7 @@ typedef enum PBool { /* Special Purpose Hash */ -typedef long PHashKey; +typedef intptr_t PHashKey; typedef struct PHashLink { struct PHashLink *next; diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 6c150f3d30f..6e6dc6f8dee 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -901,7 +901,7 @@ static void renderwin_progress_display_cb(RenderResult *rr, volatile rcti *rect) void make_renderinfo_string(RenderStats *rs, char *str) { extern char info_time_str[32]; // header_info.c - extern unsigned long mem_in_use, mmap_in_use; + extern uintptr_t mem_in_use, mmap_in_use; float megs_used_memory, mmap_used_memory; char *spos= str; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 8d86336e12e..fb055216f7f 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -182,6 +182,8 @@ #include "SYS_System.h" /* for the user def menu ... should move elsewhere. */ +#include "BLO_sys_types.h" // for intptr_t support + /* maybe we need this defined somewhere else */ extern void StartKetsjiShell(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing); extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);/*rcruiz*/ @@ -460,7 +462,7 @@ static LinkNode *save_and_reset_all_scene_cfra(void) Scene *sc; for (sc= G.main->scene.first; sc; sc= sc->id.next) { - BLI_linklist_prepend(&storelist, (void*) (long) sc->r.cfra); + BLI_linklist_prepend(&storelist, (void*) (intptr_t) sc->r.cfra); /* why is this reset to 1 ?*/ /* sc->r.cfra= 1;*/ @@ -478,7 +480,7 @@ static void restore_all_scene_cfra(LinkNode *storelist) { Scene *sc; for (sc= G.main->scene.first; sc; sc= sc->id.next) { - int stored_cfra= (long) sc_store->link; + int stored_cfra= (intptr_t) sc_store->link; sc->r.cfra= stored_cfra; set_scene_bg(sc); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 8a8d7c8cec7..c8a20cdc951 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -123,6 +123,8 @@ #include "BPY_extern.h" #include "BPY_menus.h" +#include "BLO_sys_types.h" // for intptr_t support + void asciitoraw(int ch, unsigned short *event, unsigned short *qual) { if( isupper(ch) ) { @@ -238,7 +240,7 @@ void error_libdata(void) int saveover(char *file) { - int len= strlen(file); + size_t len= strlen(file); if(len==0) return 0; @@ -1756,8 +1758,8 @@ static uiBlock *tb_makemenu(void *arg) static int tb_mainx= 1234, tb_mainy= 0; static void store_main(void *arg1, void *arg2) { - tb_mainx= (long)arg1; - tb_mainy= (long)arg2; + tb_mainx= (intptr_t)arg1; + tb_mainy= (intptr_t)arg2; } static void do_group_addmenu(void *arg, int event) @@ -2185,27 +2187,27 @@ void toolbox_n(void) but=uiDefBlockBut(block, tb_makemenu, menu1, str1, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, ""); uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_RIGHT); - uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)-5); + uiButSetFunc(but, store_main, (void *)(intptr_t)dx, (void *)(intptr_t)-5); but=uiDefBlockBut(block, tb_makemenu, menu2, str2, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, ""); uiButSetFlag(but, UI_MAKE_TOP); - uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)-5); + uiButSetFunc(but, store_main, (void *)(intptr_t)0, (void *)(intptr_t)-5); but=uiDefBlockBut(block, tb_makemenu, menu3, str3, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, ""); uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_LEFT); - uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)-5); + uiButSetFunc(but, store_main, (void *)(intptr_t)-dx, (void *)(intptr_t)-5); but=uiDefBlockBut(block, tb_makemenu, menu4, str4, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, ""); uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_RIGHT); - uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)5); + uiButSetFunc(but, store_main, (void *)(intptr_t)dx, (void *)(intptr_t)5); but=uiDefBlockBut(block, tb_makemenu, menu5, str5, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, ""); uiButSetFlag(but, UI_MAKE_DOWN); - uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)5); + uiButSetFunc(but, store_main, (void *)(intptr_t)0, (void *)(intptr_t)5); but=uiDefBlockBut(block, tb_makemenu, menu6, str6, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, ""); uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_LEFT); - uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)5); + uiButSetFunc(but, store_main, (void *)(intptr_t)-dx, (void *)(intptr_t)5); } else if (tot==5 || tot==7) { /* check if it fits, dubious */ if(mval[0]-0.25*dx+tb_mainx < 6) mval[0]= 6 + 0.25*dx -tb_mainx; @@ -2282,7 +2284,7 @@ void toolbox_generic( TBitem *generic_menu ) TBitem *menu; int dx=96; short event, mval[2]; - long ypos = -5; + intptr_t ypos = -5; tb_mainx= -32; tb_mainy= -5; diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 9f2f58d0cdb..efb86b59ed1 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -144,6 +144,8 @@ extern ListBase editelems; #include "transform.h" +#include "BLO_sys_types.h" // for intptr_t support + /* local function prototype - for Object/Bone Constraints */ static short constraints_list_needinv(TransInfo *t, ListBase *list); /* local function prototype - for finding number of keyframes that are selected for editing */ @@ -1913,7 +1915,7 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats) EditVert *eve, *prev; EditFace *efa; float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4; - long index= 0; + intptr_t index= 0; /* two abused locations in vertices */ for(eve= em->verts.first; eve; eve= eve->next, index++) { @@ -1925,13 +1927,13 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats) for(efa= em->faces.first; efa; efa= efa->next) { /* retrieve mapped coordinates */ - v1= mappedcos + 3*(long)(efa->v1->prev); - v2= mappedcos + 3*(long)(efa->v2->prev); - v3= mappedcos + 3*(long)(efa->v3->prev); + v1= mappedcos + 3*(intptr_t)(efa->v1->prev); + v2= mappedcos + 3*(intptr_t)(efa->v2->prev); + v3= mappedcos + 3*(intptr_t)(efa->v3->prev); - co1= (origcos)? origcos + 3*(long)(efa->v1->prev): efa->v1->co; - co2= (origcos)? origcos + 3*(long)(efa->v2->prev): efa->v2->co; - co3= (origcos)? origcos + 3*(long)(efa->v3->prev): efa->v3->co; + co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co; + co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co; + co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co; if(efa->v2->tmp.p==NULL && efa->v2->f1) { set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1); @@ -1940,8 +1942,8 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats) } if(efa->v4) { - v4= mappedcos + 3*(long)(efa->v4->prev); - co4= (origcos)? origcos + 3*(long)(efa->v4->prev): efa->v4->co; + v4= mappedcos + 3*(intptr_t)(efa->v4->prev); + co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co; if(efa->v1->tmp.p==NULL && efa->v1->f1) { set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4); diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index 6ae4a31bf50..77d53c4ed96 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -74,7 +74,7 @@ extern "C" { extern char bprogname[]; } // add drive character if not in path string, using blender executable location as reference static void addDrive(string &path) { - int sp = path.find_first_of(":"); + size_t sp = path.find_first_of(":"); if (sp==-1) { string blpath = bprogname; sp = blpath.find_first_of(":"); diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp index 2ce5d469380..85d514bd22f 100644 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp +++ b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp @@ -3,6 +3,8 @@ #include "KX_ScalarInterpolator.h" #include "KX_GameObject.h" +#include "BLO_sys_types.h" // for intptr_t support + #ifdef HAVE_CONFIG_H #include #endif @@ -76,10 +78,10 @@ SG_Controller* KX_MaterialIpoController::GetReplica(class SG_Node* destnode) iporeplica->AddInterpolator(copyipo); MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - long orgbase = (long)this; - long orgloc = (long)scaal; - long offset = orgloc-orgbase; - long newaddrbase = (long)iporeplica + offset; + intptr_t orgbase = (intptr_t)this; + intptr_t orgloc = (intptr_t)scaal; + intptr_t offset = orgloc-orgbase; + intptr_t newaddrbase = (intptr_t)iporeplica + offset; MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } diff --git a/source/kernel/CMakeLists.txt b/source/kernel/CMakeLists.txt index 3d966152cc5..ac759393326 100644 --- a/source/kernel/CMakeLists.txt +++ b/source/kernel/CMakeLists.txt @@ -24,7 +24,7 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(INC gen_messaging gen_system ../../intern/string ../../intern/moto/include) +SET(INC gen_messaging gen_system ../../intern/string ../../intern/moto/include ../../source/blender/blenloader ) FILE(GLOB SRC gen_messaging/intern/messaging.c diff --git a/source/kernel/SConscript b/source/kernel/SConscript index 9e678c041dc..8bd1a18f835 100644 --- a/source/kernel/SConscript +++ b/source/kernel/SConscript @@ -5,6 +5,6 @@ sources = 'gen_messaging/intern/messaging.c gen_system/GEN_HashedPtr.cpp' sources += ' gen_system/GEN_Matrix4x4.cpp gen_system/SYS_SingletonSystem.cpp' sources += ' gen_system/SYS_System.cpp' -incs = 'gen_messaging gen_system #/intern/string #/intern/moto/include' +incs = 'gen_messaging gen_system #/intern/string #/intern/moto/include #/source/blender/blenloader ' env.BlenderLib ( 'bf_kernel', Split(sources), Split(incs), [], libtype = ['common','game2', 'player'], priority = [15, 10, 150] ) diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp index 49ccb252246..6dbed1fb7a8 100644 --- a/source/kernel/gen_system/GEN_HashedPtr.cpp +++ b/source/kernel/gen_system/GEN_HashedPtr.cpp @@ -33,6 +33,8 @@ #include #endif +#include "BLO_sys_types.h" // for intptr_t support + // // Build hash index from pointer. Even though the final result // is a 32-bit integer, use all the bits of the pointer as long @@ -41,11 +43,7 @@ unsigned int GEN_Hash(void * inDWord) { -#if defined(_WIN64) - unsigned __int64 key = (unsigned __int64)inDWord; -#else - unsigned long key = (unsigned long)inDWord; -#endif + uintptr_t key = (uintptr_t)inDWord; key += ~(key << 16); key ^= (key >> 5); diff --git a/source/kernel/gen_system/Makefile b/source/kernel/gen_system/Makefile index 855af376615..31535ad2a97 100644 --- a/source/kernel/gen_system/Makefile +++ b/source/kernel/gen_system/Makefile @@ -37,4 +37,5 @@ CCFLAGS += $(LEVEL_2_CPP_WARNINGS) CPPFLAGS += -I$(NAN_MOTO)/include CPPFLAGS += -I$(NAN_STRING)/include +CPPFLAGS += -I../../../source/blender/blenloader