Release: 1.1
[udpgate.git] / src / bundle.pl
index fdd252b..1659f6f 100755 (executable)
@@ -24,6 +24,8 @@ use strict;
 use warnings;
 
 use File::Basename;
+no utf8;
+use bytes;     # REQUIRED
 
 
 print <<"EOH";
@@ -42,6 +44,7 @@ print <<"EOH";
 GHashTable *bundle_hash_new(void)
 {
 static GHashTable *hash;
+/* Prefixed 32-bit network byte order file length. */
 EOH
 my @files;
 for my $pathname (@ARGV) {
@@ -57,6 +60,9 @@ for my $pathname (@ARGV) {
                        "filename"    =>$filename,
                        "filename_sym"=>$filename_sym,
                        };
+       # Do not: pack("N",length($F)).$F
+       # as there would be utf8 encoding hassle.
+       $F=pack("Na*",length($F),$F);   # Prefix 32-bit network byte order file length.
        my $Fout=unpack "H*",$F;
        $Fout=~s/../0x$&,/g;
        $Fout=~s/(?:.....){1,16}/\t\t$&\n/g;