OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / z-form.c
index d145019..f355a98 100644 (file)
@@ -1,4 +1,12 @@
-/* File: z-form.c */
+/* File: z-form.c */
+
+/*
+ * Copyright (c) 1997 Ben Harrison
+ *
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.
+ */
 
 /* Purpose: Low level text formatting -BEN- */
 
@@ -274,8 +282,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
                        /* Save the character */
                        buf[n++] = *s++;
-
-                       /* Continue */
                        continue;
                }
 
@@ -293,8 +299,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
                        /* Skip the "%" */
                        s++;
-
-                       /* Continue */
                        continue;
                }
 
@@ -311,8 +315,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
                        /* Skip the "n" */
                        s++;
-
-                       /* Continue */
                        continue;
                }
 
@@ -324,8 +326,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
                        /* Skip the "r" */
                        s++;
-
-                       /* Continue */
                        continue;
                }
 
@@ -458,9 +458,8 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                arg = va_arg(vp, int);
 
                                /* Format the argument */
-                               sprintf(tmp, aux, arg);
+                               sprintf(tmp, "%c", arg);
 
-                               /* Done */
                                break;
                        }
 
@@ -488,7 +487,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                        sprintf(tmp, aux, arg);
                                }
 
-                               /* Done */
                                break;
                        }
 
@@ -502,7 +500,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                        /* Access next argument */
                                        arg = va_arg(vp, unsigned long);
 
-                                       /* Format the argument */
                                        sprintf(tmp, aux, arg);
                                }
                                else
@@ -511,12 +508,10 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
                                        /* Access next argument */
                                        arg = va_arg(vp, unsigned int);
-
-                                       /* Format the argument */
                                        sprintf(tmp, aux, arg);
+
                                }
 
-                               /* Done */
                                break;
                        }
 
@@ -533,7 +528,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                /* Format the argument */
                                sprintf(tmp, aux, arg);
 
-                               /* Done */
                                break;
                        }
 
@@ -548,7 +542,6 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                /* Format the argument */
                                sprintf(tmp, aux, arg);
 
-                               /* Done */
                                break;
                        }
 
@@ -569,9 +562,8 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                arg2[1023] = '\0';
 
                                /* Format the argument */
-                               sprintf(tmp, aux, arg2);
+                               sprintf(tmp, aux, arg);
 
-                               /* Done */
                                break;
                        }
 
@@ -585,14 +577,12 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                                arg = va_arg(vp, vptr);
 
                                /* Format the "user data" */
-                               (void)vstrnfmt_aux(tmp, 1000, aux, arg);
+                               sprintf(tmp, aux, arg);
 
-                               /* Done */
                                break;
                        }
 
 
-                       /* Oops */
                        default:
                        {
                                /* Error -- illegal format char */
@@ -605,7 +595,7 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
 
 
 #ifdef JP
-                  for (q = 0; tmp[q]; q++) if ( iskanji(tmp[q]) ) { do_xtra=FALSE;break;} 
+               for (q = 0; tmp[q]; q++) if (iskanji(tmp[q])) { do_xtra=FALSE;break;} 
 #endif
                /* Mega-Hack -- handle "capitilization" */
                if (do_xtra)
@@ -614,12 +604,12 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp)
                        for (q = 0; tmp[q]; q++)
                        {
                                /* Notice first non-space */
-                               if (!isspace(tmp[q]))
+                               if (!iswspace(tmp[q]))
                                {
                                        /* Capitalize if possible */
-                                       if (islower(tmp[q])) tmp[q] = toupper(tmp[q]);
+                                       if (islower(tmp[q]))
+                                               tmp[q] = (char)toupper(tmp[q]);
 
-                                       /* Done */
                                        break;
                                }
                        }