Use wide char version's function directely (part3)

ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/12613#discussion_r1045153278
This commit is contained in:
Don Ho 2023-01-21 21:28:23 +01:00
parent 8add866460
commit 535bd8fa0e
15 changed files with 61 additions and 93 deletions

View File

@ -58,7 +58,7 @@ std::string getFileContent(const TCHAR *file2read)
const size_t blockSize = 1024;
char data[blockSize];
std::string wholeFileContent = "";
FILE *fp = generic_fopen(file2read, TEXT("rb"));
FILE *fp = _wfopen(file2read, TEXT("rb"));
size_t lenFile = 0;
do

View File

@ -43,11 +43,6 @@ const bool dirDown = false;
#define WCSTOK wcstok_s
#endif
#define generic_atoi _wtoi
#define generic_itoa _itow
#define generic_fprintf fwprintf
#define generic_sprintf swprintf
#define generic_fopen _wfopen
#define NPP_INTERNAL_FUCTION_STR L"Notepad++::InternalFunction"

View File

@ -666,7 +666,7 @@ void PluginsManager::runPluginCommand(size_t i)
{
constexpr size_t bufSize = 128;
TCHAR funcInfo[bufSize] = { '\0' };
generic_sprintf(funcInfo, bufSize, TEXT("runPluginCommand(size_t i : %zd)"), i);
swprintf(funcInfo, bufSize, TEXT("runPluginCommand(size_t i : %zd)"), i);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
}
}
@ -694,7 +694,7 @@ void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID)
{
constexpr size_t bufSize = 128;
TCHAR funcInfo[bufSize] = { '\0' };
generic_sprintf(funcInfo, bufSize, TEXT("runPluginCommand(const TCHAR *pluginName : %s, int commandID : %d)"), pluginName, commandID);
swprintf(funcInfo, bufSize, TEXT("runPluginCommand(const TCHAR *pluginName : %s, int commandID : %d)"), pluginName, commandID);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
}
}
@ -725,7 +725,7 @@ void PluginsManager::notify(size_t indexPluginInfo, const SCNotification *notifi
{
constexpr size_t bufSize = 256;
TCHAR funcInfo[bufSize] = { '\0' };
generic_sprintf(funcInfo, bufSize, TEXT("notify(SCNotification *notification) : \r notification->nmhdr.code == %d\r notification->nmhdr.hwndFrom == %p\r notification->nmhdr.idFrom == %" PRIuPTR), \
swprintf(funcInfo, bufSize, TEXT("notify(SCNotification *notification) : \r notification->nmhdr.code == %d\r notification->nmhdr.hwndFrom == %p\r notification->nmhdr.idFrom == %" PRIuPTR), \
scNotif.nmhdr.code, scNotif.nmhdr.hwndFrom, scNotif.nmhdr.idFrom);
pluginCrashAlert(_pluginInfos[indexPluginInfo]->_moduleName.c_str(), funcInfo);
}
@ -764,7 +764,7 @@ void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam
{
constexpr size_t bufSize = 128;
TCHAR funcInfo[bufSize] = { '\0' };
generic_sprintf(funcInfo, bufSize, TEXT("relayNppMessages(UINT Message : %u, WPARAM wParam : %" PRIuPTR ", LPARAM lParam : %" PRIiPTR ")"), Message, wParam, lParam);
swprintf(funcInfo, bufSize, TEXT("relayNppMessages(UINT Message : %u, WPARAM wParam : %" PRIuPTR ", LPARAM lParam : %" PRIiPTR ")"), Message, wParam, lParam);
pluginCrashAlert(_pluginInfos[i]->_moduleName.c_str(), funcInfo);
}
}
@ -796,7 +796,7 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa
{
constexpr size_t bufSize = 128;
TCHAR funcInfo[bufSize] = { '\0' };
generic_sprintf(funcInfo, bufSize, TEXT("relayPluginMessages(UINT Message : %u, WPARAM wParam : %" PRIuPTR ", LPARAM lParam : %" PRIiPTR ")"), Message, wParam, lParam);
swprintf(funcInfo, bufSize, TEXT("relayPluginMessages(UINT Message : %u, WPARAM wParam : %" PRIuPTR ", LPARAM lParam : %" PRIiPTR ")"), Message, wParam, lParam);
pluginCrashAlert(_pluginInfos[i]->_moduleName.c_str(), funcInfo);
}
return true;

View File

@ -1089,7 +1089,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
return -1;
// Get the beginning of file data
FILE *f = generic_fopen(fileName, TEXT("rb"));
FILE *f = _wfopen(fileName, TEXT("rb"));
if (!f)
return -1;
const int blockSize = 1024; // To ensure that length is long enough to capture the encoding in html
@ -4497,7 +4497,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
if (x)
{
TCHAR pX[10];
generic_itoa(x, pX, 10);
_itow(x, pX, 10);
command += TEXT(" -x");
command += pX;
}
@ -4505,7 +4505,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
if (y)
{
TCHAR pY[10];
generic_itoa(y, pY, 10);
_itow(y, pY, 10);
command += TEXT(" -y");
command += pY;
}

View File

@ -1391,10 +1391,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
int mainVer = 0, auxVer = 0;
if (mainVerStr[0])
mainVer = generic_atoi(mainVerStr);
mainVer = _wtoi(mainVerStr);
if (auxVerStr[0])
auxVer = generic_atoi(auxVerStr);
auxVer = _wtoi(auxVerStr);
return MAKELONG(auxVer, mainVer);
}

