diff options
-rw-r--r-- | bcache.c | 2 | ||||
-rw-r--r-- | hcache.c | 16 | ||||
-rw-r--r-- | muttlib.c | 11 | ||||
-rw-r--r-- | protos.h | 3 |
4 files changed, 12 insertions, 20 deletions
@@ -62,7 +62,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, body_cache_t *bcac path = mutt_buffer_pool_get (); dst = mutt_buffer_pool_get (); - mutt_buffer_encode_path (path, NONULL (mailbox)); + mutt_encode_path (path, NONULL (mailbox)); mutt_buffer_printf (dst, "%s/%s%s", MessageCachedir, host, mutt_b2s (path)); if (*(dst->dptr - 1) != '/') @@ -995,25 +995,27 @@ mutt_hcache_store_raw (header_cache_t* h, const char* filename, void* data, #endif } -static char* get_foldername(const char *folder) +static char* get_foldername (const char *folder) { char *p = NULL; - char path[_POSIX_PATH_MAX]; + BUFFER *path; struct stat st; - mutt_encode_path (path, sizeof (path), folder); + path = mutt_buffer_pool_get (); + mutt_encode_path (path, folder); /* if the folder is local, canonify the path to avoid * to ensure equivalent paths share the hcache */ - if (stat (path, &st) == 0) + if (stat (mutt_b2s (path), &st) == 0) { p = safe_malloc (PATH_MAX+1); - if (!realpath (path, p)) - mutt_str_replace (&p, path); + if (!realpath (mutt_b2s (path), p)) + mutt_str_replace (&p, mutt_b2s (path)); } else - p = safe_strdup (path); + p = safe_strdup (mutt_b2s (path)); + mutt_buffer_pool_release (&path); return p; } @@ -2247,16 +2247,7 @@ int mutt_match_spam_list (const char *s, REPLACE_LIST *l, char *text, int textsi return 0; } -void mutt_encode_path (char *dest, size_t dlen, const char *src) -{ - char *p = safe_strdup (src); - int rc = mutt_convert_string (&p, Charset, "utf-8", 0); - /* `src' may be NULL, such as when called from the pop3 driver. */ - strfcpy (dest, (rc == 0) ? NONULL(p) : NONULL(src), dlen); - FREE (&p); -} - -void mutt_buffer_encode_path (BUFFER *dest, const char *src) +void mutt_encode_path (BUFFER *dest, const char *src) { char *p; int rc; @@ -204,8 +204,7 @@ int mutt_label_complete (char *, size_t, int); void mutt_curses_error (const char *, ...); void mutt_curses_message (const char *, ...); void mutt_encode_descriptions (BODY *, short); -void mutt_encode_path (char *, size_t, const char *); -void mutt_buffer_encode_path (BUFFER *, const char *); +void mutt_encode_path (BUFFER *, const char *); void mutt_enter_command (void); void mutt_error_history_display (void); void mutt_error_history_init (void); |