aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-04-19 11:26:11 +0000
committerWerner Koch <[email protected]>2006-04-19 11:26:11 +0000
commit29b23dea9731e8f258211bc6fd733d205c18e2a8 (patch)
treeff2a0f66bda0c1f050e8fa00cbf610e18b91c9f7 /jnlib
parent2006-04-14 Marcus Brinkmann <[email protected]> (diff)
downloadgnupg-29b23dea9731e8f258211bc6fd733d205c18e2a8.tar.gz
gnupg-29b23dea9731e8f258211bc6fd733d205c18e2a8.zip
Merged with gpg 1.4.3 code.
The gpg part does not yet build.
Diffstat (limited to 'jnlib')
-rw-r--r--jnlib/ChangeLog5
-rw-r--r--jnlib/libjnlib-config.h5
-rw-r--r--jnlib/strlist.c36
-rw-r--r--jnlib/strlist.h3
4 files changed, 29 insertions, 20 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog
index f0463c5b3..32549d136 100644
--- a/jnlib/ChangeLog
+++ b/jnlib/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-18 Werner Koch <[email protected]>
+
+ * libjnlib-config.h (JNLIB_NEED_UTF8CONF): Defined.
+ * strlist.c (add_to_strlist2) [JNLIB_NEED_UTF8CONV]: Enabled.
+
2005-06-15 Werner Koch <[email protected]>
* stringhelp.c (sanitize_buffer): Make P a void*.
diff --git a/jnlib/libjnlib-config.h b/jnlib/libjnlib-config.h
index ad7e353fd..8ae2a9ce9 100644
--- a/jnlib/libjnlib-config.h
+++ b/jnlib/libjnlib-config.h
@@ -1,5 +1,5 @@
/* libjnlib-config.h - local configuration of the jnlib functions
- * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -29,6 +29,9 @@
#include <gcrypt.h> /* gcry_malloc & Cie. */
#include "logging.h"
+/* We require support for utf-8 conversion. */
+#define JNLIB_NEED_UTF8CONF 1
+
#ifdef USE_SIMPLE_GETTEXT
int set_gettext_file( const char *filename );
const char *gettext( const char *msgid );
diff --git a/jnlib/strlist.c b/jnlib/strlist.c
index 49b510666..d1924c102 100644
--- a/jnlib/strlist.c
+++ b/jnlib/strlist.c
@@ -1,5 +1,5 @@
/* strlist.c - string helpers
- * Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -26,7 +26,9 @@
#include "libjnlib-config.h"
#include "strlist.h"
-
+#ifdef JNLIB_NEED_UTF8CONV
+#include "utf8conv.h"
+#endif
void
free_strlist( strlist_t sl )
@@ -53,26 +55,26 @@ add_to_strlist( strlist_t *list, const char *string )
return sl;
}
-#if 0
-/****************
- * same as add_to_strlist() but if is_utf8 is *not* set a conversion
- * to UTF8 is done
- */
+
+/* Same as add_to_strlist() but if is_utf8 is *not* set, a conversion
+ to UTF-8 is done. */
+#ifdef JNLIB_NEED_UTF8CONV
strlist_t
add_to_strlist2( strlist_t *list, const char *string, int is_utf8 )
{
- strlist_t sl;
-
- if( is_utf8 )
- sl = add_to_strlist( list, string );
- else {
- char *p = native_to_utf8( string );
- sl = add_to_strlist( list, p );
- m_free( p );
+ strlist_t sl;
+
+ if (is_utf8)
+ sl = add_to_strlist( list, string );
+ else
+ {
+ char *p = native_to_utf8( string );
+ sl = add_to_strlist( list, p );
+ jnlib_free ( p );
}
- return sl;
+ return sl;
}
-#endif
+#endif /* JNLIB_NEED_UTF8CONV*/
strlist_t
append_to_strlist( strlist_t *list, const char *string )
diff --git a/jnlib/strlist.h b/jnlib/strlist.h
index 72da241bc..47ac5bd4e 100644
--- a/jnlib/strlist.h
+++ b/jnlib/strlist.h
@@ -32,8 +32,7 @@ typedef struct string_list *strlist_t;
void free_strlist (strlist_t sl);
strlist_t add_to_strlist (strlist_t *list, const char *string);
-/*strlist_t add_to_strlist2( strlist_t *list,
- const char *string, int is_utf8);*/
+strlist_t add_to_strlist2( strlist_t *list, const char *string, int is_utf8);
strlist_t append_to_strlist (strlist_t *list, const char *string);