forked from github/server
coverity warning: NEGATIVE_RETURNS
This commit is contained in:
parent
03a94d1264
commit
5e48eac26a
|
@ -144,7 +144,7 @@ typedef enum {
|
||||||
P_TREES,
|
P_TREES,
|
||||||
P_ALLIANCE,
|
P_ALLIANCE,
|
||||||
MAXPARAMS,
|
MAXPARAMS,
|
||||||
NOPARAM = -1
|
NOPARAM
|
||||||
} param_t;
|
} param_t;
|
||||||
|
|
||||||
typedef enum { /* Fehler und Meldungen im Report */
|
typedef enum { /* Fehler und Meldungen im Report */
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
const char * keyword(keyword_t kwd)
|
const char * keyword(keyword_t kwd)
|
||||||
{
|
{
|
||||||
static char result[32]; // FIXME: static return value
|
static char result[32]; // FIXME: static return value
|
||||||
|
if (kwd==NOKEYWORD) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (!result[0]) {
|
if (!result[0]) {
|
||||||
strcpy(result, "keyword::");
|
strcpy(result, "keyword::");
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ extern "C"
|
||||||
K_PAY,
|
K_PAY,
|
||||||
K_LOOT,
|
K_LOOT,
|
||||||
MAXKEYWORDS,
|
MAXKEYWORDS,
|
||||||
NOKEYWORD = -1
|
NOKEYWORD
|
||||||
} keyword_t;
|
} keyword_t;
|
||||||
|
|
||||||
extern const char *keywords[MAXKEYWORDS];
|
extern const char *keywords[MAXKEYWORDS];
|
||||||
|
|
|
@ -11,11 +11,13 @@
|
||||||
static void test_init_keywords(CuTest *tc) {
|
static void test_init_keywords(CuTest *tc) {
|
||||||
struct locale *lang;
|
struct locale *lang;
|
||||||
|
|
||||||
test_cleanup();
|
test_setup();
|
||||||
lang = get_or_create_locale("en");
|
lang = get_or_create_locale("en");
|
||||||
locale_setstring(lang, "keyword::move", "MOVE");
|
locale_setstring(lang, "keyword::move", "MOVE");
|
||||||
init_keywords(lang);
|
init_keywords(lang);
|
||||||
CuAssertIntEquals(tc, K_MOVE, get_keyword("move", lang));
|
CuAssertIntEquals(tc, K_MOVE, get_keyword("move", lang));
|
||||||
|
CuAssertStrEquals(tc, "keyword::move", keyword(K_MOVE));
|
||||||
|
CuAssertPtrEquals(tc, NULL, (void *)keyword(NOKEYWORD));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue