Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Jan 2015 15:03:11 +0000 (16:03 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Jan 2015 15:59:24 +0000 (16:59 +0100)
Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)'
and 'strcmp(foo, bar) == 0' in several places...

133 files changed:
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_translation.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/appdir.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/customdata_file.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/property.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenkernel/intern/writeframeserver.c
source/blender/blenlib/intern/BLI_args.c
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/listbase.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationImporter.cpp
source/blender/collada/ArmatureExporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/ErrorHandler.cpp
source/blender/collada/MeshImporter.cpp
source/blender/compositor/nodes/COM_TextureNode.cpp
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/armature_add.c
source/blender/editors/armature/armature_naming.c
source/blender/editors/armature/armature_relations.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/pose_lib.c
source/blender/editors/armature/pose_utils.c
source/blender/editors/curve/editcurve.c
source/blender/editors/gpencil/editaction_gpencil.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_undo.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/resources.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_edit.c
source/blender/editors/render/render_preview.c
source/blender/editors/sculpt_paint/paint_curve.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_undo.c
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/fsmenu.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_text/text_autocomplete.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/util/ed_util.c
source/blender/editors/util/editmode_undo.c
source/blender/freestyle/intern/python/BPy_Freestyle.cpp
source/blender/gpu/intern/gpu_codegen.c
source/blender/imbuf/intern/colormanagement.c
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/metadata.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/thumbs_blend.c
source/blender/imbuf/intern/tiff.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sensor.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_ui.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_wm.c
source/blender/modifiers/intern/MOD_meshcache_pc2.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/nodes/intern/node_socket.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
source/blender/python/intern/bpy_app_translations.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/shadeoutput.c
source/blender/windowmanager/intern/wm_dragdrop.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_keymap.c
source/creator/creator.c

index 6bbf07173b9e7a8cc4d3aea1dce93e95a3776d69..127826f98c87f7a74fa5c814c7a6ea32a0cda5b4 100644 (file)
@@ -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;
                }
index e7d2c14b16f7c3d6e476be72d24f3e87ea99cf51..2a4a152f0eb37258c42b9b18cfb168b5c6bf35a7 100644 (file)
@@ -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]);
index ea168ca6a8466d23ab61669f9dc9bfc2c3d30bc6..8e2b3de9586a7611b4b06f1b422f56a505bf61d0 100644 (file)
@@ -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... */
index 9f34d5b9cd9219fbc53361ddb328d5b7ecaca969..60e81003c40390d715641124d971a18db5b4cd1d 100644 (file)
@@ -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
index 431c24d3ed0a575ab8043fc24b63868b0750b728..7d04ab7778fdef5ef6d6258d2c44dd302a9e74cb 100644 (file)
@@ -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];
 
index 8f6c9735aaf81bbc0874c40ce090d225c9e4acfa..7142c0925832b9f89e295ea6ba3c1e20cb9f7918 100644 (file)
@@ -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)
index 89ebed258a3cf0cc46df69a3928fa893c40cbe73..a259958dc0cbe292104d8c4f208040563d4c834e 100644 (file)
@@ -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;
                                }
                        }
index 97972cca30c1d6d521c1100717168407dbacd036..41579aaa568c47f39e79df24f77bf95541a9cc2b 100644 (file)
@@ -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;
        }
        
index 80db62801d6ad52df55f2b5cef7fab745fb7cd55..e2bb326b22626101ba82557e5f0288079cb5288f 100644 (file)
@@ -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;
                        }
                }
index 3541b3fba3f590901a5a6a61bf9b24de66c67969..bbc8cc314f5a7d76424fe3891af99ae21f3209be 100644 (file)
@@ -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;
 }
index 4648d70b62beea2712cd567a0e630999e7c6bec1..765917794e8883ba03baf90827d61b9ebb1727c0 100644 (file)
@@ -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;
index 8d4bb7ec058d56e736dc2a73615e40ab64c15fcf..2adf8ebc615d43e07aebdbc59b01e1b1c2ab831e 100644 (file)
@@ -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;
                        }
                }
index 2b99b5f46200febd976de06fffd6e598e7b9e397..4d83f8cf916bbbc812fcf4a4cb5f4a211ac41f06 100644 (file)
@@ -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) {
index 27165042cb2181ef6e9719acf981810a9ac189d7..4404182192e4f8b73d99423012d367fb879dbe04 100644 (file)
@@ -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;
 }
index f8c79832dfcbe0a8fdc64333fa52feed851f61af..c748568b4c56bf4c22710aacb79a25eba29e9332 100644 (file)
@@ -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;
        }
        
index 752c2961f28dfdab9a85ef1a48ece31b060264f6..4cb792da1792c3d2da9863cc8a6b47341db3985e 100644 (file)
@@ -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)
                             )
                        {
index 981064bb22a96fc4c758fcea5ae6db15ce99bee6..f8f69b8901df73fca6caaeb43f5558e5bb0c871b 100644 (file)
@@ -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;
                        }
                }
index 5649164a27336b43d0a8c492b1046b5f20c6dde1..ce20636233a6bbfe3f63cd986795a0b3ab8eadbc 100644 (file)
@@ -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
index c47d294cfb2f123795617abe2970a87205ae5bdd..8ad20df18dbe5e6f1445c73f46ad92f841cbedb6 100644 (file)
@@ -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));
index fe38fedd7aae9cf12b9b832f8af9c17edca03631..491fb46bd1feaa8786083ecfbd92d1db9eb47461 100644 (file)
@@ -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! */
 
index 039af949d81505fc7259290222e51a82a906bd7c..f30e3b699dd65c47edaf21a668b8b3f4dff7a126 100644 (file)
@@ -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);
                        
index 19ed49c727ae182366e061d556d6f0d983bef8c1..a8add058590cf6027366bac0299ce3b1d5749c8f 100644 (file)
@@ -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];
index bb04d548a44dab7e244476d80251b249353e82c8..819f4af054c57138fa990b7f360401d32e20c5fb 100644 (file)
@@ -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;
index 577dbd6d323fd1eb5390a7b3d9530d5a6cfdc9e0..8f479d4adf95d52fe81307737e2623aa0aa74bcf 100644 (file)
@@ -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)
index 3a311bfb23be0db8e36d01012282330f67fb24d6..cb2819825c2e9e8239d1882cd0353ce70bedee11 100644 (file)
@@ -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;
index d580c184a8b03a1b3751891e846e41266cdacb36..0037002f6d8b6f37ccd96dcb8f7f93245e463c73 100644 (file)
@@ -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;
index 9737ef429cbb7339a559824e4b02f426c50187f9..128a5da9b68e378eac2a53d549f0f74d52609009 100644 (file)
@@ -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
            )
        {
index 746b99ffb527a8a7300f758310547da1e103cae6..ae6b19fb0192f1354a0b1bc02e353bdede1c58fc 100644 (file)
@@ -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;
index 49a3c466727f301e7b9fdc4879bd9d6b07c82a64..9faf6c934476e2198cb13544e142b02d84d279b0 100644 (file)
@@ -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 {
index c87b60f08db40baae90e2942e043f1ea57dfa4ba..5360ea744a1453539568a75f35dfa03b31166f5e 100644 (file)
@@ -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)
index 62e1b6e4cbf503af7a884151ce5798f470556760..8ae99c0da977da17a5ea888371c610d67ae298ad 100644 (file)
@@ -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);
index bd3e1e0bbb012a452cf3837cc41d72793a6b6b63..d52c09790f94bbfffd2b14af6185b7486827e5ef 100644 (file)
@@ -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;
index 35398939ab74670eaebc6b4570e789e0a0b77ed4..0cc7524bfb5a6c7a61214d750575dfd92664febd 100644 (file)
@@ -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;
        }
 
index 4c5268562ad39e4027af115bf91982333c2f8e5b..0d09b50a52cf096a61bc56dd960b4f5496e31731 100644 (file)
@@ -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));
 }
index 5893c2275beb7a1e03fd2c2292f088ef072bbd81..34ad6d3ea614aff83ca2deaff2a5b0b93a836790 100644 (file)
@@ -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);
index a28ca7d187a3f336de4cd55f0c3d7db095128e0b..5dae6fbc46406da0743c8e857288168bcf9af13b 100644 (file)
@@ -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;
                                }
index f2c057d32d8929c1c6eb6963d05bdc3693462daa..9077db524db21091332fa6ea1b96069cdc11f2d7 100644 (file)
@@ -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())
index 6e2d337a32e2d00dadca759c01ffe008993b9e59..7e937e4278716aacc70d6c10164b8f1e9001c60f 100644 (file)
@@ -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)
                                         */
index 5ce62873377b220d9a52c34dd8adf6adbe3c22c4..36ab85b9b5b096e2126762c206d7463455a8acd8 100644 (file)
@@ -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);
 
index 7ffd300c6dede058b27522cbc015780983e34c45..c2ee6170470b8072ab981996e696801b75f2daf7 100644 (file)
@@ -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;
        }
 
index 854e8abd76ddf7d22ba95319c6b01e78ec805829..b271604f839db968c5d436da0c7346422cd5db4b 100644 (file)
@@ -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;
                        }
index 571faf8c2e933e07fe796655bb2d45433975caa0..3c6c90068debefddd6d0fc91f13e11edd08651b7 100644 (file)
@@ -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);
index 2ac027ca32654c583fa81f36e0ad4893b084a6c8..b80ca2fcdbd5f6ec82ccf8278009844e21c332ee 100644 (file)
@@ -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);
index 7ac11c1cd06d52b60fdfff276fc0452bfb980c15..3784cd5621e5492b1d9a6d5dcf18ec24c02a9309 100644 (file)
@@ -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;
                                                }
index 6c2cc10f2a37db1d0a60cc3b71036b19c74c778b..4b9a629183e42833f64c879810979d03294ecb7d 100644 (file)
@@ -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);
index eba1bc4d78d52df00ca941e30a56ec1b3f52f33e..22aaeccc4a8a0f22bfb3088b69772b0b546cefcb 100644 (file)
@@ -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;
                }
        }
index f984bf071fa9896579c60a7d68cc1e9a6d69bd2b..a8b5f888597012d6a4b375eb434255e3452a6abc 100644 (file)
@@ -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);
                                                                }
                                                        }
index 41f528bc5e24eb36d339a35a4e9e9fb1ec075044..53989dd783c26ecbdb345ece8c330975dee7b782 100644 (file)
@@ -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 */
index aace8c5434c264e9810f581c899c5cc95bb7e423..5376fc8c79b7301c1cbca012e7f3e39ff1077cd4 100644 (file)
@@ -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;
                                }
                        }
index 3dbf7b4b65af731304f033d3330498c9e22967f5..6c2d4256a0fd0ff7877c85fb90b70ea36deda241 100644 (file)
@@ -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;
                        }
index 2e6eace88aacc6ce228c90d5a8fd77178d52fd30..d571fb374d912f43110498ae890d9518b7a5561c 100644 (file)
@@ -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);
                        
index 1297755b7d067fa634b2aa7849d32eeca9ce0156..2ba1eedd33b9acd49a12d679d52cb02750a9c321 100644 (file)
@@ -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;
        }
        
index f17c46252c4f0cb04e08974f1a59b1f83c73537a..51c621cbf199f2a47d3a9a4ea70c9ad5a08c7da2 100644 (file)
@@ -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;
index 97adaea41a844c0493522ec3e0c3a825b4cc5a8d..a2ba6216f9cfd6d68023e9426b80740529fb20a3 100644 (file)
@@ -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;
                }
                
index caa22a4fde28733d11a468b0e90747995c89c954..0f1be590e9c88fe0fd7f12aa8806a510751c49b3 100644 (file)
@@ -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;
                        }
                }
index 5f0647fb43d5e9745351a61bdba409d20a89b526..34e640a4b7baf1ea81c66c6dbedd3ac4cfc3cd66 100644 (file)
@@ -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;
                        }
index 0b1d1c8c30c0c34ad61d7d2978e3e6f0dd4256dc..8fa604d57cb4e93342348dfe07952c07a4b29db6 100644 (file)
@@ -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;
index 074faaa86bcd903767d4793d69a550020d16658f..9bd09b571db2e3b371527a810e02eae9c1b9879f 100644 (file)
@@ -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;
        }
index 21e7b8eef9728ae501ed8ee84ef78eaded6f8821..b6a93c8306da71c02033ab7c820a51cc156fbd73 100644 (file)
@@ -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;
index 407843d663c952176ff12adf058882deb8b1f987..56ab27821d74a910a7d8840857269a912d78e628 100644 (file)
@@ -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;
index aa5b2570952536e56b53b67e36cd4d14944b5fd1..fb174e113b17dc0901179cef4f85e5dfb25d7b35 100644 (file)
@@ -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");
                }
        }
index 19040062fda021a57fdb90d48eaae92378c590be..dee216d9c7324ca11bc919f5705112ca11badb7c 100644 (file)
@@ -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;
                                                                        }
index 2596ea0a0647a902329c0abdf3d1d485b73ac280..8f793f7f7f9b8e75094cd96e16ebb3c5638b6f41 100644 (file)
@@ -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;
index 93956128b845828cc703bd3cb31f808aac5caef8..62c27d8922dd0e6b9dea76268df2d9fc0878f440 100644 (file)
@@ -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)
index 16874bd49dc36757cea8781654b9da9b1c112cf2..99edaff759e0b3521be7e5a96e499d876d76e4c0 100644 (file)
@@ -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
index 1f5ee708ad08bee9a4b8cae66cb7aaa3b7d962eb..439c2a639bdcd793dcbe5a981d21cc0df2d3c06f 100644 (file)
@@ -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);
index df38117f376d6578c0f5912d903d3627db76dbd4..5cfbd164153f83eb2d58a481936632a677875fad 100644 (file)
@@ -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
index 20e3155c01d32210f32f4a2dffd30ec23cdc5760..0293a0bfc00cc85b3220810eaf0b13dcd931df7f 100644 (file)
@@ -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;
index 4e9d23d3d97b96c198118cece3f4e8d050a167c4..a4adbc6bca8dc19e147d229a8d66a74c1178267b 100644 (file)
@@ -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);
 
index d9f4b97fe094ae4ea946332c6b781cf4739eebad..5ce3517696e614b2f13b9d1ae3a0b27c359e1c09 100644 (file)
@@ -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)
index a67af289f593085894fa47f5c608d1d5c65bd837..a263f22e072a51f6987824a14c30fb4915a35547 100644 (file)
@@ -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;
index 2d5e5c6e0f2e16792dba5acf0140f7bb21b1887e..8263268898f4a2fd04e31348c2579c9cbcc67613 100644 (file)
@@ -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;
                }
index a2e8eeaa058ae8c7a464e0ea7abbbc4b904b3365..836e1f807655f509c39d65947352c12b87f2407f 100644 (file)
@@ -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 */
index 3a579820106560d369f4d43befdff347f674bcf6..697ac23c84d52b379064b74f0073a2c1e3d8f3b3 100644 (file)
@@ -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);
                                }
index bcef0817ffe77a711d4f1d1cba88bab9f583be64..bf9c66267061533c86593d83eb3724a3037ee2b5 100644 (file)
@@ -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;
                }
index 3e663275dcd28954d5774c1acef1b76c0cb05a96..815faa1c223b2433020e74e42367a9947d0994de 100644 (file)
@@ -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 {
index 4ab9bc6a849ec4d930280bc1d5e6ee714f074e3b..05dfdf66ab6300eaa50a078535ffd0b6c474428f 100644 (file)
@@ -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);
index b87f80c4e6256bf011fd2504048dc87b2e910002..2944901663b0ac1d4a2ed3357ebf30b35d787748 100644 (file)
@@ -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;
                }
index 21a9246d7e6ee31cf4ec1febde005ec490384875..9e87fe02da13389e1d39bc487e46e08d7fc320c7 100644 (file)
@@ -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);
                }
        }
index 1e258368b8b68c0a4c818f98219c99bc4cd2f839..f79d6e26f22bd779286cf276889c518918ba6f5c 100644 (file)
@@ -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;
index 23586a6a509c2ccdcb4eb388150b6cf448d3e57f..a98f57fa8ffd120d7dcc5e9eacded4fe26996954 100644 (file)
@@ -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;
        }
index a4b12311fdec8bcae0762022fd29bc40b55a3b0a..c7cd4fa29d15acde24fc92c6a55b628a19549d9a 100644 (file)
@@ -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;
        }
index 3233c4192b9f5435f8dfdd0f3d5e9d35b19c83d9..6d7e4ad1d8d7b585633aa4eba4a83b3cc41f7917 100644 (file)
@@ -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);
                }
index 81af6dccc709bc0e7fa0a51ac28a90383a7101ba..5f9900d10e316f9102ee5e9caa673cf100644358 100644 (file)
@@ -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 */
index 6792bbe0577e51abfb42c4da6b92922e65e3f3b3..4fbe0c6a24190f79dd6a265a1232bee201b1426d 100644 (file)
@@ -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;
                        }
index 99e1606c9bd73c2669c23d3c3b13f17bd1eca3b9..19af71c9139a33de8cc96ea4f5c83d4959a7bae0 100644 (file)
@@ -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);
index bc5c56c3e58da89ed8f9cb1d5d3895153a27e94f..462b619f497e6a60c23f35f0992fba0bdde73814 100644 (file)
@@ -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 */
index 1185d37f813ef6b67d772c4d7719dc07317df690..ad8050a50e8e017c63f599e395e3a2cc7dd2a114 100644 (file)
@@ -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) {
index f127f375a9fcb1702a942a62e3a2940d3da1b23d..af24a99a6f2d44a01ab5d6d2834955acb47ed5ba 100644 (file)
@@ -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);
                        }
index 9c59ff125dd8ece780dde61ab760a4d7beafd8c8..cf4f1b02832d0ae74869215ca5432765423afe12 100644 (file)
@@ -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);
index 32d4f2e5a15781f94a68ded072729dab2e27bbf0..438eb1f38647ff631ed83e23a84ca48592c88781 100644 (file)
@@ -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);
index 2428ee213678f2baeebb77bd4a6c8969eec32f70..7f5edb5ea9ed024bce6f2989fd7929cfc9cd2ebe 100644 (file)
@@ -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;
index f4ead300d5e3cbc8860c41af33f1b7a474c6c62c..487a473b7bdef345ebd7e4d45dbb5e65b41736b7 100644 (file)
@@ -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;
 }
 
index 56a753ff76820b4fca66a826e253dec776fc3b93..e77ea32e574b4321224adb729e41353266633105 100644 (file)
@@ -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);
                }
index e5e22da1524bca009cc4dc02b3fc5fe428ec5a2d..95e166b2f8b623475c3a1cacae60d2de424d1f9a 100644 (file)
@@ -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;
                }
        }
index e66be77ecaf56ff224eb495d01b6ebaba74b6347..e067cd640226244a89338ade3f3c0efc13c443bd 100644 (file)
@@ -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));
index f4b5f9878693ef65b0e761032fcb7c4c70074d03..6093a1477cec17990cf646e15e2565fc388603de 100644 (file)
@@ -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;
                        }
index 797d34d118b1622fc7fb2b293dbbee728cfb1969..35d921beabd0680c21d4e3a7608e60ac12ee6993 100644 (file)
@@ -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;
index ba1bda640a61b4cc5c5b74df30584f7732828207..ad19c547db35ab00dee1e6225998de95ca6ea811 100644 (file)
@@ -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);
index 3266dc97c786f7c264dd7c1595a2509d2ea5232d..94914db3a1a80345d24723071fab68460957ee8e 100644 (file)
@@ -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);
index af353461f1f5dbaf85cd57c5e7cdaf0526129911..aee465c49ccb6786b39d6e24bb24be4f0b636687 100644 (file)
@@ -55,7 +55,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
        /* read the blend file header */
        if (gzread(gzfile, buf, 12) != 12)
                return NULL;
-       if (strncmp(buf, "BLENDER", 7))
+       if (!STREQLEN(buf, "BLENDER", 7))
                return NULL;
 
        if (buf[7] == '-')
index e3b8e27138798932fe08970e5a62231c34675012..dca10fd7eda6130fb9246fd1ca7859f948d6b684 100644 (file)
@@ -594,7 +594,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags, char colorspace[
                format = NULL;
                TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format);
 
