Kouhei Sutou
null+****@clear*****
Wed May 9 11:18:01 JST 2018
Kouhei Sutou 2018-05-09 11:18:01 +0900 (Wed, 09 May 2018) New Revision: e5786287b893cbccc0aa3dd27f6c88ab39d3333f https://github.com/groonga/groonga/commit/e5786287b893cbccc0aa3dd27f6c88ab39d3333f Message: Add grn_output_uint32() internal API Modified files: lib/grn_output.h lib/output.c Modified: lib/grn_output.h (+5 -1) =================================================================== --- lib/grn_output.h 2018-05-09 10:52:11 +0900 (af99b0c9c) +++ lib/grn_output.h 2018-05-09 11:18:01 +0900 (4aef5979f) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2010-2016 Brazil + Copyright(C) 2010-2018 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -37,6 +37,10 @@ GRN_API void grn_output_null(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type); void grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, int32_t value); +void grn_output_uint32(grn_ctx *ctx, + grn_obj *outbuf, + grn_content_type output_type, + uint32_t value); GRN_API void grn_output_int64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, int64_t value); Modified: lib/output.c (+33 -0) =================================================================== --- lib/output.c 2018-05-09 10:52:11 +0900 (6e54b6a26) +++ lib/output.c 2018-05-09 11:18:01 +0900 (96a972032) @@ -356,6 +356,39 @@ grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, in } void +grn_output_uint32(grn_ctx *ctx, + grn_obj *outbuf, + grn_content_type output_type, + uint32_t value) +{ + put_delimiter(ctx, outbuf, output_type); + switch (output_type) { + case GRN_CONTENT_JSON: + grn_text_ulltoa(ctx, outbuf, value); + break; + case GRN_CONTENT_TSV: + grn_text_ulltoa(ctx, outbuf, value); + break; + case GRN_CONTENT_XML: + GRN_TEXT_PUTS(ctx, outbuf, "<INT>"); + grn_text_ulltoa(ctx, outbuf, value); + GRN_TEXT_PUTS(ctx, outbuf, "</INT>"); + break; + case GRN_CONTENT_MSGPACK : +#ifdef GRN_WITH_MESSAGE_PACK + msgpack_pack_uint32(&ctx->impl->output.msgpacker, value); +#endif + break; + case GRN_CONTENT_GROONGA_COMMAND_LIST : + grn_text_ulltoa(ctx, outbuf, value); + break; + case GRN_CONTENT_NONE: + break; + } + INCR_LENGTH; +} + +void grn_output_int64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, int64_t value) { put_delimiter(ctx, outbuf, output_type); -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180509/8f97ff00/attachment-0001.htm