Win64: please check my changes if you ran across them ;) But should be fine since no additional crashes were reported!

This commit is contained in:
Daniel Genrich 2008-08-17 17:08:00 +00:00
parent 68765dc94b
commit fd0072e77c
69 changed files with 528 additions and 255 deletions

View File

@ -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 <sys/types.h> 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 <stdint.h>
#elif defined (__APPLE__)
#include <inttypes.h>
#else
/* FreeBSD, Irix, Solaris */
#include <sys/types.h>
#endif /* ifdef platform for types */
#ifdef _WIN32
#define htonl(x) correctByteOrder(x)
#define ntohl(x) correctByteOrder(x)
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
#include <sys/param.h>
#elif defined (__APPLE__)
#include <sys/types.h>
#else /* irix sun linux */
#include <netinet/in.h>
#endif /* ifdef platform for htonl/ntohl */
#ifdef __cplusplus
}
#endif
#endif /* eof */

View File

@ -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);
}

View File

@ -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) {

View File

@ -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

View File

@ -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 <sys/types.h> 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 <stdint.h>
#elif defined (__APPLE__)
#include <inttypes.h>
#else
/* FreeBSD, Irix, Solaris */
#include <sys/types.h>
#endif /* ifdef platform for types */
#ifdef _WIN32
#define htonl(x) correctByteOrder(x)
#define ntohl(x) correctByteOrder(x)
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
#include <sys/param.h>
#elif defined (__APPLE__)
#include <sys/types.h>
#else /* irix sun linux */
#include <netinet/in.h>
#endif /* ifdef platform for htonl/ntohl */
#ifdef __cplusplus
}
#endif
#endif /* eof */

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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]);

View File

@ -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];

View File

@ -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);

View File

@ -62,6 +62,8 @@
#include "BKE_utildefines.h"
#include <errno.h>
#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;
}

View File

@ -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 {

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}

View File

@ -80,7 +80,7 @@ struct _Log_Image_File_t_
CloseFn* close;
unsigned char *membuffer;
unsigned long membuffersize;
uintptr_t membuffersize;
unsigned char *memcursor;
};

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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 <config.h>
#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);

View File

@ -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}")

View File

@ -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']

View File

@ -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

View File

@ -50,6 +50,8 @@
#include "radio.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#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;

View File

@ -68,6 +68,8 @@
#include "radio.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#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;
}

View File

@ -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)

View File

@ -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 = []

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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; b<v; b++, ztile++, ctile++)
@ -1752,7 +1752,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
ISBSample *samp, *samplebuf[16]; /* should be RE_MAX_OSA */
ISBBranch root;
MemArena *memarena;
long *rd;
intptr_t *rd;
int *recto, *rectp, x, y, sindex, sample, bsp_err=0;
/* storage for shadow, per thread */

View File

@ -416,7 +416,7 @@ typedef struct StrandPart {
int *totapixbuf;
int *rectz;
int *rectmask;
long *rectdaps;
intptr_t *rectdaps;
int rectx, recty;
int sample;
@ -510,7 +510,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
if(spart->rectdaps) {
/* 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;

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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++;

View File

@ -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];

View File

@ -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, "");

View File

@ -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;
}

View File

@ -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)

View File

@ -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]) ||

View File

@ -22,6 +22,8 @@
#include <stdio.h>
#include <string.h>
#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)

View File

@ -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

View File

@ -30,7 +30,7 @@ typedef enum PBool {
/* Special Purpose Hash */
typedef long PHashKey;
typedef intptr_t PHashKey;
typedef struct PHashLink {
struct PHashLink *next;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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(":");

View File

@ -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 <config.h>
#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);
}

View File

@ -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

View File

@ -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] )

View File

@ -33,6 +33,8 @@
#include <config.h>
#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);

View File

@ -37,4 +37,5 @@ CCFLAGS += $(LEVEL_2_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I../../../source/blender/blenloader