pbc icon indicating copy to clipboard operation
pbc copied to clipboard

如何解析int32数组?

Open kexin-open opened this issue 8 years ago • 2 comments

如这种情形,ids是int32数组,请问如何解析?

message Test {
     repeated int32 ids = 1;
}

看了下如下接口,不知道pbc_array_integer()是否合适?pbc_array从哪里来?

// array api 
int pbc_array_size(pbc_array);
uint32_t pbc_array_integer(pbc_array array, int index, uint32_t *hi);
double pbc_array_real(pbc_array array, int index);
struct pbc_slice * pbc_array_slice(pbc_array array, int index);

void pbc_array_push_integer(pbc_array array, uint32_t low, uint32_t hi);
void pbc_array_push_slice(pbc_array array, struct pbc_slice *);
void pbc_array_push_real(pbc_array array, double v);

kexin-open avatar Mar 22 '17 15:03 kexin-open

同样的问题,解析int32的repeated 时 出现的数值是错误的,服务器传过来的值是 1 我解析出来是 28。。。。

hina90 avatar Apr 12 '18 07:04 hina90

将换成去掉

local function default_table(typename) local v = default_cache[typename] if v then return v end

v = { __index = assert(decode_message(typename , "")) }

-- default_cache[typename] = v return v end

看到default_cache[typename] = v 这句

[email protected]

发件人: Dodge 发送时间: 2018-04-12 15:36 收件人: cloudwu/pbc 抄送: Subscribed 主题: Re: [cloudwu/pbc] 如何解析int32数组? (#93) 同样的问题,解析int32的repeated 时 出现的数值是错误的,服务器传过来的值是 1 我解析出来是 28。。。。 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

davinye avatar Apr 12 '18 08:04 davinye