Commit 35486e79 authored by Chun-wei Fan's avatar Chun-wei Fan

gdk/broadway/ Fix Code Generation for MSVC

The current implementation of this script generate headers with \x-escaped
strings that can become too long (> 65535 characters) for Visual Studio
to consume, hence the build of broadwayd would break on Visual Studio.

This changes the script to instead format the string as an array of hex
characters, not unlike what GResource does, so that builds can continue as
normal on Visual Studio builds as well.
parent 7b6a6c94
#!/usr/bin/perl -w
print "static const char $ARRAYNAME\[\] = \"";
my $first = 0;
print "static const char $ARRAYNAME\[\] = {";
for ($i = 1; $i <= $#ARGV; $i = $i + 1) {
my $FILENAME = $ARGV[$i];
open FILE, $FILENAME or die "Cannot open $FILENAME";
while (my $line = <FILE>) {
foreach my $c (split //, $line) {
printf ("\\x%02x", ord ($c));
if ($first == 1) {
printf (",\n");
printf ("0x%02x", ord ($c));
$first = 1;
print "\";\n";
print "};\n";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment