Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加一个指定数据类型为int64的方法 #1241

Merged
merged 4 commits into from
Sep 15, 2020
Merged

增加一个指定数据类型为int64的方法 #1241

merged 4 commits into from
Sep 15, 2020

Conversation

Whislly
Copy link
Contributor

@Whislly Whislly commented Sep 15, 2020

在使用mongodb时,有时候数据没有超过32位,但是需要指定数据类型为int64

@cloudwu
Copy link
Owner

cloudwu commented Sep 15, 2020

作为一个基础库,我觉得 lint64 这个函数没有考虑大小端问题。建议改进。

@cloudwu
Copy link
Owner

cloudwu commented Sep 15, 2020

我明白了,这个函数只在内存里构造对象。但代码我觉得还是有一些问题的。需要改进。

if (sz != 8) {
return luaL_error(L, "Invalid int64");
}
int d = *(const int *)buf;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为何是 int 而不是 int64 ?

@@ -397,7 +397,7 @@ append_one(struct bson *bs, lua_State *L, const char *key, size_t sz, int depth)
break;
case BSON_INT64: {
if (len != 2 + 8) {
luaL_error(L, "Invalid int64");
luaL_error(L, "Invalid date");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么是 date 不是 int64 ?

@cloudwu cloudwu merged commit eef2b1f into cloudwu:master Sep 15, 2020
wangyi0226 added a commit to wangyi0226/skynet that referenced this pull request Sep 21, 2020
增加一个指定数据类型为int64的方法 (cloudwu#1241)
xzhovo added a commit to xzhovo/skynet that referenced this pull request Feb 1, 2021
【中】增加 stat: add mem stat for jemalloc
【中】sproto add double type
【中】mongo 错误数据有可能导致死循环 (cloudwu#1225)
【低】mysql 预处理执行支持nil参数,nil==NULL (cloudwu#1228)
【高】sharetable.update 时,进行match_thread 对stack_values_tmp 变量会重入。导致match_value 一个nil值。
【中】logger.c:增加时间戳;文件打开方式用a代替w;用skynet程序时间代替系统时间
【高】add api skynet_socket_pause 新增了 pause/resume 的 C API 通知网络底层暂停及延续 socket 的读操作。在 Lua 层,这个过程是自动进行的,不需要业务层主动干预。一旦 lua 服务收到了太多网络包未能被业务层读取(积累在 socket 模块中)将自动发送 pause 消息暂停网络层的接收,当读空缓冲区后,再次发起读请求则会通知网络层重新开启读数据。
【高】在socket.lua 业务层控制,新增最大读取socket buffer 的大小,超过时自动暂停
【低】Invalid addrinfo pointer casues skynet asserted in freeaddrinfo on OpenWRT (arm cpu) (cloudwu#1236)
【低】http sockethelper.socket_error
【中】mongo 增加一个指定数据类型为int64的方法 (cloudwu#1241)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants