chore(developer): Not ready yet: changes in CheckFilenameConsistency to use on non-windows

This commit is contained in:
Sabine 2023-02-17 16:00:34 +01:00
parent cfb2a67481
commit b0976d55b7
4 changed files with 10 additions and 13 deletions

View file

@ -87,7 +87,7 @@ KMX_DWORD CheckFilenameConsistency(KMX_WCHAR const * Filename, bool ReportMissin
std::wstring wstr = convert_pchar16T_To_pwcharT(Name);
const KMX_WCHART* wchptr = wstr.c_str();
nfile = _wfsopen(wchptr, L"rb", _SH_DENYWR);
nfile = _wfsopen(wchptr, L"rb", _SH_DENYNO);
_wfinddata_t fi;
n = _wfindfirst(wchptr, &fi);
_findclose(n);

View file

@ -15,11 +15,19 @@
namespace kmcmp {
WCHAR conv_KMX_WCHAR__TO__WCHAR(KMX_WCHAR in) {
// char16_t -> std::u16string -> std::string -> std::wstring -> wchar_t
std::u16string u16str(&in);
std::string stri = string_from_u16string(u16str);
std::wstring wstr = wstring_from_string(stri);
return *wstr.c_str();
}
std::wstring MakeHashKeyFromFileKey16(PFILE_KEY kp) {
std::wstringstream Key_16;
std::wstring Context_ws = u16fmt((const PKMX_WCHAR) kp->dpContext);
Key_16 << convert_KMX_WCHAR__TO__WCHAR(kp->Key) << "," << (DWORD) kp->ShiftFlags << ",";
Key_16 << conv_KMX_WCHAR__TO__WCHAR(kp->Key) << "," << (DWORD) kp->ShiftFlags << ",";
if ((KMX_WCHART*) Context_ws.c_str())
Key_16 << (KMX_WCHART*) Context_ws.c_str();
return Key_16.str();

View file

@ -73,15 +73,6 @@ std::wstring convert_pchar16T_To_pwcharT(KMX_WCHAR Name[_MAX_PATH]){
return wstr;
}
KMX_WCHART convert_KMX_WCHAR__TO__WCHAR(KMX_WCHAR in) {
// char16_t -> std::u16string -> std::string -> std::wstring -> wchar_t
std::u16string u16str(&in);
std::string stri = string_from_u16string(u16str);
std::wstring wstr = wstring_from_string(stri);
return *wstr.c_str();
}
long int u16tol(const KMX_WCHAR* str, KMX_WCHAR** endptr, int base)
{
auto s = string_from_u16string(str);

View file

@ -6,7 +6,6 @@
#include <vector>
#include <ctype.h>
#include <string>
#include <kmcompx.h>
std::string string_from_wstring(std::wstring const str);
std::wstring wstring_from_string(std::string const str);
@ -17,7 +16,6 @@ std::wstring u16fmt(const KMX_WCHAR * str);
void u16sprintf(KMX_WCHAR * dst, const size_t sz, const wchar_t* fmt, ...) ;
std::wstring convert_pchar16T_To_pwcharT(KMX_WCHAR Name[_MAX_PATH]);
KMX_WCHART convert_KMX_WCHAR__TO__WCHAR(KMX_WCHAR in) ;
size_t u16len(const KMX_WCHAR *p);
int u16cmp(const KMX_WCHAR *p, const KMX_WCHAR *q);