From: Daniel R. G. <sk...@us...> - 2006-07-03 16:36:14
|
Update of /cvsroot/libetpan/libetpan/src/data-types In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19711/src/data-types Modified Files: charconv.c Log Message: Rules.in: Modified the "prepare" rule so that it doesn't copy header files if doing so would be redundant (according to cmp(1)). This will prevent such copying when making install as a different user. Also: Copy with "cp -p", so that the destination files have the same timestamp as the originals; prefix the for-loop with "@", for less ugliness when the rule is invoked. install-sh: Updated to the latest version from the autoconf-2.60 package. (The old version was buggy/broken/bad) src/data-types/charconv.c: Moved some variable declarations up to eliminate a case where they can occur after statements (illegal on many compilers), removed a couple of redundant declarations, and eliminated two stray semicolons. Index: charconv.c =================================================================== RCS file: /cvsroot/libetpan/libetpan/src/data-types/charconv.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- charconv.c 26 Jun 2006 11:50:26 -0000 1.21 +++ charconv.c 3 Jul 2006 16:36:08 -0000 1.22 @@ -127,9 +127,19 @@ const char * str, size_t length, char ** result) { +#ifdef HAVE_ICONV + iconv_t conv; + size_t r; + char * pout; + size_t out_size; + size_t old_out_size; + size_t count; +#endif + char * out; + int res; + if (extended_charconv != NULL) { size_t result_length; - int res; result_length = length * 6; *result = malloc( length * 6 + 1); if (*result == NULL) { @@ -139,7 +149,7 @@ if (res != MAIL_CHARCONV_NO_ERROR) { free( *result); } else { - char* out = realloc( *result, result_length + 1); + out = realloc( *result, result_length + 1); if (out != NULL) *result = out; /* also a cstring, just in case */ (*result)[result_length] = '\0'; @@ -153,14 +163,6 @@ #ifndef HAVE_ICONV return MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET; #else - iconv_t conv; - size_t r; - char * out; - char * pout; - size_t out_size; - size_t old_out_size; - size_t count; - int res; conv = iconv_open(tocode, fromcode); if (conv == (iconv_t) -1) { @@ -205,17 +207,28 @@ err: return res; #endif -}; +} LIBETPAN_EXPORT int charconv_buffer(const char * tocode, const char * fromcode, const char * str, size_t length, char ** result, size_t * result_len) { +#ifdef HAVE_ICONV + iconv_t conv; + size_t iconv_r; + int r; + char * out; + char * pout; + size_t out_size; + size_t old_out_size; + size_t count; +#endif + int res; + MMAPString * mmapstr; + if (extended_charconv != NULL) { size_t result_length; - int res; - MMAPString* mmapstr; result_length = length * 6; mmapstr = mmap_string_sized_new( result_length + 1); *result_len = 0; @@ -245,16 +258,6 @@ #ifndef HAVE_ICONV return MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET; #else - iconv_t conv; - size_t iconv_r; - int r; - char * out; - char * pout; - size_t out_size; - size_t old_out_size; - size_t count; - MMAPString * mmapstr; - int res; conv = iconv_open(tocode, fromcode); if (conv == (iconv_t) -1) { @@ -304,7 +307,7 @@ err: return res; #endif -}; +} LIBETPAN_EXPORT void charconv_buffer_free(char * str) |