misc cleanup
authorCampbell Barton <ideasman42@gmail.com>
Fri, 21 Oct 2011 08:16:15 +0000 (08:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 21 Oct 2011 08:16:15 +0000 (08:16 +0000)
- remove redundant casts
- replace strcmp's with "" to just check first char.
- added WM_event_print(), debug mode only to print events since the structs values are not that meaningful.
- added warnings if locale/font dirs cant be found.

14 files changed:
source/blender/blenfont/intern/blf_lang.c
source/blender/blenfont/intern/blf_translation.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_regions.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_particle.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_operators.c

index ec9501c06a69720e67fe7efa9d703ea1bb0d4195..d5245073e5967964ee07294440f185db20dee1ab 100644 (file)
@@ -103,10 +103,13 @@ void BLF_lang_init(void)
        
        BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
        
-       if (messagepath)
+       if (messagepath) {
                BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath));
-       else
+       }
+       else {
+               printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
                global_messagepath[0]= '\0';
+       }
        
 }
 
index 8c0a26df4c22d73a63a5c34eae4166cbea149bd4..90d9c4a5981c84d1a7cedf75fe57f5abc9f0756e 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
 #include "BLI_path_util.h"
@@ -54,11 +55,16 @@ unsigned char *BLF_get_unifont(int *unifont_size_r)
 {
        if(unifont_ttf==NULL) {
                char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
-               char unifont_path[1024];
+               if (fontpath) {
+                       char unifont_path[1024];
 
-               BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
+                       BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
 
-               unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size);
+                       unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size);
+               }
+               else {
+                       printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
+               }
        }
 
        *unifont_size_r= unifont_size;
index 9e48e691b87e0f8351eaa190f2be3891d85673e8..3baf8e04b9045de118da46512057da0fc1275f1a 100644 (file)
@@ -1280,9 +1280,9 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
                        flag= setkeys(ctime, &key->block, k, t, 0);
 
                        if(flag==0)
-                               do_key(a, a+1, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
+                               do_key(a, a+1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY);
                        else
-                               cp_key(a, a+1, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
+                               cp_key(a, a+1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
                }               
        }
        else {
@@ -1292,7 +1292,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
                        for(kb= key->block.first; kb; kb= kb->next)
                                kb->weights= get_weights_array(ob, kb->vgroup);
                        
-                       do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
+                       do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
                        
                        for(kb= key->block.first; kb; kb= kb->next) {
                                if(kb->weights) MEM_freeN(kb->weights);
@@ -1386,7 +1386,7 @@ float *do_ob_key(Scene *scene, Object *ob)
                if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
                        float *weights= get_weights_array(ob, kb->vgroup);
 
-                       cp_key(0, tot, tot, (char*)out, key, actkb, kb, weights, 0);
+                       cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
 
                        if(weights) MEM_freeN(weights);
                }
index 58a2f45e8762816c800325e0c5380e56a35f8845..7b414f7746a6cea31736ceba29d15e86ff25ecc7 100644 (file)
@@ -407,8 +407,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
                return;
        }
        
-       prop = IDP_GetPropertyFromGroup(
-               rd->ffcodecdata.properties, (char*) prop_name);
+       prop = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, prop_name);
        if (!prop) {
                return;
        }
@@ -1025,8 +1024,7 @@ void ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
                return;
        }
 
-       group = IDP_GetPropertyFromGroup(
-               rd->ffcodecdata.properties, (char*) type);
+       group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type);
        if (group && prop) {
                IDP_RemFromGroup(group, prop);
                IDP_FreeProperty(prop);
@@ -1057,11 +1055,10 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int
                        = IDP_New(IDP_GROUP, val, "ffmpeg"); 
        }
 
-       group = IDP_GetPropertyFromGroup(
-               rd->ffcodecdata.properties, (char*) type);
+       group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type);
        
        if (!group) {
-               group = IDP_New(IDP_GROUP, val, (char*) type); 
+               group = IDP_New(IDP_GROUP, val, type);
                IDP_AddToGroup(rd->ffcodecdata.properties, group);
        }
 
index 667550bcaa02a8b3b29371a9d16e97886eaea0b9..3cf19df41a8c5bb62d55fe1949b8953ff2fd7e5c 100644 (file)
@@ -3112,7 +3112,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
                                pm->data[i] = newdataadr(fd, pm->data[i]);
                                
                                /* the cache saves non-struct data without DNA */
-                               if(pm->data[i] && strcmp(ptcache_data_struct[i], "")==0 && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+                               if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
                                        int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */
                                        int *poin= pm->data[i];
                                        
index c4f6e25f40b169944b05f4cc4a9ff762fd622643..8959a1ed0179f948185e9a1c567bf4fff39d3c3e 100644 (file)
@@ -872,7 +872,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
                                
                                for(i=0; i<BPHYS_TOT_DATA; i++) {
                                        if(pm->data[i] && pm->data_types & (1<<i)) {
-                                               if(strcmp(ptcache_data_struct[i], "")==0)
+                                               if(ptcache_data_struct[i][0]=='\0')
                                                        writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]);
                                                else
                                                        writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]);
@@ -880,7 +880,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
                                }
 
                                for(; extra; extra=extra->next) {
-                                       if(strcmp(ptcache_extra_struct[extra->type], "")==0)
+                                       if(ptcache_extra_struct[extra->type][0]=='\0')
                                                continue;
                                        writestruct(wd, DATA, "PTCacheExtra", 1, extra);
                                        writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data);
@@ -2699,6 +2699,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
                }
        }
 
+       userfilename[0]= '\0'; /* ensure its initialized */
        BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
        write_user_block= (BLI_path_cmp(filepath, userfilename) == 0);
 
index 24434465f5fe4020b954063d7c7ab59f5ef9a1a1..c1418c5b6e8febd968764deeedc8179543509070 100644 (file)
@@ -525,6 +525,9 @@ static void init_internal_icons(void)
                                bbuf= NULL;
                        }
                }
+               else {
+                       printf("%s: 'icons' data path not found, continuing\n", __func__);
+               }
        }
        if(bbuf==NULL)
                bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
index bc4e3cf9f131050b8ad2dac305cfbcb80eb09186..4791d2652dca547c96aa5c73e65ce0932e38bd3b 100644 (file)
@@ -2370,7 +2370,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
        
        pup->block= uiBeginBlock(C, NULL, "uiPupMenuBegin", UI_EMBOSSP);
        pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
-       pup->block->puphash= ui_popup_menu_hash((char*)title);
+       pup->block->puphash= ui_popup_menu_hash(title);
        pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
        uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
 
index bb4d6d3a33037f471e2f85715af51f0ce1ea7bc3..871cbad6152b0be3d6960f222d12bbc95bf8f1c1 100644 (file)
@@ -544,9 +544,9 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
                                rna_print_data_get(f, dp);
                                if(dp->dnapointerlevel == 0)
-                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (char*)pprop->type, dp->dnaname);
+                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname);
                                else
-                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (char*)pprop->type, dp->dnaname);
+                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname);
                        }
                        fprintf(f, "}\n\n");
                        break;
@@ -560,7 +560,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
                                   strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
                                   strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
-                                       fprintf(f, "    return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (char*)cprop->item_type: "UnknownType", manualfunc);
+                                       fprintf(f, "    return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (const char*)cprop->item_type: "UnknownType", manualfunc);
                                else
                                        fprintf(f, "    return %s(iter);\n", manualfunc);
                        }
@@ -707,7 +707,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
                fprintf(f, "value;\n");
 }
 
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func;
 
@@ -771,7 +771,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                }
                                else {
                                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
-                                       StructRNA *type= rna_find_struct((char*)pprop->type);
+                                       StructRNA *type= rna_find_struct((const char*)pprop->type);
                                        if(type && (type->flag & STRUCT_ID)) {
                                                fprintf(f, "    if(value.data)\n");
                                                fprintf(f, "            id_lib_extern((ID*)value.data);\n\n");
@@ -883,7 +883,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        return func;
 }
 
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func= NULL;
 
@@ -941,7 +941,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
        return func;
 }
 
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func, *getfunc;
 
@@ -999,7 +999,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
        return func;
 }
 
-static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc, char *nextfunc)
+static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
 {
        /* note on indices, this is for external functions and ignores skipped values.
         * so the the index can only be checked against the length when there is no 'skip' funcion. */
@@ -1078,7 +1078,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 
 #if 0
        rna_print_data_get(f, dp);
-       item_type= (cprop->item_type)? (char*)cprop->item_type: "UnknownType";
+       item_type= (cprop->item_type)? (const char*)cprop->item_type: "UnknownType";
 
        if(dp->dnalengthname || dp->dnalengthfixed) {
                if(dp->dnalengthname)
@@ -1099,7 +1099,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
        return func;
 }
 
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func, *getfunc;
 
@@ -1125,7 +1125,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
        return func;
 }
 
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func;
 
@@ -1193,12 +1193,12 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                                if(!bprop->get && !bprop->set && !dp->booleanbit)
                                        rna_set_raw_property(dp, prop);
 
-                               bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->get);
-                               bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->set);
+                               bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->get);
+                               bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->set);
                        }
                        else {
-                               bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->getarray);
-                               bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->setarray);
+                               bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->getarray);
+                               bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->setarray);
                        }
                        break;
                }
@@ -1209,15 +1209,15 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                                if(!iprop->get && !iprop->set)
                                        rna_set_raw_property(dp, prop);
 
-                               iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->get);
-                               iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->set);
+                               iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->get);
+                               iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->set);
                        }
                        else {
                                if(!iprop->getarray && !iprop->setarray)
                                        rna_set_raw_property(dp, prop);
 
-                               iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->getarray);
-                               iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->setarray);
+                               iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->getarray);
+                               iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->setarray);
                        }
                        break;
                }
@@ -1228,38 +1228,38 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                                if(!fprop->get && !fprop->set)
                                        rna_set_raw_property(dp, prop);
 
-                               fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->get);
-                               fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->set);
+                               fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->get);
+                               fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->set);
                        }
                        else {
                                if(!fprop->getarray && !fprop->setarray)
                                        rna_set_raw_property(dp, prop);
 
-                               fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->getarray);
-                               fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->setarray);
+                               fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->getarray);
+                               fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->setarray);
                        }
                        break;
                }
                case PROP_ENUM: {
                        EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
 
-                       eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)eprop->get);
-                       eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)eprop->set);
+                       eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)eprop->get);
+                       eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)eprop->set);
                        break;
                }
                case PROP_STRING: {
                        StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
 
-                       sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)sprop->get);
-                       sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)sprop->length);
-                       sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)sprop->set);
+                       sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)sprop->get);
+                       sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)sprop->length);
+                       sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)sprop->set);
                        break;
                }
                case PROP_POINTER: {
                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
 
-                       pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)pprop->get);
-                       pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)pprop->set);
+                       pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)pprop->get);
+                       pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)pprop->set);
                        if(!pprop->type) {
                                fprintf(stderr, "rna_def_property_funcs: %s.%s, pointer must have a struct type.\n", srna->identifier, prop->identifier);
                                DefRNA.error= 1;
@@ -1268,24 +1268,24 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                }
                case PROP_COLLECTION: {
                        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-                       char *nextfunc= (char*)cprop->next;
+                       const char *nextfunc= (const char*)cprop->next;
 
                        if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0);
                        else if(dp->dnalengthname || dp->dnalengthfixed)
-                               cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)cprop->length);
+                               cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)cprop->length);
 
                        /* test if we can allow raw array access, if it is using our standard
                         * array get/next function, we can be sure it is an actual array */
                        if(cprop->next && cprop->get)
-                               if(strcmp((char*)cprop->next, "rna_iterator_array_next") == 0 &&
-                                  strcmp((char*)cprop->get, "rna_iterator_array_get") == 0)
+                               if(strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 &&
+                                  strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0)
                                        prop->flag |= PROP_RAW_ARRAY;
 
