libyajl-2.0 compatibility fixes (API got changed)

OK landry@
This commit is contained in:
dcoppa 2011-05-05 12:19:36 +00:00
parent 041ba31a1e
commit 58e56a137f
5 changed files with 171 additions and 8 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.14 2011/04/29 09:18:53 dcoppa Exp $
# $OpenBSD: Makefile,v 1.15 2011/05/05 12:19:36 dcoppa Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-3.e-bf2
PKGNAME = i3-3.5.2
REVISION = 1
REVISION = 2
CATEGORIES = x11
@ -25,7 +25,7 @@ WANTLIB += xcb-xinerama yajl
MODULES = converters/libiconv
LIB_DEPENDS = devel/libev \
devel/libyajl
devel/libyajl>=2.0.0
BUILD_DEPENDS = devel/bison
RUN_DEPENDS = x11/dmenu \
devel/p5-IPC-Run \

View File

@ -1,6 +1,9 @@
$OpenBSD: patch-src_ipc_c,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
$OpenBSD: patch-src_ipc_c,v 1.3 2011/05/05 12:19:36 dcoppa Exp $
Make code compatible with libyajl-2.0 (API got changed)
--- src/ipc.c.orig Wed Jan 19 21:26:37 2011
+++ src/ipc.c Wed Apr 27 16:56:21 2011
+++ src/ipc.c Mon May 2 11:35:58 2011
@@ -91,7 +91,7 @@ static void ipc_send_message(int fd, const unsigned ch
char msg[buffer_size];
char *walk = msg;
@ -10,6 +13,60 @@ $OpenBSD: patch-src_ipc_c,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
walk += strlen("i3-ipc");
memcpy(walk, &message_size, sizeof(uint32_t));
walk += sizeof(uint32_t);
@@ -182,7 +182,7 @@ IPC_HANDLER(get_workspaces) {
if (last_focused == SLIST_END(&(c_ws->focus_stack)))
last_focused = NULL;
- yajl_gen gen = yajl_gen_alloc(NULL, NULL);
+ yajl_gen gen = yajl_gen_alloc(NULL);
y(array_open);
TAILQ_FOREACH(ws, workspaces, workspaces) {
@@ -226,7 +226,7 @@ IPC_HANDLER(get_workspaces) {
y(array_close);
const unsigned char *payload;
- unsigned int length;
+ size_t length;
y(get_buf, &payload, &length);
ipc_send_message(fd, payload, I3_IPC_REPLY_TYPE_WORKSPACES, length);
@@ -241,7 +241,7 @@ IPC_HANDLER(get_workspaces) {
IPC_HANDLER(get_outputs) {
Output *output;
- yajl_gen gen = yajl_gen_alloc(NULL, NULL);
+ yajl_gen gen = yajl_gen_alloc(NULL);
y(array_open);
TAILQ_FOREACH(output, &outputs, outputs) {
@@ -276,7 +276,7 @@ IPC_HANDLER(get_outputs) {
y(array_close);
const unsigned char *payload;
- unsigned int length;
+ size_t length;
y(get_buf, &payload, &length);
ipc_send_message(fd, payload, I3_IPC_REPLY_TYPE_OUTPUTS, length);
@@ -288,7 +288,7 @@ IPC_HANDLER(get_outputs) {
*
*/
static int add_subscription(void *extra, const unsigned char *s,
- unsigned int len) {
+ size_t len) {
ipc_client *client = extra;
DLOG("should add subscription to extra %p, sub %.*s\n", client, len, s);
@@ -338,7 +338,7 @@ IPC_HANDLER(subscribe) {
memset(&callbacks, 0, sizeof(yajl_callbacks));
callbacks.yajl_string = add_subscription;
- p = yajl_alloc(&callbacks, NULL, NULL, (void*)client);
+ p = yajl_alloc(&callbacks, NULL, (void*)client);
stat = yajl_parse(p, (const unsigned char*)message, message_size);
if (stat != yajl_status_ok) {
unsigned char *err;
@@ -437,7 +437,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w,
n -= strlen(I3_IPC_MAGIC);

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
# $OpenBSD: Makefile,v 1.3 2011/05/05 12:20:20 dcoppa Exp $
COMMENT = status and workspace bar for i3
DISTNAME = i3bar-0.6.21
REVISION = 0
REVISION = 1
CATEGORIES = x11
MAINTAINER = David Coppa <dcoppa@openbsd.org>
@ -26,7 +26,7 @@ BUILD_DEPENDS = textproc/asciidoc \
x11/i3
LIB_DEPENDS = devel/libev \
devel/libyajl
devel/libyajl>=2.0.0
RUN_DEPENDS = x11/i3

View File

@ -0,0 +1,53 @@
$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);

View File

@ -0,0 +1,53 @@
$OpenBSD: patch-src_workspaces_c,v 1.1 2011/05/05 12:20:20 dcoppa Exp $
Make code compatible with libyajl-2.0 (API got changed)
--- src/workspaces.c.orig Mon May 2 11:43:04 2011
+++ src/workspaces.c Mon May 2 11:50:16 2011
@@ -57,7 +57,7 @@ static int workspaces_boolean_cb(void *params_, bool v
* Parse an integer (num or the rect)
*
*/
-static int workspaces_integer_cb(void *params_, long val) {
+static int workspaces_integer_cb(void *params_, long long val) {
struct workspaces_json_params *params = (struct workspaces_json_params*) params_;
if (!strcmp(params->cur_key, "num")) {
@@ -98,7 +98,7 @@ static int workspaces_integer_cb(void *params_, long v
* Parse a string (name, output)
*
*/
-static int workspaces_string_cb(void *params_, const unsigned char *val, unsigned int len) {
+static int workspaces_string_cb(void *params_, const unsigned char *val, size_t len) {
struct workspaces_json_params *params = (struct workspaces_json_params*) params_;
@@ -178,7 +178,7 @@ static int workspaces_start_map_cb(void *params_) {
* Essentially we just save it in the parsing-state
*
*/
-static int workspaces_map_key_cb(void *params_, const unsigned char *keyVal, unsigned int keyLen) {
+static int workspaces_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
struct workspaces_json_params *params = (struct workspaces_json_params*) params_;
FREE(params->cur_key);
@@ -224,10 +224,9 @@ void parse_workspaces_json(char *json) {
params.json = json;
yajl_handle handle;
- yajl_parser_config parse_conf = { 0, 0 };
yajl_status state;
- handle = yajl_alloc(&workspaces_callbacks, &parse_conf, NULL, (void*) &params);
+ handle = yajl_alloc(&workspaces_callbacks, NULL, (void*) &params);
state = yajl_parse(handle, (const unsigned char*) json, strlen(json));
@@ -236,7 +235,6 @@ void parse_workspaces_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 workspaces-reply!\n");
exit(EXIT_FAILURE);