Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / blenloader / intern / readblenentry.c
index 9cd45a2..1f27691 100644 (file)
 
 #include "BLO_sys_types.h" // needed for intptr_t
 
-#ifdef _WIN32
-#include "BLI_winstuff.h"
-#endif
-
        /**
         * IDType stuff, I plan to move this
         * out into its own file + prefix, and
@@ -204,7 +200,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 int)bhead->len+sizeof(BHead));
+                       fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (intptr_t)bhead->len+sizeof(BHead));
                }
        }
        fprintf(fp, "]\n");
@@ -335,7 +331,11 @@ BlendFileData *BLO_read_from_file(char *file, ReportList *reports)
        fd = blo_openblenderfile(file, reports);
        if (fd) {
                fd->reports= reports;
-               bfd= blo_read_file_internal(fd, file);
+               bfd= blo_read_file_internal(fd);
+               if (bfd) {
+                       bfd->type= BLENFILETYPE_BLEND;
+                       strncpy(bfd->main->name, file, sizeof(bfd->main->name)-1);
+               }
                blo_freefiledata(fd);                   
        }
 
@@ -350,7 +350,11 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports)
        fd = blo_openblendermemory(mem, memsize,  reports);
        if (fd) {
                fd->reports= reports;
-               bfd= blo_read_file_internal(fd, "");
+               bfd= blo_read_file_internal(fd);
+               if (bfd) {
+                       bfd->type= BLENFILETYPE_BLEND;
+                       strcpy(bfd->main->name, "");
+               }
                blo_freefiledata(fd);                   
        }
 
@@ -379,7 +383,11 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
                /* makes lookup of existing images in old main */
                blo_make_image_pointer_map(fd, oldmain);
                
-               bfd= blo_read_file_internal(fd, "");
+               bfd= blo_read_file_internal(fd);
+               if (bfd) {
+                       bfd->type= BLENFILETYPE_BLEND;
+                       strcpy(bfd->main->name, "");
+               }
                
                /* ensures relinked images are not freed */
                blo_end_image_pointer_map(fd, oldmain);