diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-10-22 20:03:34 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-10-23 09:12:22 +0800 |
commit | 35486e7990178a44939a36f882a66c09bcf0ce6a (patch) | |
tree | 9bac2f5f8da7911d76d9eca7ddd1960c89e352b4 /gdk/broadway | |
parent | 7b6a6c9421b6e4e8aa974f28eaf54a63f3f9c90b (diff) | |
download | gtk+-35486e7990178a44939a36f882a66c09bcf0ce6a.tar.gz |
gdk/broadway/toarray.pl: 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.
https://bugzilla.gnome.org/show_bug.cgi?id=739001
Diffstat (limited to 'gdk/broadway')
-rwxr-xr-x | gdk/broadway/toarray.pl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gdk/broadway/toarray.pl b/gdk/broadway/toarray.pl index b8cdb6fdf6..ac8b5ff3b7 100755 --- a/gdk/broadway/toarray.pl +++ b/gdk/broadway/toarray.pl @@ -1,17 +1,22 @@ #!/usr/bin/perl -w my $ARRAYNAME = $ARGV[0]; -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"; |