diff options
-rw-r--r-- | src/map/atcommand.c | 10 | ||||
-rw-r--r-- | src/map/clif.c | 22 | ||||
-rw-r--r-- | src/map/clif.h | 4 | ||||
-rw-r--r-- | src/map/duel.c | 14 | ||||
-rw-r--r-- | src/map/homunculus.c | 2 | ||||
-rw-r--r-- | src/map/intif.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 12 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/vending.c | 2 |
10 files changed, 38 insertions, 36 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 32ca2f384..d08367340 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7836,7 +7836,7 @@ ACMD(cash) // If this option is set, the message is already sent by pc function if( !battle_config.cashshop_show_points ){ sprintf(output, msg_fd(fd,505), ret, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); clif->message(fd, output); } } else @@ -7844,7 +7844,7 @@ ACMD(cash) } else { if( (ret=pc->paycash(sd, -value, 0)) >= 0){ sprintf(output, msg_fd(fd,410), ret, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); clif->message(fd, output); } else clif->message(fd, msg_fd(fd,41)); // Unable to decrease the number/value. @@ -7855,7 +7855,7 @@ ACMD(cash) // If this option is set, the message is already sent by pc function if( !battle_config.cashshop_show_points ){ sprintf(output, msg_fd(fd,506), ret, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); clif->message(fd, output); } } else @@ -7863,7 +7863,7 @@ ACMD(cash) } else { if( (ret=pc->paycash(sd, -value, -value)) >= 0){ sprintf(output, msg_fd(fd,411), ret, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); clif->message(fd, output); } else clif->message(fd, msg_fd(fd,41)); // Unable to decrease the number/value. @@ -7958,7 +7958,7 @@ ACMD(request) safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,278), message); // (@request): %s intif->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output); - clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output)); + clif_disp_onlyself(sd, atcmd_output); clif->message(sd->fd,msg_fd(fd,279)); // @request sent. return true; } diff --git a/src/map/clif.c b/src/map/clif.c index 11d6076e9..1d749b8cf 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7949,19 +7949,21 @@ void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_sess /*========================================== * Displays a message using the guild-chat colors to the specified targets. [Skotlex] *------------------------------------------*/ -void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +void clif_disp_message(struct block_list *src, const char *mes, enum send_target target) { unsigned char buf[256]; + int len; + nullpo_retv(mes); + nullpo_retv(src); + + len = (int)strlen(mes); if (len == 0) return; - nullpo_retv(src); - nullpo_retv(mes); - - if (len > sizeof(buf)-5) { - ShowWarning("clif_disp_message: Truncated message '%s' (len=%"PRIuS", max=%"PRIuS", aid=%d).\n", mes, len, sizeof(buf)-5, src->id); - len = sizeof(buf)-5; + if (len > (int)sizeof(buf)-5) { + ShowWarning("clif_disp_message: Truncated message '%s' (len=%d, max=%"PRIuS", aid=%d).\n", mes, len, sizeof(buf)-5, src->id); + len = (int)sizeof(buf)-5; } WBUFW(buf, 0) = 0x17f; @@ -10738,10 +10740,10 @@ void clif_noask_sub(struct map_session_data *src, struct map_session_data *targe nullpo_retv(src); // Your request has been rejected by autoreject option. msg = msg_sd(src,392); - clif_disp_onlyself(src, msg, strlen(msg)); + clif_disp_onlyself(src, msg); //Notice that a request was rejected. snprintf(output, 256, msg_sd(target,393+type), src->status.name, 256); - clif_disp_onlyself(target, output, strlen(output)); + clif_disp_onlyself(target, output); } void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); @@ -14659,7 +14661,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd) if( md->full ) {// TODO: is this official? char output[100]; sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); } } diff --git a/src/map/clif.h b/src/map/clif.h index 534f04ed7..7c6516871 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -60,7 +60,7 @@ struct view_data; **/ #define packet_len(cmd) packet_db[cmd].len #define clif_menuskill_clear(sd) ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0) -#define clif_disp_onlyself(sd,mes,len) clif->disp_message( &(sd)->bl, (mes), (len), SELF ) +#define clif_disp_onlyself(sd, mes) clif->disp_message(&(sd)->bl, (mes), SELF) #define MAX_ROULETTE_LEVEL 7 /** client-defined value **/ #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/ #define RGB2BGR(c) (((c) & 0x0000FF) << 16 | ((c) & 0x00FF00) | ((c) & 0xFF0000) >> 16) @@ -843,7 +843,7 @@ struct clif_interface { void (*changechatstatus) (struct chat_data* cd); void (*wis_message) (int fd, const char* nick, const char* mes, size_t mes_len); void (*wis_end) (int fd, int flag); - void (*disp_message) (struct block_list* src, const char* mes, size_t len, enum send_target target); + void (*disp_message) (struct block_list *src, const char *mes, enum send_target target); void (*broadcast) (struct block_list *bl, const char *mes, int len, int type, enum send_target target); void (*broadcast2) (struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); void (*messagecolor_self) (int fd, uint32 color, const char *msg); diff --git a/src/map/duel.c b/src/map/duel.c index 86c218acd..64991d39c 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -73,7 +73,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va) if (sd->duel_group != ssd->duel_group) return 0; sprintf(output, " %d. %s", ++(*p), sd->status.name); - clif_disp_onlyself(ssd, output, strlen(output)); + clif_disp_onlyself(ssd, output); return 1; } @@ -93,7 +93,7 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) { duel->list[did].members_count, duel->list[did].members_count + duel->list[did].invites_count); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); map->foreachpc(duel_showinfo_sub, sd, &p); } @@ -113,7 +113,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl) { duel->list[i].max_players_limit = maxpl; safestrncpy(output, msg_sd(sd,372), sizeof(output)); // " -- Duel has been created (@invite/@leave) --" - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); clif->maptypeproperty2(&sd->bl,SELF); @@ -127,7 +127,7 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map nullpo_retv(target_sd); // " -- Player %s invites %s to duel --" sprintf(output, msg_sd(sd,373), sd->status.name, target_sd->status.name); - clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif->disp_message(&sd->bl, output, DUEL_WOS); target_sd->duel_invite = did; duel->list[did].invites_count++; @@ -152,7 +152,7 @@ void duel_leave(const unsigned int did, struct map_session_data* sd) { nullpo_retv(sd); // " <- Player %s has left duel --" sprintf(output, msg_sd(sd,375), sd->status.name); - clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif->disp_message(&sd->bl, output, DUEL_WOS); duel->list[did].members_count--; if(duel->list[did].members_count == 0) { @@ -177,7 +177,7 @@ void duel_accept(const unsigned int did, struct map_session_data* sd) { // " -> Player %s has accepted duel --" sprintf(output, msg_sd(sd,376), sd->status.name); - clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif->disp_message(&sd->bl, output, DUEL_WOS); clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); clif->maptypeproperty2(&sd->bl,SELF); @@ -189,7 +189,7 @@ void duel_reject(const unsigned int did, struct map_session_data* sd) { nullpo_retv(sd); // " -- Player %s has rejected duel --" sprintf(output, msg_sd(sd,377), sd->status.name); - clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif->disp_message(&sd->bl, output, DUEL_WOS); duel->list[did].invites_count--; sd->duel_invite = 0; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index bda8fd9e6..66cce23e6 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -391,7 +391,7 @@ bool homunculus_levelup(struct homun_data *hd) { growth_max_hp, growth_max_sp, growth_str/10.0, growth_agi/10.0, growth_vit/10.0, growth_int/10.0, growth_dex/10.0, growth_luk/10.0); - clif_disp_onlyself(hd->master,output,strlen(output)); + clif_disp_onlyself(hd->master, output); } return true; } diff --git a/src/map/intif.c b/src/map/intif.c index 85270546e..0b2f34ce2 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1656,7 +1656,7 @@ void intif_parse_MailInboxReceived(int fd) { else if( battle_config.mail_show_status && ( battle_config.mail_show_status == 1 || sd->mail.inbox.unread ) ) { char output[128]; sprintf(output, msg_sd(sd,510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); } } /*------------------------------------------ diff --git a/src/map/mob.c b/src/map/mob.c index 36901b03b..19fee52a5 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -421,7 +421,7 @@ bool mob_ksprotected(struct block_list *src, struct block_list *target) { if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 ) { sprintf(output, "[KS Warning!! - Owner : %s]", pl_sd->status.name); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); sd->ks_floodprotect_tick = tick + 2000; } @@ -430,7 +430,7 @@ bool mob_ksprotected(struct block_list *src, struct block_list *target) { if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 ) { sprintf(output, "[Watch out! %s is trying to KS you!]", sd->status.name); - clif_disp_onlyself(pl_sd, output, strlen(output)); + clif_disp_onlyself(pl_sd, output); pl_sd->ks_floodprotect_tick = tick + 2000; } diff --git a/src/map/pc.c b/src/map/pc.c index 3b436105f..670f7741a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4276,7 +4276,7 @@ int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, if( zeny > 0 && sd->state.showzeny ) { char output[255]; sprintf(output, "Removed %dz.", zeny); - clif_disp_onlyself(sd,output,strlen(output)); + clif_disp_onlyself(sd, output); } return 0; @@ -4318,7 +4318,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points) { char output[128]; sprintf(output, msg_sd(sd,504), points, cash, sd->kafraPoints, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); } return cash+points; } @@ -4343,7 +4343,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points) if( battle_config.cashshop_show_points ) { sprintf(output, msg_sd(sd,505), cash, sd->cashPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); } return cash; } @@ -4366,7 +4366,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points) if( battle_config.cashshop_show_points ) { sprintf(output, msg_sd(sd,506), points, sd->kafraPoints); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output); } return points; } @@ -4404,7 +4404,7 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, if( zeny > 0 && sd->state.showzeny ) { char output[255]; sprintf(output, "Gained %dz.", zeny); - clif_disp_onlyself(sd,output,strlen(output)); + clif_disp_onlyself(sd, output); } return 0; @@ -6726,7 +6726,7 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in char output[256]; sprintf(output, "Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100); - clif_disp_onlyself(sd,output,strlen(output)); + clif_disp_onlyself(sd, output); } return true; diff --git a/src/map/script.c b/src/map/script.c index f62bfa972..e869ddb62 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -13791,7 +13791,7 @@ BUILDIN(dispbottom) int color = script_getnum(st,3); clif->messagecolor_self(sd->fd, color, message); } else { - clif_disp_onlyself(sd, message, (int)strlen(message)); + clif_disp_onlyself(sd, message); } return true; diff --git a/src/map/vending.c b/src/map/vending.c index d9001f6f5..e3a62bea7 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -199,7 +199,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, if( battle_config.buyer_name ) { char temp[256]; sprintf(temp, msg_sd(vsd,265), sd->status.name); - clif_disp_onlyself(vsd,temp,strlen(temp)); + clif_disp_onlyself(vsd, temp); } } |