Use flags instead of dozen variables

This commit is contained in:
Rafal Kupiec 2024-02-18 13:37:17 +01:00
parent 2dd4048416
commit 246968045a
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 68 additions and 68 deletions

View File

@ -25,6 +25,23 @@
#define DOUBLE_EXPONENT_SHIFT 0x34 #define DOUBLE_EXPONENT_SHIFT 0x34
#define DOUBLE_EXPONENT_BIAS 0x3FF #define DOUBLE_EXPONENT_BIAS 0x3FF
/* Print flag definitions */
#define PFL_ALWAYS_PRINT_SIGN 0x00000001
#define PFL_SPACE_FOR_PLUS 0x00000002
#define PFL_LEFT_JUSTIFIED 0x00000004
#define PFL_LEADING_ZEROES 0x00000008
#define PFL_LONG_INTEGER 0x00000010
#define PFL_LONG_DOUBLE 0x00000020
#define PFL_WIDE_CHARACTER 0x00000040
#define PFL_SHORT_VALUE 0x00000080
#define PFL_UNSIGNED 0x00000100
#define PFL_UPPERCASE 0x00000200
#define PFL_PRINT_RADIX 0x00000400
#define PFL_FLOAT_FORMAT 0x00000800
#define PFL_SCI_FORMAT 0x00001000
#define PFL_DIGIT_PRECISION 0x00002000
#define PFL_THOUSANDS_GROUPING 0x00004000
/* Runtime Library routine callbacks */ /* Runtime Library routine callbacks */
typedef XTSTATUS (*PWRITE_CHARACTER)(IN CHAR Character); typedef XTSTATUS (*PWRITE_CHARACTER)(IN CHAR Character);
typedef XTSTATUS (*PWRITE_WIDE_CHARACTER)(IN WCHAR Character); typedef XTSTATUS (*PWRITE_WIDE_CHARACTER)(IN WCHAR Character);
@ -61,19 +78,7 @@ typedef struct _RTL_PRINT_FORMAT_PROPERTIES
LONG FieldWidth; LONG FieldWidth;
LONG IntegerSize; LONG IntegerSize;
LONG Precision; LONG Precision;
BOOLEAN AlwaysPrintSign; LONG Flags;
BOOLEAN LongDouble;
BOOLEAN LongInteger;
BOOLEAN LeftJustified;
BOOLEAN PrintUpperCase;
BOOLEAN PrintLeadingZeroes;
BOOLEAN PrintRadix;
BOOLEAN SpaceForPlus;
BOOLEAN ThousandsGrouping;
BOOLEAN UnsignedValue;
BOOLEAN FloatFormat;
BOOLEAN ScientificFormat;
BOOLEAN SignificantDigitPrecision;
} RTL_PRINT_FORMAT_PROPERTIES, *PRTL_PRINT_FORMAT_PROPERTIES; } RTL_PRINT_FORMAT_PROPERTIES, *PRTL_PRINT_FORMAT_PROPERTIES;
#endif /* __XTDK_RTLTYPES_H */ #endif /* __XTDK_RTLTYPES_H */

View File

