diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-10 17:11:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-10 17:11:36 +0400 |
commit | eabb4441061401245f4e12de7c54f9c46c7b3826 (patch) | |
tree | fba466a4876491f3ca7a3b9fd8e39d8e5d937b38 /source | |
parent | 6d5f0bfac6408f511f556ec756941512ec0b9a6d (diff) |
minor cleanup: make functions static, use NULL for pointer comparisons,
also fixed a possible bug assigning incorrect DPX function types to
imbuf.
Diffstat (limited to 'source')
18 files changed, 40 insertions, 47 deletions
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 857ead0b7cd..fd874d991ea 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -51,6 +51,7 @@ #include "BLF_api.h" #include "blf_internal_types.h" +#include "blf_internal.h" static ListBase global_font_dir= { NULL, NULL }; @@ -150,6 +151,7 @@ char *blf_dir_search(const char *file) return(s); } +#if 0 // UNUSED int blf_dir_split(const char *str, char *file, int *size) { int i, len; @@ -173,6 +175,7 @@ int blf_dir_split(const char *str, char *file, int *size) } return(0); } +#endif /* Some font have additional file with metrics information, * in general, the extension of the file is: .afm or .pfm diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 34df8d72103..9271d8d5a9e 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -44,7 +44,7 @@ int blf_utf8_next(unsigned char *buf, int *iindex); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); -int blf_dir_split(const char *str, char *file, int *size); +// int blf_dir_split(const char *str, char *file, int *size); // UNUSED int blf_font_init(void); void blf_font_exit(void); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index cbe0a959f15..02eb3aa540e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1913,9 +1913,10 @@ static void give_parvert(Object *par, int nr, float *vec) if(dm) { MVert *mvert= dm->getVertArray(dm); int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); - int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); + int i, vindex, numVerts = dm->getNumVerts(dm); /* get the average of all verts with (original index == nr) */ + count= 0; for(i = 0; i < numVerts; i++) { vindex= (index)? index[i]: i; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e2d7147d21f..02fae52219b 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -110,7 +110,7 @@ int ED_operator_screenactive(bContext *C) } /* XXX added this to prevent anim state to change during renders */ -int ED_operator_screenactive_norender(bContext *C) +static int ED_operator_screenactive_norender(bContext *C) { if(G.rendering) return 0; if(CTX_wm_window(C)==NULL) return 0; diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index d75c1aa7dd3..188042ad1d1 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -612,7 +612,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even bAnimContext ac; Scene *scene; ARegion *ar; - View2D *v2d; + // View2D *v2d; /*UNUSED*/ short selectmode; int mval[2]; @@ -623,7 +623,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even /* get useful pointers from animation context data */ scene= ac.scene; ar= ac.ar; - v2d= &ar->v2d; + // v2d= &ar->v2d; /* get mouse coordinates (in region coordinates) */ mval[0]= (event->x - ar->winrct.xmin); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index eee7a3d7f69..20d7ea21d5c 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -419,7 +419,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float return sel; } -int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3]) +static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3]) { EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 504817b263f..8df2a9f6985 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -44,6 +44,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" +#include "IMB_filetype.h" #include "BKE_global.h" @@ -192,7 +193,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon return 1; } -short imb_savecineon(struct ImBuf *buf, const char *myfile, int flags) +int imb_savecineon(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 1, flags); } @@ -203,14 +204,14 @@ int imb_is_cineon(unsigned char *buf) return cineonIsMemFileCineon(buf); } -ImBuf *imb_loadcineon(unsigned char *mem, int size, int flags) +ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags) { if(imb_is_cineon(mem)) return imb_load_dpx_cineon(mem, 1, size, flags); return NULL; } -short imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) +int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 0, flags); } @@ -220,7 +221,7 @@ int imb_is_dpx(unsigned char *buf) return dpxIsMemFileCineon(buf); } -ImBuf *imb_loaddpx(unsigned char *mem, int size, int flags) +ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags) { if(imb_is_dpx(mem)) return imb_load_dpx_cineon(mem, 0, size, flags); diff --git a/source/blender/imbuf/intern/cineon/cineonfile.h b/source/blender/imbuf/intern/cineon/cineonfile.h index 31aa56f560c..896e0af65b3 100644 --- a/source/blender/imbuf/intern/cineon/cineonfile.h +++ b/source/blender/imbuf/intern/cineon/cineonfile.h @@ -126,19 +126,6 @@ typedef struct { ASCII reserved[740]; } CineonMPISpecificInformation; -#if 0 -/* create CineonFile from data in header */ -/* return 0 for OK */ -int readCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header); - -/* create header from data in CineonFile */ -int initCineonGenericHeader( - CineonFile* cineon, CineonGenericHeader* header, const char* imagename); - -/* Note: dump routine assumes network byte order */ -void dumpCineonGenericHeader(CineonGenericHeader* header); -#endif - #ifdef __cplusplus } #endif diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index fdcd3491af1..922cfcf9629 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -276,7 +276,7 @@ dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) { d_printf("Input device gamma %f\n", ntohf(originInfo->input_device_gamma)); } -int +static int initCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header, const char* imagename) { fillCineonFileInfo(cineon, &header->fileInfo, imagename); @@ -287,7 +287,7 @@ initCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header, const c return 0; } -void +static void dumpCineonGenericHeader(CineonGenericHeader* header) { dumpCineonFileInfo(&header->fileInfo); dumpCineonImageInfo(&header->imageInfo); diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c index 6347eb5fdf9..d3a32774efd 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.c +++ b/source/blender/imbuf/intern/cineon/logmemfile.c @@ -27,6 +27,8 @@ #include "logImageCore.h" +#include "logmemfile.h" /* own include */ + int logimage_fseek(void* logfile, intptr_t offsett, int origin) { struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile; diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 4291fc824e9..b66b2109329 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -76,7 +76,7 @@ static void bpy_lib_dealloc(BPy_Library *self) } -PyTypeObject bpy_lib_Type= { +static PyTypeObject bpy_lib_Type= { PyVarObject_HEAD_INIT(NULL, 0) "bpy_lib", /* tp_name */ sizeof(BPy_Library), /* tp_basicsize */ diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 865cb056a61..07d24ea6d66 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -37,7 +37,7 @@ struct LampRen; struct VlakRen; struct StrandSegment; struct StrandPoint; -struct ObjectInstanceRen obi; +struct ObjectInstanceRen; struct Isect; /* shadeinput.c */ diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 74ec52c5dbf..e8f66cf18ef 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -96,7 +96,7 @@ static void RE_rayobject_config_control(RayObject *r, Render *re) } } -RayObject* RE_rayobject_create(Render *re, int type, int size) +static RayObject* RE_rayobject_create(Render *re, int type, int size) { RayObject * res = NULL; @@ -1679,7 +1679,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int /* not used, test function for ambient occlusion (yaf: pathlight) */ /* main problem; has to be called within shading loop, giving unwanted recursion */ -int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) +static int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) { static int counter=0, only_one= 0; extern float hashvectf[]; diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 74c99d1a92f..afe4d5c7e35 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -782,7 +782,7 @@ void free_renderdata_vlaknodes(VlakTableNode *vlaknodes) MEM_freeN(vlaknodes); } -void free_renderdata_strandnodes(StrandTableNode *strandnodes) +static void free_renderdata_strandnodes(StrandTableNode *strandnodes) { int a; diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 12e85af7575..9f5c2c39472 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -210,7 +210,7 @@ static void interpolate_vec4(float *v1, float *v2, float t, float negt, float *v v[3]= negt*v1[3] + t*v2[3]; } -void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, ShadeResult *shr, int addpassflag) +static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, ShadeResult *shr, int addpassflag) { float negt= 1.0f - t; @@ -252,7 +252,7 @@ void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, Sha } } -void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha) +static void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha) { if(alpha < 1.0f) { shr->combined[0] *= alpha; diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 919c06d81f7..f645c29a7a5 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -113,7 +113,7 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi) * PerezFunction: * compute perez function value based on input paramters * */ -float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz) +static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz) { float den, num; @@ -313,7 +313,7 @@ void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_ * turbidity: is atmosphere turbidity * fTau: contains computed attenuated sun light * */ -void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) +static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) { float fBeta ; float fTauR, fTauA; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index fc3280db771..8293143a2a6 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -74,7 +74,7 @@ extern struct Render R; /* Recursive test for intersections, from a point inside the mesh, to outside * Number of intersections (depth) determine if a point is inside or outside the mesh */ -int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int limit, int depth) +static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int limit, int depth) { if (limit == 0) return depth; @@ -96,7 +96,7 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l } /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */ -int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) +static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) { Isect isect= {{0}}; float dir[3] = {0.0f,0.0f,1.0f}; @@ -350,7 +350,7 @@ static void ms_diffuse(float *x0, float *x, float diff, int *n) //n is the unpad } } -void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) +static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) { const float diff = ma->vol.ms_diff * 0.001f; /* compensate for scaling for a nicer UI range */ const int simframes = (int)(ma->vol.ms_spread * (float)MAX3(vp->res[0], vp->res[1], vp->res[2])); @@ -538,7 +538,7 @@ static void *vol_precache_part(void *data) pa->done = 1; - return 0; + return NULL; } @@ -676,7 +676,7 @@ static int precache_resolution(Render *re, VolumePrecache *vp, ObjectInstanceRen * in camera space, aligned with the ObjectRen's bounding box. * Resolution is defined by the user. */ -void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Material *ma) +static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Material *ma) { VolumePrecache *vp; VolPrecachePart *nextpa, *pa; @@ -709,9 +709,8 @@ void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Mat vp->data_r = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data red channel"); vp->data_g = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data green channel"); vp->data_b = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data blue channel"); - if (vp->data_r==0 || vp->data_g==0 || vp->data_b==0) { + if (vp->data_r==NULL || vp->data_g==NULL || vp->data_b==NULL) { MEM_freeN(vp); - vp = NULL; return; } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index dde9dbb8485..09422af7c79 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -305,7 +305,7 @@ float vol_get_density(struct ShadeInput *shi, float *co) /* Color of light that gets scattered out by the volume */ /* Uses same physically based scattering parameter as in transmission calculations, * along with artificial reflection scale/reflection color tint */ -void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) +static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) { float scatter = shi->mat->vol.scattering; float reflection= shi->mat->vol.reflection; @@ -325,7 +325,7 @@ void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) /* compute emission component, amount of radiance to add per segment * can be textured with 'emit' */ -void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) +static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) { float emission = shi->mat->vol.emission; VECCOPY(emission_col, shi->mat->vol.emission_col); @@ -343,7 +343,7 @@ void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) * This can possibly use a specific scattering color, * and absorption multiplier factor too, but these parameters are left out for simplicity. * It's easy enough to get a good wide range of results with just these two parameters. */ -void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) +static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) { /* technically absorption, but named transmission color * since it describes the effect of the coloring *after* absorption */ @@ -361,7 +361,7 @@ void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) /* phase function - determines in which directions the light * is scattered in the volume relative to incoming direction * and view direction */ -float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) +static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) { const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI) @@ -408,7 +408,7 @@ float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) } /* Compute transmittance = e^(-attenuation) */ -void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density) +static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density) { /* input density = density at co */ float tau[3] = {0.f, 0.f, 0.f}; @@ -464,7 +464,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float * tr[2] = expf(-tau[2]); } -void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *lacol) +static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *lacol) { float visifac, lv[3], lampdist; float tr[3]={1.0,1.0,1.0}; |