From 62a186697df33c96dc1a6dac0f4dfc38652fb96f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Dec 2021 16:39:04 +0300 Subject: BYTE -> uint8_t --- plugins/AVS/src/acc.cpp | 6 +++--- plugins/AVS/src/image_utils.cpp | 34 +++++++++++++++++----------------- plugins/AVS/src/options.cpp | 2 +- plugins/AVS/src/services.cpp | 12 ++++++------ 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'plugins/AVS/src') diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index a8d1bfd5ca..bc65051d2d 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -150,7 +150,7 @@ void AnimatedGifMountFrame(ACCData* data, int page) data->ag.times[page] = 0; if (FreeImage_GetMetadata(FIMD_ANIMATION, dib, "DisposalMethod", &tag)) - data->ag.frame.disposal_method = *(BYTE *)FreeImage_GetTagValue(tag); + data->ag.frame.disposal_method = *(uint8_t *)FreeImage_GetTagValue(tag); else data->ag.frame.disposal_method = 0; @@ -163,7 +163,7 @@ void AnimatedGifMountFrame(ACCData* data, int page) int transparent_color = -1; if (FreeImage_IsTransparent(dib)) { int count = FreeImage_GetTransparencyCount(dib); - BYTE *table = FreeImage_GetTransparencyTable(dib); + uint8_t *table = FreeImage_GetTransparencyTable(dib); for (int i = 0; i < count; i++) { if (table[i] == 0) { have_transparent = true; @@ -176,7 +176,7 @@ void AnimatedGifMountFrame(ACCData* data, int page) //copy page data into logical buffer, with full alpha opaqueness for (int y = 0; y < data->ag.frame.height; y++) { RGBQUAD *scanline = (RGBQUAD*)FreeImage_GetScanLine(data->ag.dib, data->ag.logicalHeight - (y + data->ag.frame.top) - 1) + data->ag.frame.left; - BYTE *pageline = FreeImage_GetScanLine(dib, data->ag.frame.height - y - 1); + uint8_t *pageline = FreeImage_GetScanLine(dib, data->ag.frame.height - y - 1); for (int x = 0; x < data->ag.frame.width; x++) { if (!have_transparent || *pageline != transparent_color) { *scanline = pal[*pageline]; diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 9717e5ddb4..3783f2ab3a 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -12,7 +12,7 @@ void MakeBmpTransparent(HBITMAP hBitmap) return; DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); - BYTE *p = (BYTE *)malloc(dwLen); + uint8_t *p = (uint8_t *)malloc(dwLen); if (p == nullptr) return; @@ -30,7 +30,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) GetObject(hBitmap, sizeof(bmp), &bmp); DWORD dwLen = bmp.bmWidth * bmp.bmHeight * 4; - BYTE *p = (BYTE *)malloc(dwLen); + uint8_t *p = (uint8_t *)malloc(dwLen); if (p == nullptr) return nullptr; @@ -43,7 +43,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; - BYTE *ptPixels; + uint8_t *ptPixels; HBITMAP hDirectBitmap = CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); // Copy data @@ -98,7 +98,7 @@ void SetTranspBkgColor(HBITMAP hBitmap, COLORREF color) return; DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); - BYTE *p = (BYTE *)malloc(dwLen); + uint8_t *p = (uint8_t *)malloc(dwLen); if (p == nullptr) return; memset(p, 0, dwLen); @@ -107,7 +107,7 @@ void SetTranspBkgColor(HBITMAP hBitmap, COLORREF color) bool changed = false; for (int y = 0; y < bmp.bmHeight; ++y) { - BYTE *px = p + bmp.bmWidth * 4 * y; + uint8_t *px = p + bmp.bmWidth * 4 * y; for (int x = 0; x < bmp.bmWidth; ++x) { if (px[3] == 0) { @@ -220,7 +220,7 @@ int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags) // Other utilities //////////////////////////////////////////////////////////////////////////////// -static BOOL ColorsAreTheSame(int colorDiff, BYTE *px1, BYTE *px2) +static BOOL ColorsAreTheSame(int colorDiff, uint8_t *px1, uint8_t *px2) { return abs(px1[0] - px2[0]) <= colorDiff && abs(px1[1] - px2[1]) <= colorDiff @@ -241,12 +241,12 @@ void AddToStack(int *stack, int *topPos, int x, int y) (*topPos)++; } -BOOL GetColorForPoint(int colorDiff, BYTE *p, int width, - int x0, int y0, int x1, int y1, int x2, int y2, BOOL *foundBkg, BYTE colors[][3]) +BOOL GetColorForPoint(int colorDiff, uint8_t *p, int width, + int x0, int y0, int x1, int y1, int x2, int y2, BOOL *foundBkg, uint8_t colors[][3]) { - BYTE *px1 = GET_PIXEL(p, x0, y0); - BYTE *px2 = GET_PIXEL(p, x1, y1); - BYTE *px3 = GET_PIXEL(p, x2, y2); + uint8_t *px1 = GET_PIXEL(p, x0, y0); + uint8_t *px2 = GET_PIXEL(p, x1, y1); + uint8_t *px3 = GET_PIXEL(p, x2, y2); // If any of the corners have transparency, forget about it // Not using != 255 because some MSN bmps have 254 in some positions @@ -326,7 +326,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) return FALSE; DWORD dwLen = width * height * 4; - BYTE *p = (BYTE *)malloc(dwLen); + uint8_t *p = (uint8_t *)malloc(dwLen); if (p == nullptr) return FALSE; @@ -341,7 +341,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) // **** Get corner colors // Top left - BYTE colors[8][3]; + uint8_t colors[8][3]; BOOL foundBkg[8]; if (!GetColorForPoint(colorDiff, p, width, 0, 0, 0, 1, 1, 0, &foundBkg[0], &colors[0])) { if (hBmpTmp != *hBitmap) @@ -428,7 +428,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) count = 0; for (j = 0; j < 8; j++) { - if (foundBkg[j] && ColorsAreTheSame(colorDiff, (BYTE *)&colors[i], (BYTE *)&colors[j])) + if (foundBkg[j] && ColorsAreTheSame(colorDiff, (uint8_t *)&colors[i], (uint8_t *)&colors[j])) count++; } @@ -454,7 +454,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) bkgColor[1] = 0; bkgColor[2] = 0; for (i = 0; i < 8; i++) { - if (foundBkg[i] && ColorsAreTheSame(colorDiff, (BYTE *)&colors[i], (BYTE *)&colors[selectedColor])) { + if (foundBkg[i] && ColorsAreTheSame(colorDiff, (uint8_t *)&colors[i], (uint8_t *)&colors[selectedColor])) { bkgColor[0] += colors[i][0]; bkgColor[1] += colors[i][1]; bkgColor[2] += colors[i][2]; @@ -506,13 +506,13 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) int y = stack[curPos]; curPos++; // Get pixel - BYTE *px1 = GET_PIXEL(p, x, y); + uint8_t *px1 = GET_PIXEL(p, x, y); // It won't change the transparency if one exists // (This avoid an endless loop too) // Not using == 255 because some MSN bmps have 254 in some positions if (px1[3] >= 253) { - if (ColorsAreTheSame(colorDiff, px1, (BYTE *)&colors[selectedColor])) { + if (ColorsAreTheSame(colorDiff, px1, (uint8_t *)&colors[selectedColor])) { px1[3] = (transpProportional) ? min(252, (abs(px1[0] - colors[selectedColor][0]) + abs(px1[1] - colors[selectedColor][1]) diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 4a22874456..f75005773b 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -659,7 +659,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { wchar_t szFinalName[MAX_PATH]; DBVARIANT dbv = { 0 }; - BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); + uint8_t is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); szFinalName[0] = 0; diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index d7364e8872..6e192c1998 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -44,9 +44,9 @@ INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM) INT_PTR ProtectAvatar(WPARAM hContact, LPARAM lParam) { - BYTE was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); + uint8_t was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); - if (was_locked == (BYTE)lParam) // no need for redundant lockings... + if (was_locked == (uint8_t)lParam) // no need for redundant lockings... return 0; if (hContact) { @@ -68,8 +68,8 @@ INT_PTR ProtectAvatar(WPARAM hContact, LPARAM lParam) struct OpenFileSubclassData { - BYTE *locking_request; - BYTE setView; + uint8_t *locking_request; + uint8_t setView; }; UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -84,7 +84,7 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP data = (OpenFileSubclassData *)malloc(sizeof(OpenFileSubclassData)); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); - data->locking_request = (BYTE *)ofn->lCustData; + data->locking_request = (uint8_t *)ofn->lCustData; data->setView = TRUE; CheckDlgButton(hwnd, IDC_PROTECTAVATAR, *(data->locking_request) ? BST_CHECKED : BST_UNCHECKED); } @@ -119,7 +119,7 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam) { wchar_t FileName[MAX_PATH]; wchar_t *szFinalName; - BYTE locking_request; + uint8_t locking_request; if (hContact == NULL) return 0; -- cgit v1.2.3