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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-147-g04d0eb7)



The branch, master has been updated
       via  04d0eb73a3324d1383ba14bc3ab2834972e041b2 (commit)
       via  17a95f57912f9ee5ac63044188054948e58332ca (commit)
       via  7de36c95b7b8d465024b2767466ed246e5591dc2 (commit)
       via  70590a2312e2650f61a220980f9cf58bdad88987 (commit)
      from  71607a1b433a12192039cb4a0edf62b95c63440c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 libgeda/src/o_attrib.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)


=================
 Commit Messages
=================

commit 04d0eb73a3324d1383ba14bc3ab2834972e041b2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 15:01:15 2008 +0100

    Restore comment about returned strings in o_attrib_get_name_value()
    
    Restores a useful comment about string ownership which was removed in
    commit 872287f23b4880b01babed777efe7976783feab2.

:100644 100644 9143ea3... c9aec34... M	libgeda/src/o_attrib.c

commit 17a95f57912f9ee5ac63044188054948e58332ca
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:57:04 2008 +0100

    Restore o_attrib_get_name_value() returning NULL strings on failure
    
    Revert removal of this behaviour in
    commit 872287f23b4880b01babed777efe7976783feab2.
    
    If passed a location to return strings, set the pointer to NULL
    before returning FALSE for an invalid attribute. It provides a
    potentially convenient means to catch the invalid attribute.

:100644 100644 64ade5e... 9143ea3... M	libgeda/src/o_attrib.c

commit 7de36c95b7b8d465024b2767466ed246e5591dc2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:56:28 2008 +0100

    Revert allowing attributes with empty value in o_attrib_get_name_value()
    
    Another un-wanted change in 872287f23b4880b01babed777efe7976783feab2.
    Attributes are not legal if they have an empty ("") value part.

:100644 100644 61ade0d... 64ade5e... M	libgeda/src/o_attrib.c

commit 70590a2312e2650f61a220980f9cf58bdad88987
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:47:05 2008 +0100

    Revert "name = value" space handling in o_attrib_get_name_value()
    
    commit 872287f23b4880b01babed777efe7976783feab2 re-wrote this function
    using UTF-8 string manipulation functions, and changed a test for " "
    characters either side of the attribute's "=" to use g_unichar_isspace().
    
    This g_unichar_isspace() also tests positive for tabs and newline
    characters, making previously legal attributes illegal after this commit.
    Revert usage of g_unichar_isspace() in favour of single byte tests.
    
    An important property of UTF8 encoding is that the 7-bit ASCII codes are
    not used within bytes of a multi-byte character. Given the start of a
    chacacter in UTF8, testing if the first byte compares to the 7-bit ASCII
    code we want is a sufficient test.

:100644 100644 d9d7b59... 61ade0d... M	libgeda/src/o_attrib.c

=========
 Changes
=========

commit 04d0eb73a3324d1383ba14bc3ab2834972e041b2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 15:01:15 2008 +0100

    Restore comment about returned strings in o_attrib_get_name_value()
    
    Restores a useful comment about string ownership which was removed in
    commit 872287f23b4880b01babed777efe7976783feab2.

diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 9143ea3..c9aec34 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -541,6 +541,7 @@ gchar *o_save_attribs(GList *attribs)
  *  in that case \a *name_ptr and \a *value_ptr are set to NULL.
  *
  *  \a name_ptr and/or \a value_ptr can be NULL.
+ *  If not NULL, the caller must g_free these returned strings.
  *
  *  \note
  *  If you get an invalid attribute (improper) with a name and no

commit 17a95f57912f9ee5ac63044188054948e58332ca
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:57:04 2008 +0100

    Restore o_attrib_get_name_value() returning NULL strings on failure
    
    Revert removal of this behaviour in
    commit 872287f23b4880b01babed777efe7976783feab2.
    
    If passed a location to return strings, set the pointer to NULL
    before returning FALSE for an invalid attribute. It provides a
    potentially convenient means to catch the invalid attribute.

diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 64ade5e..9143ea3 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -538,7 +538,7 @@ gchar *o_save_attribs(GList *attribs)
  *
  *  It returns TRUE if it has been able to parse the string into the
  *  name and value parts of an attribute. Otherwise it returns FALSE,
- *  in that case \a *name_ptr and \a *value_ptr are unset.
+ *  in that case \a *name_ptr and \a *value_ptr are set to NULL.
  *
  *  \a name_ptr and/or \a value_ptr can be NULL.
  *
@@ -556,7 +556,12 @@ gboolean
 o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr)
 {
   gchar *ptr, *prev_char, *next_char;
-  
+
+  if (name_ptr != NULL)
+    *name_ptr = NULL;
+  if (value_ptr != NULL)
+    *value_ptr = NULL;
+
   g_return_val_if_fail (string != NULL, FALSE);
 
   ptr = g_utf8_strchr (string, -1, g_utf8_get_char ("="));

commit 7de36c95b7b8d465024b2767466ed246e5591dc2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:56:28 2008 +0100

    Revert allowing attributes with empty value in o_attrib_get_name_value()
    
    Another un-wanted change in 872287f23b4880b01babed777efe7976783feab2.
    Attributes are not legal if they have an empty ("") value part.

diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 61ade0d..64ade5e 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -542,6 +542,11 @@ gchar *o_save_attribs(GList *attribs)
  *
  *  \a name_ptr and/or \a value_ptr can be NULL.
  *
+ *  \note
+ *  If you get an invalid attribute (improper) with a name and no
+ *  value, then it is NOT an attribute. Also, there cannot be any
+ *  spaces beside the equals sign
+ *
  *  \param [in]  string     String to split into name/value pair.
  *  \param [out] name_ptr   The return location for the name, or NULL.
  *  \param [out] value_ptr  The return location for the value, or NULL.
@@ -562,7 +567,7 @@ o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_pt
   prev_char = g_utf8_find_prev_char (string, ptr);
   next_char = g_utf8_find_next_char (ptr, NULL);
   if (prev_char == NULL || *prev_char == ' ' ||
-      (next_char != NULL && *next_char == ' ')) {
+      next_char == NULL || *next_char == ' ' || *next_char == '\0' ) {
     return FALSE;
   }
 
@@ -571,7 +576,7 @@ o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_pt
   }
 
   if (value_ptr != NULL) {
-    *value_ptr = g_strdup (next_char != NULL ? next_char : "");
+    *value_ptr = g_strdup (next_char);
   }
 
   return TRUE;

commit 70590a2312e2650f61a220980f9cf58bdad88987
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 14:47:05 2008 +0100

    Revert "name = value" space handling in o_attrib_get_name_value()
    
    commit 872287f23b4880b01babed777efe7976783feab2 re-wrote this function
    using UTF-8 string manipulation functions, and changed a test for " "
    characters either side of the attribute's "=" to use g_unichar_isspace().
    
    This g_unichar_isspace() also tests positive for tabs and newline
    characters, making previously legal attributes illegal after this commit.
    Revert usage of g_unichar_isspace() in favour of single byte tests.
    
    An important property of UTF8 encoding is that the 7-bit ASCII codes are
    not used within bytes of a multi-byte character. Given the start of a
    chacacter in UTF8, testing if the first byte compares to the 7-bit ASCII
    code we want is a sufficient test.

diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index d9d7b59..61ade0d 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -561,10 +561,8 @@ o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_pt
 
   prev_char = g_utf8_find_prev_char (string, ptr);
   next_char = g_utf8_find_next_char (ptr, NULL);
-  if ((prev_char == NULL) ||
-      g_unichar_isspace (g_utf8_get_char (prev_char)) ||
-      ((next_char != NULL) &&
-       g_unichar_isspace (g_utf8_get_char (next_char)))) {
+  if (prev_char == NULL || *prev_char == ' ' ||
+      (next_char != NULL && *next_char == ' ')) {
     return FALSE;
   }
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs