OSDN Git Service

Suppress gcc warning
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 20 Feb 2013 13:04:34 +0000 (13:04 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 20 Feb 2013 13:04:34 +0000 (13:04 +0000)
src/artifact.c
src/birth.c
src/bldg.c
src/japanese.c
src/main-gcu.c
src/main-x11.c
src/report.c

index 30e3644..ad5a8bd 100644 (file)
@@ -189,7 +189,7 @@ void one_ability(object_type *o_ptr)
  */
 void one_activation(object_type *o_ptr)
 {
-       int type;
+       int type = 0;
        int chance = 0;
 
        while (randint1(100) >= chance)
index 0f8e6cc..d06329e 100644 (file)
@@ -2204,10 +2204,9 @@ static byte choose_realm(s32b choices, int *count)
                        }
                        if (p_ptr->realm2 == i+1)
                                cs = n;
-                       if (n < 26)
-                               sym[n] = I2A(n);
-                       else
-                               sym[n] = ('A' + n - 26);
+
+                       sym[n] = I2A(n);
+
                        sprintf(buf, "%c%c %s", sym[n], p2, realm_names[i+1]);
                        put_str(buf, 12 + (n/5), 2 + 15 * (n%5));
                        picks[n++] = i+1;
index 4fcc7f1..ad879a7 100644 (file)
@@ -4293,9 +4293,11 @@ static int repair_broken_weapon_aux(int bcost)
        {
                int i, n = 1;
 
+               /* Suppress compiler warning */
+               k_idx = 0;
+
                for (i = 1; i < max_k_idx; i++)
                {
-                       object_type forge;
                        object_kind *k_ptr = &k_info[i];
 
                        if (k_ptr->tval != TV_SWORD) continue;
index 353c947..b746e11 100644 (file)
@@ -107,7 +107,7 @@ void sindarin_to_kana(char *kana, const char *sindarin)
 
 /*ÆüËܸìÆ°»ì³èÍÑ (ÂǤġäÂǤäÆ,ÂǤÁ etc) */
 
-#define CMPTAIL(y) strncmp(&in[l-strlen(y)],y,strlen(y))
+#define CMPTAIL(y) strncmp(&in[l-(int)strlen(y)],y,strlen(y))
 
 /* ²¥¤ë,½³¤ë¡ä²¥¤ê,½³¤ë */
 void jverb1( const char *in , char *out){
index 281ec6c..0c7f244 100644 (file)
@@ -876,9 +876,8 @@ static errr Term_xtra_gcu_sound(int v)
    if (!sound_file[v]) return (1);
 
    sprintf(buf,"./gcusound.sh %s\n", sound_file[v]);
-   system(buf);
    
-   return (0);
+   return (system(buf) < 0);
 
 #if 0
    char *argv[4];
@@ -961,8 +960,7 @@ static errr Term_xtra_gcu(int n, int v)
 
       /* Make a noise */
       case TERM_XTRA_NOISE:
-      (void)write(1, "\007", 1);
-      return (0);
+      return write(1, "\007", 1) != 1;
 
 #ifdef USE_SOUND
       /* Make a special sound */
index 3fccd1c..1073be3 100644 (file)
@@ -2878,9 +2878,8 @@ static errr Term_xtra_x11_sound(int v)
        if (!sound_file[v]) return (1);
        
        sprintf(buf,"./playwave.sh %s\n", sound_file[v]);
-       system(buf);
        
-       return (0);
+       return (system(buf) < 0);
        
 }
 #endif /* USE_SOUND */
index 055ef50..1abaa3c 100644 (file)
@@ -64,11 +64,12 @@ typedef struct {
 static int Vasprintf(char **buf, const char *fmt, va_list ap)
 {
        int ret;
+       static char static_buf[8192];
 
-       *buf = malloc(1024);
+       *buf = static_buf;
 
 #if defined(HAVE_VSNPRINTF)
-       ret = vsnprintf(*buf, 1024, fmt, ap);
+       ret = vsnprintf(*buf, sizeof(static_buf), fmt, ap);
 #else
        ret = vsprintf(*buf, fmt, ap);
 #endif
@@ -127,10 +128,10 @@ static int buf_sprintf(BUF *buf, const char *fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       vasprintf(&tmpbuf, fmt, ap);
+       ret = vasprintf(&tmpbuf, fmt, ap);
        va_end(ap);
 
-       if(!tmpbuf) return -1;
+       if (ret < 0) return -1;
 
 #if ('\r' == 0x0a && '\n' == 0x0d)
        {