13
src/error.c
13
src/error.c
@@ -34,17 +34,19 @@ void jsonp_error_set_source(json_error_t *error, const char *source)
|
||||
}
|
||||
|
||||
void jsonp_error_set(json_error_t *error, int line, int column,
|
||||
size_t position, const char *msg, ...)
|
||||
size_t position, enum json_error_code code,
|
||||
const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
jsonp_error_vset(error, line, column, position, msg, ap);
|
||||
jsonp_error_vset(error, line, column, position, code, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void jsonp_error_vset(json_error_t *error, int line, int column,
|
||||
size_t position, const char *msg, va_list ap)
|
||||
size_t position, enum json_error_code code,
|
||||
const char *msg, va_list ap)
|
||||
{
|
||||
if(!error)
|
||||
return;
|
||||
@@ -58,6 +60,7 @@ void jsonp_error_vset(json_error_t *error, int line, int column,
|
||||
error->column = column;
|
||||
error->position = (int)position;
|
||||
|
||||
vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap);
|
||||
error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||
vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH - 1, msg, ap);
|
||||
error->text[JSON_ERROR_TEXT_LENGTH - 2] = '\0';
|
||||
error->text[JSON_ERROR_TEXT_LENGTH - 1] = code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user