Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/memory_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int memory_pool_check_node(MEMORY_POOL *p_pool, void *p_node)
else
{
log_error("Address of node (%p) is not aligned with border of chunk %d [%p, %p)",
p_node, i, p_pool->p_chunks[i], (char *)(p_pool->p_chunks[i]) + chunk_size);
p_node, i, p_pool->p_chunks[i], (void *)((char *)(p_pool->p_chunks[i]) + chunk_size));
return -3;
}
}
Expand Down
38 changes: 21 additions & 17 deletions src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -820,7 +821,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file)
{
if (p_menu_set->p_menu_screen_buf_free + 1 > q)
{
log_error("Menu screen buffer depleted (%p + 1 > %p)", p_menu_set->p_menu_screen_buf_free, q);
log_error("Menu screen buffer depleted (%p + 1 > %p)",
(void *)(p_menu_set->p_menu_screen_buf_free), (void *)q);
ret = -3;
goto cleanup;
}
Expand All @@ -834,7 +836,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file)
// Clear line
if (p_menu_set->p_menu_screen_buf_free + strlen(CTRL_SEQ_CLR_LINE) > q)
{
log_error("Menu screen buffer depleted (%p + %zu > %p)", p_menu_set->p_menu_screen_buf_free, strlen(CTRL_SEQ_CLR_LINE), q);
log_error("Menu screen buffer depleted (%p + %zu > %p)",
(void *)(p_menu_set->p_menu_screen_buf_free), strlen(CTRL_SEQ_CLR_LINE), (void *)q);
ret = -3;
goto cleanup;
}
Expand All @@ -845,7 +848,8 @@ int load_menu(MENU_SET *p_menu_set, const char *conf_file)
{
if (p_menu_set->p_menu_screen_buf_free + 2 > q)
{
log_error("Menu screen buffer depleted (%p + 2 > %p)", p_menu_set->p_menu_screen_buf_free, q);
log_error("Menu screen buffer depleted (%p + 2 > %p)",
(void *)(p_menu_set->p_menu_screen_buf_free), (void *)q);
ret = -3;
goto cleanup;
}
Expand Down Expand Up @@ -952,7 +956,7 @@ int display_menu_cursor(MENU_SET *p_menu_set, int show)
p_menu = get_menu_by_id(p_menu_set, menu_id);
if (p_menu == NULL)
{
log_error("get_menu_by_id(%lu) return NULL pointer", menu_id);
log_error("get_menu_by_id(%" PRIu64 ") return NULL pointer", menu_id);
return -1;
}

Expand All @@ -961,7 +965,7 @@ int display_menu_cursor(MENU_SET *p_menu_set, int show)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}

Expand All @@ -987,7 +991,7 @@ static int display_menu_current_page(MENU_SET *p_menu_set)
p_menu = get_menu_by_id(p_menu_set, menu_id);
if (p_menu == NULL)
{
log_error("get_menu_by_id(%lu) return NULL pointer", menu_id);
log_error("get_menu_by_id(%" PRIu64 ") return NULL pointer", menu_id);
return -1;
}

Expand All @@ -1011,7 +1015,7 @@ static int display_menu_current_page(MENU_SET *p_menu_set)
p_menu_screen = get_menu_screen_by_id(p_menu_set, p_menu->screen_id);
if (p_menu_screen == NULL)
{
log_error("get_menu_screen_by_id(%lu) return NULL pointer", p_menu->screen_id);
log_error("get_menu_screen_by_id(%" PRIu64 ") return NULL pointer", p_menu->screen_id);
return -1;
}

Expand Down Expand Up @@ -1083,7 +1087,7 @@ int display_menu(MENU_SET *p_menu_set)
p_menu = get_menu_by_id(p_menu_set, menu_id);
if (p_menu == NULL)
{
log_error("get_menu_by_id(%lu) return NULL pointer", menu_id);
log_error("get_menu_by_id(%" PRIu64 ") return NULL pointer", menu_id);
if (p_menu_set->choose_step > 0)
{
p_menu_set->choose_step--;
Expand All @@ -1106,7 +1110,7 @@ int display_menu(MENU_SET *p_menu_set)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return EXITMENU;
}

Expand Down Expand Up @@ -1207,7 +1211,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu = get_menu_by_id(p_menu_set, menu_id);
if (p_menu == NULL)
{
log_error("get_menu_by_id(%lu) return NULL pointer", menu_id);
log_error("get_menu_by_id(%" PRIu64 ") return NULL pointer", menu_id);
if (p_menu_set->choose_step > 0)
{
p_menu_set->choose_step--;
Expand All @@ -1234,7 +1238,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
p_menu_set->menu_item_pos[p_menu_set->choose_step] = 0;
return REDRAW;
}
Expand Down Expand Up @@ -1285,7 +1289,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}

Expand Down Expand Up @@ -1318,7 +1322,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}
if (require_page_change && p_menu_set->menu_item_page_id[menu_item_pos] != page_id)
Expand Down Expand Up @@ -1349,7 +1353,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}
if (require_page_change && p_menu_set->menu_item_page_id[menu_item_pos] != page_id)
Expand All @@ -1373,7 +1377,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}

Expand All @@ -1400,7 +1404,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}

Expand All @@ -1427,7 +1431,7 @@ int menu_control(MENU_SET *p_menu_set, int key)
p_menu_item = get_menu_item_by_id(p_menu_set, menu_item_id);
if (p_menu_item == NULL)
{
log_error("get_menu_item_by_id(%lu) return NULL pointer", menu_item_id);
log_error("get_menu_item_by_id(%" PRIu64 ") return NULL pointer", menu_item_id);
return -1;
}

Expand Down
9 changes: 5 additions & 4 deletions src/net_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "section_list_loader.h"
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -751,7 +752,7 @@ int net_server(const char *hostaddr, in_port_t port[])
ret = hash_dict_del(hash_dict_pid_sockaddr, (uint64_t)pid);
if (ret < 0)
{
log_error("hash_dict_del(hash_dict_pid_sockaddr, %lu) error", (uint64_t)pid);
log_error("hash_dict_del(hash_dict_pid_sockaddr, %" PRIu64 ") error", (uint64_t)pid);
}
}
}
Expand Down Expand Up @@ -977,7 +978,7 @@ int net_server(const char *hostaddr, in_port_t port[])
ret = hash_dict_set(hash_dict_pid_sockaddr, (uint64_t)pid, sin.sin_addr.s_addr);
if (ret < 0)
{
log_error("hash_dict_set(hash_dict_pid_sockaddr, %lu, %s) error", (uint64_t)pid, hostaddr_client);
log_error("hash_dict_set(hash_dict_pid_sockaddr, %" PRIu64 ", %s) error", (uint64_t)pid, hostaddr_client);
}

if (j == 0)
Expand All @@ -995,7 +996,7 @@ int net_server(const char *hostaddr, in_port_t port[])
else
{
// Increase connection count from this IP
log_common("Accept %s connection from %s:%d, already have %ld connections",
log_common("Accept %s connection from %s:%d, already have %" PRId64 " connections",
(SSH_v2 ? "SSH" : "telnet"), hostaddr_client, port_client, j);

ret = hash_dict_inc(hash_dict_sockaddr_count, (uint64_t)sin.sin_addr.s_addr, 1);
Expand All @@ -1008,7 +1009,7 @@ int net_server(const char *hostaddr, in_port_t port[])
}
else
{
log_error("Rejected %s connection from %s:%d over limit per IP (%ld >= %d)",
log_error("Rejected %s connection from %s:%d over limit per IP (%" PRId64 " >= %d)",
(SSH_v2 ? "SSH" : "telnet"), hostaddr_client, port_client, j, BBS_max_client_per_ip);
}
}
Expand Down
23 changes: 12 additions & 11 deletions src/test_hash_dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "hash_dict.h"
#include "log.h"
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>

Expand Down Expand Up @@ -47,7 +48,7 @@ int main(int argc, char *argv[])
ret = hash_dict_get(p_dict, key, &value);
if (ret != 0)
{
printf("hash_dict_get(%lu) ret=%d error\n", key, ret);
printf("hash_dict_get(%" PRIu64 ") ret=%d error\n", key, ret);
break;
}
}
Expand All @@ -59,14 +60,14 @@ int main(int argc, char *argv[])
{
if (hash_dict_inc(p_dict, key, i * 3 + 7) != 0)
{
printf("hash_dict_inc(%lu) error\n", key);
printf("hash_dict_inc(%" PRIu64 ") error\n", key);
break;
}
}