-               if (format && strcmp(format, "Plain Texture") == 0 && TIFFIsTiled(image)) {
+               if (format && STREQ(format, "Plain Texture") && TIFFIsTiled(image)) {
                        int numlevel = TIFFNumberOfDirectories(image);
 
                        /* create empty mipmap levels in advance */
index 92a509d4d569091468b552e9c92e027ce3771038..ec285bc448cb3602927837cdc91764a616748b8d 100644 (file)
@@ -221,11 +221,11 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
 
 static const char *rna_safe_id(const char *id)
 {
-       if (strcmp(id, "default") == 0)
+       if (STREQ(id, "default"))
                return "default_value";
-       else if (strcmp(id, "operator") == 0)
+       else if (STREQ(id, "operator"))
                return "operator_value";
-       else if (strcmp(id, "new") == 0)
+       else if (STREQ(id, "new"))
                return "create";
 
        return id;
@@ -246,11 +246,11 @@ static int cmp_property(const void *a, const void *b)
        const PropertyRNA *propa = *(const PropertyRNA **)a;
        const PropertyRNA *propb = *(const PropertyRNA **)b;
 
-       if (strcmp(propa->identifier, "rna_type") == 0) return -1;
-       else if (strcmp(propb->identifier, "rna_type") == 0) return 1;
+       if (STREQ(propa->identifier, "rna_type")) return -1;
+       else if (STREQ(propb->identifier, "rna_type")) return 1;
 
-       if (strcmp(propa->identifier, "name") == 0) return -1;
-       else if (strcmp(propb->identifier, "name") == 0) return 1;
+       if (STREQ(propa->identifier, "name")) return -1;
+       else if (STREQ(propb->identifier, "name")) return 1;
 
        return strcmp(propa->name, propb->name);
 }
@@ -372,7 +372,7 @@ static StructRNA *rna_find_struct(const char *identifier)
        StructDefRNA *ds;
 
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
-               if (strcmp(ds->srna->identifier, identifier) == 0)
+               if (STREQ(ds->srna->identifier, identifier))
                        return ds->srna;
 
        return NULL;
@@ -383,7 +383,7 @@ static const char *rna_find_type(const char *type)
        StructDefRNA *ds;
 
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
-               if (ds->dnaname && strcmp(ds->dnaname, type) == 0)
+               if (ds->dnaname && STREQ(ds->dnaname, type))
                        return ds->srna->identifier;
 
        return NULL;
@@ -394,7 +394,7 @@ static const char *rna_find_dna_type(const char *type)
        StructDefRNA *ds;
 
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
-               if (strcmp(ds->srna->identifier, type) == 0)
+               if (STREQ(ds->srna->identifier, type))
                        return ds->dnaname;
 
        return NULL;
@@ -621,9 +621,9 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                        fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
                        fprintf(f, "{\n");
                        if (manualfunc) {
-                               if (strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
-                                   strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
-                                   strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
+                               if (STREQ(manualfunc, "rna_iterator_listbase_get") ||
+                                   STREQ(manualfunc, "rna_iterator_array_get") ||
+                                   STREQ(manualfunc, "rna_iterator_array_dereference_get"))
                                {
                                        fprintf(f, "    return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
                                                (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType", manualfunc);
@@ -1168,8 +1168,8 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
                        return NULL;
 
                /* only supported in case of standard next functions */
-               if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {}
-               else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {}
+               if (STREQ(nextfunc, "rna_iterator_array_next")) {}
+               else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {}
                else return NULL;
        }
 
@@ -1190,7 +1190,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
        fprintf(f, "    %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
        fprintf(f, "    if (iter.valid) {\n");
 
-       if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {
+       if (STREQ(nextfunc, "rna_iterator_array_next")) {
                fprintf(f, "            ArrayIterator *internal = &iter.internal.array;\n");
                fprintf(f, "            if (index < 0 || index >= internal->length) {\n");
                fprintf(f, "#ifdef __GNUC__\n");
@@ -1210,7 +1210,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
                fprintf(f, "                    found = 1;\n");
                fprintf(f, "            }\n");
        }
-       else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {
+       else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
                fprintf(f, "            ListBaseIterator *internal = &iter.internal.listbase;\n");
                fprintf(f, "            if (internal->skip) {\n");
                fprintf(f, "                    while (index-- > 0 && iter.valid) {\n");
@@ -1396,23 +1396,23 @@ static void rna_set_raw_property(PropertyDefRNA *dp, PropertyRNA *prop)
        if (!dp->dnatype || !dp->dnaname || !dp->dnastructname)
                return;
        
-       if (strcmp(dp->dnatype, "char") == 0) {
+       if (STREQ(dp->dnatype, "char")) {
                prop->rawtype = PROP_RAW_CHAR;
                prop->flag |= PROP_RAW_ACCESS;
        }
-       else if (strcmp(dp->dnatype, "short") == 0) {
+       else if (STREQ(dp->dnatype, "short")) {
                prop->rawtype = PROP_RAW_SHORT;
                prop->flag |= PROP_RAW_ACCESS;
        }
-       else if (strcmp(dp->dnatype, "int") == 0) {
+       else if (STREQ(dp->dnatype, "int")) {
                prop->rawtype = PROP_RAW_INT;
                prop->flag |= PROP_RAW_ACCESS;
        }
-       else if (strcmp(dp->dnatype, "float") == 0) {
+       else if (STREQ(dp->dnatype, "float")) {
                prop->rawtype = PROP_RAW_FLOAT;
                prop->flag |= PROP_RAW_ACCESS;
        }
-       else if (strcmp(dp->dnatype, "double") == 0) {
+       else if (STREQ(dp->dnatype, "double")) {
                prop->rawtype = PROP_RAW_DOUBLE;
                prop->flag |= PROP_RAW_ACCESS;
        }
@@ -1525,7 +1525,7 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        const char *nextfunc = (const char *)cprop->next;
                        const char *item_type = (const char *)cprop->item_type;
 
-                       if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
+                       if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
                                /* pass */
                        }
                        else if (dp->dnalengthname || dp->dnalengthfixed) {
@@ -1535,8 +1535,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        /* test if we can allow raw array access, if it is using our standard
                         * array get/next function, we can be sure it is an actual array */
                        if (cprop->next && cprop->get)
-                               if (strcmp((const char *)cprop->next, "rna_iterator_array_next") == 0 &&
-                                   strcmp((const char *)cprop->get, "rna_iterator_array_get") == 0)
+                               if (STREQ((const char *)cprop->next, "rna_iterator_array_next") &&
+                                   STREQ((const char *)cprop->get, "rna_iterator_array_get"))
                                {
                                        prop->flag |= PROP_RAW_ARRAY;
                                }
@@ -2419,11 +2419,11 @@ static void rna_auto_types(void)
 
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
                /* DNA name for Screen is patched in 2.5, we do the reverse here .. */
-               if (ds->dnaname && strcmp(ds->dnaname, "Screen") == 0)
+               if (ds->dnaname && STREQ(ds->dnaname, "Screen"))
                        ds->dnaname = "bScreen";
 
                for (dp = ds->cont.properties.first; dp; dp = dp->next) {
-                       if (dp->dnastructname && strcmp(dp->dnastructname, "Screen") == 0)
+                       if (dp->dnastructname && STREQ(dp->dnastructname, "Screen"))
                                dp->dnastructname = "bScreen";
 
                        if (dp->dnatype) {
@@ -2443,7 +2443,7 @@ static void rna_auto_types(void)
                                else if (dp->prop->type == PROP_COLLECTION) {
                                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
 
-                                       if (!cprop->item_type && !cprop->get && strcmp(dp->dnatype, "ListBase") == 0)
+                                       if (!cprop->item_type && !cprop->get && STREQ(dp->dnatype, "ListBase"))
                                                cprop->item_type = (StructRNA *)rna_find_type(dp->dnatype);
                                }
                        }
@@ -2786,7 +2786,7 @@ static void rna_generate_struct_prototypes(FILE *f)
                                                const char *struct_name = rna_parameter_type_name(dp->prop);
 
                                                for (a = 0; a < all_structures; a++) {
-                                                       if (strcmp(struct_name, structures[a]) == 0) {
+                                                       if (STREQ(struct_name, structures[a])) {
                                                                found = 1;
                                                                break;
                                                        }
@@ -3417,7 +3417,7 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
                if (!filename || ds->filename == filename)
                        rna_generate_struct(brna, ds->srna, f);
 
-       if (strcmp(filename, "rna_ID.c") == 0) {
+       if (STREQ(filename, "rna_ID.c")) {
                /* this is ugly, but we cannot have c files compiled for both
                 * makesrna and blender with some build systems at the moment */
                fprintf(f, "#include \"rna_define.c\"\n\n");
@@ -3779,7 +3779,7 @@ static int rna_is_collection_functions_struct(const char **collection_structs, c
        int a = 0, found = 0;
 
        while (collection_structs[a]) {
-               if (!strcmp(collection_structs[a], struct_name)) {
+               if (STREQ(collection_structs[a], struct_name)) {
                        found = 1;
                        break;
                }
@@ -3880,7 +3880,7 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
                srna = ds->srna;
 
-               if (!strcmp(srna->identifier, first_collection_func_struct)) {
+               if (STREQ(srna->identifier, first_collection_func_struct)) {
                        StructDefRNA *ds2;
                        StructRNA *srna2;
 
index 09b970fe7fd2e18a0f1792bdfd01f3b14b9ef8dc..7096060e73b106678b28332812edef65eb76edd3 100644 (file)
@@ -241,13 +241,13 @@ static IDProperty *rna_idproperty_ui(PropertyRNA *prop)
        IDProperty *idprop;
 
        for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) {
-               if (strcmp(RNA_IDP_UI, idprop->name) == 0)
+               if (STREQ(RNA_IDP_UI, idprop->name))
                        break;
        }
 
        if (idprop == NULL) {
                for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) {
-                       if (strcmp(RNA_IDP_UI, idprop->name) == 0)
+                       if (STREQ(RNA_IDP_UI, idprop->name))
                                break;
                }
        }
@@ -511,7 +511,7 @@ StructRNA *RNA_struct_find(const char *identifier)
        StructRNA *type;
        if (identifier) {
                for (type = BLENDER_RNA.structs.first; type; type = type->cont.next)
-                       if (strcmp(type->identifier, identifier) == 0)
+                       if (STREQ(type->identifier, identifier))
                                return type;
        }
        return NULL;
@@ -719,7 +719,7 @@ FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier)
 
        RNA_PROP_BEGIN (&tptr, funcptr, iterprop)
        {
-               if (strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
+               if (STREQ(identifier, RNA_function_identifier(funcptr.data))) {
                        func = funcptr.data;
                        break;
                }
@@ -3229,7 +3229,7 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
 
                                nameptr = RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
 
-                               if ((keylen == namelen) && (strcmp(nameptr, key) == 0)) {
+                               if ((keylen == namelen) && STREQ(nameptr, key)) {
                                        *r_ptr = iter.ptr;
                                        found = 1;
                                }
@@ -5264,7 +5264,7 @@ char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
        {
                propname = RNA_property_identifier(prop);
                
-               if (strcmp(propname, "rna_type") == 0)
+               if (STREQ(propname, "rna_type"))
                        continue;
                
                if (first_time == 0)
@@ -5335,7 +5335,7 @@ char *RNA_pointer_as_string_keywords_ex(bContext *C, PointerRNA *ptr,
 
                arg_name = RNA_property_identifier(prop);
 
-               if (strcmp(arg_name, "rna_type") == 0) {
+               if (STREQ(arg_name, "rna_type")) {
                        continue;
                }
 
@@ -5632,7 +5632,7 @@ PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *f
 
        parm = func->cont.properties.first;
        for (; parm; parm = parm->next)
-               if (strcmp(RNA_property_identifier(parm), identifier) == 0)
+               if (STREQ(RNA_property_identifier(parm), identifier))
                        break;
 
        return parm;
@@ -5830,7 +5830,7 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void
 
        parm = parms->func->cont.properties.first;
        for (; parm; parm = parm->next)
-               if (strcmp(RNA_property_identifier(parm), identifier) == 0)
+               if (STREQ(RNA_property_identifier(parm), identifier))
                        break;
 
        if (parm)
@@ -5886,7 +5886,7 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, cons
 
        parm = parms->func->cont.properties.first;
        for (; parm; parm = parm->next)
-               if (strcmp(RNA_property_identifier(parm), identifier) == 0)
+               if (STREQ(RNA_property_identifier(parm), identifier))
                        break;
 
        if (parm)
@@ -6713,7 +6713,7 @@ bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, eRNAEq
                        int len_a, len_b;
                        char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a);
                        char *value_b = RNA_property_string_get_alloc(b, prop, fixed_b, sizeof(fixed_b), &len_b);
-                       bool equals = strcmp(value_a, value_b) == 0;
+                       bool equals = STREQ(value_a, value_b);
 
                        if (value_a != fixed_a) MEM_freeN(value_a);
                        if (value_b != fixed_b) MEM_freeN(value_b);
index 6792dd7e5f8ea7ef1f4bd1d33bbd5aad9a788e2b..9c7d66d00c71f8a7716aa98088913faac3ded482 100644 (file)
@@ -494,11 +494,11 @@ static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scen
                bPoseChannel *pchan;
                bPose *pose = ob->pose;
                for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-                       if (!strcmp(pchan->name, posechannel)) {
+                       if (STREQ(pchan->name, posechannel)) {
                                /* found it, now look for constraint channel */
                                bConstraint *con;
                                for (con = pchan->constraints.first; con; con = con->next) {
-                                       if (!strcmp(con->name, constraint)) {
+                                       if (STREQ(con->name, constraint)) {
                                                /* found it, all ok */
                                                return;
                                        }
index e858381b567e5721281bfd2246a8794c86c27fbf..e4696d87992b244e1f4de40540d30891e1f97107 100644 (file)
@@ -343,7 +343,7 @@ static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value)
        KeyingSet *ks = (KeyingSet *)ptr->data;
        
        /* update names of corresponding groups if name changes */
-       if (strcmp(ks->name, value)) {
+       if (!STREQ(ks->name, value)) {
                KS_Path *ksp;
                
                for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
@@ -359,7 +359,7 @@ static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value)
                                         * conflicts
                                         */
                                        for (agrp = adt->action->groups.first; agrp; agrp = agrp->next) {
-                                               if (strcmp(ks->name, agrp->name) == 0) {
+                                               if (STREQ(ks->name, agrp->name)) {
                                                        /* there should only be one of these in the action, so can stop... */
                                                        BLI_strncpy(agrp->name, value, sizeof(agrp->name));
                                                        break;
index 54c08009792548dacd4e316e5f6c33927cc5d613..7773b4c8f23cfabf7cd4ccab20137c3692167b89 100644 (file)
@@ -109,7 +109,7 @@ PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier)
 
        for (link = listbase->first; link; link = link->next) {
                PropertyRNA *prop = ((PropertyDefRNA *)link)->prop;
-               if (prop && (strcmp(prop->identifier, identifier) == 0)) {
+               if (prop && (STREQ(prop->identifier, identifier))) {
                        return (PropertyDefRNA *)link;
                }
        }
@@ -428,7 +428,7 @@ static int rna_validate_identifier(const char *identifier, char *error, bool pro
        }
        
        for (a = 0; kwlist[a]; a++) {
-               if (strcmp(identifier, kwlist[a]) == 0) {
+               if (STREQ(identifier, kwlist[a])) {
                        strcpy(error, "this keyword is reserved by python");
                        return 0;
                }
@@ -442,7 +442,7 @@ static int rna_validate_identifier(const char *identifier, char *error, bool pro
                };
 
                for (a = 0; kwlist_prop[a]; a++) {
-                       if (strcmp(identifier, kwlist_prop[a]) == 0) {
+                       if (STREQ(identifier, kwlist_prop[a])) {
                                strcpy(error, "this keyword is reserved by python");
                                return 0;
                        }
@@ -496,7 +496,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
        }
        
        for (a = 0; kwlist[a]; a++) {
-               if (strcmp(identifier, kwlist[a]) == 0) {
+               if (STREQ(identifier, kwlist[a])) {
                        /* this keyword is reserved by python.
                         * just replace the last character by '_' to keep it readable.
                         */
@@ -513,7 +513,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
                };
 
                for (a = 0; kwlist_prop[a]; a++) {
-                       if (strcmp(identifier, kwlist_prop[a]) == 0) {
+                       if (STREQ(identifier, kwlist_prop[a])) {
                                /* this keyword is reserved by python.
                                 * just replace the last character by '_' to keep it readable.
                                 */
@@ -814,7 +814,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
        if (from) {
                /* find struct to derive from */
                for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next)
-                       if (strcmp(srnafrom->identifier, from) == 0)
+                       if (STREQ(srnafrom->identifier, from))
                                break;
 
                if (!srnafrom) {
@@ -896,7 +896,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct
 
        /* find struct to derive from */
        for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next)
-               if (strcmp(srnafrom->identifier, structname) == 0)
+               if (STREQ(srnafrom->identifier, structname))
                        break;
 
        if (!srnafrom) {
@@ -1871,15 +1871,15 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
                }
 
                /* SDNA doesn't pass us unsigned unfortunately .. */
-               if (dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
+               if (dp->dnatype && STREQ(dp->dnatype, "char")) {
                        iprop->hardmin = iprop->softmin = CHAR_MIN;
                        iprop->hardmax = iprop->softmax = CHAR_MAX;
                }
-               else if (dp->dnatype && strcmp(dp->dnatype, "short") == 0) {
+               else if (dp->dnatype && STREQ(dp->dnatype, "short")) {
                        iprop->hardmin = iprop->softmin = SHRT_MIN;
                        iprop->hardmax = iprop->softmax = SHRT_MAX;
                }
-               else if (dp->dnatype && strcmp(dp->dnatype, "int") == 0) {
+               else if (dp->dnatype && STREQ(dp->dnatype, "int")) {
                        iprop->hardmin = INT_MIN;
                        iprop->hardmax = INT_MAX;
 
@@ -1923,7 +1923,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
                        }
                }
 
-               if (dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
+               if (dp->dnatype && STREQ(dp->dnatype, "char")) {
                        fprop->hardmin = fprop->softmin = 0.0f;
                        fprop->hardmax = fprop->softmax = 1.0f;
                }
@@ -2060,7 +2060,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
                        }
                }
 
-               if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
+               if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
                        cprop->next = (PropCollectionNextFunc)"rna_iterator_listbase_next";
                        cprop->get = (PropCollectionGetFunc)"rna_iterator_listbase_get";
                        cprop->end = (PropCollectionEndFunc)"rna_iterator_listbase_end";
@@ -3427,7 +3427,7 @@ int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *ide
        PropertyRNA *prop;
        
        for (prop = cont->properties.first; prop; prop = prop->next) {
-               if (strcmp(prop->identifier, identifier) == 0) {
+               if (STREQ(prop->identifier, identifier)) {
                        if (prop->flag & PROP_RUNTIME) {
                                rna_def_property_free(cont_, prop);
                                return 1;
index 18bfea026e15d02825234e3f8cf5ad6747f6461b..a7e0ed272993f5cc3b5da631a9f264880b66b0c0 100644 (file)
@@ -611,7 +611,7 @@ static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value
        Object *ob = (Object *)ptr->id.data;
        CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
 
-       if (external && strcmp(external->filename, value)) {
+       if (external && !STREQ(external->filename, value)) {
                BLI_strncpy(external->filename, value, sizeof(external->filename));
                multires_force_external_reload(ob);
        }
index f9a76005df80785ad96be980c241c3fcdee1bf60..60cf753513520694eeb8baf658e8275637870b0d 100644 (file)
@@ -640,7 +640,7 @@ void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *resul
                for (a = 0; a < me->pdata.totlayer; a++) {
                        layer = &me->pdata.layers[a];
 
-                       if (layer->type == CD_MTEXPOLY && strcmp(layer->name, value) == 0) {
+                       if (layer->type == CD_MTEXPOLY && STREQ(layer->name, value)) {
                                BLI_strncpy(result, value, maxlen);
                                return;
                        }
@@ -663,7 +663,7 @@ void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *res
                for (a = 0; a < me->fdata.totlayer; a++) {
                        layer = &me->fdata.layers[a];
 
-                       if (layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
+                       if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
                                BLI_strncpy(result, value, maxlen);
                                return;
                        }
index cd28c60866702be5d019a9762d54aff5b70ff644..4cc098fb4a6d78ebbdeb00880e6899750cea02b4 100644 (file)
@@ -190,7 +190,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
                for (pid = pidlist.first; pid; pid = pid->next) {
                        if (pid->cache == cache)
                                pid2 = pid;
-                       else if (cache->name[0] != '\0' && strcmp(cache->name, pid->cache->name) == 0) {
+                       else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) {
                                /*TODO: report "name exists" to user */
                                BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
                                new_name = 0;
index 6db9c8e9cd9803c3c47e6891f217ef0ef017582c..124a83a5f303e59bce46d799340bf417d7155b79 100644 (file)
@@ -267,7 +267,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
 
        /* check if we have registered this engine type before, and remove it */
        for (et = R_engines.first; et; et = et->next) {
-               if (strcmp(et->idname, dummyet.idname) == 0) {
+               if (STREQ(et->idname, dummyet.idname)) {
                        if (et->ext.srna)
                                rna_RenderEngine_unregister(bmain, et->ext.srna);
                        break;
index 4f51ec5468c1972852d1d0a8ca1ec55fee15d399..b2c135cd1f929d8141a81b2020fa58398e039a65 100644 (file)
@@ -179,7 +179,7 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
         * for the second loop where we go over unknown id properties */
        do {
                for (prop = ptype->cont.properties.first; prop; prop = prop->next)
-                       if ((prop->flag & PROP_BUILTIN) == 0 && strcmp(prop->identifier, idprop->name) == 0)
+                       if ((prop->flag & PROP_BUILTIN) == 0 && STREQ(prop->identifier, idprop->name))
                                return 1;
        } while ((ptype = ptype->base));
 
@@ -386,7 +386,7 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
                }
                else {
                        for (prop = srna->cont.properties.first; prop; prop = prop->next) {
-                               if (!(prop->flag & PROP_BUILTIN) && strcmp(prop->identifier, key) == 0) {
+                               if (!(prop->flag & PROP_BUILTIN) && STREQ(prop->identifier, key)) {
                                        propptr.type = &RNA_Property;
                                        propptr.data = prop;
 
@@ -408,7 +408,7 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
 
                if (group) {
                        for (idp = group->data.group.first; idp; idp = idp->next) {
-                               if (strcmp(idp->name, key) == 0) {
+                               if (STREQ(idp->name, key)) {
                                        propptr.type = &RNA_Property;
                                        propptr.data = idp;
 
@@ -1002,7 +1002,7 @@ static int rna_BlenderRNA_structs_lookup_string(PointerRNA *ptr, const char *key
 {
        StructRNA *srna = ((BlenderRNA *)ptr->data)->structs.first;
        for (; srna; srna = srna->cont.next) {
-               if (key[0] == srna->identifier[0] && strcmp(key, srna->identifier) == 0) {
+               if (key[0] == srna->identifier[0] && STREQ(key, srna->identifier)) {
                        RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
                        return true;
                }
index 7dd0185b3c642b907b4b7774c12bb75d85b28760..1cc9ef15f08d9996428d8a2c51087c0ba810c743 100644 (file)
@@ -385,7 +385,7 @@ static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key
        Base *base;
 
        for (base = scene->base.first; base; base = base->next) {
-               if (strncmp(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2) == 0) {
+               if (STREQLEN(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2)) {
                        *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
                        return true;
                }
@@ -1158,7 +1158,7 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr)
        int a = 0;
 
        for (type = R_engines.first; type; type = type->next, a++)
-               if (strcmp(type->idname, rd->engine) == 0)
+               if (STREQ(type->idname, rd->engine))
                        return a;
        
        return 0;
@@ -1243,7 +1243,7 @@ static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
        RenderEngineType *type;
 
        for (type = R_engines.first; type; type = type->next)
-               if (strcmp(type->idname, rd->engine) == 0)
+               if (STREQ(type->idname, rd->engine))
                        return (type->flag & RE_GAME);
        
        return 0;
index 3944b59dff7eeabc03a8766a04fc20788109c18f..28b7b5fbcd8f421513ee0b41946ad38e648d9813 100644 (file)
@@ -246,11 +246,11 @@ static void rna_Sensor_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
                bPoseChannel *pchan;
                bPose *pose = ob->pose;
                for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-                       if (!strcmp(pchan->name, posechannel)) {
+                       if (STREQ(pchan->name, posechannel)) {
                                /* found it, now look for constraint channel */
                                bConstraint *con;
                                for (con = pchan->constraints.first; con; con = con->next) {
-                                       if (!strcmp(con->name, constraint)) {
+                                       if (STREQ(con->name, constraint)) {
                                                /* found it, all ok */
                                                return;
                                        }
index c54822bef4dc70d3acff00ee3e50fdf00c88b3a1..ff9df16ae940e9fc2e289f8ff8fa028c648c658d 100644 (file)
@@ -1249,7 +1249,7 @@ static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA
        bNodeTree *ntree = (bNodeTree *)value.data;
        
        /* node tree type must match the selected type in node editor */
-       return (strcmp(snode->tree_idname, ntree->idname) == 0);
+       return (STREQ(snode->tree_idname, ntree->idname));
 }
 
 static void rna_SpaceNodeEditor_node_tree_update(const bContext *C, PointerRNA *UNUSED(ptr))
index a61846fa028c75c9461236fff0469ae019d82aed..fde43abe9fb608e6e3a6fb910a76935ec462988c 100644 (file)
@@ -221,7 +221,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 
        /* check if we have registered this panel type before, and remove it */
        for (pt = art->paneltypes.first; pt; pt = pt->next) {
-               if (strcmp(pt->idname, dummypt.idname) == 0) {
+               if (STREQ(pt->idname, dummypt.idname)) {
                        if (pt->ext.srna)
                                rna_Panel_unregister(bmain, pt->ext.srna);
                        else
@@ -587,7 +587,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
 
        /* check if we have registered this header type before, and remove it */
        for (ht = art->headertypes.first; ht; ht = ht->next) {
-               if (strcmp(ht->idname, dummyht.idname) == 0) {
+               if (STREQ(ht->idname, dummyht.idname)) {
                        if (ht->ext.srna)
                                rna_Header_unregister(bmain, ht->ext.srna);
                        break;
index 4f889c916655f4df06a5918fc1305791aece15ca..b5eeebae664feeb814c6e3eac74010766d2da55a 100644 (file)
@@ -295,7 +295,7 @@ static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char
 
        if (items) {
                for (item = items; item->identifier; item++) {
-                       if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+                       if (item->identifier[0] && STREQ(item->identifier, identifier)) {
                                name = item->name;
                                break;
                        }
@@ -326,7 +326,7 @@ static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, con
 
        if (items) {
                for (item = items; item->identifier; item++) {
-                       if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+                       if (item->identifier[0] && STREQ(item->identifier, identifier)) {
                                desc = item->description;
                                break;
                        }
@@ -356,7 +356,7 @@ static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propna
 
        if (items) {
                for (item = items; item->identifier; item++) {
-                       if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+                       if (item->identifier[0] && STREQ(item->identifier, identifier)) {
                                icon = item->icon;
                                break;
                        }
index 3b97508dd67dde9e7d1a9304427bf6c5e5defa4b..347b669812e460cc538fd1edd05acab8112d7bd2 100644 (file)
@@ -835,7 +835,7 @@ static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
 
        WM_operator_bl_idname(idname, value);
 
-       if (strcmp(idname, kmi->idname) != 0) {
+       if (!STREQ(idname, kmi->idname)) {
                BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
 
                WM_keymap_properties_reset(kmi, NULL);
index 679bdcd1d472552ec2903661e49f290d668076b9..219eae4eccab3311e478d1c41a2f0ded961e3d81 100644 (file)
@@ -57,7 +57,7 @@ static bool meshcache_read_pc2_head(FILE *fp, const int verts_tot,
                return false;
        }
 
-       if (strcmp(pc2_head->header, "POINTCACHE2") != 0) {
+       if (!STREQ(pc2_head->header, "POINTCACHE2")) {
                *err_str = "Invalid header";
                return false;
        }
index ecc02e732ce57d57580ce33ef3b4f9d46710e7fa..e8845b543b8f7955dc0fd0afb57e2945b0172e7a 100644 (file)
@@ -439,7 +439,7 @@ static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr)
 
 static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree)
 {
-       if (strcmp(ntree->idname, "CompositorNodeTree") == 0) {
+       if (STREQ(ntree->idname, "CompositorNodeTree")) {
                Scene *scene;
                
                /* XXX ugly: check if ntree is a local scene node tree.
index 282567b797fb73954662010d52186e743f069098..01c642b063de223e7a6cd882bb02480f48a4b2f3 100644 (file)
@@ -108,7 +108,7 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
        bNodeSocket *sock;
        
        for (sock = socklist->first; sock; sock = sock->next) {
-               if (strncmp(sock->name, stemp->name, NODE_MAXSTR) == 0)
+               if (STREQLEN(sock->name, stemp->name, NODE_MAXSTR))
                        break;
        }
        if (sock) {
index 7c598f92bed95c20dcf8513148c7ce2adb6edea3..2fb03536bbeaa43b72a419fbaac450e4656e16ba 100644 (file)
@@ -63,7 +63,7 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b
                if (ngeo->uvname[0]) {
                        /* find uv map by name */
                        for (i = 0; i < shi->totuv; i++) {
-                               if (strcmp(shi->uv[i].name, ngeo->uvname) == 0) {
+                               if (STREQ(shi->uv[i].name, ngeo->uvname)) {
                                        suv = &shi->uv[i];
                                        break;
                                }
@@ -84,7 +84,7 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b
 
                        if (ngeo->colname[0]) {
                                for (i = 0; i < shi->totcol; i++) {
-                                       if (strcmp(shi->col[i].name, ngeo->colname) == 0) {
+                                       if (STREQ(shi->col[i].name, ngeo->colname)) {
                                                scol = &shi->col[i];
                                                break;
                                        }
index fd864f1c7c6a017ff5349981f0d7e146a41be043..9fe56d4f01d08ca990dcf9352e7c2407baae7df6 100644 (file)
@@ -51,7 +51,7 @@ static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNo
        node->custom1 = SHD_SUBSURFACE_CUBIC;
 
        /*for (sock = node->inputs.first; sock; sock = sock->next) {
-               if (strcmp(sock->name, "Sharpness") == 0) {
+               if (STREQ(sock->name, "Sharpness")) {
                        bNodeSocketValueFloat *dval = sock->default_value;
                        dval->value = 0.0f;
                }
@@ -72,7 +72,7 @@ static void node_shader_update_subsurface_scattering(bNodeTree *UNUSED(ntree), b
        int falloff = node->custom1;
 
        for (sock = node->inputs.first; sock; sock = sock->next) {
-               if (strcmp(sock->name, "Sharpness") == 0) {
+               if (STREQ(sock->name, "Sharpness")) {
                        if (falloff == SHD_SUBSURFACE_CUBIC)
                                sock->flag &= ~SOCK_UNAVAIL;
                        else
index 1a56c0f7c5993264cfaae21459e5bb009e009712..17a2038b7dc37212d76ef5c13e68ea73f5b64890 100644 (file)
@@ -260,7 +260,7 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms
                return msgid;
 
        tmp = BLF_lang_get();
-       if (strcmp(tmp, locale) || !_translations_cache) {
+       if (!STREQ(tmp, locale) || !_translations_cache) {
                PyGILState_STATE _py_state;
 
                BLI_strncpy(locale, tmp, STATIC_LOCALE_SIZE);
index 7605d7d9ea725e2c69650f2cb749e7d945d85c77..1e30e05fe1a0941be385b052c09ed995bd0638d7 100644 (file)
@@ -256,7 +256,7 @@ Render *RE_GetRender(const char *name)
 
        /* search for existing renders */
        for (re = RenderGlobal.renderlist.first; re; re = re->next)
-               if (strncmp(re->name, name, RE_MAXNAME) == 0)
+               if (STREQLEN(re->name, name, RE_MAXNAME))
                        break;
 
        return re;
index 0d859f81e0c93e02f5f26f408963077d77501810..6486844bacf6b2be18df177a4d0df61f45846085 100644 (file)
@@ -309,97 +309,97 @@ static const char *get_pass_name(int passtype, int channel)
 static int passtype_from_name(const char *str)
 {
        
-       if (strcmp(str, "Combined") == 0)
+       if (STREQ(str, "Combined"))
                return SCE_PASS_COMBINED;
 
-       if (strcmp(str, "Depth") == 0)
+       if (STREQ(str, "Depth"))
                return SCE_PASS_Z;
 
-       if (strcmp(str, "Vector") == 0)
+       if (STREQ(str, "Vector"))
                return SCE_PASS_VECTOR;
 
-       if (strcmp(str, "Normal") == 0)
+       if (STREQ(str, "Normal"))
                return SCE_PASS_NORMAL;
 
-       if (strcmp(str, "UV") == 0)
+       if (STREQ(str, "UV"))
                return SCE_PASS_UV;
 
-       if (strcmp(str, "Color") == 0)
+       if (STREQ(str, "Color"))
                return SCE_PASS_RGBA;
 
-       if (strcmp(str, "Emit") == 0)
+       if (STREQ(str, "Emit"))
                return SCE_PASS_EMIT;
 
-       if (strcmp(str, "Diffuse") == 0)
+       if (STREQ(str, "Diffuse"))
                return SCE_PASS_DIFFUSE;
 
-       if (strcmp(str, "Spec") == 0)
+       if (STREQ(str, "Spec"))
                return SCE_PASS_SPEC;
 
-       if (strcmp(str, "Shadow") == 0)
+       if (STREQ(str, "Shadow"))
                return SCE_PASS_SHADOW;
        
-       if (strcmp(str, "AO") == 0)
+       if (STREQ(str, "AO"))
                return SCE_PASS_AO;
 
-       if (strcmp(str, "Env") == 0)
+       if (STREQ(str, "Env"))
                return SCE_PASS_ENVIRONMENT;
 
-       if (strcmp(str, "Indirect") == 0)
+       if (STREQ(str, "Indirect"))
                return SCE_PASS_INDIRECT;
 
-       if (strcmp(str, "Reflect") == 0)
+       if (STREQ(str, "Reflect"))
                return SCE_PASS_REFLECT;
 
-       if (strcmp(str, "Refract") == 0)
+       if (STREQ(str, "Refract"))
                return SCE_PASS_REFRACT;
 
-       if (strcmp(str, "IndexOB") == 0)
+       if (STREQ(str, "IndexOB"))
                return SCE_PASS_INDEXOB;
 
-       if (strcmp(str, "IndexMA") == 0)
+       if (STREQ(str, "IndexMA"))
                return SCE_PASS_INDEXMA;
 
-       if (strcmp(str, "Mist") == 0)
+       if (STREQ(str, "Mist"))
                return SCE_PASS_MIST;
        
-       if (strcmp(str, "RayHits") == 0)
+       if (STREQ(str, "RayHits"))
                return SCE_PASS_RAYHITS;
 
-       if (strcmp(str, "DiffDir") == 0)
+       if (STREQ(str, "DiffDir"))
                return SCE_PASS_DIFFUSE_DIRECT;
 
-       if (strcmp(str, "DiffInd") == 0)
+       if (STREQ(str, "DiffInd"))
                return SCE_PASS_DIFFUSE_INDIRECT;
 
-       if (strcmp(str, "DiffCol") == 0)
+       if (STREQ(str, "DiffCol"))
                return SCE_PASS_DIFFUSE_COLOR;
 
-       if (strcmp(str, "GlossDir") == 0)
+       if (STREQ(str, "GlossDir"))
                return SCE_PASS_GLOSSY_DIRECT;
 
-       if (strcmp(str, "GlossInd") == 0)
+       if (STREQ(str, "GlossInd"))
                return SCE_PASS_GLOSSY_INDIRECT;
 
-       if (strcmp(str, "GlossCol") == 0)
+       if (STREQ(str, "GlossCol"))
                return SCE_PASS_GLOSSY_COLOR;
 
-       if (strcmp(str, "TransDir") == 0)
+       if (STREQ(str, "TransDir"))
                return SCE_PASS_TRANSM_DIRECT;
 
-       if (strcmp(str, "TransInd") == 0)
+       if (STREQ(str, "TransInd"))
                return SCE_PASS_TRANSM_INDIRECT;
 
-       if (strcmp(str, "TransCol") == 0)
+       if (STREQ(str, "TransCol"))
                return SCE_PASS_TRANSM_COLOR;
                
-       if (strcmp(str, "SubsurfaceDir") == 0)
+       if (STREQ(str, "SubsurfaceDir"))
                return SCE_PASS_SUBSURFACE_DIRECT;
 
-       if (strcmp(str, "SubsurfaceInd") == 0)
+       if (STREQ(str, "SubsurfaceInd"))
                return SCE_PASS_SUBSURFACE_INDIRECT;
 
-       if (strcmp(str, "SubsurfaceCol") == 0)
+       if (STREQ(str, "SubsurfaceCol"))
                return SCE_PASS_SUBSURFACE_COLOR;
 
        return 0;
@@ -509,7 +509,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
        for (nr = 0, srl = re->r.layers.first; srl; srl = srl->next, nr++) {
 
                if (layername && layername[0])
-                       if (strcmp(srl->name, layername) != 0)
+                       if (!STREQ(srl->name, layername))
                                continue;
 
                if (re->r.scemode & R_SINGLE_LAYER) {
index b1e00c4a45116bcd33c727db4ec55928146deeb1..c738fc3e06af6c8163a0ed8de0f852cf1df9fc0c 100644 (file)
@@ -2249,7 +2249,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
 
                                        if (mtex->uvname[0] != 0) {
                                                for (i = 0; i < shi->totuv; i++) {
-                                                       if (strcmp(shi->uv[i].name, mtex->uvname)==0) {
+                                                       if (STREQ(shi->uv[i].name, mtex->uvname)) {
                                                                suv= &shi->uv[i];
                                                                break;
                                                        }
index 93e8c6a275a57600d145fe232c8ab52adc039f60..63a97a04b3960d694b682ccc9d88c68b2c8f2375 100644 (file)
@@ -2064,7 +2064,7 @@ float RE_lamp_get_data(ShadeInput *shi, Object *lamp_obj, float col[4], float lv
                if (R.r.scemode & R_BUTS_PREVIEW) {
                        for (go = R.lights.first; go; go = go->next) {
                                /* "Lamp.002" is main key light of material preview */
-                               if (strcmp(go->ob->id.name + 2, "Lamp.002") == 0)
+                               if (STREQ(go->ob->id.name + 2, "Lamp.002"))
                                        return lamp_get_data_internal(shi, go, col, lv, dist, shadow);
                        }
                        return 0.0f;
index 9859a7ded87c7f90f4e89293e39e8036255ecb18..cdc3c9eaaffced44110216abdbd4cb90e347e86f 100644 (file)
@@ -81,7 +81,7 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
        
        for (dm = dropboxes.first; dm; dm = dm->next)
                if (dm->spaceid == spaceid && dm->regionid == regionid)
-                       if (0 == strncmp(idname, dm->idname, KMAP_MAX_NAME))
+                       if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
                                return &dm->dropboxes;
        
        dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
index afbc7bbc0251021a62c54556add1c98a7c09a1d5..885aa69b179606b1afbfbc735aaabdcc8e7b07e2 100644 (file)
@@ -870,7 +870,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
                                        break;
 
                                /* skip invalid properties */
-                               if (strcmp(RNA_property_identifier(prop), otmacro->idname) == 0) {
+                               if (STREQ(RNA_property_identifier(prop), otmacro->idname)) {
                                        wmOperatorType *otm = WM_operatortype_find(otmacro->idname, 0);
                                        PointerRNA someptr = RNA_property_pointer_get(properties, prop);
                                        wmOperator *opm = wm_operator_create(wm, otm, &someptr, NULL);
index d159513e6a10582c71b7427ca995f6e45fde93d2..a500f24db16d419d52707956163a3c953b890aab 100644 (file)
@@ -355,7 +355,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
                else {
                        len = gzread(gzfile, header, sizeof(header));
                        gzclose(gzfile);
-                       if (len == sizeof(header) && strncmp(header, "BLENDER", 7) == 0) {
+                       if (len == sizeof(header) && STREQLEN(header, "BLENDER", 7)) {
                                retval = BKE_READ_EXOTIC_OK_BLEND;
                        }
                        else {
index b52f3819d3f04ee0f03033e4470111c21b811d17..a1643046fff444e73820201a9fd0c54e37e38e41 100644 (file)
@@ -145,21 +145,15 @@ static void wm_keyconfig_properties_update_ot(ListBase *km_lb)
        }
 }
 
-static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
+static bool wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
 {
-       if (strcmp(a->idname, b->idname) != 0)
-               return 0;
-       
-       if (!RNA_struct_equals(a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE))
-               return 0;
-       
-       if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
-               return 0;
-       
-       return (a->propvalue == b->propvalue);
+       return (STREQ(a->idname, b->idname) &&
+               RNA_struct_equals(a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE) &&
+               (a->flag & KMI_INACTIVE) == (b->flag & KMI_INACTIVE) &&
+               a->propvalue == b->propvalue);
 }
 
-static int wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
+static bool wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
 {
        return (wm_keymap_item_equals_result(a, b) &&
                a->type == b->type &&
@@ -266,7 +260,7 @@ wmKeyConfig *WM_keyconfig_new_user(wmWindowManager *wm, const char *idname)
 bool WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
 {
        if (BLI_findindex(&wm->keyconfigs, keyconf) != -1) {
-               if (strncmp(U.keyconfigstr, keyconf->idname, sizeof(U.keyconfigstr)) == 0) {
+               if (STREQLEN(U.keyconfigstr, keyconf->idname, sizeof(U.keyconfigstr))) {
                        BLI_strncpy(U.keyconfigstr, wm->defaultconf->idname, sizeof(U.keyconfigstr));
                        WM_keyconfig_update_tag(NULL, NULL);
                }
@@ -421,7 +415,7 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
        wmKeyMapItem *kmi;
        
        for (kmi = keymap->items.first; kmi; kmi = kmi->next)
-               if (strncmp(kmi->idname, idname, OP_MAX_TYPENAME) == 0)
+               if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME))
                        break;
        if (kmi == NULL) {
                kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
@@ -728,7 +722,7 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
 
        for (km = lb->first; km; km = km->next)
                if (km->spaceid == spaceid && km->regionid == regionid)
-                       if (0 == strncmp(idname, km->idname, KMAP_MAX_NAME))
+                       if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
                                return km;
        
        return NULL;
@@ -787,7 +781,7 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
        
        for (km = keyconf->keymaps.first; km; km = km->next)
                if (km->flag & KEYMAP_MODAL)
-                       if (0 == strncmp(idname, km->idname, KMAP_MAX_NAME))
+                       if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
                                break;
        
        return km;
@@ -952,7 +946,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
                                if (kmi->flag & KMI_INACTIVE)
                                        continue;
                                
-                               if (strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
+                               if (STREQ(kmi->idname, opname) && WM_key_event_string(kmi->type)[0]) {
                                        if (is_hotkey) {
                                                if (!ISHOTKEY(kmi->type))
                                                        continue;
@@ -963,7 +957,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
                                                /* example of debugging keymaps */
 #if 0
                                                if (kmi->ptr) {
-                                                       if (strcmp("MESH_OT_rip_move", opname) == 0) {
+                                                       if (STREQ("MESH_OT_rip_move", opname)) {
                                                                printf("OPERATOR\n");
                                                                IDP_spit(properties);
                                                                printf("KEYMAP\n");
@@ -1353,7 +1347,7 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
 
        if (orig) {
                /* restore to original */
-               if (strcmp(orig->idname, kmi->idname) != 0) {
+               if (!STREQ(orig->idname, kmi->idname)) {
                        BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
                        WM_keymap_properties_reset(kmi, NULL);
                }
index 67932bcfb30ea31634be9f037e483a718a5b9dfd..15406485c7fecb02c766e6116d440d1fe81708bb 100644 (file)
@@ -755,7 +755,7 @@ static int set_engine(int argc, const char **argv, void *data)
 {
        bContext *C = data;
        if (argc >= 2) {
-               if (!strcmp(argv[1], "help")) {
+               if (STREQ(argv[1], "help")) {
                        RenderEngineType *type = NULL;
                        printf("Blender Engine Listing:\n");
                        for (type = R_engines.first; type; type = type->next) {
@@ -925,11 +925,11 @@ static int set_ge_parameters(int argc, const char **argv, void *data)
                        SYS_WriteCommandLineInt(syshandle, argv[a], 1);
 #endif
                        /* doMipMap */
-                       if (!strcmp(argv[a], "nomipmap")) {
+                       if (STREQ(argv[a], "nomipmap")) {
                                GPU_set_mipmap(0); //doMipMap = 0;
                        }
                        /* linearMipMap */
-                       if (!strcmp(argv[a], "linearmipmap")) {
+                       if (STREQ(argv[a], "linearmipmap")) {
                                GPU_set_linear_mipmap(1); //linearMipMap = 1;
                        }
 
@@ -1555,7 +1555,7 @@ int main(
        
 #if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE)
 /* patch to ignore argument finder gives us (pid?) */
-       if (argc == 2 && strncmp(argv[1], "-psn_", 5) == 0) {
+       if (argc == 2 && STREQLEN(argv[1], "-psn_", 5)) {
                extern int GHOST_HACK_getFirstFile(char buf[]);
                static char firstfilebuf[512];