From e8c8f3d6aca78987c385f21d6f50199e475b460b Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Fri, 25 Feb 2022 15:13:09 +0800 Subject: [PATCH] use libfastcommon V1.56 --- HISTORY | 4 ++++ common/fdfs_global.c | 2 +- common/fdfs_http_shared.c | 6 +++--- common/mime_file_parser.c | 10 +++++----- tracker/fdfs_server_id_func.c | 2 +- tracker/tracker_mem.c | 20 ++++++++++---------- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/HISTORY b/HISTORY index b576fe1..a140bc4 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,8 @@ +Version 6.08 2022-02-25 + * use libfastcommon V1.56 + NOTE: you MUST upgrade libfastcommon to V1.56 or later + Version 6.07 2020-12-31 * use libfastcommon V1.44 NOTE: you MUST upgrade libfastcommon to V1.44 or later diff --git a/common/fdfs_global.c b/common/fdfs_global.c index 8d8f4bd..b734868 100644 --- a/common/fdfs_global.c +++ b/common/fdfs_global.c @@ -23,7 +23,7 @@ int g_fdfs_connect_timeout = DEFAULT_CONNECT_TIMEOUT; int g_fdfs_network_timeout = DEFAULT_NETWORK_TIMEOUT; char g_fdfs_base_path[MAX_PATH_SIZE] = {'/', 't', 'm', 'p', '\0'}; -Version g_fdfs_version = {6, 7}; +Version g_fdfs_version = {6, 8}; bool g_use_connection_pool = false; ConnectionPool g_connection_pool; int g_connection_pool_max_idle_time = 3600; diff --git a/common/fdfs_http_shared.c b/common/fdfs_http_shared.c index 43197e1..e40edd0 100644 --- a/common/fdfs_http_shared.c +++ b/common/fdfs_http_shared.c @@ -72,7 +72,7 @@ int fdfs_http_get_content_type_by_extname(FDFSHTTPParams *pParams, \ return 0; } - pHashData = hash_find_ex(&pParams->content_type_hash, \ + pHashData = fc_hash_find_ex(&pParams->content_type_hash, \ ext_name, ext_len + 1); if (pHashData == NULL) { @@ -282,7 +282,7 @@ int fdfs_http_params_load(IniContext *pIniContext, \ if (!(pParams->need_find_content_type || pParams->support_multi_range)) { - hash_destroy(&pParams->content_type_hash); + fc_hash_destroy(&pParams->content_type_hash); } if ((result=getFileContent(token_check_fail_filename, \ @@ -301,7 +301,7 @@ void fdfs_http_params_destroy(FDFSHTTPParams *pParams) { if (!(pParams->need_find_content_type || pParams->support_multi_range)) { - hash_destroy(&pParams->content_type_hash); + fc_hash_destroy(&pParams->content_type_hash); } } diff --git a/common/mime_file_parser.c b/common/mime_file_parser.c index e7bcfce..e7a2241 100644 --- a/common/mime_file_parser.c +++ b/common/mime_file_parser.c @@ -69,11 +69,11 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename) } } - if ((result=hash_init_ex(pHash, PJWHash, 2 * 1024, 0.75, 0, true)) != 0) + if ((result=fc_hash_init_ex(pHash, PJWHash, 2 * 1024, 0.75, 0, true)) != 0) { free(content); logError("file: "__FILE__", line: %d, " \ - "hash_init_ex fail, errno: %d, error info: %s", \ + "fc_hash_init_ex fail, errno: %d, error info: %s", \ __LINE__, result, STRERROR(result)); return result; } @@ -108,14 +108,14 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename) continue; } - if ((result=hash_insert_ex(pHash, ext_name, \ + if ((result=fc_hash_insert_ex(pHash, ext_name, \ strlen(ext_name)+1, content_type, \ strlen(content_type)+1, true)) < 0) { free(content); result *= -1; logError("file: "__FILE__", line: %d, " \ - "hash_insert_ex fail, errno: %d, " \ + "fc_hash_insert_ex fail, errno: %d, " \ "error info: %s", __LINE__, \ result, STRERROR(result)); return result; @@ -125,7 +125,7 @@ int load_mime_types_from_file(HashArray *pHash, const char *mime_filename) free(content); - //hash_stat_print(pHash); + //fc_hash_stat_print(pHash); return 0; } diff --git a/tracker/fdfs_server_id_func.c b/tracker/fdfs_server_id_func.c index 8d76415..d084b8e 100644 --- a/tracker/fdfs_server_id_func.c +++ b/tracker/fdfs_server_id_func.c @@ -338,7 +338,7 @@ int fdfs_load_storage_ids(char *content, const char *pStorageIdsFilename) g_storage_ids_by_id.count = 0; for (i=0; istorage_port = atoi(trim(fields[1])); + clientInfo.pGroup->storage_port = atoi(fc_trim(fields[1])); if (col_count == STORAGE_DATA_GROUP_FIELDS - 2) { //version < V1.12 clientInfo.pGroup->store_path_count = 0; @@ -523,9 +523,9 @@ static int tracker_load_groups_old(FDFSGroups *pGroups, const char *data_path) else { clientInfo.pGroup->store_path_count = \ - atoi(trim(fields[2])); + atoi(fc_trim(fields[2])); clientInfo.pGroup->subdir_count_per_path = \ - atoi(trim(fields[3])); + atoi(fc_trim(fields[3])); } } @@ -907,8 +907,8 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path) } memset(&clientInfo, 0, sizeof(TrackerClientInfo)); - snprintf(group_name, sizeof(group_name), "%s", trim(fields[0])); - snprintf(ip_addr, sizeof(ip_addr), "%s", trim(fields[1])); + snprintf(group_name, sizeof(group_name), "%s", fc_trim(fields[0])); + snprintf(ip_addr, sizeof(ip_addr), "%s", fc_trim(fields[1])); if ((clientInfo.pGroup=tracker_mem_get_group_ex(pGroups, \ group_name)) == NULL) { @@ -952,7 +952,7 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path) FDFS_STORAGE_STATUS_OFFLINE; } - psync_src_id = trim(fields[3]); + psync_src_id = fc_trim(fields[3]); pStorage->sync_until_timestamp = atoi( \ trim_left(fields[4])); pStorage->stat.total_upload_count = strtoll( \ @@ -1007,7 +1007,7 @@ static int tracker_load_storages_old(FDFSGroups *pGroups, const char *data_path) snprintf(pStorage->version, \ sizeof(pStorage->version), - "%s", trim(fields[21])); + "%s", fc_trim(fields[21])); } } } @@ -1420,9 +1420,9 @@ static int tracker_load_sync_timestamps(FDFSGroups *pGroups, const char *data_pa } snprintf(group_name, sizeof(group_name), \ - "%s", trim(fields[0])); + "%s", fc_trim(fields[0])); snprintf(src_storage_id, sizeof(src_storage_id), \ - "%s", trim(fields[1])); + "%s", fc_trim(fields[1])); if (strcmp(group_name, previous_group_name) != 0 || \ pGroup == NULL) {