From cddcd7483a7c472598af098e759e5d309024f606 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Dec 2021 20:31:39 +0300 Subject: DWORD -> uint32_t --- plugins/Msg_Export/src/FileViewer.cpp | 18 +++++++++--------- plugins/Msg_Export/src/options.cpp | 8 ++++---- plugins/Msg_Export/src/utils.cpp | 24 ++++++++++++------------ plugins/Msg_Export/src/utils.h | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 55e99279ff..6390f435e1 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -256,7 +256,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) for (; n < dwRead; n++) { // worst case is a file ending with \n or a unicode letter. resulting in a big unicode string // here we need szNewLine and szRtfEnd. the 10 is a small safty margin. - if (dwCurrent + (sizeof(szNewLine) + sizeof(szRtfEnd) + 10) > (DWORD)cb) { + if (dwCurrent + (sizeof(szNewLine) + sizeof(szRtfEnd) + 10) > (uint32_t)cb) { // oh no !!! we have almost reached the end of the windows supplyed buffer // we are writing to. we need to abort mision *S*!! // and rewinde file @@ -432,12 +432,12 @@ bool bUseInternalViewer(bool bNew) // pbBuff - ? // cb - ? // pcb - ? -// Returns : DWORD CALLBACK +// Returns : uint32_t CALLBACK DWORD CALLBACK RichEditStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { ReadFile((HANDLE)dwCookie, pbBuff, (DWORD)cb, (DWORD *)pcb, (LPOVERLAPPED)nullptr); - return (DWORD)(*pcb >= 0 ? NOERROR : (*pcb = 0, E_FAIL)); + return (uint32_t)(*pcb >= 0 ? NOERROR : (*pcb = 0, E_FAIL)); } DWORD CALLBACK RichEditRTFStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) @@ -445,12 +445,12 @@ DWORD CALLBACK RichEditRTFStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG *pcb = ((CLStreamRTFInfo *)dwCookie)->nLoadFileStream(pbBuff, cb); if (*pcb) return NOERROR; - return (DWORD)E_FAIL; + return (uint32_t)E_FAIL; } DWORD CALLBACK RichEditStreamSaveFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { - WriteFile((HANDLE)dwCookie, pbBuff, cb, (DWORD*)pcb, (LPOVERLAPPED)nullptr); + WriteFile((HANDLE)dwCookie, pbBuff, cb, (DWORD *)pcb, (LPOVERLAPPED)nullptr); return *pcb != cb; } @@ -463,7 +463,7 @@ DWORD CALLBACK RichEditStreamSaveFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb bool bLoadFile(HWND hwndDlg, CLHistoryDlg *pclDlg) { - DWORD dwStart = GetTickCount(); + uint32_t dwStart = GetTickCount(); HWND hRichEdit = GetDlgItem(hwndDlg, IDC_RICHEDIT); if (!hRichEdit) @@ -526,7 +526,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg *pclDlg) GETTEXTLENGTHEX sData = { 0 }; sData.flags = GTL_DEFAULT; - DWORD dwDataRead = (DWORD)SendMessage(hRichEdit, EM_GETTEXTLENGTHEX, (WPARAM)&sData, 0); + uint32_t dwDataRead = (uint32_t)SendMessage(hRichEdit, EM_GETTEXTLENGTHEX, (WPARAM)&sData, 0); SendMessage(hRichEdit, EM_SETSEL, dwDataRead - 1, dwDataRead - 1); if (!bScrollToBottom) @@ -604,7 +604,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (pt.x == -1 && pt.y == -1) { - DWORD dwStart, dwEnd; + uint32_t dwStart, dwEnd; SendMessage(hwnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd); SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)dwEnd); ClientToScreen(hwnd, &pt); @@ -838,7 +838,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LOGFONT lf = { 0 }; lf.lfHeight = 14L; - DWORD dwEffects = g_plugin.getDword(szFileViewDB "TEffects", 0); + uint32_t dwEffects = g_plugin.getDword(szFileViewDB "TEffects", 0); lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0; lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0; lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0; diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 32b9607dfc..90f87f8067 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -39,7 +39,7 @@ const int nProtoColWitdh = 100; // width in pixels of the UIN column in the List class CLDBEvent { - DWORD time; + uint32_t time; public: MCONTACT hUser; MEVENT hDbEvent; @@ -82,8 +82,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) return mir_strcmp(Proto_GetBaseAccountName((MCONTACT)lParam1), Proto_GetBaseAccountName((MCONTACT)lParam2)); if (lParamSort == 3) { - DWORD dwUin1 = db_get_dw((MCONTACT)lParam1, Proto_GetBaseAccountName((MCONTACT)lParam1), "UIN", 0); - DWORD dwUin2 = db_get_dw((MCONTACT)lParam2, Proto_GetBaseAccountName((MCONTACT)lParam2), "UIN", 0); + uint32_t dwUin1 = db_get_dw((MCONTACT)lParam1, Proto_GetBaseAccountName((MCONTACT)lParam1), "UIN", 0); + uint32_t dwUin2 = db_get_dw((MCONTACT)lParam2, Proto_GetBaseAccountName((MCONTACT)lParam2), "UIN", 0); if (dwUin1 == dwUin2) return 0; return (dwUin1 > dwUin2) ? -1 : 1; @@ -417,7 +417,7 @@ public: bool OnInitDialog() override { - DWORD dw = listUsers.GetExtendedListViewStyle(); + uint32_t dw = listUsers.GetExtendedListViewStyle(); dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES; listUsers.SetExtendedListViewStyle(dw); diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 479723781c..7a67870ed2 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -143,7 +143,7 @@ static void ReplaceAll(wstring &sSrc, const wchar_t *pszReplace, const wchar_t * // Parameters : dwError - ? // Returns : string -CMStringW sGetErrorString(DWORD dwError) +CMStringW sGetErrorString(uint32_t dwError) { LPVOID lpMsgBuf; FormatMessage( @@ -174,7 +174,7 @@ CMStringW sGetErrorString() void LogLastError(const wchar_t *pszError) { - DWORD error = GetLastError(); + uint32_t error = GetLastError(); CMStringW sError = pszError; @@ -199,7 +199,7 @@ static bool bWriteToFile(HANDLE hFile, const char *pszSrc, int nLen = -1) nLen = (int)mir_strlen(pszSrc); DWORD dwBytesWritten; - return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (DWORD)nLen); + return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (uint32_t)nLen); } @@ -251,7 +251,7 @@ static bool bWriteTextToFile(HANDLE hFile, const char *pszSrc, bool bUtf8File, i // Returns : Returns true if all the data was written to the file const char szNewLineIndent[] = "\r\n "; -bool bWriteNewLine(HANDLE hFile, DWORD dwIndent) +bool bWriteNewLine(HANDLE hFile, uint32_t dwIndent) { if (dwIndent > sizeof(szNewLineIndent) - 2) dwIndent = sizeof(szNewLineIndent) - 2; @@ -460,7 +460,7 @@ void ReplaceDefines(MCONTACT hContact, wstring &sTarget) ReplaceAll(sTarget, L"%nick%", FileNickFromHandle(hContact)); if (sTarget.find(L"%UIN%") != string::npos) { - DWORD dwUIN = db_get_dw(hContact, szProto, "UIN", 0); + uint32_t dwUIN = db_get_dw(hContact, szProto, "UIN", 0); wstring sReplaceUin; if (dwUIN) { wchar_t sTmp[20]; @@ -779,7 +779,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF pRoot.push_back(JSONNode("flags", flags)); if (dbei.eventType == EVENTTYPE_FILE) { - char *p = (char*)dbei.pBlob + sizeof(DWORD); + char *p = (char*)dbei.pBlob + sizeof(uint32_t); ptrW wszFileName(getEventString(dbei, p)); ptrW wszDescr(getEventString(dbei, p)); @@ -824,7 +824,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF case EVENTTYPE_FILE: { - char *p = (char*)dbei.pBlob + sizeof(DWORD); + char *p = (char*)dbei.pBlob + sizeof(uint32_t); ptrW wszFileName(getEventString(dbei, p)); ptrW wszDescr(getEventString(dbei, p)); @@ -860,14 +860,14 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF const wchar_t *pszTitle; char *pszCurBlobPos; if (dbei.eventType == EVENTTYPE_AUTHREQUEST) { // request - //blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) + //blob is: uin(uint32_t), hContact(uint32_t), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) nStringCount = 5; - pszCurBlobPos = (char *)dbei.pBlob + sizeof(DWORD) * 2; + pszCurBlobPos = (char *)dbei.pBlob + sizeof(uint32_t) * 2; pszTitle = LPGENW("The following user made an authorization request:"); } else { // Added - //blob is: uin(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) - pszCurBlobPos = (char *)dbei.pBlob + sizeof(DWORD); + //blob is: uin(uint32_t), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) + pszCurBlobPos = (char *)dbei.pBlob + sizeof(uint32_t); nStringCount = 4; pszTitle = LPGENW("The following user added you to their contact list:"); } @@ -875,7 +875,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF if (bWriteTextToFile(hFile, pszTitle, bWriteUTF8Format) && bWriteNewLine(hFile, nIndent) && bWriteTextToFile(hFile, LPGENW("UIN :"), bWriteUTF8Format)) { - DWORD uin = *((PDWORD)(dbei.pBlob)); + uint32_t uin = *((PDWORD)(dbei.pBlob)); int n = mir_snwprintf(szTemp, L"%d", uin); if (bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) { char *pszEnd = (char *)(dbei.pBlob + sizeof(dbei)); diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h index 7db695bbd9..8e50aeff9a 100755 --- a/plugins/Msg_Export/src/utils.h +++ b/plugins/Msg_Export/src/utils.h @@ -66,7 +66,7 @@ void ReplaceDefines(MCONTACT hContact, wstring &sTarget); void ReplaceTimeVariables(wstring &sRet); bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const wchar_t *pszSrc, bool bUtf8File); -bool bWriteNewLine(HANDLE hFile, DWORD dwIndent); +bool bWriteNewLine(HANDLE hFile, uint32_t dwIndent); bool bIsUtf8Header(uint8_t *pucByteOrder); #endif -- cgit v1.2.3