wrong DEBUG usage, firmware version is 2

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2022-01-23 15:19:15 +03:00
parent 7ffa4d6bf8
commit d388e910fe
20 changed files with 54 additions and 54 deletions

View File

@ -564,7 +564,7 @@ BdsEntry (
gST->FirmwareVendor = AllocateRuntimeCopyPool (StrSize (FirmwareVendor), FirmwareVendor);
// ASSERT (gST->FirmwareVendor != NULL);
#ifdef FIRMWARE_REVISION
gST->FirmwareRevision = (1<<16) + (UINT32)StrDecimalToUintn(FIRMWARE_REVISION);
gST->FirmwareRevision = (2<<16) + (UINT32)StrDecimalToUintn(FIRMWARE_REVISION);
#else
gST->FirmwareRevision = PcdGet32 (PcdFirmwareRevision);
#endif

View File

@ -146,7 +146,7 @@ LogDataHubXString8(IN EFI_GUID *TypeGuid,
IN CONST CHAR16 *Name,
const XString8& s)
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) panic("LogDataHub s.length > MAX_UINT32");
#else
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) return EFI_OUT_OF_RESOURCES;
@ -159,7 +159,7 @@ LogDataHubXStringW(IN EFI_GUID *TypeGuid,
IN CONST CHAR16 *Name,
const XStringW& s)
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) panic("LogDataHub s.length > MAX_UINT32");
#else
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) return EFI_OUT_OF_RESOURCES;

View File

@ -1350,7 +1350,7 @@ INT32 FindBin (UINT8 *dsdt, UINT32 len, const UINT8* bin, UINT32 N)
return -1;
}
INT32 FindBin (UINT8 *dsdt, size_t len, const XBuffer<UINT8>& bin) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( len > MAX_INT32 ) panic("FindBin : len > MAX_INT32"); // check against INT32, even though parameter of FindBin is UINT32. Because return value is INT32, parameter should not be > MAX_INT32
if ( bin.size() > MAX_INT32 ) panic("FindBin : bin.size() > MAX_INT32");
#else

View File

