Skip to content

Commit

Permalink
Fix missing sizeof(WCHAR)
Browse files Browse the repository at this point in the history
Fix missing const
  • Loading branch information
kingseva committed Feb 14, 2018
1 parent a57fae0 commit c5850a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions include/rang.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,14 @@ namespace rang_implementation {

// Check pipe name is template of
// {"cygwin-","msys-"}XXXXXXXXXXXXXXX-ptyX-XX
if (ptrGetFileInformationByHandleEx(h, FileNameInfo, pNameInfo.get(),
sizeof(MY_FILE_NAME_INFO))) {
std::wstring name(pNameInfo->FileName, pNameInfo->FileNameLength);
if ((name.find(L"msys-") == std::wstring::npos
&& name.find(L"cygwin-") == std::wstring::npos)
|| name.find(L"-pty") == std::wstring::npos) {
return false;
}
} else {
if (!ptrGetFileInformationByHandleEx(h, FileNameInfo, pNameInfo.get(),
sizeof(MY_FILE_NAME_INFO))) {
return false;
}
std::wstring name(pNameInfo->FileName, pNameInfo->FileNameLength / sizeof(WCHAR));
if ((name.find(L"msys-") == std::wstring::npos
&& name.find(L"cygwin-") == std::wstring::npos)
|| name.find(L"-pty") == std::wstring::npos) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion test/colorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using namespace std;
using namespace rang;

void printHeading(string &heading)
void printHeading(const string &heading)
{
cout << '\n'
<< style::reset << heading << style::reset << bg::reset << fg::reset
Expand Down

0 comments on commit c5850a0

Please sign in to comment.