Skip to content

Commit

Permalink
fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Apr 26, 2024
1 parent c49298f commit 9bf9d53
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions sherpa-onnx/csrc/sherpa-onnx-microphone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,29 @@ static void Handler(int32_t sig) {
fprintf(stderr, "\nCaught Ctrl + C. Exiting...\n");
}

static std::string tolowerUnicode(const std::string& input_str) {

// Use system locale
std::setlocale(LC_ALL, "");

// From char string to wchar string
std::wstring input_wstr(input_str.size()+1, '\0');
std::mbstowcs(&input_wstr[0], input_str.c_str(), input_str.size());
std::wstring lowercase_wstr;

for (wchar_t wc : input_wstr) {
if (std::iswupper(wc)) {
lowercase_wstr += std::towlower(wc);
} else {
lowercase_wstr += wc;
}
static std::string tolowerUnicode(const std::string &input_str) {
// Use system locale
std::setlocale(LC_ALL, "");

// From char string to wchar string
std::wstring input_wstr(input_str.size() + 1, '\0');
std::mbstowcs(&input_wstr[0], input_str.c_str(), input_str.size());
std::wstring lowercase_wstr;

for (wchar_t wc : input_wstr) {
if (std::iswupper(wc)) {
lowercase_wstr += std::towlower(wc);
} else {
lowercase_wstr += wc;
}

// Back to char string
std::string lowercase_str(input_str.size()+1, '\0');
std:wcstombs(&lowercase_str[0], lowercase_wstr.c_str(), lowercase_wstr.size());
}

// Back to char string
std::string lowercase_str(input_str.size() + 1, '\0');
std::wcstombs(&lowercase_str[0], lowercase_wstr.c_str(),
lowercase_wstr.size());

return lowercase_str;
return lowercase_str;
}

int32_t main(int32_t argc, char *argv[]) {
Expand Down

0 comments on commit 9bf9d53

Please sign in to comment.