soc.2009.vulture: cd038ddd: Make character conversion routines handl...
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Tue Sep 15 15:40:37 EDT 2009
-----------------------------------------------------------------
Revision: cd038dddf49514dd4bbca86e842cd326645a1c88
Ancestor: 7b9ea81496080f898cad722c2fd19d0452477e45
Author: gdick at soc.pidgin.im
Date: 2009-09-15T14:00:11
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/cd038dddf49514dd4bbca86e842cd326645a1c88
Modified files:
vulture/vulture.h
ChangeLog:
Make character conversion routines handle NULL gracefully for convenience.
-------------- next part --------------
============================================================
--- vulture/vulture.h 74f168560d192dfefc8e6bf1565af6c794d0d09d
+++ vulture/vulture.h 8873a1cc1145a08c57a424632f2990d794bb8b46
@@ -96,12 +96,17 @@ static INLINE gchar* VultureTCHARToUTF8(
*/
static INLINE gchar* VultureTCHARToUTF8(LPCTSTR sz)
{
+ if(sz)
+ {
#ifdef UNICODE
- return g_utf16_to_utf8(sz, -1, NULL, NULL, NULL);
+ return g_utf16_to_utf8(sz, -1, NULL, NULL, NULL);
#else
- gsize cchWritten;
- return g_locale_to_utf8(sz, -1, NULL, &cchWritten, NULL);
+ gsize cchWritten;
+ return g_locale_to_utf8(sz, -1, NULL, &cchWritten, NULL);
#endif
+ }
+
+ return NULL;
}
@@ -114,12 +119,17 @@ static INLINE LPTSTR VultureUTF8ToTCHAR(
*/
static INLINE LPTSTR VultureUTF8ToTCHAR(const gchar* sz)
{
+ if(sz)
+ {
#ifdef UNICODE
- return g_utf8_to_utf16(sz, -1, NULL, NULL, NULL);
+ return g_utf8_to_utf16(sz, -1, NULL, NULL, NULL);
#else
- gsize cchWritten;
- return g_locale_from_utf8(sz, -1, NULL, &cchWritten, NULL);
+ gsize cchWritten;
+ return g_locale_from_utf8(sz, -1, NULL, &cchWritten, NULL);
#endif
+ }
+
+ return NULL;
}
More information about the Commits
mailing list