mirror of
https://github.com/quantum5/Zalgo.git
synced 2025-04-24 13:41:57 -04:00
Added a forgotten header, fixed warnings.
This commit is contained in:
parent
e9e0ba6262
commit
f14bd75015
38
include/NLSWrap.hpp
Normal file
38
include/NLSWrap.hpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#pragma once
|
||||||
|
#ifndef id8B5E818D_F6E4_43FA_889FF93BB24D8D62
|
||||||
|
#define id8B5E818D_F6E4_43FA_889FF93BB24D8D62
|
||||||
|
|
||||||
|
typedef int (WINAPI *FN_NORMALIZESTRING)(UINT NormForm, LPCWSTR lpSrcString,
|
||||||
|
int cwSrcLength, LPWSTR lpDstString,
|
||||||
|
int cwDstLength);
|
||||||
|
FN_NORMALIZESTRING f_NormalizeString = NULL;
|
||||||
|
|
||||||
|
inline void ZalgoNormalizeInit()
|
||||||
|
{
|
||||||
|
HMODULE module = LoadLibrary(L"normaliz.dll");
|
||||||
|
FARPROC proc = GetProcAddress(module, "NormalizeString");
|
||||||
|
if (proc)
|
||||||
|
f_NormalizeString = (FN_NORMALIZESTRING) proc;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline UINT NormalizeStringForm(DWORD form)
|
||||||
|
{
|
||||||
|
switch (form) {
|
||||||
|
case MAP_PRECOMPOSED:
|
||||||
|
return 0x1; // NormalizationC
|
||||||
|
case MAP_COMPOSITE:
|
||||||
|
return 0x2; // NormalizationD
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int ZalgoNormalizeString(DWORD form, LPCWSTR src, LPWSTR dst, int bufsize)
|
||||||
|
{
|
||||||
|
if (f_NormalizeString)
|
||||||
|
return f_NormalizeString(NormalizeStringForm(form), src, -1, dst, bufsize);
|
||||||
|
else
|
||||||
|
return FoldString(form, src, -1, dst, bufsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // header
|
|
@ -280,9 +280,9 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
Edit_GetText(m_message, text, textlen);
|
Edit_GetText(m_message, text, textlen);
|
||||||
|
|
||||||
zalgo = ZalgoComes(text,
|
zalgo = ZalgoComes(text,
|
||||||
IsDlgButtonChecked(m_hwnd, ZALGO_GO_UP),
|
IsDlgButtonChecked(m_hwnd, ZALGO_GO_UP) != 0,
|
||||||
IsDlgButtonChecked(m_hwnd, ZALGO_GO_CENTER),
|
IsDlgButtonChecked(m_hwnd, ZALGO_GO_CENTER) != 0,
|
||||||
IsDlgButtonChecked(m_hwnd, ZALGO_GO_DOWN),
|
IsDlgButtonChecked(m_hwnd, ZALGO_GO_DOWN) != 0,
|
||||||
GetDlgItemInt(m_hwnd, ZALGO_MESS_LEVEL, NULL, FALSE));
|
GetDlgItemInt(m_hwnd, ZALGO_MESS_LEVEL, NULL, FALSE));
|
||||||
|
|
||||||
Edit_SetText(m_message, zalgo);
|
Edit_SetText(m_message, zalgo);
|
||||||
|
@ -329,7 +329,7 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
ShowWindow(m_preview->GetHWND(), SW_SHOW);
|
ShowWindow(m_preview->GetHWND(), SW_SHOW);
|
||||||
}
|
}
|
||||||
case TEXT_TO_NFC: {
|
case TEXT_TO_NFC: {
|
||||||
wchar_t *orig, *nfc;
|
wchar_t *orig, *nfc = NULL;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
int textlen;
|
int textlen;
|
||||||
|
|
||||||
|
@ -346,12 +346,13 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
Edit_SetText(m_message, nfc);
|
Edit_SetText(m_message, nfc);
|
||||||
|
|
||||||
nfccleanup:
|
nfccleanup:
|
||||||
delete nfc;
|
if (nfc)
|
||||||
|
delete nfc;
|
||||||
delete orig;
|
delete orig;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TEXT_TO_NFD: {
|
case TEXT_TO_NFD: {
|
||||||
wchar_t *orig, *nfd;
|
wchar_t *orig, *nfd = NULL;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
int textlen;
|
int textlen;
|
||||||
|
|
||||||
|
@ -368,7 +369,8 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
Edit_SetText(m_message, nfd);
|
Edit_SetText(m_message, nfd);
|
||||||
|
|
||||||
nfdcleanup:
|
nfdcleanup:
|
||||||
delete nfd;
|
if (nfd)
|
||||||
|
delete nfd;
|
||||||
delete orig;
|
delete orig;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue