diff options
Diffstat (limited to 'src/emu/webengine.c')
-rw-r--r-- | src/emu/webengine.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/webengine.c b/src/emu/webengine.c index 70c6e50f43b..ad6d1928a7e 100644 --- a/src/emu/webengine.c +++ b/src/emu/webengine.c @@ -69,7 +69,7 @@ int web_engine::json_game_handler(struct mg_connection *conn) data["ispaused"] = m_machine->paused(); Json::FastWriter writer; - const char *json = writer.write(data).c_str(); + std::string json = writer.write(data); // Send HTTP reply to the client mg_printf(conn, "HTTP/1.1 200 OK\r\n" @@ -77,7 +77,7 @@ int web_engine::json_game_handler(struct mg_connection *conn) "Content-Length: %d\r\n" // Always set Content-Length "\r\n" "%s", - (int)strlen(json), json); + (int)json.length(), json.c_str()); // Returning non-zero tells mongoose that our function has replied to // the client, and mongoose should not send client any more data. @@ -88,7 +88,7 @@ int web_engine::json_game_handler(struct mg_connection *conn) int web_engine::json_slider_handler(struct mg_connection *conn) { const slider_state *curslider; - astring tempstring; + std::string tempstring; Json::Value array(Json::arrayValue); // add all sliders @@ -119,7 +119,7 @@ int web_engine::json_slider_handler(struct mg_connection *conn) array.append(data); } Json::FastWriter writer; - const char *json = writer.write(array).c_str(); + std::string json = writer.write(array); // Send HTTP reply to the client mg_printf(conn, "HTTP/1.1 200 OK\r\n" @@ -127,7 +127,7 @@ int web_engine::json_slider_handler(struct mg_connection *conn) "Content-Length: %d\r\n" // Always set Content-Length "\r\n" "%s", - (int)strlen(json), json); + (int)json.length(), json.c_str()); return MG_TRUE; } @@ -260,7 +260,7 @@ static int filename_endswith(const char *str, const char *suffix) // This function will be called by mongoose on every new request. int web_engine::begin_request_handler(struct mg_connection *conn) { - astring file_path = astring(mg_get_option(m_server, "document_root")).cat(PATH_SEPARATOR).cat(conn->uri); + std::string file_path = std::string(mg_get_option(m_server, "document_root")).append(PATH_SEPARATOR).append(conn->uri); if (filename_endswith(file_path.c_str(), ".lp")) { FILE *fp = NULL; @@ -440,7 +440,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn) return 0; } - astring fname("screenshot.png"); + std::string fname("screenshot.png"); emu_file file(m_machine->options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open(fname.c_str()); @@ -450,7 +450,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn) } m_machine->video().save_snapshot(screen, file); - astring fullpath(file.fullpath()); + std::string fullpath(file.fullpath()); file.close(); mg_send_header(conn, "Cache-Control", "no-cache, no-store, must-revalidate"); mg_send_header(conn, "Pragma", "no-cache"); |