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.
|
* 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 stat sb;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
@ -233,7 +233,7 @@ static DilloDir *File_dillodir_new(char *dirname)
|
|||||||
std::string fname;
|
std::string fname;
|
||||||
int dirname_len;
|
int dirname_len;
|
||||||
|
|
||||||
if (!(dir = opendir(dirname)))
|
if (!(dir = opendir(dirname.c_str())))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
auto Ddir = std::make_unique< DilloDir >();
|
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,
|
static int File_prepare_send_dir(ClientInfo *client,
|
||||||
const char *DirName, const char *orig_url)
|
const char *DirName, const char *orig_url)
|
||||||
{
|
{
|
||||||
Dstr *ds_dirname;
|
std::string ds_dirname;
|
||||||
DilloDir *Ddir;
|
DilloDir *Ddir;
|
||||||
|
|
||||||
/* Let's make sure this directory url has a trailing slash */
|
/* Let's make sure this directory url has a trailing slash */
|
||||||
ds_dirname = dStr_new(DirName);
|
ds_dirname = DirName;
|
||||||
if (ds_dirname->str[ds_dirname->len - 1] != '/')
|
if (ds_dirname[ds_dirname.size() - 1] != '/')
|
||||||
dStr_append(ds_dirname, "/");
|
ds_dirname+= "/";
|
||||||
|
|
||||||
/* Let's get a structure ready for transfer */
|
/* Let's get a structure ready for transfer */
|
||||||
Ddir = File_dillodir_new(ds_dirname->str);
|
Ddir = File_dillodir_new(ds_dirname.c_str());
|
||||||
dStr_free(ds_dirname, TRUE);
|
|
||||||
if (Ddir) {
|
if (Ddir) {
|
||||||
/* looks ok, set things accordingly */
|
/* looks ok, set things accordingly */
|
||||||
client->orig_url = dStrdup(orig_url);
|
client->orig_url = dStrdup(orig_url);
|
||||||
|
|||||||
Reference in New Issue
Block a user