[gimp/gimp-2-8] Bug 765685: Disambiguates octal-escaped output in c-source image output
- From: João Sebastião de Oliveira Bueno Calligaris <jsbueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 765685: Disambiguates octal-escaped output in c-source image output
- Date: Thu, 28 Apr 2016 03:19:33 +0000 (UTC)
commit fee9dc252bee58e8fe79baecc7a4da703883cd8c
Author: João S. O. Bueno <gwidion gmail com>
Date: Wed Apr 27 23:46:19 2016 -0300
Bug 765685: Disambiguates octal-escaped output in c-source image output
Fixes the plug-in output to render decimal digit
characters as octal escaped, so they can't be acidentally
combined in preceding escaped sequences. (i.e. the sequence
of values '255, 49' is now rendered as '\377\049' instead of
'\3771')
Thanks Steve Baker for noticing and reporting the issue.
plug-ins/common/file-csource.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c
index aa6dd04..52ae5a4 100644
--- a/plug-ins/common/file-csource.c
+++ b/plug-ins/common/file-csource.c
@@ -349,9 +349,9 @@ save_uchar (FILE *fp,
c = 2;
}
}
- if (d < 33 || d > 126)
+ if (d < 33 || (d >= 48 && d <= 57) || d > 126)
{
- fprintf (fp, "\\%o", d);
+ fprintf (fp, "\\%03o", d);
c += 1 + 1 + (d > 7) + (d > 63);
pad = d < 64;
@@ -599,7 +599,7 @@ save_image (Config *config,
fprintf (fp, "\\b");
else if (*p == '\f')
fprintf (fp, "\\f");
- else if (*p >= 32 && *p <= 126)
+ else if (( *p >= 32 && *p <= 47 ) || (*p >= 58 && *p <= 126))
fprintf (fp, "%c", *p);
else
fprintf (fp, "\\%03o", *p);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]