@ -567,32 +567,32 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
if(*FormatIndex == L'\'') if(*FormatIndex == L'\'')
{ {
/* Thousands grouping separator applied */ /* Thousands grouping separator applied */
FormatProperties.ThousandsGrouping = TRUE; FormatProperties.Flags |= PFL_THOUSANDS_GROUPING;
} }
else if(*FormatIndex == L'-') else if(*FormatIndex == L'-')
{ {
/* Left-align the output */ /* Left-align the output */
FormatProperties.LeftJustified = TRUE; FormatProperties.Flags |= PFL_LEFT_JUSTIFIED;
} }
else if(*FormatIndex == L' ') else if(*FormatIndex == L' ')
{ {
/* Prepend a space for positive signed-numeric types */ /* Prepend a space for positive signed-numeric types */
FormatProperties.SpaceForPlus = TRUE; FormatProperties.Flags |= PFL_SPACE_FOR_PLUS;
} }
else if(*FormatIndex == L'+') else if(*FormatIndex == L'+')
{ {
/* Prepend a plus for positive signed-numeric types */ /* Prepend a plus for positive signed-numeric types */
FormatProperties.AlwaysPrintSign = TRUE; FormatProperties.Flags |= PFL_ALWAYS_PRINT_SIGN;
} }
else if(*FormatIndex == L'#') else if(*FormatIndex == L'#')
{ {
/* Convert to an alternate form */ /* Convert to an alternate form */
FormatProperties.PrintRadix = TRUE; FormatProperties.Flags |= PFL_PRINT_RADIX;
} }
else if(*FormatIndex == L'0') else if(*FormatIndex == L'0')
{ {
/* Prepend zeros for numeric types */ /* Prepend zeros for numeric types */
FormatProperties.PrintLeadingZeroes = TRUE; FormatProperties.Flags |= PFL_LEADING_ZEROES;
} }
else else
{ {
@ -605,17 +605,17 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
} }
/* Check if output is left-justified */ /* Check if output is left-justified */
if(FormatProperties.LeftJustified) if(FormatProperties.Flags & PFL_LEFT_JUSTIFIED)
{ {
/* Left justified output can't have leading zeros */ /* Left justified output can't have leading zeros */
FormatProperties.PrintLeadingZeroes = FALSE; FormatProperties.Flags &= ~PFL_LEADING_ZEROES;
} }
/* Check if plus for positive signed-numeric types is enabled */ /* Check if plus for positive signed-numeric types is enabled */
if(FormatProperties.AlwaysPrintSign) if(FormatProperties.Flags & PFL_ALWAYS_PRINT_SIGN)
{ {
/* Do not append a space when plus character is enabled */ /* Do not append a space when plus character is enabled */
FormatProperties.SpaceForPlus = FALSE; FormatProperties.Flags &= ~PFL_SPACE_FOR_PLUS;
} }
/* Lookup width field */ /* Lookup width field */
@ -637,7 +637,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
if(FormatProperties.FieldWidth < 0) if(FormatProperties.FieldWidth < 0)
{ {
/* Force left-aligned output and turn field width into positive value */ /* Force left-aligned output and turn field width into positive value */
FormatProperties.LeftJustified = TRUE; FormatProperties.Flags |= PFL_LEFT_JUSTIFIED;
FormatProperties.FieldWidth *= -1; FormatProperties.FieldWidth *= -1;
} }
@ -681,11 +681,13 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
/* SHORT-sized integer argument */ /* SHORT-sized integer argument */
FormatIndex++; FormatIndex++;
FormatProperties.IntegerSize = sizeof(SHORT); FormatProperties.IntegerSize = sizeof(SHORT);
FormatProperties.Flags |= PFL_SHORT_VALUE;
if(*FormatIndex == L'h') if(*FormatIndex == L'h')
{ {
/* CHAR-sized integer argument */ /* CHAR-sized integer argument */
FormatIndex++; FormatIndex++;
FormatProperties.IntegerSize = sizeof(CHAR); FormatProperties.IntegerSize = sizeof(CHAR);
FormatProperties.Flags &= ~PFL_SHORT_VALUE;
} }
break; break;
case L'j': case L'j':
@ -696,16 +698,14 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'l': case L'l':
/* LONG-sized double/integer argument */ /* LONG-sized double/integer argument */
FormatIndex++; FormatIndex++;
FormatProperties.LongDouble = TRUE;
FormatProperties.LongInteger = TRUE;
FormatProperties.IntegerSize = sizeof(LONG); FormatProperties.IntegerSize = sizeof(LONG);
FormatProperties.Flags |= PFL_LONG_DOUBLE | PFL_LONG_INTEGER | PFL_WIDE_CHARACTER;
if(*FormatIndex == L'l') if(*FormatIndex == L'l')
{ {
/* LONGLONG-sized integer argument */ /* LONGLONG-sized integer argument */
FormatIndex++; FormatIndex++;
FormatProperties.LongDouble = FALSE;
FormatProperties.LongInteger = FALSE;
FormatProperties.IntegerSize = sizeof(LONGLONG); FormatProperties.IntegerSize = sizeof(LONGLONG);
FormatProperties.Flags &= ~(PFL_LONG_DOUBLE | PFL_LONG_INTEGER | PFL_WIDE_CHARACTER);
} }
break; break;
case L'q': case L'q':
@ -721,7 +721,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'w': case L'w':
/* MSVC extension: wide character or wide string argument */ /* MSVC extension: wide character or wide string argument */
FormatIndex++; FormatIndex++;
FormatProperties.LongInteger = TRUE; FormatProperties.Flags |= PFL_WIDE_CHARACTER;
break; break;
case L'z': case L'z':
/* SIZE_T-sized integer argument */ /* SIZE_T-sized integer argument */
@ -736,8 +736,8 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
{ {
/* MSVC extension: 32-bit (double word) integer argument */ /* MSVC extension: 32-bit (double word) integer argument */
FormatIndex += 2; FormatIndex += 2;
FormatProperties.LongInteger = TRUE;
FormatProperties.IntegerSize = sizeof(LONG); FormatProperties.IntegerSize = sizeof(LONG);
FormatProperties.Flags |= PFL_LONG_INTEGER;
} }
else if((*FormatIndex == L'6') && (*(FormatIndex + 1) == L'4')) else if((*FormatIndex == L'6') && (*(FormatIndex + 1) == L'4'))
{ {
@ -749,8 +749,8 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'L': case L'L':
/* LONG-sized double argument */ /* LONG-sized double argument */
FormatIndex++; FormatIndex++;
FormatProperties.LongDouble = TRUE;
FormatProperties.IntegerSize = sizeof(LDOUBLE); FormatProperties.IntegerSize = sizeof(LDOUBLE);
FormatProperties.Flags |= PFL_LONG_DOUBLE;
break; break;
} }
@ -758,7 +758,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
Specifier = *FormatIndex++; Specifier = *FormatIndex++;
/* Handle char and string modifiers */ /* Handle char and string modifiers */
if(FormatProperties.LongInteger) if(FormatProperties.Flags & PFL_WIDE_CHARACTER)
{ {
if(Specifier == L'c') if(Specifier == L'c')
{ {
@ -773,20 +773,19 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
} }
/* Lookup format specifier */ /* Lookup format specifier */
FormatProperties.UnsignedValue = TRUE; FormatProperties.Flags |= PFL_UNSIGNED;
switch(Specifier) switch(Specifier)
{ {
case L'a': case L'a':
/* Double argument as hexadecimal number (lowercase) */ /* Double argument as hexadecimal number (lowercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.ScientificFormat = TRUE; FormatProperties.Flags |= PFL_SCI_FORMAT;
FormatProperties.Radix = 16; FormatProperties.Radix = 16;
break; break;
case L'A': case L'A':
/* Double argument as hexadecimal number (uppercase) */ /* Double argument as hexadecimal number (uppercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.ScientificFormat = TRUE; FormatProperties.Flags |= PFL_SCI_FORMAT | PFL_UPPERCASE;
FormatProperties.PrintUpperCase = TRUE;
FormatProperties.Radix = 16; FormatProperties.Radix = 16;
break; break;
case L'b': case L'b':
@ -796,7 +795,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'B': case L'B':
/* XTOS extension: Boolean argument (uppercase) */ /* XTOS extension: Boolean argument (uppercase) */
FormatProperties.VariableType = Boolean; FormatProperties.VariableType = Boolean;
FormatProperties.PrintUpperCase = TRUE; FormatProperties.Flags |= PFL_UPPERCASE;
break; break;
case L'c': case L'c':
/* Character argument */ /* Character argument */
@ -810,41 +809,38 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'i': case L'i':
/* Signed integer argument as decimal number */ /* Signed integer argument as decimal number */
FormatProperties.VariableType = Integer; FormatProperties.VariableType = Integer;
FormatProperties.Flags &= ~PFL_UNSIGNED;
FormatProperties.Radix = 10; FormatProperties.Radix = 10;
FormatProperties.UnsignedValue = FALSE;
break; break;
case L'e': case L'e':
/* Double argument in scientific notation (lowercase) */ /* Double argument in scientific notation (lowercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.ScientificFormat = TRUE; FormatProperties.Flags |= PFL_SCI_FORMAT;
break; break;
case L'E': case L'E':
/* Double argument in scientific notation (uppercase) */ /* Double argument in scientific notation (uppercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.ScientificFormat = TRUE; FormatProperties.Flags |= PFL_SCI_FORMAT | PFL_UPPERCASE;
FormatProperties.PrintUpperCase = TRUE;
break; break;
case L'f': case L'f':
/* Double argument as floating point number (lowercase) */ /* Double argument as floating point number (lowercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.FloatFormat = TRUE; FormatProperties.Flags |= PFL_FLOAT_FORMAT;
break; break;
case L'F': case L'F':
/* Double argument as floating point number (uppercase) */ /* Double argument as floating point number (uppercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.FloatFormat = TRUE; FormatProperties.Flags |= PFL_FLOAT_FORMAT | PFL_UPPERCASE;
FormatProperties.PrintUpperCase = TRUE;
break; break;
case L'g': case L'g':
/* Double argument as either floating point number or in scientific notation (lowercase) */ /* Double argument as either floating point number or in scientific notation (lowercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.SignificantDigitPrecision = TRUE; FormatProperties.Flags |= PFL_DIGIT_PRECISION;
break; break;
case L'G': case L'G':
/* Double argument as either floating point number or in scientific notation (uppercase) */ /* Double argument as either floating point number or in scientific notation (uppercase) */
FormatProperties.VariableType = Float; FormatProperties.VariableType = Float;
FormatProperties.PrintUpperCase = TRUE; FormatProperties.Flags |= PFL_DIGIT_PRECISION | PFL_UPPERCASE;
FormatProperties.SignificantDigitPrecision = TRUE;
break; break;
case L'n': case L'n':
/* Write number of characters written so far into an integer pointer parameter */ /* Write number of characters written so far into an integer pointer parameter */
@ -860,16 +856,15 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
/* Pointer argument as hexadecimal number (lowercase) */ /* Pointer argument as hexadecimal number (lowercase) */
FormatProperties.VariableType = Integer; FormatProperties.VariableType = Integer;
FormatProperties.IntegerSize = sizeof(UINT_PTR); FormatProperties.IntegerSize = sizeof(UINT_PTR);
FormatProperties.Flags |= PFL_PRINT_RADIX;
FormatProperties.Radix = 16; FormatProperties.Radix = 16;
FormatProperties.PrintRadix = TRUE;
break; break;
case L'P': case L'P':
/* XTOS extension: Pointer argument as hexadecimal number (uppercase) */ /* XTOS extension: Pointer argument as hexadecimal number (uppercase) */
FormatProperties.VariableType = Integer; FormatProperties.VariableType = Integer;
FormatProperties.IntegerSize = sizeof(UINT_PTR); FormatProperties.IntegerSize = sizeof(UINT_PTR);
FormatProperties.Flags |= PFL_PRINT_RADIX | PFL_UPPERCASE;
FormatProperties.Radix = 16; FormatProperties.Radix = 16;
FormatProperties.PrintUpperCase = TRUE;
FormatProperties.PrintRadix = TRUE;
break; break;
case L's': case L's':
/* String argument */ /* String argument */
@ -891,7 +886,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'V': case L'V':
/* XTOS extension: UUID/GUID argument (uppercase) */ /* XTOS extension: UUID/GUID argument (uppercase) */
FormatProperties.VariableType = Guid; FormatProperties.VariableType = Guid;
FormatProperties.PrintUpperCase = TRUE; FormatProperties.Flags |= PFL_UPPERCASE;
break; break;
case L'x': case L'x':
/* Unsigned integer argument as hexadecimal number (lowercase) */ /* Unsigned integer argument as hexadecimal number (lowercase) */
@ -901,12 +896,12 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
case L'X': case L'X':
/* Unsigned integer argument as hexadecimal number (uppercase) */ /* Unsigned integer argument as hexadecimal number (uppercase) */
FormatProperties.VariableType = Integer; FormatProperties.VariableType = Integer;
FormatProperties.Flags |= PFL_UPPERCASE;
FormatProperties.Radix = 16; FormatProperties.Radix = 16;
FormatProperties.PrintUpperCase = TRUE;
break; break;
case L'Z': case L'Z':
/* MSVC extension: ANSI/Unicode string argument */ /* MSVC extension: ANSI/Unicode string argument */
FormatProperties.VariableType = FormatProperties.LongInteger ? UnicodeString : AnsiString; FormatProperties.VariableType = (FormatProperties.Flags & PFL_WIDE_CHARACTER) ? UnicodeString : AnsiString;
break; break;
case L'%': case L'%':
/* Print '%' character */ /* Print '%' character */
@ -941,7 +936,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
} }
/* Check if using uppercase format */ /* Check if using uppercase format */
if(FormatProperties.PrintUpperCase) if(FormatProperties.Flags & PFL_UPPERCASE)
{ {
/* Set uppercase boolean string depending on argument value */ /* Set uppercase boolean string depending on argument value */
WideStrArg = IntArg ? L"TRUE" : L"FALSE"; WideStrArg = IntArg ? L"TRUE" : L"FALSE";
@ -974,7 +969,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
if(GuidArg != NULL) if(GuidArg != NULL)
{ {
/* Check if using uppercase format */ /* Check if using uppercase format */
if(FormatProperties.PrintUpperCase) if(FormatProperties.Flags & PFL_UPPERCASE)
{ {
/* Use uppercase GUID format string */ /* Use uppercase GUID format string */
WideStrArg = L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; WideStrArg = L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
@ -1036,7 +1031,7 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
else else
{ {
/* Get argument value from the next argument, depending on its size */ /* Get argument value from the next argument, depending on its size */
if(FormatProperties.LongDouble) if(FormatProperties.Flags & PFL_LONG_DOUBLE)
{ {
FloatArg.DoublePart = VA_ARG(*ArgumentList, LDOUBLE); FloatArg.DoublePart = VA_ARG(*ArgumentList, LDOUBLE);
} }
@ -1407,7 +1402,7 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
Negative = FALSE; Negative = FALSE;
/* Check if this is signed integer */ /* Check if this is signed integer */
if(!FormatProperties->UnsignedValue) if(!(FormatProperties->Flags & PFL_UNSIGNED))
{ {
/* Check integer size and extend to signed value */ /* Check integer size and extend to signed value */
switch(FormatProperties->IntegerSize) switch(FormatProperties->IntegerSize)
@ -1428,14 +1423,14 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
if(Integer == 0) if(Integer == 0)
{ {
/* Cannot print radix if integer is zero */ /* Cannot print radix if integer is zero */
FormatProperties->PrintRadix = FALSE; FormatProperties->Flags &= ~PFL_PRINT_RADIX;
} }
/* Check if any of the integer value or precision is non-zero */ /* Check if any of the integer value or precision is non-zero */
if(Integer != 0 || FormatProperties->Precision != 0) if(Integer != 0 || FormatProperties->Precision != 0)
{ {
/* Check if the integer is negative */ /* Check if the integer is negative */
if(!FormatProperties->UnsignedValue && (LONGLONG)Integer < 0) if(!(FormatProperties->Flags & PFL_UNSIGNED) && (LONGLONG)Integer < 0)
{ {
/* Mark the integer as negative and turn it positive */ /* Mark the integer as negative and turn it positive */
Negative = TRUE; Negative = TRUE;
@ -1456,7 +1451,7 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
if(Character > 9) if(Character > 9)
{ {
/* Check if the character should be upper case */ /* Check if the character should be upper case */
if(FormatProperties->PrintUpperCase) if(FormatProperties->Flags & PFL_UPPERCASE)
{ {
/* Get the uppercase character */ /* Get the uppercase character */
Character = Character - 10 + L'A'; Character = Character - 10 + L'A';
@ -1488,19 +1483,19 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
/* Handle the sign decoration */ /* Handle the sign decoration */
PrefixLength = 0; PrefixLength = 0;
if(!FormatProperties->UnsignedValue && Negative) if(!(FormatProperties->Flags & PFL_UNSIGNED) && Negative)
{ {
/* Signed negative value, write '-' character */ /* Signed negative value, write '-' character */
Prefix[PrefixLength] = L'-'; Prefix[PrefixLength] = L'-';
PrefixLength += 1; PrefixLength += 1;
} }
else if(FormatProperties->AlwaysPrintSign) else if(FormatProperties->Flags & PFL_ALWAYS_PRINT_SIGN)
{ {
/* Write '+' character for positive value */ /* Write '+' character for positive value */
Prefix[PrefixLength] = L'+'; Prefix[PrefixLength] = L'+';
PrefixLength += 1; PrefixLength += 1;
} }
else if(FormatProperties->SpaceForPlus) else if(FormatProperties->Flags & PFL_SPACE_FOR_PLUS)
{ {
/* Write ' ' character for positive value */ /* Write ' ' character for positive value */
Prefix[PrefixLength] = L' '; Prefix[PrefixLength] = L' ';
@ -1508,7 +1503,7 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
} }
/* Handle the radix decoration */ /* Handle the radix decoration */
if(FormatProperties->PrintRadix) if(FormatProperties->Flags & PFL_PRINT_RADIX)
{ {
if(FormatProperties->Radix == 8) if(FormatProperties->Radix == 8)
{ {
@ -1548,10 +1543,10 @@ RtlpWriteWideStringIntegerValue(IN PRTL_PRINT_CONTEXT Context,
} }
/* Check if leading zero padding is required and if field is left aligned */ /* Check if leading zero padding is required and if field is left aligned */
if(!FormatProperties->LeftJustified || FormatProperties->PrintLeadingZeroes) if(!(FormatProperties->Flags & PFL_LEFT_JUSTIFIED) || (FormatProperties->Flags & PFL_LEADING_ZEROES))
{ {
Character = L' '; Character = L' ';
if(FormatProperties->PrintLeadingZeroes) if(FormatProperties->Flags & PFL_LEADING_ZEROES)
{ {
/* Write leading zero padding characters */ /* Write leading zero padding characters */
Character = L'0'; Character = L'0';
@ -1691,7 +1686,7 @@ RtlpWriteWideStringStringValue(PRTL_PRINT_CONTEXT Context,
} }
/* Check is left side padding is required */ /* Check is left side padding is required */
if(!FormatProperties->LeftJustified) if(!(FormatProperties->Flags & PFL_LEFT_JUSTIFIED))
{ {
/* Pad left */ /* Pad left */
while(PaddingLength > 0) while(PaddingLength > 0)
@ -1801,7 +1796,7 @@ RtlpWriteWideStringValue(PRTL_PRINT_CONTEXT Context,
/* Check is left side padding is required */ /* Check is left side padding is required */
if(!FormatProperties->LeftJustified) if(!(FormatProperties->Flags & PFL_LEFT_JUSTIFIED))
{ {
/* Pad left */ /* Pad left */
while(PaddingLength > 0) while(PaddingLength > 0)