hfst / hfst-ospell

HFST spell checker library and command line tool
Apache License 2.0
13 stars 9 forks source link

Strange character in main.cc #49

Closed marxin closed 4 years ago

marxin commented 4 years ago

Using GCC 10, I noticed a strange usage of '§' character: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94168

The hunk was added in 04e4843e4c66beb61b756f3ceb2ac94628142185. Was it really intentional:

diff --git a/main.cc b/main.cc
index d14da8b..438d4e2 100644
--- a/main.cc
+++ b/main.cc
@@ -61,7 +61,7 @@ static bool suggest_reals = false;
 #ifdef WINDOWS
 static std::string wide_string_to_string(const std::wstring & wstr)
 {
-  int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
+  int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)§wstr.size(), NULL, 0, NULL, NULL);
   std::string str( size_needed, 0 );
   WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], size_needed, NULL, NULL);
   return str;
marxin commented 4 years ago

@eaxelson

marxin commented 4 years ago

Seems to me that it was accidental. Look at the previous commit cf8ee5cd31c0cb0ae31abaa151c66aed8ff51e77. I'll send a pull request.