[Commits] [SCM] claws branch, master, updated. 3.9.3-222-gd7493e3

wwp at claws-mail.org wwp at claws-mail.org
Fri May 23 00:51:40 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  d7493e38a465649d0e56b3e3c86f3b9085372d61 (commit)
      from  a873d8f791b069ffee24e524477165deda81558e (commit)


- Log -----------------------------------------------------------------
commit d7493e38a465649d0e56b3e3c86f3b9085372d61
Author: wwp <wwp at free.fr>
Date:   Fri May 23 00:50:29 2014 +0200

    Add g_utf8_substring function for compiling with GLIB < 2.30.

diff --git a/src/common/utils.c b/src/common/utils.c
index 104c691..a592ce9 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -14,6 +14,10 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The code of the g_utf8_substring function below is owned by
+ * Matthias Clasen <matthiasc at src.gnome.org>/<mclasen at redhat.com>
+ * and is got from GLIB 2.30
  * 
  */
 
@@ -5504,3 +5508,37 @@ int cm_canonicalize_filename(const gchar *filename, gchar **canonical_name) {
 	slist_free_strings_full(canonical_parts);
 	return 0;
 }
+
+#if !GLIB_CHECK_VERSION(2, 30, 0)
+/**
+ * g_utf8_substring:
+ * @str: a UTF-8 encoded string
+ * @start_pos: a character offset within @str
+ * @end_pos: another character offset within @str
+ *
+ * Copies a substring out of a UTF-8 encoded string.
+ * The substring will contain @end_pos - @start_pos
+ * characters.
+ *
+ * Returns: a newly allocated copy of the requested
+ *     substring. Free with g_free() when no longer needed.
+ *
+ * Since: GLIB 2.30
+ */
+gchar *
+g_utf8_substring (const gchar *str,
+				  glong 	   start_pos,
+				  glong 	   end_pos)
+{
+  gchar *start, *end, *out;
+
+  start = g_utf8_offset_to_pointer (str, start_pos);
+  end = g_utf8_offset_to_pointer (start, end_pos - start_pos);
+
+  out = g_malloc (end - start + 1);
+  memcpy (out, start, end - start);
+  out[end - start] = 0;
+
+  return out;
+}
+#endif
diff --git a/src/common/utils.h b/src/common/utils.h
index 434b684..1a1f6c4 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -14,7 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
+ *
+ * The code of the g_utf8_substring function below is owned by
+ * Matthias Clasen <matthiasc at src.gnome.org>/<mclasen at redhat.com>
+ * and is got from GLIB 2.30
+ *
  */
 
 #ifndef __UTILS_H__
@@ -599,6 +603,12 @@ void cm_mutex_free(GMutex *mutex);
 
 int cm_canonicalize_filename(const gchar *filename, gchar **canonical_name);
 
+#if !GLIB_CHECK_VERSION(2, 30, 0)
+gchar   *g_utf8_substring         (const gchar *p,
+                                   glong        start_pos,
+                                   glong        end_pos) G_GNUC_MALLOC;
+#endif
+
 #ifdef __cplusplus
 }
 #endif

-----------------------------------------------------------------------

Summary of changes:
 src/common/utils.c |   38 ++++++++++++++++++++++++++++++++++++++
 src/common/utils.h |   12 +++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list