Example #1
0
bool msgpack_unpacker_next(msgpack_unpacker* mpac, msgpack_unpacked* result)
{
    if(result->zone != NULL) {
        msgpack_zone_free(result->zone);
    }

    int ret = msgpack_unpacker_execute(mpac);

    if(ret <= 0) {
        result->zone = NULL;
        memset(&result->data, 0, sizeof(msgpack_object));
        return false;
    }

    result->zone = msgpack_unpacker_release_zone(mpac);
    result->data = msgpack_unpacker_data(mpac);
    msgpack_unpacker_reset(mpac);

    return true;
}
Example #2
0
msgpack_unpack_return msgpack_unpacker_next(msgpack_unpacker* mpac, msgpack_unpacked* result)
{
    msgpack_unpacked_destroy(result);

    int ret = msgpack_unpacker_execute(mpac);

    if(ret < 0) {
        result->zone = NULL;
        memset(&result->data, 0, sizeof(msgpack_object));
        return MSGPACK_UNPACK_PARSE_ERROR;
    }

    if(ret == 0) {
        return MSGPACK_UNPACK_CONTINUE;
    }
    result->zone = msgpack_unpacker_release_zone(mpac);
    result->data = msgpack_unpacker_data(mpac);
    msgpack_unpacker_reset(mpac);

    return MSGPACK_UNPACK_SUCCESS;
}
Example #3
0
void msgpack_unpacker_data_wrap(msgpack_unpacker *mpac, msgpack_object *obj)
{
  *obj=msgpack_unpacker_data(mpac);
}