+ fix: burndown some VS Analyze Mode Infos/Warnings

This commit is contained in:
Rainer Kottenhoff 2021-02-11 13:08:37 +01:00
parent bc2d712971
commit 28bbb26b30
6 changed files with 81 additions and 51 deletions

View File

@ -2363,10 +2363,13 @@ bool MRU_AddFile(LPMRULIST pmru, LPWSTR pszFile, bool bRelativePath, bool bUnexp
}
#pragma warning(push)
#pragma warning(disable : 6385 6386)
bool MRU_Delete(LPMRULIST pmru, int iIndex)
{
if (pmru) {
if (iIndex >= 0 || iIndex < pmru->iSize) {
if (pmru && iIndex < MRU_MAXITEMS) {
if (iIndex >= 0 && iIndex < pmru->iSize) {
if (pmru->pszItems[iIndex]) {
LocalFree(pmru->pszItems[iIndex]); // StrDup()
}
@ -2395,6 +2398,8 @@ bool MRU_Delete(LPMRULIST pmru, int iIndex)
return false;
}
#pragma warning(pop)
bool MRU_Empty(LPMRULIST pmru, bool bExceptLeast)
{

View File

@ -91,14 +91,14 @@ static LRESULT CALLBACK SetPosRelatedToParent_Hook(INT nCode, WPARAM wParam, LPA
if (hParentWnd) {
WININFO const winInfo = GetMyWindowPlacement(hParentWnd, NULL);
RECT rcParent;
RECT rcParent = { 0, 0, 0, 0 };
rcParent.left = winInfo.x;
rcParent.top = winInfo.y;
rcParent.right = winInfo.x + winInfo.cx;
rcParent.bottom = winInfo.y + winInfo.cy;
// set new coordinates
RECT rcDlg;
RECT rcDlg = { 0, 0, 0, 0 };
rcDlg.left = pCreateStruct->x;
rcDlg.top = pCreateStruct->y;
rcDlg.right = pCreateStruct->x + pCreateStruct->cx;
@ -431,6 +431,7 @@ INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...)
}
INFOBOXLNG msgBox;
ZeroMemory(&msgBox, sizeof(INFOBOXLNG));
msgBox.uType = uType;
msgBox.lpstrMessage = AllocMem((COUNTOF(wchMessage)+1) * sizeof(WCHAR), HEAP_ZERO_MEMORY);
@ -854,6 +855,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, IDC_SCI_VERSION, WM_GETFONT, 0, 0);
if (hFont) {
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
GetObject(hFont, sizeof(LOGFONT), &lf);
lf.lfHeight = MulDiv(lf.lfHeight, 3, 2);
lf.lfWeight = FW_BOLD;
@ -921,6 +923,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, IDC_SCI_VERSION, WM_GETFONT, 0, 0);
if (hFont) {
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
GetObject(hFont, sizeof(LOGFONT), &lf);
lf.lfHeight = MulDiv(lf.lfHeight, 3, 2);
lf.lfWeight = FW_BOLD;
@ -1026,6 +1029,7 @@ CASE_WM_CTLCOLOR_SET:
if (penLink->msg == WM_LBUTTONDOWN) {
WCHAR hLink[256] = { L'\0' };
TEXTRANGE txtRng;
ZeroMemory(&txtRng, sizeof(TEXTRANGE));
txtRng.chrg = penLink->chrg;
txtRng.lpstrText = hLink;
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_GETTEXTRANGE, 0, (LPARAM)&txtRng);
@ -1535,6 +1539,7 @@ bool OpenWithDlg(HWND hwnd,LPCWSTR lpstrFile)
bool result = false;
DLITEM dliOpenWith;
ZeroMemory(&dliOpenWith, sizeof(DLITEM));
dliOpenWith.mask = DLI_FILENAME;
if (IDOK == ThemedDialogBoxParam(Globals.hLngResContainer,MAKEINTRESOURCE(IDD_MUI_OPENWITH),
@ -2200,7 +2205,7 @@ CASE_WM_CTLCOLOR_SET:
case BCN_DROPDOWN: {
const NMBCDROPDOWN* pDropDown = (NMBCDROPDOWN*)lParam;
// Get screen coordinates of the button.
POINT pt;
POINT pt = { 0, 0 };
pt.x = pDropDown->rcButton.left;
pt.y = pDropDown->rcButton.bottom;
ClientToScreen(pDropDown->hdr.hwndFrom, &pt);
@ -3389,10 +3394,9 @@ CASE_WM_CTLCOLOR_SET:
//
bool SelectDefEncodingDlg(HWND hwnd, cpi_enc_t* pidREncoding)
{
INT_PTR iResult;
ENCODEDLG dd;
ZeroMemory(&dd, sizeof(ENCODEDLG));
dd.bRecodeOnly = false;
dd.idEncoding = *pidREncoding;
@ -3592,7 +3596,7 @@ bool SelectEncodingDlg(HWND hwnd, cpi_enc_t* pidREncoding)
INT_PTR iResult;
ENCODEDLG dd;
ZeroMemory(&dd, sizeof(ENCODEDLG));
dd.bRecodeOnly = false;
dd.idEncoding = *pidREncoding;
dd.cxDlg = Settings.EncodingDlgSizeX;
@ -3623,9 +3627,9 @@ bool SelectEncodingDlg(HWND hwnd, cpi_enc_t* pidREncoding)
bool RecodeDlg(HWND hwnd, cpi_enc_t* pidREncoding)
{
INT_PTR iResult;
INT_PTR iResult = 0;
ENCODEDLG dd;
ZeroMemory(&dd, sizeof(ENCODEDLG));
dd.bRecodeOnly = true;
dd.idEncoding = *pidREncoding;
dd.cxDlg = Settings.RecodeDlgSizeX;
@ -4110,6 +4114,7 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
}
WININFO wi;
ZeroMemory(&wi, sizeof(WININFO));
wi.x = wndpl.rcNormalPosition.left;
wi.y = wndpl.rcNormalPosition.top;
wi.cx = wndpl.rcNormalPosition.right - wndpl.rcNormalPosition.left;
@ -4737,6 +4742,7 @@ POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent)
{
HMONITOR const hMonitor = MonitorFromRect(rcParent, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
ZeroMemory(&mi, sizeof(MONITORINFO));
mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfo(hMonitor, &mi);
@ -4748,7 +4754,7 @@ POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent)
int const x = rcParent->left + max_i(20, ((rcParent->right - rcParent->left) - (rcDlg->right - rcDlg->left)) / 2);
int const y = rcParent->top + max_i(20, ((rcParent->bottom - rcParent->top) - (rcDlg->bottom - rcDlg->top)) / 2);
POINT ptRet;
POINT ptRet = { 0, 0 };
ptRet.x = clampi(x, xMin, xMax);
ptRet.y = clampi(y, yMin, yMax);
return ptRet;
@ -4845,6 +4851,7 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
HMONITOR const hMonitor = MonitorFromRect(&rcParent, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
ZeroMemory(&mi, sizeof(MONITORINFO));
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
@ -4900,6 +4907,7 @@ void ResizeDlg_InitEx(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_
const DWORD style = (pm->direction < 0) ? (GetWindowStyle(hwnd) & ~WS_THICKFRAME) : (GetWindowStyle(hwnd) | WS_THICKFRAME);
WRCT_T wrc;
ZeroMemory(&wrc, sizeof(WRCT_T));
wrc.left = rc.left;
wrc.top = rc.top;
wrc.right = rc.right;
@ -5159,8 +5167,10 @@ void MakeBitmapButton(HWND hwnd, int nCtrlId, WORD uBmpId, int width, int height
hBmp = ResampleImageBitmap(hwnd, hBmp, width, height);
BITMAP bmp;
ZeroMemory(&bmp, sizeof(BITMAP));
GetObject(hBmp, sizeof(BITMAP), &bmp);
BUTTON_IMAGELIST bi;
ZeroMemory(&bi, sizeof(BUTTON_IMAGELIST));
bi.himl = ImageList_Create(bmp.bmWidth, bmp.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
ImageList_AddMasked(bi.himl, hBmp, CLR_DEFAULT);
@ -5180,9 +5190,10 @@ void MakeColorPickButton(HWND hwnd, int nCtrlId, HINSTANCE hInstance, COLORREF c
{
HWND const hwndCtl = GetDlgItem(hwnd, nCtrlId);
HIMAGELIST himlOld = NULL;
COLORMAP colormap[2];
COLORMAP colormap[2] = { {0,0}, {0,0} };
BUTTON_IMAGELIST bi;
ZeroMemory(&bi, sizeof(BUTTON_IMAGELIST));
if (SendMessage(hwndCtl, BCM_GETIMAGELIST, 0, (LPARAM)&bi)) {
himlOld = bi.himl;
}
@ -5232,7 +5243,8 @@ void DeleteBitmapButton(HWND hwnd, int nCtrlId)
{
HWND const hwndCtl = GetDlgItem(hwnd, nCtrlId);
BUTTON_IMAGELIST bi;
if (SendMessage(hwndCtl, BCM_GETIMAGELIST, 0, (LPARAM)& bi)) {
ZeroMemory(&bi, sizeof(BUTTON_IMAGELIST));
if (SendMessage(hwndCtl, BCM_GETIMAGELIST, 0, (LPARAM)&bi)) {
ImageList_Destroy(bi.himl);
}
}
@ -5324,6 +5336,7 @@ int Toolbar_GetButtons(HANDLE hwnd, int cmdBase, LPWSTR lpszButtons, int cchButt
for (int i = 0; i < cnt; i++) {
TBBUTTON tbb;
ZeroMemory(&tbb, sizeof(TBBUTTON));
SendMessage(hwnd, TB_GETBUTTON, (WPARAM)i, (LPARAM)&tbb);
StringCchPrintf(tchItem, COUNTOF(tchItem), L"%i ",
(tbb.idCommand == 0) ? 0 : tbb.idCommand - cmdBase + 1);
@ -5382,7 +5395,7 @@ int Toolbar_SetButtons(HANDLE hwnd, int cmdBase, LPCWSTR lpszButtons, LPCTBBUTTO
DPI_T GetCurrentPPI(HWND hwnd)
{
HDC const hDC = GetDC(hwnd);
DPI_T ppi;
DPI_T ppi = { 0, 0 };
ppi.x = max_u(GetDeviceCaps(hDC, LOGPIXELSX), USER_DEFAULT_SCREEN_DPI);
ppi.y = max_u(GetDeviceCaps(hDC, LOGPIXELSY), USER_DEFAULT_SCREEN_DPI);
ReleaseDC(hwnd, hDC);
@ -5724,7 +5737,7 @@ void SetUACIcon(HWND hwnd, const HMENU hMenu, const UINT nItem)
if (!mii.cbSize) { mii.cbSize = sizeof(MENUITEMINFO); }
if (!mii.fMask) { mii.fMask = MIIM_BITMAP; }
if (!mii.hbmpItem) { DeleteObject(mii.hbmpItem); }
if (mii.hbmpItem) { DeleteObject(mii.hbmpItem); }
mii.hbmpItem = ConvertIconToBitmap(Globals.hIconMsgShield, scx, scy);
@ -5775,6 +5788,7 @@ HBITMAP ResampleImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height)
{
if (hbmp) {
BITMAP bmp;
ZeroMemory(&bmp, sizeof(BITMAP));
if (GetObject(hbmp, sizeof(BITMAP), &bmp)) {
if ((width <= 0) || (height <= 0)) {
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);

View File

@ -585,7 +585,7 @@ char* EditGetClipboardText(HWND hwnd, bool bCheckEncoding, int* pLineCount, int*
char *s = pmch;
char *d = ptmp;
int eolmode = SciCall_GetEOLMode();
for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) {
for (ptrdiff_t i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) {
if (*s == '\n' || *s == '\r') {
if (eolmode == SC_EOL_CR) {
*d++ = '\r';
@ -610,7 +610,7 @@ char* EditGetClipboardText(HWND hwnd, bool bCheckEncoding, int* pLineCount, int*
int mlen2 = (int)(d - ptmp);
FreeMem(pmch);
pmch = AllocMem(mlen2 + 1, HEAP_ZERO_MEMORY);
pmch = AllocMem((size_t)mlen2 + 1LL, HEAP_ZERO_MEMORY);
if (pmch) {
StringCchCopyA(pmch, SizeOfMem(pmch), ptmp);
FreeMem(ptmp);
@ -619,7 +619,7 @@ char* EditGetClipboardText(HWND hwnd, bool bCheckEncoding, int* pLineCount, int*
} else {
// count lines only
char *s = pmch;
for (int i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) {
for (ptrdiff_t i = 0; (i <= mlen) && (*s != '\0'); ++i, ++lenLastLine) {
if (*s == '\n' || *s == '\r') {
if ((*s == '\r') && (i + 1 < mlen) && (*(s + 1) == '\n')) {
i++;
@ -2183,6 +2183,7 @@ static void _GetCurrentDateTimeString(LPWSTR pwchDateTimeStrg, size_t cchBufLen,
StringCchCopyW(wchTemplate, COUNTOF(wchTemplate), StrIsNotEmpty(pwchDateTimeStrg) ? pwchDateTimeStrg : confFormat);
struct tm sst;
ZeroMemory(&sst, sizeof(sst));
sst.tm_isdst = -1;
sst.tm_sec = (int)st.wSecond;
sst.tm_min = (int)st.wMinute;
@ -2357,7 +2358,7 @@ void EditTabsToSpaces(int nTabWidth,bool bOnlyIndentingWS)
FreeMem(pszTextW);
if (bModified) {
char* pszText2 = AllocMem(cchConvW*3, HEAP_ZERO_MEMORY);
char *pszText2 = AllocMem((size_t)cchConvW * 3, HEAP_ZERO_MEMORY);
ptrdiff_t cchConvM = WideCharToMultiByteEx(Encoding_SciCP,0,pszConvW,cchConvW,
pszText2,SizeOfMem(pszText2),NULL,NULL);
@ -2472,7 +2473,7 @@ void EditSpacesToTabs(int nTabWidth,bool bOnlyIndentingWS)
FreeMem(pszTextW);
if (bModified || cchConvW != cchTextW) {
char* pszText2 = AllocMem(cchConvW * 3, HEAP_ZERO_MEMORY);
char *pszText2 = AllocMem((size_t)cchConvW * 3, HEAP_ZERO_MEMORY);
ptrdiff_t cchConvM = WideCharToMultiByteEx(Encoding_SciCP,0,pszConvW,cchConvW,
pszText2,SizeOfMem(pszText2),NULL,NULL);
@ -3886,7 +3887,7 @@ void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlan
if (bTrailingBlanksOnly) {
DocPos i = iEndPos;
char ch;
char ch = '\0';
do {
ch = SciCall_GetCharAt(--i);
} while ((i >= iStartPos) && IsBlankCharA(ch));
@ -4298,7 +4299,7 @@ void EditFocusMarkedLinesCmd(HWND hwnd, bool bCopy, bool bDelete)
int const cchTextW = MultiByteToWideChar(Encoding_SciCP, 0, pchBuffer, -1, NULL, 0);
if (cchTextW > 0) {
bool ok = false;
HANDLE const hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (cchTextW + 1) * sizeof(WCHAR));
HANDLE const hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, ((size_t)cchTextW + 1LL) * sizeof(WCHAR));
if (hData) {
WCHAR* const pszClipBoard = GlobalLock(hData);
if (pszClipBoard) {
@ -4819,13 +4820,13 @@ void EditSortLines(HWND hwnd, int iSortFlags)
int const cchw = MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, NULL, 0);
if (cchw > 1) {
int tabs = _iTabWidth;
DocLn tabs = _iTabWidth;
ptrdiff_t const lnLen = (sizeof(WCHAR) * cchw);
pLines[i].pwszLine = AllocMem(lnLen, HEAP_ZERO_MEMORY);
MultiByteToWideChar(Encoding_SciCP, 0, pmsz, -1, pLines[i].pwszLine, cchw);
pLines[i].pwszSortEntry = pLines[i].pwszLine;
if (iSortFlags & SORT_COLUMN) {
int col = 0;
DocLn col = 0;
while (*(pLines[i].pwszSortEntry)) {
if (*(pLines[i].pwszSortEntry) == L'\t') {
if (col + tabs <= iSortColumn) {
@ -4876,7 +4877,7 @@ void EditSortLines(HWND hwnd, int iSortFlags)
srand((UINT)GetTickCount());
for (DocLn i = (iLineCount - 1); i > 0; --i) {
int j = rand() % i;
SORTLINE sLine;
SORTLINE sLine = { NULL, NULL };
sLine.pwszLine = pLines[i].pwszLine;
sLine.pwszSortEntry = pLines[i].pwszSortEntry;
pLines[i] = pLines[j];
@ -4888,7 +4889,7 @@ void EditSortLines(HWND hwnd, int iSortFlags)
DocLn const lenRes = cchTotal + (2 * iLineCount) + 1;
char* pmszResult = AllocMem(lenRes, HEAP_ZERO_MEMORY);
char* pmszResOffset = pmszResult;
char* pmszBuf = AllocMem(ichlMax + 1, HEAP_ZERO_MEMORY);
char* pmszBuf = AllocMem((size_t)ichlMax + 1LL, HEAP_ZERO_MEMORY);
FNSTRCMP const pFctStrCmp = (iSortFlags & SORT_NOCASE) ? ((iSortFlags & SORT_LEXICOGRAPH) ? _wcsicmp_s : _wcsicoll_s) :
((iSortFlags & SORT_LEXICOGRAPH) ? _wcscmp_s : _wcscoll_s);
@ -5137,9 +5138,9 @@ void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt)
}*/
tr.chrg.cpMax = min_cr(tr.chrg.cpMax, (DocPosCR)Sci_GetDocEndPosition());
size_t const len = (tr.chrg.cpMax - tr.chrg.cpMin);
char* pszText = AllocMem(len+1, HEAP_ZERO_MEMORY);
LPWSTR pszTextW = AllocMem((len+1) * sizeof(WCHAR), HEAP_ZERO_MEMORY);
size_t const len = ((size_t)tr.chrg.cpMax - (size_t)tr.chrg.cpMin);
char* pszText = AllocMem(len+1LL, HEAP_ZERO_MEMORY);
LPWSTR pszTextW = AllocMem((len+1LL) * sizeof(WCHAR), HEAP_ZERO_MEMORY);
DWORD cch = 0;
if (pszText && pszTextW) {
@ -5904,7 +5905,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
case WM_DPICHANGED: {
DPI_T dpi;
DPI_T dpi = { 0, 0 };
dpi.x = LOWORD(wParam);
dpi.y = HIWORD(wParam);
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, &dpi);
@ -6104,7 +6105,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
}
if (HIWORD(wParam) == CBN_CLOSEUP) {
LONG lSelEnd;
LONG lSelEnd = 0;
SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETEDITSEL, 0, (LPARAM)&lSelEnd);
SendDlgItemMessage(hwnd, LOWORD(wParam), CB_SETEDITSEL, 0, MAKELPARAM(lSelEnd, lSelEnd));
}
@ -7514,7 +7515,7 @@ bool EditAutoCompleteWord(HWND hwnd, bool autoInsert)
//LL_INSERT_INORDER(pListHead, pwlNewWord, wordcmpi);
LL_APPEND_ELEM(pListHead, pPrev, pwlNewWord);
++iNumWords;
iWListSize += (wlen + 1);
iWListSize += ((size_t)wlen + 1LL);
pwlNewWord = NULL; // alloc new
}
}
@ -7941,7 +7942,7 @@ static INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
case WM_DPICHANGED: {
DPI_T dpi;
DPI_T dpi = { 0, 0 };
dpi.x = LOWORD(wParam);
dpi.y = HIWORD(wParam);
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, &dpi);
@ -8099,6 +8100,7 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, 200, WM_GETFONT, 0, 0);
if (hFont) {
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
GetObject(hFont, sizeof(LOGFONT), &lf);
lf.lfUnderline = true;
//lf.lfWeight = FW_BOLD;
@ -8123,13 +8125,14 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
return true;
case WM_DPICHANGED: {
DPI_T dpi;
DPI_T dpi = { 0, 0 };
dpi.x = LOWORD(wParam);
dpi.y = HIWORD(wParam);
HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, 200, WM_GETFONT, 0, 0);
if (hFont) {
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
GetObject(hFont, sizeof(LOGFONT), &lf);
lf.lfUnderline = true;
//lf.lfWeight = FW_BOLD;
@ -8203,7 +8206,7 @@ CASE_WM_CTLCOLOR_SET: {
#endif
case WM_MOUSEMOVE: {
POINT pt;
POINT pt = { 0, 0 };
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
HWND hwndHover = ChildWindowFromPoint(hwnd,pt);
@ -8227,7 +8230,7 @@ CASE_WM_CTLCOLOR_SET: {
break;
case WM_LBUTTONDOWN: {
POINT pt;
POINT pt = { 0, 0 };
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
HWND hwndHover = ChildWindowFromPoint(hwnd,pt);
@ -8301,6 +8304,7 @@ bool EditModifyLinesDlg(HWND hwnd,LPWSTR pwsz1,LPWSTR pwsz2)
INT_PTR iResult;
MODLINESDATA data;
ZeroMemory(&data, sizeof(MODLINESDATA));
data.pwsz1 = pwsz1;
data.pwsz2 = pwsz2;
@ -8533,6 +8537,7 @@ bool EditEncloseSelectionDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose)
INT_PTR iResult;
ENCLOSESELDATA data;
ZeroMemory(&data, sizeof(ENCLOSESELDATA));
data.pwsz1 = pwszOpen;
data.pwsz2 = pwszClose;
@ -8595,7 +8600,7 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L
pdata->repeat = 1;
SetDlgItemInt(hwnd, 102, pdata->repeat, FALSE);
SetFocus(GetDlgItem(hwnd,100));
PostMessage(GetDlgItem(hwnd,100),EM_SETSEL,1,(int)(StringCchLen(wchOpenTagStrg,0)-1));
PostMessageW(GetDlgItem(hwnd,100),EM_SETSEL,1,(LPARAM)(StringCchLen(wchOpenTagStrg,0)-1));
CenterDlgInParent(hwnd, NULL);
}
return false;
@ -8719,8 +8724,9 @@ CASE_WM_CTLCOLOR_SET:
bool EditInsertTagDlg(HWND hwnd,LPWSTR pwszOpen,LPWSTR pwszClose, UINT* pRepeat)
{
INT_PTR iResult;
INT_PTR iResult = 0;
TAGSDATA data;
ZeroMemory(&data, sizeof(TAGSDATA));
data.pwsz1 = pwszOpen;
data.pwsz2 = pwszClose;
data.repeat = 1;
@ -9250,7 +9256,7 @@ void EditFoldClick(DocLn ln, int mode)
DocLn ln;
int mode;
DWORD dwTickCount;
} prev;
} prev = { 0, 0, 0 };
bool fGotoFoldPoint = mode & FOLD_SIBLINGS;

View File

@ -379,7 +379,7 @@ BOOL _resample(BYTE *ibuf, LONG iw, LONG ih, BYTE *obuf, LONG ow, LONG oh, PFN_F
DWORD *tb; // Temporary (intermediate buffer)
double intensity[COLOR_COMPONENTS]; // RGBA component intensities
double intensity[COLOR_COMPONENTS] = { 0.0, 0.0, 0.0, 0.0 }; // RGBA component intensities
double center; // Center of current sampling
double weight; // Current wight
@ -403,7 +403,7 @@ BOOL _resample(BYTE *ibuf, LONG iw, LONG ih, BYTE *obuf, LONG ow, LONG oh, PFN_F
ob = (DWORD *)obuf;
if (ow == iw && oh == ih) { /* Aame size, no resampling */
CopyMemory(ob, ib, iw * ih * sizeof(COLORREF));
CopyMemory(ob, ib, (size_t)iw * (size_t)ih * sizeof(COLORREF));
return TRUE;
}
@ -422,7 +422,7 @@ BOOL _resample(BYTE *ibuf, LONG iw, LONG ih, BYTE *obuf, LONG ow, LONG oh, PFN_F
tb = NULL;
tb = (DWORD *)AllocMem(ow * ih * sizeof(DWORD), HEAP_ZERO_MEMORY);
tb = (DWORD *)AllocMem((size_t)ow * ih * sizeof(DWORD), HEAP_ZERO_MEMORY);
if (!tb) {
goto Cleanup;
@ -440,10 +440,10 @@ BOOL _resample(BYTE *ibuf, LONG iw, LONG ih, BYTE *obuf, LONG ow, LONG oh, PFN_F
MAX_CONTRIBS = (int)(2 * SCALED_RADIUS + 1);
/* Pre-allocating all of the needed memory */
h_weight = (double *)AllocMem(ow * MAX_CONTRIBS * sizeof(double), HEAP_ZERO_MEMORY); /* weights */
h_pixel = (LONG *)AllocMem(ow * MAX_CONTRIBS * sizeof(int), HEAP_ZERO_MEMORY); /* the contributing pixels */
h_count = (LONG *)AllocMem(ow * sizeof(int), HEAP_ZERO_MEMORY); /* how may contributions for the target pixel */
h_wsum = (double *)AllocMem(ow * sizeof(double), HEAP_ZERO_MEMORY); /* sum of the weights for the target pixel */
h_weight = (double *)AllocMem((size_t)ow * MAX_CONTRIBS * sizeof(double), HEAP_ZERO_MEMORY); /* weights */
h_pixel = (LONG *)AllocMem((size_t)ow * MAX_CONTRIBS * sizeof(int), HEAP_ZERO_MEMORY); /* the contributing pixels */
h_count = (LONG *)AllocMem((size_t)ow * sizeof(int), HEAP_ZERO_MEMORY); /* how may contributions for the target pixel */
h_wsum = (double *)AllocMem((size_t)ow * sizeof(double), HEAP_ZERO_MEMORY); /* sum of the weights for the target pixel */
if (!(h_weight && h_pixel || h_count || h_wsum)) {
goto Cleanup;
@ -526,10 +526,10 @@ BOOL _resample(BYTE *ibuf, LONG iw, LONG ih, BYTE *obuf, LONG ow, LONG oh, PFN_F
MAX_CONTRIBS = (int)(2 * SCALED_RADIUS + 1);
/* Pre-calculate filter contributions for a column */
v_weight = (double *)AllocMem(oh * MAX_CONTRIBS * sizeof(double), HEAP_ZERO_MEMORY); /* Weights */
v_pixel = (LONG *)AllocMem(oh * MAX_CONTRIBS * sizeof(int), HEAP_ZERO_MEMORY); /* The contributing pixels */
v_count = (LONG *)AllocMem(oh * sizeof(int), HEAP_ZERO_MEMORY); /* How may contributions for the target pixel */
v_wsum = (double *)AllocMem(oh * sizeof(double), HEAP_ZERO_MEMORY); /* Sum of the weights for the target pixel */
v_weight = (double *)AllocMem((size_t)oh * MAX_CONTRIBS * sizeof(double), HEAP_ZERO_MEMORY); /* Weights */
v_pixel = (LONG *)AllocMem((size_t)oh * MAX_CONTRIBS * sizeof(int), HEAP_ZERO_MEMORY); /* The contributing pixels */
v_count = (LONG *)AllocMem((size_t)oh * sizeof(int), HEAP_ZERO_MEMORY); /* How may contributions for the target pixel */
v_wsum = (double *)AllocMem((size_t)oh * sizeof(double), HEAP_ZERO_MEMORY); /* Sum of the weights for the target pixel */
if (!(v_weight && v_pixel && v_count && v_wsum)) {
goto Cleanup;

View File

@ -46,6 +46,9 @@
#include "Sci_Position.h"
#include "Scintilla.h"
// no Analyze warning "prefer: enum class"
#pragma warning(disable : 26812)
//
// TODO:
// SCI_CREATEDOCUMENT (SC_DOCUMENTOPTION_TEXT_LARGE)

View File

@ -73,6 +73,8 @@ typedef struct state {
int lookup_len;
} state;
#define TE_INIT_STATE { NULL, NULL, 0, 0.0, NULL, NULL, 0 }
#if defined(TINYEXPR_USE_STATIC_MEMORY)
static te_expr te_expr_array[TINYEXPR_MAX_EXPRESSIONS] = {0};
static bool te_expr_isAllocated[TINYEXPR_MAX_EXPRESSIONS] = {false};
@ -1082,7 +1084,7 @@ static void optimize(te_expr *n) {
te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, te_xint_t *error) {
state s;
state s = TE_INIT_STATE;
s.start = s.next = expression;
s.lookup = variables;
s.lookup_len = var_count;