[libgsf] OLE2: Pad unicode strings in properties.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] OLE2: Pad unicode strings in properties.
- Date: Sun, 28 Oct 2012 16:58:29 +0000 (UTC)
commit a21877b01776c93627857476cbfe7533df534770
Author: Morten Welinder <terra gnome org>
Date: Sun Oct 28 12:58:05 2012 -0400
OLE2: Pad unicode strings in properties.
ChangeLog | 5 +++++
gsf/gsf-msole-utils.c | 8 ++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38a6e11..2541096 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-28 Morten Welinder <terra gnome org>
+
+ * gsf/gsf-msole-utils.c (msole_metadata_write_string): Pad to
+ 4-byte boundary if char_size>1 as per spec.
+
2012-10-27 Morten Welinder <terra gnome org>
* gsf/gsf-msole-utils.c (msole_metadata_write_string): New
diff --git a/gsf/gsf-msole-utils.c b/gsf/gsf-msole-utils.c
index b14e75a..d634dc9 100644
--- a/gsf/gsf-msole-utils.c
+++ b/gsf/gsf-msole-utils.c
@@ -1421,6 +1421,14 @@ msole_metadata_write_string (WritePropState *state, const char *txt)
GSF_LE_SET_GUINT32 (buf, 0);
res = res && gsf_output_write (state->out, state->char_size, buf);
+ if (state->char_size > 1) {
+ unsigned padding = 4 - (bytes_written + state->char_size) % 4;
+ if (padding < 4) {
+ g_printerr ("Padding string %s\n", txt);
+ res = res && gsf_output_write (state->out, padding, buf);
+ }
+ }
+
g_free (ctxt);
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]