From 3000aa7ef3cb72aafb345e1dd1a87b6c774df3e58a3347fe7566c087e3c62b76 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 6 Aug 2025 02:14:42 -0400 Subject: [PATCH] Another local string. --- dpi/file.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dpi/file.cc b/dpi/file.cc index b8bf6ef..a3033b3 100644 --- a/dpi/file.cc +++ b/dpi/file.cc @@ -224,7 +224,7 @@ FileInfo::operator <=> ( const FileInfo &rhs ) const /* * Allocate a DilloDir structure, set safe values in it and sort the entries. */ -static DilloDir *File_dillodir_new(char *dirname) +static DilloDir *File_dillodir_new(const std::string &dirname) { struct stat sb; struct dirent *de; @@ -233,7 +233,7 @@ static DilloDir *File_dillodir_new(char *dirname) std::string fname; int dirname_len; - if (!(dir = opendir(dirname))) + if (!(dir = opendir(dirname.c_str()))) return NULL; auto Ddir = std::make_unique< DilloDir >(); @@ -613,17 +613,16 @@ static void File_send_error_page(ClientInfo *client) static int File_prepare_send_dir(ClientInfo *client, const char *DirName, const char *orig_url) { - Dstr *ds_dirname; + std::string ds_dirname; DilloDir *Ddir; /* Let's make sure this directory url has a trailing slash */ - ds_dirname = dStr_new(DirName); - if (ds_dirname->str[ds_dirname->len - 1] != '/') - dStr_append(ds_dirname, "/"); + ds_dirname = DirName; + if (ds_dirname[ds_dirname.size() - 1] != '/') + ds_dirname+= "/"; /* Let's get a structure ready for transfer */ - Ddir = File_dillodir_new(ds_dirname->str); - dStr_free(ds_dirname, TRUE); + Ddir = File_dillodir_new(ds_dirname.c_str()); if (Ddir) { /* looks ok, set things accordingly */ client->orig_url = dStrdup(orig_url);