This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] Implement BOM recognition



+ -- UTF-16 (little-endian) + + elsif Str'Length >= 2 + and then Str (Str'First) = Character'Val (16#FF#) + and then Str (Str'First + 1) = Character'Val (16#FE#) + then + Len := 2; + BOM := UTF16_LE;

...

+      --  UTF-32 (little-endian)
+
+      elsif Str'Length >= 4
+        and then Str (Str'First)     = Character'Val (16#FF#)
+        and then Str (Str'First + 1) = Character'Val (16#FE#)
+        and then Str (Str'First + 2) = Character'Val (16#00#)
+        and then Str (Str'First + 3) = Character'Val (16#00#)
+      then
+         Len := 4;
+         BOM := UTF32_LE;

It seems to me that the second case will never match. UTF-32 tests should be performed first.


Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]