Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-01-26 18:03:11 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-01-26 18:59:24 +0300
commitfca515838e70f8bec7028b840bb921a1be9fabbb (patch)
tree1752923de19eca5f01ca4cfb5754fd4d1f13d934 /source/blender/imbuf
parentd44890ee75634052f325531766a661a5bcef628f (diff)
Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).
Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)' and 'strcmp(foo, bar) == 0' in several places...
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/colormanagement.c16
-rw-r--r--source/blender/imbuf/intern/indexer.c2
-rw-r--r--source/blender/imbuf/intern/jpeg.c7
-rw-r--r--source/blender/imbuf/intern/metadata.c6
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp4
-rw-r--r--source/blender/imbuf/intern/png.c2
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c2
-rw-r--r--source/blender/imbuf/intern/tiff.c2
8 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index e5e22da1524..95e166b2f8b 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -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;
}
}
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index e66be77ecaf..e067cd64022 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -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));
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index f4b5f987869..6093a1477ce 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -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;
}
diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c
index 797d34d118b..35d921beabd 100644
--- a/source/blender/imbuf/intern/metadata.c
+++ b/source/blender/imbuf/intern/metadata.c
@@ -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;
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index ba1bda640a6..ad19c547db3 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -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);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 3266dc97c78..94914db3a1a 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -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);
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index af353461f1f..aee465c49cc 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -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] == '-')
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index e3b8e271387..dca10fd7eda 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -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 */