[genius] Wed Aug 20 18:49:35 2014 Jiri (George) Lebl <jirka 5z com>



commit fd6473a83cbd41929c1610fb0a69b18e6667875a
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Wed Aug 20 18:49:42 2014 -0500

    Wed Aug 20 18:49:35 2014  Jiri (George) Lebl <jirka 5z com>
    
        * src/calc.c: also encode the description when compiling.  This is
          to be on the safe side, I don't think any descriptions right now
          contain invalid characters for the compiled file such as a
          semicolon, but they could.

 ChangeLog  |    7 +++++++
 src/calc.c |   14 +++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 85a6092..25de57c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Aug 20 18:49:35 2014  Jiri (George) Lebl <jirka 5z com>
+
+       * src/calc.c: also encode the description when compiling.  This is
+         to be on the safe side, I don't think any descriptions right now
+         contain invalid characters for the compiled file such as a
+         semicolon, but they could.
+
 Tue Aug 19 14:09:44 2014  Jiri (George) Lebl <jirka 5z com>
 
        * lib/number_theory/prime.gel: update the known limits on mersenne
diff --git a/src/calc.c b/src/calc.c
index 1dd0dae..41ede4f 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -1946,10 +1946,12 @@ compile_funcs_in_dict (FILE *outfile, GSList *dict, gboolean is_extra_dict)
                                fprintf (outfile, "C;%s;%s\n",
                                         func->id->token,
                                         help->category);
-                       if (help->description != NULL)
+                       if (help->description != NULL) {
+                               char *s = gel_encode_string (help->description);
                                fprintf (outfile, "D;%s;%s\n",
-                                        func->id->token,
-                                        help->description);
+                                        func->id->token, s);
+                               g_free (s);
+                       }
                        if (help->help_link != NULL) {
                                char *s = gel_encode_string (help->help_link);
                                fprintf (outfile, "L;%s;%s\n",
@@ -2085,7 +2087,7 @@ load_compiled_fp (const char *file, FILE *fp)
                        gel_add_category(p,d);
                        continue;
                } else if (*p == 'D') {
-                       char *d;
+                       char *d, *h;
                        p = strtok_r (NULL,";", &ptrptr);
                        if G_UNLIKELY (!p) {
                                gel_errorout (_("Badly formed record"));
@@ -2096,7 +2098,9 @@ load_compiled_fp (const char *file, FILE *fp)
                                gel_errorout (_("Badly formed record"));
                                continue;
                        }
-                       gel_add_description(p,d);
+                       h = gel_decode_string (d);
+                       gel_add_description (p, h);
+                       g_free (h);
                        continue;
                } else if (*p == 'L') {
                        char *d, *h;


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