https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4c48945643460fca2732…
commit e4c48945643460fca273217b75f3e7b72bb3ed7a
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Jul 30 14:56:10 2023 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Aug 6 17:35:23 2023 +0200
[GDI32] CreateDIBSection: Remove erroneous assignation (#5502)
bmBits is only used and assigned on output. It points (holds the address)
to the array of DIB bit values. The "Bits" parameter is however a pointer
to a variable that will receive the address of that array.
So it makes no sense to initially assign bmBits to the value of the Bits
parameter...
---
win32ss/gdi/gdi32/objects/bitmap.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/bitmap.c b/win32ss/gdi/gdi32/objects/bitmap.c
index 5fbcf50568a..343b2b55bd0 100644
--- a/win32ss/gdi/gdi32/objects/bitmap.c
+++ b/win32ss/gdi/gdi32/objects/bitmap.c
@@ -255,34 +255,36 @@ CreateDIBSection(
HBITMAP hBitmap = NULL;
PVOID bmBits = NULL;
- pConvertedInfo = ConvertBitmapInfo(BitmapInfo, Usage, &ConvertedInfoSize,
- FALSE);
-
+ pConvertedInfo = ConvertBitmapInfo(BitmapInfo,
+ Usage,
+ &ConvertedInfoSize,
+ FALSE);
if (pConvertedInfo)
{
// Verify header due to converted may == info.
if (pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER))
{
- if (pConvertedInfo->bmiHeader.biCompression == BI_JPEG
- || pConvertedInfo->bmiHeader.biCompression == BI_PNG)
+ if (pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
+ pConvertedInfo->bmiHeader.biCompression == BI_PNG)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
}
- bmBits = Bits;
- hBitmap = NtGdiCreateDIBSection(hDC, hSection, dwOffset, pConvertedInfo, Usage,
- ConvertedInfoSize, 0, // fl
- 0, // dwColorSpace
- &bmBits);
+ hBitmap = NtGdiCreateDIBSection(hDC,
+ hSection,
+ dwOffset,
+ pConvertedInfo,
+ Usage,
+ ConvertedInfoSize,
+ 0, // fl
+ 0, // dwColorSpace
+ &bmBits);
+ if (!hBitmap)
+ bmBits = NULL;
if (BitmapInfo != pConvertedInfo)
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
-
- if (!hBitmap)
- {
- bmBits = NULL;
- }
}
if (Bits)