style cleanup: whitespace/operators

This commit is contained in:
2012-05-09 09:24:15 +00:00
parent c2863e3f9b
commit d20c129a9c
34 changed files with 206 additions and 244 deletions

View File

@@ -966,8 +966,7 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...)
temp = (AviIndexEntry *) MEM_mallocN((frame_num + 1) *
(movie->header->Streams + 1) * sizeof(AviIndexEntry), "newidxentry");
if (movie->entries != NULL) {
memcpy(temp, movie->entries, movie->index_entries * (movie->header->Streams + 1)
* sizeof(AviIndexEntry));
memcpy(temp, movie->entries, movie->index_entries * (movie->header->Streams + 1) * sizeof(AviIndexEntry));
MEM_freeN(movie->entries);
}

View File

@@ -2666,7 +2666,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
if (is_degenerate == 0) {
copy_v2_v2(prev_edge, cur_edge);
++i;
i++;
}
}
}
@@ -2725,7 +2725,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
f2x_surf_area = len_v3(norm);
fsurf_ratio = f2x_surf_area/f2x_area_uv; // tri area divided by texture area
++nr_accumulated;
nr_accumulated++;
dsum += (double)(fsurf_ratio);
}
}

View File

@@ -1915,8 +1915,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
void *src_data = source->layers[src_i].data;
for (j = 0; j < count; ++j)
sources[j] = (char *)src_data
+ typeInfo->size * src_indices[j];
sources[j] = (char *)src_data + typeInfo->size * src_indices[j];
dest_offset = dest_index * typeInfo->size;

View File

@@ -96,8 +96,7 @@ ModifierData *modifier_new(int type)
BLI_strncpy(md->name, mti->name, sizeof(md->name));
md->type = type;
md->mode = eModifierMode_Realtime
| eModifierMode_Render | eModifierMode_Expanded;
md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded;
if (mti->flags & eModifierTypeFlag_EnableInEditmode)
md->mode |= eModifierMode_Editmode;

View File

@@ -476,9 +476,9 @@ static int get_levels_from_disps(Object *ob)
if (md->totdisp == lvl_totdisp)
break;
else if (md->totdisp < lvl_totdisp)
--totlvl;
totlvl--;
else
++totlvl;
totlvl++;
}
@@ -764,7 +764,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
int vndx = me->mloop[p->loopstart + k].v;
if (vndx != i) {
add_v3_v3(center, origco[vndx]);
++tot;
tot++;
}
}
}
@@ -1755,7 +1755,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
/* Load base verts */
for (i = 0; i < lvl1->totvert; ++i) {
vvmap[totvert - lvl1->totvert + i] = src;
++src;
src++;
}
/* Original edges */
@@ -1801,7 +1801,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
int sides = lvl1->faces[i].v[3] ? 4 : 3;
lvl = lvl1->next->next;
++dst;
dst++;
for (j = 3; j <= mr->level_count; ++j) {
int base = multires_side_tot[totlvl - j + 1] - 2;
@@ -1819,7 +1819,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
for (s = 0; s < sides; ++s) {
for (x = 0; x < st2; ++x) {
vvmap[dst + crossedgelen * (s + 1) - base - x * skip - 1] = lsrc;
++lsrc;
lsrc++;
}
}

View File

@@ -512,9 +512,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
vec[0]/=delta[0];
vec[1]/=delta[1];
vec[2]/=delta[2];
(pa +((int)(vec[0]*(size[0]-1))*res
+(int)(vec[1]*(size[1]-1)))*res
+(int)(vec[2]*(size[2]-1)))->flag &= ~PARS_UNEXIST;
(pa + ((int)(vec[0] * (size[0] - 1)) * res +
(int)(vec[1] * (size[1] - 1))) * res +
(int)(vec[2] * (size[2] - 1)))->flag &= ~PARS_UNEXIST;
}
}
else if (ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {

View File

@@ -312,8 +312,7 @@ static struct ImBuf *do_plugin_effect(
if (cp) strncpy(cp, seq->name + 2, sizeof(seq->name) - 2);
if (seq->plugin->current_private_data) {
*seq->plugin->current_private_data
= seq->plugin->instance_private_data;
*seq->plugin->current_private_data = seq->plugin->instance_private_data;
}
float_rendering = (out->rect_float != NULL);
@@ -1094,8 +1093,7 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
while (x--) {
*rt = gammaCorrect(
fac1 * invGammaCorrect(*rt1)
+ fac2 * invGammaCorrect(*rt2));
fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
rt1++; rt2++; rt++;
}
@@ -1106,8 +1104,7 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
while (x--) {
*rt = gammaCorrect(
fac1 * invGammaCorrect(*rt1)
+ fac2 * invGammaCorrect(*rt2));
fac1 * invGammaCorrect(*rt1) + fac2 * invGammaCorrect(*rt2));
rt1++; rt2++; rt++;
}

View File

@@ -3934,8 +3934,7 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
}
if (seq->strip->color_balance) {
seqn->strip->color_balance
= MEM_dupallocN(seq->strip->color_balance);
seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
}
if (seq->type == SEQ_META) {

View File

@@ -3514,9 +3514,9 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
totvert= lt->pntsu*lt->pntsv*lt->pntsw;
if (ob->softflag & OB_SB_EDGES) {
totspring = ((lt->pntsu -1) * lt->pntsv
+ (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+lt->pntsu*lt->pntsv*(lt->pntsw -1);
totspring = ((lt->pntsu - 1) * lt->pntsv +
(lt->pntsv - 1) * lt->pntsu) * lt->pntsw +
lt->pntsu*lt->pntsv * (lt->pntsw - 1);
if (ob->softflag & OB_SB_QUADS) {
totspring += 4 * (lt->pntsu - 1) * (lt->pntsv -1) * (lt->pntsw - 1);
}

View File

@@ -730,8 +730,9 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
int gridInternalEnd;
i = 0;
while (i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert)
++i;
while (i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert) {
i++;
}
f = ccgdm->faceMap[i].face;
numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -774,8 +775,9 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
int x;
i = 0;
while (i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert)
++i;
while (i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert) {
i++;
}
e = ccgdm->edgeMap[i].edge;
@@ -869,8 +871,9 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
#endif
i = 0;
while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge)
++i;
while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge) {
i++;
}
f = ccgdm->faceMap[i].face;
/* numVerts = ccgSubSurf_getFaceNumVerts(f); */ /*UNUSED*/
@@ -1144,8 +1147,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
if (edgeFlags) {
if (edgeIdx != -1) {
flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP))
| ME_EDGEDRAW | ME_EDGERENDER;
flags |= ((edgeFlags[index] & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW | ME_EDGERENDER);
}
}
else {
@@ -3169,10 +3171,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
numVerts, vertNum);
if (vertOrigIndex) {
*vertOrigIndex = ORIGINDEX_NONE;
++vertOrigIndex;
vertOrigIndex++;
}
++vertNum;
vertNum++;
/*interpolate per-vert data*/
for (s = 0; s < numVerts; s++) {
@@ -3183,10 +3185,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
if (vertOrigIndex) {
*vertOrigIndex = ORIGINDEX_NONE;
++vertOrigIndex;
vertOrigIndex++;
}
++vertNum;
vertNum++;
}
}
@@ -3200,10 +3202,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
if (vertOrigIndex) {
*vertOrigIndex = ORIGINDEX_NONE;
++vertOrigIndex;
vertOrigIndex++;
}
++vertNum;
vertNum++;
}
}
}
@@ -3299,9 +3301,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, 2, vertNum);
if (vertOrigIndex) {
*vertOrigIndex = ORIGINDEX_NONE;
++vertOrigIndex;
vertOrigIndex++;
}
++vertNum;
vertNum++;
}
for (i = 0; i < numFinalEdges; ++i) {
@@ -3339,9 +3341,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
if (vertOrigIndex) {
*vertOrigIndex = mapIndex;
++vertOrigIndex;
vertOrigIndex++;
}
++vertNum;
vertNum++;
}
ccgdm->dm.numVertData = vertNum;

View File