View File

@ -2345,7 +2345,7 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session& s
const TCHAR* intStrTabColour = (childNode->ToElement())->Attribute(TEXT("tabColourId"));
if (intStrTabColour)
{
sfi._individualTabColour = generic_atoi(intStrTabColour);
sfi._individualTabColour = _wtoi(intStrTabColour);
}
for (TiXmlNode *markNode = childNode->FirstChildElement(TEXT("Mark"));
@ -4852,7 +4852,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
const TCHAR* val = n->Value();
if (val)
{
int const i = generic_atoi (val);
int const i = _wtoi (val);
if ((i >= urlMin) && (i <= urlMax))
_nppGUI._styleURL = urlMode(i);
}
@ -6847,7 +6847,7 @@ void NppParameters::createXmlTreeFromGUIParams()
// <GUIConfig name="URL">2</GUIConfig>
{
TCHAR szStr [12] = TEXT("0");
generic_itoa(_nppGUI._styleURL, szStr, 10);
_itow(_nppGUI._styleURL, szStr, 10);
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("URL"));
GUIConfigElement->InsertEndChild(TiXmlText(szStr));
@ -7860,9 +7860,9 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
TCHAR temp[32];
generic_string udlVersion;
udlVersion += generic_itoa(SCE_UDL_VERSION_MAJOR, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_MAJOR, temp, 10);
udlVersion += TEXT(".");
udlVersion += generic_itoa(SCE_UDL_VERSION_MINOR, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_MINOR, temp, 10);
rootElement->SetAttribute(TEXT("name"), userLang->_name);
rootElement->SetAttribute(TEXT("ext"), userLang->_ext);
@ -8113,9 +8113,9 @@ Date::Date(const TCHAR *dateStr)
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
int y = generic_atoi(yyyy.c_str());
int m = generic_atoi(mm.c_str());
int d = generic_atoi(dd.c_str());
int y = _wtoi(yyyy.c_str());
int m = _wtoi(mm.c_str());
int d = _wtoi(dd.c_str());
if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31))
{

View File

@ -682,7 +682,7 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding
if (pPath)
{
FILE* fp = generic_fopen(pPath, TEXT("rb"));
FILE* fp = _wfopen(pPath, TEXT("rb"));
if (fp)
{
_fseeki64(fp, 0, SEEK_END);
@ -813,7 +813,7 @@ bool FileManager::reloadBuffer(BufferID id)
//Get file size
FILE* fp = generic_fopen(buf->getFullPathName(), TEXT("rb"));
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
if (!fp)
return false;
_fseeki64(fp, 0, SEEK_END);
@ -1271,7 +1271,7 @@ size_t FileManager::nextUntitledNewNumber() const
{
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
TCHAR *numberStr = buf->_fileName + newTitle.length();
int usedNumber = generic_atoi(numberStr);
int usedNumber = _wtoi(numberStr);
usedNumbers.push_back(usedNumber);
}
}
@ -1456,7 +1456,7 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data,
bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
{
FILE *fp = generic_fopen(filename, TEXT("rb"));
FILE *fp = _wfopen(filename, TEXT("rb"));
if (!fp)
return false;

View File

@ -3201,8 +3201,8 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
{
// use sprintf or swprintf instead of wsprintf
// to make octal format work
generic_sprintf(f, bufSize, TEXT("%%%s"), fStr);
generic_sprintf(str, strLen, f, number);
swprintf(f, bufSize, TEXT("%%%s"), fStr);
swprintf(str, strLen, f, number);
}
int i = lstrlen(str);
for ( ; i < nbChiffre ; ++i)
@ -3215,8 +3215,8 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
{
// use sprintf or swprintf instead of wsprintf
// to make octal format work
generic_sprintf(f, bufSize, TEXT("%%.%d%s"), nbChiffre, fStr);
generic_sprintf(str, strLen, f, number);
swprintf(f, bufSize, TEXT("%%.%d%s"), nbChiffre, fStr);
swprintf(str, strLen, f, number);
}
// else already done.
}

View File

@ -538,7 +538,7 @@ void CommentStyleDialog::setKeywords2List(int id)
TCHAR intBuffer[10] = { '0', 0 };
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
{
generic_itoa(i, intBuffer + 1, 10);
_itow(i, intBuffer + 1, 10);
::GetDlgItemText(_hSelf, list[i], buffer, max_char);
convertTo(newList, max_char, buffer, intBuffer);
}
@ -601,7 +601,7 @@ void CommentStyleDialog::updateDlg()
TCHAR intBuffer[10] = { '0', 0 };
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
{
generic_itoa(i, intBuffer + 1, 10);
_itow(i, intBuffer + 1, 10);
retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer);
::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, reinterpret_cast<LPARAM>(buffer));
}
@ -662,9 +662,9 @@ void SymbolsStyleDialog::updateDlg()
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
{
if (i < 10)
generic_itoa(i, intBuffer + 1, 10);
_itow(i, intBuffer + 1, 10);
else
generic_itoa(i, intBuffer, 10);
_itow(i, intBuffer, 10);
retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], intBuffer);
::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, reinterpret_cast<LPARAM>(buffer));
@ -856,9 +856,9 @@ void SymbolsStyleDialog::setKeywords2List(int id)
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
{
if (i < 10)
generic_itoa(i, intBuffer+1, 10);
_itow(i, intBuffer+1, 10);
else
generic_itoa(i, intBuffer, 10);
_itow(i, intBuffer, 10);
int dd = list[i];
::GetDlgItemText(_hSelf, dd, buffer, max_char);
@ -1060,13 +1060,13 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
TCHAR temp[32];
generic_string udlVersion = TEXT("User Defined Language v.");
udlVersion += generic_itoa(SCE_UDL_VERSION_MAJOR, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_MAJOR, temp, 10);
udlVersion += TEXT(".");
udlVersion += generic_itoa(SCE_UDL_VERSION_MINOR, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_MINOR, temp, 10);
udlVersion += TEXT(".");
udlVersion += generic_itoa(SCE_UDL_VERSION_BUILD, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_BUILD, temp, 10);
udlVersion += TEXT(".");
udlVersion += generic_itoa(SCE_UDL_VERSION_REVISION, temp, 10);
udlVersion += _itow(SCE_UDL_VERSION_REVISION, temp, 10);
::SetWindowText(_hSelf, udlVersion.c_str());

View File

@ -771,7 +771,7 @@ bool TiXmlDocumentA::LoadUnicodeFilePath( const TCHAR* filename )
// See STL_STRING_BUG above.
// Fixed with the StringToBuffer class.
FILE* file = generic_fopen(filename, TEXT("r"));
FILE* file = _wfopen(filename, TEXT("r"));
if ( file )
{
@ -829,7 +829,7 @@ bool TiXmlDocumentA::SaveFile( const char * filename ) const
bool TiXmlDocumentA::SaveUnicodeFilePath( const TCHAR* filename ) const
{
// The old c stuff lives on...
FILE* fp = generic_fopen( filename, TEXT("wc") );
FILE* fp = _wfopen( filename, TEXT("wc") );
if ( fp )
{
Print( fp, 0 );

View File

@ -481,7 +481,7 @@ const TCHAR * TiXmlElement::Attribute( const TCHAR * name, int* i ) const
if ( i )
{
if ( s )
*i = generic_atoi( s );
*i = _wtoi( s );
else
*i = 0;
}
@ -558,20 +558,16 @@ void TiXmlElement::Print( std::string& outputStream, int depth ) const
for ( i=0; i<depth; i++ )
{
outputStream += " ";
//generic_fprintf( cfile, TEXT(" ") );
}
std::string tagOpenValue = "<";
tagOpenValue += wstring2string(value, CP_UTF8);
outputStream += tagOpenValue;
//generic_fprintf( cfile, TEXT("<%ls"), value.c_str() );
TiXmlAttribute* attrib;
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
{
outputStream += " ";
//generic_fprintf(cfile, TEXT(" "));
attrib->Print(outputStream, depth );
}
@ -583,45 +579,36 @@ void TiXmlElement::Print( std::string& outputStream, int depth ) const
if ( !firstChild )
{
outputStream += " />";
//generic_fprintf( cfile, TEXT(" />") );
}
else if ( firstChild == lastChild && firstChild->ToText() )
{
outputStream += ">";
//generic_fprintf( cfile, TEXT(">") );
firstChild->Print(outputStream, depth + 1 );
std::string tagCloseWithValue = "</";
tagCloseWithValue += wstring2string(value, CP_UTF8) + ">";
outputStream += tagCloseWithValue;
//generic_fprintf( cfile, TEXT("</%ls>"), value.c_str() );
}
else
{
outputStream += ">";
//generic_fprintf( cfile, TEXT(">") );
for ( node = firstChild; node; node=node->NextSibling() )
{
if ( !node->ToText() )
{
outputStream += "\r\n";
//generic_fprintf( cfile, TEXT("\n") );
}
node->Print(outputStream, depth+1 );
}
outputStream += "\r\n";
//generic_fprintf( cfile, TEXT("\n") );
for( i=0; i<depth; ++i )
outputStream += " ";
// generic_fprintf( cfile, TEXT(" ") );
std::string tagCloseWithValue = "</";
tagCloseWithValue += wstring2string(value, CP_UTF8) + ">";
outputStream += tagCloseWithValue;
//generic_fprintf( cfile, TEXT("</%ls>"), value.c_str() );
}
}
@ -733,7 +720,7 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
// Fixed with the StringToBuffer class.
value = filename;
FILE* file = generic_fopen( value.c_str (), TEXT("r") );
FILE* file = _wfopen( value.c_str (), TEXT("r") );
if ( file )
{
@ -779,7 +766,7 @@ bool TiXmlDocument::SaveFile( const TCHAR * filename ) const
{
/*
// The old c stuff lives on...
FILE* fp = generic_fopen( filename, TEXT("wc") );
FILE* fp = _wfopen( filename, TEXT("wc") );
if ( fp )
{
Print( fp, 0 );
@ -832,7 +819,6 @@ void TiXmlDocument::Print( std::string& outputStream, int depth ) const
node->Print(outputStream, depth );
outputStream += "\r\n";
//generic_fprintf( cfile, TEXT("\n") );
}
}
@ -885,14 +871,12 @@ void TiXmlAttribute::Print( std::string& outputStream, int /*depth*/ ) const
attrVsValue += "=\"";
attrVsValue += wstring2string(v, CP_UTF8);
attrVsValue += "\"";
//generic_fprintf(cfile, TEXT("%ls=\"%ls\""), n.c_str(), v.c_str());
}
else
{
attrVsValue += "='";
attrVsValue += wstring2string(v, CP_UTF8);
attrVsValue += "'";
//generic_fprintf(cfile, TEXT("%ls='%ls'"), n.c_str(), v.c_str());
}
outputStream += attrVsValue;
}
@ -946,7 +930,7 @@ void TiXmlAttribute::SetDoubleValue( double _value )
const int TiXmlAttribute::IntValue() const
{
return generic_atoi (value.c_str ());
return _wtoi (value.c_str ());
}
const double TiXmlAttribute::DoubleValue() const
@ -959,14 +943,12 @@ void TiXmlComment::Print( std::string& outputStream, int depth ) const
for ( int i=0; i<depth; i++ )
{
outputStream += " ";
//generic_fprintf( cfile, TEXT(" ") );
}
std::string comment = "<!--";
comment += wstring2string(value, CP_UTF8);
comment += "-->";
outputStream += comment;
//generic_fprintf( cfile, TEXT("<!--%ls-->"), value.c_str() );
}
void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
@ -994,7 +976,6 @@ void TiXmlText::Print( std::string& outputStream, int /*depth*/ ) const
PutString( value, &buffer );
outputStream += wstring2string(buffer, CP_UTF8);
//generic_fprintf( cfile, TEXT("%ls"), buffer.c_str() );
}
@ -1030,14 +1011,12 @@ TiXmlDeclaration::TiXmlDeclaration( const TCHAR * _version,
void TiXmlDeclaration::Print( std::string& outputStream, int /*depth*/ ) const
{
std::string xmlDcl = "<?xml ";
//generic_fprintf (cfile, TEXT("<?xml "));
if (!version.empty())
{
xmlDcl += "version=\"";
xmlDcl += wstring2string(version, CP_UTF8);
xmlDcl += "\" ";
//generic_fprintf(cfile, TEXT("version=\"%ls\" "), version.c_str());
}
if (!encoding.empty())
@ -1045,19 +1024,15 @@ void TiXmlDeclaration::Print( std::string& outputStream, int /*depth*/ ) const
xmlDcl += "encoding=\"";
xmlDcl += wstring2string(encoding, CP_UTF8);
xmlDcl += "\" ";
//generic_fprintf(cfile, TEXT("encoding=\"%ls\" "), encoding.c_str());
}
if (!standalone.empty())
{
xmlDcl += "standalone=\"";
xmlDcl += wstring2string(standalone, CP_UTF8);
xmlDcl += "\" ";
//generic_fprintf(cfile, TEXT("standalone=\"%ls\" "), standalone.c_str());
}
xmlDcl += "?>";
//generic_fprintf (cfile, TEXT("?>"));
outputStream += xmlDcl;
}
@ -1105,10 +1080,8 @@ void TiXmlUnknown::Print( std::string& outputStream, int depth ) const
{
for ( int i=0; i<depth; i++ )
outputStream += " ";
//generic_fprintf( cfile, TEXT(" ") );
outputStream += wstring2string(value, CP_UTF8);
//generic_fprintf( cfile, TEXT("%ls"), value.c_str() );
}
void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const

