Made the names of the function arguments of the declaration and the definition of mg_get_var(..) the same.

Changed the error codes to have a consistent way of reporting errors. -2 is returned if there is a problem with the size of the destination buffer. -1 is returned if the variable is not found.

Updated the documentation of mg_get_var(..) in mongoose.h and removed the redundant comments from mongoose.c.
This commit is contained in:
nullable.type committed 2012-12-16 12:27:53 +01:00
1 parent 0912a7f473
commit c9183f3851
2 files changed
+17 -18

No files matched your search

+6 -6
View File
@@ -286,19 +286,19 @@ const char *mg_get_header(const struct mg_connection *, const char *name);
// or request_info.query_string.
// data_len: length of the encoded data.
// var_name: variable name to decode from the buffer
// buf: destination buffer for the decoded variable
// buf_len: length of the destination buffer
// dst: destination buffer for the decoded variable
// dst_len: length of the destination buffer
//
// Return:
// On success, length of the decoded variable.
// On error:
// -1 (variable not found, or destination buffer is too small).
// -2 (destination buffer is NULL or zero length).
// -1 (variable not found).
// -2 (destination buffer is NULL, zero length or too small to hold the decoded variable).
//
// Destination buffer is guaranteed to be '\0' - terminated if it is not
// NULL or zero length. In case of failure, dst[0] == '\0'.
// NULL or zero length.
int mg_get_var(const char *data, size_t data_len,
const char *var_name, char *buf, size_t buf_len);
const char *var_name, char *dst, size_t dst_len);
// Fetch value of certain cookie variable into the destination buffer.
//