@@ -317,8 +317,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
if (ENDIAN_ORDER == L_ENDIAN) {
int y;
for (y = 0; y < height; y++) {
uint8_t* target = rgb_frame->data[0]
+ width * 4 * (height - y - 1);
uint8_t* target = rgb_frame->data[0] + width * 4 * (height - y - 1);
uint8_t* src = rendered_frame + width * 4 * y;
uint8_t* end = src + width * 4;
while (src != end) {
@@ -335,8 +334,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
else {
int y;
for (y = 0; y < height; y++) {
uint8_t* target = rgb_frame->data[0]
+ width * 4 * (height - y - 1);
uint8_t* target = rgb_frame->data[0] + width * 4 * (height - y - 1);
uint8_t* src = rendered_frame + width * 4 * y;
uint8_t* end = src + width * 4;
while (src != end) {
@@ -488,8 +486,7 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->rc_max_rate = rd->ffcodecdata.rc_max_rate*1000;
c->rc_min_rate = rd->ffcodecdata.rc_min_rate*1000;
c->rc_buffer_size = rd->ffcodecdata.rc_buffer_size * 1024;
c->rc_initial_buffer_occupancy
= rd->ffcodecdata.rc_buffer_size*3/4;
c->rc_initial_buffer_occupancy = rd->ffcodecdata.rc_buffer_size * 3 / 4;
c->rc_buffer_aggressivity = 1.0;
c->me_method = ME_EPZS;
@@ -1110,8 +1107,7 @@ IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, int opt_in
parent = c.av_class->option + parent_index;
if (!rd->ffcodecdata.properties) {
rd->ffcodecdata.properties
= IDP_New(IDP_GROUP, &val, "ffmpeg");
rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg");
}
group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type);

View File

@@ -145,7 +145,7 @@ int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFre
else
gh->buckets[hash] = n;
--gh->nentries;
gh->nentries--;
return 1;
}
p = e;

View File

@@ -485,7 +485,9 @@ void BLI_path_rel(char *file, const char *relfile)
while (*p == *q)
#endif
{
++p; ++q;
p++;
q++;
/* don't search beyond the end of the string
* in the rare case they match */
if ((*p=='\0') || (*q=='\0')) {
@@ -513,7 +515,7 @@ void BLI_path_rel(char *file, const char *relfile)
while (p && p < lslash) {
if (*p == '/')
strcat(res, "../");
++p;
p++;
}
strcat(res, q+1); /* don't copy the slash at the beginning */

View File

@@ -301,20 +301,20 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
std::string target;
if ( !is_param )
target = translate_id(ob_name)
+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
target = translate_id(ob_name) +
"/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
else {
if ( ob->type == OB_LAMP )
target = get_light_id(ob)
+ "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
target = get_light_id(ob) +
"/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
if ( ob->type == OB_CAMERA )
target = get_camera_id(ob)
+ "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
target = get_camera_id(ob) +
"/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
if ( ma )
target = translate_id(id_name(ma)) + "-effect"
+"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
target = translate_id(id_name(ma)) + "-effect" +
"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
}
addChannel(COLLADABU::URI(empty, sampler_id), target);

View File

@@ -422,7 +422,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
while (a--) {
BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)MEM_freeN);
++bezt;
bezt++;
}
}
else {
@@ -431,7 +431,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
while (a--) {
BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)MEM_freeN);
++bp;
bp++;
}
}
}
@@ -752,11 +752,11 @@ static void calc_keyHandles(ListBase *nurb, float *key)
}
}
else {
++nextp;
nextp++;
nextfp += 12;
}
++bezt;
bezt++;
fp += 12;
}
}
@@ -849,7 +849,7 @@ static void calc_shapeKeys(Object *obedit)
ofs[i + 1][0] = bp->alfa - oldbp->alfa;
}
i += 2;
++bp;
bp++;
}
}
@@ -894,7 +894,7 @@ static void calc_shapeKeys(Object *obedit)
}
fp += 3; ++i; /* alphas */
++bezt;
bezt++;
}
}
else {
@@ -913,7 +913,7 @@ static void calc_shapeKeys(Object *obedit)
}
fp += 4;
++bp;
bp++;
i += 2;
}
}
@@ -947,7 +947,7 @@ static void calc_shapeKeys(Object *obedit)
if (apply_offset) {
/* apply alfa offsets */
add_v3_v3(fp, ofs[i]);
++i;
i++;
}
fp += 3; /* alphas */
@@ -962,7 +962,7 @@ static void calc_shapeKeys(Object *obedit)
fp += 3; /* alphas */
}
++bezt;
bezt++;
}
}
else {
@@ -987,7 +987,7 @@ static void calc_shapeKeys(Object *obedit)
}
fp += 4;
++bp;
bp++;
i += 2;
}
}

