From a382ea7c1fd1cb984abf5c16d32568630eb3b25d Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 2 Dec 2023 17:59:43 -0500 Subject: [PATCH] LibGfx/TIFF: Consider ASCII and UTF-8 as containers The generator will now create APIs that return a single `String` instead of a `Vector`. --- Userland/Libraries/LibGfx/TIFFGenerator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/TIFFGenerator.py b/Userland/Libraries/LibGfx/TIFFGenerator.py index 5d8e4e129b..d8fa0ba437 100755 --- a/Userland/Libraries/LibGfx/TIFFGenerator.py +++ b/Userland/Libraries/LibGfx/TIFFGenerator.py @@ -104,6 +104,8 @@ def tiff_type_to_cpp(t: TIFFType, without_promotion: bool = False) -> str: # Note that the Value<> type doesn't include u16 for this reason if not without_promotion: t = promote_type(t) + if t in [TIFFType.ASCII, TIFFType.UTF8]: + return 'String' if t == TIFFType.Undefined: return 'ByteBuffer' if t == TIFFType.UnsignedShort: @@ -119,7 +121,7 @@ def is_container(t: TIFFType) -> bool: An example of that are ASCII strings defined as N * byte. Let's intercept that and generate a nice API instead of Vector. """ - return t in [TIFFType.Byte, TIFFType.Undefined] + return t in [TIFFType.ASCII, TIFFType.Byte, TIFFType.Undefined, TIFFType.UTF8] def export_promoter() -> str: