Increase source portability by replace the use of EFI_STATUS_CODE_DATA_MAX_SIZE with sizeof(Buffer)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8435 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2009-06-01 22:41:57 +00:00
parent b088ba369e
commit 1ca88083d4
3 changed files with 19 additions and 19 deletions

View File

@ -78,12 +78,12 @@ DebugPrint (
// //
// If the TotalSize is larger than the maximum record size, then ASSERT() // If the TotalSize is larger than the maximum record size, then ASSERT()
// //
ASSERT (TotalSize <= EFI_STATUS_CODE_DATA_MAX_SIZE); ASSERT (TotalSize <= sizeof (Buffer));
// //
// If the TotalSize is larger than the maximum record size, then return // If the TotalSize is larger than the maximum record size, then return
// //
if (TotalSize > EFI_STATUS_CODE_DATA_MAX_SIZE) { if (TotalSize > sizeof (Buffer)) {
return; return;
} }
@ -259,7 +259,7 @@ DebugAssert (
FileNameLength = AsciiStrLen (FileName); FileNameLength = AsciiStrLen (FileName);
DescriptionLength = AsciiStrLen (Description); DescriptionLength = AsciiStrLen (Description);
TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA) + FileNameLength + 1 + DescriptionLength + 1; TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA) + FileNameLength + 1 + DescriptionLength + 1;
if (TotalSize <= EFI_STATUS_CODE_DATA_MAX_SIZE) { if (TotalSize <= sizeof (Buffer)) {
// //
// Fill in EFI_DEBUG_ASSERT_DATA // Fill in EFI_DEBUG_ASSERT_DATA
// //

View File

@ -62,7 +62,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"\n\rPEI_ASSERT!: %a (%d): %a\n\r", "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
Filename, Filename,
LineNumber, LineNumber,
@ -75,7 +75,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiBSPrint ( CharCount = AsciiBSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
Format, Format,
Marker Marker
); );
@ -85,7 +85,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"ERROR: C%x:V%x I%x", "ERROR: C%x:V%x I%x",
CodeType, CodeType,
Value, Value,
@ -95,7 +95,7 @@ SerialStatusCodeReportWorker (
if (CallerId != NULL) { if (CallerId != NULL) {
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
" %g", " %g",
CallerId CallerId
); );
@ -104,7 +104,7 @@ SerialStatusCodeReportWorker (
if (Data != NULL) { if (Data != NULL) {
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
" %x", " %x",
Data Data
); );
@ -112,7 +112,7 @@ SerialStatusCodeReportWorker (
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
"\n\r" "\n\r"
); );
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) { } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
@ -121,7 +121,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"PROGRESS CODE: V%x I%x\n\r", "PROGRESS CODE: V%x I%x\n\r",
Value, Value,
Instance Instance
@ -132,7 +132,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"Undefined: C%x:V%x I%x\n\r", "Undefined: C%x:V%x I%x\n\r",
CodeType, CodeType,
Value, Value,

View File

@ -96,7 +96,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"\n\rDXE_ASSERT!: %a (%d): %a\n\r", "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
Filename, Filename,
LineNumber, LineNumber,
@ -109,7 +109,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiBSPrint ( CharCount = AsciiBSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
Format, Format,
Marker Marker
); );
@ -119,7 +119,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"ERROR: C%x:V%x I%x", "ERROR: C%x:V%x I%x",
CodeType, CodeType,
Value, Value,
@ -129,7 +129,7 @@ SerialStatusCodeReportWorker (
if (CallerId != NULL) { if (CallerId != NULL) {
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
" %g", " %g",
CallerId CallerId
); );
@ -138,7 +138,7 @@ SerialStatusCodeReportWorker (
if (Data != NULL) { if (Data != NULL) {
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
" %x", " %x",
Data Data
); );
@ -146,7 +146,7 @@ SerialStatusCodeReportWorker (
CharCount += AsciiSPrint ( CharCount += AsciiSPrint (
&Buffer[CharCount - 1], &Buffer[CharCount - 1],
(EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)), (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
"\n\r" "\n\r"
); );
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) { } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
@ -155,7 +155,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"PROGRESS CODE: V%x I%x\n\r", "PROGRESS CODE: V%x I%x\n\r",
Value, Value,
Instance Instance
@ -166,7 +166,7 @@ SerialStatusCodeReportWorker (
// //
CharCount = AsciiSPrint ( CharCount = AsciiSPrint (
Buffer, Buffer,
EFI_STATUS_CODE_DATA_MAX_SIZE, sizeof (Buffer),
"Undefined: C%x:V%x I%x\n\r", "Undefined: C%x:V%x I%x\n\r",
CodeType, CodeType,
Value, Value,