Permalink
Browse files

Fix clang-tidy (LLVM-8.0.0-r345380) warnings.

  • Loading branch information...
zufuliu committed Oct 27, 2018
1 parent 2390a9d commit b14f13ae4d1d5f9e349fb4cdea128c7140e9b553
@@ -1,6 +1,6 @@
---
# http://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.strcpy,modernize-*,-modernize-use-using,bugprone-*,performance-*,readability-*,-readability-implicit-bool-conversion,misc-*'
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.strcpy,modernize-*,-modernize-use-using,bugprone-*,performance-*,readability-*,-readability-implicit-bool-conversion,-readability-magic-numbers,misc-*,-misc-non-private-member-variables-in-classes'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
@@ -44,7 +44,7 @@ typedef intptr_t sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define INVALID_POSITION -1
#define INVALID_POSITION (-1)
#define SCI_START 2000
#define SCI_OPTIONAL_START 3000
#define SCI_LEXER_START 4000
@@ -723,7 +723,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMOUSEDOWNCAPTURES 2385
#define SCI_SETMOUSEWHEELCAPTURES 2696
#define SCI_GETMOUSEWHEELCAPTURES 2697
#define SC_CURSORNORMAL -1
#define SC_CURSORNORMAL (-1)
#define SC_CURSORARROW 2
#define SC_CURSORWAIT 4
#define SC_CURSORREVERSEARROW 7
@@ -100,6 +100,8 @@ def ReadFromFile(self, name):
elif featureType == "val":
try:
name, value = featureVal.split("=", 1)
if value[0] == '-':
value = '(' + value + ')'
except ValueError:
print("Failure %s" % featureVal)
raise Exception()
@@ -12,17 +12,17 @@
def printLexHFile(f):
out = []
lex = []
lex = set()
for name in f.order:
v = f.features[name]
if v["FeatureType"] in ["val"]:
if "SCE_" in name or "SCLEX_" in name:
val = int(v["Value"])
val = int(v["Value"].strip('()'))
if "SCLEX_" in name:
if val in lex:
raise Exception("Duplicate Lexer Value: %s = %d" % (name, val))
else:
lex.append(val)
lex.add(val)
else:
if val > 31 and val < 40:
raise Exception("Invalid Style Value: %s = %d" % (name, val))
@@ -70,23 +70,21 @@ IDWriteRenderingParams *customClearTypeRenderingParams = nullptr;
static HMODULE hDLLD2D {};
static HMODULE hDLLDWrite {};
extern "C" UINT16 g_uWinVer;
#define IsWin8AndAbove() (g_uWinVer >= 0x0602)
extern "C" DWORD kSystemLibraryLoadFlags;
bool LoadD2D() noexcept {
static bool triedLoadingD2D = false;
if (!triedLoadingD2D) {
// Availability of SetDefaultDllDirectories implies Windows 8+ or
// that KB2533623 has been installed so LoadLibraryEx can be called
// with LOAD_LIBRARY_SEARCH_SYSTEM32.
const DWORD loadLibraryFlags = (IsWin8AndAbove() || ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories")) ? LOAD_LIBRARY_SEARCH_SYSTEM32 : 0;
typedef HRESULT(WINAPI *D2D1CFSig)(D2D1_FACTORY_TYPE factoryType, REFIID riid,
CONST D2D1_FACTORY_OPTIONS *pFactoryOptions, IUnknown **factory);
typedef HRESULT(WINAPI *DWriteCFSig)(DWRITE_FACTORY_TYPE factoryType, REFIID iid,
IUnknown **factory);
hDLLD2D = ::LoadLibraryEx(TEXT("D2D1.DLL"), nullptr, loadLibraryFlags);
hDLLD2D = ::LoadLibraryEx(TEXT("D2D1.DLL"), nullptr, kSystemLibraryLoadFlags);
if (hDLLD2D) {
D2D1CFSig fnD2DCF = reinterpret_cast<D2D1CFSig>(::GetProcAddress(hDLLD2D, "D2D1CreateFactory"));
if (fnD2DCF) {
@@ -97,7 +95,7 @@ bool LoadD2D() noexcept {
reinterpret_cast<IUnknown**>(&pD2DFactory));
}
}
hDLLDWrite = ::LoadLibraryEx(TEXT("DWRITE.DLL"), nullptr, loadLibraryFlags);
hDLLDWrite = ::LoadLibraryEx(TEXT("DWRITE.DLL"), nullptr, kSystemLibraryLoadFlags);
if (hDLLDWrite) {
DWriteCFSig fnDWCF = reinterpret_cast<DWriteCFSig>(::GetProcAddress(hDLLDWrite, "DWriteCreateFactory"));
if (fnDWCF) {
@@ -132,8 +132,8 @@ Used by VSCode, Atom etc.
#define SC_WIN_IDLE 5001
#define SC_INDICATOR_INPUT INDIC_IME
#define SC_INDICATOR_TARGET INDIC_IME+1
#define SC_INDICATOR_CONVERTED INDIC_IME+2
#define SC_INDICATOR_TARGET (INDIC_IME + 1)
#define SC_INDICATOR_CONVERTED (INDIC_IME + 2)
#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX
#ifndef SCS_CAP_SETRECONVERTSTRING
@@ -743,14 +743,14 @@ int ScintillaWin::MouseModifiers(uptr_t wParam) noexcept {
namespace {
int InputCodePage() noexcept {
HKL const inputLocale = ::GetKeyboardLayout(0);
HKL inputLocale = ::GetKeyboardLayout(0);
const LANGID inputLang = LOWORD(inputLocale);
WCHAR sCodePage[10];
const int res = ::GetLocaleInfo(MAKELCID(inputLang, SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE, sCodePage, sizeof(sCodePage) / sizeof(WCHAR));
if (!res)
return 0;
return StrToInt(sCodePage);
return static_cast<int>(wcstol(sCodePage, nullptr, 10));
}
/** Map the key codes to their equivalent SCK_ form. */
@@ -1659,7 +1659,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_KILLFOCUS: {
HWND wOther = reinterpret_cast<HWND>(wParam);
HWND wThis = MainHWND();
HWND const wCT = static_cast<HWND>(ct.wCallTip.GetID());
HWND wCT = static_cast<HWND>(ct.wCallTip.GetID());
if (!wParam ||
!(::IsChild(wThis, wOther) || (wOther == wCT))) {
SetFocusState(false);
@@ -33,10 +33,10 @@ NP2_inline void InitScintillaHandle(HWND hwnd) {
// SciCall()
//
//
LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM);
LRESULT WINAPI Scintilla_DirectFunction(HANDLE handle, UINT msg, WPARAM wParam, LPARAM lParam);
#define SciCall0(m) Scintilla_DirectFunction(g_hScintilla, (m), 0, 0)
#define SciCall1(m, w) Scintilla_DirectFunction(g_hScintilla, (m), (WPARAM)(w), 0)
#define SciCall2(m, w, l) Scintilla_DirectFunction(g_hScintilla, (m), (WPARAM)(w), (LPARAM)(l))
#define SciCall1(m, w) Scintilla_DirectFunction(g_hScintilla, (m), (w), 0)
#define SciCall2(m, w, l) Scintilla_DirectFunction(g_hScintilla, (m), (w), (l))
//=============================================================================
//
@@ -92,15 +92,15 @@ NP2_inline Sci_Position SciCall_GetLineEndPosition(int line) {
}
NP2_inline int SciCall_GetLine(int line, char *buffer) {
return (int)SciCall2(SCI_GETLINE, line, buffer);
return (int)SciCall2(SCI_GETLINE, line, (LPARAM)buffer);
}
NP2_inline int SciCall_GetSelTextLength(void) {
return (int)SciCall0(SCI_GETSELTEXT);
}
NP2_inline int SciCall_GetSelText(char *buffer) {
return (int)SciCall2(SCI_GETSELTEXT, 0, buffer);
return (int)SciCall2(SCI_GETSELTEXT, 0, (LPARAM)buffer);
}
NP2_inline int SciCall_CountCharacters(Sci_Position start, Sci_Position end) {
@@ -124,11 +124,11 @@ NP2_inline BOOL EditIsEmptySelection(void) {
}
NP2_inline Sci_Position SciCall_FindText(int searchFlags, struct Sci_TextToFind *ft) {
return (Sci_Position)SciCall2(SCI_FINDTEXT, searchFlags, ft);
return (Sci_Position)SciCall2(SCI_FINDTEXT, searchFlags, (LPARAM)ft);
}
NP2_inline int SciCall_GetTextRange(struct Sci_TextRange *tr) {
return (int)SciCall2(SCI_GETTEXTRANGE, 0, tr);
return (int)SciCall2(SCI_GETTEXTRANGE, 0, (LPARAM)tr);
}
//=============================================================================
@@ -183,7 +183,7 @@ NP2_inline int SciCall_GetMarginWidth(int margin) {
}
NP2_inline int SciCall_TextWidth(int style, const char *text) {
return (int)SciCall2(SCI_TEXTWIDTH, style, text);
return (int)SciCall2(SCI_TEXTWIDTH, style, (LPARAM)text);
}
NP2_inline void SciCall_SetMarginMask(int margin, int mask) {
@@ -266,7 +266,7 @@ NP2_inline void SciCall_EnsureVisible(int line) {
//
//
NP2_inline void SciCall_SetProperty(const char *key, const char *value) {
SciCall2(SCI_SETPROPERTY, key, value);
SciCall2(SCI_SETPROPERTY, (WPARAM)key, (LPARAM)value);
}
#endif // NOTEPAD2_SCICALL_H_
@@ -2,7 +2,6 @@
// Microsoft Visual C++ generated include file.
// Used by Notepad2.rc
//
#define IDC_STATIC -1
#define IDR_RT_MANIFEST 1
#define IDR_MAINWND 100
#define IDC_FINDTEXT 100

0 comments on commit b14f13a

Please sign in to comment.