diff options
-rw-r--r-- | source/blender/avi/AVI_avi.h | 11 | ||||
-rw-r--r-- | source/blender/avi/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/avi/SConscript | 2 | ||||
-rw-r--r-- | source/blender/avi/intern/avi.c | 12 | ||||
-rw-r--r-- | source/blender/avi/intern/options.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_winstuff.h | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 4 |
8 files changed, 29 insertions, 14 deletions
diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h index 85685e2bd4c..1446971a8ac 100644 --- a/source/blender/avi/AVI_avi.h +++ b/source/blender/avi/AVI_avi.h @@ -55,11 +55,12 @@ #ifndef __AVI_H__ #define __AVI_H__ +#include "MEM_sys_types.h" #include <stdio.h> /* for FILE */ typedef struct _AviChunk { int fcc; - int size; + int64_t size; } AviChunk; typedef struct _AviList { @@ -185,16 +186,16 @@ typedef struct _AviMovie { #define AVI_MOVIE_READ 0 #define AVI_MOVIE_WRITE 1 - unsigned long size; + int64_t size; AviMainHeader *header; AviStreamRec *streams; AviIndexEntry *entries; int index_entries; - int movi_offset; - int read_offset; - long *offset_table; + int64_t movi_offset; + int64_t read_offset; + int64_t *offset_table; /* Local data goes here */ int interlace; diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index b62e0cc5afd..bae61fd678b 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC . ../../../intern/guardedalloc + ../blenlib ) set(INC_SYS diff --git a/source/blender/avi/SConscript b/source/blender/avi/SConscript index 0bf8c3c74db..4d2ce8fd845 100644 --- a/source/blender/avi/SConscript +++ b/source/blender/avi/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('intern/*.c') -incs = '. #/intern/guardedalloc' +incs = '. #/intern/guardedalloc ../blenlib' incs += ' ' + env['BF_JPEG_INC'] env.BlenderLib ('bf_avi', sources, Split(incs), [], libtype=['core','player'], priority = [190,120] ) diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 82bf3a3d21b..ff3aafbf065 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -42,6 +42,9 @@ #include <ctype.h> #include "MEM_guardedalloc.h" +#include "MEM_sys_types.h" + +#include "BLI_winstuff.h" #include "AVI_avi.h" #include "avi_intern.h" @@ -593,7 +596,6 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) { movie->movi_offset = ftell (movie->fp); movie->read_offset = movie->movi_offset; - if (AVI_DEBUG) printf ("movi_offset is %d\n", movie->movi_offset); /* Read in the index if the file has one, otherwise create one */ if (movie->header->Flags & AVIF_HASINDEX) { @@ -707,8 +709,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { AviList list; AviChunk chunk; int i; - int header_pos1, header_pos2; - int stream_pos1, stream_pos2; + int64_t header_pos1, header_pos2; + int64_t stream_pos1, stream_pos2; movie->type = AVI_MOVIE_WRITE; movie->fp = fopen (name, "wb"); @@ -718,7 +720,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { if (movie->fp == NULL) return AVI_ERROR_OPEN; - movie->offset_table = (long *) MEM_mallocN ((1+streams*2) * sizeof (long),"offsettable"); + movie->offset_table = (int64_t *) MEM_mallocN ((1+streams*2) * sizeof (int64_t),"offsettable"); for (i=0; i < 1 + streams*2; i++) movie->offset_table[i] = -1L; @@ -897,7 +899,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) { AviIndexEntry *temp; va_list ap; int stream; - long rec_off; + int64_t rec_off; AviFormat format; void *buffer; int size; diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index edb708d8a69..96c62843436 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -40,6 +40,8 @@ #include "avi_intern.h" #include "endian.h" +#include "BLI_winstuff.h" + /* avi_set_compress_options gets its own file... now don't WE feel important? */ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index d0eb3c7d67d..e0c819c2dba 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -98,6 +98,15 @@ extern "C" { typedef unsigned int mode_t; #endif +/* use functions that take a 64 bit offset for files larger than 4GB */ +#ifndef FREE_WINDOWS +#include <stdio.h> +#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin) +#define ftell(stream) _ftelli64(stream) +#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin) +#define tell(fd) _telli64(fd) +#endif + /* mingw using _SSIZE_T_ to declare ssize_t type */ #ifndef _SSIZE_T_ #define _SSIZE_T_ diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e9db148e992..41eedef8835 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -478,7 +478,7 @@ LinkNode *BLI_read_file_as_lines(const char *name) FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; char *buf; - int size; + int64_t size; if (!fp) return NULL; diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index c8a6ae5a6d0..a927de60cd8 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -327,7 +327,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) { char marshal_path[512]; char *marshal_buffer = NULL; - unsigned int marshal_length; + size_t marshal_length; FILE *fp = NULL; int result; @@ -338,7 +338,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) if (fp) { // obtain file size: fseek (fp, 0, SEEK_END); - marshal_length = ftell(fp); + marshal_length = (size_t)ftell(fp); rewind(fp); marshal_buffer = (char*)malloc (sizeof(char)*marshal_length); |