version 1.1.2.13, 2014/01/29 13:37:13
|
version 1.1.2.15, 2014/01/29 13:56:52
|
Line 9 ub_flash_io(const char *csSec, int mode)
|
Line 9 ub_flash_io(const char *csSec, int mode)
|
{ |
{ |
int f, l, rlen; |
int f, l, rlen; |
const char *str; |
const char *str; |
size_t siz, esiz; | ssize_t siz, esiz; |
ait_val_t v; |
ait_val_t v; |
u_int crc; |
u_int crc; |
|
|
Line 122 const char*
|
Line 122 const char*
|
ub_getenv(const char *csSec, const char *csName) |
ub_getenv(const char *csSec, const char *csName) |
{ |
{ |
char *e, *nxt; |
char *e, *nxt; |
size_t dlen; | size_t dlen = 0; |
const char *str = NULL; |
const char *str = NULL; |
|
|
FTRACE(3); |
FTRACE(3); |
Line 132 ub_getenv(const char *csSec, const char *csName)
|
Line 132 ub_getenv(const char *csSec, const char *csName)
|
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
if (!str) |
if (!str) |
return NULL; |
return NULL; |
|
dlen -= sizeof env->env_crc; |
} |
} |
dlen = strtol(str, NULL, 0); | dlen += strtol(str, NULL, 0); |
if (!dlen) |
if (!dlen) |
return NULL; |
return NULL; |
else |
else |
Line 158 int
|
Line 159 int
|
ub_setenv(const char *csSec, const char *csName, const char *csValue) |
ub_setenv(const char *csSec, const char *csName, const char *csValue) |
{ |
{ |
char *e, *nxt; |
char *e, *nxt; |
size_t dlen, len; | ssize_t dlen = 0, len; |
const char *str, *old = NULL; |
const char *str, *old = NULL; |
|
|
FTRACE(3); |
FTRACE(3); |
Line 168 ub_setenv(const char *csSec, const char *csName, const
|
Line 169 ub_setenv(const char *csSec, const char *csName, const
|
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
if (!str) |
if (!str) |
return -1; |
return -1; |
|
dlen -= sizeof env->env_crc; |
} |
} |
dlen = strtol(str, NULL, 0); | dlen += strtol(str, NULL, 0); |
if (!dlen) |
if (!dlen) |
return -1; |
return -1; |
else |
else |
Line 206 ub_setenv(const char *csSec, const char *csName, const
|
Line 208 ub_setenv(const char *csSec, const char *csName, const
|
for (e = env->env_data; *e || *(e + 1); e++); |
for (e = env->env_data; *e || *(e + 1); e++); |
if (e > env->env_data) |
if (e > env->env_data) |
e++; |
e++; |
/* "name" + "=" + "val" +"\0\0" > u-boot-env size */ | /* "name" + "=" + "val" +"\0\0" check u-boot-env size */ |
len = strlen(csName) + 2; /* add '=' for first arg, ' ' for all others */ |
len = strlen(csName) + 2; /* add '=' for first arg, ' ' for all others */ |
len += strlen(csValue) + 1; |
len += strlen(csValue) + 1; |
if (len > env->env_data + dlen - e) { |
if (len > env->env_data + dlen - e) { |
Line 236 int
|
Line 238 int
|
ub_env(const char *csSec) |
ub_env(const char *csSec) |
{ |
{ |
char *e, *nxt; |
char *e, *nxt; |
size_t dlen; | ssize_t dlen = 0; |
const char *str; |
const char *str; |
|
|
FTRACE(3); |
FTRACE(3); |
Line 246 ub_env(const char *csSec)
|
Line 248 ub_env(const char *csSec)
|
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
str = cfg_getAttribute(&cfg, csSec, "drive_size"); |
if (!str) |
if (!str) |
return -1; |
return -1; |
|
dlen -= sizeof env->env_crc; |
} |
} |
dlen = strtol(str, NULL, 0); | dlen += strtol(str, NULL, 0); |
if (!dlen) |
if (!dlen) |
return -1; |
return -1; |
else |
else |