Fix incorrect string resize

This commit is contained in:
Konstantin Olchanski 2020-05-22 13:52:26 -07:00
parent 5609cf96d0
commit f09643b9fc

View File

@ -238,7 +238,7 @@ MXML_WRITER *mxml_open_buffer(void)
if (mxml_suppress_date_flag == 0) { if (mxml_suppress_date_flag == 0) {
time_t now = time(NULL); time_t now = time(NULL);
std::string str = ctime(&now); std::string str = ctime(&now);
str[24] = 0; str.resize(24);
std::string line = ""; std::string line = "";
//sprintf(line, "<!-- created by MXML on %s -->\n", str); //sprintf(line, "<!-- created by MXML on %s -->\n", str);
line += "<!-- created by MXML on "; line += "<!-- created by MXML on ";
@ -294,7 +294,7 @@ MXML_WRITER *mxml_open_file(const char *file_name)
if (mxml_suppress_date_flag == 0) { if (mxml_suppress_date_flag == 0) {
time_t now = time(NULL); time_t now = time(NULL);
std::string str = ctime(&now); std::string str = ctime(&now);
str[24] = 0; str.resize(24);
std::string line = ""; std::string line = "";
//sprintf(line, "<!-- created by MXML on %s -->\n", str); //sprintf(line, "<!-- created by MXML on %s -->\n", str);
line += "<!-- created by MXML on "; line += "<!-- created by MXML on ";