From be3dece5af1ec2bb063298226aeffef1add88a02 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 27 Oct 2016 21:48:46 +0200 Subject: [PATCH] Allow emission of strings containing ". --- mach/proto/mcg/data.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mach/proto/mcg/data.c b/mach/proto/mcg/data.c index 38525b724..6b6fc084f 100644 --- a/mach/proto/mcg/data.c +++ b/mach/proto/mcg/data.c @@ -74,6 +74,11 @@ void data_float(const char* data, size_t size, bool is_ro) fprintf(outputfile, "\n"); } +static bool istext(c) +{ + return isprint(c) && (c != '"'); +} + void data_block(const uint8_t* data, size_t size, bool is_ro) { const uint8_t* start = data; @@ -85,7 +90,7 @@ void data_block(const uint8_t* data, size_t size, bool is_ro) start = p = data; while (p < end) { - while ((p < end) && isprint(*p)) + while ((p < end) && istext(*p)) p++; if (start < p) @@ -99,7 +104,7 @@ void data_block(const uint8_t* data, size_t size, bool is_ro) fprintf(outputfile, "\"\n"); } - while ((p < end) && !isprint(*p)) + while ((p < end) && !istext(*p)) p++; if (start < p) -- 2.34.1