trunk/src/emu/webengine.c
| r32401 | r32402 | |
| 320 | 320 | } |
| 321 | 321 | else if (!strncmp(conn->uri, "/keyupload",8)) |
| 322 | 322 | { |
| 323 | | const char *upload_data; |
| 323 | char *upload_data; |
| 324 | 324 | int data_length, ofs = 0; |
| 325 | 325 | 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) { |
| 327 | 327 | mg_printf_data(conn, "File: %s, size: %d bytes", file_name, data_length); |
| 328 | 328 | } |
| 329 | 329 | |
| r32401 | r32402 | |
| 332 | 332 | |
| 333 | 333 | if ((&data_length > 0) && (sizeof(file_name) > 0)) |
| 334 | 334 | { |
| 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 | |
| 337 | 338 | // Now paste the stripped down paste_data.. |
| 338 | | machine().ioport().natkeyboard().post_utf8(paste_data); |
| 339 | machine().ioport().natkeyboard().post_utf8(upload_data); |
| 339 | 340 | } |
| 340 | 341 | return MG_TRUE; |
| 341 | 342 | } |