Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-21 12:16:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-21 12:16:15 +0400
commit04db8ad282ec305ab61245b7556e15121d9cdcc5 (patch)
tree49bb50c8598051771b572b3ebfbfdc76ccff26a1 /source
parentf9f5daed9bb0b1f239b3b3d3de7e6ff95b56e3d2 (diff)
misc cleanup
- 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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_lang.c7
-rw-r--r--source/blender/blenfont/intern/blf_translation.c12
-rw-r--r--source/blender/blenkernel/intern/key.c8
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c11
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/blenloader/intern/writefile.c5
-rw-r--r--source/blender/editors/interface/interface_icons.c3
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/makesrna/intern/makesrna.c96
-rw-r--r--source/blender/makesrna/intern/rna_access.c20
-rw-r--r--source/blender/makesrna/intern/rna_particle.c2
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c33
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
14 files changed, 126 insertions, 80 deletions
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index ec9501c06a6..d5245073e59 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -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';
+ }
}
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 8c0a26df4c2..90d9c4a5981 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 9e48e691b87..3baf8e04b90 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -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);
}
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 58a2f45e876..7b414f7746a 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -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);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 667550bcaa0..3cf19df41a8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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];
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c4f6e25f40b..8959a1ed017 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -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);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 24434465f5f..c1418c5b6e8 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -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);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index bc4e3cf9f13..4791d2652dc 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -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);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index bb4d6d3a330..871cbad6152 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -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;
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 8047b2df226..422ee6f31dc 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -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);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 43d5f87f0d5..a1d156a2b2a 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -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;
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 9e19a057175..34f59ce047d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -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);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 6fd84b4c315..e73440e5eb0 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -79,6 +79,10 @@
#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) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 7a8d69e58a5..a06da3941af 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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);
}