Skip to content

Commit

Permalink
Merged PR 5328: MdeModulePkg/HiiDatabaseDxe: Fix linker error
Browse files Browse the repository at this point in the history
Fix issue where memcpy() instrinsic is being used after recent MSVC
linker update in windows-2022 VM image from:

Previous:
- VM version: 20220509.1
- MSVC version: 14.31.31103

New:
- VM version: 20220511.2
- MSVC version: 14.32.31326
  • Loading branch information
makubacki authored and kenlautner committed May 9, 2023
1 parent ebf80b7 commit 9ae1c1d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ Output1bitPixel (
Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < 8; Index++) {
if ((Byte & (1 << Index)) != 0) {
BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[1];
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)], &PaletteValue[1], sizeof (*BitMapPtr));
} else {
BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)] = PaletteValue[0];
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 8 + (8 - Index - 1)], &PaletteValue[0], sizeof (*BitMapPtr));
}
}
}
Expand All @@ -302,9 +302,9 @@ Output1bitPixel (
Byte = *(Data + OffsetY + Xpos);
for (Index = 0; Index < Image->Width % 8; Index++) {
if ((Byte & (1 << (8 - Index - 1))) != 0) {
BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[1];
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index], &PaletteValue[1], sizeof (*BitMapPtr));
} else {
BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index] = PaletteValue[0];
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 8 + Index], &PaletteValue[0], sizeof (*BitMapPtr));
}
}
}
Expand Down Expand Up @@ -375,17 +375,17 @@ Output4bitPixel (
// All bits in these bytes are meaningful
//
for (Xpos = 0; Xpos < Image->Width / 2; Xpos++) {
Byte = *(Data + OffsetY + Xpos);
BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1] = PaletteValue[Byte & 0x0F];
Byte = *(Data + OffsetY + Xpos);
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 2], &PaletteValue[Byte >> 4], sizeof (*BitMapPtr));
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 2 + 1], &PaletteValue[Byte & 0x0F], sizeof (*BitMapPtr));
}

if (Image->Width % 2 != 0) {
//
// Padding bits in this byte should be ignored.
//
Byte = *(Data + OffsetY + Xpos);
BitMapPtr[Ypos * Image->Width + Xpos * 2] = PaletteValue[Byte >> 4];
Byte = *(Data + OffsetY + Xpos);
CopyMem (&BitMapPtr[Ypos * Image->Width + Xpos * 2], &PaletteValue[Byte >> 4], sizeof (*BitMapPtr));
}
}
}
Expand Down Expand Up @@ -453,8 +453,8 @@ Output8bitPixel (
// All bits are meaningful since the bitmap is 8 bits per pixel.
//
for (Xpos = 0; Xpos < Image->Width; Xpos++) {
Byte = *(Data + OffsetY + Xpos);
BitMapPtr[OffsetY + Xpos] = PaletteValue[Byte];
Byte = *(Data + OffsetY + Xpos);
CopyMem (&BitMapPtr[OffsetY + Xpos], &PaletteValue[Byte], sizeof (*BitMapPtr));
}
}
}
Expand Down Expand Up @@ -552,13 +552,13 @@ ImageToBlt (
OffsetY1 = Width * Ypos;
OffsetY2 = ImageOut->Width * (BltY + Ypos);
for (Xpos = 0; Xpos < Width; Xpos++) {
SrcPixel = BltBuffer[OffsetY1 + Xpos];
CopyMem (&SrcPixel, &BltBuffer[OffsetY1 + Xpos], sizeof (SrcPixel));
if (Transparent) {
if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) {
ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
if (CompareMem (&SrcPixel, &ZeroPixel, 3) != 0) { \
CopyMem (&ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos], &SrcPixel, sizeof (SrcPixel));
}
} else {
ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos] = SrcPixel;
CopyMem (&ImageOut->Image.Bitmap[OffsetY2 + BltX + Xpos], &SrcPixel, sizeof (SrcPixel));
}
}
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ HiiDrawImage (
OffsetY1 = Image->Width * Ypos;
OffsetY2 = Width * Ypos;
for (Xpos = 0; Xpos < Width; Xpos++) {
BltBuffer[OffsetY2 + Xpos] = Image->Bitmap[OffsetY1 + Xpos];
CopyMem (&BltBuffer[OffsetY2 + Xpos], &Image->Bitmap[OffsetY1 + Xpos], sizeof (*BltBuffer));
}
}
}
Expand Down

0 comments on commit 9ae1c1d

Please sign in to comment.