]> granicus.if.org Git - mutt/commitdiff
Convert remaining mutt_encode_path() call to use BUFFER.
authorKevin McCarthy <kevin@8t8.us>
Mon, 9 Sep 2019 21:06:31 +0000 (14:06 -0700)
committerKevin McCarthy <kevin@8t8.us>
Tue, 10 Sep 2019 01:13:12 +0000 (18:13 -0700)
Then rename the other uses of mutt_buffer_encode_path() to
mutt_encode_path().

bcache.c
hcache.c
muttlib.c
protos.h

index 0fef6c32f1042deb3046cdd2932c72572897f33c..b6925d4a94757f43700e98a3a3394059ab491a72 100644 (file)
--- a/bcache.c
+++ b/bcache.c
@@ -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) != '/')
index 07f3fbd3e3f4c2635b53b8bb946bfa2c1601c520..b8d7a9dac59664678ec567d52f401276b04c245b 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -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;
 }
 
index 82f90faf7398eccfdbfa4a1907f250e781a473ec..6964123047c6074716cd6388e07377dbc0c62dd4 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -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;
index 66348bc3dd8f8f737abba0cd1d565a6e2e41cbfc..f747bcb9ee3d8a0ec2e010f8a9ee78e132429cc9 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -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);