]> granicus.if.org Git - transmission/commitdiff
* add DISABLE_GETTEXT preprocessor directive to turn off i18n in libtransmission...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 21 Aug 2008 21:04:57 +0000 (21:04 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 21 Aug 2008 21:04:57 +0000 (21:04 +0000)
* remove `wchar.h' #include from shttpd that broke the compile on embedded devices.

libtransmission/utils.c
libtransmission/utils.h
third-party/shttpd/std_includes.h

index 1789728d541c26929aef6004a30f556f710f113c..da494ecc532f58c1a5f43fe2bc6476b0f877e35e 100644 (file)
@@ -357,6 +357,41 @@ tr_strcasecmp( const char * a, const char * b )
 #endif
 }
 
+/**
+***
+**/
+
+#ifdef DISABLE_GETTEXT
+
+const char*
+tr_strip_positional_args( const char* str )
+{
+    static size_t bufsize = 0;
+    static char * buf = NULL;
+    const size_t len = strlen( str );
+    char * out;
+
+    if( bufsize < len ) {
+        bufsize = len * 2;
+        buf = tr_renew( char, buf, bufsize );
+    }
+
+    for( out=buf; *str; ++str ) {
+        *out++ = *str;
+        if( ( *str == '%' ) && isdigit( str[1] ) ) {
+            const char * tmp = str + 1;
+            while( isdigit( *tmp ) )
+                ++tmp;
+            if( *tmp == '$' )
+                str = tmp;
+        }
+    }
+    *out = '\0';
+
+    return buf;
+}
+
+#endif
 
 /**
 ***
index bb02d853ca41941e457fceccdb035d80301e0e87..10643e74ab05b07195c53169006c9d2a97af1115 100644 (file)
 #endif
 #endif
 
+/* #define DISABLE_GETTEXT */
+#ifdef DISABLE_GETTEXT
+const char* tr_strip_positional_args( const char* fmt );
+#undef _
+#define _(a) tr_strip_positional_args(a)
+#endif
+
 #define tr_nerr( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, n, ## a )
 #define tr_ninf( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, n, ## a )
 #define tr_ndbg( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, n, ## a )
index f61503ce69eeb0212fa35ec1acf752e567edad9c..4bf1ea7b66f533efa9a4ef583005eb44b67f0788 100644 (file)
@@ -28,7 +28,6 @@
 #include <limits.h>
 #include <stddef.h>
 #include <stdio.h>
-#include <wchar.h>
 
 #if defined(_WIN32)            /* Windows specific     */
 #include "compat_win32.h"