diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-13 00:39:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-13 00:39:39 +0400 |
commit | 9892736206676c5b7fabc8d1184f9655511ff2dd (patch) | |
tree | 83562ac50c93fe3004959d35c1af4a5b380fdd97 /source/blender/blenloader | |
parent | cffaa42d3a34c6b310c3c87c98e1f8313881e473 (diff) |
code cleanup: header cleanup and remove some duplicate defines.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 127 | ||||
-rw-r--r-- | source/blender/blenloader/BLO_sys_types.h | 24 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.h | 26 |
3 files changed, 85 insertions, 92 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index bddaa5f67d6..f0bf7e99758 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -49,54 +49,54 @@ struct bContext; struct BHead; struct FileData; -typedef struct BlendHandle BlendHandle; +typedef struct BlendHandle BlendHandle; typedef enum BlenFileType { - BLENFILETYPE_BLEND= 1, - BLENFILETYPE_PUB= 2, - BLENFILETYPE_RUNTIME= 3 + BLENFILETYPE_BLEND = 1, + BLENFILETYPE_PUB = 2, + BLENFILETYPE_RUNTIME = 3 } BlenFileType; typedef struct BlendFileData { - struct Main* main; - struct UserDef* user; + struct Main *main; + struct UserDef *user; int winpos; int fileflags; int displaymode; int globalf; - char filename[1024]; /* 1024 = FILE_MAX */ + char filename[1024]; /* 1024 = FILE_MAX */ - struct bScreen* curscreen; - struct Scene* curscene; + struct bScreen *curscreen; + struct Scene *curscene; - BlenFileType type; + BlenFileType type; } BlendFileData; - /** - * Open a blender file from a pathname. The function - * returns NULL and sets a report in the list if - * it cannot open the file. - * - * \param filepath The path of the file to open. - * \param reports If the return value is NULL, errors - * indicating the cause of the failure. - * \return The data of the file. - */ -BlendFileData* BLO_read_from_file(const char *filepath, struct ReportList *reports); - - /** - * Open a blender file from memory. The function - * returns NULL and sets a report in the list if - * it cannot open the file. - * - * \param mem The file data. - * \param memsize The length of \a mem. - * \param reports If the return value is NULL, errors - * indicating the cause of the failure. - * \return The data of the file. - */ -BlendFileData* BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports); +/** + * Open a blender file from a pathname. The function + * returns NULL and sets a report in the list if + * it cannot open the file. + * + * \param filepath The path of the file to open. + * \param reports If the return value is NULL, errors + * indicating the cause of the failure. + * \return The data of the file. + */ +BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *reports); + +/** + * Open a blender file from memory. The function + * returns NULL and sets a report in the list if + * it cannot open the file. + * + * \param mem The file data. + * \param memsize The length of \a mem. + * \param reports If the return value is NULL, errors + * indicating the cause of the failure. + * \return The data of the file. + */ +BlendFileData *BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports); /** * oldmain is old main, from which we will keep libraries, images, .. @@ -111,9 +111,8 @@ BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, * * \param bfd The structure to free. */ - void -BLO_blendfiledata_free( - BlendFileData *bfd); +void +BLO_blendfiledata_free(BlendFileData *bfd); /** * Open a blendhandle from a file path. @@ -122,10 +121,9 @@ BLO_blendfiledata_free( * \param reports Report errors in opening the file (can be NULL). * \return A handle on success, or NULL on failure. */ - BlendHandle* -BLO_blendhandle_from_file( - char *file, - struct ReportList *reports); +BlendHandle * +BLO_blendhandle_from_file(char *file, + struct ReportList *reports); /** * Open a blendhandle from memory. @@ -135,10 +133,9 @@ BLO_blendhandle_from_file( * \return A handle on success, or NULL on failure. */ - BlendHandle* -BLO_blendhandle_from_memory( - void *mem, - int memsize); +BlendHandle * +BLO_blendhandle_from_memory(void *mem, + int memsize); /** * Gets the names of all the datablocks in a file @@ -151,11 +148,10 @@ BLO_blendhandle_from_memory( * \return A BLI_linklist of strings. The string links * should be freed with malloc. */ - struct LinkNode* -BLO_blendhandle_get_datablock_names( - BlendHandle *bh, - int ofblocktype, - int *tot_names); +struct LinkNode * +BLO_blendhandle_get_datablock_names(BlendHandle *bh, + int ofblocktype, + int *tot_names); /** * Gets the previews of all the datablocks in a file @@ -168,11 +164,10 @@ BLO_blendhandle_get_datablock_names( * \return A BLI_linklist of PreviewImage. The PreviewImage links * should be freed with malloc. */ - struct LinkNode* -BLO_blendhandle_get_previews( - BlendHandle *bh, - int ofblocktype, - int *tot_prev); +struct LinkNode * +BLO_blendhandle_get_previews(BlendHandle *bh, + int ofblocktype, + int *tot_prev); /** * Gets the names of all the datablock groups in a @@ -183,9 +178,8 @@ BLO_blendhandle_get_previews( * \return A BLI_linklist of strings. The string links * should be freed with malloc. */ - struct LinkNode* -BLO_blendhandle_get_linkable_groups( - BlendHandle *bh); +struct LinkNode * +BLO_blendhandle_get_linkable_groups(BlendHandle *bh); /** * Close and free a blendhandle. The handle @@ -193,11 +187,10 @@ BLO_blendhandle_get_linkable_groups( * * \param bh The handle to close. */ - void -BLO_blendhandle_close( - BlendHandle *bh); +void +BLO_blendhandle_close(BlendHandle *bh); - /***/ +/***/ #define GROUP_MAX 32 @@ -217,7 +210,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group); * \param filepath Used for relative linking, copied to the lib->name * \return the library Main, to be passed to BLO_library_append_named_part as mainl. */ -struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, const char *filepath); +struct Main *BLO_library_append_begin(struct Main *mainvar, BlendHandle **bh, const char *filepath); /** @@ -229,7 +222,7 @@ struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, co * \param idcode The kind of datablock to link. * \return the appended ID when found. */ -struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode); +struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode); /** * Link/Append a named datablock from an external blend file. @@ -243,13 +236,13 @@ struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, c * \param flag Options for linking, used for instancing. * \return the appended ID when found. */ -struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag); +struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag); -void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag); +void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag); void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); -BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports); +BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index 41e33eb2a05..4e76481c394 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -53,12 +53,12 @@ extern "C" { * need to include anything else here. */ -typedef signed __int8 int8_t; +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 __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; @@ -83,19 +83,19 @@ typedef unsigned long uintptr_t; #elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) - /* Linux-i386, Linux-Alpha, Linux-ppc */ +/* Linux-i386, Linux-Alpha, Linux-ppc */ #include <stdint.h> /* XXX */ #ifndef UINT64_MAX -# define UINT64_MAX 18446744073709551615 -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; +# define UINT64_MAX 18446744073709551615 +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; #endif -#elif defined (__APPLE__) +#elif defined(__APPLE__) #include <inttypes.h> @@ -108,7 +108,7 @@ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); #else - /* FreeBSD, Solaris */ +/* FreeBSD, Solaris */ #include <sys/types.h> #endif /* ifdef platform for types */ @@ -123,9 +123,9 @@ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); #define ntohl(x) correctByteOrder(x) #endif #endif -#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/param.h> -#elif defined (__APPLE__) +#elif defined(__APPLE__) #include <sys/types.h> #else /* sun linux */ #include <netinet/in.h> diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 9be375977e9..aa388923f6b 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -75,8 +75,8 @@ typedef struct FileData { char *compflags; int fileversion; - int id_name_offs; /* used to retrieve ID names from (bhead+1) */ - int globalf, fileflags; /* for do_versions patching */ + int id_name_offs; /* used to retrieve ID names from (bhead+1) */ + int globalf, fileflags; /* for do_versions patching */ struct OldNewMap *datamap; struct OldNewMap *globmap; @@ -89,9 +89,9 @@ typedef struct FileData { ListBase mainlist; - /* ick ick, used to return - * data through streamglue. - */ + /* ick ick, used to return + * data through streamglue. + */ BlendFileData **bfd_r; struct ReportList *reports; } FileData; @@ -102,16 +102,16 @@ typedef struct BHeadN { } BHeadN; -#define FD_FLAGS_SWITCH_ENDIAN (1<<0) -#define FD_FLAGS_FILE_POINTSIZE_IS_4 (1<<1) -#define FD_FLAGS_POINTSIZE_DIFFERS (1<<2) -#define FD_FLAGS_FILE_OK (1<<3) -#define FD_FLAGS_NOT_MY_BUFFER (1<<4) -#define FD_FLAGS_NOT_MY_LIBMAP (1<<5) +#define FD_FLAGS_SWITCH_ENDIAN (1 << 0) +#define FD_FLAGS_FILE_POINTSIZE_IS_4 (1 << 1) +#define FD_FLAGS_POINTSIZE_DIFFERS (1 << 2) +#define FD_FLAGS_FILE_OK (1 << 3) +#define FD_FLAGS_NOT_MY_BUFFER (1 << 4) +#define FD_FLAGS_NOT_MY_LIBMAP (1 << 5) #define SIZEOFBLENDERHEADER 12 - /***/ +/***/ struct Main; void blo_join_main(ListBase *mainlist); void blo_split_main(ListBase *mainlist, struct Main *main); @@ -129,7 +129,7 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain); void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain); void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd); -void blo_freefiledata( FileData *fd); +void blo_freefiledata(FileData *fd); BHead *blo_firstbhead(FileData *fd); BHead *blo_nextbhead(FileData *fd, BHead *thisblock); |