[goffice] GOFormat: avoid dumping tokens into odf output.



commit bbb6961668a346902f034dcb729009b6ce182c42
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 27 08:07:24 2014 -0400

    GOFormat: avoid dumping tokens into odf output.

 ChangeLog                 |    3 +++
 goffice/utils/go-format.c |   32 +++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3c364a..20af1ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
        * goffice/utils/go-format.c (go_format_output_general_to_odf):
        Match what LO does for "General".
+       (go_format_output_date_to_odf, go_format_output_to_odf): Make sure
+       we don't accidentally output a non-character token as-if it was a
+       single character.
 
 2014-03-26  Morten Welinder  <terra gnome org>
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index f40d680..b6a4ab8 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -7800,8 +7800,10 @@ go_format_output_date_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                        break;
 
                default:
-                       ODF_OPEN_STRING;
-                       g_string_append_c (accum, t);
+                       if (t <= 0x7f) {
+                               ODF_OPEN_STRING;
+                               g_string_append_c (accum, t);
+                       }
                        break;
                }
        }
@@ -8039,8 +8041,10 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                        }
                        /* no break */
                default:
-                       ODF_OPEN_STRING;
-                       g_string_append_c (accum, t);
+                       if (t <= 0x7f) {
+                               ODF_OPEN_STRING;
+                               g_string_append_c (accum, t);
+                       }
                        break;
                }
        }
@@ -8284,9 +8288,11 @@ go_format_output_number_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                }
 
                default:
-                       ODF_WRITE_NUMBER;
-                       ODF_OPEN_STRING;
-                       g_string_append_c (accum, t);
+                       if (t <= 0x7f) {
+                               ODF_WRITE_NUMBER;
+                               ODF_OPEN_STRING;
+                               g_string_append_c (accum, t);
+                       }
                        break;
                }
        }
@@ -8373,8 +8379,10 @@ go_format_output_text_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                        break;
 
                default:
-                       ODF_OPEN_STRING;
-                       g_string_append_c (accum, t);
+                       if (t <= 0x7f) {
+                               ODF_OPEN_STRING;
+                               g_string_append_c (accum, t);
+                       }
                        break;
                }
        }
@@ -8591,8 +8599,10 @@ go_format_output_scientific_number_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                }
 
                default:
-                       ODF_OPEN_STRING;
-                       g_string_append_c (accum, t);
+                       if (t <= 0x7f) {
+                               ODF_OPEN_STRING;
+                               g_string_append_c (accum, t);
+                       }
                        break;
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]