From 756085f91d0f01c69550735cf2e60cae54d9c72a Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 6 Apr 2013 17:25:56 -0700 Subject: Native amd64 support --- src/char/char.cpp | 2 +- src/char/int_storage.cpp | 2 +- src/common/sanity.hpp | 10 ++-------- src/common/socket.cpp | 2 +- src/ladmin/ladmin.cpp | 4 ++-- src/login/login.cpp | 20 ++++++++++---------- src/map/intif.cpp | 4 ++-- src/map/magic-interpreter-parser.ypp | 4 ++-- 8 files changed, 21 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/char/char.cpp b/src/char/char.cpp index 9749c23..5c501b4 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -2260,7 +2260,7 @@ void parse_frommap(int fd) return; } // inter server処理でもない場合は切断 - PRINTF("char: unknown packet 0x%04x (%d bytes to read in buffer)! (from map).\n", + PRINTF("char: unknown packet 0x%04x (%zu bytes to read in buffer)! (from map).\n", RFIFOW(fd, 0), RFIFOREST(fd)); session[fd]->eof = 1; return; diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp index b7feae1..ba55538 100644 --- a/src/char/int_storage.cpp +++ b/src/char/int_storage.cpp @@ -205,7 +205,7 @@ int mapif_parse_SaveStorage(int fd) int len = RFIFOW(fd, 2); if (sizeof(struct storage) != len - 8) { - PRINTF("inter storage: data size error %d %d\n", + PRINTF("inter storage: data size error %zu %d\n", sizeof(struct storage), len - 8); } else diff --git a/src/common/sanity.hpp b/src/common/sanity.hpp index 8271ef8..e54739f 100644 --- a/src/common/sanity.hpp +++ b/src/common/sanity.hpp @@ -44,17 +44,11 @@ # endif // compiler and not library # endif // __GNUC__ == 4 -# ifndef __i386__ +# if not defined(__i386__) and not defined(__x86_64__) // Known platform dependencies: // endianness for the [RW]FIFO.* macros // possibly, some signal-handling -# error "Unsupported platform" +# error "Unsupported platform use x86 / amd64 only" # endif // not __i386__ -# ifdef __x86_64__ -// I'm working on it - I know there are some pointer-size assumptions. -# error "Sorry, this code is believed not to be 64-bit safe" -# error "please compile with -m32" -# endif // __x86_64__ - #endif // SANITY_HPP diff --git a/src/common/socket.cpp b/src/common/socket.cpp index ac5a17d..96de47c 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -324,7 +324,7 @@ void WFIFOSET(int fd, size_t len) if (s->wdata_size + len + 16384 > s->max_wdata) { realloc_fifo(fd, s->max_rdata, s->max_wdata << 1); - PRINTF("socket: %d wdata expanded to %d bytes.\n", fd, s->max_wdata); + PRINTF("socket: %d wdata expanded to %zu bytes.\n", fd, s->max_wdata); } if (s->wdata_size + len + 2048 < s->max_wdata) s->wdata_size += len; diff --git a/src/ladmin/ladmin.cpp b/src/ladmin/ladmin.cpp index 1af83e1..e28286e 100644 --- a/src/ladmin/ladmin.cpp +++ b/src/ladmin/ladmin.cpp @@ -1760,9 +1760,9 @@ int changememo(const char *param) if (strlen(memo) > 254) { - PRINTF("Memo is too long (%d characters).\n", strlen(memo)); + PRINTF("Memo is too long (%zu characters).\n", strlen(memo)); PRINTF("Please input a memo of 254 bytes at the maximum.\n"); - LADMIN_LOG("Email is too long (%d characters). Please input a memo of 254 bytes at the maximum.\n", + LADMIN_LOG("Email is too long (%zu characters). Please input a memo of 254 bytes at the maximum.\n", strlen(memo)); return 102; } diff --git a/src/login/login.cpp b/src/login/login.cpp index 10f6395..ccdaa97 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -1111,7 +1111,7 @@ void parse_fromchar(int fd) while (RFIFOREST(fd) >= 2) { if (display_parse_fromchar == 2 || (display_parse_fromchar == 1 && RFIFOW(fd, 0) != 0x2714)) // 0x2714 is done very often (number of players) - PRINTF("parse_fromchar: connection #%d, packet: 0x%x (with being read: %d bytes).\n", + PRINTF("parse_fromchar: connection #%d, packet: 0x%x (with being read: %zu bytes).\n", fd, RFIFOW(fd, 0), RFIFOREST(fd)); switch (RFIFOW(fd, 0)) @@ -1730,7 +1730,7 @@ void parse_fromchar(int fd) "%s: receiving of an unknown packet -> disconnection\n", tmpstr); FPRINTF(logfp, - "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n", fd, ip, RFIFOW(fd, 0), RFIFOREST(fd)); FPRINTF(logfp, "Detail (in hex):\n"); FPRINTF(logfp, @@ -1799,7 +1799,7 @@ void parse_admin(int fd) while (RFIFOREST(fd) >= 2) { if (display_parse_admin == 1) - PRINTF("parse_admin: connection #%d, packet: 0x%x (with being read: %d).\n", + PRINTF("parse_admin: connection #%d, packet: 0x%x (with being read: %zu).\n", fd, RFIFOW(fd, 0), RFIFOREST(fd)); switch (RFIFOW(fd, 0)) @@ -2954,7 +2954,7 @@ void parse_admin(int fd) "%s: receiving of an unknown packet -> disconnection\n", tmpstr); FPRINTF(logfp, - "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n", fd, ip, RFIFOW(fd, 0), RFIFOREST(fd)); FPRINTF(logfp, "Detail (in hex):\n"); FPRINTF(logfp, @@ -3056,19 +3056,19 @@ void parse_login(int fd) if (RFIFOW(fd, 0) == 0x64 || RFIFOW(fd, 0) == 0x01dd) { if (RFIFOREST(fd) >= ((RFIFOW(fd, 0) == 0x64) ? 55 : 47)) - PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %d), account: %s.\n", + PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), account: %s.\n", fd, RFIFOW(fd, 0), RFIFOREST(fd), static_cast(RFIFOP(fd, 6))); } else if (RFIFOW(fd, 0) == 0x2710) { if (RFIFOREST(fd) >= 86) - PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %d), server: %s.\n", + PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), server: %s.\n", fd, RFIFOW(fd, 0), RFIFOREST(fd), static_cast(RFIFOP(fd, 60))); } else - PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %d).\n", + PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu).\n", fd, RFIFOW(fd, 0), RFIFOREST(fd)); } @@ -3508,7 +3508,7 @@ void parse_login(int fd) "%s: receiving of an unknown packet -> disconnection\n", tmpstr); FPRINTF(logfp, - "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %d).\n", + "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n", fd, ip, RFIFOW(fd, 0), RFIFOREST(fd)); FPRINTF(logfp, "Detail (in hex):\n"); @@ -4106,7 +4106,7 @@ void save_config_in_log(void) else if (strcmp(admin_pass, "admin") == 0) LOGIN_LOG("- with a remote administration with the DEFAULT password.\n"); else - LOGIN_LOG("- with a remote administration with the password of %d character(s).\n", + LOGIN_LOG("- with a remote administration with the password of %zu character(s).\n", strlen(admin_pass)); if (access_ladmin_allownum == 0 || (access_ladmin_allownum == 1 && access_ladmin_allow[0] == '\0')) @@ -4126,7 +4126,7 @@ void save_config_in_log(void) else if (strcmp(gm_pass, "gm") == 0) LOGIN_LOG("- with the DEFAULT 'To GM become' password (gm_pass).\n"); else - LOGIN_LOG("- with a 'To GM become' password (gm_pass) of %d character(s).\n", + LOGIN_LOG("- with a 'To GM become' password (gm_pass) of %zu character(s).\n", strlen(gm_pass)); if (level_new_gm == 0) LOGIN_LOG("- to refuse any creation of GM with @gm.\n"); diff --git a/src/map/intif.cpp b/src/map/intif.cpp index a2f75c5..6c8edf5 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -418,7 +418,7 @@ int intif_parse_LoadStorage(int fd) if (RFIFOW(fd, 2) - 8 != sizeof(struct storage)) { if (battle_config.error_log) - PRINTF("intif_parse_LoadStorage: data size error %d %d\n", + PRINTF("intif_parse_LoadStorage: data size error %d %zu\n", RFIFOW(fd, 2) - 8, sizeof(struct storage)); return 1; } @@ -473,7 +473,7 @@ int intif_parse_PartyInfo(int fd) if (RFIFOW(fd, 2) != sizeof(struct party) + 4) { if (battle_config.error_log) - PRINTF("intif: party info : data size error %d %d %d\n", + PRINTF("intif: party info : data size error %d %d %zu\n", RFIFOL(fd, 4), RFIFOW(fd, 2), sizeof(struct party) + 4); } diff --git a/src/map/magic-interpreter-parser.ypp b/src/map/magic-interpreter-parser.ypp index a8db8a4..dd62edf 100644 --- a/src/map/magic-interpreter-parser.ypp +++ b/src/map/magic-interpreter-parser.ypp @@ -819,7 +819,7 @@ expr_t *fun_expr(const char *name, int args_nr, expr_t **args, int line, int col if (!fun) { fail(line, column, "Unknown function `%s'\n", name); } else if (strlen(fun->signature) != args_nr) { - fail(line, column, "Incorrect number of arguments to function `%s': Expected %d, found %d\n", name, strlen(fun->signature), args_nr); + fail(line, column, "Incorrect number of arguments to function `%s': Expected %zu, found %d\n", name, strlen(fun->signature), args_nr); fun = NULL; } @@ -932,7 +932,7 @@ effect_t *op_effect(char *name, int args_nr, expr_t **args, int line, int column if (!op) fail(line, column, "Unknown operation `%s'\n", name); else if (strlen(op->signature) != args_nr) { - fail(line, column, "Incorrect number of arguments to operation `%s': Expected %d, found %d\n", name, strlen(op->signature), args_nr); + fail(line, column, "Incorrect number of arguments to operation `%s': Expected %zu, found %d\n", name, strlen(op->signature), args_nr); op = NULL; } -- cgit v1.2.3-70-g09d2