Win64 commit: first little commit to test how it compiles on other plattforms - I...
authorDaniel Genrich <daniel.genrich@gmx.net>
Sun, 17 Aug 2008 16:36:37 +0000 (16:36 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Sun, 17 Aug 2008 16:36:37 +0000 (16:36 +0000)
source/blender/blenloader/BLO_sys_types.h
source/blender/blenloader/intern/genfile.c
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c

index a1885894fe321912696cb1d37cac05ce7ec396b0..a519183a1e15a9b7c4cda6bf87afbb85831d98be 100644 (file)
@@ -64,6 +64,14 @@ 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 */
index 87c859de839145294d0943de8e0d630a07f46538..86338ca9e89d863be1e6564f0b74b54efae5f781 100644 (file)
@@ -58,6 +58,8 @@
 
 #include "genfile.h"
 
+#include "BLO_sys_types.h" // for intptr_t support
+
 /* gcc 4.1 on mingw was complaining that __int64 was alredy defined
 actually is saw the line below as typedef long long long long... 
 Anyhow, since its alredy defined, its safe to do an ifndef here- Cambpell*/
@@ -315,7 +317,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
 /* in sdna->data the data, now we convert that to something understandable */
 {
        int *data, *verg;
-       long nr;
+       intptr_t nr;
        short *sp;
        char str[8], *cp;
        
@@ -351,7 +353,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
                        cp++;
                        nr++;
                }
-               nr= (long)cp;           /* prevent BUS error */
+               nr= (intptr_t)cp;               /* prevent BUS error */
                nr= (nr+3) & ~3;
                cp= (char *)nr;
                
@@ -389,7 +391,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
                        cp++;
                        nr++;
                }
-               nr= (long)cp;           /* prevent BUS error */
+               nr= (intptr_t)cp;               /* prevent BUS error */
                nr= (nr+3) & ~3;
                cp= (char *)nr;
                
@@ -1098,7 +1100,7 @@ int dna_elem_offset(struct SDNA *sdna, char *stype, char *vartype, char *name)
        int SDNAnr= dna_findstruct_nr(sdna, stype);
        short *spo= sdna->structs[SDNAnr];
        char *cp= find_elem(sdna, vartype, name, spo, NULL, NULL);
-       return (int)((long)cp);
+       return (int)((intptr_t)cp);
 }
 
 
index f56b261efe27df6bc8a72b58dbfdf71e1211fc4c..5a75b5c8b110426dd5dcaac269dde28a6d1c51c3 100644 (file)
@@ -63,6 +63,8 @@
 
 #include "BLO_readblenfile.h"
 
+#include "BLO_sys_types.h" // needed for intptr_t
+
        /**
         * IDType stuff, I plan to move this
         * out into its own file + prefix, and
@@ -193,7 +195,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
                        buf[2]= buf[2]?buf[2]:' ';
                        buf[3]= buf[3]?buf[3]:' ';
                        
-                       fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long)bhead->len+sizeof(BHead));
+                       fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (intptr_t)bhead->len+sizeof(BHead));
                }
        }
        fprintf(fp, "]\n");
index ad19cde3c9ba963ad5700bd4cdb848b396056286..495a35bbe4c5022bd40d5c3dc78f8a0a9149e2b6 100644 (file)
@@ -3593,9 +3593,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                {
                        Sequence temp;
                        char *poin;
-                       long offset;
+                       intptr_t offset;
                        
-                       offset= ((long)&(temp.seqbase)) - ((long)&temp);
+                       offset= ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
                        
                        /* root pointer */
                        if(ed->seqbasep == old_seqbasep) {
@@ -4094,7 +4094,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
        while(se) {
                se->v1= newdataadr(fd, se->v1);
                se->v2= newdataadr(fd, se->v2);
-               if( (long)se->v1 > (long)se->v2) {
+               if( (intptr_t)se->v1 > (intptr_t)se->v2) {
                        sv= se->v1;
                        se->v1= se->v2;
                        se->v2= sv;