make genconfig happy

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-02-28 21:12:57 +03:00
parent b6f2478cff
commit bdc977d14f
6 changed files with 37 additions and 31 deletions

View File

@ -38,6 +38,7 @@ cc -o genconfig clover-genconfig.c gfxutil.c -framework CoreFoundation -framewor
#define __DEBUG_LIB_H__
#define _STRUCT_X86_THREAD_STATE32
#define _STRUCT_X86_THREAD_STATE64
#include "../../../rEFIt_UEFI/Platform/Platform.h"
#include <IOKit/IOKitLib.h>

View File

@ -103,6 +103,7 @@ extern "C" {
#include "../cpp_foundation/XObjArray.h"
#include "../cpp_util/remove_ref.h"
#endif
#ifdef _MSC_VER
#define __typeof__(x) decltype(x)
#endif

View File

@ -5068,14 +5068,14 @@ GetUserSettings(
Prop2 = Prop2->tag; //take a <dict> for this device
if ((Prop2 != NULL) && (Prop2->type == kTagTypeDict)) {
INTN j, PropCount = 0;
INTN PropCount = 0;
PropCount = GetTagCount(Prop2); //properties count for this device
// DBG("Add %d properties:\n", PropCount);
for (j = 0; j < PropCount; j++) {
for (INTN j = 0; j < PropCount; j++) {
Prop3 = NULL;
DevProps = *Child;
*Child = (__typeof_am__(*Child))AllocateZeroPool(sizeof(**Child));
//*Child = new (__typeof_am__(**Child));
// *Child = new (__typeof_am__(**Child));
(*Child)->Next = DevProps;
if (EFI_ERROR(GetElement(Prop2, j, &Prop3))) { // Prop3 -> <key>
@ -8222,6 +8222,7 @@ SetDevices (LOADER_ENTRY *Entry)
}
Next = Props->Next;
FreePool(Props);
//delete Props;
Props = Next;
}
Next = Prop->Next;

View File

@ -1347,7 +1347,7 @@ VOID PatchTableType17()
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CHAR8*)&deviceLocator[0]);
if ((gRAM.User[UserIndex].InUse) && (gRAM.User[UserIndex].ModuleSize > 0)) {
if (iStrLen(gRAM.User[UserIndex].Vendor, 64) > 0) {
CHAR8* vendor = (CHAR8*)AllocatePool(AsciiStrLen(gRAM.User[UserIndex].Vendor)+1); // this will never be freed. Will be solved when using a string object.
CHAR8* vendor = (CHAR8*)AllocatePool(AsciiStrLen(gRAM.User[UserIndex].Vendor)+1);
AsciiStrCpy(vendor, gRAM.User[UserIndex].Vendor);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, vendor);
gRAM.User[UserIndex].Vendor = vendor;
@ -1670,7 +1670,7 @@ VOID PatchTableType17()
(AsciiStrnCmp(gRAM.SPD[SPDIndex].Vendor, "NoName", 6) == 0)) {
DBG("Type17->Manufacturer corrected by SMBIOS from NoName to %a\n", gRAM.SMBIOS[SMBIOSIndex].Vendor);
CHAR8* vendor = (CHAR8*)AllocatePool(AsciiStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor)+1); // this will never be freed. WIll be solved when using a string object.
AsciiStrCpy(vendor, gRAM.SMBIOS[SMBIOSIndex].Vendor);
AsciiStrCpyS(vendor, 64, gRAM.SMBIOS[SMBIOSIndex].Vendor);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, vendor);
gRAM.SMBIOS[SMBIOSIndex].Vendor = vendor;
}

View File

@ -1,16 +1,16 @@
#include "XImage.h"
#ifndef DEBUG_ALL
#define DEBUG_XIMAGE 1
#else
#define DEBUG_XIMAGE DEBUG_ALL
#endif
#if DEBUG_XIMAGE == 0
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_XIMAGE, __VA_ARGS__)
#endif
#ifndef DEBUG_ALL
#define DEBUG_XIMAGE 1
#else
#define DEBUG_XIMAGE DEBUG_ALL
#endif
#if DEBUG_XIMAGE == 0
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_XIMAGE, __VA_ARGS__)
#endif
XImage::XImage()
@ -267,26 +267,25 @@ unsigned XImage::FromSVG(const CHAR8 *SVGData, UINTN FileDataLength, float scale
{
NSVGimage *SVGimage;
NSVGparser* p;
EFI_STATUS Status;
NSVGrasterizer* rast = nsvgCreateRasterizer();
if (!rast) return 1;
char *input = AsciiStrCpy(SVGData);
char *input = (__typeof__(input))AllocateCopyPool(AsciiStrSize(SVGData), SVGData);
if (!input) return 2;
p = nsvgParse(input, 72, 1.f); //the parse will change input contents
SVGimage = p->image;
if (SVGimage) {
float ScaleX = Width / SVGimage->width;
float ScaleY = Height / SVGimage->height;
float Scale = (ScaleX > ScaleY) ? ScaleY : ScaleX;
Scale *= scale;
DBG("Test image width=%d heigth=%d\n", (int)(SVGimage->width), (int)(SVGimage->height));
nsvgRasterize(rast, SVGimage, 0.f, 0.f, Scale, Scale, (UINT8*)&PixelData[0], (int)Width, (int)Height, (int)Width * sizeof(PixelData[0]));
FreePool(SVGimage);
}
nsvg__deleteParser(p);
p = nsvgParse(input, 72, 1.f); //the parse will change input contents
SVGimage = p->image;
if (SVGimage) {
float ScaleX = Width / SVGimage->width;
float ScaleY = Height / SVGimage->height;
float Scale = (ScaleX > ScaleY) ? ScaleY : ScaleX;
Scale *= scale;
DBG("Test image width=%d heigth=%d\n", (int)(SVGimage->width), (int)(SVGimage->height));
nsvgRasterize(rast, SVGimage, 0.f, 0.f, Scale, Scale, (UINT8*)&PixelData[0], (int)Width, (int)Height, (int)Width * sizeof(PixelData[0]));
FreePool(SVGimage);
}
nsvg__deleteParser(p);
nsvgDeleteRasterizer(rast);
FreePool(input);
return 0;

View File

@ -68,7 +68,9 @@
// Experimental <--
#include "libeg.h"
#ifdef _cplusplus
#include "../cpp_foundation/XObjArray.h"
#endif
#define REFIT_DEBUG (2)
#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
@ -694,7 +696,9 @@ extern BOOLEAN MainAnime;
extern GUI_ANIME *GuiAnime;
extern REFIT_VOLUME *SelfVolume;
#ifdef _cplusplus
extern XObjArray<REFIT_VOLUME> Volumes;
#endif
//extern UINTN VolumesCount;
extern EG_IMAGE *Banner;