View File

@ -241,7 +241,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
dataSize = sizeof(DWORD);
if (RegQueryValueExW(hKey, TEXT("UBR"), NULL, NULL, reinterpret_cast<LPBYTE>(&dwUBR), &dataSize) == ERROR_SUCCESS)
{
generic_sprintf(szUBR, bufSizeUBR, TEXT("%u"), dwUBR);
swprintf(szUBR, bufSizeUBR, TEXT("%u"), dwUBR);
}
RegCloseKey(hKey);
@ -250,19 +250,19 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// Get alternative OS information
if (szProductName[0] == '\0')
{
generic_sprintf(szProductName, bufSize, TEXT("%s"), (NppParameters::getInstance()).getWinVersionStr().c_str());
swprintf(szProductName, bufSize, TEXT("%s"), (NppParameters::getInstance()).getWinVersionStr().c_str());
}
// Override ProductName if it's Windows 11
if (NppDarkMode::isWindows11())
generic_sprintf(szProductName, bufSize, TEXT("%s"), TEXT("Windows 11"));
swprintf(szProductName, bufSize, TEXT("%s"), TEXT("Windows 11"));
if (szCurrentBuildNumber[0] == '\0')
{
DWORD dwVersion = GetVersion();
if (dwVersion < 0x80000000)
{
generic_sprintf(szCurrentBuildNumber, bufSizeBuildNumber, TEXT("%u"), HIWORD(dwVersion));
swprintf(szCurrentBuildNumber, bufSizeBuildNumber, TEXT("%u"), HIWORD(dwVersion));
}
}
@ -292,7 +292,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{
constexpr size_t bufSizeACP = 32;
TCHAR szACP[bufSizeACP] = { '\0' };
generic_sprintf(szACP, bufSizeACP, TEXT("%u"), ::GetACP());
swprintf(szACP, bufSizeACP, TEXT("%u"), ::GetACP());
_debugInfoStr += TEXT("Current ANSI codepage : ");
_debugInfoStr += szACP;
_debugInfoStr += TEXT("\r\n");
@ -310,7 +310,7 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{
constexpr size_t bufSizeWineVer = 32;
TCHAR szWINEVersion[bufSizeWineVer] = { '\0' };
generic_sprintf(szWINEVersion, bufSizeWineVer, TEXT("%hs"), pWGV());
swprintf(szWINEVersion, bufSizeWineVer, TEXT("%hs"), pWGV());
_debugInfoStr += TEXT("WINE : ");
_debugInfoStr += szWINEVersion;

View File

@ -394,26 +394,26 @@ void AsciiListView::setValues(int codepage)
TCHAR hex[bufSize];
TCHAR htmlNumber[bufSize];
generic_string htmlName;
generic_sprintf(dec, bufSize, TEXT("%d"), i);
generic_sprintf(hex, bufSize, TEXT("%02X"), i);
swprintf(dec, bufSize, TEXT("%d"), i);
swprintf(hex, bufSize, TEXT("%02X"), i);
generic_string s = getAscii(static_cast<unsigned char>(i));
if (codepage == 0 || codepage == 1252)
{
if ((i >= 32 && i <= 126) || (i >= 160 && i <= 255))
{
generic_sprintf(htmlNumber, bufSize, TEXT("&#%d"), i);
swprintf(htmlNumber, bufSize, TEXT("&#%d"), i);
}
else
{
int n = getHtmlNumber(static_cast<unsigned char>(i));
if (n > -1)
{
generic_sprintf(htmlNumber, bufSize, TEXT("&#%d"), n);
swprintf(htmlNumber, bufSize, TEXT("&#%d"), n);
}
else
{
generic_sprintf(htmlNumber, bufSize, TEXT(""));
swprintf(htmlNumber, bufSize, TEXT(""));
}
}
@ -421,7 +421,7 @@ void AsciiListView::setValues(int codepage)
}
else
{
generic_sprintf(htmlNumber, bufSize, TEXT(""));
swprintf(htmlNumber, bufSize, TEXT(""));
htmlName = TEXT("");
}

View File

@ -240,8 +240,8 @@ int CALLBACK FunctionListPanel::categorySortFunc(LPARAM lParam1, LPARAM lParam2,
generic_string* posString1 = reinterpret_cast<generic_string*>(lParam1);
generic_string* posString2 = reinterpret_cast<generic_string*>(lParam2);
size_t pos1 = generic_atoi(posString1->c_str());
size_t pos2 = generic_atoi(posString2->c_str());
size_t pos1 = _wtoi(posString1->c_str());
size_t pos2 = _wtoi(posString2->c_str());
if (pos1 > pos2)
return 1;
else
@ -486,7 +486,7 @@ void FunctionListPanel::findMarkEntry(HTREEITEM htItem, LONG line)
generic_string *posStr = reinterpret_cast<generic_string *>(tvItem.lParam);
if (posStr)
{
int pos = generic_atoi(posStr->c_str());
int pos = _wtoi(posStr->c_str());
if (pos != -1)
{
LONG sci_line = static_cast<LONG>((*_ppEditView)->execute(SCI_LINEFROMPOSITION, pos));
@ -570,7 +570,7 @@ bool FunctionListPanel::openSelection(const TreeView & treeView)
if (!posStr)
return false;
int pos = generic_atoi(posStr->c_str());
int pos = _wtoi(posStr->c_str());
if (pos == -1)
return false;

View File

@ -635,7 +635,7 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
{
WPARAM wParam;
buffer[0]=0x20;
BGHS[SI].ownerdrawitem = generic_atoi(buffer);
BGHS[SI].ownerdrawitem = _wtoi(buffer);
wParam=MAKEWPARAM(::GetMenu(hWnd),BGN_OWNERDRAW);
SendMessage(GetParent(hWnd), WM_COMMAND, wParam, reinterpret_cast<LPARAM>(&rect));
}
@ -1696,7 +1696,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, j - 1, reinterpret_cast<LPARAM>(buffer));
buffer[5]=0x00;
j=generic_atoi(buffer);
j=_wtoi(buffer);
if(j>SendMessage(hWnd,BGM_GETROWS,0,0))
{
SendMessage(hWnd,BGM_SETGRIDDIM,j,BGHS[SelfIndex].cols);