replace print format OFF_PRINTF_FORMAT to PRId64

pull/170/head
Yu Qing 2017-08-10 16:15:36 +08:00
parent 68fd3f5b1f
commit 1e4eb5c154
4 changed files with 33 additions and 30 deletions

View File

@ -1,6 +1,7 @@
Version 5.12 2017-08-10
* code refine for rare case
* replace print format OFF_PRINTF_FORMAT to PRId64
Version 5.11 2017-05-26
* bug fixed: file_offset has no effect when use trunk file

View File

@ -4917,9 +4917,9 @@ static int storage_modify_file(struct fast_task_info *pTask)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, file offset: %"PRId64 \
" is invalid, which > appender file size: " \
OFF_PRINTF_FORMAT, __LINE__, pTask->client_ip, \
file_offset, stat_buf.st_size);
" is invalid, which > appender file size: %" \
PRId64, __LINE__, pTask->client_ip, \
file_offset, (int64_t)stat_buf.st_size);
return EINVAL;
}
@ -5097,10 +5097,10 @@ static int storage_do_truncate_file(struct fast_task_info *pTask)
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, truncated file size: " \
"%"PRId64" == appender file size: " \
OFF_PRINTF_FORMAT", skip truncate file", \
"%"PRId64" == appender file size: %" \
PRId64", skip truncate file", \
__LINE__, pTask->client_ip, \
remain_bytes, stat_buf.st_size);
remain_bytes, (int64_t)stat_buf.st_size);
return 0;
}
if (remain_bytes > stat_buf.st_size)
@ -5108,9 +5108,9 @@ static int storage_do_truncate_file(struct fast_task_info *pTask)
logError("file: "__FILE__", line: %d, " \
"client ip: %s, truncated file size: " \
"%"PRId64" is invalid, " \
"which > appender file size: " \
OFF_PRINTF_FORMAT, __LINE__, pTask->client_ip, \
remain_bytes, stat_buf.st_size);
"which > appender file size: %" \
PRId64, __LINE__, pTask->client_ip, \
remain_bytes, (int64_t)stat_buf.st_size);
return EINVAL;
}
@ -5554,11 +5554,11 @@ static int storage_sync_copy_file(struct fast_task_info *pTask, \
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, logic file %s, " \
"my file size: "OFF_PRINTF_FORMAT \
"my file size: %"PRId64\
" != src file size: %"PRId64 \
", will be overwrited", __LINE__, \
pTask->client_ip, filename, \
stat_buf.st_size, file_bytes);
(int64_t)stat_buf.st_size, file_bytes);
}
else
{
@ -5858,20 +5858,21 @@ static int storage_sync_append_file(struct fast_task_info *pTask)
if (stat_buf.st_size >= start_offset + append_bytes)
{
logDebug("file: "__FILE__", line: %d, " \
"client ip: %s, file %s, my file size: " \
OFF_PRINTF_FORMAT" >= src file size: " \
"client ip: %s, file %s, my file size: %" \
PRId64" >= src file size: " \
"%"PRId64", do not append", \
__LINE__, pTask->client_ip, pFileContext->filename, \
stat_buf.st_size, start_offset + append_bytes);
(int64_t)stat_buf.st_size,
start_offset + append_bytes);
}
else
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, file %s, my file size: " \
OFF_PRINTF_FORMAT" > %"PRId64 \
"client ip: %s, file %s, my file size: %" \
PRId64" > %"PRId64 \
", but < %"PRId64", need be resynced", \
__LINE__, pTask->client_ip, pFileContext->filename, \
stat_buf.st_size, start_offset, \
(int64_t)stat_buf.st_size, start_offset, \
start_offset + append_bytes);
}
@ -5881,11 +5882,11 @@ static int storage_sync_append_file(struct fast_task_info *pTask)
else //stat_buf.st_size < start_offset
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, file %s, my file size: " \
OFF_PRINTF_FORMAT" < start offset " \
"client ip: %s, file %s, my file size: %" \
PRId64" < start offset " \
"%"PRId64", need to resync this file!", \
__LINE__, pTask->client_ip, pFileContext->filename, \
stat_buf.st_size, start_offset);
(int64_t)stat_buf.st_size, start_offset);
need_write_file = false;
}
@ -6079,11 +6080,11 @@ static int storage_sync_modify_file(struct fast_task_info *pTask)
else if (stat_buf.st_size < start_offset)
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, file %s, my file size: " \
OFF_PRINTF_FORMAT" < start offset " \
"client ip: %s, file %s, my file size: %" \
PRId64" < start offset " \
"%"PRId64", need to resync this file!", \
__LINE__, pTask->client_ip, pFileContext->filename, \
stat_buf.st_size, start_offset);
(int64_t)stat_buf.st_size, start_offset);
need_write_file = false;
}
else
@ -6278,11 +6279,11 @@ static int storage_sync_truncate_file(struct fast_task_info *pTask)
if (stat_buf.st_size != old_file_size)
{
logWarning("file: "__FILE__", line: %d, " \
"client ip: %s, file %s, my file size: " \
OFF_PRINTF_FORMAT" != before truncated size: " \
"client ip: %s, file %s, my file size: %" \
PRId64" != before truncated size: " \
"%"PRId64", skip!", __LINE__, \
pTask->client_ip, pFileContext->filename, \
stat_buf.st_size, old_file_size);
(int64_t)stat_buf.st_size, old_file_size);
return EEXIST;
}

View File

@ -151,11 +151,12 @@ static int storage_sync_copy_file(ConnectionInfo *pStorageServer, \
"sync data file, logic file: %s " \
"on dest server %s:%d already exists, "\
"but file size: %"PRId64 \
" not same as mine: "OFF_PRINTF_FORMAT\
" not same as mine: %"PRId64 \
", need re-sync it", __LINE__, \
pRecord->filename, pStorageServer->ip_addr,\
pStorageServer->port, \
file_info.file_size, stat_buf.st_size);
file_info.file_size, \
(int64_t)stat_buf.st_size);
proto_cmd = STORAGE_PROTO_CMD_SYNC_UPDATE_FILE;
}

View File

@ -1985,9 +1985,9 @@ static int tracker_deal_get_one_sys_file(struct fast_task_info *pTask)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, invalid offset: %"PRId64
" < 0 or > "OFF_PRINTF_FORMAT, \
" < 0 or > %"PRId64, \
__LINE__, pTask->client_ip, offset, \
file_stat.st_size);
(int64_t)file_stat.st_size);
pTask->length = sizeof(TrackerHeader);
return EINVAL;