OSDN Git Service

add type casting for fprintf
authordis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 8 Sep 2012 05:55:39 +0000 (05:55 +0000)
committerdis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 8 Sep 2012 05:55:39 +0000 (05:55 +0000)
src/bldg.c
src/cmd3.c
src/cmd4.c
src/mind.c
src/spells2.c
src/wizard1.c
src/wizard2.c
src/xtra1.c
src/xtra2.c

index 36819ed..7317586 100644 (file)
@@ -129,9 +129,9 @@ static void show_building(building_type* bldg)
                                {
                                        action_color = TERM_YELLOW;
 #ifdef JP
-sprintf(buff, "($%ld)", bldg->member_costs[i]);
+sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
 #else
-                                       sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
+                                       sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
 #endif
 
                                }
@@ -139,9 +139,9 @@ sprintf(buff, "($%ld)", bldg->member_costs[i]);
                                {
                                        action_color = TERM_YELLOW;
 #ifdef JP
-sprintf(buff, "($%ld)", bldg->other_costs[i]);
+sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
 #else
-                                       sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
+                                       sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
 #endif
 
                                }
@@ -168,9 +168,9 @@ strcpy(buff, "(
                                {
                                        action_color = TERM_YELLOW;
 #ifdef JP
-sprintf(buff, "($%ld)", bldg->member_costs[i]);
+sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
 #else
-                                       sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
+                                       sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
 #endif
 
                                }
@@ -178,9 +178,9 @@ sprintf(buff, "($%ld)", bldg->member_costs[i]);
                                {
                                        action_color = TERM_YELLOW;
 #ifdef JP
-sprintf(buff, "($%ld)", bldg->other_costs[i]);
+sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
 #else
-                                       sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
+                                       sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
 #endif
 
                                }
@@ -201,9 +201,9 @@ strcpy(buff, "(
                                {
                                        action_color = TERM_YELLOW;
 #ifdef JP
-sprintf(buff, "($%ld)", bldg->member_costs[i]);
+sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
 #else
-                                       sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
+                                       sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
 #endif
 
                                }
@@ -1270,9 +1270,9 @@ static bool gamble_comm(int cmd)
                /* Get the wager */
                strcpy(out_val, "");
 #ifdef JP
-sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
+sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
 #else
-               sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
+               sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
 #endif
 
 
@@ -1303,9 +1303,9 @@ msg_print("
                        else if (wager > maxbet)
                        {
 #ifdef JP
-msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤­¤Ê¡£", maxbet);
+msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤­¤Ê¡£", (long int)maxbet);
 #else
-                               msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
+                               msg_format("I'll take %ld gold of that. Keep the rest.", (long int)maxbet);
 #endif
 
                                wager = maxbet;
@@ -1327,17 +1327,17 @@ msg_print("
                        oldgold = p_ptr->au;
 
 #ifdef JP
-sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", oldgold);
+sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", (long int)oldgold);
 #else
-                       sprintf(tmp_str, "Gold before game: %9ld", oldgold);
+                       sprintf(tmp_str, "Gold before game: %9ld", (long int)oldgold);
 #endif
 
                        prt(tmp_str, 20, 2);
 
 #ifdef JP
-sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â:     %9ld", wager);
+sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â:     %9ld", (long int)wager);
 #else
-                       sprintf(tmp_str, "Current Wager:    %9ld", wager);
+                       sprintf(tmp_str, "Current Wager:    %9ld", (long int)wager);
 #endif
 
                        prt(tmp_str, 21, 2);
@@ -1606,9 +1606,9 @@ prt("
                                        prt("", 17, 37);
                                }
 #ifdef JP
-sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â:     %9ld", p_ptr->au);
+sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â:     %9ld", (long int)p_ptr->au);
 #else
-                               sprintf(tmp_str, "Current Gold:     %9ld", p_ptr->au);
+                               sprintf(tmp_str, "Current Gold:     %9ld", (long int)p_ptr->au);
 #endif
 
                                prt(tmp_str, 22, 2);
@@ -1960,9 +1960,9 @@ static bool kakutoujou(void)
                        monster_race *r_ptr = &r_info[battle_mon[i]];
 
 #ifdef JP
-                       sprintf(buf,"%d) %-58s  %4ld.%02ldÇÜ", i+1, format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "¤â¤É¤­" : "      "), mon_odds[i]/100, mon_odds[i]%100);
+                       sprintf(buf,"%d) %-58s  %4ld.%02ldÇÜ", i+1, format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "¤â¤É¤­" : "      "), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
 #else
-                       sprintf(buf,"%d) %-58s  %4ld.%02ld", i+1, format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name), mon_odds[i]/100, mon_odds[i]%100);
+                       sprintf(buf,"%d) %-58s  %4ld.%02ld", i+1, format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
 #endif
                        prt(buf, 5+i, 1);
                }
@@ -2002,9 +2002,9 @@ static bool kakutoujou(void)
                /* Get the wager */
                strcpy(out_val, "");
 #ifdef JP
-sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
+sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
 #else
-               sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
+               sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
 #endif
 
 
@@ -2035,9 +2035,9 @@ msg_print("
                        else if (wager > maxbet)
                        {
 #ifdef JP
-msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤­¤Ê¡£", maxbet);
+msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤­¤Ê¡£", (long int)maxbet);
 #else
-                               msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
+                               msg_format("I'll take %ld gold of that. Keep the rest.",(long int) maxbet);
 #endif
 
                                wager = maxbet;
@@ -2238,9 +2238,9 @@ static bool kankin(void)
                        if (get_check(buf))
                        {
 #ifdef JP
-                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 1000000L * o_ptr->number);
+                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(1000000L * o_ptr->number));
 #else
-                               msg_format("You get %ldgp.", 1000000L * o_ptr->number);
+                               msg_format("You get %ldgp.", (long int)(1000000L * o_ptr->number));
 #endif
                                p_ptr->au += 1000000L * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
@@ -2269,9 +2269,9 @@ static bool kankin(void)
                        if (get_check(buf))
                        {
 #ifdef JP
-                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 200000L * o_ptr->number);
+                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(200000L * o_ptr->number));
 #else
-                               msg_format("You get %ldgp.", 200000L * o_ptr->number);
+                               msg_format("You get %ldgp.", (long int)(200000L * o_ptr->number));
 #endif
                                p_ptr->au += 200000L * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
@@ -2300,9 +2300,9 @@ static bool kankin(void)
                        if (get_check(buf))
                        {
 #ifdef JP
-                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 100000L * o_ptr->number);
+                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(100000L * o_ptr->number));
 #else
-                               msg_format("You get %ldgp.", 100000L * o_ptr->number);
+                               msg_format("You get %ldgp.", (long int)(100000L * o_ptr->number));
 #endif
                                p_ptr->au += 100000L * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
@@ -2329,9 +2329,9 @@ static bool kankin(void)
                        if (get_check(buf))
                        {
 #ifdef JP
-                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
+                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
 #else
-                               msg_format("You get %ldgp.", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
+                               msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
 #endif
                                p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
@@ -2359,9 +2359,9 @@ static bool kankin(void)
                        if (get_check(buf))
                        {
 #ifdef JP
-                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
+                               msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
 #else
-                               msg_format("You get %ldgp.", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
+                               msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
 #endif
                                p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
index e8ce3b1..7c325ac 100644 (file)
@@ -46,8 +46,8 @@ void do_cmd_inven(void)
 
 #ifdef JP
        sprintf(out_val, "»ý¤Áʪ¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
-           lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
-           (p_ptr->total_weight * 100) / weight_limit());
+           (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #else
        sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
            (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
@@ -120,12 +120,12 @@ void do_cmd_equip(void)
        /* Build a prompt */
 #ifdef JP
        sprintf(out_val, "ÁõÈ÷¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
-           lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
-           (p_ptr->total_weight * 100) / weight_limit());
+           (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #else
        sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
            (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
-           (p_ptr->total_weight * 100) / weight_limit());
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #endif
 
 
index d56d239..f388fb0 100644 (file)
@@ -7347,9 +7347,9 @@ static void do_cmd_knowledge_kill_count(void)
 #endif
                else
 #ifdef JP
-                       fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
+                       fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", (long int)Total);
 #else
-                       fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
+                       fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
 #endif
        }
 
@@ -7429,10 +7429,10 @@ static void do_cmd_knowledge_kill_count(void)
 
        fprintf(fff,"----------------------------------------------\n");
 #ifdef JP
-       fprintf(fff,"    ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
+       fprintf(fff,"    ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", (unsigned long int)Total);
 #else
        fprintf(fff,"   Total: %lu creature%s killed.\n",
-               Total, (Total == 1 ? "" : "s"));
+               (unsigned long int)Total, (Total == 1 ? "" : "s"));
 #endif
 
 
index 062fb58..33e9921 100644 (file)
@@ -322,7 +322,7 @@ void mindcraft_info(char *p, int use_mind, int power)
        case 11: sprintf(p, " %s%dd6", s_dam, plev / 2);  break;
        case 12: sprintf(p, " %sd%d+%d", s_dam, plev * 3, plev * 3); break;
 #ifdef JP
-       case 13: sprintf(p, " ¹ÔÆ°:%ld²ó", (p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
+       case 13: sprintf(p, " ¹ÔÆ°:%ld²ó", (long int)(p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
 #else
        case 13: sprintf(p, " %ld acts.", (p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
 #endif
index 830cdd1..2359722 100644 (file)
@@ -109,9 +109,9 @@ sprintf(Dummy, "
        info[i++] = "";
 
 #ifdef JP
-       sprintf(Dummy, "¸½ºß¤Î°À­ : %s(%ld)", your_alignment(), p_ptr->align);
+       sprintf(Dummy, "¸½ºß¤Î°À­ : %s(%ld)", your_alignment(), (long int)p_ptr->align);
 #else
-       sprintf(Dummy, "Your alighnment : %s(%ld)", your_alignment(), p_ptr->align);
+       sprintf(Dummy, "Your alighnment : %s(%ld)", your_alignment(), (long int)p_ptr->align);
 #endif
        strcpy(buf[1], Dummy);
        info[i++] = buf[1];
index f5414cf..050f80a 100644 (file)
@@ -2402,7 +2402,7 @@ static void spoil_mon_evol(cptr fname)
 #endif
                for (n = 1; r_ptr->next_exp; n++)
                {
-                       fprintf(fff, "%*s-(%ld)-> ", n * 2, "", r_ptr->next_exp);
+                       fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
                        fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
                        r_ptr = &r_info[r_ptr->next_r_idx];
 #ifdef JP
index 0a01936..31a7b29 100644 (file)
@@ -1040,7 +1040,7 @@ static void wiz_statistics(object_type *o_ptr)
                        break;
                }
 
-               sprintf(tmp_val, "%ld", test_roll);
+               sprintf(tmp_val, "%ld", (long int)test_roll);
                if (get_string(p, tmp_val, 10)) test_roll = atol(tmp_val);
                test_roll = MAX(1, test_roll);
 
index 12ec3fa..39e13b6 100644 (file)
@@ -932,7 +932,7 @@ static void prt_hp(void)
        put_str("HP", ROW_CURHP, COL_CURHP);
 
        /* ¸½ºß¤Î¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->chp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->chp);
 
        if (p_ptr->chp >= p_ptr->mhp)
        {
@@ -953,7 +953,7 @@ static void prt_hp(void)
        put_str( "/", ROW_CURHP, COL_CURHP + 7 );
 
        /* ºÇÂç¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->mhp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
        color = TERM_L_GREEN;
 
        c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
@@ -983,7 +983,7 @@ static void prt_sp(void)
 #endif
 
        /* ¸½ºß¤Î¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->csp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->csp);
 
        if (p_ptr->csp >= p_ptr->msp)
        {
@@ -1004,7 +1004,7 @@ static void prt_sp(void)
        put_str( "/", ROW_CURSP, COL_CURSP + 7 );
 
        /* ºÇÂç¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->msp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->msp);
        color = TERM_L_GREEN;
 
        c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
index 8206468..246306b 100644 (file)
@@ -3088,7 +3088,7 @@ static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
        num = MIN(999, exp_adv_frac);
 
        /* Display the number */
-       sprintf(buf,"%03ld", num);
+       sprintf(buf,"%03ld", (long int)num);
 }