Another local string.
This commit is contained in:
15
dpi/file.cc
15
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);
|
||||
|
Reference in New Issue
Block a user