if (hash_dict_set(p_dict, key, i * 3 + 7) != 0)
{
printf("hash_dict_set(%lu) error\n", key);
printf("hash_dict_set(%" PRIu64 ") error\n", key);
break;
}
}
Expand All @@ -83,12 +84,12 @@ int main(int argc, char *argv[])
ret = hash_dict_get(p_dict, key, &value);
if (ret != 1)
{
printf("hash_dict_get(%lu) ret=%d error\n", key, ret);
printf("hash_dict_get(%" PRIu64 ") ret=%d error\n", key, ret);
break;
}
if (value != i * 3 + 7)
{
printf("hash_dict_get(%lu) value=%ld error\n", key, value);
printf("hash_dict_get(%" PRIu64 ") value=%" PRId64 " error\n", key, value);
break;
}
}
Expand All @@ -98,7 +99,7 @@ int main(int argc, char *argv[])
key = i * 37 + 13;
if (hash_dict_inc(p_dict, key, i * 5 + 17) != 1)
{
printf("hash_dict_inc(%lu) error\n", key);
printf("hash_dict_inc(%" PRIu64 ") error\n", key);
break;
}
}
Expand All @@ -109,12 +110,12 @@ int main(int argc, char *argv[])
ret = hash_dict_get(p_dict, key, &value);
if (ret != 1)
{
printf("hash_dict_get(%lu) ret=%d error\n", key, ret);
printf("hash_dict_get(%" PRIu64 ") ret=%d error\n", key, ret);
break;
}
if (value != i * 3 + 7 + i * 5 + 17)
{
printf("hash_dict_get(%lu) value=%ld error\n", key, value);
printf("hash_dict_get(%" PRIu64 ") value=%" PRId64 " error\n", key, value);
break;
}
}
Expand All @@ -130,7 +131,7 @@ int main(int argc, char *argv[])
key = i * 37 + 13;
if (hash_dict_del(p_dict, key) != 1)
{
printf("hash_dict_del(%lu) error\n", key);
printf("hash_dict_del(%" PRIu64 ") error\n", key);
break;
}
}
Expand All @@ -147,7 +148,7 @@ int main(int argc, char *argv[])
ret = hash_dict_get(p_dict, key, &value);
if (ret != 0)
{
printf("hash_dict_get(%lu) ret=%d error\n", key, ret);
printf("hash_dict_get(%" PRIu64 ") ret=%d error\n", key, ret);
break;
}
}
Expand All @@ -157,7 +158,7 @@ int main(int argc, char *argv[])
key = i * 37 + 13;
if (hash_dict_del(p_dict, key) != 0)
{
printf("hash_dict_del(%lu) error\n", key);
printf("hash_dict_del(%" PRIu64 ") error\n", key);
break;
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/test_trie_dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "log.h"
#include "trie_dict.h"
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
Expand Down Expand Up @@ -112,7 +113,7 @@ int main(int argc, char *argv[])
}
else if (value != TEST_VAL >> i)
{
printf("Value of [%s] is incorrect (%ld != %ld)\n", keys[i], value, TEST_VAL >> i);
printf("Value of [%s] is incorrect (%" PRId64 " != %" PRId64 ")\n", keys[i], value, TEST_VAL >> i);
}
}

Expand Down Expand Up @@ -157,7 +158,7 @@ int main(int argc, char *argv[])
}
else if (value != TEST_VAL >> i)
{
printf("Value of [%s] is incorrect (%ld != %ld)\n", keys[i], value, TEST_VAL >> i);
printf("Value of [%s] is incorrect (%" PRId64 " != %" PRId64 ")\n", keys[i], value, TEST_VAL >> i);
}
}
}
Expand Down Expand Up @@ -203,7 +204,7 @@ int main(int argc, char *argv[])
}
else if (value != TEST_VAL << i)
{
printf("Value of [%s] is incorrect (%ld != %ld)\n", keys[i], value, TEST_VAL << i);
printf("Value of [%s] is incorrect (%" PRId64 " != %" PRId64 ")\n", keys[i], value, TEST_VAL << i);
}
}
}
Expand Down
Loading