version 1.5.2.4, 2012/04/02 09:10:31
|
version 1.5.2.5, 2012/05/14 12:48:21
|
Line 71 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
Line 71 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
|
|
Limit = sizeof(ait_val_t) * io_arraySize(vars); |
Limit = sizeof(ait_val_t) * io_arraySize(vars); |
if (Limit > buflen) { |
if (Limit > buflen) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d needed min %d ...\n", | io_SetErr(EMSGSIZE, "Short buffer buflen=%d needed min %d", |
buflen, Limit); |
buflen, Limit); |
return -1; |
return -1; |
} else { |
} else { |
Line 105 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
Line 105 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
break; |
break; |
case data: |
case data: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
return -1; |
return -1; |
} else |
} else |
Limit += AIT_LEN(val); |
Limit += AIT_LEN(val); |
Line 119 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
Line 119 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
case buffer: |
case buffer: |
case string: |
case string: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
return -1; |
return -1; |
} else |
} else |
Limit += AIT_LEN(val); |
Limit += AIT_LEN(val); |
Line 131 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
Line 131 io_vars2buffer(u_char *buf, int buflen, array_t *vars)
|
dat += AIT_LEN(val); |
dat += AIT_LEN(val); |
break; |
break; |
default: |
default: |
io_SetErr(EINVAL, "Error:: unsupported variable type=%d at element #%d ...\n", | io_SetErr(EINVAL, "Unsupported variable type=%d at element #%d", |
AIT_TYPE(val), i); |
AIT_TYPE(val), i); |
return -1; |
return -1; |
} |
} |
Line 165 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
Line 165 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
|
|
Limit = sizeof(ait_val_t) * vnum; |
Limit = sizeof(ait_val_t) * vnum; |
if (Limit > buflen) { |
if (Limit > buflen) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d needed min %d ...\n", | io_SetErr(EMSGSIZE, "Short buffer buflen=%d needed min %d", |
buflen, Limit); |
buflen, Limit); |
return NULL; |
return NULL; |
} else { |
} else { |
Line 223 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
Line 223 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
case buffer: |
case buffer: |
case string: |
case string: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
if (!zcpy) |
if (!zcpy) |
io_arrayFree(vars); |
io_arrayFree(vars); |
io_arrayDestroy(&vars); |
io_arrayDestroy(&vars); |
Line 246 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
Line 246 io_buffer2vars(u_char *buf, int buflen, int vnum, int
|
dat += AIT_LEN(val); |
dat += AIT_LEN(val); |
break; |
break; |
default: |
default: |
io_SetErr(EINVAL, "Error:: unsupported variable type=%d at element #%d ...\n", | io_SetErr(EINVAL, "Unsupported variable type=%d at element #%d", |
AIT_TYPE(val), i); |
AIT_TYPE(val), i); |
if (!zcpy) |
if (!zcpy) |
io_arrayFree(vars); |
io_arrayFree(vars); |
Line 285 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
Line 285 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
|
|
Limit = sizeof(ait_val_t) * io_arraySize(vars); |
Limit = sizeof(ait_val_t) * io_arraySize(vars); |
if (Limit > buflen) { |
if (Limit > buflen) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d needed min %d ...\n", | io_SetErr(EMSGSIZE, "Short buffer buflen=%d needed min %d", |
buflen, Limit); |
buflen, Limit); |
return -1; |
return -1; |
} else { |
} else { |
Line 319 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
Line 319 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
break; |
break; |
case data: |
case data: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
return -1; |
return -1; |
} else |
} else |
Limit += AIT_LEN(val); |
Limit += AIT_LEN(val); |
Line 333 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
Line 333 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
case buffer: |
case buffer: |
case string: |
case string: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
return -1; |
return -1; |
} else |
} else |
Limit += AIT_LEN(val); |
Limit += AIT_LEN(val); |
Line 345 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
Line 345 io_vars2map(u_char *buf, int buflen, array_t *vars)
|
dat += AIT_LEN(val); |
dat += AIT_LEN(val); |
break; |
break; |
default: |
default: |
io_SetErr(EINVAL, "Error:: unsupported variable type=%d at element #%d ...\n", | io_SetErr(EINVAL, "Unsupported variable type=%d at element #%d", |
AIT_TYPE(val), i); |
AIT_TYPE(val), i); |
return -1; |
return -1; |
} |
} |
Line 379 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
Line 379 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
|
|
Limit = sizeof(ait_val_t) * vnum; |
Limit = sizeof(ait_val_t) * vnum; |
if (Limit > buflen) { |
if (Limit > buflen) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d needed min %d ...\n", | io_SetErr(EMSGSIZE, "Short buffer buflen=%d needed min %d", |
buflen, Limit); |
buflen, Limit); |
return NULL; |
return NULL; |
} else { |
} else { |
Line 428 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
Line 428 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
case buffer: |
case buffer: |
case string: |
case string: |
if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
io_SetErr(EMSGSIZE, "Error:: too short buffer buflen=%d " | io_SetErr(EMSGSIZE, "short buffer buflen=%d " |
"needed min %d ...\n", buflen, Limit + AIT_LEN(val)); | "needed min %d", buflen, Limit + AIT_LEN(val)); |
if (!zcpy) |
if (!zcpy) |
io_arrayFree(vars); |
io_arrayFree(vars); |
io_arrayDestroy(&vars); |
io_arrayDestroy(&vars); |
Line 451 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
Line 451 io_map2vars(u_char *buf, int buflen, int vnum, int zcp
|
dat += AIT_LEN(val); |
dat += AIT_LEN(val); |
break; |
break; |
default: |
default: |
io_SetErr(EINVAL, "Error:: unsupported variable type=%d at element #%d ...\n", | io_SetErr(EINVAL, "Unsupported variable type=%d at element #%d", |
AIT_TYPE(val), i); |
AIT_TYPE(val), i); |
if (!zcpy) |
if (!zcpy) |
io_arrayFree(vars); |
io_arrayFree(vars); |
Line 481 io_allocVars(int varnum)
|
Line 481 io_allocVars(int varnum)
|
return NULL; |
return NULL; |
|
|
for (i = 0; i < io_arraySize(arr); i++) { |
for (i = 0; i < io_arraySize(arr); i++) { |
v = malloc(sizeof(ait_val_t)); | if (!(v = io_allocVar())) { |
if (!v) { | |
LOGERR; | |
io_freeVars(&arr); |
io_freeVars(&arr); |
return NULL; |
return NULL; |
} else { | } else |
memset(v, 0, sizeof(ait_val_t)); | |
io_arraySet(arr, i, v); |
io_arraySet(arr, i, v); |
} |
|
} |
} |
|
|
return arr; |
return arr; |
Line 505 inline int
|
Line 501 inline int
|
io_clrVars(array_t * __restrict vars) |
io_clrVars(array_t * __restrict vars) |
{ |
{ |
register int i; |
register int i; |
ait_val_t *v; |
|
|
|
if (!vars) |
if (!vars) |
return -1; |
return -1; |
|
|
for (i = 0; i < io_arraySize(vars); i++) |
for (i = 0; i < io_arraySize(vars); i++) |
if ((v = io_array(vars, i, ait_val_t*))) | io_freeVar((ait_val_t**) io_arrayGet2(vars, i)); |
AIT_FREE_VAL(v); | |
|
|
return io_arraySize(vars); |
return io_arraySize(vars); |
} |
} |
Line 530 io_freeVars(array_t ** __restrict vars)
|
Line 524 io_freeVars(array_t ** __restrict vars)
|
return; |
return; |
|
|
io_clrVars(*vars); |
io_clrVars(*vars); |
io_arrayFree(*vars); |
|
io_arrayDestroy(vars); |
io_arrayDestroy(vars); |
} |
} |
|
|
Line 562 io_allocVar(void)
|
Line 555 io_allocVar(void)
|
* return: none |
* return: none |
*/ |
*/ |
inline void |
inline void |
io_freeVar(ait_val_t * __restrict val) | io_freeVar(ait_val_t ** __restrict val) |
{ |
{ |
if (val) { | if (val && *val) { |
AIT_FREE_VAL(val); | AIT_FREE_VAL(*val); |
free(val); | free(*val); |
val = NULL; | *val = NULL; |
} |
} |
} |
} |
|
|