[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46618] trunk/blender: style cleanup: imbuf & icons
Campbell Barton
ideasman42 at gmail.com
Mon May 14 00:05:52 CEST 2012
Revision: 46618
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46618
Author: campbellbarton
Date: 2012-05-13 22:05:51 +0000 (Sun, 13 May 2012)
Log Message:
-----------
style cleanup: imbuf & icons
Modified Paths:
--------------
trunk/blender/GNUmakefile
trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c
trunk/blender/source/blender/blenkernel/intern/icons.c
trunk/blender/source/blender/editors/space_api/spacetypes.c
trunk/blender/source/blender/imbuf/intern/allocimbuf.c
trunk/blender/source/blender/imbuf/intern/divers.c
trunk/blender/source/blender/imbuf/intern/filter.c
trunk/blender/source/blender/imbuf/intern/imageprocess.c
trunk/blender/source/blender/imbuf/intern/rotate.c
trunk/blender/source/blender/imbuf/intern/writeimage.c
trunk/blender/source/tools/check_style_c.py
Modified: trunk/blender/GNUmakefile
===================================================================
--- trunk/blender/GNUmakefile 2012-05-13 21:46:18 UTC (rev 46617)
+++ trunk/blender/GNUmakefile 2012-05-13 22:05:51 UTC (rev 46618)
@@ -216,7 +216,7 @@
test_style:
# run our own checks on C/C++ style
- PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator
+ PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check
# -----------------------------------------------------------------------------
# Project Files
Modified: trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c 2012-05-13 21:46:18 UTC (rev 46617)
+++ trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c 2012-05-13 22:05:51 UTC (rev 46618)
@@ -2406,7 +2406,7 @@
CCGFace **array;
int i, num;
- if (!*faces) {
+ if (*faces == NULL) {
array = MEM_mallocN(sizeof(*array) * ss->fMap->numEntries, "CCGSubsurf allFaces");
num = 0;
for (i = 0; i < ss->fMap->curSize; i++) {
Modified: trunk/blender/source/blender/blenkernel/intern/icons.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/icons.c 2012-05-13 21:46:18 UTC (rev 46617)
+++ trunk/blender/source/blender/blenkernel/intern/icons.c 2012-05-13 22:05:51 UTC (rev 46618)
@@ -51,11 +51,9 @@
#include "BLO_sys_types.h" // for intptr_t support
-#define GS(a) (*((short *)(a)))
-
/* GLOBALS */
-static GHash* gIcons = NULL;
+static GHash *gIcons = NULL;
static int gNextIconId = 1;
@@ -64,7 +62,7 @@
static void icon_free(void *val)
{
- Icon* icon = val;
+ Icon *icon = val;
if (icon) {
if (icon->drawinfo_free) {
@@ -84,15 +82,15 @@
int startId = gFirstIconId;
/* if we haven't used up the int number range, we just return the next int */
- if (gNextIconId>=gFirstIconId)
+ if (gNextIconId >= gFirstIconId)
return gNextIconId++;
/* now we try to find the smallest icon id not stored in the gIcons hash */
- while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId>=gFirstIconId)
+ while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId)
startId++;
/* if we found a suitable one that isn't used yet, return it */
- if (startId>=gFirstIconId)
+ if (startId >= gFirstIconId)
return startId;
/* fail */
@@ -115,14 +113,14 @@
gIcons = NULL;
}
-struct PreviewImage* BKE_previewimg_create(void)
+PreviewImage *BKE_previewimg_create(void)
{
- PreviewImage* prv_img = NULL;
+ PreviewImage *prv_img = NULL;
int i;
prv_img = MEM_callocN(sizeof(PreviewImage), "img_prv");
- for (i=0; i<NUM_ICON_SIZES; ++i) {
+ for (i = 0; i < NUM_ICON_SIZES; ++i) {
prv_img->changed[i] = 1;
prv_img->changed_timestamp[i] = 0;
}
@@ -135,7 +133,7 @@
if (prv) {
int i;
- for (i=0; i<NUM_ICON_SIZES;++i) {
+ for (i = 0; i < NUM_ICON_SIZES; ++i) {
if (prv->rect[i]) {
MEM_freeN(prv->rect[i]);
prv->rect[i] = NULL;
@@ -153,14 +151,14 @@
}
}
-struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv)
+PreviewImage *BKE_previewimg_copy(PreviewImage *prv)
{
- PreviewImage* prv_img = NULL;
+ PreviewImage *prv_img = NULL;
int i;
if (prv) {
prv_img = MEM_dupallocN(prv);
- for (i=0; i < NUM_ICON_SIZES; ++i) {
+ for (i = 0; i < NUM_ICON_SIZES; ++i) {
if (prv->rect[i]) {
prv_img->rect[i] = MEM_dupallocN(prv->rect[i]);
}
@@ -175,62 +173,62 @@
void BKE_previewimg_free_id(ID *id)
{
if (GS(id->name) == ID_MA) {
- Material *mat = (Material*)id;
+ Material *mat = (Material *)id;
BKE_previewimg_free(&mat->preview);
}
else if (GS(id->name) == ID_TE) {
- Tex *tex = (Tex*)id;
+ Tex *tex = (Tex *)id;
BKE_previewimg_free(&tex->preview);
}
else if (GS(id->name) == ID_WO) {
- World *wo = (World*)id;
+ World *wo = (World *)id;
BKE_previewimg_free(&wo->preview);
}
else if (GS(id->name) == ID_LA) {
- Lamp *la = (Lamp*)id;
+ Lamp *la = (Lamp *)id;
BKE_previewimg_free(&la->preview);
}
else if (GS(id->name) == ID_IM) {
- Image *img = (Image*)id;
+ Image *img = (Image *)id;
BKE_previewimg_free(&img->preview);
}
else if (GS(id->name) == ID_BR) {
- Brush *br = (Brush*)id;
+ Brush *br = (Brush *)id;
BKE_previewimg_free(&br->preview);
}
}
-PreviewImage* BKE_previewimg_get(ID *id)
+PreviewImage *BKE_previewimg_get(ID *id)
{
- PreviewImage* prv_img = NULL;
+ PreviewImage *prv_img = NULL;
if (GS(id->name) == ID_MA) {
- Material *mat = (Material*)id;
+ Material *mat = (Material *)id;
if (!mat->preview) mat->preview = BKE_previewimg_create();
prv_img = mat->preview;
}
else if (GS(id->name) == ID_TE) {
- Tex *tex = (Tex*)id;
+ Tex *tex = (Tex *)id;
if (!tex->preview) tex->preview = BKE_previewimg_create();
prv_img = tex->preview;
}
else if (GS(id->name) == ID_WO) {
- World *wo = (World*)id;
+ World *wo = (World *)id;
if (!wo->preview) wo->preview = BKE_previewimg_create();
prv_img = wo->preview;
}
else if (GS(id->name) == ID_LA) {
- Lamp *la = (Lamp*)id;
+ Lamp *la = (Lamp *)id;
if (!la->preview) la->preview = BKE_previewimg_create();
prv_img = la->preview;
}
else if (GS(id->name) == ID_IM) {
- Image *img = (Image*)id;
+ Image *img = (Image *)id;
if (!img->preview) img->preview = BKE_previewimg_create();
prv_img = img->preview;
}
else if (GS(id->name) == ID_BR) {
- Brush *br = (Brush*)id;
+ Brush *br = (Brush *)id;
if (!br->preview) br->preview = BKE_previewimg_create();
prv_img = br->preview;
}
@@ -240,19 +238,19 @@
void BKE_icon_changed(int id)
{
- Icon* icon = NULL;
+ Icon *icon = NULL;
if (!id || G.background) return;
icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(id));
if (icon) {
- PreviewImage *prv = BKE_previewimg_get((ID*)icon->obj);
+ PreviewImage *prv = BKE_previewimg_get((ID *)icon->obj);
/* all previews changed */
if (prv) {
int i;
- for (i=0; i<NUM_ICON_SIZES; ++i) {
+ for (i = 0; i < NUM_ICON_SIZES; ++i) {
prv->changed[i] = 1;
prv->changed_timestamp[i]++;
}
@@ -260,9 +258,9 @@
}
}
-int BKE_icon_getid(struct ID* id)
+int BKE_icon_getid(struct ID *id)
{
- Icon* new_icon = NULL;
+ Icon *new_icon = NULL;
if (!id || G.background)
return 0;
@@ -291,9 +289,9 @@
return id->icon_id;
}
-Icon* BKE_icon_get(int icon_id)
+Icon *BKE_icon_get(int icon_id)
{
- Icon* icon = NULL;
+ Icon *icon = NULL;
icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
@@ -305,9 +303,9 @@
return icon;
}
-void BKE_icon_set(int icon_id, struct Icon* icon)
+void BKE_icon_set(int icon_id, struct Icon *icon)
{
- Icon* old_icon = NULL;
+ Icon *old_icon = NULL;
old_icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
@@ -319,10 +317,10 @@
BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(icon_id), icon);
}
-void BKE_icon_delete(struct ID* id)
+void BKE_icon_delete(struct ID *id)
{
- if (!id->icon_id) return; /* no icon defined for library object */
+ if (!id->icon_id) return; /* no icon defined for library object */
BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(id->icon_id), NULL, icon_free);
id->icon_id = 0;
Modified: trunk/blender/source/blender/editors/space_api/spacetypes.c
===================================================================
--- trunk/blender/source/blender/editors/space_api/spacetypes.c 2012-05-13 21:46:18 UTC (rev 46617)
+++ trunk/blender/source/blender/editors/space_api/spacetypes.c 2012-05-13 22:05:51 UTC (rev 46618)
@@ -70,7 +70,7 @@
SpaceType *type;
/* UI_UNIT_X is now a variable, is used in some spacetype inits? */
- U.widget_unit= 20;
+ U.widget_unit = 20;
/* create space types */
ED_spacetype_outliner();
@@ -117,7 +117,7 @@
/* register operators */
spacetypes = BKE_spacetypes_list();
- for (type=spacetypes->first; type; type=type->next) {
+ for (type = spacetypes->first; type; type = type->next) {
if (type->operatortypes)
type->operatortypes();
}
@@ -136,7 +136,7 @@
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();
- for (type=spacetypes->first; type; type=type->next) {
+ for (type = spacetypes->first; type; type = type->next) {
if (type->dropboxes)
type->dropboxes();
}
@@ -169,10 +169,10 @@
UI_view2d_keymap(keyconf);
spacetypes = BKE_spacetypes_list();
- for (stype=spacetypes->first; stype; stype=stype->next) {
+ for (stype = spacetypes->first; stype; stype = stype->next) {
if (stype->keymap)
stype->keymap(keyconf);
- for (atype=stype->regiontypes.first; atype; atype=atype->next) {
+ for (atype = stype->regiontypes.first; atype; atype = atype->next) {
if (atype->keymap)
atype->keymap(keyconf);
}
@@ -192,15 +192,15 @@
} RegionDrawCB;
void *ED_region_draw_cb_activate(ARegionType *art,
- void (*draw)(const struct bContext *, struct ARegion *, void *),
- void *customdata, int type)
+ void (*draw)(const struct bContext *, struct ARegion *, void *),
+ void *customdata, int type)
{
- RegionDrawCB *rdc= MEM_callocN(sizeof(RegionDrawCB), "RegionDrawCB");
+ RegionDrawCB *rdc = MEM_callocN(sizeof(RegionDrawCB), "RegionDrawCB");
BLI_addtail(&art->drawcalls, rdc);
- rdc->draw= draw;
- rdc->customdata= customdata;
- rdc->type= type;
+ rdc->draw = draw;
+ rdc->customdata = customdata;
+ rdc->type = type;
return rdc;
}
@@ -209,8 +209,8 @@
{
RegionDrawCB *rdc;
- for (rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
- if (rdc==(RegionDrawCB *)handle) {
+ for (rdc = art->drawcalls.first; rdc; rdc = rdc->next) {
+ if (rdc == (RegionDrawCB *)handle) {
BLI_remlink(&art->drawcalls, rdc);
MEM_freeN(rdc);
return;
@@ -227,8 +227,8 @@
{
RegionDrawCB *rdc;
- for (rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
- if (rdc->type==type)
+ for (rdc = ar->type->drawcalls.first; rdc; rdc = rdc->next) {
+ if (rdc->type == type)
rdc->draw(C, ar, rdc->customdata);
}
}
@@ -283,14 +283,14 @@
{
static SpaceType st;
- st.spaceid= SPACE_VIEW3D;
+ st.spaceid = SPACE_VIEW3D;
- st.new= xxx_new;
- st.free= xxx_free;
- st.init= xxx_init;
- st.duplicate= xxx_duplicate;
- st.operatortypes= xxx_operatortypes;
- st.keymap= xxx_keymap;
+ st.new = xxx_new;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list