[ekiga] Finalise previous commit, thanks Snark!



commit d3b3774da9910994e36261d002045aff871cae07
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date:   Tue Apr 21 12:25:07 2009 +0200

    Finalise previous commit, thanks Snark!
    
    Also added copyright text to the new files.
---
 lib/engine/components/ptlib/utils.cpp |   63 +++++++++++++++++++++++---------
 lib/engine/components/ptlib/utils.h   |   45 +++++++++++++++++++++++
 2 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/lib/engine/components/ptlib/utils.cpp b/lib/engine/components/ptlib/utils.cpp
index eb8f095..c86f250 100644
--- a/lib/engine/components/ptlib/utils.cpp
+++ b/lib/engine/components/ptlib/utils.cpp
@@ -1,3 +1,39 @@
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         utils.cpp  -  description
+ *                         -----------------------------
+ *   begin                : Tue Apr 21 2009
+ *   copyright            : (C) 2009 by Eugen Dedu
+ *   description          : Functions to change encoding of std::string
+ */
+
+
 #include <glib.h>
 
 #include "utils.h"
@@ -8,17 +44,11 @@ latin2utf (const std::string str)
   gchar *utf8_str;
   std::string result;
 
-  if (g_utf8_validate (str.c_str (), -1, NULL))
-    utf8_str = g_strdup (str.c_str ());
-  else
-    utf8_str = g_convert (str.c_str (), -1,
-                          "UTF-8", "ISO-8859-1",
-                          NULL, NULL, NULL);
-
+  utf8_str = g_convert (str.c_str (), -1,
+                        "UTF-8", "ISO-8859-1",
+                        NULL, NULL, NULL);
   result = std::string (utf8_str);
-
   g_free (utf8_str);
-
   return result;
 }
 
@@ -26,17 +56,14 @@ latin2utf (const std::string str)
 const std::string
 utf2latin (const std::string str)
 {
-  gchar *utf8_str;
+  gchar *latin_str;
   std::string result;
 
   g_warn_if_fail (g_utf8_validate (str.c_str (), -1, NULL));
-  utf8_str = g_convert (str.c_str (), -1,
-                        "ISO-8859-1", "UTF-8",
-                        NULL, NULL, NULL);
-
-  result = std::string (utf8_str);
-
-  g_free (utf8_str);
-
+  latin_str = g_convert (str.c_str (), -1,
+                         "ISO-8859-1", "UTF-8",
+                         NULL, NULL, NULL);
+  result = std::string (latin_str);
+  g_free (latin_str);
   return result;
 }
diff --git a/lib/engine/components/ptlib/utils.h b/lib/engine/components/ptlib/utils.h
index 366a6f6..1ff095a 100644
--- a/lib/engine/components/ptlib/utils.h
+++ b/lib/engine/components/ptlib/utils.h
@@ -1,4 +1,49 @@
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         utils.h  -  description
+ *                         -----------------------------
+ *   begin                : Tue Apr 21 2009
+ *   copyright            : (C) 2009 by Eugen Dedu
+ *   description          : Functions to change encoding of std::string
+ */
+
+
 #include <string>
 
+/* DESCRIPTION  :  /
+ * BEHAVIOR     :  Change encoding from latin-1 to utf-8.
+ * PRE          :  /
+ */
 const std::string latin2utf (const std::string str);
+
+/* DESCRIPTION  :  /
+ * BEHAVIOR     :  Change encoding from utf-8 to latin-1.
+ * PRE          :  A validated utf-8 string.
+ */
 const std::string utf2latin (const std::string str);



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