-                       cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)cprop->get);
-                       cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (char*)cprop->begin);
-                       cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (char*)cprop->next);
-                       cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (char*)cprop->end);
-                       cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (char*)cprop->lookupint, nextfunc);
+                       cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get);
+                       cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
+                       cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next);
+                       cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (const char*)cprop->end);
+                       cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (const char*)cprop->lookupint, nextfunc);
 
                        if(!(prop->flag & PROP_IDPROPERTY)) {
                                if(!cprop->begin) {
@@ -1414,7 +1414,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
        if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
                return;
        
-       if(prop->name && prop->description && strcmp(prop->description, "") != 0)
+       if(prop->name && prop->description && prop->description[0] != '\0')
                fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
        else if(prop->name)
                fprintf(f, "\t/* %s */\n", prop->name);
@@ -1468,7 +1468,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
 
                        if(pprop->type)
-                               fprintf(f, "\tinline %s %s(void);", (char*)pprop->type, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tinline %s %s(void);", (const char*)pprop->type, rna_safe_id(prop->identifier));
                        else
                                fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier));
                        break;
@@ -1477,7 +1477,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
                        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
 
                        if(cprop->item_type)
-                               fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier));
                        else
                                fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
                        break;
@@ -1531,7 +1531,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
 
                        if(pprop->type)
-                               fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier));
                        else
                                fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
                        break;
@@ -1540,7 +1540,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                        /*CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
 
                        if(cprop->type)
-                               fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->type, srna->identifier, prop->identifier);
+                               fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier);
                        else
                                fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);*/
                        break;
@@ -1763,7 +1763,7 @@ static void rna_auto_types(void)
                                                pprop->type= (StructRNA*)rna_find_type(dp->dnatype);
 
                                        if(pprop->type) {
-                                               type= rna_find_struct((char*)pprop->type);
+                                               type= rna_find_struct((const char*)pprop->type);
                                                if(type && (type->flag & STRUCT_ID_REFCOUNT))
                                                        pprop->property.flag |= PROP_ID_REFCOUNT;
                                        }
@@ -2214,7 +2214,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
        else fprintf(f, "\t0, -1");
 
        /* our own type - collections/arrays only */
-       if(prop->srna) fprintf(f, ", &RNA_%s", (char*)prop->srna);
+       if(prop->srna) fprintf(f, ", &RNA_%s", (const char*)prop->srna);
        else fprintf(f, ", NULL");
 
        fprintf(f, "},\n");
@@ -2273,14 +2273,14 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        case PROP_POINTER: {
                                PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
                                fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll));
-                               if(pprop->type) fprintf(f, "&RNA_%s\n", (char*)pprop->type);
+                               if(pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type);
                                else fprintf(f, "NULL\n");
                                break;
                         }
                        case PROP_COLLECTION: {
                                CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
                                fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint));
-                               if(cprop->item_type) fprintf(f, "&RNA_%s\n", (char*)cprop->item_type);
+                               if(cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type);
                                else fprintf(f, "NULL\n");
                                break;
                        }
index 8047b2df2268f58993aa97798e2bbba1b3be900e..422ee6f31dc590a327e29f46e48b138a8dfba103 100644 (file)
@@ -1614,7 +1614,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
+                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier));
        }
 }
 
@@ -1693,7 +1693,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
 
                group= RNA_struct_idprops(ptr, 1);
                if(group) {
-                       idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
+                       idprop= IDP_New(IDP_ARRAY, val, prop->identifier);
                        IDP_AddToGroup(group, idprop);
                        memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
                }
@@ -1811,7 +1811,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
+                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier));
        }
 }
 
@@ -1927,7 +1927,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v
 
                group= RNA_struct_idprops(ptr, 1);
                if(group) {
-                       idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
+                       idprop= IDP_New(IDP_ARRAY, val, prop->identifier);
                        IDP_AddToGroup(group, idprop);
                        memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
                }
@@ -2047,7 +2047,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, (char*)prop->identifier));
+                       IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, prop->identifier));
        }
 }
 
