openbsd-ports/x11/i3bar/patches/patch-src_outputs_c
2011-05-05 12:19:36 +00:00

54 lines
2.1 KiB
Plaintext

$OpenBSD: patch-src_outputs_c,v 1.1 2011/05/05 12:20:20 dcoppa Exp $
Make code compatible with libyajl-2.0 (API got changed)
--- src/outputs.c.orig Mon May 2 11:43:00 2011
+++ src/outputs.c Mon May 2 11:46:07 2011
@@ -59,7 +59,7 @@ static int outputs_boolean_cb(void *params_, bool val)
* Parse an integer (current_workspace or the rect)
*
*/
-static int outputs_integer_cb(void *params_, long val) {
+static int outputs_integer_cb(void *params_, long long val) {
struct outputs_json_params *params = (struct outputs_json_params*) params_;
if (!strcmp(params->cur_key, "current_workspace")) {
@@ -99,7 +99,7 @@ static int outputs_integer_cb(void *params_, long val)
* Parse a string (name)
*
*/
-static int outputs_string_cb(void *params_, const unsigned char *val, unsigned int len) {
+static int outputs_string_cb(void *params_, const unsigned char *val, size_t len) {
struct outputs_json_params *params = (struct outputs_json_params*) params_;
if (strcmp(params->cur_key, "name")) {
@@ -169,7 +169,7 @@ static int outputs_end_map_cb(void *params_) {
* Essentially we just save it in the parsing-state
*
*/
-static int outputs_map_key_cb(void *params_, const unsigned char *keyVal, unsigned int keyLen) {
+static int outputs_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
struct outputs_json_params *params = (struct outputs_json_params*) params_;
FREE(params->cur_key);
@@ -216,10 +216,9 @@ void parse_outputs_json(char *json) {
params.json = json;
yajl_handle handle;
- yajl_parser_config parse_conf = { 0, 0 };
yajl_status state;
- handle = yajl_alloc(&outputs_callbacks, &parse_conf, NULL, (void*) &params);
+ handle = yajl_alloc(&outputs_callbacks, NULL, (void*) &params);
state = yajl_parse(handle, (const unsigned char*) json, strlen(json));
@@ -228,7 +227,6 @@ void parse_outputs_json(char *json) {
case yajl_status_ok:
break;
case yajl_status_client_canceled:
- case yajl_status_insufficient_data:
case yajl_status_error:
ELOG("Could not parse outputs-reply!\n");
exit(EXIT_FAILURE);