Fix warnings in RCons and update sdb

This commit is contained in:
pancake 2014-12-14 01:56:55 +01:00
parent a6b34c4d53
commit cace7101e5
2 changed files with 12 additions and 4 deletions

View File

@ -122,16 +122,23 @@ R_API char *r_cons_pal_parse(const char *str) {
return r_cons_color_random (0);
}
if (!strncmp (s, "rgb:", 4)) {
int correct = 0;
if (length == 7) {
r = rgbnum (s[4],s[4]);
g = rgbnum (s[5],s[5]);
b = rgbnum (s[6],s[6]);
correct = 1;
} else if (length == 10) {
r = rgbnum(s[4],s[5]);
g = rgbnum(s[6],s[7]);
b = rgbnum(s[8],s[9]);
correct = 1;
}
if (correct) {
r_cons_rgb_str (out, r, g, b, 0);
} else {
eprintf ("Invalid rgb string (%s)\n", str);
}
r_cons_rgb_str (out, r, g, b, 0);
}
for (i=0; colors[i].name; i++) {
if (!strcmp (s, colors[i].name))

View File

@ -143,9 +143,10 @@ SDB_API char *sdb_anext(char *str, char **next) {
}
SDB_API const char *sdb_const_anext(const char *str, const char **next) {
const char *p = strchr (str, SDB_RS);
const char *nxt = p? p+1: NULL;
if (next) *next = nxt;
if (next) {
const char *p = strchr (str, SDB_RS);
*next = p? p+1: NULL;
}
return str;
}