Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).

Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)'
and 'strcmp(foo, bar) == 0' in several places...
This commit is contained in:
Bastien Montagne 2015-01-26 16:03:11 +01:00
parent d44890ee75
commit fca515838e
133 changed files with 467 additions and 471 deletions

@ -137,7 +137,7 @@ static int blf_search(const char *name)
for (i = 0; i < BLF_MAX_FONT; i++) {
font = global_font[i];
if (font && (!strcmp(font->name, name)))
if (font && (STREQ(font->name, name)))
return i;
}
@ -324,7 +324,7 @@ void BLF_unload(const char *name)
for (i = 0; i < BLF_MAX_FONT; i++) {
font = global_font[i];
if (font && (!strcmp(font->name, name))) {
if (font && (STREQ(font->name, name))) {
blf_font_free(font);
global_font[i] = NULL;
}

@ -133,7 +133,7 @@ void BLF_free_unifont_mono(void)
bool BLF_is_default_context(const char *msgctxt)
{
/* We use the "short" test, a more complete one could be:
* return (!msgctxt || !msgctxt[0] || !strcmp(msgctxt == BLF_I18NCONTEXT_DEFAULT_BPYRNA))
* return (!msgctxt || !msgctxt[0] || STREQ(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPYRNA))
*/
/* Note: trying without the void string check for now, it *should* not be necessary... */
return (!msgctxt || msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPYRNA[0]);

@ -791,7 +791,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char
if (fcu->rna_path != old_path) {
bActionGroup *agrp = fcu->grp;
if ((agrp) && strcmp(oldName, agrp->name) == 0) {
if ((agrp) && STREQ(oldName, agrp->name)) {
BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
}
}
@ -828,7 +828,7 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
/* also fix the bone-name (if applicable) */
if (strstr(prefix, "bones")) {
if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object *)(dtar->id))->data == ref_id)) &&
(dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name) == 0) )
(dtar->pchan_name[0]) && STREQ(oldName, dtar->pchan_name) )
{
BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
}
@ -1281,7 +1281,7 @@ KS_Path *BKE_keyingset_find_path(KeyingSet *ks, ID *id, const char group_name[],
eq_id = 0;
/* path */
if ((ksp->rna_path == NULL) || strcmp(rna_path, ksp->rna_path))
if ((ksp->rna_path == NULL) || !STREQ(rna_path, ksp->rna_path))
eq_path = 0;
/* index - need to compare whole-array setting too... */

@ -641,7 +641,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
}
}
#if defined(DEBUG)
if (strcmp(name, fullname)) {
if (!STREQ(name, fullname)) {
printf("guessing '%s' == '%s'\n", name, fullname);
}
#endif

@ -233,7 +233,7 @@ static Bone *get_named_bone_bonechildren(Bone *bone, const char *name)
{
Bone *curBone, *rbone;
if (!strcmp(bone->name, name))
if (STREQ(bone->name, name))
return bone;
for (curBone = bone->childbase.first; curBone; curBone = curBone->next) {
@ -2417,7 +2417,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
/* validate first */
if (amod->ob && amod->ob->type == OB_CURVE && amod->channel[0]) {
if (strcmp(pchan->name, amod->channel) == 0) {
if (STREQ(pchan->name, amod->channel)) {
float mat4[4][4], mat3[3][3];
curve_deform_vector(scene, amod->ob, armob, bone->arm_mat[3], pchan->pose_mat[3], mat3, amod->no_rot_axis);
@ -2430,7 +2430,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
break;
case ACTSTRIP_MOD_NOISE:
{
if (strcmp(pchan->name, amod->channel) == 0) {
if (STREQ(pchan->name, amod->channel)) {
float nor[3], loc[3], ofs;
float eul[3], size[3], eulo[3], sizeo[3];

@ -454,7 +454,7 @@ static void data_dir_add(ListBase *lb, const char *member, const bool use_all)
{
LinkData *link;
if ((use_all == false) && strcmp(member, "scene") == 0) /* exception */
if ((use_all == false) && STREQ(member, "scene")) /* exception */
return;
if (BLI_findstring(lb, member, offsetof(LinkData, data)))
@ -546,7 +546,7 @@ ListBase CTX_data_dir_get(const bContext *C)
bool CTX_data_equals(const char *member, const char *str)
{
return (strcmp(member, str) == 0);
return (STREQ(member, str));
}
bool CTX_data_dir(const char *member)

@ -1553,7 +1553,7 @@ int CustomData_get_named_layer_index(const CustomData *data, int type, const cha
for (i = 0; i < data->totlayer; ++i)
if (data->layers[i].type == type)
if (strcmp(data->layers[i].name, name) == 0)
if (STREQ(data->layers[i].name, name))
return i;
return -1;
@ -2690,7 +2690,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
/* if we found a matching layer, copy the data */
if (dest->layers[dest_i].type == source->layers[src_i].type &&
strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0)
STREQ(dest->layers[dest_i].name, source->layers[src_i].name))
{
const char *src_data = (char *)src_block + source->layers[src_i].offset;
char *dest_data = (char *)*dest_block + dest->layers[dest_i].offset;
@ -3163,12 +3163,12 @@ static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int
CustomDataLayer *layer = &data->layers[i];
if (CustomData_is_property_layer(type)) {
if (CustomData_is_property_layer(layer->type) && strcmp(layer->name, name) == 0) {
if (CustomData_is_property_layer(layer->type) && STREQ(layer->name, name)) {
return true;
}
}
else {
if (i != index && layer->type == type && strcmp(layer->name, name) == 0) {
if (i != index && layer->type == type && STREQ(layer->name, name)) {
return true;
}
}

@ -417,7 +417,7 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name)
for (a = 0; a < cdf->totlayer; a++) {
layer = &cdf->layer[a];
if (layer->type == type && strcmp(layer->name, name) == 0)
if (layer->type == type && STREQ(layer->name, name))
return layer;
}

@ -542,7 +542,7 @@ static bool defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *
for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
if (dg != curdef) {
if (!strcmp(curdef->name, name)) {
if (STREQ(curdef->name, name)) {
return true;
}
}

@ -368,7 +368,7 @@ static bool surface_duplicateNameExists(void *arg, const char *name)
DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
for (; surface; surface = surface->next) {
if (surface != t_surface && !strcmp(name, surface->name)) return true;
if (surface != t_surface && STREQ(name, surface->name)) return true;
}
return false;
}

@ -230,7 +230,7 @@ FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_
/* check paths of curves, then array indices... */
for (fcu = list->first; fcu; fcu = fcu->next) {
/* simple string-compare (this assumes that they have the same root...) */
if (fcu->rna_path && !strcmp(fcu->rna_path, rna_path)) {
if (fcu->rna_path && STREQ(fcu->rna_path, rna_path)) {
/* now check indices */
if (fcu->array_index == array_index)
return fcu;
@ -253,7 +253,7 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
/* check paths of curves, then array indices... */
for (fcu = fcu_iter; fcu; fcu = fcu->next) {
/* simple string-compare (this assumes that they have the same root...) */
if (fcu->rna_path && !strcmp(fcu->rna_path, rna_path)) {
if (fcu->rna_path && STREQ(fcu->rna_path, rna_path)) {
return fcu;
}
}
@ -290,7 +290,7 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
if (quotedName) {
/* check if the quoted name matches the required name */
if (strcmp(quotedName, dataName) == 0) {
if (STREQ(quotedName, dataName)) {
LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
ld->data = fcu;

@ -245,7 +245,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
}
/* Do not add FO_BUILTIN_NAME to temporary listbase */
if (strcmp(filename, FO_BUILTIN_NAME)) {
if (!STREQ(filename, FO_BUILTIN_NAME)) {
vfont->temp_pf = temp_pf;
}
}

@ -804,7 +804,7 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is
case IDP_STRING:
{
return (((prop1->len == prop2->len) &&
strncmp(IDP_String(prop1), IDP_String(prop2), (size_t)prop1->len) == 0));
STREQLEN(IDP_String(prop1), IDP_String(prop2), (size_t)prop1->len)));
}
case IDP_ARRAY:
if (prop1->len == prop2->len && prop1->subtype == prop2->subtype) {

@ -1223,37 +1223,37 @@ char BKE_imtype_valid_depths(const char imtype)
* creator.c help info */
char BKE_imtype_from_arg(const char *imtype_arg)
{
if (!strcmp(imtype_arg, "TGA")) return R_IMF_IMTYPE_TARGA;
else if (!strcmp(imtype_arg, "IRIS")) return R_IMF_IMTYPE_IRIS;
if (STREQ(imtype_arg, "TGA")) return R_IMF_IMTYPE_TARGA;
else if (STREQ(imtype_arg, "IRIS")) return R_IMF_IMTYPE_IRIS;
#ifdef WITH_DDS
else if (!strcmp(imtype_arg, "DDS")) return R_IMF_IMTYPE_DDS;
else if (STREQ(imtype_arg, "DDS")) return R_IMF_IMTYPE_DDS;
#endif
else if (!strcmp(imtype_arg, "JPEG")) return R_IMF_IMTYPE_JPEG90;
else if (!strcmp(imtype_arg, "IRIZ")) return R_IMF_IMTYPE_IRIZ;
else if (!strcmp(imtype_arg, "RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
else if (!strcmp(imtype_arg, "AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
else if (!strcmp(imtype_arg, "AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
else if (!strcmp(imtype_arg, "PNG")) return R_IMF_IMTYPE_PNG;
else if (!strcmp(imtype_arg, "QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
else if (!strcmp(imtype_arg, "BMP")) return R_IMF_IMTYPE_BMP;
else if (STREQ(imtype_arg, "JPEG")) return R_IMF_IMTYPE_JPEG90;
else if (STREQ(imtype_arg, "IRIZ")) return R_IMF_IMTYPE_IRIZ;
else if (STREQ(imtype_arg, "RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
else if (STREQ(imtype_arg, "AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
else if (STREQ(imtype_arg, "AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
else if (STREQ(imtype_arg, "PNG")) return R_IMF_IMTYPE_PNG;
else if (STREQ(imtype_arg, "QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
else if (STREQ(imtype_arg, "BMP")) return R_IMF_IMTYPE_BMP;
#ifdef WITH_HDR
else if (!strcmp(imtype_arg, "HDR")) return R_IMF_IMTYPE_RADHDR;
else if (STREQ(imtype_arg, "HDR")) return R_IMF_IMTYPE_RADHDR;
#endif
#ifdef WITH_TIFF
else if (!strcmp(imtype_arg, "TIFF")) return R_IMF_IMTYPE_TIFF;
else if (STREQ(imtype_arg, "TIFF")) return R_IMF_IMTYPE_TIFF;
#endif
#ifdef WITH_OPENEXR
else if (!strcmp(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR;
else if (!strcmp(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
else if (STREQ(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR;
else if (STREQ(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
#endif
else if (!strcmp(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG;
else if (!strcmp(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
else if (STREQ(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG;
else if (STREQ(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
#ifdef WITH_CINEON
else if (!strcmp(imtype_arg, "CINEON")) return R_IMF_IMTYPE_CINEON;
else if (!strcmp(imtype_arg, "DPX")) return R_IMF_IMTYPE_DPX;
else if (STREQ(imtype_arg, "CINEON")) return R_IMF_IMTYPE_CINEON;
else if (STREQ(imtype_arg, "DPX")) return R_IMF_IMTYPE_DPX;
#endif
#ifdef WITH_OPENJPEG
else if (!strcmp(imtype_arg, "JP2")) return R_IMF_IMTYPE_JP2;
else if (STREQ(imtype_arg, "JP2")) return R_IMF_IMTYPE_JP2;
#endif
else return R_IMF_IMTYPE_INVALID;
}

@ -922,11 +922,11 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con
BLI_snprintf(buf, sizeof(buf), "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
}
else if (actname && actname[0]) {
if ((blocktype == ID_OB) && strcmp(actname, "Object") == 0) {
if ((blocktype == ID_OB) && STREQ(actname, "Object")) {
/* Actionified "Object" IPO's... no extra path stuff needed */
buf[0] = '\0'; /* empty string */
}
else if ((blocktype == ID_KE) && strcmp(actname, "Shape") == 0) {
else if ((blocktype == ID_KE) && STREQ(actname, "Shape")) {
/* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
strcpy(buf, "data.shape_keys");
}
@ -1326,7 +1326,7 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
* - we now need as 'frames'
*/
if ( (id) && (icu->blocktype == GS(id->name)) &&
(fcu->rna_path && strcmp(fcu->rna_path, "eval_time") == 0) )
(fcu->rna_path && STREQ(fcu->rna_path, "eval_time")) )
{
Curve *cu = (Curve *)id;
@ -1403,9 +1403,9 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S
* F-Curves for bones). This may be added later... for now let's just dump without them...
*/
if (actname) {
if ((ipo->blocktype == ID_OB) && (strcmp(actname, "Object") == 0))
if ((ipo->blocktype == ID_OB) && STREQ(actname, "Object"))
actname = NULL;
else if ((ipo->blocktype == ID_OB) && (strcmp(actname, "Shape") == 0))
else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape"))
actname = NULL;
}

@ -1202,7 +1202,7 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
/* do not test alphabetic! */
/* optimized */
if (idtest->name[2] == name[0]) {
if (strcmp(name, idtest->name + 2) == 0) break;
if (STREQ(name, idtest->name + 2)) break;
}
}
}
@ -1260,7 +1260,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
if ( (id != idtest) &&
(idtest->lib == NULL) &&
(*name == *(idtest->name + 2)) &&
(strncmp(name, idtest->name + 2, left_len) == 0) &&
STREQLEN(name, idtest->name + 2, left_len) &&
(BLI_split_name_num(leftest, &nrtest, idtest->name + 2, '.') == left_len)
)
{

@ -1027,7 +1027,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
Group *group;
for (group = G.main->group.first; group; group = group->id.next) {
if (!group->id.lib && strcmp(group->id.name, ma->group->id.name) == 0) {
if (!group->id.lib && STREQ(group->id.name, ma->group->id.name)) {
ma->group = group;
}
}

@ -468,7 +468,7 @@ bool BKE_mball_is_basis_for(Object *ob1, Object *ob2)
BLI_split_name_num(basis1name, &basis1nr, ob1->id.name + 2, '.');
BLI_split_name_num(basis2name, &basis2nr, ob2->id.name + 2, '.');
if (!strcmp(basis1name, basis2name)) {
if (STREQ(basis1name, basis2name)) {
return BKE_mball_is_basis(ob1);
}
else {
@ -503,7 +503,7 @@ void BKE_mball_properties_copy(Scene *scene, Object *active_object)
/* Object ob has to be in same "group" ... it means, that it has to have
* same base of its name */
if (strcmp(obname, basisname) == 0) {
if (STREQ(obname, basisname)) {
MetaBall *mb = ob->data;
/* Copy properties from selected/edited metaball */
@ -545,7 +545,7 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.');
/* object ob has to be in same "group" ... it means, that it has to have same base of its name */
if (strcmp(obname, basisname) == 0) {
if (STREQ(obname, basisname)) {
if (obnr < basisnr) {
basis = ob;
basisnr = obnr;
@ -1679,7 +1679,7 @@ static float init_meta(EvaluationContext *eval_ctx, PROCESS *process, Scene *sce
int nr;
BLI_split_name_num(name, &nr, bob->id.name + 2, '.');
if (strcmp(obname, name) == 0) {
if (STREQ(obname, name)) {
mb = bob->data;
if (mb->editelems) ml = mb->editelems->first;
@ -2243,7 +2243,7 @@ static void mball_count(EvaluationContext *eval_ctx, PROCESS *process, Scene *sc
/* object ob has to be in same "group" ... it means, that it has to have
* same base of its name */
if (strcmp(obname, basisname) == 0) {
if (STREQ(obname, basisname)) {
MetaBall *mb = ob->data;
/* if object is in edit mode, then dynamic list of all MetaElems

@ -703,7 +703,7 @@ bool BKE_mesh_uv_cdlayer_rename_index(Mesh *me, const int poly_index, const int
}
/* Loop until we do have exactly the same name for all layers! */
for (i = 1; (strcmp(cdlp->name, cdlu->name) != 0 || (cdlf && strcmp(cdlp->name, cdlf->name) != 0)); i++) {
for (i = 1; !STREQ(cdlp->name, cdlu->name) || (cdlf && !STREQ(cdlp->name, cdlf->name)); i++) {
switch (i % step) {
case 0:
BLI_strncpy(cdlp->name, cdlu->name, sizeof(cdlp->name));

@ -621,7 +621,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
BLI_strncpy(strtest, clip->name, sizeof(clip->name));
BLI_path_abs(strtest, G.main->name);
if (strcmp(strtest, str) == 0) {
if (STREQ(strtest, str)) {
BLI_strncpy(clip->name, name, sizeof(clip->name)); /* for stringcode */
clip->id.us++; /* officially should not, it doesn't link here! */

@ -2250,7 +2250,7 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create)
ntree_interface_identifier_base(ntree, base);
/* RNA identifier may have a number suffix, but should start with the idbase string */
if (strncmp(RNA_struct_identifier(srna), base, sizeof(base)) != 0) {
if (!STREQLEN(RNA_struct_identifier(srna), base, sizeof(base))) {
/* generate new unique RNA identifier from the ID name */
ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description);

@ -772,7 +772,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
/* version header */
ptcache_file_read(pf, version, 4, sizeof(char));
if (strncmp(version, SMOKE_CACHE_VERSION, 4))
if (!STREQLEN(version, SMOKE_CACHE_VERSION, 4))
{
/* reset file pointer */
fseek(pf->fp, -4, SEEK_CUR);
@ -954,7 +954,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
/* version header */
ptcache_file_read(pf, version, 1, sizeof(char) * 4);
if (strncmp(version, DPAINT_CACHE_VERSION, 4)) {
if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) {
printf("Dynamic Paint: Invalid cache version: '%c%c%c%c'!\n", UNPACK4(version));
return 0;
}
@ -1716,7 +1716,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
if (fread(bphysics, sizeof(char), 8, pf->fp) != 8)
error = 1;
if (!error && strncmp(bphysics, "BPHYSICS", 8))
if (!error && !STREQLEN(bphysics, "BPHYSICS", 8))
error = 1;
if (!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp))
@ -2588,7 +2588,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
if (mode == PTCACHE_CLEAR_ALL) {
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
@ -2794,7 +2794,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
/* read the number of the file */
unsigned int frame, len2 = (int)strlen(de->d_name);
char num[7];
@ -2975,7 +2975,7 @@ void BKE_ptcache_remove(void)
return;
while ((de = readdir(dir)) != NULL) {
if ( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
if (STREQ(de->d_name, ".") || STREQ(de->d_name, "..")) {
/* do nothing */
}
else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
@ -3532,7 +3532,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (strncmp(old_filename, de->d_name, len ) == 0) { /* do we have the right prefix */
if (STREQLEN(old_filename, de->d_name, len)) { /* do we have the right prefix */
/* read the number of the file */
int frame, len2 = (int)strlen(de->d_name);
char num[7];
@ -3587,7 +3587,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
/* read the number of the file */
int frame, len2 = (int)strlen(de->d_name);
char num[7];

@ -136,7 +136,7 @@ static bProperty *bproperty_get(bProperty *first, bProperty *self, const char *n
{
bProperty *p;
for (p = first; p; p = p->next) {
if (p != self && (strcmp(p->name, name) == 0))
if (p != self && STREQ(p->name, name))
return p;
}
return NULL;

@ -2003,7 +2003,7 @@ void BKE_scene_disable_color_management(Scene *scene)
bool BKE_scene_check_color_management_enabled(const Scene *scene)
{
return strcmp(scene->display_settings.display_device, "None") != 0;
return !STREQ(scene->display_settings.display_device, "None");
}
bool BKE_scene_check_rigidbody_active(const Scene *scene)

@ -2740,7 +2740,7 @@ void txt_unindent(Text *text)
while (true) {
bool changed = false;
if (strncmp(text->curl->line, remove, indentlen) == 0) {
if (STREQLEN(text->curl->line, remove, indentlen)) {
if (num == 0)
unindented_first = true;
text->curl->len -= indentlen;

@ -721,7 +721,7 @@ MovieTrackingTrack *BKE_tracking_track_get_named(MovieTracking *tracking, MovieT
MovieTrackingTrack *track = tracksbase->first;
while (track) {
if (!strcmp(track->name, name))
if (STREQ(track->name, name))
return track;
track = track->next;
@ -1267,7 +1267,7 @@ MovieTrackingPlaneTrack *BKE_tracking_plane_track_get_named(MovieTracking *track
plane_track;
plane_track = plane_track->next)
{
if (!strcmp(plane_track->name, name)) {
if (STREQ(plane_track->name, name)) {
return plane_track;
}
}
@ -1563,7 +1563,7 @@ MovieTrackingObject *BKE_tracking_object_get_named(MovieTracking *tracking, cons
MovieTrackingObject *object = tracking->objects.first;
while (object) {
if (!strcmp(object->name, name))
if (STREQ(object->name, name))
return object;
object = object->next;

@ -469,8 +469,8 @@ static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProp
{
int valid = 1;
if (strcmp(prop_name, "video") == 0) {
if (strcmp(curr->name, "bf") == 0) {
if (STREQ(prop_name, "video")) {
if (STREQ(curr->name, "bf")) {
/* flash codec doesn't support b frames */
valid &= c->codec_id != AV_CODEC_ID_FLV1;
}
@ -624,9 +624,9 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
if ((of->oformat->flags & AVFMT_GLOBALHEADER)
#if 0
|| !strcmp(of->oformat->name, "mp4")
|| !strcmp(of->oformat->name, "mov")
|| !strcmp(of->oformat->name, "3gp")
|| STREQ(of->oformat->name, "mp4")
|| STREQ(of->oformat->name, "mov")
|| STREQ(of->oformat->name, "3gp")
#endif
)
{

@ -214,7 +214,7 @@ static int handle_request(RenderData *rd, char *req)
*p = 0;
if (strcmp(path, "/index.html") == 0 || strcmp(path, "/") == 0) {
if (STREQ(path, "/index.html") || STREQ(path, "/")) {
safe_puts(index_page);
return -1;
}
@ -226,7 +226,7 @@ static int handle_request(RenderData *rd, char *req)
write_ppm = 1;
return atoi(path + 12);
}
if (strcmp(path, "/info.txt") == 0) {
if (STREQ(path, "/info.txt")) {
char buf[4096];
sprintf(buf,
@ -250,7 +250,7 @@ static int handle_request(RenderData *rd, char *req)
safe_puts(buf);
return -1;
}
if (strcmp(path, "/close.txt") == 0) {
if (STREQ(path, "/close.txt")) {
safe_puts(good_bye);
G.is_break = true; /* Abort render */
return -1;

@ -100,7 +100,7 @@ static bool keycmp(const void *a, const void *b)
return (BLI_strcasecmp(ka->arg, kb->arg) != 0);
}
else {
return (strcmp(ka->arg, kb->arg) != 0);
return (!STREQ(ka->arg, kb->arg));
}
}
else {

@ -771,7 +771,7 @@ unsigned int BLI_ghashutil_strhash_p(const void *ptr)
}
bool BLI_ghashutil_strcmp(const void *a, const void *b)
{
return (strcmp(a, b) != 0);
return (!STREQ(a, b));
}
GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second)

@ -584,7 +584,7 @@ static int recursive_operation(const char *startfrom, const char *startto,
for (i = 0; i < n; i++) {
const struct dirent * const dirent = dirlist[i];
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
if (STREQ(dirent->d_name, ".") || STREQ(dirent->d_name, ".."))
continue;
join_dirfile_alloc(&from_path, &from_alloc_len, from, dirent->d_name);

@ -474,7 +474,7 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
for (link = listbase->first; link; link = link->next) {
id_iter = ((const char *)link) + offset;
if (id[0] == id_iter[0] && strcmp(id, id_iter) == 0) {
if (id[0] == id_iter[0] && STREQ(id, id_iter)) {
return link;
}
}
@ -494,7 +494,7 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset
for (link = listbase->last; link; link = link->prev) {
id_iter = ((const char *)link) + offset;
if (id[0] == id_iter[0] && strcmp(id, id_iter) == 0) {
if (id[0] == id_iter[0] && STREQ(id, id_iter)) {
return link;
}
}
@ -515,7 +515,7 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off
/* exact copy of BLI_findstring(), except for this line */
id_iter = *((const char **)(((const char *)link) + offset));
if (id[0] == id_iter[0] && strcmp(id, id_iter) == 0) {
if (id[0] == id_iter[0] && STREQ(id, id_iter)) {
return link;
}
}
@ -536,7 +536,7 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
/* exact copy of BLI_rfindstring(), except for this line */
id_iter = *((const char **)(((const char *)link) + offset));
if (id[0] == id_iter[0] && strcmp(id, id_iter) == 0) {
if (id[0] == id_iter[0] && STREQ(id, id_iter)) {
return link;
}
}
@ -600,7 +600,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
while (link) {
id_iter = ((const char *)link) + offset;
if (id[0] == id_iter[0] && strcmp(id, id_iter) == 0)
if (id[0] == id_iter[0] && STREQ(id, id_iter))
return i;
i++;
link = link->next;

@ -1369,9 +1369,7 @@ bool BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
ssize_t a;
/* first check the extension is already there */
if ( (ext_len <= path_len) &&
(strcmp(path + (path_len - ext_len), ext) == 0))
{
if ((ext_len <= path_len) && (STREQ(path + (path_len - ext_len), ext))) {
return true;
}

@ -135,10 +135,10 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2)
/* OK, now we know their S_IFMT fields are the same, go on to a name comparison */
/* make sure "." and ".." are always first */
if (strcmp(entry1->relname, ".") == 0) return (-1);
if (strcmp(entry2->relname, ".") == 0) return (1);
if (strcmp(entry1->relname, "..") == 0) return (-1);
if (strcmp(entry2->relname, "..") == 0) return (1);
if (STREQ(entry1->relname, ".")) return (-1);
if (STREQ(entry2->relname, ".")) return (1);
if (STREQ(entry1->relname, "..")) return (-1);
if (STREQ(entry2->relname, "..")) return (1);
return (BLI_natstrcmp(entry1->relname, entry2->relname));
}

@ -777,7 +777,7 @@ static void decode_blender_header(FileData *fd)
readsize = fd->read(fd, header, sizeof(header));
if (readsize == sizeof(header)) {
if (strncmp(header, "BLENDER", 7) == 0) {
if (STREQLEN(header, "BLENDER", 7)) {
int remove_this_endian_test = 1;
fd->flags |= FD_FLAGS_FILE_OK;
@ -1182,7 +1182,7 @@ bool BLO_is_a_library(const char *path, char *dir, char *group)
/* now we know that we are in a blend file and it is safe to
* assume that gp actually points to a group */
if (strcmp("Screen", gp) != 0)
if (!STREQ("Screen", gp))
BLI_strncpy(group, gp, BLO_GROUP_MAX);
}
return 1;
@ -6011,7 +6011,7 @@ typedef enum ePointerUserMode {
static bool restore_pointer(ID *id, ID *newid, ePointerUserMode user)
{
if (strcmp(newid->name + 2, id->name + 2) == 0) {
if (STREQ(newid->name + 2, id->name + 2)) {
if (newid->lib == id->lib) {
if (user == USER_ONE) {
if (newid->us == 0) {
@ -9099,7 +9099,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons
if (bhead->code == idcode) {
const char *idname_test= bhead_id_name(fd, bhead);
if (strcmp(idname_test + 2, idname) == 0) {
if (STREQ(idname_test + 2, idname)) {
found = 1;
id = is_yet_read(fd, mainl, bhead);
if (id == NULL) {
@ -9220,7 +9220,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id)
for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
if (bhead->code == GS(id->name)) {
if (strcmp(id->name, bhead_id_name(fd, bhead))==0) {
if (STREQ(id->name, bhead_id_name(fd, bhead))) {
id->flag &= ~LIB_READ;
id->flag |= LIB_NEED_EXPAND;
// printf("read lib block %s\n", id->name);

@ -1299,7 +1299,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
Object *ob;
for (vf = main->vfont.first; vf; vf = vf->id.next) {
if (strcmp(vf->name + strlen(vf->name)-6, ".Bfont") == 0) {
if (STREQ(vf->name + strlen(vf->name)-6, ".Bfont")) {
strcpy(vf->name, FO_BUILTIN_NAME);
}
}
@ -2314,7 +2314,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
if (main->versionfile == 241) {
Image *ima;
for (ima = main->image.first; ima; ima = ima->id.next)
if (strcmp(ima->name, "Compositor") == 0) {
if (STREQ(ima->name, "Compositor")) {
strcpy(ima->id.name + 2, "Viewer Node");
strcpy(ima->name, "Viewer Node");
}
@ -2502,11 +2502,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
ima->gen_x = 256; ima->gen_y = 256;
ima->gen_type = 1;
if (0 == strncmp(ima->id.name + 2, "Viewer Node", sizeof(ima->id.name) - 2)) {
if (STREQLEN(ima->id.name + 2, "Viewer Node", sizeof(ima->id.name) - 2)) {
ima->source = IMA_SRC_VIEWER;
ima->type = IMA_TYPE_COMPOSITE;
}
if (0 == strncmp(ima->id.name + 2, "Render Result", sizeof(ima->id.name) - 2)) {
if (STREQLEN(ima->id.name + 2, "Render Result", sizeof(ima->id.name) - 2)) {
ima->source = IMA_SRC_VIEWER;
ima->type = IMA_TYPE_R_RESULT;
}

@ -76,9 +76,9 @@ void AnimationExporter::operator()(Object *ob)
else
transformName = extract_transform_name(fcu->rna_path);
if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
(!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL) ||
(!strcmp(transformName, "rotation_quaternion")))
if ((STREQ(transformName, "location") || STREQ(transformName, "scale")) ||
(STREQ(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL) ||
(STREQ(transformName, "rotation_quaternion")))
{
dae_animation(ob, fcu, transformName, false);
}
@ -98,8 +98,8 @@ void AnimationExporter::operator()(Object *ob)
while (fcu) {
transformName = extract_transform_name(fcu->rna_path);
if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size")) ||
(!strcmp(transformName, "spot_blend")) || (!strcmp(transformName, "distance")))
if ((STREQ(transformName, "color")) || (STREQ(transformName, "spot_size")) ||
(STREQ(transformName, "spot_blend")) || (STREQ(transformName, "distance")))
{
dae_animation(ob, fcu, transformName, true);
}
@ -113,10 +113,10 @@ void AnimationExporter::operator()(Object *ob)
while (fcu) {
transformName = extract_transform_name(fcu->rna_path);
if ((!strcmp(transformName, "lens")) ||
(!strcmp(transformName, "ortho_scale")) ||
(!strcmp(transformName, "clip_end")) ||
(!strcmp(transformName, "clip_start")))
if ((STREQ(transformName, "lens")) ||
(STREQ(transformName, "ortho_scale")) ||
(STREQ(transformName, "clip_end")) ||
(STREQ(transformName, "clip_start")))
{
dae_animation(ob, fcu, transformName, true);
}
@ -134,9 +134,9 @@ void AnimationExporter::operator()(Object *ob)
while (fcu) {
transformName = extract_transform_name(fcu->rna_path);
if ((!strcmp(transformName, "specular_hardness")) || (!strcmp(transformName, "specular_color")) ||
(!strcmp(transformName, "diffuse_color")) || (!strcmp(transformName, "alpha")) ||
(!strcmp(transformName, "ior")))
if ((STREQ(transformName, "specular_hardness")) || (STREQ(transformName, "specular_color")) ||
(STREQ(transformName, "diffuse_color")) || (STREQ(transformName, "alpha")) ||
(STREQ(transformName, "ior")))
{
dae_animation(ob, fcu, transformName, true, ma);
}
@ -225,7 +225,7 @@ float *AnimationExporter::get_eul_source_for_quat(Object *ob)
while (fcu) {
char *transformName = extract_transform_name(fcu->rna_path);
if (!strcmp(transformName, "rotation_quaternion") ) {
if (STREQ(transformName, "rotation_quaternion") ) {
for (int i = 0; i < fcu->totvert; i++) {
*(quat + (i * 4) + fcu->array_index) = fcu->bezt[i].vec[1][1];
}
@ -278,17 +278,17 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
bool has_tangents = false;
bool quatRotation = false;
if (!strcmp(transformName, "rotation_quaternion") ) {
if (STREQ(transformName, "rotation_quaternion") ) {
fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
quatRotation = true;
return;
}
//axis names for colors
else if (!strcmp(transformName, "color") ||
!strcmp(transformName, "specular_color") ||
!strcmp(transformName, "diffuse_color") ||
!strcmp(transformName, "alpha"))
else if (STREQ(transformName, "color") ||
STREQ(transformName, "specular_color") ||
STREQ(transformName, "diffuse_color") ||
STREQ(transformName, "alpha"))
{
const char *axis_names[] = {"R", "G", "B"};
if (fcu->array_index < 3)
@ -296,10 +296,10 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
}
//axis names for transforms
else if (!strcmp(transformName, "location") ||
!strcmp(transformName, "scale") ||
!strcmp(transformName, "rotation_euler") ||
!strcmp(transformName, "rotation_quaternion"))
else if (STREQ(transformName, "location") ||
STREQ(transformName, "scale") ||
STREQ(transformName, "rotation_euler") ||
STREQ(transformName, "rotation_quaternion"))
{
const char *axis_names[] = {"X", "Y", "Z"};
if (fcu->array_index < 3)
@ -357,7 +357,7 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
MEM_freeN(eul);
MEM_freeN(eul_axis);
}
else if (!strcmp(transformName, "lens") && (ob->type == OB_CAMERA)) {
else if (STREQ(transformName, "lens") && (ob->type == OB_CAMERA)) {
output_id = create_lens_source_from_fcurve((Camera *) ob->data, COLLADASW::InputSemantic::OUTPUT, fcu, anim_id);
}
else {
@ -763,7 +763,7 @@ std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemanti
{
std::string source_id = anim_id + get_semantic_suffix(semantic);
//bool is_angle = !strcmp(fcu->rna_path, "rotation");
//bool is_angle = STREQ(fcu->rna_path, "rotation");
bool is_angle = false;
if (strstr(fcu->rna_path, "rotation") || strstr(fcu->rna_path,"spot_size")) is_angle = true;
@ -1103,13 +1103,13 @@ std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type,
if (rna_path) {
char *name = extract_transform_name(rna_path);
if (!strcmp(name, "color"))
if (STREQ(name, "color"))
tm_type = 1;
else if (!strcmp(name, "spot_size"))
else if (STREQ(name, "spot_size"))
tm_type = 2;
else if (!strcmp(name, "spot_blend"))
else if (STREQ(name, "spot_blend"))
tm_type = 3;
else if (!strcmp(name, "distance"))
else if (STREQ(name, "distance"))
tm_type = 4;
else
tm_type = -1;
@ -1151,13 +1151,13 @@ std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type,
if (rna_path) {
char *name = extract_transform_name(rna_path);
if (!strcmp(name, "lens"))
if (STREQ(name, "lens"))
tm_type = 0;
else if (!strcmp(name, "ortho_scale"))
else if (STREQ(name, "ortho_scale"))
tm_type = 1;
else if (!strcmp(name, "clip_end"))
else if (STREQ(name, "clip_end"))
tm_type = 2;
else if (!strcmp(name, "clip_start"))
else if (STREQ(name, "clip_start"))
tm_type = 3;
else
@ -1203,23 +1203,23 @@ std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, co
if (rna_path) {
char *name = extract_transform_name(rna_path);
if (!strcmp(name, "rotation_euler"))
if (STREQ(name, "rotation_euler"))
tm_type = 0;
else if (!strcmp(name, "rotation_quaternion"))
else if (STREQ(name, "rotation_quaternion"))
tm_type = 1;
else if (!strcmp(name, "scale"))
else if (STREQ(name, "scale"))
tm_type = 2;
else if (!strcmp(name, "location"))
else if (STREQ(name, "location"))
tm_type = 3;
else if (!strcmp(name, "specular_hardness"))
else if (STREQ(name, "specular_hardness"))
tm_type = 4;
else if (!strcmp(name, "specular_color"))
else if (STREQ(name, "specular_color"))
tm_type = 5;
else if (!strcmp(name, "diffuse_color"))
else if (STREQ(name, "diffuse_color"))
tm_type = 6;
else if (!strcmp(name, "alpha"))
else if (STREQ(name, "alpha"))
tm_type = 7;
else if (!strcmp(name, "ior"))
else if (STREQ(name, "ior"))
tm_type = 8;
else
@ -1311,7 +1311,7 @@ void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
for (fcu = (FCurve *)act->curves.first; fcu; fcu = fcu->next) {
if (bone_name) {
if (!strncmp(fcu->rna_path, prefix, strlen(prefix)))
if (STREQLEN(fcu->rna_path, prefix, strlen(prefix)))
fcu->flag &= ~FCURVE_DISABLED;
else
fcu->flag |= FCURVE_DISABLED;
@ -1378,11 +1378,11 @@ void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const c
FCurve *fcu = (FCurve *)ob->adt->action->curves.first;
for (; fcu; fcu = fcu->next) {
if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix)))
if (prefix && !STREQLEN(prefix, fcu->rna_path, strlen(prefix)))
continue;
char *name = extract_transform_name(fcu->rna_path);
if (!strcmp(name, tm_name)) {
if (STREQ(name, tm_name)) {
for (unsigned int i = 0; i < fcu->totvert; i++) {
float f = fcu->bezt[i].vec[1][0];
if (std::find(fra.begin(), fra.end(), f) == fra.end())

@ -649,7 +649,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
FCurve *fcu = *iter;
/* All anim_types whose values are to be converted from Degree to Radians can be ORed here */
if (strcmp("spot_size", anim_type)==0) {
if (STREQ("spot_size", anim_type)) {
/* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
* Reason: old blender versions stored spot_size in radians (was a bug)
*/

@ -181,7 +181,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
std::list<Object *>::iterator i = child_objects.begin();
while (i != child_objects.end()) {
if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
if ((*i)->partype == PARBONE && STREQ((*i)->parsubstr, bone->name)) {
float backup_parinv[4][4];
copy_m4_m4(backup_parinv, (*i)->parentinv);

@ -54,7 +54,7 @@ static EditBone *get_edit_bone(bArmature * armature, char *name) {
EditBone *eBone;
for (eBone = (EditBone *)armature->edbo->first; eBone; eBone = eBone->next) {
if (!strcmp(name, eBone->name))
if (STREQ(name, eBone->name))
return eBone;
}

@ -34,6 +34,8 @@
#include <string.h>
#include "BLI_utildefines.h"
//--------------------------------------------------------------------
ErrorHandler::ErrorHandler() : mError(false)
{
@ -55,13 +57,13 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
// Workaround to avoid wrong error
if (parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
if (strcmp(parserError.getElement(), "effect") == 0) {
if (STREQ(parserError.getElement(), "effect")) {
isError = false;
}
}
if (parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
if (!((strcmp(parserError.getElement(), "extra") == 0) &&
(strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
if (!(STREQ(parserError.getElement(), "extra") &&
STREQ(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract")))
{
isError = false;
}

@ -1061,7 +1061,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
// set texture face
if (color_texture &&
strlen((color_texture)->uvname) &&
strcmp(layername, color_texture->uvname) != 0) {
!STREQ(layername, color_texture->uvname)) {
texture_face = (MTFace *)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
color_texture->uvname);
strcpy(layername, color_texture->uvname);

@ -35,7 +35,7 @@ void TextureNode::convertToOperations(NodeConverter &converter, const Compositor
Tex *texture = (Tex *)editorNode->id;
TextureOperation *operation = new TextureOperation();
const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings();
bool sceneColorManage = strcmp(displaySettings->display_device, "None") != 0;
bool sceneColorManage = !STREQ(displaySettings->display_device, "None");
operation->setTexture(texture);
operation->setRenderData(context.getRenderData());
operation->setSceneColorManage(sceneColorManage);

@ -663,14 +663,14 @@ static tAnimCopybufItem *pastebuf_match_path_full(FCurve *fcu, const short from_
if ((from_single) || (aci->array_index == fcu->array_index)) {
char *name = NULL;
flip_names(aci, &name);
if (strcmp(name, fcu->rna_path) == 0) {
if (STREQ(name, fcu->rna_path)) {
MEM_freeN(name);
break;
}
MEM_freeN(name);
}
}
else if (to_simple || (strcmp(aci->rna_path, fcu->rna_path) == 0)) {
else if (to_simple || STREQ(aci->rna_path, fcu->rna_path)) {
if ((from_single) || (aci->array_index == fcu->array_index)) {
break;
}
@ -711,7 +711,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
int len_path = strlen(fcu->rna_path);
if (len_id <= len_path) {
/* note, paths which end with "] will fail with this test - Animated ID Props */
if (strcmp(identifier, fcu->rna_path + (len_path - len_id)) == 0) {
if (STREQ(identifier, fcu->rna_path + (len_path - len_id))) {
if ((from_single) || (aci->array_index == fcu->array_index))
break;
}

@ -556,7 +556,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[]
/* loop over KeyingSets checking names */
for (ks = first; ks; ks = ks->next) {
if (strcmp(name, ks->idname) == 0)
if (STREQ(name, ks->idname))
return ks;
}
@ -603,7 +603,7 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
ksn = ks->next;
/* remove if matching typeinfo name */
if (strcmp(ks->typeinfo, ksi->idname) == 0) {
if (STREQ(ks->typeinfo, ksi->idname)) {
Scene *scene;
BKE_keyingset_free(ks);
BLI_remlink(&builtin_keyingsets, ks);

@ -270,7 +270,7 @@ static EditBone *get_named_editbone(ListBase *edbo, const char *name)
if (name) {
for (eBone = edbo->first; eBone; eBone = eBone->next) {
if (!strcmp(name, eBone->name))
if (STREQ(name, eBone->name))
return eBone;
}
}

@ -141,7 +141,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
char oldname[MAXBONENAME];
/* names better differ! */
if (strncmp(oldnamep, newnamep, MAXBONENAME)) {
if (!STREQLEN(oldnamep, newnamep, MAXBONENAME)) {
/* we alter newname string... so make copy */
BLI_strncpy(newname, newnamep, MAXBONENAME);
@ -219,7 +219,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
if (ob->parent && (ob->parent->data == arm)) {
if (ob->partype == PARBONE) {
/* bone name in object */
if (!strcmp(ob->parsubstr, oldname))
if (STREQ(ob->parsubstr, oldname))
BLI_strncpy(ob->parsubstr, newname, MAXBONENAME);
}
}
@ -285,7 +285,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->ob_centre && v3d->ob_centre->data == arm) {
if (!strcmp(v3d->ob_centre_bone, oldname)) {
if (STREQ(v3d->ob_centre_bone, oldname)) {
BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
}
}

@ -151,7 +151,7 @@ static void joined_armature_fix_animdata_cb(ID *id, AnimData *adt, void *user_da
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
/* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
if (strcmp(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "pose.bones",
old_name, new_name, 0, 0, false);
@ -189,14 +189,14 @@ static void joined_armature_fix_animdata_cb(ID *id, AnimData *adt, void *user_da
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
/* only remap if changed */
if (strcmp(old_name, new_name)) {
if (!STREQ(old_name, new_name)) {
if ((dtar->rna_path) && strstr(dtar->rna_path, old_name)) {
/* Fix up path */
dtar->rna_path = BKE_animsys_fix_rna_path_rename(id, dtar->rna_path, "pose.bones",
old_name, new_name, 0, 0, false);
break; /* no need to try any more names for bone path */
}
else if (strcmp(dtar->pchan_name, old_name) == 0) {
else if (STREQ(dtar->pchan_name, old_name)) {
/* Change target bone name */
BLI_strncpy(dtar->pchan_name, new_name, sizeof(dtar->pchan_name));
break; /* no need to try any more names for bone subtarget */

@ -718,7 +718,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
cti->get_constraint_targets(con, &targets);
for (target_index = 0, ct = targets.first; ct; target_index++, ct = ct->next) {
if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
if ((ct->tar == rg->ob) && STREQ(ct->subtarget, ctrl->bone->name)) {
/* SET bone link to bone corresponding to pchan */
EditBone *link = BLI_ghash_lookup(rg->bones_map, pchan->name);
@ -841,7 +841,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
cti->get_constraint_targets(con, &targets);
for (ct = targets.first; ct; ct = ct->next) {
if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
if ((ct->tar == rg->ob) && STREQ(ct->subtarget, ctrl->bone->name)) {
/* SET bone link to ctrl corresponding to pchan */
RigControl *link = BLI_ghash_lookup(rg->controls_map, pchan->name);
@ -1160,7 +1160,7 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
last_bone = bone;
if (strcmp(bone->name, "head") == 0) {
if (STREQ(bone->name, "head")) {
contain_head = 1;
}
}

@ -333,11 +333,11 @@ static void sk_autoname(bContext *C, ReebArc *arc)
if (side[0] == '\0') {
valid = 1;
}
else if (strcmp(side, "R") == 0 || strcmp(side, "L") == 0) {
else if (STREQ(side, "R") || STREQ(side, "L")) {
valid = 1;
caps = 1;
}
else if (strcmp(side, "r") == 0 || strcmp(side, "l") == 0) {
else if (STREQ(side, "r") || STREQ(side, "l")) {
valid = 1;
caps = 0;
}

@ -1050,7 +1050,7 @@ static void poselib_preview_get_next(tPoseLib_PreviewData *pld, int step)
LinkData *ld, *ldn, *ldc;
/* free and rebuild if needed (i.e. if search-str changed) */
if (strcmp(pld->searchstr, pld->searchold)) {
if (!STREQ(pld->searchstr, pld->searchold)) {
/* free list of temporary search matches */
BLI_freelistN(&pld->searchp);

@ -259,7 +259,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con
FCurve *fcu = (FCurve *)ld->data;
/* check if paths match */
if (strcmp(path, fcu->rna_path) == 0)
if (STREQ(path, fcu->rna_path))
return ld;
}

@ -999,7 +999,7 @@ static void fcurve_path_rename(AnimData *adt, const char *orig_rna_path, char *r
for (fcu = orig_curves->first; fcu; fcu = nextfcu) {
nextfcu = fcu->next;
if (!strncmp(fcu->rna_path, orig_rna_path, len)) {
if (STREQLEN(fcu->rna_path, orig_rna_path, len)) {
char *spath, *suffix = fcu->rna_path + len;
nfcu = copy_fcurve(fcu);
spath = nfcu->rna_path;
@ -1102,10 +1102,10 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
for (fcu = orig_curves->first; fcu; fcu = next) {
next = fcu->next;
if (!strncmp(fcu->rna_path, "splines", 7)) {
if (STREQLEN(fcu->rna_path, "splines", 7)) {
const char *ch = strchr(fcu->rna_path, '.');
if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
if (ch && (STREQLEN(ch, ".bezier_points", 14) || STREQLEN(ch, ".points", 7)))
fcurve_remove(adt, orig_curves, fcu);
}
}
@ -1129,7 +1129,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
for (fcu = orig_curves->first; fcu; fcu = next) {
next = fcu->next;
if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(adt, orig_curves, fcu);
if (STREQLEN(fcu->rna_path, "splines", 7)) fcurve_remove(adt, orig_curves, fcu);
else BLI_addtail(&curves, fcu);
}
@ -6768,7 +6768,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
int clear = (strcmp(op->idname, "CURVE_OT_shade_flat") == 0);
int clear = (STREQ(op->idname, "CURVE_OT_shade_flat"));
if (obedit->type != OB_CURVE)
return OPERATOR_CANCELLED;

@ -390,7 +390,7 @@ void paste_gpdata(Scene *scene)
/* find suitable layer from buffer to use to paste from */
for (gpls = gpcopybuf.first; gpls; gpls = gpls->next) {
/* check if layer name matches */
if ((no_name) || (strcmp(gpls->info, gpld->info) == 0))
if ((no_name) || STREQ(gpls->info, gpld->info))
break;
}

@ -2502,50 +2502,50 @@ static bool gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
const bool valid_timing = RNA_boolean_get(ptr, "use_timing_data");
/* Always show those props */
if (strcmp(prop_id, "type") == 0 ||
strcmp(prop_id, "use_normalize_weights") == 0 ||
strcmp(prop_id, "radius_multiplier") == 0 ||
strcmp(prop_id, "use_link_strokes") == 0)
if (STREQ(prop_id, "type") ||
STREQ(prop_id, "use_normalize_weights") ||
STREQ(prop_id, "radius_multiplier") ||
STREQ(prop_id, "use_link_strokes"))
{
return true;
}
/* Never show this prop */
if (strcmp(prop_id, "use_timing_data") == 0)
if (STREQ(prop_id, "use_timing_data"))
return false;
if (link_strokes) {
/* Only show when link_stroke is true */
if (strcmp(prop_id, "timing_mode") == 0)
if (STREQ(prop_id, "timing_mode"))
return true;
if (timing_mode != GP_STROKECONVERT_TIMING_NONE) {
/* Only show when link_stroke is true and stroke timing is enabled */
if (strcmp(prop_id, "frame_range") == 0 ||
strcmp(prop_id, "start_frame") == 0)
if (STREQ(prop_id, "frame_range") ||
STREQ(prop_id, "start_frame"))
{
return true;
}
/* Only show if we have valid timing data! */
if (valid_timing && strcmp(prop_id, "use_realtime") == 0)
if (valid_timing && STREQ(prop_id, "use_realtime"))
return true;
/* Only show if realtime or valid_timing is false! */
if ((!realtime || !valid_timing) && strcmp(prop_id, "end_frame") == 0)
if ((!realtime || !valid_timing) && STREQ(prop_id, "end_frame"))
return true;
if (valid_timing && timing_mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
/* Only show for custom gaps! */
if (strcmp(prop_id, "gap_duration") == 0)
if (STREQ(prop_id, "gap_duration"))
return true;
/* Only show randomness for non-null custom gaps! */
if (strcmp(prop_id, "gap_randomness") == 0 && (gap_duration > 0.0f))
if (STREQ(prop_id, "gap_randomness") && (gap_duration > 0.0f))
return true;
/* Only show seed for randomize action! */
if (strcmp(prop_id, "seed") == 0 && (gap_duration > 0.0f) && (gap_randomness > 0.0f))
if (STREQ(prop_id, "seed") && (gap_duration > 0.0f) && (gap_randomness > 0.0f))
return true;
}
}

@ -76,7 +76,7 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
if (step == 1) { /* undo */
//printf("\t\tGP - undo step\n");
if (cur_node->prev) {
if (!name || strcmp(cur_node->name, name) == 0) {
if (!name || STREQ(cur_node->name, name)) {
cur_node = cur_node->prev;
new_gpd = cur_node->gpd;
}
@ -85,7 +85,7 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
else if (step == -1) {
//printf("\t\tGP - redo step\n");
if (cur_node->next) {
if (!name || strcmp(cur_node->name, name) == 0) {
if (!name || STREQ(cur_node->name, name)) {
cur_node = cur_node->next;
new_gpd = cur_node->gpd;
}

@ -297,7 +297,7 @@ void ui_block_bounds_calc(uiBlock *block)
/* hardcoded exception... but that one is annoying with larger safety */
bt = block->buttons.first;
if (bt && strncmp(bt->str, "ERROR", 5) == 0) xof = 10;
if (bt && STREQLEN(bt->str, "ERROR", 5)) xof = 10;
else xof = 40;
block->safety.xmin = block->rect.xmin - xof;

@ -515,7 +515,7 @@ static bool ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
(but_a->rnaprop == but_b->rnaprop) &&
(but_a->optype == but_b->optype) &&
(but_a->unit_type == but_b->unit_type) &&
(strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0))
STREQLEN(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR))
{
return true;
}

@ -1919,7 +1919,7 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker
ui_but_v3_set(bt, rgb);
}
else if (strcmp(bt->str, "Hex: ") == 0) {
else if (STREQ(bt->str, "Hex: ")) {
float rgb_gamma[3];
unsigned char rgb_gamma_uchar[3];
double intpart;

@ -2862,7 +2862,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
/* validate arguments */
/* Forbid default UI_UL_DEFAULT_CLASS_NAME list class without a custom list_id! */
if (!strcmp(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) {
if (STREQ(UI_UL_DEFAULT_CLASS_NAME, listtype_name) && !(list_id && list_id[0])) {
RNA_warning("template_list using default '%s' UIList class must provide a custom list_id",
UI_UL_DEFAULT_CLASS_NAME);
return;

@ -1574,7 +1574,7 @@ void init_userdef_do_versions(void)
U.tb_rightmouse = 5;
}
if (U.mixbufsize == 0) U.mixbufsize = 2048;
if (strcmp(U.tempdir, "/") == 0) {
if (STREQ(U.tempdir, "/")) {
BKE_tempdir_system_init(U.tempdir);
}
if (U.autokey_mode == 0) {
@ -1907,39 +1907,39 @@ void init_userdef_do_versions(void)
wmKeyMap *km;
for (km = U.user_keymaps.first; km; km = km->next) {
if (strcmp(km->idname, "Armature_Sketch") == 0)
if (STREQ(km->idname, "Armature_Sketch"))
strcpy(km->idname, "Armature Sketch");
else if (strcmp(km->idname, "View3D") == 0)
else if (STREQ(km->idname, "View3D"))
strcpy(km->idname, "3D View");
else if (strcmp(km->idname, "View3D Generic") == 0)
else if (STREQ(km->idname, "View3D Generic"))
strcpy(km->idname, "3D View Generic");
else if (strcmp(km->idname, "EditMesh") == 0)
else if (STREQ(km->idname, "EditMesh"))
strcpy(km->idname, "Mesh");
else if (strcmp(km->idname, "TimeLine") == 0)
else if (STREQ(km->idname, "TimeLine"))
strcpy(km->idname, "Timeline");
else if (strcmp(km->idname, "UVEdit") == 0)
else if (STREQ(km->idname, "UVEdit"))
strcpy(km->idname, "UV Editor");
else if (strcmp(km->idname, "Animation_Channels") == 0)
else if (STREQ(km->idname, "Animation_Channels"))
strcpy(km->idname, "Animation Channels");
else if (strcmp(km->idname, "GraphEdit Keys") == 0)
else if (STREQ(km->idname, "GraphEdit Keys"))
strcpy(km->idname, "Graph Editor");
else if (strcmp(km->idname, "GraphEdit Generic") == 0)
else if (STREQ(km->idname, "GraphEdit Generic"))
strcpy(km->idname, "Graph Editor Generic");
else if (strcmp(km->idname, "Action_Keys") == 0)
else if (STREQ(km->idname, "Action_Keys"))
strcpy(km->idname, "Dopesheet");
else if (strcmp(km->idname, "NLA Data") == 0)
else if (STREQ(km->idname, "NLA Data"))
strcpy(km->idname, "NLA Editor");
else if (strcmp(km->idname, "Node Generic") == 0)
else if (STREQ(km->idname, "Node Generic"))
strcpy(km->idname, "Node Editor");
else if (strcmp(km->idname, "Logic Generic") == 0)
else if (STREQ(km->idname, "Logic Generic"))
strcpy(km->idname, "Logic Editor");
else if (strcmp(km->idname, "File") == 0)
else if (STREQ(km->idname, "File"))
strcpy(km->idname, "File Browser");
else if (strcmp(km->idname, "FileMain") == 0)
else if (STREQ(km->idname, "FileMain"))
strcpy(km->idname, "File Browser Main");
else if (strcmp(km->idname, "FileButtons") == 0)
else if (STREQ(km->idname, "FileButtons"))
strcpy(km->idname, "File Browser Buttons");
else if (strcmp(km->idname, "Buttons Generic") == 0)
else if (STREQ(km->idname, "Buttons Generic"))
strcpy(km->idname, "Property Editor");
}
}

@ -329,7 +329,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
if (odg) {
/* Search for a match in the new object, and set new index */
for (dg = ob->defbase.first, index = 0; dg; dg = dg->next, index++) {
if (!strcmp(dg->name, odg->name)) {
if (STREQ(dg->name, odg->name)) {
dvert[i].dw[j].def_nr = index;
break;
}

@ -471,7 +471,7 @@ static void test_constraints(Object *owner, bPoseChannel *pchan)
/* TODO: clear subtarget? */
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (strcmp(pchan->name, ct->subtarget) == 0) {
else if (STREQ(pchan->name, ct->subtarget)) {
/* cannot target self */
ct->subtarget[0] = '\0';
curcon->flag |= CONSTRAINT_DISABLE;

@ -1347,7 +1347,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
ID *data;
Curve *cu;
Nurb *nu;
int clear = (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
int clear = (STREQ(op->idname, "OBJECT_OT_shade_flat"));
bool done = false, linked_data = false;
CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects)

@ -359,7 +359,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
for (base = sce->base.first; base; base = base->next) {
if (base->object->type == OB_LAMP) {
/* if doesn't match 'Lamp.002' --> main key light */
if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) {
if (!STREQ(base->object->id.name + 2, "Lamp.002")) {
if (mat->material_type == MA_TYPE_VOLUME)
base->object->restrictflag |= OB_RESTRICT_RENDER;
else

@ -108,7 +108,7 @@ static void paintcurve_undo_restore(bContext *C, ListBase *lb)
uc = (UndoCurve *)lb->first;
if (strncmp(uc->idname, pc->id.name, BLI_strnlen(uc->idname, sizeof(uc->idname))) == 0) {
if (STREQLEN(uc->idname, pc->id.name, BLI_strnlen(uc->idname, sizeof(uc->idname)))) {
SWAP(PaintCurvePoint *, pc->points, uc->points);
SWAP(int, pc->tot_points, uc->tot_points);
SWAP(int, pc->add_index, uc->active_point);

@ -193,7 +193,7 @@ void *image_undo_find_tile(Image *ima, ImBuf *ibuf, int x_tile, int y_tile, unsi
for (tile = lb->first; tile; tile = tile->next) {
if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source) {
if (tile->use_float == use_float) {
if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0) {
if (STREQ(tile->idname, ima->id.name) && STREQ(tile->ibufname, ibuf->name)) {
if (mask) {
/* allocate mask if requested */
if (!tile->mask) {
@ -328,7 +328,7 @@ void ED_image_undo_restore(bContext *C, ListBase *lb)
short use_float;
/* find image based on name, pointer becomes invalid with global undo */
if (ima && strcmp(tile->idname, ima->id.name) == 0) {
if (ima && STREQ(tile->idname, ima->id.name)) {
/* ima is valid */
}
else {
@ -337,7 +337,7 @@ void ED_image_undo_restore(bContext *C, ListBase *lb)
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
if (ima && ibuf && strcmp(tile->ibufname, ibuf->name) != 0) {
if (ima && ibuf && !STREQ(tile->ibufname, ibuf->name)) {
/* current ImBuf filename was changed, probably current frame
* was changed when painting on image sequence, rather than storing
* full image user (which isn't so obvious, btw) try to find ImBuf with

@ -210,7 +210,7 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
/* pass */
}
else {
if (!name || strcmp(stack->current->name, name) == 0) {
if (!name || STREQ(stack->current->name, name)) {
if (G.debug & G_DEBUG_WM) {
printf("%s: undo '%s'\n", __func__, stack->current->name);
}
@ -225,7 +225,7 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
/* pass */
}
else {
if (!name || strcmp(stack->current->name, name) == 0) {
if (!name || STREQ(stack->current->name, name)) {
undo = (stack->current && stack->current->next) ? stack->current->next : stack->elems.first;
undo_restore(C, stack, undo);
stack->current = undo;
@ -394,7 +394,7 @@ int ED_undo_paint_valid(int type, const char *name)
/* pass */
}
else {
if (name && strcmp(stack->current->name, name) == 0)
if (name && STREQ(stack->current->name, name))
return 1;
else
return stack->elems.first != stack->elems.last;

@ -104,7 +104,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
if (unode->maxvert) {
/* regular mesh restore */
if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
if (ss->kb && !STREQ(ss->kb->name, unode->shapeName)) {
/* shape key has been changed before calling undo operator */
Key *key = BKE_key_from_object(ob);
@ -404,7 +404,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
bool need_mask = false;
for (unode = lb->first; unode; unode = unode->next) {
if (strcmp(unode->idname, ob->id.name) == 0) {
if (STREQ(unode->idname, ob->id.name)) {
if (unode->type == SCULPT_UNDO_MASK) {
/* is possible that we can't do the mask undo (below)
* because of the vertex count */
@ -423,7 +423,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
return;
for (unode = lb->first; unode; unode = unode->next) {
if (!(strcmp(unode->idname, ob->id.name) == 0))
if (!STREQ(unode->idname, ob->id.name))
continue;
/* check if undo data matches current data well enough to
@ -550,7 +550,7 @@ static bool sculpt_undo_cleanup(bContext *C, ListBase *lb)
unode = lb->first;
if (unode && strcmp(unode->idname, ob->id.name) != 0) {
if (unode && !STREQ(unode->idname, ob->id.name)) {
if (unode->bm_entry)
BM_log_cleanup_entry(unode->bm_entry);

@ -399,7 +399,7 @@ static bool sound_mixdown_check(bContext *UNUSED(C), wmOperator *op)
if (item->value == container) {
const char **ext = snd_ext_sound;
while (*ext != NULL) {
if (!strcmp(*ext + 1, item->name)) {
if (STREQ(*ext + 1, item->name)) {
extension = *ext;
break;
}
@ -449,9 +449,9 @@ static int sound_mixdown_invoke(bContext *C, wmOperator *op, const wmEvent *even
static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
return !(strcmp(prop_id, "filepath") == 0 ||
strcmp(prop_id, "directory") == 0 ||
strcmp(prop_id, "filename") == 0);
return !(STREQ(prop_id, "filepath") ||
STREQ(prop_id, "directory") ||
STREQ(prop_id, "filename"));
}
static void sound_mixdown_draw(bContext *C, wmOperator *op)

@ -559,7 +559,7 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
char name[UI_MAX_NAME_STR];
/* add label per category */
if (!last_category || strcmp(last_category, user->category) != 0) {
if (!last_category || !STREQ(last_category, user->category)) {
uiItemL(layout, user->category, ICON_NONE);
but = block->buttons.last;
but->drawflag = UI_BUT_TEXT_LEFT;

@ -107,7 +107,7 @@ static ConsoleLine *console_history_find(SpaceConsole *sc, const char *str, Cons
if (cl == cl_ignore)
continue;
if (strcmp(str, cl->line) == 0)
if (STREQ(str, cl->line))
return cl;
}
@ -722,7 +722,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
if (ci->prev) {
ConsoleLine *ci_prev = (ConsoleLine *)ci->prev;
if (strcmp(ci->line, ci_prev->line) == 0)
if (STREQ(ci->line, ci_prev->line))
console_history_free(sc, ci_prev);
}
@ -791,7 +791,7 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
while ((cl = console_history_find(sc, ci->line, ci)))
console_history_free(sc, cl);
if (strcmp(str, ci->line) == 0) {
if (STREQ(str, ci->line)) {
MEM_freeN(str);
return OPERATOR_FINISHED;
}

@ -239,7 +239,7 @@ static void draw_tile(int sx, int sy, int width, int height, int colorid, int sh
static int get_file_icon(struct direntry *file)
{
if (file->type & S_IFDIR) {
if (strcmp(file->relname, "..") == 0) {
if (STREQ(file->relname, "..")) {
return ICON_FILE_PARENT;
}
if (file->flags & FILE_TYPE_APPLICATIONBUNDLE) {
@ -403,7 +403,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
if (strcmp(orgname, newname) != 0) {
if (!STREQ(orgname, newname)) {
if (!BLI_exists(newname)) {
BLI_rename(orgname, newname);
/* to make sure we show what is on disk */

@ -183,11 +183,11 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
retval = FILE_SELECT_DIR;
}
/* the path is too long and we are not going up! */
else if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) {
else if (!STREQ(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) {
// XXX error("Path too long, cannot enter this directory");
}
else {
if (strcmp(file->relname, "..") == 0) {
if (STREQ(file->relname, "..")) {
/* avoids /../../ */
BLI_parent_dir(params->dir);
}

@ -304,10 +304,10 @@ static int compare_direntry_generic(const struct direntry *entry1, const struct
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
if (strcmp(entry1->relname, ".") == 0) return (-1);
if (strcmp(entry2->relname, ".") == 0) return (1);
if (strcmp(entry1->relname, "..") == 0) return (-1);
if (strcmp(entry2->relname, "..") == 0) return (1);
if (STREQ(entry1->relname, ".")) return (-1);
if (STREQ(entry2->relname, ".")) return (1);
if (STREQ(entry1->relname, "..")) return (-1);
if (STREQ(entry2->relname, "..")) return (1);
return 0;
}
@ -634,10 +634,10 @@ ImBuf *filelist_geticon(struct FileList *filelist, const int index)
fidx = filelist->fidx[index];
file = &filelist->filelist[fidx];
if (file->type & S_IFDIR) {
if (strcmp(filelist->filelist[fidx].relname, "..") == 0) {
if (STREQ(filelist->filelist[fidx].relname, "..")) {
ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT];
}
else if (strcmp(filelist->filelist[fidx].relname, ".") == 0) {
else if (STREQ(filelist->filelist[fidx].relname, ".")) {
ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH];
}
else {
@ -773,7 +773,8 @@ int filelist_find(struct FileList *filelist, const char *filename)
for (i = 0; i < filelist->numfiles; ++i) {
if (strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */
/* not dealing with user input so don't need BLI_path_cmp */
if (STREQ(filelist->filelist[i].relname, filename)) {
index = i;
break;
}

@ -669,7 +669,7 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
AutoComplete *autocpl = UI_autocomplete_begin(str, FILE_MAX);
while ((de = readdir(dir)) != NULL) {
if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) {
if (STREQ(de->d_name, ".") || STREQ(de->d_name, "..")) {
/* pass */
}
else {

@ -283,10 +283,10 @@ void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename)
if (!fp) return;
while (fgets(line, sizeof(line), fp) != NULL) { /* read a line */
if (strncmp(line, "[Bookmarks]", 11) == 0) {
if (STREQLEN(line, "[Bookmarks]", 11)) {
category = FS_CATEGORY_BOOKMARKS;
}
else if (strncmp(line, "[Recent]", 8) == 0) {
else if (STREQLEN(line, "[Recent]", 8)) {
category = FS_CATEGORY_RECENT;
}
else {
@ -359,7 +359,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
continue;
FSRefMakePath(&dir, path, FILE_MAX);
if (strcmp((char *)path, "/home") && strcmp((char *)path, "/net")) {
if (!STREQ((char *)path, "/home") && !STREQ((char *)path, "/net")) {
/* /net and /home are meaningless on OSX, home folders are stored in /Users */
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED);
}
@ -488,7 +488,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
else {
while ((mnt = getmntent(fp))) {
/* not sure if this is right, but seems to give the relevant mnts */
if (strncmp(mnt->mnt_fsname, "/dev", 4))
if (!STREQLEN(mnt->mnt_fsname, "/dev", 4))
continue;
len = strlen(mnt->mnt_dir);

@ -1721,7 +1721,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
* so if the paths or the ID's don't match up, then a curve needs to be added
* to a new group
*/
if ((euf) && (euf->id == ale->id) && (strcmp(euf->rna_path, fcu->rna_path) == 0)) {
if ((euf) && (euf->id == ale->id) && (STREQ(euf->rna_path, fcu->rna_path))) {
/* this should be fine to add to the existing group then */
euf->fcurves[fcu->array_index] = fcu;
}

@ -166,7 +166,7 @@ void make_unique_prop_names(bContext *C, char *str)
/* now we check for double names, and change them */
for (nr=0; nr<propcount; nr++) {
if (names[nr]!=str && strcmp( names[nr], str )==0 ) {
if (names[nr] != str && STREQ(names[nr], str)) {
BLI_newname(str, +1);
}
}

@ -566,7 +566,7 @@ void snode_set_context(const bContext *C)
return;
}
if (snode->nodetree && strcmp(snode->nodetree->idname, snode->tree_idname) != 0) {
if (snode->nodetree && !STREQ(snode->nodetree->idname, snode->tree_idname)) {
/* current tree does not match selected type, clear tree path */
ntree = NULL;
id = NULL;

@ -775,7 +775,7 @@ static eOLDrawState tree_element_active_sequence_dup(
continue;
}
// if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
// if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name))
// XXX select_single_seq(p, 0);
p = p->next;
}

@ -1160,7 +1160,7 @@ static int need_add_seq_dup(Sequence *seq)
continue;
}
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name))
return(2);
p = p->prev;
}
@ -1172,7 +1172,7 @@ static int need_add_seq_dup(Sequence *seq)
continue;
}
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name))
return(0);
p = p->next;
}
@ -1191,7 +1191,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
continue;
}
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name))
/* ch = */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
p = p->next;
}

@ -467,7 +467,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
}
}
else if (seq->type == SEQ_TYPE_MOVIECLIP) {
if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
if (seq->clip && !STREQ(name, seq->clip->id.name + 2)) {
str_len = BLI_snprintf(str, sizeof(str), "%s: %s | %d",
name, seq->clip->id.name + 2, seq->len);
}
@ -477,7 +477,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
}
}
else if (seq->type == SEQ_TYPE_MASK) {
if (seq->mask && strcmp(name, seq->mask->id.name + 2) != 0) {
if (seq->mask && !STREQ(name, seq->mask->id.name + 2)) {
str_len = BLI_snprintf(str, sizeof(str), "%s: %s | %d",
name, seq->mask->id.name + 2, seq->len);
}

@ -987,13 +987,13 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene *scene)
// XXX if (0 == sbutton(to, 0, sizeof(to)-1, "To: "))
// return;
if (strcmp(to, from) == 0)
if (STREQ(to, from))
return;
SEQP_BEGIN (ed, seq)
{
if (seq->flag & SELECT) {
if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
if (STREQLEN(seq->strip->dir, from, strlen(from))) {
printf("found %s\n", seq->strip->dir);
/* strip off the beginning */

@ -996,7 +996,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq)
if (SEQ_HAS_PATH(actseq) && dir) {
SEQP_BEGIN (ed, seq)
{
if (SEQ_HAS_PATH(seq) && seq->strip && strcmp(seq->strip->dir, dir) == 0) {
if (SEQ_HAS_PATH(seq) && seq->strip && STREQ(seq->strip->dir, dir)) {
seq->flag |= SELECT;
changed = true;
}

@ -183,7 +183,7 @@ static GHash *text_autocomplete_build(Text *text)
const int choice_len = i_end - i_start;
if ((choice_len > seek_len) &&
(seek_len == 0 || strncmp(seek, str_sub, seek_len) == 0) &&
(seek_len == 0 || STREQLEN(seek, str_sub, seek_len)) &&
(seek != str_sub))
{
// printf("Adding: %s\n", s);

@ -549,7 +549,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
full_update |= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */
full_update |= drawcache->lheight != st->lheight_dpi; /* word-wrapping option was toggled */
full_update |= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */
full_update |= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
if (st->wordwrap) {
/* update line heights */

@ -2923,7 +2923,7 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
if (mode != TEXT_FIND && txt_has_sel(text)) {
tmp = txt_sel_to_buf(text);
if (flags & ST_MATCH_CASE) found = strcmp(st->findstr, tmp) == 0;
if (flags & ST_MATCH_CASE) found = STREQ(st->findstr, tmp);
else found = BLI_strcasecmp(st->findstr, tmp) == 0;
if (found) {

@ -216,7 +216,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
CustomTool *ct;
for (ct = st->toolshelf.first; ct; ct = ct->next) {
if (0 == strncmp(context, ct->context, OP_MAX_TYPENAME)) {
if (STREQLEN(context, ct->context, OP_MAX_TYPENAME)) {
col = uiLayoutColumn(pa->layout, true);
uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
}

@ -5354,7 +5354,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
/* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (pchanName && strcmp(pchanName, pchan->name) == 0)
if (pchanName && STREQ(pchanName, pchan->name))
insert_keyframe(reports, id, act, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
if (pchanName) MEM_freeN(pchanName);

@ -231,7 +231,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
BLI_split_file_part(abs_name, fi, sizeof(fi));
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
if (strcmp(abs_name, local_name) != 0) {
if (!STREQ(abs_name, local_name)) {
switch (checkPackedFile(local_name, pf)) {
case PF_NOFILE:
BLI_snprintf(line, sizeof(line), IFACE_("Create %s"), local_name);

@ -206,7 +206,7 @@ static void undo_clean_stack(bContext *C)
/* for when objects are converted, renamed, or global undo changes pointers... */
if (uel->type == obedit->type) {
if (strcmp(uel->id.name, obedit->id.name) == 0) {
if (STREQ(uel->id.name, obedit->id.name)) {
if (uel->validate_undo == NULL)
is_valid = true;
else if (uel->validate_undo(uel->undodata, editdata))
@ -305,7 +305,7 @@ void undo_editmode_name(bContext *C, const char *undoname)
UndoElem *uel;
for (uel = undobase.last; uel; uel = uel->prev) {
if (strcmp(undoname, uel->name) == 0)
if (STREQ(undoname, uel->name))
break;
}
if (uel && uel->prev) {
@ -321,7 +321,7 @@ int undo_editmode_valid(const char *undoname)
UndoElem *uel;
for (uel = undobase.last; uel; uel = uel->prev) {
if (strcmp(undoname, uel->name) == 0)
if (STREQ(undoname, uel->name))
break;
}
return uel != NULL;

@ -87,24 +87,24 @@ static PyObject *Freestyle_getCurrentScene(PyObject *self)
static int ramp_blend_type(const char *type)
{
if (!strcmp(type, "MIX")) return MA_RAMP_BLEND;
if (!strcmp(type, "ADD")) return MA_RAMP_ADD;
if (!strcmp(type, "MULTIPLY")) return MA_RAMP_MULT;
if (!strcmp(type, "SUBTRACT")) return MA_RAMP_SUB;
if (!strcmp(type, "SCREEN")) return MA_RAMP_SCREEN;
if (!strcmp(type, "DIVIDE")) return MA_RAMP_DIV;
if (!strcmp(type, "DIFFERENCE")) return MA_RAMP_DIFF;
if (!strcmp(type, "DARKEN")) return MA_RAMP_DARK;
if (!strcmp(type, "LIGHTEN")) return MA_RAMP_LIGHT;
if (!strcmp(type, "OVERLAY")) return MA_RAMP_OVERLAY;
if (!strcmp(type, "DODGE")) return MA_RAMP_DODGE;
if (!strcmp(type, "BURN")) return MA_RAMP_BURN;
if (!strcmp(type, "HUE")) return MA_RAMP_HUE;
if (!strcmp(type, "SATURATION")) return MA_RAMP_SAT;
if (!strcmp(type, "VALUE")) return MA_RAMP_VAL;
if (!strcmp(type, "COLOR")) return MA_RAMP_COLOR;
if (!strcmp(type, "SOFT_LIGHT")) return MA_RAMP_SOFT;
if (!strcmp(type, "LINEAR_LIGHT")) return MA_RAMP_LINEAR;
if (STREQ(type, "MIX")) return MA_RAMP_BLEND;
if (STREQ(type, "ADD")) return MA_RAMP_ADD;
if (STREQ(type, "MULTIPLY")) return MA_RAMP_MULT;
if (STREQ(type, "SUBTRACT")) return MA_RAMP_SUB;
if (STREQ(type, "SCREEN")) return MA_RAMP_SCREEN;
if (STREQ(type, "DIVIDE")) return MA_RAMP_DIV;
if (STREQ(type, "DIFFERENCE")) return MA_RAMP_DIFF;
if (STREQ(type, "DARKEN")) return MA_RAMP_DARK;
if (STREQ(type, "LIGHTEN")) return MA_RAMP_LIGHT;
if (STREQ(type, "OVERLAY")) return MA_RAMP_OVERLAY;
if (STREQ(type, "DODGE")) return MA_RAMP_DODGE;
if (STREQ(type, "BURN")) return MA_RAMP_BURN;
if (STREQ(type, "HUE")) return MA_RAMP_HUE;
if (STREQ(type, "SATURATION")) return MA_RAMP_SAT;
if (STREQ(type, "VALUE")) return MA_RAMP_VAL;
if (STREQ(type, "COLOR")) return MA_RAMP_COLOR;
if (STREQ(type, "SOFT_LIGHT")) return MA_RAMP_SOFT;
if (STREQ(type, "LINEAR_LIGHT")) return MA_RAMP_LINEAR;
return -1;
}

@ -915,7 +915,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType
outnode = link->output->node;
name = outnode->name;
if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) {
input = MEM_dupallocN(outnode->inputs.first);
input->type = type;
if (input->link)
@ -1109,7 +1109,7 @@ static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *a
if (input->source == GPU_SOURCE_ATTRIB) {
for (a=0; a<attribs->totlayer; a++) {
if (attribs->layer[a].type == input->attribtype &&
strcmp(attribs->layer[a].name, input->attribname) == 0)
STREQ(attribs->layer[a].name, input->attribname))
{
break;
}
@ -1351,7 +1351,7 @@ int GPU_link_changed(GPUNodeLink *link)
node = link->output->node;
name = node->name;
if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
if (STREQ(name, "set_value") || STREQ(name, "set_rgb")) {
input = node->inputs.first;
return (input->link != NULL);
}

@ -1141,7 +1141,7 @@ void IMB_colormanagement_validate_settings(ColorManagedDisplaySettings *display_
for (view_link = display->views.first; view_link; view_link = view_link->next) {
ColorManagedView *view = view_link->data;
if (!strcmp(view->name, view_settings->view_transform))
if (STREQ(view->name, view_settings->view_transform))
break;
}
@ -1496,7 +1496,7 @@ static bool is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSet
const char *from_colorspace = ibuf->rect_colorspace->name;
const char *to_colorspace = IMB_colormanagement_get_display_colorspace_name(view_settings, display_settings);
if (to_colorspace && !strcmp(from_colorspace, to_colorspace))
if (to_colorspace && STREQ(from_colorspace, to_colorspace))
return true;
}
@ -1625,7 +1625,7 @@ static void colormanagement_transform_ex(float *buffer, int width, int height, i
return;
}
if (!strcmp(from_colorspace, to_colorspace)) {
if (STREQ(from_colorspace, to_colorspace)) {
/* if source and destination color spaces are identical, skip
* threading overhead and simply do nothing
*/
@ -1666,7 +1666,7 @@ void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspac
return;
}
if (!strcmp(from_colorspace, to_colorspace)) {
if (STREQ(from_colorspace, to_colorspace)) {
/* if source and destination color spaces are identical, skip
* threading overhead and simply do nothing
*/
@ -2152,7 +2152,7 @@ ColorManagedDisplay *colormanage_display_get_named(const char *name)
ColorManagedDisplay *display;
for (display = global_displays.first; display; display = display->next) {
if (!strcmp(display->name, name))
if (STREQ(display->name, name))
return display;
}
@ -2257,7 +2257,7 @@ ColorManagedView *colormanage_view_get_named(const char *name)
ColorManagedView *view;
for (view = global_views.first; view; view = view->next) {
if (!strcmp(view->name, name))
if (STREQ(view->name, name))
return view;
}
@ -2373,7 +2373,7 @@ ColorSpace *colormanage_colorspace_get_named(const char *name)
ColorSpace *colorspace;
for (colorspace = global_colorspaces.first; colorspace; colorspace = colorspace->next) {
if (!strcmp(colorspace->name, name))
if (STREQ(colorspace->name, name))
return colorspace;
}
@ -2459,7 +2459,7 @@ ColorManagedLook *colormanage_look_get_named(const char *name)
ColorManagedLook *look;
for (look = global_looks.first; look; look = look->next) {
if (!strcmp(look->name, name)) {
if (STREQ(look->name, name)) {
return look;
}
}

@ -1237,7 +1237,7 @@ void IMB_free_indices(struct anim *anim)
void IMB_anim_set_index_dir(struct anim *anim, const char *dir)
{
if (strcmp(anim->index_dir, dir) == 0) {
if (STREQ(anim->index_dir, dir)) {
return;
}
BLI_strncpy(anim->index_dir, dir, sizeof(anim->index_dir));

@ -37,6 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_fileops.h"
@ -267,7 +268,7 @@ handle_app1(j_decompress_ptr cinfo)
if (length < 16) {
for (i = 0; i < length; i++) INPUT_BYTE(cinfo, neogeo[i], return false);
length = 0;
if (strncmp(neogeo, "NeoGeo", 6) == 0) memcpy(&ibuf_ftype, neogeo + 6, 4);
if (STREQLEN(neogeo, "NeoGeo", 6)) memcpy(&ibuf_ftype, neogeo + 6, 4);
ibuf_ftype = BIG_LONG(ibuf_ftype);
}
INPUT_SYNC(cinfo); /* do before skip_input_data */
@ -385,7 +386,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
* That is why we need split it to the
* common key/value here.
*/
if (strncmp(str, "Blender", 7)) {
if (!STREQLEN(str, "Blender", 7)) {
/*
* Maybe the file have text that
* we don't know "what it's", in that
@ -494,7 +495,7 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
text = MEM_mallocN(530, "stamp info read");
iptr = ibuf->metadata;
while (iptr) {
if (!strcmp(iptr->key, "None")) {
if (STREQ(iptr->key, "None")) {
jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) iptr->value, strlen(iptr->value) + 1);
goto next_stamp_info;
}

@ -76,7 +76,7 @@ bool IMB_metadata_get_field(struct ImBuf *img, const char *key, char *field, con
}
info = img->metadata;
while (info) {
if (strcmp(key, info->key) == 0) {
if (STREQ(key, info->key)) {
BLI_strncpy(field, info->value, len);
retval = true;
break;
@ -123,7 +123,7 @@ bool IMB_metadata_del_field(struct ImBuf *img, const char *key)
p = img->metadata;
p1 = NULL;
while (p) {
if (!strcmp(key, p->key)) {
if (STREQ(key, p->key)) {
if (p1)
p1->next = p->next;
else
@ -152,7 +152,7 @@ bool IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *f
p = img->metadata;
while (p) {
if (!strcmp(key, p->key)) {
if (STREQ(key, p->key)) {
MEM_freeN(p->value);
p->value = BLI_strdup(field);
return true;

@ -784,7 +784,7 @@ void IMB_exr_read_channels(void *handle)
/* check if exr was saved with previous versions of blender which flipped images */
const StringAttribute *ta = data->ifile->header().findTypedAttribute <StringAttribute> ("BlenderMultiChannel");
short flip = (ta && strncmp(ta->value().c_str(), "Blender V2.43", 13) == 0); /* 'previous multilayer attribute, flipped */
short flip = (ta && STREQLEN(ta->value().c_str(), "Blender V2.43", 13)); /* 'previous multilayer attribute, flipped */
for (echan = (ExrChannel *)data->channels.first; echan; echan = echan->next) {
@ -982,7 +982,7 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname)
if (pass == NULL) {
pass = (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass");
if (strcmp(passname, "Combined") == 0)
if (STREQ(passname, "Combined"))
BLI_addhead(lb, pass);
else
BLI_addtail(lb, pass);

@ -490,7 +490,7 @@ static void imb_png_warning(png_structp UNUSED(png_ptr), png_const_charp message
* and with new libpng it became too much picky, giving a warning on
* the splash screen even.
*/
if ((G.debug & G_DEBUG) == 0 && !strncmp(message, "iCCP", 4)) {
if ((G.debug & G_DEBUG) == 0 && STREQLEN(message, "iCCP", 4)) {
return;
}
fprintf(stderr, "libpng warning: %s\n", message);

Some files were not shown because too many files have changed in this diff Show More