diff options
author | Joseph Gilbert <ascotan@gmail.com> | 2005-07-18 07:50:37 +0400 |
---|---|---|
committer | Joseph Gilbert <ascotan@gmail.com> | 2005-07-18 07:50:37 +0400 |
commit | e60291d39c0f77282a2d17f79e9264107bbc495e (patch) | |
tree | 274f6c0fc564553bb1484abfc5ad33e758d00903 /source/blender/python/BPY_menus.c | |
parent | 9919df089dc34a62ac14f5c151d7815ee852bd81 (diff) |
Header file clean up and warning fixes
- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
Diffstat (limited to 'source/blender/python/BPY_menus.c')
-rw-r--r-- | source/blender/python/BPY_menus.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index e71d06b4141..dbb946aa045 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -35,38 +35,21 @@ * from Blender menus. To know more, please start with its header file. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "BPY_menus.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> #include <Python.h> - #ifndef WIN32 -#include <dirent.h> + #include <dirent.h> #else -#include "BLI_winstuff.h" -#include <io.h> -#include <direct.h> + #include "BLI_winstuff.h" #endif - #include "BKE_global.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "MEM_guardedalloc.h" - -#include <DNA_userdef_types.h> /* for U.pythondir */ - -#include "BPY_extern.h" -#include "BPY_menus.h" +#include "DNA_userdef_types.h" /* for U.pythondir */ #include "api2_2x/EXPP_interface.h" /* for bpy_gethome() */ -#include <errno.h> - #define BPYMENU_DATAFILE "Bpymenus" #define MAX_DIR_DEPTH 4 /* max depth for traversing scripts dirs */ #define MAX_DIR_NUMBER 30 /* max number of dirs in scripts dirs trees */ @@ -494,7 +477,7 @@ static int bpymenu_CreateFromFile( void ) } if( parsing == 1 ) { /* got menu group string */ - group = bpymenu_group_atoi( w1 ); + group = (short)bpymenu_group_atoi( w1 ); if( group < 0 && DEBUG ) { /* invalid type */ fprintf(stderr, "BPyMenus error parsing config file: wrong group: %s,\n\ @@ -503,7 +486,7 @@ will use 'Misc'.\n", w1 ); } else continue; - while( 1 ) { + for(;;) { tip = NULL; /* optional tooltip */ fgets( line, 255, fp ); if( line[0] == '}' ) @@ -592,7 +575,7 @@ static void bpymenu_WriteDataFile( void ) pymenu = BPyMenuTable[i]; if( !pymenu ) continue; - fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( i ) ); + fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( (short)i ) ); while( pymenu ) { fprintf( fp, "'%s' %d %s %d", pymenu->name, pymenu->version, pymenu->filename, @@ -629,7 +612,7 @@ void BPyMenu_PrintAllEntries( void ) for( i = 0; i < PYMENU_TOTAL; i++ ) { pymenu = BPyMenuTable[i]; - printf( "\n%s {\n", BPyMenu_group_itoa( i ) ); + printf( "\n%s {\n", BPyMenu_group_itoa( (short)i ) ); while( pymenu ) { printf( "'%s' %d %s %d", pymenu->name, pymenu->version, pymenu->filename, pymenu->dir ); @@ -690,7 +673,7 @@ static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir) int parser_state; char script_name[100]; - int script_version; + int script_version = 1; int script_group; BPyMenu *scriptMenu = NULL; @@ -751,7 +734,7 @@ static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir) } else { /* register script */ - scriptMenu = bpymenu_AddEntry(script_group, + scriptMenu = bpymenu_AddEntry((short)script_group, (short int)script_version, script_name, fname, is_userdir,NULL); if (scriptMenu == NULL) { if (DEBUG) |