• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: コミット

変愚蛮怒のメインリポジトリです


コミットメタ情報

リビジョン71f3e243bb13fef0aeb2037b2a371a99a710317a (tree)
日時2017-09-12 21:25:20
作者Deskull <desull@user...>
コミッターDeskull

ログメッセージ

#37287 (2.2.0.85) z-term.c, z-rand.c, z-form.c 中のVCコンパイラ警告を修正。C4710は抑制。 / Fix warnings of VC compiler in z-term.c, z-rand.c and z-form.c. Suppress C4710.

変更サマリ

差分

--- a/Hengband_vcs2015/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2015/Hengband/Hengband.vcxproj
@@ -69,7 +69,7 @@
6969 <WarningLevel>EnableAllWarnings</WarningLevel>
7070 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
7171 <CompileAs>CompileAsC</CompileAs>
72- <DisableSpecificWarnings>4127;4996;4244;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
72+ <DisableSpecificWarnings>4127;4710;4996;4244;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
7373 </ClCompile>
7474 <Link>
7575 <AdditionalDependencies>winmm.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
--- a/src/defines.h
+++ b/src/defines.h
@@ -53,7 +53,7 @@
5353 #define FAKE_VER_MAJOR 12 /*!< ゲームのバージョン番号定義(メジャー番号 + 10) */
5454 #define FAKE_VER_MINOR 2 /*!< ゲームのバージョン番号定義(マイナー番号) */
5555 #define FAKE_VER_PATCH 0 /*!< ゲームのバージョン番号定義(パッチ番号) */
56-#define FAKE_VER_EXTRA 85 /*!< ゲームのバージョン番号定義(エクストラ番号) */
56+#define FAKE_VER_EXTRA 86 /*!< ゲームのバージョン番号定義(エクストラ番号) */
5757
5858
5959 /*!
--- a/src/z-form.c
+++ b/src/z-form.c
@@ -466,7 +466,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
466466 arg = va_arg(vp, int);
467467
468468 /* Format the argument */
469- sprintf(tmp, aux, arg);
469+ sprintf(tmp, "%c", arg);
470470
471471 /* Done */
472472 break;
@@ -483,7 +483,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
483483 arg = va_arg(vp, long);
484484
485485 /* Format the argument */
486- sprintf(tmp, aux, arg);
486+ sprintf(tmp, "%ld", arg);
487487 }
488488 else
489489 {
@@ -493,7 +493,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
493493 arg = va_arg(vp, int);
494494
495495 /* Format the argument */
496- sprintf(tmp, aux, arg);
496+ sprintf(tmp, "%d", arg);
497497 }
498498
499499 /* Done */
@@ -511,7 +511,25 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
511511 arg = va_arg(vp, unsigned long);
512512
513513 /* Format the argument */
514- sprintf(tmp, aux, arg);
514+ switch (aux[q-1])
515+ {
516+ case 'u':
517+ sprintf(tmp, "%lu", arg);
518+ break;
519+ case 'o':
520+ sprintf(tmp, "%lo", arg);
521+ break;
522+ case 'x':
523+ sprintf(tmp, "%lx", arg);
524+ break;
525+ case 'X':
526+ sprintf(tmp, "%lX", arg);
527+ break;
528+ default:
529+ sprintf(tmp, "");
530+ break;
531+ }
532+
515533 }
516534 else
517535 {
@@ -521,7 +539,24 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
521539 arg = va_arg(vp, unsigned int);
522540
523541 /* Format the argument */
524- sprintf(tmp, aux, arg);
542+ switch (aux[q - 1])
543+ {
544+ case 'u':
545+ sprintf(tmp, "%u", arg);
546+ break;
547+ case 'o':
548+ sprintf(tmp, "%o", arg);
549+ break;
550+ case 'x':
551+ sprintf(tmp, "%x", arg);
552+ break;
553+ case 'X':
554+ sprintf(tmp, "%X", arg);
555+ break;
556+ default:
557+ sprintf(tmp, "");
558+ break;
559+ }
525560 }
526561
527562 /* Done */
@@ -539,7 +574,27 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
539574 arg = va_arg(vp, double);
540575
541576 /* Format the argument */
542- sprintf(tmp, aux, arg);
577+ switch (aux[q - 1])
578+ {
579+ case 'f':
580+ sprintf(tmp, "%f", arg);
581+ break;
582+ case 'e':
583+ sprintf(tmp, "%e", arg);
584+ break;
585+ case 'E':
586+ sprintf(tmp, "%E", arg);
587+ break;
588+ case 'g':
589+ sprintf(tmp, "%g", arg);
590+ break;
591+ case 'G':
592+ sprintf(tmp, "%G", arg);
593+ break;
594+ default:
595+ sprintf(tmp, aux, arg);
596+ break;
597+ }
543598
544599 /* Done */
545600 break;
@@ -554,7 +609,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
554609 arg = va_arg(vp, vptr);
555610
556611 /* Format the argument */
557- sprintf(tmp, aux, arg);
612+ sprintf(tmp, "%p", arg);
558613
559614 /* Done */
560615 break;
@@ -577,7 +632,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
577632 arg2[1023] = '\0';
578633
579634 /* Format the argument */
580- sprintf(tmp, aux, arg2);
635+ sprintf(tmp, "%s", arg2);
581636
582637 /* Done */
583638 break;
@@ -593,7 +648,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
593648 arg = va_arg(vp, vptr);
594649
595650 /* Format the "user data" */
596- (void)vstrnfmt_aux(tmp, 1000, aux, arg);
651+ (void)vstrnfmt_aux(tmp, 1000, aux[q-1] == 'V' ? "%V" : "%v", arg);
597652
598653 /* Done */
599654 break;
@@ -626,7 +681,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
626681 {
627682 /* Capitalize if possible */
628683 if (islower(tmp[q]))
629- tmp[q] = toupper(tmp[q]);
684+ tmp[q] = (char)toupper(tmp[q]);
630685
631686 /* Done */
632687 break;
--- a/src/z-rand.c
+++ b/src/z-rand.c
@@ -362,7 +362,7 @@ s16b randnor(int mean, int stand)
362362 s16b high = RANDNOR_NUM;
363363
364364 /* Paranoia */
365- if (stand < 1) return (mean);
365+ if (stand < 1) return (s16b)(mean);
366366
367367 /* Roll for probability */
368368 tmp = (s16b)randint0(32768);
@@ -381,7 +381,7 @@ s16b randnor(int mean, int stand)
381381 /* Move left otherwise */
382382 else
383383 {
384- high = mid;
384+ high = (s16b)mid;
385385 }
386386 }
387387
@@ -404,7 +404,7 @@ s16b damroll(int num, int sides)
404404 {
405405 int i, sum = 0;
406406 for (i = 0; i < num; i++) sum += randint1(sides);
407- return (sum);
407+ return (s16b)(sum);
408408 }
409409
410410
@@ -463,7 +463,7 @@ s32b Rand_external(s32b m)
463463 if (!initialized)
464464 {
465465 /* Initialize with new seed */
466- u32b seed = time(NULL);
466+ u32b seed = (u32b)time(NULL);
467467 Rand_Xorshift_seed(seed, Rand_state_external);
468468 initialized = TRUE;
469469 }
--- a/src/z-term.c
+++ b/src/z-term.c
@@ -535,12 +535,12 @@ void Term_queue_char(int x, int y, byte a, char c, byte ta, char tc)
535535 *scr_tcc = tc;
536536
537537 /* Check for new min/max row info */
538- if (y < Term->y1) Term->y1 = y;
539- if (y > Term->y2) Term->y2 = y;
538+ if (y < Term->y1) Term->y1 = (byte_hack)y;
539+ if (y > Term->y2) Term->y2 = (byte_hack)y;
540540
541541 /* Check for new min/max col info for this row */
542- if (x < Term->x1[y]) Term->x1[y] = x;
543- if (x > Term->x2[y]) Term->x2[y] = x;
542+ if (x < Term->x1[y]) Term->x1[y] = (byte_hack)x;
543+ if (x > Term->x2[y]) Term->x2[y] = (byte_hack)x;
544544
545545 #ifdef JP
546546 if (((scrn->a[y][x] & AF_BIGTILE2) == AF_BIGTILE2) ||
@@ -695,12 +695,12 @@ void Term_queue_line(int x, int y, int n, byte *a, char *c, byte *ta, char *tc)
695695 if (x1 >= 0)
696696 {
697697 /* Check for new min/max row info */
698- if (y < Term->y1) Term->y1 = y;
699- if (y > Term->y2) Term->y2 = y;
698+ if (y < Term->y1) Term->y1 = (byte_hack)y;
699+ if (y > Term->y2) Term->y2 = (byte_hack)y;
700700
701701 /* Check for new min/max col info in this row */
702- if (x1 < Term->x1[y]) Term->x1[y] = x1;
703- if (x2 > Term->x2[y]) Term->x2[y] = x2;
702+ if (x1 < Term->x1[y]) Term->x1[y] = (byte_hack)x1;
703+ if (x2 > Term->x2[y]) Term->x2[y] = (byte_hack)x2;
704704 }
705705 }
706706
@@ -828,12 +828,12 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
828828 if (x1 >= 0)
829829 {
830830 /* Check for new min/max row info */
831- if (y < Term->y1) Term->y1 = y;
832- if (y > Term->y2) Term->y2 = y;
831+ if (y < Term->y1) Term->y1 = (byte_hack)y;
832+ if (y > Term->y2) Term->y2 = (byte_hack)y;
833833
834834 /* Check for new min/max col info in this row */
835- if (x1 < Term->x1[y]) Term->x1[y] = x1;
836- if (x2 > Term->x2[y]) Term->x2[y] = x2;
835+ if (x1 < Term->x1[y]) Term->x1[y] = (byte_hack)x1;
836+ if (x2 > Term->x2[y]) Term->x2[y] = (byte_hack)x2;
837837 }
838838 }
839839
@@ -1692,7 +1692,7 @@ errr Term_fresh(void)
16921692 }
16931693
16941694 /* This row is all done */
1695- Term->x1[y] = w;
1695+ Term->x1[y] = (byte_hack)w;
16961696 Term->x2[y] = 0;
16971697
16981698 /* Hack -- Flush that row (if allowed) */
@@ -1701,7 +1701,7 @@ errr Term_fresh(void)
17011701 }
17021702
17031703 /* No rows are invalid */
1704- Term->y1 = h;
1704+ Term->y1 = (byte_hack)h;
17051705 Term->y2 = 0;
17061706 }
17071707
@@ -1796,7 +1796,7 @@ errr Term_set_cursor(int v)
17961796 if (Term->scr->cv == v) return (1);
17971797
17981798 /* Change */
1799- Term->scr->cv = v;
1799+ Term->scr->cv = (bool_hack)v;
18001800
18011801 /* Success */
18021802 return (0);
@@ -1818,8 +1818,8 @@ errr Term_gotoxy(int x, int y)
18181818 if ((y < 0) || (y >= h)) return (-1);
18191819
18201820 /* Remember the cursor */
1821- Term->scr->cx = x;
1822- Term->scr->cy = y;
1821+ Term->scr->cx = (byte_hack)x;
1822+ Term->scr->cy = (byte_hack)y;
18231823
18241824 /* The cursor is not useless */
18251825 Term->scr->cu = 0;
@@ -1975,7 +1975,7 @@ errr Term_addstr(int n, byte a, cptr s)
19751975 Term_queue_chars(Term->scr->cx, Term->scr->cy, n, a, s);
19761976
19771977 /* Advance the cursor */
1978- Term->scr->cx += n;
1978+ Term->scr->cx += (byte_hack)n;
19791979
19801980 /* Hack -- Notice "Useless" cursor */
19811981 if (res) Term->scr->cu = 1;
@@ -2124,8 +2124,8 @@ errr Term_erase(int x, int y, int n)
21242124 n++;
21252125 #endif
21262126 /* Save the "literal" information */
2127- scr_aa[x] = na;
2128- scr_cc[x] = nc;
2127+ scr_aa[x] = (byte_hack)na;
2128+ scr_cc[x] = (char)nc;
21292129
21302130 scr_taa[x] = 0;
21312131 scr_tcc[x] = 0;
@@ -2141,12 +2141,12 @@ errr Term_erase(int x, int y, int n)
21412141 if (x1 >= 0)
21422142 {
21432143 /* Check for new min/max row info */
2144- if (y < Term->y1) Term->y1 = y;
2145- if (y > Term->y2) Term->y2 = y;
2144+ if (y < Term->y1) Term->y1 = (byte_hack)y;
2145+ if (y > Term->y2) Term->y2 = (byte_hack)y;
21462146
21472147 /* Check for new min/max col info in this row */
2148- if (x1 < Term->x1[y]) Term->x1[y] = x1;
2149- if (x2 > Term->x2[y]) Term->x2[y] = x2;
2148+ if (x1 < Term->x1[y]) Term->x1[y] = (byte_hack)x1;
2149+ if (x2 > Term->x2[y]) Term->x2[y] = (byte_hack)x2;
21502150 }
21512151
21522152 /* Success */
@@ -2246,8 +2246,8 @@ errr Term_redraw_section(int x1, int y1, int x2, int y2)
22462246 if (x1 < 0) x1 = 0;
22472247
22482248 /* Set y limits */
2249- Term->y1 = y1;
2250- Term->y2 = y2;
2249+ Term->y1 = (byte_hack)y1;
2250+ Term->y2 = (byte_hack)y2;
22512251
22522252 /* Set the x limits */
22532253 for (i = Term->y1; i <= Term->y2; i++)
@@ -2266,8 +2266,8 @@ errr Term_redraw_section(int x1, int y1, int x2, int y2)
22662266 if (Term->scr->a[i][x2j] & AF_KANJI1) x2j++;
22672267 }
22682268
2269- Term->x1[i] = x1j;
2270- Term->x2[i] = x2j;
2269+ Term->x1[i] = (byte_hack)x1j;
2270+ Term->x2[i] = (byte_hack)x2j;
22712271
22722272 c_ptr = Term->old->c[i];
22732273
@@ -2401,7 +2401,7 @@ errr Term_keypress(int k)
24012401 if (!k) return (-1);
24022402
24032403 /* Store the char, advance the queue */
2404- Term->key_queue[Term->key_head++] = k;
2404+ Term->key_queue[Term->key_head++] = (char)k;
24052405
24062406 /* Circular queue, handle wrap */
24072407 if (Term->key_head == Term->key_size) Term->key_head = 0;
@@ -2431,7 +2431,7 @@ errr Term_key_push(int k)
24312431 if (Term->key_tail == 0) Term->key_tail = Term->key_size;
24322432
24332433 /* Back up, Store the char */
2434- Term->key_queue[--Term->key_tail] = k;
2434+ Term->key_queue[--Term->key_tail] = (char)k;
24352435
24362436 /* Success (unless overflow) */
24372437 if (Term->key_head != Term->key_tail) return (0);
@@ -2782,8 +2782,8 @@ errr Term_resize(int w, int h)
27822782 }
27832783
27842784 /* Save new size */
2785- Term->wid = w;
2786- Term->hgt = h;
2785+ Term->wid = (byte_hack)w;
2786+ Term->hgt = (byte_hack)h;
27872787
27882788 /* Force "total erase" */
27892789 Term->total_erase = TRUE;
@@ -2940,15 +2940,15 @@ errr term_init(term *t, int w, int h, int k)
29402940 t->key_head = t->key_tail = 0;
29412941
29422942 /* Determine the input queue size */
2943- t->key_size = k;
2943+ t->key_size = (u16b)k;
29442944
29452945 /* Allocate the input queue */
29462946 C_MAKE(t->key_queue, t->key_size, char);
29472947
29482948
29492949 /* Save the size */
2950- t->wid = w;
2951- t->hgt = h;
2950+ t->wid = (byte_hack)w;
2951+ t->hgt = (byte_hack)h;
29522952
29532953 /* Allocate change arrays */
29542954 C_MAKE(t->x1, h, byte);
旧リポジトリブラウザで表示