Another string.

This commit is contained in:
2025-08-05 22:29:54 -04:00
parent 9cb76d2b22
commit 92e90f9233
4 changed files with 12 additions and 17 deletions

View File

@ -150,7 +150,7 @@ public: //BUG: for now everything is public
entries, it is the initial value */
DilloHtmlSelect *select;
bool init_val; /* only meaningful for buttons */
Dstr *file_data; /* only meaningful for file inputs.
std::string file_data; /* only meaningful for file inputs.
TODO: may become a list... */
private:
@ -1639,7 +1639,6 @@ DilloHtmlInput::DilloHtmlInput (DilloHtmlInputType type2, Embed *embed2,
default:
break;
}
file_data = NULL;
reset ();
}
@ -1648,7 +1647,6 @@ DilloHtmlInput::DilloHtmlInput (DilloHtmlInputType type2, Embed *embed2,
*/
DilloHtmlInput::~DilloHtmlInput ()
{
dStr_free(file_data, 1);
if (select)
delete select;
}
@ -1714,9 +1712,8 @@ void DilloHtmlInput::readFile (BrowserWindow *bw)
const char *filename = a_UIcmd_select_file();
if (filename) {
a_UIcmd_set_msg(bw, "Loading file...");
dStr_free(file_data, 1);
file_data = a_Misc_file2dstr(filename);
if (file_data) {
if (not file_data.empty()) {
a_UIcmd_set_msg(bw, "File loaded.");
LabelButtonResource *lbr = (LabelButtonResource*)embed->getResource();
lbr->setLabel(filename);
@ -1775,8 +1772,8 @@ void DilloHtmlInput::appendValuesTo(std::vector< std::string > &values, bool is_
LabelButtonResource *lbr = (LabelButtonResource*)embed->getResource();
const char *filename = lbr->getLabel();
if (filename[0] && strcmp(filename, init_str.value().c_str())) {
if (file_data) {
values.push_back( file_data->str );
if (not file_data.empty()) {
values.push_back( file_data );
} else {
MSG("FORM file input \"%s\" not loaded.\n", filename);
}