From 9250031fac8f5c5eec8c17498923315ea8a38a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cpengxuanzheng=E2=80=9D?= Date: Wed, 22 Sep 2021 18:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(TSG-7855):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=93=88=E5=B8=8C=E6=9F=A5=E6=89=BE=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/demo/hos_write_demo.cpp | 2 +- src/hos_hash.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/demo/hos_write_demo.cpp b/example/demo/hos_write_demo.cpp index ca251853..6cdc1aff 100644 --- a/example/demo/hos_write_demo.cpp +++ b/example/demo/hos_write_demo.cpp @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) userdata_t data = {&finished}; hos_instance hos_instance = NULL; char object[1024]; - const char *bucket = "hos_test_not_exit_bucket"; + const char *bucket = "hos_test_bucket"; if (stat(file_name, &buffer) == -1) { diff --git a/src/hos_hash.cpp b/src/hos_hash.cpp index bb7e2538..22ff9954 100644 --- a/src/hos_hash.cpp +++ b/src/hos_hash.cpp @@ -8,7 +8,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(*handle, (int *)&input->fd, value); + HASH_FIND(hh,*handle,&input->fd,sizeof(input->fd),value); if (value == NULL) { value = (hos_fd_context_t *)malloc(sizeof(hos_fd_context_t)); @@ -17,7 +17,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) value->bucket = (char *)calloc(1, strlen(input->bucket) + 1); memcpy(value->bucket, input->bucket, strlen(input->bucket)); memcpy(value->object, input->object, strlen(input->object)); - HASH_ADD_INT(*handle, fd, value); + HASH_ADD(hh,*handle,fd,sizeof(long),value); } else { @@ -50,7 +50,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) hos_fd_context_t *find_context_by_fd(hos_fd_context_t *handle, size_t fd) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(handle, &fd, value); + HASH_FIND(hh,handle,&fd,sizeof(long),value); return value; } @@ -58,7 +58,7 @@ void delete_context_by_fd(hos_fd_context_t **handle, size_t fd) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(*handle, &fd, value); + HASH_FIND(hh,*handle,&fd,sizeof(long),value); if (value) { if (value->bucket)