From 57c95d6129ad661b350f1e8bb40b349a79c245a8 Mon Sep 17 00:00:00 2001 From: nathancorvussolis Date: Fri, 1 Jan 2021 19:38:36 +0900 Subject: [PATCH] VS2019 --- README.TXT | 8 +- crvskkserv.sln | 7 +- crvskkserv/app.ico | Bin 1150 -> 1406 bytes crvskkserv/crvskkserv.cpp | 11 +- crvskkserv/crvskkserv.h | 14 +-- crvskkserv/crvskkserv.manifest | 38 +++++++ crvskkserv/crvskkserv.vcxproj | 14 ++- crvskkserv/crvskkserv.vcxproj.filters | 5 + crvskkserv/eucjis2004.cpp | 150 +++++++++++++------------- crvskkserv/eucjis2004.h | 6 +- crvskkserv/eucjis2004table.h | 6 +- crvskkserv/resource.h | 6 +- crvskkserv/search_dictionary.cpp | 2 +- crvskkserv/stdafx.cpp | 5 +- crvskkserv/stdafx.h | 3 +- crvskkserv/utf8.cpp | 12 +-- crvskkserv/utf8.h | 6 +- 17 files changed, 165 insertions(+), 128 deletions(-) create mode 100644 crvskkserv/crvskkserv.manifest diff --git a/README.TXT b/README.TXT index dbedb8d..b30eb88 100644 --- a/README.TXT +++ b/README.TXT @@ -1,7 +1,7 @@  ------------------------------------------------------------------------------- - crvskkserv 2.2.0 + crvskkserv 2.4.0 ------------------------------------------------------------------------------- @@ -26,8 +26,8 @@ SKK辞書サーバ通信は、IPv4、IPv6に対応しています。 Google CGI APIの「見出し語の検索除外条件」設定は、おそらく送りあり(と思われる) 見出し語を除外する正規表現がデフォルトとなっています。 -Visual C++ 2015 の正規表現で、文法はECMAScriptを使用しています。 -https://msdn.microsoft.com/en-us/library/bb982727(v=vs.140).aspx +Visual C++ 2019 の正規表現で、文法はECMAScriptを使用しています。 +https://docs.microsoft.com/en-us/cpp/standard-library/regular-expressions-cpp?view=msvc-160 Google CGI APIの設定でクライアントの文字コードをEUC-JIS-2004にしたとき、 UTF-8からEUC-JIS-2004に変換できない文字を含む候補は除外されます。 @@ -72,7 +72,7 @@ crvskkserv The MIT License -Copyright (C) 2012-2016 SASAKI Nobuyuki +Copyright (C) 2012-2021 SASAKI Nobuyuki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/crvskkserv.sln b/crvskkserv.sln index 529b085..517f841 100644 --- a/crvskkserv.sln +++ b/crvskkserv.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crvskkserv", "crvskkserv\crvskkserv.vcxproj", "{EE56E58B-C54E-425C-A0AF-292B4653B1F0}" EndProject @@ -19,4 +19,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {77834FB2-D0C0-411E-88B9-0EF4B38BE404} + EndGlobalSection EndGlobal diff --git a/crvskkserv/app.ico b/crvskkserv/app.ico index 5bb9cb59b7c8f691ddc67d97b06212fd4aa02b4b..1e09bfb5b0a783a2b570102ac709fabd4f8e914b 100644 GIT binary patch literal 1406 zcmeHH!4ZQn3{&8G@Z`mpK05~EFb1PBO2_CgNOnV$+;swCuw%(GN&El^e5MJEBen-H z19;I%;Yk-STZ1h{*ok6{1=m2EK%2llCeX?Js+L|zoH6+vimEFRGQ;;%Sr4oF1M&5h zC8dcWQcCxrf-77k`lk-{2I=f-l2r$+E@1GI82T*0djO6e*txg-pQXCA>QV0r$s!Ei literal 1150 zcmbu5K@NgY3`B=W;+B0MHQE-phmT17I%3t2fQ?Y7KrRy=@(bM&2+Cj~~K@a_`N7LV}U1a%QF=+1J6_ZhhfP|N2WQo^w9eSpX{j0 diff --git a/crvskkserv/crvskkserv.cpp b/crvskkserv/crvskkserv.cpp index 58a2260..57c7478 100644 --- a/crvskkserv/crvskkserv.cpp +++ b/crvskkserv/crvskkserv.cpp @@ -50,7 +50,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdL WSADATA wsaData; INITCOMMONCONTROLSEX icex; - _wsetlocale(LC_ALL, L"JPN"); + _wsetlocale(LC_ALL, L"ja-JP"); icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_LISTVIEW_CLASSES; @@ -78,7 +78,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdL RegisterClassExW(&wcex); - hWnd = CreateWindowW(title, title, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, nullptr, nullptr, hInstance, nullptr); + hWnd = CreateWindowW(title, title, WS_OVERLAPPEDWINDOW, 0, 0, 320, 200, nullptr, nullptr, hInstance, nullptr); if(!hWnd) { @@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcSKKServ(HWND hDlg, UINT message, WPARAM wParam, LPARAM l static HWND hPDlg; HWND hWndListView; LVITEMW item; - int index, count; + int index, count; WCHAR path[MAX_PATH]; WCHAR host[256]; WCHAR port[6]; @@ -448,6 +448,11 @@ INT_PTR CALLBACK DlgProcConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP } return (INT_PTR)TRUE; + case WM_DPICHANGED: + hWndListView = GetDlgItem(hDlg, IDC_LIST_SKK_DIC); + ListView_SetColumnWidth(hWndListView, 0, LVSCW_AUTOSIZE); + return (INT_PTR)TRUE; + case WM_COMMAND: hWndListView = GetDlgItem(hDlg, IDC_LIST_SKK_DIC); diff --git a/crvskkserv/crvskkserv.h b/crvskkserv/crvskkserv.h index b0abb58..52eec43 100644 --- a/crvskkserv/crvskkserv.h +++ b/crvskkserv/crvskkserv.h @@ -1,15 +1,13 @@ - -#ifndef CRVSKKSERV_H -#define CRVSKKSERV_H +#pragma once #define RC_PRODUCT "crvskkserv" -#define RC_VERSION "2.2.0" -#define RC_VERSION_D 2,2,0,0 -#define RC_TITLE "crvskkserv (ver. 2.2.0)" +#define RC_VERSION "2.4.0" +#define RC_VERSION_D 2,4,0,0 +#define RC_TITLE "crvskkserv (ver. 2.4.0)" #define RC_AUTHOR "nathancorvussolis" #define APP_TITLE L"crvskkserv" -#define APP_VERSION L"2.2.0" +#define APP_VERSION L"2.4.0" #define RES_VER RC_PRODUCT "/" RC_VERSION " " #define REQ_END '0' @@ -82,5 +80,3 @@ BOOL get_skkserv_version(SOCKET &sock); // search_google_cgiapi void search_google_cgiapi(DICINFO &dicinfo, const std::string &key, std::string &s); - -#endif diff --git a/crvskkserv/crvskkserv.manifest b/crvskkserv/crvskkserv.manifest new file mode 100644 index 0000000..e9448b1 --- /dev/null +++ b/crvskkserv/crvskkserv.manifest @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + True + PerMonitorV2 + + + + diff --git a/crvskkserv/crvskkserv.vcxproj b/crvskkserv/crvskkserv.vcxproj index d362e90..4057a76 100644 --- a/crvskkserv/crvskkserv.vcxproj +++ b/crvskkserv/crvskkserv.vcxproj @@ -14,18 +14,19 @@ {EE56E58B-C54E-425C-A0AF-292B4653B1F0} Win32Proj crvskkserv + 10.0 Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode @@ -59,6 +60,9 @@ true ws2_32.lib;wininet.lib;comctl32.lib;%(AdditionalDependencies) + + crvskkserv.manifest %(AdditionalManifestFiles) + @@ -80,6 +84,9 @@ No UseLinkTimeCodeGeneration + + crvskkserv.manifest %(AdditionalManifestFiles) + @@ -112,6 +119,9 @@ + + + diff --git a/crvskkserv/crvskkserv.vcxproj.filters b/crvskkserv/crvskkserv.vcxproj.filters index 18221b3..190c12a 100644 --- a/crvskkserv/crvskkserv.vcxproj.filters +++ b/crvskkserv/crvskkserv.vcxproj.filters @@ -76,4 +76,9 @@ + + + Resource Files + + \ No newline at end of file diff --git a/crvskkserv/eucjis2004.cpp b/crvskkserv/eucjis2004.cpp index a167373..d9bf5ed 100644 --- a/crvskkserv/eucjis2004.cpp +++ b/crvskkserv/eucjis2004.cpp @@ -30,7 +30,7 @@ size_t UcpToWideChar(UCSCHAR ucp, PWCHAR first, PWCHAR second) { size_t ret = 0; - if(first == nullptr || second == nullptr) + if (first == nullptr || second == nullptr) { return 0; } @@ -38,13 +38,13 @@ size_t UcpToWideChar(UCSCHAR ucp, PWCHAR first, PWCHAR second) *first = L'\0'; *second = L'\0'; - if(ucp < SURROGATEPAIR_UCPMIN) + if (ucp < SURROGATEPAIR_UCPMIN) { *first = (WCHAR)ucp; *second = L'\0'; ret = 1; } - else if(ucp <= SURROGATEPAIR_UCPMAX) //surrogate pair + else if (ucp <= SURROGATEPAIR_UCPMAX) //surrogate pair { *first = (WCHAR)(SURROGATEPAIR_HIGH_MASK | ((ucp - SURROGATEPAIR_UCPMIN) >> SURROGATEPAIR_SEPBIT)); *second = (WCHAR)(SURROGATEPAIR_LOW_MASK | ((ucp - SURROGATEPAIR_UCPMIN) & SURROGATEPAIR_SEPMASK)); @@ -68,7 +68,7 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) CHAR ej[2]; size_t srcused = 0; - if(src == nullptr || srcsize == 0 || ucp1 == nullptr || ucp2 == nullptr) + if (src == nullptr || srcsize == 0 || ucp1 == nullptr || ucp2 == nullptr) { return 0; } @@ -76,7 +76,7 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) *ucp1 = 0; *ucp2 = 0; - if(as <= src[0] && src[0] <= ae) //ASCII + if (as <= src[0] && src[0] <= ae) //ASCII { *ucp1 = src[0]; *ucp2 = 0; @@ -84,10 +84,10 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) } else { - switch(src[0]) + switch (src[0]) { case ss3: // JIS X 0213 Plane 2 - if(srcsize < 3) + if (srcsize < 3) { break; } @@ -95,20 +95,20 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) ej[0] = 0; ej[1] = 0; - if((UCHAR)src[1] >= (UCHAR)ejd) + if ((UCHAR)src[1] >= (UCHAR)ejd) { ej[0] = (CHAR)((UCHAR)src[1] - (UCHAR)ejd); } - if((UCHAR)src[2] >= (UCHAR)ejd) + if ((UCHAR)src[2] >= (UCHAR)ejd) { ej[1] = (CHAR)((UCHAR)src[2] - (UCHAR)ejd); } - if((ej[0] >= ejs && ej[0] <= eje) && (ej[1] >= ejs && ej[1] <= eje)) + if ((ej[0] >= ejs && ej[0] <= eje) && (ej[1] >= ejs && ej[1] <= eje)) { *ucp1 = 0; - if(euc2i[ej[0] - ejs] != 0 && euc2i[ej[0] - ejs] <= ROW2NUM) + if (euc2i[ej[0] - ejs] != 0 && euc2i[ej[0] - ejs] <= ROW2NUM) { *ucp1 = euc2[euc2i[ej[0] - ejs] - 1][ej[1] - ejs]; } @@ -118,19 +118,19 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) break; case ss2: //JIS X 0201 halfwidth katakana - if(srcsize < 2) + if (srcsize < 2) { break; } ej[0] = 0; - if((UCHAR)src[1] >= (UCHAR)ejd) + if ((UCHAR)src[1] >= (UCHAR)ejd) { ej[0] = (CHAR)((UCHAR)src[1] - (UCHAR)ejd); } - if(ej[0] >= ejs && ej[0] <= eje) + if (ej[0] >= ejs && ej[0] <= eje) { *ucp1 = eucK[ej[0] - ejs]; *ucp2 = 0; @@ -139,7 +139,7 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) break; default: // JIS X 0213 Plane 1 - if(srcsize < 2) + if (srcsize < 2) { break; } @@ -147,24 +147,24 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) ej[0] = 0; ej[1] = 0; - if((UCHAR)src[0] >= (UCHAR)ejd) + if ((UCHAR)src[0] >= (UCHAR)ejd) { ej[0] = (CHAR)((UCHAR)src[0] - (UCHAR)ejd); } - if((UCHAR)src[1] >= (UCHAR)ejd) + if ((UCHAR)src[1] >= (UCHAR)ejd) { ej[1] = (CHAR)((UCHAR)src[1] - (UCHAR)ejd); } - if((ej[0] >= ejs && ej[0] <= eje) && (ej[1] >= ejs && ej[1] <= eje)) + if ((ej[0] >= ejs && ej[0] <= eje) && (ej[1] >= ejs && ej[1] <= eje)) { USHORT euc = ((USHORT)ej[0] << 8) | (USHORT)ej[1] | 0x8080; //結合文字 - for(int i = 0; i < CMBCHARNUM; i++) + for (int i = 0; i < CMBCHARNUM; i++) { - if(euccmb[i].euc == euc) + if (euccmb[i].euc == euc) { *ucp1 = euccmb[i].ucp[0]; *ucp2 = euccmb[i].ucp[1]; @@ -173,7 +173,7 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) } } - if(srcused != 0) + if (srcused != 0) { break; } @@ -193,12 +193,12 @@ size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2) void AddNullWideChar(size_t *srcsize, size_t si, LPWSTR dst, size_t *dstsize, size_t di) { - if(srcsize != nullptr) + if (srcsize != nullptr) { *srcsize = si; } *dstsize = di + 1; - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = L'\0'; } @@ -213,37 +213,37 @@ BOOL EucJis2004ToWideChar(LPCSTR src, size_t *srcsize, LPWSTR dst, size_t *dstsi WCHAR utf16[2][2]; size_t utf16num[2]; - if(dstsize == nullptr) + if (dstsize == nullptr) { return FALSE; } - if(dst == nullptr) + if (dst == nullptr) { *dstsize = (size_t)-1; } - if(src == nullptr) + if (src == nullptr) { *dstsize = 0; return FALSE; } - if(srcsize != nullptr) + if (srcsize != nullptr) { ss = *srcsize; } - for(si = 0; ; si++) + for (si = 0; ; si++) { - if((ss <= si) || (*(src + si) == '\0')) + if ((ss <= si) || (*(src + si) == '\0')) { break; } // EUC-JIS-2004からUnicode Code Pointへ変換 size_t used = EucJis2004ToUcp(src + si, ss - si, &ucp[0], &ucp[1]); - if((ucp[0] == 0) || (used == 0)) + if ((ucp[0] == 0) || (used == 0)) { AddNullWideChar(srcsize, si, dst, dstsize, di); return FALSE; @@ -251,26 +251,26 @@ BOOL EucJis2004ToWideChar(LPCSTR src, size_t *srcsize, LPWSTR dst, size_t *dstsi si += used - 1; // Unicode Code PointからUTF-16へ変換 - for(int i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { utf16num[i] = 0; - if(ucp[i] != 0) + if (ucp[i] != 0) { utf16num[i] = UcpToWideChar(ucp[i], &utf16[i][0], &utf16[i][1]); } } - if(*dstsize <= di + utf16num[0] + utf16num[1]) //limit + if (*dstsize <= di + utf16num[0] + utf16num[1]) //limit { AddNullWideChar(srcsize, si, dst, dstsize, di); return FALSE; } - for(int i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { - if(dst != nullptr) + if (dst != nullptr) { - for(int j = 0; j < (int)utf16num[i] && j < 2; j++) + for (int j = 0; j < (int)utf16num[i] && j < 2; j++) { *(dst + di + j) = utf16[i][j]; } @@ -287,12 +287,12 @@ BOOL EucJis2004ToWideChar(LPCSTR src, size_t *srcsize, LPWSTR dst, size_t *dstsi void AddNullEucJis2004(size_t *srcsize, size_t si, LPSTR dst, size_t *dstsize, size_t di) { - if(srcsize != nullptr) + if (srcsize != nullptr) { *srcsize = si; } *dstsize = di + 1; - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = '\0'; } @@ -311,42 +311,42 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi UCSCHAR ucp; BOOL exist; - if(dstsize == nullptr) + if (dstsize == nullptr) { return FALSE; } - if(dst == nullptr) + if (dst == nullptr) { *dstsize = (size_t)-1; } - if(src == nullptr) + if (src == nullptr) { *dstsize = 0; return FALSE; } - if(srcsize != nullptr) + if (srcsize != nullptr) { ss = *srcsize; } - for(si = 0; ; si++) + for (si = 0; ; si++) { - if((ss <= si) || (*(src + si) == L'\0')) + if ((ss <= si) || (*(src + si) == L'\0')) { break; } - if(*(src + si) <= L'\x7F') //ASCII + if (*(src + si) <= L'\x7F') //ASCII { - if(*dstsize <= di + 1) //limit + if (*dstsize <= di + 1) //limit { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; } - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = (CHAR)*(src + si); } @@ -357,7 +357,7 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi exist = FALSE; first = *(src + si); - if(si + 1 < ss) + if (si + 1 < ss) { second = *(src + si + 1); } @@ -366,7 +366,7 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi second = 0; } - if((first >= SURROGATEPAIR_HIGH_MASK && first <= (SURROGATEPAIR_HIGH_MASK | SURROGATEPAIR_SEPMASK)) && + if ((first >= SURROGATEPAIR_HIGH_MASK && first <= (SURROGATEPAIR_HIGH_MASK | SURROGATEPAIR_SEPMASK)) && (second >= SURROGATEPAIR_LOW_MASK && second <= (SURROGATEPAIR_LOW_MASK | SURROGATEPAIR_SEPMASK))) { ucp = SURROGATEPAIR_UCPMIN + @@ -379,16 +379,16 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi } //結合文字 - for(int i = 0; i < CMBCHARNUM; i++) + for (int i = 0; i < CMBCHARNUM; i++) { - if(first == euccmb[i].ucp[0] && second == euccmb[i].ucp[1]) + if (first == euccmb[i].ucp[0] && second == euccmb[i].ucp[1]) { - if(*dstsize <= di + 2) //limit + if (*dstsize <= di + 2) //limit { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; } - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = euccmb[i].euc >> 8; *(dst + di + 1) = euccmb[i].euc & 0xFF; @@ -400,48 +400,48 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi } } - if(!exist) + if (!exist) { - for(int i = 0; i < ROWNUM; i++) + for (int i = 0; i < ROWNUM; i++) { - for(int j = 0; j < CELLNUM; j++) + for (int j = 0; j < CELLNUM; j++) { - if(ucp == euc1[i][j]) // JIS X 0213 Plane 1 + if (ucp == euc1[i][j]) // JIS X 0213 Plane 1 { - if(*dstsize <= di + 2) //limit + if (*dstsize <= di + 2) //limit { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; } - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = (CHAR)((UCHAR)(ejs + i) + (UCHAR)ejd); *(dst + di + 1) = (CHAR)((UCHAR)(ejs + j) + (UCHAR)ejd); } di += 2; - if(ucp != first) //surrogate pair + if (ucp != first) //surrogate pair { si++; } exist = TRUE; break; } - else if(euc2i[i] != 0 && euc2i[i] <= ROW2NUM && + else if (euc2i[i] != 0 && euc2i[i] <= ROW2NUM && ucp == euc2[euc2i[i] - 1][j]) // JIS X 0213 Plane 2 { - if(*dstsize <= di + 3) //limit + if (*dstsize <= di + 3) //limit { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; } - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = ss3; *(dst + di + 1) = (CHAR)((UCHAR)(ejs + i) + (UCHAR)ejd); *(dst + di + 2) = (CHAR)((UCHAR)(ejs + j) + (UCHAR)ejd); } di += 3; - if(ucp != first) //surrogate pair + if (ucp != first) //surrogate pair { si++; } @@ -450,25 +450,25 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi } } - if(exist) + if (exist) { break; } } } - if(!exist) + if (!exist) { - for(int i = 0; i < ANKNUM; i++) + for (int i = 0; i < ANKNUM; i++) { - if(ucp == eucK[i]) //JIS X 0201 halfwidth katakana + if (ucp == eucK[i]) //JIS X 0201 halfwidth katakana { - if(*dstsize <= di + 2) //limit + if (*dstsize <= di + 2) //limit { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; } - if(dst != nullptr) + if (dst != nullptr) { *(dst + di) = ss2; *(dst + di + 1) = (CHAR)((UCHAR)(ejs + i) + (UCHAR)ejd); @@ -480,7 +480,7 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi } } - if(!exist) + if (!exist) { AddNullEucJis2004(srcsize, si, dst, dstsize, di); return FALSE; @@ -498,7 +498,7 @@ std::string wstring_to_eucjis2004_string(const std::wstring &s) size_t len; BOOL b = WideCharToEucJis2004(s.c_str(), nullptr, nullptr, &len); - if(b && len > 0) + if (b && len > 0) { try { @@ -507,7 +507,7 @@ std::string wstring_to_eucjis2004_string(const std::wstring &s) ret = euc; delete[] euc; } - catch(...) + catch (...) { } } @@ -521,7 +521,7 @@ std::wstring eucjis2004_string_to_wstring(const std::string &s) size_t len; BOOL b = EucJis2004ToWideChar(s.c_str(), nullptr, nullptr, &len); - if(b && len > 0) + if (b && len > 0) { try { @@ -530,7 +530,7 @@ std::wstring eucjis2004_string_to_wstring(const std::string &s) ret = wcs; delete[] wcs; } - catch(...) + catch (...) { } } diff --git a/crvskkserv/eucjis2004.h b/crvskkserv/eucjis2004.h index d67331d..3b6fa04 100644 --- a/crvskkserv/eucjis2004.h +++ b/crvskkserv/eucjis2004.h @@ -1,6 +1,4 @@ - -#ifndef EUCJIS2004_H -#define EUCJIS2004_H +#pragma once // Unicode Code PointをUTF-16へ変換 // 戻り値 @@ -63,5 +61,3 @@ std::wstring eucjis2004_string_to_wstring(const std::string &s); #define WCTOEUC(w) wstring_to_eucjis2004_string(w).c_str() #define EUCTOWC(u) eucjis2004_string_to_wstring(u).c_str() - -#endif //EUCJIS2004_H diff --git a/crvskkserv/eucjis2004table.h b/crvskkserv/eucjis2004table.h index bbd5c2a..1a21631 100644 --- a/crvskkserv/eucjis2004table.h +++ b/crvskkserv/eucjis2004table.h @@ -1,6 +1,4 @@ - -#ifndef EUCJIS2004TABLE_H -#define EUCJIS2004TABLE_H +#pragma once #define CMBCHARNUM 25 #define ANKNUM 94 @@ -19,5 +17,3 @@ extern const UCSCHAR euc1[ROWNUM][CELLNUM]; //JIS X 0213 第一面 extern const UCSCHAR eucK[ANKNUM]; //JIS X 0201 extern const BYTE euc2i[ROWNUM]; //JIS X 0213 第二面インデックス extern const UCSCHAR euc2[ROW2NUM][CELLNUM]; //JIS X 0213 第二面 - -#endif //EUCJIS2004TABLE_H diff --git a/crvskkserv/resource.h b/crvskkserv/resource.h index d9ff149..49b6061 100644 --- a/crvskkserv/resource.h +++ b/crvskkserv/resource.h @@ -1,6 +1,4 @@ - -#ifndef RESOURCE_H -#define RESOURCE_H +#pragma once #ifndef IDC_STATIC #define IDC_STATIC (-1) @@ -34,5 +32,3 @@ #define IDC_EDIT_GOOGLECGIAPI_TIMEOUT 313 #define IDC_RADIO_GOOGLECGIAPI_EUC 314 #define IDC_RADIO_GOOGLECGIAPI_UTF8 315 - -#endif diff --git a/crvskkserv/search_dictionary.cpp b/crvskkserv/search_dictionary.cpp index 624a89f..481136d 100644 --- a/crvskkserv/search_dictionary.cpp +++ b/crvskkserv/search_dictionary.cpp @@ -10,7 +10,7 @@ void init_search_dictionary(DICINFO &dicinfo) std::string sbuf; FILE *fpdic; long pos; - int okuri = -1; + int okuri = 0; // default okuri-nasi MAP map; size_t pidx; #if USEIDXFILE diff --git a/crvskkserv/stdafx.cpp b/crvskkserv/stdafx.cpp index 290c67a..5f28270 100644 --- a/crvskkserv/stdafx.cpp +++ b/crvskkserv/stdafx.cpp @@ -1,4 +1 @@ - -#pragma comment(linker,"\"/manifestdependency:type='win32' \ -name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ -processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") + \ No newline at end of file diff --git a/crvskkserv/stdafx.h b/crvskkserv/stdafx.h index 6c64e07..f7eb6e0 100644 --- a/crvskkserv/stdafx.h +++ b/crvskkserv/stdafx.h @@ -1,5 +1,4 @@ - -#pragma once +#pragma once #define WIN32_LEAN_AND_MEAN diff --git a/crvskkserv/utf8.cpp b/crvskkserv/utf8.cpp index c64a839..e3708b6 100644 --- a/crvskkserv/utf8.cpp +++ b/crvskkserv/utf8.cpp @@ -4,18 +4,18 @@ std::string wstring_to_utf8_string(const std::wstring &s) std::string ret; int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, s.c_str(), -1, nullptr, 0, nullptr, nullptr); - if(len > 0) + if (len > 0) { try { LPSTR utf8 = new CHAR[len]; - if(WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, utf8, len, nullptr, nullptr) > 0) + if (WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, utf8, len, nullptr, nullptr) > 0) { ret = utf8; } delete[] utf8; } - catch(...) + catch (...) { } } @@ -28,18 +28,18 @@ std::wstring utf8_string_to_wstring(const std::string &s) std::wstring ret; int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, nullptr, 0); - if(len > 0) + if (len > 0) { try { LPWSTR wcs = new WCHAR[len]; - if(MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wcs, len) > 0) + if (MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wcs, len) > 0) { ret = wcs; } delete[] wcs; } - catch(...) + catch (...) { } } diff --git a/crvskkserv/utf8.h b/crvskkserv/utf8.h index f7054cd..70311a2 100644 --- a/crvskkserv/utf8.h +++ b/crvskkserv/utf8.h @@ -1,11 +1,7 @@ - -#ifndef UTF8_H -#define UTF8_H +#pragma once std::string wstring_to_utf8_string(const std::wstring &s); std::wstring utf8_string_to_wstring(const std::string &s); #define WCTOU8(w) wstring_to_utf8_string(w).c_str() #define U8TOWC(u) utf8_string_to_wstring(u).c_str() - -#endif