--- nono/util/mkcgrom/mkcgrom.cpp 2026/04/29 17:04:28 1.1.1.1 +++ nono/util/mkcgrom/mkcgrom.cpp 2026/04/29 17:04:52 1.1.1.2 @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -53,11 +54,11 @@ struct font_t { }; /* グローバル変数 */ -wxString fontdir; -wxFile cgrom; +static wxString fontdir; +static wxFile cgrom; /* ワーニングを表示 */ -void +static void warning(const char *fmt, ...) { va_list ap; @@ -522,22 +523,22 @@ BDF_1byte_unicode::GetAddr(int code) con * ここでは扱わない。 */ const wxChar BDF_1byte_unicode::table_uni[] = - "                " // +00 - "            →←↑↓" // +10 - " !”#$%&’()*+,−./" // +20 - "0123456789:;<=>?" // +30 - "@ABCDEFGHIJKLMNO" // +40 - "PQRSTUVWXYZ[¥]^_" // +50 - "`abcdefghijklmno" // +60 - "pqrstuvwxyz{|} ̄ " // +70 - "\     をぁぃぅぇぉゃゅょっ" // +80 - " あいうえおかきくけこさしすせそ" // +90 - " 。「」、・ヲァィゥェォャュョッ" // +a0 - "ーアイウエオカキクケコサシスセソ" // +b0 - "タチツテトナニヌネノハヒフヘホマ" // +c0 - "ミムメモヤユヨラリルレロワン゛゜" // +d0 - "たちつてとなにぬねのはひふへほま" // +e0 - "みむめもやゆよらりるれろわん  "; // +f0 + wxT("                ") // +00 + wxT("            →←↑↓") // +10 + wxT(" !”#$%&’()*+,−./") // +20 + wxT("0123456789:;<=>?") // +30 + wxT("@ABCDEFGHIJKLMNO") // +40 + wxT("PQRSTUVWXYZ[¥]^_") // +50 + wxT("`abcdefghijklmno") // +60 + wxT("pqrstuvwxyz{|} ̄ ") // +70 + wxT("\     をぁぃぅぇぉゃゅょっ") // +80 + wxT(" あいうえおかきくけこさしすせそ") // +90 + wxT(" 。「」、・ヲァィゥェォャュョッ") // +a0 + wxT("ーアイウエオカキクケコサシスセソ") // +b0 + wxT("タチツテトナニヌネノハヒフヘホマ") // +c0 + wxT("ミムメモヤユヨラリルレロワン゛゜") // +d0 + wxT("たちつてとなにぬねのはひふへほま") // +e0 + wxT("みむめもやゆよらりるれろわん  "); // +f0 /* @@ -642,7 +643,7 @@ F24Font::F24Font(const char *fname, int bool F24Font::Convert() { - char buf[pattern_len * 94]; /* 1区94文字分 */ + std::vector buf(pattern_len * 94); /* 1区94文字分 */ int len; int i; int n; @@ -653,44 +654,44 @@ F24Font::Convert() */ len = 2 * 24; for (i = 0; i < 256; i++) { - n = fread(buf, 1, len, fp); + n = fread(&buf[0], 1, len, fp); if (n < len) { printf("fread error: %d\n", n); throw 0; } if (IsRange(i)) { cgrom.Seek(0x3d000 + i * len); - cgrom.Write(buf, n); + cgrom.Write(&buf[0], n); } } /* ここから 24x24 全角 */ cgrom.Seek(offset); - len = sizeof(buf); + len = buf.size(); /* 全角非漢字が8区 */ for (i = 1; i < 9; i++) { - n = fread(buf, 1, len, fp); + n = fread(&buf[0], 1, len, fp); if (n < len) { printf("fread error: %d\n", n); throw 0; } - cgrom.Write(buf, n); + cgrom.Write(&buf[0], n); } /* 9区〜15区は JIS X 0208 にはないのでスキップ */ for (; i < 16; i++) { - fseek(fp, sizeof(buf), SEEK_CUR); + fseek(fp, buf.size(), SEEK_CUR); } /* 16区〜83区が第一、第二水準漢字 */ for (; i < 84; i++) { - n = fread(buf, 1, len, fp); + n = fread(&buf[0], 1, len, fp); if (n < len) { printf("fread error: %d\n", n); throw 0; } - cgrom.Write(buf, n); + cgrom.Write(&buf[0], n); } /* @@ -698,12 +699,12 @@ F24Font::Convert() * CGROM にはない。 */ len = pattern_len * 4; - n = fread(buf, 1, len, fp); + n = fread(&buf[0], 1, len, fp); if (n < len) { printf("fread error: %d\n", n); throw 0; } - cgrom.Write(buf, n); + cgrom.Write(&buf[0], n); return true; } @@ -724,7 +725,15 @@ class MyApp : public wxApp static const wxCmdLineEntryDesc desc[]; }; +// IMPLEMENT_APP() は闇マクロすぎて clang のちからには耐えられない +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Weverything" +#endif IMPLEMENT_APP(MyApp) +#if defined(__clang__) +#pragma clang diagnostic pop +#endif const wxCmdLineEntryDesc MyApp::desc[] = { { wxCMD_LINE_OPTION, "f", "f", "font dir (default: ./fonts)", },