View File

@@ -1436,7 +1436,7 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
{
RNA_enum_item_add(&item, &totitem, input);
}
++input;
input++;
}
RNA_enum_item_end(&item, &totitem);

View File

@@ -391,8 +391,8 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
kLSSharedFileListNoUserInteraction
| kLSSharedFileListDoNotMountVolumes,
kLSSharedFileListNoUserInteraction |
kLSSharedFileListDoNotMountVolumes,
&cfURL, NULL);
if (err != noErr)
continue;
@@ -440,8 +440,8 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
kLSSharedFileListNoUserInteraction
| kLSSharedFileListDoNotMountVolumes,
kLSSharedFileListNoUserInteraction |
kLSSharedFileListDoNotMountVolumes,
&cfURL, NULL);
if (err != noErr)
continue;

View File

@@ -275,8 +275,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf)
unsigned char *rgb = src + 4 * (ibuf->x * y + x);
for (c = 0; c < 3; c++) {
unsigned char *p = tgt;
p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1)
+ c * sw + x / 3 + 1);
p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) +
c * sw + x / 3 + 1);
scope_put_pixel_single(wtable, p, c);
p += 4 * w;
@@ -327,8 +327,8 @@ static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf)
CLAMP(v, 0.0f, 1.0f);
p += 4 * (w * ((int) (v * (h - 3)) + 1)
+ c * sw + x / 3 + 1);
p += 4 * (w * ((int) (v * (h - 3)) + 1) +
c * sw + x / 3 + 1);
scope_put_pixel_single(wtable, p, c);
p += 4 * w;
@@ -581,8 +581,8 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g,
rgb[2] = (float)b / 255.0f;
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) +
(int) ((yuv[1] * (w - 3) + 1)));
if (r == 0 && g == 0 && b == 0) {
r = 255;
@@ -632,8 +632,8 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
rgb[2] = (float)src1[2] / 255.0f;
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) +
(int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char *)p);
}
}
@@ -682,8 +682,8 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) +
(int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char *)p);
}
}

View File

@@ -1156,7 +1156,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
}
else {
new_line[j] = text_check_line[a];
++j;
j++;
}
}
new_line[j] = '\0';
@@ -1208,12 +1208,12 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
if (!number) { //found all number of space to equal a tab
new_line[extra] = '\t';
a = a + (st->tabnumber - 1);
++extra;
extra++;
}
else { //not adding a tab
new_line[extra] = text_check_line[a];
++extra;
extra++;
}
}
new_line[extra] = '\0';

View File

@@ -5500,7 +5500,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
}
++index;
index++;
nu = nu->next;
}
}
@@ -5529,7 +5529,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
tekenhandlesN_active(nu);
tekenhandlesN(nu, 0, hide_handles);
}
++index;
index++;
}
draw_editnurb(ob, nurb, 0);
draw_editnurb(ob, nurb, 1);

View File

@@ -431,9 +431,10 @@ static int object_mode_icon(int mode)
EnumPropertyItem *item = object_mode_items;
while (item->name != NULL) {
if (item->value == mode)
if (item->value == mode) {
return item->icon;
++item;
}
item++;
}
return ICON_OBJECT_DATAMODE;

View File

@@ -567,9 +567,9 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
if (flip_sign)
negate_v3(planes[val]);
planes[val][3] = -planes[val][0] * bb->vec[val][0]
- planes[val][1] * bb->vec[val][1]
- planes[val][2] * bb->vec[val][2];
planes[val][3] = -planes[val][0] * bb->vec[val][0] -
planes[val][1] * bb->vec[val][1] -
planes[val][2] * bb->vec[val][2];
}
}

View File

