summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libjsmn/jsmn.h
diff options
context:
space:
mode:
authorcy <cy@FreeBSD.org>2015-07-05 15:42:16 +0000
committercy <cy@FreeBSD.org>2015-07-05 15:42:16 +0000
commit4798ffa9e1d37998fdd0d94d9c2ad9cb3fb5d110 (patch)
treefb96356e3ef85aaa8d1f5939a9decd315a7ca596 /contrib/ntp/libjsmn/jsmn.h
parent8920bf0c56d10d9413aa5f7595886836b12c974f (diff)
parent5ef283fde5be3bb35376b46b0d8cdc0e6dff0ad4 (diff)
downloadFreeBSD-src-4798ffa9e1d37998fdd0d94d9c2ad9cb3fb5d110.zip
FreeBSD-src-4798ffa9e1d37998fdd0d94d9c2ad9cb3fb5d110.tar.gz
MFV ntp-4.2.8p3 (r284990).
Approved by: roberto, delphij Security: VuXML: 0d0f3050-1f69-11e5-9ba9-d050996490d0 Security: http://bugs.ntp.org/show_bug.cgi?id=2853 Security: https://www.kb.cert.org/vuls/id/668167 Security: http://support.ntp.org/bin/view/Main/SecurityNotice#June_2015_NTP_Security_Vulnerabi
Diffstat (limited to 'contrib/ntp/libjsmn/jsmn.h')
-rw-r--r--contrib/ntp/libjsmn/jsmn.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/ntp/libjsmn/jsmn.h b/contrib/ntp/libjsmn/jsmn.h
index 03b2c1a..95fb2ca 100644
--- a/contrib/ntp/libjsmn/jsmn.h
+++ b/contrib/ntp/libjsmn/jsmn.h
@@ -1,6 +1,12 @@
#ifndef __JSMN_H_
#define __JSMN_H_
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* JSON type identifier. Basic types are:
* o Object
@@ -21,9 +27,7 @@ typedef enum {
/* Invalid character inside JSON string */
JSMN_ERROR_INVAL = -2,
/* The string is not a full JSON packet, more bytes expected */
- JSMN_ERROR_PART = -3,
- /* Everything was fine */
- JSMN_SUCCESS = 0
+ JSMN_ERROR_PART = -3
} jsmnerr_t;
/**
@@ -48,7 +52,7 @@ typedef struct {
*/
typedef struct {
unsigned int pos; /* offset in the JSON string */
- int toknext; /* next token to allocate */
+ unsigned int toknext; /* next token to allocate */
int toksuper; /* superior token node, e.g parent object or array */
} jsmn_parser;
@@ -61,7 +65,11 @@ void jsmn_init(jsmn_parser *parser);
* Run JSON parser. It parses a JSON data string into and array of tokens, each describing
* a single JSON object.
*/
-jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js,
+jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __JSMN_H_ */
OpenPOWER on IntegriCloud