fix: fix bug caused by refactor

This commit is contained in:
yyc12345 2024-06-28 16:30:21 +08:00
parent e5b6e8c6c3
commit 23b4da95ce
3 changed files with 5 additions and 5 deletions

View File

@ -149,7 +149,7 @@ namespace YYCC::ConsoleHelper {
// anything else, use WriteFile instead. // anything else, use WriteFile instead.
// WriteFile do not need extra convertion, because it is direct writing. // WriteFile do not need extra convertion, because it is direct writing.
// check whether string length is overflow // check whether string length is overflow
size_t strl_size = strl.size() * sizeof(std::string::value_type); size_t strl_size = strl.size() * sizeof(yycc_u8string::value_type);
// write string with size check // write string with size check
if (strl_size <= std::numeric_limits<DWORD>::max()) { if (strl_size <= std::numeric_limits<DWORD>::max()) {
WriteFile(hStdOut, strl.c_str(), static_cast<DWORD>(strl_size), &dwWrittenNumberOfChars, NULL); WriteFile(hStdOut, strl.c_str(), static_cast<DWORD>(strl_size), &dwWrittenNumberOfChars, NULL);

View File

@ -58,7 +58,7 @@ namespace YYCC::DialogHelper {
* @brief Add a filter pair in file types list. * @brief Add a filter pair in file types list.
* @param filter_name[in] The friendly name of the filter. * @param filter_name[in] The friendly name of the filter.
* @param il[in] A C++ initialize list. * @param il[in] A C++ initialize list.
* Every entries must be `const char*` represent a single filter pattern. * Every entries must be `const yycc_char8_t*` represent a single filter pattern.
* The list at least should have one valid pattern. * The list at least should have one valid pattern.
* This function will not validate these filter patterns, so please write them carefully. * This function will not validate these filter patterns, so please write them carefully.
* @return True if added success, otherwise false. * @return True if added success, otherwise false.

View File

@ -273,9 +273,9 @@ namespace YYCC::ExceptionHelper {
// special proc for 2 exceptions // special proc for 2 exceptions
if (rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION || rec->ExceptionCode == EXCEPTION_IN_PAGE_ERROR) { if (rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION || rec->ExceptionCode == EXCEPTION_IN_PAGE_ERROR) {
if (rec->NumberParameters >= 2) { if (rec->NumberParameters >= 2) {
const char* op = const yycc_char8_t* op =
rec->ExceptionInformation[0] == 0 ? "read" : rec->ExceptionInformation[0] == 0 ? YYCC_U8("read") :
rec->ExceptionInformation[0] == 1 ? "written" : "executed"; rec->ExceptionInformation[0] == 1 ? YYCC_U8("written") : YYCC_U8("executed");
UExceptionErrLogFormatLine(fs, YYCC_U8("The data at memory address 0x%" PRI_XPTR_LEFT_PADDING PRIxPTR " could not be %s."), UExceptionErrLogFormatLine(fs, YYCC_U8("The data at memory address 0x%" PRI_XPTR_LEFT_PADDING PRIxPTR " could not be %s."),
rec->ExceptionInformation[1], op); rec->ExceptionInformation[1], op);
} }