[dia] vdx: adapt <ForeignData/> attributes and content
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] vdx: adapt <ForeignData/> attributes and content
- Date: Sun, 31 Aug 2014 18:17:47 +0000 (UTC)
commit b2a834360a0ea79be6970c9f27d7ae1b319e757e
Author: Hans Breuer <hans breuer org>
Date: Sun Aug 31 19:30:22 2014 +0200
vdx: adapt <ForeignData/> attributes and content
At least LibreOffice 4.2.4.2 is not happy with the padding
after base64 data, not even with the linebreak following. See:
https://bugs.freedesktop.org/show_bug.cgi?id=83275
The change in lib/prop_pixbuf.c to not put a linebreak into
the base64 data will have effect on other output as well,
but the tag directly following should not be a problem
anywhere.
lib/prop_pixbuf.c | 2 +-
plug-ins/vdx/vdx-xml.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/lib/prop_pixbuf.c b/lib/prop_pixbuf.c
index b51e243..a52d251 100644
--- a/lib/prop_pixbuf.c
+++ b/lib/prop_pixbuf.c
@@ -202,7 +202,7 @@ pixbuf_encode_base64 (const GdkPixbuf *pixbuf)
/* g_base64_encode_close ... [needs] up to 5 bytes if line-breaking is enabled */
/* also make the array 0-terminated */
g_byte_array_append (ed.array, (guint8 *)"\0\0\0\0\0", 6);
- ed.size += g_base64_encode_close (TRUE, (gchar *)&ed.array->data[ed.size],
+ ed.size += g_base64_encode_close (FALSE, (gchar *)&ed.array->data[ed.size],
&ed.state, &ed.save);
ed.array->data[ed.size] = '\0';
diff --git a/plug-ins/vdx/vdx-xml.c b/plug-ins/vdx/vdx-xml.c
index 70afb26..9587db3 100644
--- a/plug-ins/vdx/vdx-xml.c
+++ b/plug-ins/vdx/vdx-xml.c
@@ -4029,7 +4029,15 @@ vdx_write_object(FILE *file, unsigned int depth, const void *p)
case vdx_types_ForeignData:
ForeignData = (const struct vdx_ForeignData *)(p);
- fprintf(file, "%s<ForeignData CompressionLevel='%f' CompressionType='%s' ForeignType='%s'
ObjectHeight='%f' ObjectWidth='%f' ShowAsIcon='%u'", pad, ForeignData->CompressionLevel,
vdx_convert_xml_string(ForeignData->CompressionType), vdx_convert_xml_string(ForeignData->ForeignType),
ForeignData->ObjectHeight, ForeignData->ObjectWidth, ForeignData->ShowAsIcon);
+#if 0
+ fprintf(file, "%s<ForeignData CompressionLevel='%f' CompressionType='%s' ForeignType='%s'
ObjectHeight='%f' ObjectWidth='%f' ShowAsIcon='%u'",
+ pad, ForeignData->CompressionLevel, vdx_convert_xml_string(ForeignData->CompressionType),
vdx_convert_xml_string(ForeignData->ForeignType),
+ ForeignData->ObjectHeight, ForeignData->ObjectWidth, ForeignData->ShowAsIcon);
+#else
+ /* avoid writing optional values which are almost certainly meaningless */
+ fprintf(file, "%s<ForeignData CompressionType='%s' ForeignType='%s' ",
+ pad, vdx_convert_xml_string(ForeignData->CompressionType),
vdx_convert_xml_string(ForeignData->ForeignType));
+#endif
if (ForeignData->ExtentX_exists)
fprintf(file, " ExtentX='%u'",
ForeignData->ExtentX);
@@ -5190,7 +5198,10 @@ vdx_write_object(FILE *file, unsigned int depth, const void *p)
vdx_write_object(file, depth+1, child->data);
child = child->next;
}
- if (Any->type != vdx_types_text)
+ /* LibreOffice Draw 4.2.4.2 does not like </ForeignData> with padding, it gives: General input/output
error. */
+ if (Any->type == vdx_types_ForeignData)
+ fprintf(file, "</%s>\n", vdx_Types[(int)Any->type]);
+ else if (Any->type != vdx_types_text)
fprintf(file, "%s</%s>\n", pad, vdx_Types[(int)Any->type]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]