]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/BrotliCompress/enc/utf8_util.c
BaseTools: Update Brotli Compress to the latest one 1.0.6
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / enc / utf8_util.c
index c963f306faa0ca42c2606888d7c95d44943ceb88..9d21aa9fa3ed1c79d03ed6da7d6dd65efd5aabe5 100644 (file)
@@ -8,7 +8,7 @@
 \r
 #include "./utf8_util.h"\r
 \r
-#include "../common/types.h"\r
+#include <brotli/types.h>\r
 \r
 #if defined(__cplusplus) || defined(c_plusplus)\r
 extern "C" {\r
@@ -25,37 +25,37 @@ static size_t BrotliParseAsUTF8(
   }\r
   /* 2-byte UTF8 */\r
   if (size > 1u &&\r
-      (input[0] & 0xe0) == 0xc0 &&\r
-      (input[1] & 0xc0) == 0x80) {\r
-    *symbol = (((input[0] & 0x1f) << 6) |\r
-               (input[1] & 0x3f));\r
-    if (*symbol > 0x7f) {\r
+      (input[0] & 0xE0) == 0xC0 &&\r
+      (input[1] & 0xC0) == 0x80) {\r
+    *symbol = (((input[0] & 0x1F) << 6) |\r
+               (input[1] & 0x3F));\r
+    if (*symbol > 0x7F) {\r
       return 2;\r
     }\r
   }\r
   /* 3-byte UFT8 */\r
   if (size > 2u &&\r
-      (input[0] & 0xf0) == 0xe0 &&\r
-      (input[1] & 0xc0) == 0x80 &&\r
-      (input[2] & 0xc0) == 0x80) {\r
-    *symbol = (((input[0] & 0x0f) << 12) |\r
-               ((input[1] & 0x3f) << 6) |\r
-               (input[2] & 0x3f));\r
-    if (*symbol > 0x7ff) {\r
+      (input[0] & 0xF0) == 0xE0 &&\r
+      (input[1] & 0xC0) == 0x80 &&\r
+      (input[2] & 0xC0) == 0x80) {\r
+    *symbol = (((input[0] & 0x0F) << 12) |\r
+               ((input[1] & 0x3F) << 6) |\r
+               (input[2] & 0x3F));\r
+    if (*symbol > 0x7FF) {\r
       return 3;\r
     }\r
   }\r
   /* 4-byte UFT8 */\r
   if (size > 3u &&\r
-      (input[0] & 0xf8) == 0xf0 &&\r
-      (input[1] & 0xc0) == 0x80 &&\r
-      (input[2] & 0xc0) == 0x80 &&\r
-      (input[3] & 0xc0) == 0x80) {\r
+      (input[0] & 0xF8) == 0xF0 &&\r
+      (input[1] & 0xC0) == 0x80 &&\r
+      (input[2] & 0xC0) == 0x80 &&\r
+      (input[3] & 0xC0) == 0x80) {\r
     *symbol = (((input[0] & 0x07) << 18) |\r
-               ((input[1] & 0x3f) << 12) |\r
-               ((input[2] & 0x3f) << 6) |\r
-               (input[3] & 0x3f));\r
-    if (*symbol > 0xffff && *symbol <= 0x10ffff) {\r
+               ((input[1] & 0x3F) << 12) |\r
+               ((input[2] & 0x3F) << 6) |\r
+               (input[3] & 0x3F));\r
+    if (*symbol > 0xFFFF && *symbol <= 0x10FFFF) {\r
       return 4;\r
     }\r
   }\r