@@ -2181,7 +2181,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa
 
                group= RNA_struct_idprops(ptr, 1);
                if(group) {
-                       idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
+                       idprop= IDP_New(IDP_ARRAY, val, prop->identifier);
                        IDP_AddToGroup(group, idprop);
                        memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
                }
@@ -2328,7 +2328,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
        BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
        if((idprop=rna_idproperty_check(&prop, ptr)))
-               IDP_AssignString(idprop, (char*)value, RNA_property_string_maxlength(prop) - 1);
+               IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1);
        else if(sprop->set)
                sprop->set(ptr, value); /* set function needs to clamp its self */
        else if(prop->flag & PROP_EDITABLE) {
@@ -2336,7 +2336,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_NewString((char*)value, (char*)prop->identifier, RNA_property_string_maxlength(prop) - 1));
+                       IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop) - 1));
        }
 }
 
@@ -2413,7 +2413,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
+                       IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier));
        }
 }
 
@@ -2509,7 +2509,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
 
                group= RNA_struct_idprops(ptr, 1);
                if(group)
-                       IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier));
+                       IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, prop->identifier));
        }
        else
                printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);
index 43d5f87f0d5001d0e1e32d903d33ee2cc18a8844..a1d156a2b2ac146f5579963c5241e01818839fa0 100644 (file)
@@ -820,7 +820,7 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i
                psys->vgroup[index]= 0;
        }
        else {
-               int vgroup_num = defgroup_name_index(ob, (char*)value);
+               int vgroup_num = defgroup_name_index(ob, value);
 
                if(vgroup_num == -1)
                        return;
index 9e19a057175fd0360556ccae34f7a314de448cfe..34f59ce047d92de0b7d852319b98cc869ffd52ac 100644 (file)
@@ -267,6 +267,9 @@ void                WM_gestures_remove(struct bContext *C);
                        /* fileselecting support */
 void           WM_event_add_fileselect(struct bContext *C, struct wmOperator *op);
 void           WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval);
+#ifndef NDEBUG
+void           WM_event_print(struct wmEvent *event);
+#endif
 
                        /* drag and drop */
 struct wmDrag          *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value);
index 6fd84b4c315bb45e03ac2fabc3aa92bd5db5b121..e73440e5eb0b9a1e6255fce53fdbbedfd764b3a9 100644 (file)
 #include "wm_event_types.h"
 #include "wm_draw.h"
 
+#ifndef NDEBUG
+#  include "RNA_enum_types.h"
+#endif
+
 static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only);
 
 /* ************ event management ************** */
@@ -435,6 +439,35 @@ static void wm_operator_print(bContext *C, wmOperator *op)
        MEM_freeN(buf);
 }
 
+/* for debugging only, getting inspecting events manually is tedious */
+#ifndef NDEBUG
+
+void WM_event_print(wmEvent *event)
+{
+       if(event) {
+               const char *unknown= "UNKNOWN";
+               const char *type_id= unknown;
+               const char *val_id= unknown;
+
+               RNA_enum_identifier(event_type_items, event->type, &type_id);
+               RNA_enum_identifier(event_value_items, event->val, &val_id);
+
+               printf("wmEvent - type:%d/%s, val:%d/%s, "
+                          "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, "
+                          "mouse:(%d,%d), ascii:'%c', utf8:'%.6s', "
+                          "keymap_idname:%s, pointer:%p\n",
+                          event->type, type_id, event->val, val_id,
+                          event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier,
+                          event->x, event->y, event->ascii, event->utf8_buf,
+                          event->keymap_idname, (void *)event);
+       }
+       else {
+               printf("wmEvent - NULL\n");
+       }
+}
+
+#endif /* NDEBUG */
+
 static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup)
 {
        if(popup) {
index 7a8d69e58a5cfbac80701794873ba7b5a9caecea..a06da3941af09ba81a4f9b914d60bc72679cacee 100644 (file)
@@ -678,7 +678,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
        else {
                pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
                layout= uiPupMenuLayout(pup);
-               uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
+               uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
                uiPupMenuEnd(C, pup);
        }