mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
some style check
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
b65ace3b58
commit
80a7bd0b7a
@ -1852,7 +1852,7 @@ AcpiTableAcpiTableConstructor (
|
|||||||
// at the beginning of the list of tables. Some OS don't seem
|
// at the beginning of the list of tables. Some OS don't seem
|
||||||
// to find it correctly if it is too far down the list.
|
// to find it correctly if it is too far down the list.
|
||||||
//
|
//
|
||||||
AcpiTableInstance->Rsdt1->SignatureCommon.Signature = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
AcpiTableInstance->Rsdt1->Signature = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
||||||
AcpiTableInstance->Rsdt1->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
AcpiTableInstance->Rsdt1->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
||||||
AcpiTableInstance->Rsdt1->Revision = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
AcpiTableInstance->Rsdt1->Revision = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
||||||
CopyMem(AcpiTableInstance->Rsdt1->OemId, EFI_ACPI_OEM_ID, 6);
|
CopyMem(AcpiTableInstance->Rsdt1->OemId, EFI_ACPI_OEM_ID, 6);
|
||||||
@ -1867,7 +1867,7 @@ AcpiTableAcpiTableConstructor (
|
|||||||
AcpiTableInstance->NumberOfTableEntries1 = 1;
|
AcpiTableInstance->NumberOfTableEntries1 = 1;
|
||||||
AcpiTableInstance->Rsdt1->Length = AcpiTableInstance->Rsdt1->Length + sizeof(UINT32);
|
AcpiTableInstance->Rsdt1->Length = AcpiTableInstance->Rsdt1->Length + sizeof(UINT32);
|
||||||
|
|
||||||
AcpiTableInstance->Rsdt3->SignatureCommon.Signature = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
AcpiTableInstance->Rsdt3->Signature = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
||||||
AcpiTableInstance->Rsdt3->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
AcpiTableInstance->Rsdt3->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
||||||
AcpiTableInstance->Rsdt3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
AcpiTableInstance->Rsdt3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
||||||
CopyMem(AcpiTableInstance->Rsdt3->OemId, EFI_ACPI_OEM_ID, 6);
|
CopyMem(AcpiTableInstance->Rsdt3->OemId, EFI_ACPI_OEM_ID, 6);
|
||||||
@ -1885,7 +1885,7 @@ AcpiTableAcpiTableConstructor (
|
|||||||
//
|
//
|
||||||
// Initialize Xsdt
|
// Initialize Xsdt
|
||||||
//
|
//
|
||||||
AcpiTableInstance->Xsdt->SignatureCommon.Signature = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
AcpiTableInstance->Xsdt->Signature = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
|
||||||
AcpiTableInstance->Xsdt->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
AcpiTableInstance->Xsdt->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
||||||
AcpiTableInstance->Xsdt->Revision = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
AcpiTableInstance->Xsdt->Revision = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION;
|
||||||
CopyMem(AcpiTableInstance->Xsdt->OemId, EFI_ACPI_OEM_ID, 6);
|
CopyMem(AcpiTableInstance->Xsdt->OemId, EFI_ACPI_OEM_ID, 6);
|
||||||
|
@ -138,7 +138,7 @@ ScanTableInRSDT (
|
|||||||
EntryPtr = &Rsdt->Entry;
|
EntryPtr = &Rsdt->Entry;
|
||||||
for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) {
|
for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) {
|
||||||
Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr));
|
Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr));
|
||||||
if (Table->SignatureCommon.Signature == Signature) {
|
if (Table->Signature == Signature) {
|
||||||
*FoundTable = Table;
|
*FoundTable = Table;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ ScanTableInXSDT (
|
|||||||
for (Index = 0; Index < EntryCount; Index ++) {
|
for (Index = 0; Index < EntryCount; Index ++) {
|
||||||
CopyMem(&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof(UINT64));
|
CopyMem(&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof(UINT64));
|
||||||
Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr));
|
Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr));
|
||||||
if (Table->SignatureCommon.Signature == Signature) {
|
if (Table->Signature == Signature) {
|
||||||
*FoundTable = Table;
|
*FoundTable = Table;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -778,7 +778,7 @@ HdaCodecDisableWidgetPath(
|
|||||||
{
|
{
|
||||||
// Create variables.
|
// Create variables.
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HDA_IO_PROTOCOL *HdaIo = HdaWidget->FuncGroup->HdaCodecDev->HdaIo;
|
EFI_HDA_IO_PROTOCOL *HdaIo;
|
||||||
UINT32 Response = 0;
|
UINT32 Response = 0;
|
||||||
|
|
||||||
//DEBUG((DEBUG_INFO, "HdaCodecDisableWidgetPath(): start\n"));
|
//DEBUG((DEBUG_INFO, "HdaCodecDisableWidgetPath(): start\n"));
|
||||||
@ -787,6 +787,8 @@ HdaCodecDisableWidgetPath(
|
|||||||
if (HdaWidget == NULL)
|
if (HdaWidget == NULL)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
HdaIo = HdaWidget->FuncGroup->HdaCodecDev->HdaIo;
|
||||||
|
|
||||||
// Crawl through widget path.
|
// Crawl through widget path.
|
||||||
while (HdaWidget != NULL) {
|
while (HdaWidget != NULL) {
|
||||||
// If Output, disable stream.
|
// If Output, disable stream.
|
||||||
@ -823,7 +825,7 @@ HdaCodecEnableWidgetPath(
|
|||||||
{
|
{
|
||||||
// Create variables.
|
// Create variables.
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HDA_IO_PROTOCOL *HdaIo = HdaWidget->FuncGroup->HdaCodecDev->HdaIo;
|
EFI_HDA_IO_PROTOCOL *HdaIo;
|
||||||
UINT32 Response = 0;
|
UINT32 Response = 0;
|
||||||
|
|
||||||
//DEBUG((DEBUG_INFO, "HdaCodecEnableWidgetPath(): start\n"));
|
//DEBUG((DEBUG_INFO, "HdaCodecEnableWidgetPath(): start\n"));
|
||||||
@ -832,6 +834,8 @@ HdaCodecEnableWidgetPath(
|
|||||||
if ((HdaWidget == NULL) || (Volume > EFI_AUDIO_IO_PROTOCOL_MAX_VOLUME))
|
if ((HdaWidget == NULL) || (Volume > EFI_AUDIO_IO_PROTOCOL_MAX_VOLUME))
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
HdaIo = HdaWidget->FuncGroup->HdaCodecDev->HdaIo;
|
||||||
|
|
||||||
// Crawl through widget path.
|
// Crawl through widget path.
|
||||||
while (HdaWidget != NULL) {
|
while (HdaWidget != NULL) {
|
||||||
DEBUG((DEBUG_INFO, "Widget @ 0x%X setting up\n", HdaWidget->NodeId));
|
DEBUG((DEBUG_INFO, "Widget @ 0x%X setting up\n", HdaWidget->NodeId));
|
||||||
|
@ -749,13 +749,13 @@ BdsSetConsoleMode (
|
|||||||
NewRows = mBootTextModeRow;
|
NewRows = mBootTextModeRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GraphicsOutput != NULL) {
|
// if (GraphicsOutput != NULL) {
|
||||||
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (SimpleTextOut != NULL) {
|
// if (SimpleTextOut != NULL) {
|
||||||
MaxTextMode = SimpleTextOut->Mode->MaxMode;
|
MaxTextMode = SimpleTextOut->Mode->MaxMode;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1. If current video resolution is same with required video resolution,
|
// 1. If current video resolution is same with required video resolution,
|
||||||
|
@ -928,7 +928,7 @@ AhciDmaTransfer (
|
|||||||
}
|
}
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
if ((Task == NULL) || ((Task != NULL) && (!Task->IsStart))) {
|
if ((Task == NULL) || !Task->IsStart) {
|
||||||
//
|
//
|
||||||
// Mark the Task to indicate that it has been started.
|
// Mark the Task to indicate that it has been started.
|
||||||
//
|
//
|
||||||
@ -1039,7 +1039,7 @@ Exit:
|
|||||||
// context cleanup, then set the packet's Asb status.
|
// context cleanup, then set the packet's Asb status.
|
||||||
//
|
//
|
||||||
if (Task == NULL ||
|
if (Task == NULL ||
|
||||||
((Task != NULL) && (Status != EFI_NOT_READY))
|
(Status != EFI_NOT_READY)
|
||||||
) {
|
) {
|
||||||
AhciStopCommand (
|
AhciStopCommand (
|
||||||
PciIo,
|
PciIo,
|
||||||
@ -1402,8 +1402,6 @@ AhciAtaSmartReturnStatusCheck (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_ATA_COMMAND_BLOCK AtaCommandBlock;
|
EFI_ATA_COMMAND_BLOCK AtaCommandBlock;
|
||||||
UINT8 LBAMid;
|
|
||||||
UINT8 LBAHigh;
|
|
||||||
UINTN FisBaseAddr;
|
UINTN FisBaseAddr;
|
||||||
UINT32 Value;
|
UINT32 Value;
|
||||||
|
|
||||||
@ -1431,44 +1429,44 @@ AhciAtaSmartReturnStatusCheck (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
REPORT_STATUS_CODE (
|
// REPORT_STATUS_CODE (
|
||||||
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
// EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||||
(EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_DISABLED)
|
// (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_DISABLED)
|
||||||
);
|
// );
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
REPORT_STATUS_CODE (
|
// REPORT_STATUS_CODE (
|
||||||
EFI_PROGRESS_CODE,
|
// EFI_PROGRESS_CODE,
|
||||||
(EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_ENABLE)
|
// (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_ENABLE)
|
||||||
);
|
// );
|
||||||
|
|
||||||
FisBaseAddr = (UINTN)AhciRegisters->AhciRFis + Port * sizeof (EFI_AHCI_RECEIVED_FIS);
|
FisBaseAddr = (UINTN)AhciRegisters->AhciRFis + Port * sizeof (EFI_AHCI_RECEIVED_FIS);
|
||||||
|
|
||||||
Value = *(UINT32 *) (FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET);
|
Value = *(UINT32 *) (FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET);
|
||||||
|
|
||||||
if ((Value & EFI_AHCI_FIS_TYPE_MASK) == EFI_AHCI_FIS_REGISTER_D2H) {
|
if ((Value & EFI_AHCI_FIS_TYPE_MASK) == EFI_AHCI_FIS_REGISTER_D2H) {
|
||||||
LBAMid = ((UINT8 *)(UINTN)(FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET))[5];
|
UINT8 LBAMid = ((UINT8 *)(UINTN)(FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET))[5];
|
||||||
LBAHigh = ((UINT8 *)(UINTN)(FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET))[6];
|
UINT8 LBAHigh = ((UINT8 *)(UINTN)(FisBaseAddr + EFI_AHCI_D2H_FIS_OFFSET))[6];
|
||||||
|
|
||||||
if ((LBAMid == 0x4f) && (LBAHigh == 0xc2)) {
|
if ((LBAMid == 0x4f) && (LBAHigh == 0xc2)) {
|
||||||
//
|
//
|
||||||
// The threshold exceeded condition is not detected by the device
|
// The threshold exceeded condition is not detected by the device
|
||||||
//
|
//
|
||||||
DEBUG ((EFI_D_INFO, "The S.M.A.R.T threshold exceeded condition is not detected\n"));
|
// DEBUG ((EFI_D_INFO, "The S.M.A.R.T threshold exceeded condition is not detected\n"));
|
||||||
REPORT_STATUS_CODE (
|
// REPORT_STATUS_CODE (
|
||||||
EFI_PROGRESS_CODE,
|
// EFI_PROGRESS_CODE,
|
||||||
(EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD)
|
// (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD)
|
||||||
);
|
// );
|
||||||
} else if ((LBAMid == 0xf4) && (LBAHigh == 0x2c)) {
|
} else if ((LBAMid == 0xf4) && (LBAHigh == 0x2c)) {
|
||||||
//
|
//
|
||||||
// The threshold exceeded condition is detected by the device
|
// The threshold exceeded condition is detected by the device
|
||||||
//
|
//
|
||||||
DEBUG ((EFI_D_INFO, "The S.M.A.R.T threshold exceeded condition is detected\n"));
|
// DEBUG ((EFI_D_INFO, "The S.M.A.R.T threshold exceeded condition is detected\n"));
|
||||||
REPORT_STATUS_CODE (
|
// REPORT_STATUS_CODE (
|
||||||
EFI_PROGRESS_CODE,
|
// EFI_PROGRESS_CODE,
|
||||||
(EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD)
|
// (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD)
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,7 @@ typedef struct {
|
|||||||
/// The common ACPI description table header. This structure prefaces most ACPI tables.
|
/// The common ACPI description table header. This structure prefaces most ACPI tables.
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
CHAR8 SignatureAs4Char[4];
|
|
||||||
} SignatureCommon;
|
|
||||||
UINT32 Length;
|
UINT32 Length;
|
||||||
UINT8 Revision;
|
UINT8 Revision;
|
||||||
UINT8 Checksum;
|
UINT8 Checksum;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 718db6190f93bacd4a4e19c96baed3cfd8070286
|
Subproject commit f7dceb2b4c839595e8bd83902cc331a57087d9dd
|
@ -573,9 +573,7 @@ void Inflator_inflateHuffmanBlock(VECTOR_8 *out, const UINT8 *in, UINT32 *bp, UI
|
|||||||
vector8_resize(out, (*pos + 1) * 2); // reserve more room
|
vector8_resize(out, (*pos + 1) * 2); // reserve more room
|
||||||
out->data[(*pos)++] = (UINT8) code;
|
out->data[(*pos)++] = (UINT8) code;
|
||||||
}
|
}
|
||||||
else
|
else if (code <= 285)
|
||||||
|
|
||||||
if (code >= 257 && code <= 285)
|
|
||||||
{ // length code
|
{ // length code
|
||||||
UINT32 length = LENBASE[code - 257], numextrabits = LENEXTRA[code - 257];
|
UINT32 length = LENBASE[code - 257], numextrabits = LENEXTRA[code - 257];
|
||||||
UINT32 codeD;
|
UINT32 codeD;
|
||||||
|
@ -67,13 +67,12 @@ KeyMapBubbleSort (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN NoRemainingChilds2;
|
UINTN NoRemainingChilds2;
|
||||||
UINT16 *OperandPtr;
|
UINT16 *OperandPtr;
|
||||||
UINT16 FirstChild;
|
|
||||||
|
|
||||||
if (!Operand || !NoChilds) {
|
if (!Operand || !NoChilds) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Operand != NULL) {
|
|
||||||
++Operand;
|
++Operand;
|
||||||
NoRemainingChilds = (NoChilds - 1);
|
NoRemainingChilds = (NoChilds - 1);
|
||||||
Index = 1;
|
Index = 1;
|
||||||
@ -84,7 +83,7 @@ KeyMapBubbleSort (
|
|||||||
|
|
||||||
if (Index < NoChilds) {
|
if (Index < NoChilds) {
|
||||||
do {
|
do {
|
||||||
FirstChild = Operand[-1];
|
UINT16 FirstChild = Operand[-1];
|
||||||
|
|
||||||
if (FirstChild > *OperandPtr) {
|
if (FirstChild > *OperandPtr) {
|
||||||
Operand[-1] = *OperandPtr;
|
Operand[-1] = *OperandPtr;
|
||||||
@ -99,7 +98,7 @@ KeyMapBubbleSort (
|
|||||||
++Index;
|
++Index;
|
||||||
++Operand;
|
++Operand;
|
||||||
} while ((NoRemainingChilds--) > 0);
|
} while ((NoRemainingChilds--) > 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -432,7 +432,8 @@ GetIndexFromSupportedLangCodes(
|
|||||||
//
|
//
|
||||||
// Skip ';' characters in SupportedLang
|
// Skip ';' characters in SupportedLang
|
||||||
//
|
//
|
||||||
for (; *SupportedLang != '\0' && *SupportedLang == ';'; SupportedLang++);
|
//for (; *SupportedLang != '\0' && *SupportedLang == ';'; SupportedLang++);
|
||||||
|
while (*SupportedLang == ';') SupportedLang++; //no sense to check \0
|
||||||
//
|
//
|
||||||
// Determine the length of the next language code in SupportedLang
|
// Determine the length of the next language code in SupportedLang
|
||||||
//
|
//
|
||||||
@ -530,7 +531,8 @@ GetLangFromSupportedLangCodes (
|
|||||||
//
|
//
|
||||||
// Skip ';' characters in Supported
|
// Skip ';' characters in Supported
|
||||||
//
|
//
|
||||||
for (; *Supported != '\0' && *Supported == ';'; Supported++);
|
//for (; *Supported != '\0' && *Supported == ';'; Supported++);
|
||||||
|
while (*Supported == ';') Supported++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,7 +624,8 @@ VariableGetBestLanguage (
|
|||||||
//
|
//
|
||||||
// Skip ';' characters in Supported
|
// Skip ';' characters in Supported
|
||||||
//
|
//
|
||||||
for (; *Supported != '\0' && *Supported == ';'; Supported++);
|
//for (; *Supported != '\0' && *Supported == ';'; Supported++);
|
||||||
|
while (*Supported == ';') Supported++;
|
||||||
//
|
//
|
||||||
// Determine the length of the next language code in Supported
|
// Determine the length of the next language code in Supported
|
||||||
//
|
//
|
||||||
|
@ -1773,7 +1773,7 @@ UINT32 FixADP1 (UINT8* dsdt, UINT32 len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer<UINT8> ToFind, const XBuffer<UINT8> ToReplace)
|
UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer<UINT8>& ToFind, const XBuffer<UINT8>& ToReplace)
|
||||||
{
|
{
|
||||||
size_t sizeoffset;
|
size_t sizeoffset;
|
||||||
INT32 adr;
|
INT32 adr;
|
||||||
|
@ -50,7 +50,7 @@ FindBin (
|
|||||||
INT32 FindBin (UINT8 *dsdt, size_t len, const XBuffer<UINT8>& bin);
|
INT32 FindBin (UINT8 *dsdt, size_t len, const XBuffer<UINT8>& bin);
|
||||||
|
|
||||||
|
|
||||||
UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer<UINT8> ToFind, const XBuffer<UINT8> ToReplace);
|
UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer<UINT8>& ToFind, const XBuffer<UINT8>& ToReplace);
|
||||||
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, const XBuffer<UINT8>& TgtBrgName, const XBuffer<UINT8>& ToFind, const XBuffer<UINT8>& ToReplace);
|
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, const XBuffer<UINT8>& TgtBrgName, const XBuffer<UINT8>& ToFind, const XBuffer<UINT8>& ToReplace);
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ EFI_STATUS SaveHdaDumpBin()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
HdaCodecDev = AudioIoPrivateData->HdaCodecDev;
|
HdaCodecDev = AudioIoPrivateData->HdaCodecDev;
|
||||||
if(!HdaCodecDev || !HdaCodecDev->AudioFuncGroup)
|
if(!HdaCodecDev->AudioFuncGroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// HdaCodecInfo = &HdaCodecDev->HdaCodecInfoData->HdaCodecInfo;
|
// HdaCodecInfo = &HdaCodecDev->HdaCodecInfoData->HdaCodecInfo;
|
||||||
|
@ -80,7 +80,6 @@ XString8 get_pci_dev_path(pci_dt_t *PciDt)
|
|||||||
return NullXString8;
|
return NullXString8;
|
||||||
returnValue = FileDevicePathToXStringW(DevicePath);
|
returnValue = FileDevicePathToXStringW(DevicePath);
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 pci_config_read32(pci_dt_t *PciDt, UINT8 reg)
|
UINT32 pci_config_read32(pci_dt_t *PciDt, UINT8 reg)
|
||||||
@ -342,6 +341,8 @@ void devprop_free_string(DevPropString *StringBuf)
|
|||||||
// StringBuf = NULL;
|
// StringBuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT8 builtin = 0x0;
|
||||||
|
|
||||||
// Ethernet built-in device injection
|
// Ethernet built-in device injection
|
||||||
XBool set_eth_props(pci_dt_t *eth_dev)
|
XBool set_eth_props(pci_dt_t *eth_dev)
|
||||||
{
|
{
|
||||||
@ -349,7 +350,6 @@ XBool set_eth_props(pci_dt_t *eth_dev)
|
|||||||
// CHAR8 *devicepath;
|
// CHAR8 *devicepath;
|
||||||
#endif
|
#endif
|
||||||
DevPropDevice *device = NULL;
|
DevPropDevice *device = NULL;
|
||||||
UINT8 builtin = 0x0;
|
|
||||||
XBool Injected = false;
|
XBool Injected = false;
|
||||||
UINTN i;
|
UINTN i;
|
||||||
CHAR8 compatible[64];
|
CHAR8 compatible[64];
|
||||||
@ -422,8 +422,6 @@ XBool set_eth_props(pci_dt_t *eth_dev)
|
|||||||
#define PCI_IF_XHCI 0x30
|
#define PCI_IF_XHCI 0x30
|
||||||
|
|
||||||
static UINT8 clock_id = 0;
|
static UINT8 clock_id = 0;
|
||||||
static UINT8 builtin = 0x0;
|
|
||||||
|
|
||||||
static UINT16 current_available = 1200; //mA
|
static UINT16 current_available = 1200; //mA
|
||||||
static UINT16 current_extra = 700;
|
static UINT16 current_extra = 700;
|
||||||
static UINT16 current_in_sleep = 1000;
|
static UINT16 current_in_sleep = 1000;
|
||||||
|
@ -66,13 +66,14 @@ XBool AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& _LoaderTit
|
|||||||
// INTN i;
|
// INTN i;
|
||||||
|
|
||||||
DBG(" AddLegacyEntry:\n");
|
DBG(" AddLegacyEntry:\n");
|
||||||
|
if (Volume == NULL) {
|
||||||
|
DBG(" Volume==0\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
DBG(" FullTitle=%ls\n", FullTitle.wc_str());
|
DBG(" FullTitle=%ls\n", FullTitle.wc_str());
|
||||||
DBG(" LoaderTitle=%ls\n", _LoaderTitle.wc_str());
|
DBG(" LoaderTitle=%ls\n", _LoaderTitle.wc_str());
|
||||||
DBG(" Volume->LegacyOS->Name=%ls\n", Volume->LegacyOS->Name.wc_str());
|
DBG(" Volume->LegacyOS->Name=%ls\n", Volume->LegacyOS->Name.wc_str());
|
||||||
|
|
||||||
if (Volume == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Ignore this loader if it's device path is already present in another loader
|
// Ignore this loader if it's device path is already present in another loader
|
||||||
for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) {
|
for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) {
|
||||||
REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i];
|
REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i];
|
||||||
|
@ -268,8 +268,9 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path)
|
|||||||
( Path.isEqualIC(OSXInstallerPaths[2])) ||
|
( Path.isEqualIC(OSXInstallerPaths[2])) ||
|
||||||
( Path.isEqualIC(OSXInstallerPaths[3])) ||
|
( Path.isEqualIC(OSXInstallerPaths[3])) ||
|
||||||
( Path.isEqualIC(OSXInstallerPaths[4])) ||
|
( Path.isEqualIC(OSXInstallerPaths[4])) ||
|
||||||
( Path.isEqualIC(RockBoot)) || ( Path.isEqualIC(PaperBoot)) || ( Path.isEqualIC(ScissorBoot)) ||
|
( Path.isEqualIC(RockBoot)) || ( Path.isEqualIC(PaperBoot)) || ( Path.isEqualIC(ScissorBoot)) /* ||
|
||||||
(! Path.isEqualIC(L"\\.IABootFiles\\boot.efi") && Path.isEqualIC(L"\\.IAPhysicalMedia") && Path.isEqualIC(MACOSX_LOADER_PATH))
|
(! Path.isEqualIC(L"\\.IABootFiles\\boot.efi") &&
|
||||||
|
Path.isEqualIC(L"\\.IAPhysicalMedia")) */ //what is it???
|
||||||
) {
|
) {
|
||||||
return OSTYPE_OSX_INSTALLER;
|
return OSTYPE_OSX_INSTALLER;
|
||||||
} else if ( Path.isEqualIC(L"\\com.apple.recovery.boot\\boot.efi")) {
|
} else if ( Path.isEqualIC(L"\\com.apple.recovery.boot\\boot.efi")) {
|
||||||
|
@ -24,7 +24,7 @@ float CeilF(float X);
|
|||||||
float FloorF(float X);
|
float FloorF(float X);
|
||||||
float ModF(float X, float Y);
|
float ModF(float X, float Y);
|
||||||
float AcosF(float X);
|
float AcosF(float X);
|
||||||
float Atan2F(float X, float Y);
|
float Atan2F(float Y, float X); //y=sin(A), x=cos(A), atan2(y,x) == A
|
||||||
float FabsF(float X);
|
float FabsF(float X);
|
||||||
float rndf(void); //random number from 0 to 1.0f
|
float rndf(void); //random number from 0 to 1.0f
|
||||||
int dither(float x, int level);
|
int dither(float x, int level);
|
||||||
|
@ -140,7 +140,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage*
|
|||||||
else {
|
else {
|
||||||
SVGimage->shapes = shapeNext;
|
SVGimage->shapes = shapeNext;
|
||||||
}
|
}
|
||||||
shapePrev->next = shapeNext;
|
// shapePrev->next = shapeNext; //already done or null pointer
|
||||||
} //the shape in the group
|
} //the shape in the group
|
||||||
else {
|
else {
|
||||||
shapePrev = shape;
|
shapePrev = shape;
|
||||||
|
@ -840,9 +840,9 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
|||||||
unsigned tablelen = maxlen - FIRSTBITS;
|
unsigned tablelen = maxlen - FIRSTBITS;
|
||||||
unsigned start = tree->table_value[index]; /*starting index in secondary table*/
|
unsigned start = tree->table_value[index]; /*starting index in secondary table*/
|
||||||
unsigned num = 1u << (tablelen - (l - FIRSTBITS)); /*amount of entries of this symbol in secondary table*/
|
unsigned num = 1u << (tablelen - (l - FIRSTBITS)); /*amount of entries of this symbol in secondary table*/
|
||||||
unsigned j;
|
|
||||||
if(maxlen < l) return 55; /*invalid tree: long symbol shares prefix with short symbol*/
|
if(maxlen < l) return 55; /*invalid tree: long symbol shares prefix with short symbol*/
|
||||||
for(j = 0; j < num; ++j) {
|
for(unsigned j = 0; j < num; ++j) {
|
||||||
unsigned reverse2 = reverse >> FIRSTBITS; /* l - FIRSTBITS bits */
|
unsigned reverse2 = reverse >> FIRSTBITS; /* l - FIRSTBITS bits */
|
||||||
unsigned index2 = start + (reverse2 | (j << (l - FIRSTBITS)));
|
unsigned index2 = start + (reverse2 | (j << (l - FIRSTBITS)));
|
||||||
tree->table_len[index2] = l;
|
tree->table_len[index2] = l;
|
||||||
@ -889,7 +889,6 @@ static unsigned HuffmanTree_makeFromLengths2(HuffmanTree* tree) {
|
|||||||
unsigned* blcount;
|
unsigned* blcount;
|
||||||
unsigned* nextcode;
|
unsigned* nextcode;
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
unsigned bits, n;
|
|
||||||
|
|
||||||
tree->codes = (unsigned*)lodepng_malloc(tree->numcodes * sizeof(unsigned));
|
tree->codes = (unsigned*)lodepng_malloc(tree->numcodes * sizeof(unsigned));
|
||||||
blcount = (unsigned*)lodepng_malloc((tree->maxbitlen + 1) * sizeof(unsigned));
|
blcount = (unsigned*)lodepng_malloc((tree->maxbitlen + 1) * sizeof(unsigned));
|
||||||
@ -899,13 +898,13 @@ static unsigned HuffmanTree_makeFromLengths2(HuffmanTree* tree) {
|
|||||||
if(!error) {
|
if(!error) {
|
||||||
// for(n = 0; n != tree->maxbitlen + 1; n++) blcount[n] = nextcode[n] = 0; //already zero
|
// for(n = 0; n != tree->maxbitlen + 1; n++) blcount[n] = nextcode[n] = 0; //already zero
|
||||||
/*step 1: count number of instances of each code length*/
|
/*step 1: count number of instances of each code length*/
|
||||||
for(bits = 0; bits != tree->numcodes; ++bits) ++blcount[tree->lengths[bits]];
|
for(unsigned bits = 0; bits != tree->numcodes; ++bits) ++blcount[tree->lengths[bits]];
|
||||||
/*step 2: generate the nextcode values*/
|
/*step 2: generate the nextcode values*/
|
||||||
for(bits = 1; bits <= tree->maxbitlen; ++bits) {
|
for(unsigned bits = 1; bits <= tree->maxbitlen; ++bits) {
|
||||||
nextcode[bits] = (nextcode[bits - 1] + blcount[bits - 1]) << 1u;
|
nextcode[bits] = (nextcode[bits - 1] + blcount[bits - 1]) << 1u;
|
||||||
}
|
}
|
||||||
/*step 3: generate all the codes*/
|
/*step 3: generate all the codes*/
|
||||||
for(n = 0; n != tree->numcodes; ++n) {
|
for(unsigned n = 0; n != tree->numcodes; ++n) {
|
||||||
if(tree->lengths[n] != 0) {
|
if(tree->lengths[n] != 0) {
|
||||||
tree->codes[n] = nextcode[tree->lengths[n]]++;
|
tree->codes[n] = nextcode[tree->lengths[n]]++;
|
||||||
/*remove superfluous bits from the code*/
|
/*remove superfluous bits from the code*/
|
||||||
@ -966,22 +965,22 @@ typedef struct BPMLists {
|
|||||||
} BPMLists;
|
} BPMLists;
|
||||||
|
|
||||||
/*creates a new chain node with the given parameters, from the memory in the lists */
|
/*creates a new chain node with the given parameters, from the memory in the lists */
|
||||||
static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail) {
|
static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail)
|
||||||
unsigned i;
|
{
|
||||||
BPMNode* result;
|
BPMNode* result;
|
||||||
|
|
||||||
/*memory full, so garbage collect*/
|
/*memory full, so garbage collect*/
|
||||||
if(lists->nextfree >= lists->numfree) {
|
if(lists->nextfree >= lists->numfree) {
|
||||||
/*mark only those that are in use*/
|
/*mark only those that are in use*/
|
||||||
for(i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0;
|
for(unsigned i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0;
|
||||||
for(i = 0; i != lists->listsize; ++i) {
|
for(unsigned i = 0; i != lists->listsize; ++i) {
|
||||||
BPMNode* node;
|
BPMNode* node;
|
||||||
for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1;
|
for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1;
|
||||||
for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1;
|
for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1;
|
||||||
}
|
}
|
||||||
/*collect those that are free*/
|
/*collect those that are free*/
|
||||||
lists->numfree = 0;
|
lists->numfree = 0;
|
||||||
for(i = 0; i != lists->memsize; ++i) {
|
for(unsigned i = 0; i != lists->memsize; ++i) {
|
||||||
if(!lists->memory[i].in_use) lists->freelist[lists->numfree++] = &lists->memory[i];
|
if(!lists->memory[i].in_use) lists->freelist[lists->numfree++] = &lists->memory[i];
|
||||||
}
|
}
|
||||||
lists->nextfree = 0;
|
lists->nextfree = 0;
|
||||||
@ -1060,7 +1059,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int
|
|||||||
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
|
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
|
||||||
size_t numcodes, unsigned maxbitlen) {
|
size_t numcodes, unsigned maxbitlen) {
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
unsigned i;
|
// unsigned i;
|
||||||
size_t numpresent = 0; /*number of symbols with non-zero frequency*/
|
size_t numpresent = 0; /*number of symbols with non-zero frequency*/
|
||||||
BPMNode* leaves; /*the symbols, only those with > 0 frequency*/
|
BPMNode* leaves; /*the symbols, only those with > 0 frequency*/
|
||||||
|
|
||||||
@ -1070,7 +1069,7 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen
|
|||||||
leaves = (BPMNode*)lodepng_malloc(numcodes * sizeof(*leaves));
|
leaves = (BPMNode*)lodepng_malloc(numcodes * sizeof(*leaves));
|
||||||
if(!leaves) return 83; /*alloc fail*/
|
if(!leaves) return 83; /*alloc fail*/
|
||||||
|
|
||||||
for(i = 0; i != numcodes; ++i) {
|
for(unsigned i = 0; i != numcodes; ++i) {
|
||||||
if(frequencies[i] > 0) {
|
if(frequencies[i] > 0) {
|
||||||
leaves[numpresent].weight = (int)frequencies[i];
|
leaves[numpresent].weight = (int)frequencies[i];
|
||||||
leaves[numpresent].index = i;
|
leaves[numpresent].index = i;
|
||||||
@ -1107,21 +1106,21 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen
|
|||||||
if(!lists.memory || !lists.freelist || !lists.chains0 || !lists.chains1) error = 83; /*alloc fail*/
|
if(!lists.memory || !lists.freelist || !lists.chains0 || !lists.chains1) error = 83; /*alloc fail*/
|
||||||
|
|
||||||
if(!error) {
|
if(!error) {
|
||||||
for(i = 0; i != lists.memsize; ++i) lists.freelist[i] = &lists.memory[i];
|
for(unsigned i = 0; i != lists.memsize; ++i) lists.freelist[i] = &lists.memory[i];
|
||||||
// CopyMem(lists.freelist, &lists.memory, lists.memsize * sizeof(*lists.freelist));
|
// CopyMem(lists.freelist, &lists.memory, lists.memsize * sizeof(*lists.freelist));
|
||||||
bpmnode_create(&lists, leaves[0].weight, 1, 0);
|
bpmnode_create(&lists, leaves[0].weight, 1, 0);
|
||||||
bpmnode_create(&lists, leaves[1].weight, 2, 0);
|
bpmnode_create(&lists, leaves[1].weight, 2, 0);
|
||||||
|
|
||||||
for(i = 0; i != lists.listsize; ++i) {
|
for(unsigned i = 0; i != lists.listsize; ++i) {
|
||||||
lists.chains0[i] = &lists.memory[0];
|
lists.chains0[i] = &lists.memory[0];
|
||||||
lists.chains1[i] = &lists.memory[1];
|
lists.chains1[i] = &lists.memory[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*each boundaryPM call adds one chain to the last list, and we need 2 * numpresent - 2 chains.*/
|
/*each boundaryPM call adds one chain to the last list, and we need 2 * numpresent - 2 chains.*/
|
||||||
for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int)maxbitlen - 1, (int)i);
|
for(unsigned i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int)maxbitlen - 1, (int)i);
|
||||||
|
|
||||||
for(node = lists.chains1[maxbitlen - 1]; node; node = node->tail) {
|
for(node = lists.chains1[maxbitlen - 1]; node; node = node->tail) {
|
||||||
for(i = 0; i != node->index; ++i) ++lengths[leaves[i].index];
|
for(unsigned i = 0; i != node->index; ++i) ++lengths[leaves[i].index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,15 +1152,15 @@ static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigne
|
|||||||
|
|
||||||
/*get the literal and length code tree of a deflated block with fixed tree, as per the deflate specification*/
|
/*get the literal and length code tree of a deflated block with fixed tree, as per the deflate specification*/
|
||||||
static unsigned generateFixedLitLenTree(HuffmanTree* tree) {
|
static unsigned generateFixedLitLenTree(HuffmanTree* tree) {
|
||||||
unsigned i, error = 0;
|
unsigned error = 0;
|
||||||
unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DEFLATE_CODE_SYMBOLS * sizeof(unsigned));
|
unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DEFLATE_CODE_SYMBOLS * sizeof(unsigned));
|
||||||
if(!bitlen) return 83; /*alloc fail*/
|
if(!bitlen) return 83; /*alloc fail*/
|
||||||
|
|
||||||
/*288 possible codes: 0-255=literals, 256=endcode, 257-285=lengthcodes, 286-287=unused*/
|
/*288 possible codes: 0-255=literals, 256=endcode, 257-285=lengthcodes, 286-287=unused*/
|
||||||
for(i = 0; i <= 143; ++i) bitlen[i] = 8;
|
for(unsigned i = 0; i <= 143; ++i) bitlen[i] = 8;
|
||||||
for(i = 144; i <= 255; ++i) bitlen[i] = 9;
|
for(unsigned i = 144; i <= 255; ++i) bitlen[i] = 9;
|
||||||
for(i = 256; i <= 279; ++i) bitlen[i] = 7;
|
for(unsigned i = 256; i <= 279; ++i) bitlen[i] = 7;
|
||||||
for(i = 280; i <= 287; ++i) bitlen[i] = 8;
|
for(unsigned i = 280; i <= 287; ++i) bitlen[i] = 8;
|
||||||
|
|
||||||
error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DEFLATE_CODE_SYMBOLS, 15);
|
error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DEFLATE_CODE_SYMBOLS, 15);
|
||||||
|
|
||||||
@ -1171,12 +1170,12 @@ static unsigned generateFixedLitLenTree(HuffmanTree* tree) {
|
|||||||
|
|
||||||
/*get the distance code tree of a deflated block with fixed tree, as specified in the deflate specification*/
|
/*get the distance code tree of a deflated block with fixed tree, as specified in the deflate specification*/
|
||||||
static unsigned generateFixedDistanceTree(HuffmanTree* tree) {
|
static unsigned generateFixedDistanceTree(HuffmanTree* tree) {
|
||||||
unsigned i, error = 0;
|
unsigned error = 0;
|
||||||
unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned));
|
unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned));
|
||||||
if(!bitlen) return 83; /*alloc fail*/
|
if(!bitlen) return 83; /*alloc fail*/
|
||||||
|
|
||||||
/*there are 32 distance codes, but 30-31 are unused*/
|
/*there are 32 distance codes, but 30-31 are unused*/
|
||||||
for(i = 0; i != NUM_DISTANCE_SYMBOLS; ++i) bitlen[i] = 5;
|
for(unsigned i = 0; i != NUM_DISTANCE_SYMBOLS; ++i) bitlen[i] = 5;
|
||||||
error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15);
|
error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15);
|
||||||
|
|
||||||
lodepng_free(bitlen);
|
lodepng_free(bitlen);
|
||||||
@ -1224,7 +1223,7 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d,
|
|||||||
LodePNGBitReader* reader) {
|
LodePNGBitReader* reader) {
|
||||||
/*make sure that length values that aren't filled in will be 0, or a wrong tree will be generated*/
|
/*make sure that length values that aren't filled in will be 0, or a wrong tree will be generated*/
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
unsigned n, HLIT, HDIST, HCLEN, i;
|
unsigned n, HLIT, HDIST, HCLEN;
|
||||||
|
|
||||||
/*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/
|
/*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/
|
||||||
unsigned* bitlen_ll = 0; /*lit,len code lengths*/
|
unsigned* bitlen_ll = 0; /*lit,len code lengths*/
|
||||||
@ -1252,11 +1251,11 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d,
|
|||||||
if(lodepng_gtofl(reader->bp, HCLEN * 3, reader->bitsize)) {
|
if(lodepng_gtofl(reader->bp, HCLEN * 3, reader->bitsize)) {
|
||||||
ERROR_BREAK(50); /*error: the bit pointer is or will go past the memory*/
|
ERROR_BREAK(50); /*error: the bit pointer is or will go past the memory*/
|
||||||
}
|
}
|
||||||
for(i = 0; i != HCLEN; ++i) {
|
for(unsigned i = 0; i != HCLEN; ++i) {
|
||||||
ensureBits9(reader, 3); /*out of bounds already checked above */
|
ensureBits9(reader, 3); /*out of bounds already checked above */
|
||||||
bitlen_cl[CLCL_ORDER[i]] = readBits(reader, 3);
|
bitlen_cl[CLCL_ORDER[i]] = readBits(reader, 3);
|
||||||
}
|
}
|
||||||
for(i = HCLEN; i != NUM_CODE_LENGTH_CODES; ++i) {
|
for(unsigned i = HCLEN; i != NUM_CODE_LENGTH_CODES; ++i) {
|
||||||
bitlen_cl[CLCL_ORDER[i]] = 0;
|
bitlen_cl[CLCL_ORDER[i]] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1271,7 +1270,7 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d,
|
|||||||
lodepng_memset(bitlen_d, 0, NUM_DISTANCE_SYMBOLS * sizeof(*bitlen_d));
|
lodepng_memset(bitlen_d, 0, NUM_DISTANCE_SYMBOLS * sizeof(*bitlen_d));
|
||||||
|
|
||||||
/*i is the current symbol we're reading in the part that contains the code lengths of lit/len and dist codes*/
|
/*i is the current symbol we're reading in the part that contains the code lengths of lit/len and dist codes*/
|
||||||
i = 0;
|
unsigned i = 0;
|
||||||
while(i < HLIT + HDIST) {
|
while(i < HLIT + HDIST) {
|
||||||
unsigned code;
|
unsigned code;
|
||||||
ensureBits25(reader, 22); /* up to 15 bits for huffman code, up to 7 extra bits below*/
|
ensureBits25(reader, 22); /* up to 15 bits for huffman code, up to 7 extra bits below*/
|
||||||
@ -5189,20 +5188,21 @@ static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) {
|
static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info)
|
||||||
|
{
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
size_t i;
|
// size_t i;
|
||||||
ucvector tRNS;
|
ucvector tRNS;
|
||||||
ucvector_init(&tRNS);
|
ucvector_init(&tRNS);
|
||||||
if(info->colortype == LCT_PALETTE) {
|
if(info->colortype == LCT_PALETTE) {
|
||||||
size_t amount = info->palettesize;
|
size_t amount = info->palettesize;
|
||||||
/*the tail of palette values that all have 255 as alpha, does not have to be encoded*/
|
/*the tail of palette values that all have 255 as alpha, does not have to be encoded*/
|
||||||
for(i = info->palettesize; i != 0; --i) {
|
for(unsigned i = info->palettesize; i != 0; --i) {
|
||||||
if(info->palette[4 * (i - 1) + 3] == 255) --amount;
|
if(info->palette[4 * (i - 1) + 3] == 255) --amount;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
/*add only alpha channel*/
|
/*add only alpha channel*/
|
||||||
for(i = 0; i != amount; ++i) ucvector_push_back(&tRNS, info->palette[4 * i + 3]);
|
for(unsigned i = 0; i != amount; ++i) ucvector_push_back(&tRNS, info->palette[4 * i + 3]);
|
||||||
} else if(info->colortype == LCT_GREY) {
|
} else if(info->colortype == LCT_GREY) {
|
||||||
if(info->key_defined) {
|
if(info->key_defined) {
|
||||||
ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8));
|
ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8));
|
||||||
@ -5226,7 +5226,8 @@ static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize,
|
static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize,
|
||||||
LodePNGCompressSettings* zlibsettings) {
|
LodePNGCompressSettings* zlibsettings)
|
||||||
|
{
|
||||||
ucvector zlibdata;
|
ucvector zlibdata;
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
|
|
||||||
@ -5239,7 +5240,8 @@ static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t d
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned addChunk_IEND(ucvector* out) {
|
static unsigned addChunk_IEND(ucvector* out)
|
||||||
|
{
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
error = addChunk(out, "IEND", 0, 0);
|
error = addChunk(out, "IEND", 0, 0);
|
||||||
return error;
|
return error;
|
||||||
@ -5247,7 +5249,8 @@ static unsigned addChunk_IEND(ucvector* out) {
|
|||||||
|
|
||||||
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
|
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
|
||||||
|
|
||||||
static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring) {
|
static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring)
|
||||||
|
{
|
||||||
unsigned error = 0;
|
unsigned error = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
ucvector text;
|
ucvector text;
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define ceilf(x) CeilF(x)
|
#define ceilf(x) CeilF(x)
|
||||||
#define floorf(x) FloorF(x)
|
#define floorf(x) FloorF(x)
|
||||||
#define acosf(x) AcosF(x)
|
#define acosf(x) AcosF(x)
|
||||||
#define atan2f(x,y) Atan2F(x,y)
|
#define atan2f(y,x) Atan2F(y,x)
|
||||||
#define fabsf(x) FabsF(x)
|
#define fabsf(x) FabsF(x)
|
||||||
|
|
||||||
|
|
||||||
@ -447,7 +447,6 @@ static double nsvg__evalBezier(double t, double p0, double p1, double p2, double
|
|||||||
|
|
||||||
static void nsvg__curveBounds(float* bounds, float* curve)
|
static void nsvg__curveBounds(float* bounds, float* curve)
|
||||||
{
|
{
|
||||||
int i, j, count;
|
|
||||||
double roots[2], a, b, c, b2ac, t, v;
|
double roots[2], a, b, c, b2ac, t, v;
|
||||||
float* v0 = &curve[0];
|
float* v0 = &curve[0];
|
||||||
float* v1 = &curve[2];
|
float* v1 = &curve[2];
|
||||||
@ -466,11 +465,11 @@ static void nsvg__curveBounds(float* bounds, float* curve)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Add bezier curve inflection points in X and Y.
|
// Add bezier curve inflection points in X and Y.
|
||||||
for (i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
a = -3.0f * v0[i] + 9.0f * v1[i] - 9.0f * v2[i] + 3.0f * v3[i];
|
a = -3.0f * v0[i] + 9.0f * v1[i] - 9.0f * v2[i] + 3.0f * v3[i];
|
||||||
b = 6.0f * v0[i] - 12.0f * v1[i] + 6.0f * v2[i];
|
b = 6.0f * v0[i] - 12.0f * v1[i] + 6.0f * v2[i];
|
||||||
c = 3.0f * v1[i] - 3.0f * v0[i];
|
c = 3.0f * v1[i] - 3.0f * v0[i];
|
||||||
count = 0;
|
int count = 0;
|
||||||
if (fabs(a) < NSVG_EPSILON) {
|
if (fabs(a) < NSVG_EPSILON) {
|
||||||
if (fabs(b) > NSVG_EPSILON) {
|
if (fabs(b) > NSVG_EPSILON) {
|
||||||
t = -c / b;
|
t = -c / b;
|
||||||
@ -486,7 +485,7 @@ static void nsvg__curveBounds(float* bounds, float* curve)
|
|||||||
if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON) roots[count++] = t;
|
if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON) roots[count++] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (j = 0; j < count; j++) {
|
for (int j = 0; j < count; j++) {
|
||||||
v = nsvg__evalBezier(roots[j], v0[i], v1[i], v2[i], v3[i]);
|
v = nsvg__evalBezier(roots[j], v0[i], v1[i], v2[i], v3[i]);
|
||||||
bounds[0+i] = nsvg__minf(bounds[0+i], (float)v);
|
bounds[0+i] = nsvg__minf(bounds[0+i], (float)v);
|
||||||
bounds[2+i] = nsvg__maxf(bounds[2+i], (float)v);
|
bounds[2+i] = nsvg__maxf(bounds[2+i], (float)v);
|
||||||
@ -4232,10 +4231,10 @@ static void nsvg__content(void* ud, char* s)
|
|||||||
if (p->shapeFlag) {
|
if (p->shapeFlag) {
|
||||||
while (shape->next)
|
while (shape->next)
|
||||||
shape = shape->next;
|
shape = shape->next;
|
||||||
if (shape) {
|
// if (shape) {
|
||||||
memcpy(shape->title, s, len);
|
memcpy(shape->title, s, len);
|
||||||
memset(shape->title + len, 0, lim-len);
|
memset(shape->title + len, 0, lim-len);
|
||||||
}
|
// }
|
||||||
} else { //not shape
|
} else { //not shape
|
||||||
NSVGattrib* attr = nsvg__getAttr(p);
|
NSVGattrib* attr = nsvg__getAttr(p);
|
||||||
memcpy(attr->title, s, len);
|
memcpy(attr->title, s, len);
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#define floorf(x) FloorF(x)
|
#define floorf(x) FloorF(x)
|
||||||
#define fmodf(x,y) ModF(x,y)
|
#define fmodf(x,y) ModF(x,y)
|
||||||
#define acosf(x) AcosF(x)
|
#define acosf(x) AcosF(x)
|
||||||
#define atan2f(x,y) Atan2F(x,y)
|
#define atan2f(y,x) Atan2F(y,x)
|
||||||
//#define fabsf(x) ((x >= 0.0f)?x:(-x))
|
//#define fabsf(x) ((x >= 0.0f)?x:(-x))
|
||||||
#define fabsf(x) FabsF(x)
|
#define fabsf(x) FabsF(x)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user