genlang: Correct the 'size' in the binary vstrings sub-header

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 24220d13e5abe732229f3f93fb0ba7c3713f7e39
Author: Solomon Peachy <[email protected]>
Date:   Tue Jan 6 23:06:47 2026 -0500

    genlang:  Correct the 'size' in the binary vstrings sub-header
    
    It was only taking into account LANG_* strings, and ignoring VOICE_*
    
    Fortunately rbutil currently ignores this field as it's not needed.
    
    Change-Id: If58230cd047abe7a80ebab7eca9147e510b034ea

diff --git a/tools/genlang b/tools/genlang
index 95762a9217..378ed7c154 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -617,21 +617,31 @@ elsif($binary || $binvoice) {
     }
 
     # output the number of strings for each user
-    my $foffset = $HEADER_SIZE + $SUBHEADER_SIZE * keys(%users);
+    my $foffsetb = $HEADER_SIZE + $SUBHEADER_SIZE * keys(%users);
+    my $foffsetv = $HEADER_SIZE + $SUBHEADER_SIZE * keys(%users);
     for (keys %users) {
-        my $size;
-        for $n (0 .. $idcount[$_]-1) {
-            $size += length(trim($dest{$idnum[$_][$n]})) + 1;
-        }
         if($binary) {
+	    my $sizeb = 0;
+	    for $n (0 .. $idcount[$_]-1) {
+		$sizeb += length(trim($dest{$idnum[$_][$n]})) + 1;
+	    }
+
             printf OUTF ("%c%c%c%c%c%c", ($idcount[$_] >> 8), ($idcount[$_] & 0xff),
-                ($size >> 8), ($size & 0xff), ($foffset >> 8), ($foffset & 0xff));
+			 ($sizeb >> 8), ($sizeb & 0xff), ($foffsetb >> 8), ($foffsetb & 0xff));
+	    $foffsetb += $sizeb;
         }
         if($binvoice) {
+	    my $sizev = 0;
+	    for $n (0 .. $idcount[$_]-1) {
+		$sizev += length(trim($voice{$idnum[$_][$n]})) + 1;
+	    }
+	    for $n (0x8001 .. $voiceid[$_]-1) {
+		$sizev += length(trim($voice{$idnum[$_][$n]})) + 1;
+	    }
             printf OUTV ("%c%c%c%c%c%c", ($idcount[$_] >> 8), ($idcount[$_] & 0xff),
-                ($size >> 8), ($size & 0xff), ($foffset >> 8), ($foffset & 0xff));
+			 ($sizev >> 8), ($sizev & 0xff), ($foffsetv >> 8), ($foffsetv & 0xff));
+	    $foffsetv += $sizev;
         }
-        $foffset += $size;
     }
 
     for (keys %users) {
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.