skin_parser: Fix build warnings when included in the theme editor

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sun, 5 Jul 2026 13:57:48 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 0d5afa6d66d6d75346751cf8e7aabc3319914eb6
Author: Solomon Peachy <[email protected]>
Date:   Sun Jul 5 13:53:31 2026 -0400

    skin_parser:  Fix build warnings when included in the theme editor
    
    skin_buffer_to_offset() call can never return a "negative" pointer
    (since it just returns the pointer as-is) so don't bother to check.
    
    Change-Id: Id86d53abd7ab1fb071ca54421ebe3b5ff2981c02

diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 0da0528858..0c148ba969 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -465,8 +465,10 @@ static struct skin_element* skin_parse_sublines_optional(const char** document,
     for(i = 0; i < sublines; i++)
     {
         children[i] = skin_buffer_to_offset(skin_parse_line_optional(&cursor, conditional));
+#ifdef OFFSETYYPE_OFFSET
         if (children[i] < 0)
             return NULL;
+#endif
         skip_whitespace(&cursor);
 
         if(*cursor != MULTILINESYM && i != sublines - 1)
@@ -755,8 +757,10 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
             /* Recursively parsing a code argument */
             params[i].type = CODE;
             params[i].data.code = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor));
+#ifdef OFFSETTYPE_OFFSET
             if(params[i].data.code < 0)
                 return 0;
+#endif
         }
         else if (tolower(type_code) == 't')
         {
@@ -874,8 +878,10 @@ static int skin_parse_text(struct skin_element* element, const char** document,
     element->next = skin_buffer_to_offset(NULL);
     text = skin_alloc_string(length);
     element->data = skin_buffer_to_offset(text);
+#ifdef OFFSETTYPE_OFFSET
     if (element->data < 0)
         return 0;
+#endif
 
     for(dest = 0; dest < length; dest++)
     {
@@ -1026,8 +1032,10 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
                 cursor++;
             }
             children_array[i] = skin_buffer_to_offset(skin_parse_code_as_arg(&cursor));
+#ifdef OFFSETTYPE_OFFSET
             if (children_array[i] < 0)
                 return 0;
+#endif
             skip_whitespace(&cursor);
 #ifdef ROCKBOX
             if ((element->tag->flags&FEATURE_TAG) && feature_available)
diff --git a/lib/skin_parser/skin_parser.h b/lib/skin_parser/skin_parser.h
index 095c3021e2..e671754e89 100644
--- a/lib/skin_parser/skin_parser.h
+++ b/lib/skin_parser/skin_parser.h
@@ -52,6 +52,7 @@ typedef long skinoffset_t;
  * do what you expect.
  */
 #define OFFSETTYPE(type) skinoffset_t
+#define OFFSETTYPE_OFFSET
 #else
 #define SKINOFFSETTOPTR(base, offset) offset
 #define PTRTOSKINOFFSET(base, pointer) pointer
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs