diff options
author | Haru <haru@dotalux.com> | 2018-04-08 22:14:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-08 22:14:05 +0200 |
commit | 21b56f6e44722e82405b78bee16a1a409743f58a (patch) | |
tree | 58df8a4d5c3648d71c6f2544a22777e951333858 | |
parent | dd6655709ea9f61cec8229d98fe9e4a9bc31bf14 (diff) | |
parent | 2bc4b4f09d00a92b28805eeeb5b5624064983255 (diff) | |
download | hercules-21b56f6e44722e82405b78bee16a1a409743f58a.tar.gz hercules-21b56f6e44722e82405b78bee16a1a409743f58a.tar.bz2 hercules-21b56f6e44722e82405b78bee16a1a409743f58a.tar.xz hercules-21b56f6e44722e82405b78bee16a1a409743f58a.zip |
Merge pull request #2009 from MishimaHaruna/sprintf-hooking-fix
Fix HPMHooking compilation when sprintf() is a macro
-rw-r--r-- | src/map/script.c | 10 | ||||
-rw-r--r-- | src/map/script.h | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 16 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/map/script.c b/src/map/script.c index 275601dcc..d11b6741a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5625,7 +5625,7 @@ const char *script_getfuncname(struct script_state *st) { * already initialized) * @retval false if an error occurs. */ -bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) +bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) { const char *format = NULL; const char *p = NULL, *np = NULL; @@ -5678,7 +5678,7 @@ bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) } // placeholder = "%n" ; (ignored) if (*np == 'n') { - ShowWarning("script_sprintf: Format %%n not supported! Skipping...\n"); + ShowWarning("script_sprintf_helper: Format %%n not supported! Skipping...\n"); script->reportsrc(st); lastarg = nextarg; p = np + 1; @@ -5881,7 +5881,7 @@ BUILDIN(mesf) StrBuf->Init(&buf); - if (!script_sprintf(st, 2, &buf)) { + if (!script->sprintf_helper(st, 2, &buf)) { StrBuf->Destroy(&buf); return false; } @@ -16793,7 +16793,7 @@ BUILDIN(sprintf) struct StringBuf buf; StrBuf->Init(&buf); - if (!script_sprintf(st, 2, &buf)) { + if (!script->sprintf_helper(st, 2, &buf)) { StrBuf->Destroy(&buf); script_pushconststr(st, ""); return false; @@ -25219,7 +25219,7 @@ void script_defaults(void) script->search_str = script_search_str; script->setd_sub = setd_sub; script->attach_state = script_attach_state; - script->sprintf = script_sprintf; + script->sprintf_helper = script_sprintf_helper; script->queue = script_hqueue_get; script->queue_add = script_hqueue_add; diff --git a/src/map/script.h b/src/map/script.h index 2dc3b2327..ede786481 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -909,7 +909,7 @@ struct script_interface { int (*buildin_mobuseskill_sub) (struct block_list *bl, va_list ap); int (*cleanfloor_sub) (struct block_list *bl, va_list ap); int (*run_func) (struct script_state *st); - bool (*sprintf) (struct script_state *st, int start, struct StringBuf *out); + bool (*sprintf_helper) (struct script_state *st, int start, struct StringBuf *out); const char *(*getfuncname) (struct script_state *st); // for ENABLE_CASE_CHECK unsigned int (*calc_hash_ci) (const char *p); diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 0fd459a63..c11c9c3c0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6472,8 +6472,8 @@ typedef int (*HPMHOOK_pre_script_cleanfloor_sub) (struct block_list **bl, va_lis typedef int (*HPMHOOK_post_script_cleanfloor_sub) (int retVal___, struct block_list *bl, va_list ap); typedef int (*HPMHOOK_pre_script_run_func) (struct script_state **st); typedef int (*HPMHOOK_post_script_run_func) (int retVal___, struct script_state *st); -typedef bool (*HPMHOOK_pre_script_sprintf) (struct script_state **st, int *start, struct StringBuf **out); -typedef bool (*HPMHOOK_post_script_sprintf) (bool retVal___, struct script_state *st, int start, struct StringBuf *out); +typedef bool (*HPMHOOK_pre_script_sprintf_helper) (struct script_state **st, int *start, struct StringBuf **out); +typedef bool (*HPMHOOK_post_script_sprintf_helper) (bool retVal___, struct script_state *st, int start, struct StringBuf *out); typedef const char* (*HPMHOOK_pre_script_getfuncname) (struct script_state **st); typedef const char* (*HPMHOOK_post_script_getfuncname) (const char* retVal___, struct script_state *st); typedef unsigned int (*HPMHOOK_pre_script_calc_hash_ci) (const char **p); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b037cbcd6..cbfaf1b65 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5092,8 +5092,8 @@ struct { struct HPMHookPoint *HP_script_cleanfloor_sub_post; struct HPMHookPoint *HP_script_run_func_pre; struct HPMHookPoint *HP_script_run_func_post; - struct HPMHookPoint *HP_script_sprintf_pre; - struct HPMHookPoint *HP_script_sprintf_post; + struct HPMHookPoint *HP_script_sprintf_helper_pre; + struct HPMHookPoint *HP_script_sprintf_helper_post; struct HPMHookPoint *HP_script_getfuncname_pre; struct HPMHookPoint *HP_script_getfuncname_post; struct HPMHookPoint *HP_script_calc_hash_ci_pre; @@ -11411,8 +11411,8 @@ struct { int HP_script_cleanfloor_sub_post; int HP_script_run_func_pre; int HP_script_run_func_post; - int HP_script_sprintf_pre; - int HP_script_sprintf_post; + int HP_script_sprintf_helper_pre; + int HP_script_sprintf_helper_post; int HP_script_getfuncname_pre; int HP_script_getfuncname_post; int HP_script_calc_hash_ci_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 45658360d..5fdfd9e03 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2608,7 +2608,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->buildin_mobuseskill_sub, HP_script_buildin_mobuseskill_sub) }, { HP_POP(script->cleanfloor_sub, HP_script_cleanfloor_sub) }, { HP_POP(script->run_func, HP_script_run_func) }, - { HP_POP(script->sprintf, HP_script_sprintf) }, + { HP_POP(script->sprintf_helper, HP_script_sprintf_helper) }, { HP_POP(script->getfuncname, HP_script_getfuncname) }, { HP_POP(script->calc_hash_ci, HP_script_calc_hash_ci) }, { HP_POP(script->array_src, HP_script_array_src) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 9a844cb92..02cf68bd2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -67982,14 +67982,14 @@ int HP_script_run_func(struct script_state *st) { } return retVal___; } -bool HP_script_sprintf(struct script_state *st, int start, struct StringBuf *out) { +bool HP_script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) { int hIndex = 0; bool retVal___ = false; - if (HPMHooks.count.HP_script_sprintf_pre > 0) { + if (HPMHooks.count.HP_script_sprintf_helper_pre > 0) { bool (*preHookFunc) (struct script_state **st, int *start, struct StringBuf **out); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_script_sprintf_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_script_sprintf_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_sprintf_helper_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_script_sprintf_helper_pre[hIndex].func; retVal___ = preHookFunc(&st, &start, &out); } if (*HPMforce_return) { @@ -67998,12 +67998,12 @@ bool HP_script_sprintf(struct script_state *st, int start, struct StringBuf *out } } { - retVal___ = HPMHooks.source.script.sprintf(st, start, out); + retVal___ = HPMHooks.source.script.sprintf_helper(st, start, out); } - if (HPMHooks.count.HP_script_sprintf_post > 0) { + if (HPMHooks.count.HP_script_sprintf_helper_post > 0) { bool (*postHookFunc) (bool retVal___, struct script_state *st, int start, struct StringBuf *out); - for (hIndex = 0; hIndex < HPMHooks.count.HP_script_sprintf_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_script_sprintf_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_sprintf_helper_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_script_sprintf_helper_post[hIndex].func; retVal___ = postHookFunc(retVal___, st, start, out); } } |