diff options
author | Thomas White <taw@physics.org> | 2019-03-08 19:44:06 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-03-14 11:36:57 +0100 |
commit | 994c14337ecf9a754ebd40ca78fc384a527cd353 (patch) | |
tree | 38f9bc3bd0b2f7bb34de4dd6c54c41186e4eb52b /src/im-zmq.c | |
parent | de09b82310f7b464e4095d1b750d9b968c84b6ed (diff) |
More ZMQ/MsgPack logic fixes
Diffstat (limited to 'src/im-zmq.c')
-rw-r--r-- | src/im-zmq.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/im-zmq.c b/src/im-zmq.c index 4503acff..3efb6607 100644 --- a/src/im-zmq.c +++ b/src/im-zmq.c @@ -145,9 +145,11 @@ static msgpack_object *find_msgpack_kv(msgpack_object *obj, const char *key) for ( i=0; i<obj->via.map.size; i++ ) { const char *kstr; + size_t klen; assert(obj->via.map.ptr[i].key.type == MSGPACK_OBJECT_STR); kstr = obj->via.map.ptr[i].key.via.str.ptr; - if ( strcmp(kstr, key) == 0 ) { + klen = obj->via.map.ptr[i].key.via.str.size; + if ( strncmp(kstr, key, klen) == 0 ) { return &obj->via.map.ptr[i].val; } } @@ -318,11 +320,11 @@ int unpack_msgpack_data(msgpack_object *obj, struct image *image) ERROR("No data MessagePack object found inside corr_data.\n"); return 1; } - if ( data_obj->type != MSGPACK_OBJECT_BIN ) { + if ( data_obj->type != MSGPACK_OBJECT_STR ) { ERROR("corr_data.data isn't a binary object.\n"); return 1; } - data = (double *)data_obj->via.bin.ptr; + data = (double *)data_obj->via.str.ptr; shape_obj = find_msgpack_kv(corr_data_obj, "shape"); if ( shape_obj == NULL ) { |