From 830963c0a00b9cbb0a54e118cfb3c3f4b3cbec7c Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Wed, 5 Aug 2015 09:24:11 -0400 Subject: [PATCH] fix some bugs --- aaae.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/aaae.rb b/aaae.rb index 4175490..97c0539 100644 --- a/aaae.rb +++ b/aaae.rb @@ -37,15 +37,16 @@ def output_bytes(name, data) tmp.each_byte {|b| print " " if index == 0 - printf("%02x, ", b) + printf("0x%02x, ", b) index = index + 1 - if index == 16 + if index == 8 print "\n" index = 0 end } - print "\n" if index > 0 + puts "0x00\n" + #print "\n" if index > 0 puts "};" end @@ -66,10 +67,10 @@ def output_strings(name, data) data.each {|x| # escape \ - x = x.gsub(/\\/, '\\') + x = x.gsub(/([\\"])/) {|m| '\\' + m } # escape " - x = x.gsub(/"/, '\"') + #x = x.gsub(/"/, '\"') # escape chars... # unfortunately, \x doesn't have a length limit so