@@ -229,8 +229,9 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
double *angle = mi->data;
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2.0 * ((A*B)?(A*B):1.0));
double deler = (((dx1 * dx1 + dy1 * dy1) +
(dx2 * dx2 + dy2 * dy2) -
(dx3 * dx3 + dy3 * dy3)) / (2.0 * ((A * B) ? (A * B) : 1.0)));
/* ((A*B)?(A*B):1.0) this takes care of potential divide by zero errors */
float dphi;
@@ -290,16 +291,13 @@ void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], int mva
static void calcSpringFactor(MouseInput *mi)
{
mi->factor = (float)sqrt(
(
((float)(mi->center[1] - mi->imval[1]))*((float)(mi->center[1] - mi->imval[1]))
+
((float)(mi->center[0] - mi->imval[0]))*((float)(mi->center[0] - mi->imval[0]))
) );
mi->factor = sqrtf(((float)(mi->center[1] - mi->imval[1])) * ((float)(mi->center[1] - mi->imval[1])) +
((float)(mi->center[0] - mi->imval[0])) * ((float)(mi->center[0] - mi->imval[0])));
if (mi->factor==0.0f)
if (mi->factor == 0.0f) {
mi->factor= 1.0f; /* prevent Inf */
}
}
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
{

View File

@@ -1373,7 +1373,7 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
for (j = 0; j < (f->v4 ? 2 : 1); ++j) {
for (k = 0; k < 3; ++k) {
*tri_data = face_vert_indices[i][v[k]];
++tri_data;
tri_data++;
}
v[0] = 3;
v[1] = 0;

View File

@@ -471,8 +471,7 @@ static int startffmpeg(struct anim * anim)
videoStream = -1;
for (i = 0; i < pFormatCtx->nb_streams; i++)
if (pFormatCtx->streams[i]->codec->codec_type
== AVMEDIA_TYPE_VIDEO) {
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
streamcount--;
continue;
@@ -502,9 +501,9 @@ static int startffmpeg(struct anim * anim)
return -1;
}
anim->duration = ceil(pFormatCtx->duration
* av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate)
/ AV_TIME_BASE);
anim->duration = ceil(pFormatCtx->duration *
av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate) /
AV_TIME_BASE);
frs_num = pFormatCtx->streams[videoStream]->r_frame_rate.num;
frs_den = pFormatCtx->streams[videoStream]->r_frame_rate.den;
@@ -658,8 +657,8 @@ static void ffmpeg_postprocess(struct anim * anim)
anim->pFrame,
anim->pCodecCtx->pix_fmt,
anim->pCodecCtx->width,
anim->pCodecCtx->height)
< 0) {
anim->pCodecCtx->height) < 0)
{
filter_y = TRUE;
}
else {
@@ -785,8 +784,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
"pkt_pts=%lld, guessed_pts=%lld\n",
(anim->pFrame->pts == AV_NOPTS_VALUE) ?
-1 : (long long int)anim->pFrame->pts,
(anim->pFrame->pkt_pts
== AV_NOPTS_VALUE) ?
(anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ?
-1 : (long long int)anim->pFrame->pkt_pts,
(long long int)anim->next_pts);
break;
@@ -921,12 +919,11 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
}
else {
pts_to_search = (long long)
floor(((double) position)
/ pts_time_base / frame_rate + 0.5);
floor(((double) position) /
pts_time_base / frame_rate + 0.5);
if (st_time != AV_NOPTS_VALUE) {
pts_to_search += st_time / pts_time_base
/ AV_TIME_BASE;
pts_to_search += st_time / pts_time_base / AV_TIME_BASE;
}
}
@@ -1001,8 +998,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
}
}
else {
pos = (long long) (position - anim->preseek)
* AV_TIME_BASE / frame_rate;
pos = (long long) (position - anim->preseek) *
AV_TIME_BASE / frame_rate;
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"NO INDEX seek pos = %lld, st_time = %lld\n",

View File

@@ -68,8 +68,7 @@ static int tc_types[] = { IMB_TC_RECORD_RUN,
anim_index_builder * IMB_index_builder_create(const char * name)
{
anim_index_builder * rv
= MEM_callocN(sizeof(struct anim_index_builder),
anim_index_builder * rv = MEM_callocN(sizeof(struct anim_index_builder),
"index builder");
fprintf(stderr, "Starting work on index: %s\n", name);
@@ -182,17 +181,17 @@ struct anim_index * IMB_indexer_open(const char * name)
fseek(fp, 0, SEEK_END);
idx->num_entries = (ftell(fp) - 12)
/ (sizeof(int) // framepos
+ sizeof(unsigned long long) // seek_pos
+ sizeof(unsigned long long) // seek_pos_dts
+ sizeof(unsigned long long) // pts
idx->num_entries = (ftell(fp) - 12) /
(sizeof(int) + // framepos
sizeof(unsigned long long) + // seek_pos
sizeof(unsigned long long) + // seek_pos_dts
sizeof(unsigned long long) // pts
);
fseek(fp, 12, SEEK_SET);
idx->entries = MEM_callocN(sizeof(struct anim_index_entry)
* idx->num_entries, "anim_index_entries");
idx->entries = MEM_callocN(sizeof(struct anim_index_entry) *
idx->num_entries, "anim_index_entries");
for (i = 0; i < idx->num_entries; i++) {
fread(&idx->entries[i].frameno,
@@ -260,7 +259,7 @@ int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno)
if (idx->entries[middle].frameno < frameno) {
first = middle;
++first;
first++;
len = len - half - 1;
}
else {
@@ -301,8 +300,7 @@ int IMB_indexer_can_scan(struct anim_index * idx,
{
/* makes only sense, if it is the same I-Frame and we are not
* trying to run backwards in time... */
return (IMB_indexer_get_seek_pos(idx, old_frame_index)
== IMB_indexer_get_seek_pos(idx, new_frame_index) &&
return (IMB_indexer_get_seek_pos(idx, old_frame_index) == IMB_indexer_get_seek_pos(idx, new_frame_index) &&
old_frame_index < new_frame_index);
}
@@ -515,9 +513,9 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
rv->c->pix_fmt = PIX_FMT_YUVJ420P;
}
rv->c->sample_aspect_ratio
= rv->st->sample_aspect_ratio
= st->codec->sample_aspect_ratio;
rv->c->sample_aspect_ratio =
rv->st->sample_aspect_ratio =
st->codec->sample_aspect_ratio;
rv->c->time_base.den = 25;
rv->c->time_base.num = 1;
@@ -755,8 +753,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim
/* Find the video stream */
context->videoStream = -1;
for (i = 0; i < context->iFormatCtx->nb_streams; i++)
if (context->iFormatCtx->streams[i]->codec->codec_type
== AVMEDIA_TYPE_VIDEO) {
if (context->iFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (streamcount > 0) {
streamcount--;
continue;
@@ -895,8 +892,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
if (frame_finished) {
unsigned long long s_pos = seek_pos;
unsigned long long s_dts = seek_pos_dts;
unsigned long long pts
= av_get_pts_from_frame(context->iFormatCtx, in_frame);
unsigned long long pts = av_get_pts_from_frame(context->iFormatCtx, in_frame);
for (i = 0; i < context->num_proxy_sizes; i++) {
add_to_proxy_output_ffmpeg(
@@ -908,8 +904,8 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
start_pts_set = TRUE;
}
frameno = floor((pts - start_pts)
* pts_time_base * frame_rate + 0.5f);
frameno = floor((pts - start_pts) *
pts_time_base * frame_rate + 0.5f);
/* decoding starts *always* on I-Frames,
so: P-Frames won't work, even if all the

View File

@@ -367,10 +367,8 @@ static void enlarge_picture_byte(
unsigned char* src, unsigned char* dst, int src_width,
int src_height, int dst_width, int dst_height)
{
double ratiox = (double) (dst_width - 1.0)
/ (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0)
/ (double) (src_height - 1.001);
double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
uintptr_t x_src, dx_src, x_dst;
uintptr_t y_src, dy_src, y_dst;
@@ -395,41 +393,25 @@ static void enlarge_picture_byte(
unsigned long x = (x_src >> 16) * 4;
*dst++ = ((((line1[x] * weight1y) >> 16)
* weight1x) >> 16)
+ ((((line2[x] * weight2y) >> 16)
* weight1x) >> 16)
+ ((((line1[4 + x] * weight1y) >> 16)
* weight2x) >> 16)
+ ((((line2[4 + x] * weight2y) >> 16)
* weight2x) >> 16);
*dst++ = ((((line1[x] * weight1y) >> 16) * weight1x) >> 16) +
((((line2[x] * weight2y) >> 16) * weight1x) >> 16) +
((((line1[4 + x] * weight1y) >> 16) * weight2x) >> 16) +
((((line2[4 + x] * weight2y) >> 16) * weight2x) >> 16);
*dst++ = ((((line1[x + 1] * weight1y) >> 16)
* weight1x) >> 16)
+ ((((line2[x + 1] * weight2y) >> 16)
* weight1x) >> 16)
+ ((((line1[4 + x + 1] * weight1y) >> 16)
* weight2x) >> 16)
+ ((((line2[4 + x + 1] * weight2y) >> 16)
* weight2x) >> 16);
*dst++ = ((((line1[x + 1] * weight1y) >> 16) * weight1x) >> 16) +
((((line2[x + 1] * weight2y) >> 16) * weight1x) >> 16) +
((((line1[4 + x + 1] * weight1y) >> 16) * weight2x) >> 16) +
((((line2[4 + x + 1] * weight2y) >> 16) * weight2x) >> 16);
*dst++ = ((((line1[x + 2] * weight1y) >> 16)
* weight1x) >> 16)
+ ((((line2[x + 2] * weight2y) >> 16)
* weight1x) >> 16)
+ ((((line1[4 + x + 2] * weight1y) >> 16)
* weight2x) >> 16)
+ ((((line2[4 + x + 2] * weight2y) >> 16)
* weight2x) >> 16);
*dst++ = ((((line1[x + 2] * weight1y) >> 16) * weight1x) >> 16) +
((((line2[x + 2] * weight2y) >> 16) * weight1x) >> 16) +
((((line1[4 + x + 2] * weight1y) >> 16) * weight2x) >> 16) +
((((line2[4 + x + 2] * weight2y) >> 16) * weight2x) >> 16);
*dst++ = ((((line1[x + 3] * weight1y) >> 16)
* weight1x) >> 16)
+ ((((line2[x + 3] * weight2y) >> 16)
* weight1x) >> 16)
+ ((((line1[4 + x + 3] * weight1y) >> 16)
* weight2x) >> 16)
+ ((((line2[4 + x + 3] * weight2y) >> 16)
* weight2x) >> 16);
*dst++ = ((((line1[x + 3] * weight1y) >> 16) * weight1x) >> 16) +
((((line2[x + 3] * weight2y) >> 16) * weight1x) >> 16) +
((((line1[4 + x + 3] * weight1y) >> 16) * weight2x) >> 16) +
((((line2[4 + x + 3] * weight2y) >> 16) * weight2x) >> 16);
x_src += dx_src;
}
@@ -578,10 +560,8 @@ static void enlarge_picture_float(
float* src, float* dst, int src_width,
int src_height, int dst_width, int dst_height)
{
double ratiox = (double) (dst_width - 1.0)
/ (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0)
/ (double) (src_height - 1.001);
double ratiox = (double) (dst_width - 1.0) / (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0) / (double) (src_height - 1.001);
uintptr_t x_dst;
uintptr_t y_dst;
double x_src, dx_src;
@@ -613,25 +593,25 @@ static void enlarge_picture_float(
uintptr_t x = ((int) x_src) * 4;
*dst++ = line1[x] * w11
+ line2[x] * w21
+ line1[4 + x] * w12
+ line2[4 + x] * w22;
*dst++ = line1[x] * w11 +
line2[x] * w21 +
line1[4 + x] * w12 +
line2[4 + x] * w22;
*dst++ = line1[x + 1] * w11
+ line2[x + 1] * w21
+ line1[4 + x + 1] * w12
+ line2[4 + x + 1] * w22;
*dst++ = line1[x + 1] * w11 +
line2[x + 1] * w21 +
line1[4 + x + 1] * w12 +
line2[4 + x + 1] * w22;
*dst++ = line1[x + 2] * w11
+ line2[x + 2] * w21
+ line1[4 + x + 2] * w12
+ line2[4 + x + 2] * w22;
*dst++ = line1[x + 2] * w11 +
line2[x + 2] * w21 +
line1[4 + x + 2] * w12 +
line2[4 + x + 2] * w22;
*dst++ = line1[x + 3] * w11
+ line2[x + 3] * w21
+ line1[4 + x + 3] * w12
+ line2[4 + x + 3] * w22;
*dst++ = line1[x + 3] * w11 +
line2[x + 3] * w21 +
line1[4 + x + 3] * w12 +
line2[4 + x + 3] * w22;
x_src += dx_src;
}

View File

@@ -916,8 +916,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
switch (ob->body_type) {
case OB_BODY_TYPE_SENSOR:
ob->gameflag |= OB_SENSOR | OB_COLLISION | OB_GHOST;
ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION
|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH);
ob->gameflag &= ~(OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
break;
case OB_BODY_TYPE_OCCLUDER:
ob->gameflag |= OB_OCCLUDER;

View File

@@ -246,8 +246,7 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy");
seq->strip->proxy->quality = 90;
seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL;
seq->strip->proxy->build_size_flags
= SEQ_PROXY_IMAGE_SIZE_25;
seq->strip->proxy->build_size_flags = SEQ_PROXY_IMAGE_SIZE_25;
}
}
else {

View File

@@ -153,7 +153,7 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis)
/* find the minimum and maximum coordinates on the desired axis */
min_co = max_co = mvert->co[axis];
++mvert;
mvert++;
for (i = 1; i < numVerts; ++i, ++mvert) {
if (mvert->co[axis] < min_co) min_co = mvert->co[axis];
if (mvert->co[axis] > max_co) max_co = mvert->co[axis];

View File

@@ -206,9 +206,9 @@ ModifierTypeInfo modifierType_Cloth = {
/* structName */ "ClothModifierData",
/* structSize */ sizeof(ClothModifierData),
/* type */ eModifierTypeType_OnlyDeform,
/* flags */ eModifierTypeFlag_AcceptsMesh
| eModifierTypeFlag_UsesPointCache
| eModifierTypeFlag_Single,
/* flags */ eModifierTypeFlag_AcceptsMesh |
eModifierTypeFlag_UsesPointCache |
eModifierTypeFlag_Single,
/* copyData */ copyData,
/* deformVerts */ deformVerts,

View File

@@ -144,8 +144,8 @@ ModifierTypeInfo modifierType_Curve = {
/* structName */ "CurveModifierData",
/* structSize */ sizeof(CurveModifierData),
/* type */ eModifierTypeType_OnlyDeform,
/* flags */ eModifierTypeFlag_AcceptsCVs
| eModifierTypeFlag_SupportsEditmode,
/* flags */ eModifierTypeFlag_AcceptsCVs |
eModifierTypeFlag_SupportsEditmode,
/* copyData */ copyData,
/* deformVerts */ deformVerts,

View File

@@ -141,8 +141,8 @@ ModifierTypeInfo modifierType_Lattice = {
/* structName */ "LatticeModifierData",
/* structSize */ sizeof(LatticeModifierData),
/* type */ eModifierTypeType_OnlyDeform,
/* flags */ eModifierTypeFlag_AcceptsCVs
| eModifierTypeFlag_SupportsEditmode,
/* flags */ eModifierTypeFlag_AcceptsCVs |
eModifierTypeFlag_SupportsEditmode,
/* copyData */ copyData,
/* deformVerts */ deformVerts,
/* deformMatrices */ NULL,

View File

@@ -127,10 +127,8 @@ void makeGammaTables(float gamma)
/* To speed up calculations, we make these calc factor tables. They are */
/* multiplication factors used in scaling the interpolation. */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++ ) {
gamfactor_table[i] = inv_color_step
* (gamma_range_table[i + 1] - gamma_range_table[i]);
inv_gamfactor_table[i] = inv_color_step
* (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
gamfactor_table[i] = inv_color_step * (gamma_range_table[i + 1] - gamma_range_table[i]);
inv_gamfactor_table[i] = inv_color_step * (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
}
} /* end of void makeGammaTables(float gamma) */