Package: qtcurve Version: 1.8.18+git20160320-3d8622c-3 Severity: normal Tags: patch
--- Please enter the report below this line. --- QtCurve uses `memcmp()` to compare strings against various constants when reading configuration file. This might easily end up with memcmp() reading past the input string boundary, when input string is shorter that the string which is compared against. For example, if slider style is set to "circular", it will be first be compared against "triangular", which is a longer string and will cause reads past the original string boundary. In order to reproduce the issue, KDE Plasma is to be configured to use QtCurve widget style (Settings -> Application Style -> Applications -> Widget Style). I am using Breeze preset for QtCurve. The error is very easily noticeable when running Qt5 application compiled with address sanitizer. Probably running any Qt application with Valgrind will show the error as well, but i did not try that. The solution i've tried is to use strncmp() instead of memcmp(), which will avoid reading past the string memory. Seems all strings are NULL-terminated in those comparisons, so it should be good enough approach. The patch is attached. P.S. Not sure the QtCurve versions are correctly detected, i've re-compiled the packaged locally with the patch mentioned above. The patch is against QtCurve from Stretch. P.P.S. I'm using self-compiled kernel, because previously i was on one from jessie-backports, which had issues with my machine. This shouldn't matter i think. --- System information. --- Architecture: Kernel: Linux 4.11.5-vanilla Debian Release: 9.0 995 stable dl.google.com 990 stable security.debian.org 990 stable ftp.de.debian.org --- Package information. --- Depends (Version) | Installed ====================================-+-=========== gtk2-engines-qtcurve | 1.8.18+git20160320-3d8622c-3 kde-style-qtcurve-qt4 | 1.8.18+git20160320-3d8622c-3 kde-style-qtcurve-qt5 | 1.8.18+git20160320-3d8622c-3 qtcurve-l10n | 1.8.18+git20160320-3d8622c-3 Package's Recommends field is empty. Suggests (Version) | Installed =====================================-+-=========== kwin-decoration-oxygen | 4:5.8.4-1 oxygen-icon-theme | 5:5.28.0-1
Description: Replace memcmp with strncmp This change replaces memcmp(str, "constant", length) with strncmp with the same arguments. This avoids reading past array boundary which coud easily happen when string which is being compared is shorter than string which is being compared against. . qtcurve (1.8.18+git20160320-3d8622c-3) unstable; urgency=medium . * Add workaround-for-kwin-x11-crashes.patch. (Closes: #823674) Author: Boris Pek <tehn...@debian.org> Bug-Debian: https://bugs.debian.org/823674 --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: <vendor|upstream|other>, <url of original patch> Bug: <url in upstream bugtracker> Bug-Debian: https://bugs.debian.org/<bugnumber> Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> Forwarded: <no|not-needed|url proving that it has been forwarded> Reviewed-By: <name and email of someone who approved the patch> Last-Update: 2017-06-24 --- qtcurve-1.8.18+git20160320-3d8622c.orig/gtk2/common/config_file.cpp +++ qtcurve-1.8.18+git20160320-3d8622c/gtk2/common/config_file.cpp @@ -88,17 +88,17 @@ static ELine toLine(const char *str, ELi { if(str && 0!=str[0]) { - if(0==memcmp(str, "dashes", 6)) + if(0==strncmp(str, "dashes", 6)) return LINE_DASHES; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return LINE_NONE; - if(0==memcmp(str, "sunken", 6)) + if(0==strncmp(str, "sunken", 6)) return LINE_SUNKEN; - if(0==memcmp(str, "dots", 4)) + if(0==strncmp(str, "dots", 4)) return LINE_DOTS; - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return LINE_FLAT; - if(0==memcmp(str, "1dot", 5)) + if(0==strncmp(str, "1dot", 5)) return LINE_1DOT; } return def; @@ -108,12 +108,12 @@ static ETBarBorder toTBarBorder(const ch { if(str && 0!=str[0]) { - if(0==memcmp(str, "dark", 4)) - return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "dark", 4)) + return 0==strncmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; + if(0==strncmp(str, "none", 4)) return TB_NONE; - if(0==memcmp(str, "light", 5)) - return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; + if(0==strncmp(str, "light", 5)) + return 0==strncmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; } return def; } @@ -122,15 +122,15 @@ static EMouseOver toMouseOver(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "colored", 7)) return MO_COLORED; - if(0==memcmp(str, "thickcolored", 12)) + if(0==strncmp(str, "thickcolored", 12)) return MO_COLORED_THICK; - if(0==memcmp(str, "plastik", 7)) + if(0==strncmp(str, "plastik", 7)) return MO_PLASTIK; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return MO_GLOW; - if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 4) || 0==strncmp(str, "none", 4)) return MO_NONE; } return def; @@ -140,40 +140,40 @@ static EAppearance toAppearance(const ch { if(str && 0!=str[0]) { - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return APPEARANCE_FLAT; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return APPEARANCE_RAISED; - if(0==memcmp(str, "dullglass", 9)) + if(0==strncmp(str, "dullglass", 9)) return APPEARANCE_DULL_GLASS; - if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10)) + if(0==strncmp(str, "glass", 5) || 0==strncmp(str, "shinyglass", 10)) return APPEARANCE_SHINY_GLASS; - if(0==memcmp(str, "agua", 4)) + if(0==strncmp(str, "agua", 4)) return APPEARANCE_AGUA; - if(0==memcmp(str, "soft", 4)) + if(0==strncmp(str, "soft", 4)) return APPEARANCE_SOFT_GRADIENT; - if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13)) + if(0==strncmp(str, "gradient", 8) || 0==strncmp(str, "lightgradient", 13)) return APPEARANCE_GRADIENT; - if(0==memcmp(str, "harsh", 5)) + if(0==strncmp(str, "harsh", 5)) return APPEARANCE_HARSH_GRADIENT; - if(0==memcmp(str, "inverted", 8)) + if(0==strncmp(str, "inverted", 8)) return APPEARANCE_INVERTED; - if(0==memcmp(str, "darkinverted", 12)) + if(0==strncmp(str, "darkinverted", 12)) return APPEARANCE_DARK_INVERTED; - if(0==memcmp(str, "splitgradient", 13)) + if(0==strncmp(str, "splitgradient", 13)) return APPEARANCE_SPLIT_GRADIENT; - if(0==memcmp(str, "bevelled", 8)) + if(0==strncmp(str, "bevelled", 8)) return APPEARANCE_BEVELLED; - if(APP_ALLOW_FADE==allow && 0==memcmp(str, "fade", 4)) + if(APP_ALLOW_FADE==allow && 0==strncmp(str, "fade", 4)) return APPEARANCE_FADE; - if(APP_ALLOW_STRIPED==allow && 0==memcmp(str, "striped", 7)) + if(APP_ALLOW_STRIPED==allow && 0==strncmp(str, "striped", 7)) return APPEARANCE_STRIPED; - if(APP_ALLOW_NONE==allow && 0==memcmp(str, "none", 4)) + if(APP_ALLOW_NONE==allow && 0==strncmp(str, "none", 4)) return APPEARANCE_NONE; - if(nullptr!=pix && APP_ALLOW_STRIPED==allow && 0==memcmp(str, "file", 4) && strlen(str)>9) + if(nullptr!=pix && APP_ALLOW_STRIPED==allow && 0==strncmp(str, "file", 4) && strlen(str)>9) return loadImage(&str[5], pix) || !checkImage ? APPEARANCE_FILE : def; - if(0==memcmp(str, "customgradient", 14) && strlen(str)>14) + if(0==strncmp(str, "customgradient", 14) && strlen(str)>14) { int i=atoi(&str[14]); @@ -192,22 +192,22 @@ toShade(const char *str, bool allowMenu, if(str && 0!=str[0]) { /* true/false is from 0.25... */ - if((!menuShade && 0==memcmp(str, "true", 4)) || 0==memcmp(str, "selected", 8)) + if((!menuShade && 0==strncmp(str, "true", 4)) || 0==strncmp(str, "selected", 8)) return SHADE_BLEND_SELECTED; - if(0==memcmp(str, "origselected", 12)) + if(0==strncmp(str, "origselected", 12)) return SHADE_SELECTED; - if(allowMenu && (0==memcmp(str, "darken", 6) || (menuShade && 0==memcmp(str, "true", 4)))) + if(allowMenu && (0==strncmp(str, "darken", 6) || (menuShade && 0==strncmp(str, "true", 4)))) return SHADE_DARKEN; - if(allowMenu && 0==memcmp(str, "wborder", 7)) + if(allowMenu && 0==strncmp(str, "wborder", 7)) return SHADE_WINDOW_BORDER; - if(0==memcmp(str, "custom", 6)) + if(0==strncmp(str, "custom", 6)) return SHADE_CUSTOM; if('#'==str[0] && col) { qtcSetRgb(col, str); return SHADE_CUSTOM; } - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return SHADE_NONE; } @@ -219,15 +219,15 @@ static ERound toRound(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return ROUND_NONE; - if(0==memcmp(str, "slight", 6)) + if(0==strncmp(str, "slight", 6)) return ROUND_SLIGHT; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return ROUND_FULL; - if(0==memcmp(str, "extra", 5)) + if(0==strncmp(str, "extra", 5)) return ROUND_EXTRA; - if(0==memcmp(str, "max", 3)) + if(0==strncmp(str, "max", 3)) return ROUND_MAX; } @@ -250,11 +250,11 @@ static EEffect toEffect(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return EFFECT_NONE; - if(0==memcmp(str, "shadow", 6)) + if(0==strncmp(str, "shadow", 6)) return EFFECT_SHADOW; - if(0==memcmp(str, "etch", 4)) + if(0==strncmp(str, "etch", 4)) return EFFECT_ETCH; } @@ -271,13 +271,13 @@ static EStripe toStripe(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "plain", 5) || 0==strncmp(str, "true", 4)) return STRIPE_PLAIN; - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return STRIPE_NONE; - if(0==memcmp(str, "diagonal", 8)) + if(0==strncmp(str, "diagonal", 8)) return STRIPE_DIAGONAL; - if(0==memcmp(str, "fade", 4)) + if(0==strncmp(str, "fade", 4)) return STRIPE_FADE; } @@ -288,17 +288,17 @@ static ESliderStyle toSlider(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "round", 5)) + if(0==strncmp(str, "round", 5)) return SLIDER_ROUND; - if(0==memcmp(str, "plain", 5)) + if(0==strncmp(str, "plain", 5)) return SLIDER_PLAIN; - if(0==memcmp(str, "r-round", 7)) + if(0==strncmp(str, "r-round", 7)) return SLIDER_ROUND_ROTATED; - if(0==memcmp(str, "r-plain", 7)) + if(0==strncmp(str, "r-plain", 7)) return SLIDER_PLAIN_ROTATED; - if(0==memcmp(str, "triangular", 10)) + if(0==strncmp(str, "triangular", 10)) return SLIDER_TRIANGULAR; - if(0==memcmp(str, "circular", 8)) + if(0==strncmp(str, "circular", 8)) return SLIDER_CIRCULAR; } @@ -309,11 +309,11 @@ static EColor toEColor(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "base", 4)) + if(0==strncmp(str, "base", 4)) return ECOLOR_BASE; - if(0==memcmp(str, "dark", 4)) + if(0==strncmp(str, "dark", 4)) return ECOLOR_DARK; - if(0==memcmp(str, "background", 10)) + if(0==strncmp(str, "background", 10)) return ECOLOR_BACKGROUND; } @@ -324,19 +324,19 @@ static EFocus toFocus(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return FOCUS_STANDARD; - if(0==memcmp(str, "rect", 4) || 0==memcmp(str, "highlight", 9)) + if(0==strncmp(str, "rect", 4) || 0==strncmp(str, "highlight", 9)) return FOCUS_RECTANGLE; - if(0==memcmp(str, "filled", 6)) + if(0==strncmp(str, "filled", 6)) return FOCUS_FILLED; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return FOCUS_FULL; - if(0==memcmp(str, "line", 4)) + if(0==strncmp(str, "line", 4)) return FOCUS_LINE; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return FOCUS_GLOW; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return FOCUS_NONE; } @@ -347,11 +347,11 @@ static ETabMo toTabMo(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "top", 3)) + if(0==strncmp(str, "top", 3)) return TAB_MO_TOP; - if(0==memcmp(str, "bot", 3)) + if(0==strncmp(str, "bot", 3)) return TAB_MO_BOTTOM; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return TAB_MO_GLOW; } @@ -362,9 +362,9 @@ static EGradType toGradType(const char * { if(str && 0!=str[0]) { - if(0==memcmp(str, "horiz", 5)) + if(0==strncmp(str, "horiz", 5)) return GT_HORIZ; - if(0==memcmp(str, "vert", 4)) + if(0==strncmp(str, "vert", 4)) return GT_VERT; } return def; @@ -375,14 +375,14 @@ static bool toLvLines(const char *str, b if(str && 0!=str[0]) { #if 0 - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "new", 3)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "new", 3)) return LV_NEW; - if(0==memcmp(str, "old", 3)) + if(0==strncmp(str, "old", 3)) return LV_OLD; - if(0==memcmp(str, "false", 5) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 5) || 0==strncmp(str, "none", 4)) return LV_NONE; #else - return 0!=memcmp(str, "false", 5); + return 0!=strncmp(str, "false", 5); #endif } return def; @@ -392,15 +392,15 @@ static EGradientBorder toGradientBorder( { if (str && str[0]) { *haveAlpha = strstr(str, "-alpha") ? true : false; - if(0==memcmp(str, "light", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "light", 5) || 0==strncmp(str, "true", 4)) return GB_LIGHT; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GB_NONE; - if(0==memcmp(str, "3dfull", 6)) + if(0==strncmp(str, "3dfull", 6)) return GB_3D_FULL; - if(0==memcmp(str, "3d", 2) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "3d", 2) || 0==strncmp(str, "false", 5)) return GB_3D; - if(0==memcmp(str, "shine", 5)) + if(0==strncmp(str, "shine", 5)) return GB_SHINE; } return GB_3D; @@ -411,11 +411,11 @@ static ETitleBarIcon toTitlebarIcon(cons { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return TITLEBAR_ICON_NONE; - if(0==memcmp(str, "menu", 4)) + if(0==strncmp(str, "menu", 4)) return TITLEBAR_ICON_MENU_BUTTON; - if(0==memcmp(str, "title", 5)) + if(0==strncmp(str, "title", 5)) return TITLEBAR_ICON_NEXT_TO_TITLE; } return def; @@ -426,15 +426,15 @@ static EImageType toImageType(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return IMG_NONE; - if(0==memcmp(str, "plainrings", 10)) + if(0==strncmp(str, "plainrings", 10)) return IMG_PLAIN_RINGS; - if(0==memcmp(str, "rings", 5)) + if(0==strncmp(str, "rings", 5)) return IMG_BORDERED_RINGS; - if(0==memcmp(str, "squarerings", 11)) + if(0==strncmp(str, "squarerings", 11)) return IMG_SQUARE_RINGS; - if(0==memcmp(str, "file", 4)) + if(0==strncmp(str, "file", 4)) return IMG_FILE; } return def; @@ -444,13 +444,13 @@ static EGlow toGlow(const char *str, EGl { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GLOW_NONE; - if(0==memcmp(str, "start", 5)) + if(0==strncmp(str, "start", 5)) return GLOW_START; - if(0==memcmp(str, "middle", 6)) + if(0==strncmp(str, "middle", 6)) return GLOW_MIDDLE; - if(0==memcmp(str, "end", 3)) + if(0==strncmp(str, "end", 3)) return GLOW_END; } return def; @@ -460,11 +460,11 @@ static ETBarBtn toTBarBtn(const char *st { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return TBTN_STANDARD; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return TBTN_RAISED; - if(0==memcmp(str, "joined", 6)) + if(0==strncmp(str, "joined", 6)) return TBTN_JOINED; } return def; @@ -634,7 +634,7 @@ static bool readBoolEntry(GHashTable *cfg, const char *key, bool def) { char *str = readStringEntry(cfg, key); - return str ? (memcmp(str, "true", 4) == 0 ? true : false) : def; + return str ? (strncmp(str, "true", 4) == 0 ? true : false) : def; } static void --- qtcurve-1.8.18+git20160320-3d8622c.orig/qt4/common/config_file.cpp +++ qtcurve-1.8.18+git20160320-3d8622c/qt4/common/config_file.cpp @@ -80,21 +80,21 @@ static EDefBtnIndicator toInd(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6)) + if(0==strncmp(str, "fontcolor", 9) || 0==strncmp(str, "border", 6)) return IND_FONT_COLOR; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return IND_NONE; - if(0==memcmp(str, "corner", 6)) + if(0==strncmp(str, "corner", 6)) return IND_CORNER; - if(0==memcmp(str, "colored", 7)) + if(0==strncmp(str, "colored", 7)) return IND_COLORED; - if(0==memcmp(str, "tint", 4)) + if(0==strncmp(str, "tint", 4)) return IND_TINT; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return IND_GLOW; - if(0==memcmp(str, "darken", 6)) + if(0==strncmp(str, "darken", 6)) return IND_DARKEN; - if(0==memcmp(str, "origselected", 12)) + if(0==strncmp(str, "origselected", 12)) return IND_SELECTED; } @@ -105,17 +105,17 @@ static ELine toLine(const char *str, ELi { if(str && 0!=str[0]) { - if(0==memcmp(str, "dashes", 6)) + if(0==strncmp(str, "dashes", 6)) return LINE_DASHES; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return LINE_NONE; - if(0==memcmp(str, "sunken", 6)) + if(0==strncmp(str, "sunken", 6)) return LINE_SUNKEN; - if(0==memcmp(str, "dots", 4)) + if(0==strncmp(str, "dots", 4)) return LINE_DOTS; - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return LINE_FLAT; - if(0==memcmp(str, "1dot", 5)) + if(0==strncmp(str, "1dot", 5)) return LINE_1DOT; } return def; @@ -125,12 +125,12 @@ static ETBarBorder toTBarBorder(const ch { if(str && 0!=str[0]) { - if(0==memcmp(str, "dark", 4)) - return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "dark", 4)) + return 0==strncmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; + if(0==strncmp(str, "none", 4)) return TB_NONE; - if(0==memcmp(str, "light", 5)) - return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; + if(0==strncmp(str, "light", 5)) + return 0==strncmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; } return def; } @@ -139,15 +139,15 @@ static EMouseOver toMouseOver(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "colored", 7)) return MO_COLORED; - if(0==memcmp(str, "thickcolored", 12)) + if(0==strncmp(str, "thickcolored", 12)) return MO_COLORED_THICK; - if(0==memcmp(str, "plastik", 7)) + if(0==strncmp(str, "plastik", 7)) return MO_PLASTIK; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return MO_GLOW; - if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 4) || 0==strncmp(str, "none", 4)) return MO_NONE; } return def; @@ -157,41 +157,41 @@ static EAppearance toAppearance(const ch { if(str && 0!=str[0]) { - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return APPEARANCE_FLAT; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return APPEARANCE_RAISED; - if(0==memcmp(str, "dullglass", 9)) + if(0==strncmp(str, "dullglass", 9)) return APPEARANCE_DULL_GLASS; - if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10)) + if(0==strncmp(str, "glass", 5) || 0==strncmp(str, "shinyglass", 10)) return APPEARANCE_SHINY_GLASS; - if(0==memcmp(str, "agua", 4)) + if(0==strncmp(str, "agua", 4)) return APPEARANCE_AGUA; - if(0==memcmp(str, "soft", 4)) + if(0==strncmp(str, "soft", 4)) return APPEARANCE_SOFT_GRADIENT; - if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13)) + if(0==strncmp(str, "gradient", 8) || 0==strncmp(str, "lightgradient", 13)) return APPEARANCE_GRADIENT; - if(0==memcmp(str, "harsh", 5)) + if(0==strncmp(str, "harsh", 5)) return APPEARANCE_HARSH_GRADIENT; - if(0==memcmp(str, "inverted", 8)) + if(0==strncmp(str, "inverted", 8)) return APPEARANCE_INVERTED; - if(0==memcmp(str, "darkinverted", 12)) + if(0==strncmp(str, "darkinverted", 12)) return APPEARANCE_DARK_INVERTED; - if(0==memcmp(str, "splitgradient", 13)) + if(0==strncmp(str, "splitgradient", 13)) return APPEARANCE_SPLIT_GRADIENT; - if(0==memcmp(str, "bevelled", 8)) + if(0==strncmp(str, "bevelled", 8)) return APPEARANCE_BEVELLED; - if(APP_ALLOW_FADE==allow && 0==memcmp(str, "fade", 4)) + if(APP_ALLOW_FADE==allow && 0==strncmp(str, "fade", 4)) return APPEARANCE_FADE; - if(APP_ALLOW_STRIPED==allow && 0==memcmp(str, "striped", 7)) + if(APP_ALLOW_STRIPED==allow && 0==strncmp(str, "striped", 7)) return APPEARANCE_STRIPED; - if(APP_ALLOW_NONE==allow && 0==memcmp(str, "none", 4)) + if(APP_ALLOW_NONE==allow && 0==strncmp(str, "none", 4)) return APPEARANCE_NONE; if (pix && APP_ALLOW_STRIPED == allow && - 0==memcmp(str, "file", 4) && strlen(str)>9) + 0==strncmp(str, "file", 4) && strlen(str)>9) return loadImage(&str[5], pix) || !checkImage ? APPEARANCE_FILE : def; - if(0==memcmp(str, "customgradient", 14) && strlen(str)>14) + if(0==strncmp(str, "customgradient", 14) && strlen(str)>14) { int i=atoi(&str[14]); @@ -210,22 +210,22 @@ toShade(const char *str, bool allowMenu, if(str && 0!=str[0]) { /* true/false is from 0.25... */ - if((!menuShade && 0==memcmp(str, "true", 4)) || 0==memcmp(str, "selected", 8)) + if((!menuShade && 0==strncmp(str, "true", 4)) || 0==strncmp(str, "selected", 8)) return SHADE_BLEND_SELECTED; - if(0==memcmp(str, "origselected", 12)) + if(0==strncmp(str, "origselected", 12)) return SHADE_SELECTED; - if(allowMenu && (0==memcmp(str, "darken", 6) || (menuShade && 0==memcmp(str, "true", 4)))) + if(allowMenu && (0==strncmp(str, "darken", 6) || (menuShade && 0==strncmp(str, "true", 4)))) return SHADE_DARKEN; - if(allowMenu && 0==memcmp(str, "wborder", 7)) + if(allowMenu && 0==strncmp(str, "wborder", 7)) return SHADE_WINDOW_BORDER; - if(0==memcmp(str, "custom", 6)) + if(0==strncmp(str, "custom", 6)) return SHADE_CUSTOM; if('#'==str[0] && col) { qtcSetRgb(col, str); return SHADE_CUSTOM; } - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return SHADE_NONE; } @@ -237,15 +237,15 @@ static ERound toRound(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return ROUND_NONE; - if(0==memcmp(str, "slight", 6)) + if(0==strncmp(str, "slight", 6)) return ROUND_SLIGHT; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return ROUND_FULL; - if(0==memcmp(str, "extra", 5)) + if(0==strncmp(str, "extra", 5)) return ROUND_EXTRA; - if(0==memcmp(str, "max", 3)) + if(0==strncmp(str, "max", 3)) return ROUND_MAX; } @@ -267,11 +267,11 @@ static EEffect toEffect(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return EFFECT_NONE; - if(0==memcmp(str, "shadow", 6)) + if(0==strncmp(str, "shadow", 6)) return EFFECT_SHADOW; - if(0==memcmp(str, "etch", 4)) + if(0==strncmp(str, "etch", 4)) return EFFECT_ETCH; } @@ -288,13 +288,13 @@ static EStripe toStripe(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "plain", 5) || 0==strncmp(str, "true", 4)) return STRIPE_PLAIN; - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return STRIPE_NONE; - if(0==memcmp(str, "diagonal", 8)) + if(0==strncmp(str, "diagonal", 8)) return STRIPE_DIAGONAL; - if(0==memcmp(str, "fade", 4)) + if(0==strncmp(str, "fade", 4)) return STRIPE_FADE; } @@ -305,17 +305,17 @@ static ESliderStyle toSlider(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "round", 5)) + if(0==strncmp(str, "round", 5)) return SLIDER_ROUND; - if(0==memcmp(str, "plain", 5)) + if(0==strncmp(str, "plain", 5)) return SLIDER_PLAIN; - if(0==memcmp(str, "r-round", 7)) + if(0==strncmp(str, "r-round", 7)) return SLIDER_ROUND_ROTATED; - if(0==memcmp(str, "r-plain", 7)) + if(0==strncmp(str, "r-plain", 7)) return SLIDER_PLAIN_ROTATED; - if(0==memcmp(str, "triangular", 10)) + if(0==strncmp(str, "triangular", 10)) return SLIDER_TRIANGULAR; - if(0==memcmp(str, "circular", 8)) + if(0==strncmp(str, "circular", 8)) return SLIDER_CIRCULAR; } @@ -326,11 +326,11 @@ static EColor toEColor(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "base", 4)) + if(0==strncmp(str, "base", 4)) return ECOLOR_BASE; - if(0==memcmp(str, "dark", 4)) + if(0==strncmp(str, "dark", 4)) return ECOLOR_DARK; - if(0==memcmp(str, "background", 10)) + if(0==strncmp(str, "background", 10)) return ECOLOR_BACKGROUND; } @@ -341,19 +341,19 @@ static EFocus toFocus(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return FOCUS_STANDARD; - if(0==memcmp(str, "rect", 4) || 0==memcmp(str, "highlight", 9)) + if(0==strncmp(str, "rect", 4) || 0==strncmp(str, "highlight", 9)) return FOCUS_RECTANGLE; - if(0==memcmp(str, "filled", 6)) + if(0==strncmp(str, "filled", 6)) return FOCUS_FILLED; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return FOCUS_FULL; - if(0==memcmp(str, "line", 4)) + if(0==strncmp(str, "line", 4)) return FOCUS_LINE; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return FOCUS_GLOW; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return FOCUS_NONE; } @@ -364,11 +364,11 @@ static ETabMo toTabMo(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "top", 3)) + if(0==strncmp(str, "top", 3)) return TAB_MO_TOP; - if(0==memcmp(str, "bot", 3)) + if(0==strncmp(str, "bot", 3)) return TAB_MO_BOTTOM; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return TAB_MO_GLOW; } @@ -379,9 +379,9 @@ static EGradType toGradType(const char * { if(str && 0!=str[0]) { - if(0==memcmp(str, "horiz", 5)) + if(0==strncmp(str, "horiz", 5)) return GT_HORIZ; - if(0==memcmp(str, "vert", 4)) + if(0==strncmp(str, "vert", 4)) return GT_VERT; } return def; @@ -392,14 +392,14 @@ static bool toLvLines(const char *str, b if(str && 0!=str[0]) { #if 0 - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "new", 3)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "new", 3)) return LV_NEW; - if(0==memcmp(str, "old", 3)) + if(0==strncmp(str, "old", 3)) return LV_OLD; - if(0==memcmp(str, "false", 5) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 5) || 0==strncmp(str, "none", 4)) return LV_NONE; #else - return 0!=memcmp(str, "false", 5); + return 0!=strncmp(str, "false", 5); #endif } return def; @@ -409,15 +409,15 @@ static EGradientBorder toGradientBorder( { if (str && str[0]) { *haveAlpha = strstr(str, "-alpha") ? true : false; - if(0==memcmp(str, "light", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "light", 5) || 0==strncmp(str, "true", 4)) return GB_LIGHT; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GB_NONE; - if(0==memcmp(str, "3dfull", 6)) + if(0==strncmp(str, "3dfull", 6)) return GB_3D_FULL; - if(0==memcmp(str, "3d", 2) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "3d", 2) || 0==strncmp(str, "false", 5)) return GB_3D; - if(0==memcmp(str, "shine", 5)) + if(0==strncmp(str, "shine", 5)) return GB_SHINE; } return GB_3D; @@ -427,13 +427,13 @@ static EAlign toAlign(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "left", 4)) + if(0==strncmp(str, "left", 4)) return ALIGN_LEFT; - if(0==memcmp(str, "center-full", 11)) + if(0==strncmp(str, "center-full", 11)) return ALIGN_FULL_CENTER; - if(0==memcmp(str, "center", 6)) + if(0==strncmp(str, "center", 6)) return ALIGN_CENTER; - if(0==memcmp(str, "right", 5)) + if(0==strncmp(str, "right", 5)) return ALIGN_RIGHT; } return def; @@ -443,11 +443,11 @@ static ETitleBarIcon toTitlebarIcon(cons { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return TITLEBAR_ICON_NONE; - if(0==memcmp(str, "menu", 4)) + if(0==strncmp(str, "menu", 4)) return TITLEBAR_ICON_MENU_BUTTON; - if(0==memcmp(str, "title", 5)) + if(0==strncmp(str, "title", 5)) return TITLEBAR_ICON_NEXT_TO_TITLE; } return def; @@ -457,15 +457,15 @@ static EImageType toImageType(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return IMG_NONE; - if(0==memcmp(str, "plainrings", 10)) + if(0==strncmp(str, "plainrings", 10)) return IMG_PLAIN_RINGS; - if(0==memcmp(str, "rings", 5)) + if(0==strncmp(str, "rings", 5)) return IMG_BORDERED_RINGS; - if(0==memcmp(str, "squarerings", 11)) + if(0==strncmp(str, "squarerings", 11)) return IMG_SQUARE_RINGS; - if(0==memcmp(str, "file", 4)) + if(0==strncmp(str, "file", 4)) return IMG_FILE; } return def; @@ -475,13 +475,13 @@ static EGlow toGlow(const char *str, EGl { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GLOW_NONE; - if(0==memcmp(str, "start", 5)) + if(0==strncmp(str, "start", 5)) return GLOW_START; - if(0==memcmp(str, "middle", 6)) + if(0==strncmp(str, "middle", 6)) return GLOW_MIDDLE; - if(0==memcmp(str, "end", 3)) + if(0==strncmp(str, "end", 3)) return GLOW_END; } return def; @@ -491,11 +491,11 @@ static ETBarBtn toTBarBtn(const char *st { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return TBTN_STANDARD; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return TBTN_RAISED; - if(0==memcmp(str, "joined", 6)) + if(0==strncmp(str, "joined", 6)) return TBTN_JOINED; } return def; --- qtcurve-1.8.18+git20160320-3d8622c.orig/qt5/common/config_file.cpp +++ qtcurve-1.8.18+git20160320-3d8622c/qt5/common/config_file.cpp @@ -79,21 +79,21 @@ static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def) { if (str && str[0]) { - if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6)) + if(0==strncmp(str, "fontcolor", 9) || 0==strncmp(str, "border", 6)) return IND_FONT_COLOR; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return IND_NONE; - if(0==memcmp(str, "corner", 6)) + if(0==strncmp(str, "corner", 6)) return IND_CORNER; - if(0==memcmp(str, "colored", 7)) + if(0==strncmp(str, "colored", 7)) return IND_COLORED; - if(0==memcmp(str, "tint", 4)) + if(0==strncmp(str, "tint", 4)) return IND_TINT; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return IND_GLOW; - if(0==memcmp(str, "darken", 6)) + if(0==strncmp(str, "darken", 6)) return IND_DARKEN; - if(0==memcmp(str, "origselected", 12)) + if(0==strncmp(str, "origselected", 12)) return IND_SELECTED; } return def; @@ -103,17 +103,17 @@ static ELine toLine(const char *str, ELine def) { if (str && str[0]) { - if(0==memcmp(str, "dashes", 6)) + if(0==strncmp(str, "dashes", 6)) return LINE_DASHES; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return LINE_NONE; - if(0==memcmp(str, "sunken", 6)) + if(0==strncmp(str, "sunken", 6)) return LINE_SUNKEN; - if(0==memcmp(str, "dots", 4)) + if(0==strncmp(str, "dots", 4)) return LINE_DOTS; - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return LINE_FLAT; - if(0==memcmp(str, "1dot", 5)) + if(0==strncmp(str, "1dot", 5)) return LINE_1DOT; } return def; @@ -123,12 +123,12 @@ static ETBarBorder toTBarBorder(const char *str, ETBarBorder def) { if (str && str[0]) { - if(0==memcmp(str, "dark", 4)) - return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "dark", 4)) + return 0==strncmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; + if(0==strncmp(str, "none", 4)) return TB_NONE; - if(0==memcmp(str, "light", 5)) - return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; + if(0==strncmp(str, "light", 5)) + return 0==strncmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; } return def; } @@ -137,15 +137,15 @@ static EMouseOver toMouseOver(const char *str, EMouseOver def) { if (str && str[0]) { - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "colored", 7)) return MO_COLORED; - if(0==memcmp(str, "thickcolored", 12)) + if(0==strncmp(str, "thickcolored", 12)) return MO_COLORED_THICK; - if(0==memcmp(str, "plastik", 7)) + if(0==strncmp(str, "plastik", 7)) return MO_PLASTIK; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return MO_GLOW; - if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 4) || 0==strncmp(str, "none", 4)) return MO_NONE; } return def; @@ -156,40 +156,40 @@ toAppearance(const char *str, EAppearanc QtCPixmap *pix, bool checkImage) { if (str && str[0]) { - if(0==memcmp(str, "flat", 4)) + if(0==strncmp(str, "flat", 4)) return APPEARANCE_FLAT; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return APPEARANCE_RAISED; - if(0==memcmp(str, "dullglass", 9)) + if(0==strncmp(str, "dullglass", 9)) return APPEARANCE_DULL_GLASS; - if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10)) + if(0==strncmp(str, "glass", 5) || 0==strncmp(str, "shinyglass", 10)) return APPEARANCE_SHINY_GLASS; - if(0==memcmp(str, "agua", 4)) + if(0==strncmp(str, "agua", 4)) return APPEARANCE_AGUA; - if(0==memcmp(str, "soft", 4)) + if(0==strncmp(str, "soft", 4)) return APPEARANCE_SOFT_GRADIENT; - if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13)) + if(0==strncmp(str, "gradient", 8) || 0==strncmp(str, "lightgradient", 13)) return APPEARANCE_GRADIENT; - if(0==memcmp(str, "harsh", 5)) + if(0==strncmp(str, "harsh", 5)) return APPEARANCE_HARSH_GRADIENT; - if(0==memcmp(str, "inverted", 8)) + if(0==strncmp(str, "inverted", 8)) return APPEARANCE_INVERTED; - if(0==memcmp(str, "darkinverted", 12)) + if(0==strncmp(str, "darkinverted", 12)) return APPEARANCE_DARK_INVERTED; - if(0==memcmp(str, "splitgradient", 13)) + if(0==strncmp(str, "splitgradient", 13)) return APPEARANCE_SPLIT_GRADIENT; - if(0==memcmp(str, "bevelled", 8)) + if(0==strncmp(str, "bevelled", 8)) return APPEARANCE_BEVELLED; - if(APP_ALLOW_FADE==allow && 0==memcmp(str, "fade", 4)) + if(APP_ALLOW_FADE==allow && 0==strncmp(str, "fade", 4)) return APPEARANCE_FADE; - if(APP_ALLOW_STRIPED==allow && 0==memcmp(str, "striped", 7)) + if(APP_ALLOW_STRIPED==allow && 0==strncmp(str, "striped", 7)) return APPEARANCE_STRIPED; - if(APP_ALLOW_NONE==allow && 0==memcmp(str, "none", 4)) + if(APP_ALLOW_NONE==allow && 0==strncmp(str, "none", 4)) return APPEARANCE_NONE; - if (pix && APP_ALLOW_STRIPED==allow && 0==memcmp(str, "file", 4) && strlen(str)>9) + if (pix && APP_ALLOW_STRIPED==allow && 0==strncmp(str, "file", 4) && strlen(str)>9) return loadImage(&str[5], pix) || !checkImage ? APPEARANCE_FILE : def; - if(0==memcmp(str, "customgradient", 14) && strlen(str)>14) + if(0==strncmp(str, "customgradient", 14) && strlen(str)>14) { int i=atoi(&str[14]); @@ -207,22 +207,22 @@ toShade(const char *str, bool allowMenu, { if (str && str[0]) { /* true/false is from 0.25... */ - if((!menuShade && 0==memcmp(str, "true", 4)) || 0==memcmp(str, "selected", 8)) + if((!menuShade && 0==strncmp(str, "true", 4)) || 0==strncmp(str, "selected", 8)) return SHADE_BLEND_SELECTED; - if(0==memcmp(str, "origselected", 12)) + if(0==strncmp(str, "origselected", 12)) return SHADE_SELECTED; - if(allowMenu && (0==memcmp(str, "darken", 6) || (menuShade && 0==memcmp(str, "true", 4)))) + if(allowMenu && (0==strncmp(str, "darken", 6) || (menuShade && 0==strncmp(str, "true", 4)))) return SHADE_DARKEN; - if(allowMenu && 0==memcmp(str, "wborder", 7)) + if(allowMenu && 0==strncmp(str, "wborder", 7)) return SHADE_WINDOW_BORDER; - if(0==memcmp(str, "custom", 6)) + if(0==strncmp(str, "custom", 6)) return SHADE_CUSTOM; if('#'==str[0] && col) { qtcSetRgb(col, str); return SHADE_CUSTOM; } - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return SHADE_NONE; } @@ -234,15 +234,15 @@ static ERound toRound(const char *str, ERound def) { if (str && str[0]) { - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return ROUND_NONE; - if(0==memcmp(str, "slight", 6)) + if(0==strncmp(str, "slight", 6)) return ROUND_SLIGHT; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return ROUND_FULL; - if(0==memcmp(str, "extra", 5)) + if(0==strncmp(str, "extra", 5)) return ROUND_EXTRA; - if(0==memcmp(str, "max", 3)) + if(0==strncmp(str, "max", 3)) return ROUND_MAX; } return def; @@ -264,11 +264,11 @@ static EEffect toEffect(const char *str, EEffect def) { if (str && str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return EFFECT_NONE; - if(0==memcmp(str, "shadow", 6)) + if(0==strncmp(str, "shadow", 6)) return EFFECT_SHADOW; - if(0==memcmp(str, "etch", 4)) + if(0==strncmp(str, "etch", 4)) return EFFECT_ETCH; } @@ -285,13 +285,13 @@ static EStripe toStripe(const char *str, EStripe def) { if (str && str[0]) { - if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "plain", 5) || 0==strncmp(str, "true", 4)) return STRIPE_PLAIN; - if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "none", 4) || 0==strncmp(str, "false", 5)) return STRIPE_NONE; - if(0==memcmp(str, "diagonal", 8)) + if(0==strncmp(str, "diagonal", 8)) return STRIPE_DIAGONAL; - if(0==memcmp(str, "fade", 4)) + if(0==strncmp(str, "fade", 4)) return STRIPE_FADE; } @@ -302,17 +302,17 @@ static ESliderStyle toSlider(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "round", 5)) + if(0==strncmp(str, "round", 5)) return SLIDER_ROUND; - if(0==memcmp(str, "plain", 5)) + if(0==strncmp(str, "plain", 5)) return SLIDER_PLAIN; - if(0==memcmp(str, "r-round", 7)) + if(0==strncmp(str, "r-round", 7)) return SLIDER_ROUND_ROTATED; - if(0==memcmp(str, "r-plain", 7)) + if(0==strncmp(str, "r-plain", 7)) return SLIDER_PLAIN_ROTATED; - if(0==memcmp(str, "triangular", 10)) + if(0==strncmp(str, "triangular", 10)) return SLIDER_TRIANGULAR; - if(0==memcmp(str, "circular", 8)) + if(0==strncmp(str, "circular", 8)) return SLIDER_CIRCULAR; } @@ -323,11 +323,11 @@ static EColor toEColor(const char *str, { if(str && 0!=str[0]) { - if(0==memcmp(str, "base", 4)) + if(0==strncmp(str, "base", 4)) return ECOLOR_BASE; - if(0==memcmp(str, "dark", 4)) + if(0==strncmp(str, "dark", 4)) return ECOLOR_DARK; - if(0==memcmp(str, "background", 10)) + if(0==strncmp(str, "background", 10)) return ECOLOR_BACKGROUND; } @@ -338,19 +338,19 @@ static EFocus toFocus(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return FOCUS_STANDARD; - if(0==memcmp(str, "rect", 4) || 0==memcmp(str, "highlight", 9)) + if(0==strncmp(str, "rect", 4) || 0==strncmp(str, "highlight", 9)) return FOCUS_RECTANGLE; - if(0==memcmp(str, "filled", 6)) + if(0==strncmp(str, "filled", 6)) return FOCUS_FILLED; - if(0==memcmp(str, "full", 4)) + if(0==strncmp(str, "full", 4)) return FOCUS_FULL; - if(0==memcmp(str, "line", 4)) + if(0==strncmp(str, "line", 4)) return FOCUS_LINE; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return FOCUS_GLOW; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return FOCUS_NONE; } @@ -361,11 +361,11 @@ static ETabMo toTabMo(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "top", 3)) + if(0==strncmp(str, "top", 3)) return TAB_MO_TOP; - if(0==memcmp(str, "bot", 3)) + if(0==strncmp(str, "bot", 3)) return TAB_MO_BOTTOM; - if(0==memcmp(str, "glow", 4)) + if(0==strncmp(str, "glow", 4)) return TAB_MO_GLOW; } @@ -376,9 +376,9 @@ static EGradType toGradType(const char * { if(str && 0!=str[0]) { - if(0==memcmp(str, "horiz", 5)) + if(0==strncmp(str, "horiz", 5)) return GT_HORIZ; - if(0==memcmp(str, "vert", 4)) + if(0==strncmp(str, "vert", 4)) return GT_VERT; } return def; @@ -389,14 +389,14 @@ static bool toLvLines(const char *str, b if(str && 0!=str[0]) { #if 0 - if(0==memcmp(str, "true", 4) || 0==memcmp(str, "new", 3)) + if(0==strncmp(str, "true", 4) || 0==strncmp(str, "new", 3)) return LV_NEW; - if(0==memcmp(str, "old", 3)) + if(0==strncmp(str, "old", 3)) return LV_OLD; - if(0==memcmp(str, "false", 5) || 0==memcmp(str, "none", 4)) + if(0==strncmp(str, "false", 5) || 0==strncmp(str, "none", 4)) return LV_NONE; #else - return 0!=memcmp(str, "false", 5); + return 0!=strncmp(str, "false", 5); #endif } return def; @@ -406,15 +406,15 @@ static EGradientBorder toGradientBorder( { if (str && str[0]) { *haveAlpha = strstr(str, "-alpha") ? true : false; - if(0==memcmp(str, "light", 5) || 0==memcmp(str, "true", 4)) + if(0==strncmp(str, "light", 5) || 0==strncmp(str, "true", 4)) return GB_LIGHT; - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GB_NONE; - if(0==memcmp(str, "3dfull", 6)) + if(0==strncmp(str, "3dfull", 6)) return GB_3D_FULL; - if(0==memcmp(str, "3d", 2) || 0==memcmp(str, "false", 5)) + if(0==strncmp(str, "3d", 2) || 0==strncmp(str, "false", 5)) return GB_3D; - if(0==memcmp(str, "shine", 5)) + if(0==strncmp(str, "shine", 5)) return GB_SHINE; } return GB_3D; @@ -424,13 +424,13 @@ static EAlign toAlign(const char *str, E { if(str && 0!=str[0]) { - if(0==memcmp(str, "left", 4)) + if(0==strncmp(str, "left", 4)) return ALIGN_LEFT; - if(0==memcmp(str, "center-full", 11)) + if(0==strncmp(str, "center-full", 11)) return ALIGN_FULL_CENTER; - if(0==memcmp(str, "center", 6)) + if(0==strncmp(str, "center", 6)) return ALIGN_CENTER; - if(0==memcmp(str, "right", 5)) + if(0==strncmp(str, "right", 5)) return ALIGN_RIGHT; } return def; @@ -440,11 +440,11 @@ static ETitleBarIcon toTitlebarIcon(cons { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return TITLEBAR_ICON_NONE; - if(0==memcmp(str, "menu", 4)) + if(0==strncmp(str, "menu", 4)) return TITLEBAR_ICON_MENU_BUTTON; - if(0==memcmp(str, "title", 5)) + if(0==strncmp(str, "title", 5)) return TITLEBAR_ICON_NEXT_TO_TITLE; } return def; @@ -454,15 +454,15 @@ static EImageType toImageType(const char { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return IMG_NONE; - if(0==memcmp(str, "plainrings", 10)) + if(0==strncmp(str, "plainrings", 10)) return IMG_PLAIN_RINGS; - if(0==memcmp(str, "rings", 5)) + if(0==strncmp(str, "rings", 5)) return IMG_BORDERED_RINGS; - if(0==memcmp(str, "squarerings", 11)) + if(0==strncmp(str, "squarerings", 11)) return IMG_SQUARE_RINGS; - if(0==memcmp(str, "file", 4)) + if(0==strncmp(str, "file", 4)) return IMG_FILE; } return def; @@ -472,13 +472,13 @@ static EGlow toGlow(const char *str, EGl { if(str && 0!=str[0]) { - if(0==memcmp(str, "none", 4)) + if(0==strncmp(str, "none", 4)) return GLOW_NONE; - if(0==memcmp(str, "start", 5)) + if(0==strncmp(str, "start", 5)) return GLOW_START; - if(0==memcmp(str, "middle", 6)) + if(0==strncmp(str, "middle", 6)) return GLOW_MIDDLE; - if(0==memcmp(str, "end", 3)) + if(0==strncmp(str, "end", 3)) return GLOW_END; } return def; @@ -488,11 +488,11 @@ static ETBarBtn toTBarBtn(const char *st { if(str && 0!=str[0]) { - if(0==memcmp(str, "standard", 8)) + if(0==strncmp(str, "standard", 8)) return TBTN_STANDARD; - if(0==memcmp(str, "raised", 6)) + if(0==strncmp(str, "raised", 6)) return TBTN_RAISED; - if(0==memcmp(str, "joined", 6)) + if(0==strncmp(str, "joined", 6)) return TBTN_JOINED; } return def;