]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
clarify the logic of the print length counting functions in both PrintLib library...
[mirror_edk2.git] / MdeModulePkg / Library / DxePrintLibPrint2Protocol / PrintLib.c
index a239dee2cceaf9a533255a9faf1e28a5eae46293..45aab49176894cd162c7a66c2d27114235bd6c95 100644 (file)
@@ -1660,38 +1660,18 @@ InternalPrintLibSPrintMarker (
     // Pad before the string\r
     //\r
     if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {\r
-      if (Flags & COUNT_ONLY_NO_PRINT) {\r
-        LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);\r
-      } else {\r
-//        Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
-      }\r
+      LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);\r
     }\r
 \r
     if (ZeroPad) {\r
       if (Prefix != 0) {\r
-        if (Flags & COUNT_ONLY_NO_PRINT) {\r
-          LengthToReturn += (1 * BytesPerOutputCharacter);\r
-        } else {\r
-//          Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);\r
-        }\r
-      }\r
-      if (Flags & COUNT_ONLY_NO_PRINT) {\r
-        LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);\r
-      } else {\r
-//        Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, '0', BytesPerOutputCharacter);\r
+        LengthToReturn += (1 * BytesPerOutputCharacter);\r
       }\r
+      LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);\r
     } else {\r
-      if (Flags & COUNT_ONLY_NO_PRINT) {\r
-        LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);\r
-      } else {\r
-//        Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, ' ', BytesPerOutputCharacter);\r
-      }\r
+      LengthToReturn += ((Precision - Count) * BytesPerOutputCharacter);\r
       if (Prefix != 0) {\r
-        if (Flags & COUNT_ONLY_NO_PRINT) {\r
-          LengthToReturn += (1 * BytesPerOutputCharacter);\r
-        } else {\r
-//          Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);\r
-        }\r
+        LengthToReturn += (1 * BytesPerOutputCharacter);\r
       }\r
     }\r
 \r
@@ -1709,11 +1689,7 @@ InternalPrintLibSPrintMarker (
     while (Index < Count) {\r
       ArgumentCharacter = ((*ArgumentString & 0xff) | (*(ArgumentString + 1) << 8)) & ArgumentMask;\r
 \r
-      if (Flags & COUNT_ONLY_NO_PRINT) {\r
-        LengthToReturn += (1 * BytesPerOutputCharacter);\r
-      } else {\r
-//        Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ArgumentCharacter, BytesPerOutputCharacter);\r
-      }\r
+      LengthToReturn += (1 * BytesPerOutputCharacter);\r
       ArgumentString    += BytesPerArgumentCharacter;\r
       Index++;\r
       if (Comma) {\r
@@ -1722,11 +1698,7 @@ InternalPrintLibSPrintMarker (
           Digits = 0;\r
           Index++;\r
           if (Index < Count) {\r
-            if (Flags & COUNT_ONLY_NO_PRINT) {\r
-              LengthToReturn += (1 * BytesPerOutputCharacter);\r
-            } else {\r
-//              Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', BytesPerOutputCharacter);\r
-            }\r
+            LengthToReturn += (1 * BytesPerOutputCharacter);\r
           }\r
         }\r
       }\r
@@ -1736,11 +1708,7 @@ InternalPrintLibSPrintMarker (
     // Pad after the string\r
     //\r
     if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {\r
-      if (Flags & COUNT_ONLY_NO_PRINT) {\r
-        LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);\r
-      } else {\r
-//        Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
-      }\r
+      LengthToReturn += ((Width - Precision) * BytesPerOutputCharacter);\r
     }\r
 \r
     //\r