@ -151,7 +151,7 @@ const TagDict* TagArray::dictElementAt(size_t idx) const
{
const TagStruct* tag = elementAt(idx);
if ( !tag->isDict() ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("MALFORMED PLIST : TagArray::dictElementAt(%zu) -> trying to get a dict element at %zu, but element is %s\n", idx, idx, tag->getTypeAsXString8().c_str());
#else
return 0;
@ -164,7 +164,7 @@ const TagArray* TagArray::arrayElementAt(size_t idx) const
{
const TagStruct* tag = elementAt(idx);
if ( !tag->isArray() ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("MALFORMED PLIST : TagArray::dictElementAt(%zu) -> trying to get a array element at %zu, but element is %s\n", idx, idx, tag->getTypeAsXString8().c_str());
#else
return 0;

View File

@ -60,7 +60,7 @@ public:
}
void setDataValue(UINT8* data, UINTN dataLen)
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( data == NULL && dataLen != 0 ) panic("TagData::setDataValue() : data == NULL && dataLen != 0 ");
if ( data != NULL && dataLen == 0 ) panic("TagData::setDataValue() : data != NULL && dataLen == 0 ");
#else

View File

@ -114,7 +114,7 @@ XBool TagDict::debugIsEqual(const TagStruct& other, const XString8& label) const
INTN TagDict::dictKeyCount() const
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( !isDict() ) panic("TagStruct::dictKeyCount() : !isDict() ");
#else
if ( !isDict() ) return 0;

View File

@ -40,14 +40,14 @@ public:
*/
const XObjArray<TagStruct>& dictContent() const
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( !isDict() ) panic("TagDict::dictContent() : !isDict() ");
#endif
return _dictContent;
}
XObjArray<TagStruct>& dictContent()
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( !isDict() ) panic("TagDict::dictContent() : !isDict() ");
#endif
return _dictContent;

View File

@ -57,7 +57,7 @@ public:
virtual void sprintf(unsigned int ident, XString8* s) const = 0;
void printf(unsigned int ident) const;
virtual void printf() const { printf(0); }
#ifdef DEBUG
#ifdef JIEF_DEBUG
virtual const TagDict* getDict() const { panic("getDict() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagKey* getKey() const { panic("getKey() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagString* getString() const { panic("getString() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }

View File

@ -59,7 +59,7 @@ public:
XBool isInitialized() const { return m_CloverDir != NULL; }
void checkInitialized() const
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( !isInitialized() ) {
panic("Self in not initialized");
}

View File

@ -59,7 +59,7 @@ class XArray
template<typename IntegralType, enable_if(is_integral(IntegralType))>
const TYPE& ElementAt(IntegralType index) const
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( index < 0 ) {
panic("XArray::ElementAt(int) -> Operator [] : index < 0");
}
@ -209,7 +209,7 @@ void XArray<TYPE>::CheckSize(size_t nNewSize, size_t nGrowBy)
nNewSize += nGrowBy;
m_data = (TYPE *)Xrealloc((void *)m_data, nNewSize * sizeof(TYPE), m_allocatedSize * sizeof(TYPE) );
if ( !m_data ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XArray<TYPE>::CheckSize(nNewSize=%zu, nGrowBy=%zu) : Xrealloc(%zu, %lu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, nNewSize*sizeof(TYPE), (uintptr_t)m_data);
#endif
}
@ -231,7 +231,7 @@ void XArray<TYPE>::setSize(size_t l)
{
CheckSize(l, 0); // be sure the size is allocated
m_len = l;
#ifdef DEBUG
#ifdef JIEF_DEBUG
if(m_len > m_allocatedSize) {
panic("XArray::SetLength(size_t) -> _Len > _Size");
}

View File

@ -41,7 +41,7 @@ protected:
template<typename IntegralType, enable_if(is_integral(IntegralType))>
void stealValueFrom(T* p, IntegralType count) {
if ( count < 0 ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XBuffer::stealValueFrom : count < 0. System halted\n");
#else
return;
@ -86,7 +86,7 @@ public:
template<typename IntegralType, enable_if(is_integral(IntegralType))>
T* dataSized(IntegralType size) {
if ( size < 0 ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XBuffer::dataSized : size < 0. System halted\n");
#else
return NULL;
@ -143,7 +143,7 @@ public:
template<typename IntegralType, enable_if(is_integral(IntegralType))>
T& operator [](IntegralType i)
{
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
if (i < 0) panic("XBuffer::[] : i < 0. System halted\n");
if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n");
//#else
@ -156,7 +156,7 @@ public:
template<typename IntegralType, enable_if(is_integral(IntegralType))>
const T& operator [](IntegralType i) const
{
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
if (i < 0) panic("XBuffer::[] : i < 0. System halted\n");
if ( (unsigned_type(IntegralType))i >= size() ) panic("XBuffer::[] : i > _Len. System halted\n");
//#else
@ -176,7 +176,7 @@ public:
template<typename IntegralType, enable_if(is_integral(IntegralType))>
void memset(unsigned char c, IntegralType count) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
if (count < 0) panic("XBuffer::memset : count < 0. System halted\n");
#else
if (count < 0) return;
@ -187,7 +187,7 @@ public:
template<typename IntegralType1, typename IntegralType2, enable_if( is_integral(IntegralType1) && is_integral(IntegralType2) )>
void memsetAtPos(IntegralType1 pos, unsigned char c, IntegralType2 count) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
if (pos < 0) panic("XBuffer::memset : pos < 0. System halted\n");
if (count < 0) panic("XBuffer::memset : count < 0. System halted\n");
#else
@ -289,7 +289,7 @@ void XBuffer<T>::Initialize(const T* p, size_t count, size_t index)
m_allocatedSize = count;
_WData = (T*)malloc(m_allocatedSize);
if ( !_WData ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XBuffer<T>::Initialize(%zu) : malloc returned NULL. System halted\n", count);
#else
return;
@ -320,7 +320,7 @@ void XBuffer<T>::CheckAllocatedSize(size_t nNewSize, size_t nGrowBy)
nNewSize += nGrowBy;
_WData = (T*)Xrealloc(_WData, nNewSize*sizeof(T), m_allocatedSize);
if ( !_WData ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XBuffer<T>::CheckAllocatedSize(%zu, %zu) : Xrealloc(%" PRIuPTR " %zu, %zu) returned NULL. System halted\n", nNewSize, nGrowBy, uintptr_t(_WData), nNewSize, m_allocatedSize);
#else
m_allocatedSize = 0;

View File

@ -525,7 +525,7 @@ void XObjArrayNC<TYPE>::CheckSize(size_t nNewSize, size_t nGrowBy)
nNewSize += nGrowBy + 1;
_Data = (XObjArrayEntry<TYPE> *)Xrealloc((void *)_Data, sizeof(XObjArrayEntry<TYPE>) * nNewSize, sizeof(XObjArrayEntry<TYPE>) * m_allocatedSize);
if ( !_Data ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XObjArrayNC<TYPE>::CheckSize(nNewSize=%zu, nGrowBy=%zu) : Xrealloc(%zu, %zu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, sizeof(XObjArrayEntry<TYPE>) * nNewSize, (uintptr_t)_Data);
#else
m_allocatedSize = 0;

View File

@ -65,7 +65,7 @@ class XRBuffer
void setIndex(IntegralType Idx)
{
if (Idx < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XBuffer::setIndex : Idx < 0. System halted\n");
#else
_Index = 0;
@ -86,14 +86,14 @@ class XRBuffer
T& operator [](IntegralType i)
{
if (i < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XRBuffer::operator [] : i < 0. System halted\n");
#else
return 0;
#endif
}
if ( (unsigned_type(IntegralType))i >= m_size ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XRBuffer::operator [] : index >= m_size. System halted\n");
#else
return 0;
@ -105,14 +105,14 @@ class XRBuffer
const T& operator [](IntegralType i) const
{
if (i < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XRBuffer::operator [] : i < 0. System halted\n");
#else
return 0;
#endif
}
if ( (unsigned_type(IntegralType))i >= m_size ) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("XRBuffer::operator [] : index > len. System halted\n");
#else
return 0;

View File

@ -302,7 +302,7 @@ public:
char32_t char32At(IntegralType i) const
{
if (i < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("__String<T>::char32At(size_t i) : i < 0. System halted\n");
#else
return 0;
@ -314,7 +314,7 @@ public:
do {
p = get_char32_from_string(p, &char32);
if (!char32) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( (unsigned_type(IntegralType))i == nb ) return 0; // no panic if we want to access the null terminator
panic("__String::char32At(size_t i) : i >= length(). System halted\n");
#else
@ -537,7 +537,7 @@ public:
bool isEqualAtIC(IntegralType pos, const __String<O, OtherXStringClass>& S) const
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( pos < 0 ) panic("XString::equalAtIC -> i < 0");
#else
if ( pos < 0 ) return false;

View File

@ -45,7 +45,7 @@ XmlAbstractType& XmlDict::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, co
XmlAbstractType& xmlAbstractType = xmlDictField.xmlAbstractType;
if ( strnIsEqualIC(keyValue, keyValueLength, fieldName) )
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( xmlPath.containsIC("/ACPI/RenameDevices") ) {
(void)1;
}
@ -54,7 +54,7 @@ if ( strcmp(fieldName, "AutoMerge") == 0 ) {
}
#endif
*keyFound = true;
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
// XmlParserPosition pos = xmlLiteParser->getPosition();
//#endif
@ -63,7 +63,7 @@ if ( strcmp(fieldName, "AutoMerge") == 0 ) {
// xmlAbstractType.reset();
// }
// if ( !xmlAbstractType.parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors) ) {
////#ifdef DEBUG
////#ifdef JIEF_DEBUG
//// xmlAbstractType.reset();
//// xmlLiteParser->restorePosition(pos);
//// xmlAbstractType.parseFromXmlLite(xmlLiteParser, xmlPath, false);
@ -110,7 +110,7 @@ size_t* keyValueLengthPtr)
if ( xmlPath.lastChar() == '/' ) xmlSubPath.S8Catf("%.*s", (int)keyValueLength, keyValue);
else xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue);
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
//XmlParserPosition valuePos = xmlLiteParser->getPosition();
//#endif
@ -125,7 +125,7 @@ size_t* keyValueLengthPtr)
xmlLiteParser->skipNextTag(generateErrors); // return value doesn't need to be tested, because skipNextTag() set xmlLiteParser::xmlParsingError to true.
}
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
// if ( xmlLiteParser->xmlParsingError ) {
// xmlLiteParser->restorePosition(valuePos);
// reset();
@ -154,7 +154,7 @@ XBool XmlDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xm
// xmlSubPath = xmlPath;
// xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue);
//
#ifdef DEBUG
#ifdef JIEF_DEBUG
XmlParserPosition valuePos = xmlLiteParser->getPosition();
(void)valuePos;
#endif
@ -211,14 +211,14 @@ XBool XmlDict::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, c
// XmlDictField& xmlDictField = fields[idx];
// XmlAbstractType& xmlAbstractType = xmlDictField.xmlAbstractType;
// XString8 subXmlPath = S8Printf("%s/%s", xmlPath.c_str(), xmlDictField.m_name);
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
////if ( subXmlPath == "/ACPI/DSDT/Name"_XS8 ) {
//if ( subXmlPath == "/Boot/Policy"_XS8 ) {
// printf("");
//}
//#endif
// if ( !xmlAbstractType.validate(xmlLiteParser, subXmlPath, pos, generateErrors) ) {
// #ifdef DEBUG
// #ifdef JIEF_DEBUG
//// xmlAbstractType.validate(xmlLiteParser, subXmlPath, pos, false);
// #endif
// return false;

View File

@ -175,7 +175,7 @@ if ( xmlPath.startWithOrEqualToIC("/Devices/Properties"_XS8) ) {
// xmlSubPath = xmlPath;
// xmlSubPath.S8Catf("/%.*s", (int)keyValueLength, keyValue);
//
#ifdef DEBUG
#ifdef JIEF_DEBUG
XmlParserPosition valuePos = xmlLiteParser->getPosition();
(void)valuePos;
#endif

View File

@ -870,7 +870,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
}else{
// Here, it means MainChosenEntry->SubScreen != null, but MainChosenEntry->SubScreen->Entries.size() == 0.
// This is a technical bug. GraphicsMenuStyle would crash.
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("A sub menu doesn't have any entries");
#else
MenuExit = 0; // loop on main menu

View File

@ -144,10 +144,10 @@ public:
{
if ( includeHidden ) return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::operator [] (nIndex);
if (nIndex < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("EntryArray::operator[] : i < 0. System halted\n");
#else
return 0;
return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(0);
#endif
}
size_t size = 0;
@ -158,10 +158,10 @@ public:
}
}
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("EntryArray::operator[] nIndex > size()");
#else
return 0;
return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(0);
#endif
}
@ -171,10 +171,10 @@ public:
{
if ( includeHidden ) return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::operator [] (nIndex);
if (nIndex < 0) {
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("EntryArray::operator[] : i < 0. System halted\n");
#else
return 0;
return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(0);
#endif
}
size_t size = 0;
@ -184,10 +184,10 @@ public:
size++;
}
}
#ifdef DEBUG
#ifdef JIEF_DEBUG
panic("EntryArray::operator[] nIndex > size()");
#else
return 0;
return XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(0);
#endif
}
@ -268,7 +268,7 @@ public:
template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
void moveBefore(IntegralType1 idxFrom, IntegralType2 idxTo)
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if (idxFrom < 0) panic("EntryArray::move(IntegralType1, IntegralType2) : idxFrom < 0. System halted\n");
if ((unsigned_type(IntegralType1))idxFrom >= XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::size()) panic("EntryArray::move(IntegralType1, IntegralType2) : idxFrom > size(). System halted\n");
if (idxTo < 0) panic("EntryArray::move(IntegralType1, IntegralType2) : idxTo < 0. System halted\n");
@ -293,7 +293,7 @@ public:
template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
void moveAfter(IntegralType1 idxFrom, IntegralType2 idxTo)
{
#ifdef DEBUG
#ifdef JIEF_DEBUG
if (idxFrom < 0) panic("EntryArray::move(IntegralType1, IntegralType2) : idxFrom < 0. System halted\n");
if ((unsigned_type(IntegralType1))idxFrom >= XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::size()) panic("EntryArray::move(IntegralType1, IntegralType2) : idxFrom > size(). System halted\n");
if (idxTo < 0) panic("EntryArray::move(IntegralType1, IntegralType2) : idxTo < 0. System halted\n");

View File

@ -4736,7 +4736,7 @@ static unsigned readChunk_iCCP(LodePNGInfo* info, const LodePNGDecompressSetting
if(!error) {
if(decoded.size) {
info->iccp_profile_size = (__typeof__(info->iccp_profile_size))decoded.size; // Unsafe cast
#ifdef DEBUG
#ifdef JIEF_DEBUG
if ( info->iccp_profile_size != decoded.size ) panic("info->iccp_profile_size != decoded.size"); // Check the cast
#else
if ( info->iccp_profile_size != decoded.size ) return 100; /*invalid ICC profile size*/

View File

@ -822,7 +822,7 @@ void LOADER_ENTRY::StartLoader()
// EFI_HANDLE Interface = NULL;
// Status = gBS->LocateProtocol(&gAptioMemoryFixProtocolGuid, NULL, &Interface );
// if ( !EFI_ERROR(Status) ) {
//#ifdef DEBUG
//#ifdef JIEF_DEBUG
// panic("Remove AptioMemoryFix.efi and OcQuirks.efi from your driver folder\n");
//#else
// DBG("Remove AptioMemoryFix.efi and OcQuirks.efi from your driver folder\n");