Previous 199869 Revisions Next

r32402 Friday 26th September, 2014 at 13:43:44 UTC by R. Belmont
(nw)
[src/emu]webengine.c

trunk/src/emu/webengine.c
r32401r32402
320320   }
321321   else if (!strncmp(conn->uri, "/keyupload",8))
322322   {
323      const char *upload_data;
323      char *upload_data;
324324      int data_length, ofs = 0;
325325      char var_name[100], file_name[255];
326      while ((ofs = mg_parse_multipart(conn->content + ofs, conn->content_len - ofs, var_name, sizeof(var_name), file_name, sizeof(file_name),    &upload_data, &data_length)) > 0) {
326      while ((ofs = mg_parse_multipart(conn->content + ofs, conn->content_len - ofs, var_name, sizeof(var_name), file_name, sizeof(file_name), (const char **)&upload_data, &data_length)) > 0) {
327327            mg_printf_data(conn, "File: %s, size: %d bytes", file_name, data_length);
328328      }
329329     
r32401r32402
332332     
333333      if ((&data_length > 0) && (sizeof(file_name) > 0))
334334      {
335         char paste_data[data_length];
336         strncpy (paste_data, upload_data, data_length);
335         // MSVC doesn't yet support variable-length arrays, so chop the string the old-fashioned way
336         upload_data[data_length] = '\0';
337
337338         // Now paste the stripped down paste_data..
338         machine().ioport().natkeyboard().post_utf8(paste_data);
339         machine().ioport().natkeyboard().post_utf8(upload_data);
339340      }
340341      return MG_TRUE;
341342   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team