Mercurial > gftp.yaz
changeset 423:4cee2498761d
2004-3-15 Brian Masney <masneyb@gftp.org>
* lib/gftp.h - if _FILE_OFFSET_BITS is > 32 and _LARGEFILE_SOURCE is
not defined, define it
* lib/protocols.c (gftp_string_{to|from}_utf8 - don't alter the contents of the remote_charsets option. Instead, make a copy of that and alter
that copy
author | masneyb |
---|---|
date | Tue, 16 Mar 2004 02:11:56 +0000 |
parents | 38bfc112ab46 |
children | 26333110dfd2 |
files | ChangeLog lib/gftp.h lib/protocols.c |
diffstat | 3 files changed, 31 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Mar 15 18:07:15 2004 +0000 +++ b/ChangeLog Tue Mar 16 02:11:56 2004 +0000 @@ -1,3 +1,10 @@ +2004-3-15 Brian Masney <masneyb@gftp.org> + * lib/gftp.h - if _FILE_OFFSET_BITS is > 32 and _LARGEFILE_SOURCE is + not defined, define it + + * lib/protocols.c (gftp_string_{to|from}_utf8 - don't alter the contents of the remote_charsets option. Instead, make a copy of that and alter + that copy + 2004-3-14 Brian Masney <masneyb@gftp.org> * lib/misc.c (expand_path) - skip over paths that are empty @@ -2265,7 +2272,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.230 2004/03/15 18:06:51 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.231 2004/03/16 02:11:54 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/gftp.h Mon Mar 15 18:07:15 2004 +0000 +++ b/lib/gftp.h Tue Mar 16 02:11:56 2004 +0000 @@ -26,6 +26,13 @@ #include "config.h" #endif +/* FreeBSD and OpenBSD both include 64bit off_t but _LARGEFILE_SOURCE does not + get defined. */ +#if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS > 32 && \ + !defined (_LARGEFILE_SOURCE) +#define _LARGEFILE_SOURCE 1 +#endif + #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h>
--- a/lib/protocols.c Mon Mar 15 18:07:15 2004 +0000 +++ b/lib/protocols.c Tue Mar 16 02:11:56 2004 +0000 @@ -348,7 +348,7 @@ #if GLIB_MAJOR_VERSION > 1 static char * -_gftp_get_next_charset (char *remote_charsets, char *orig_str, char **curpos) +_gftp_get_next_charset (char **curpos) { char *ret, *endpos; @@ -356,40 +356,22 @@ return (NULL); ret = *curpos; - if (*curpos != remote_charsets) - { - *orig_str = *(*curpos - 1); - *(*curpos - 1) = ','; - } - if ((endpos = strchr (*curpos, ',')) == NULL) *curpos += strlen (*curpos); else { *endpos = '\0'; - - if (*orig_str != '\0') - *curpos = endpos + 1; - else - *curpos = endpos; + *curpos = endpos + 1; } return (ret); } -static void -_gftp_restore_charset_string (char **remote_charsets, char orig_str, char **curpos) -{ - if (*curpos != *remote_charsets) - *(*curpos - 1) = orig_str; -} - - char * gftp_string_to_utf8 (gftp_request * request, const char *str) { - char *ret, *remote_charsets, *stpos, *cur_charset, orig_str; + char *ret, *remote_charsets, *stpos, *cur_charset, *tempstr; gsize bread, bwrite; GError * error; @@ -402,8 +384,8 @@ else if (g_utf8_validate (str, -1, NULL)) return (NULL); - gftp_lookup_request_option (request, "remote_charsets", &remote_charsets); - if (*remote_charsets == '\0') + gftp_lookup_request_option (request, "remote_charsets", &tempstr); + if (*tempstr == '\0') { error = NULL; if ((ret = g_locale_to_utf8 (str, -1, &bread, &bwrite, &error)) != NULL) @@ -412,10 +394,10 @@ return (NULL); } + remote_charsets = g_strdup (tempstr); ret = NULL; stpos = remote_charsets; - while ((cur_charset = _gftp_get_next_charset (remote_charsets, &orig_str, - &stpos)) != NULL) + while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) { if ((request->iconv = g_iconv_open ("UTF-8", cur_charset)) == (GIConv) -1) continue; @@ -431,11 +413,12 @@ else { request->iconv_initialized = 1; - _gftp_restore_charset_string (&remote_charsets, *cur_charset, &stpos); break; } } + g_free (remote_charsets); + return (ret); } @@ -443,7 +426,7 @@ char * gftp_string_from_utf8 (gftp_request * request, const char *str) { - char *ret, *remote_charsets, *stpos, *cur_charset, orig_str; + char *ret, *remote_charsets, *stpos, *cur_charset, *tempstr; gsize bread, bwrite; GError * error; @@ -456,8 +439,8 @@ else if (g_utf8_validate (str, -1, NULL)) return (NULL); - gftp_lookup_request_option (request, "remote_charsets", &remote_charsets); - if (*remote_charsets == '\0') + gftp_lookup_request_option (request, "remote_charsets", &tempstr); + if (*tempstr == '\0') { error = NULL; if ((ret = g_locale_from_utf8 (str, -1, &bread, &bwrite, &error)) != NULL) @@ -466,10 +449,10 @@ return (NULL); } + remote_charsets = g_strdup (tempstr); ret = NULL; stpos = remote_charsets; - while ((cur_charset = _gftp_get_next_charset (remote_charsets, &orig_str, - &stpos)) != NULL) + while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) { if ((request->iconv = g_iconv_open (cur_charset, "UTF-8")) == (GIConv) -1) continue; @@ -485,11 +468,12 @@ else { request->iconv_initialized = 1; - _gftp_restore_charset_string (&remote_charsets, *cur_charset, &stpos); break; } } + g_free (remote_charsets); + return (ret); }