ufairiya / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Mongoose r478 doesn't compile and run on windows vs2005 #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
Was running on Windows Vista.

- Had downloaded mongoose r478 from the code repository and was compiling.
Did not attempt to use the installers for older versions.

- Had to replace calling strtoll with _strtoi64 on windows since strtoll
doesn't exist on windows in order to successfully compile.

- When serving a file, the server crashed when calling
send_file()/mg_printf():2792. The INT64_FMT is incorrect.

A corrected mongoose.c is included in the attached files as well as a
visual studio solution and projects.

Please provide any additional information below.

Here's a diff of the changes I made to get it to work on Windows:
$ diff mongoose-r478.c mongoose.c
101c101
< #define INT64_FMT             "I64"

---
> #define INT64_FMT             "I64d"
1537a1538,1541
>
> #ifdef _WIN32
>       return (cl == NULL ? -1 : _strtoi64(cl, NULL, 10));
> #else
1538a1543
> #endif

Original issue reported on code.google.com by crul...@gmail.com on 13 Jan 2010 at 5:07

Attachments:

GoogleCodeExporter commented 9 years ago
I ran into the same problem after compiling with VC6. The symptoms are as 
follows:

Stack:
------
HTTPGUI! _output + 1129 bytes
HTTPGUI! _vsnprintf + 44 bytes
mg_vsnprintf(mg_connection * 0x00c0fd3c, char * 0x00c0ba64, unsigned int 8192, 
const 
char * 0x0041ec88, char * 0x00c0da74) line 584 + 21 bytes
mg_printf(mg_connection * 0x00c0fd3c, const char * 0x0041ec88) line 1524 + 32 
bytes
send_file(mg_connection * 0x00c0fd3c, const char * 0x00c0dc10, mgstat * 
0x00c0dbf4) 
line 2802 + 81 bytes
analyze_request(mg_connection * 0x00c0fd3c) line 3717 + 23 bytes
process_new_connection(mg_connection * 0x00c0fd3c) line 4458 + 9 bytes
worker_thread(mg_context * 0x00356e38) line 4541 + 12 bytes
KERNEL32! 7c80b729()

mg_printf:   fmt parameter
--------------------------
0x0041ec88 "HTTP/1.1 %d %s
Date: %s
Last-Modified: %s
Etag: "%s"
Content-Type: %.*s
Content-Length: %I64
Connection: close
Accept-Ranges: bytes
%s
"

mg_vsnprintf:    buf parameter
------------------------------
0x00c0ba64 "HTTP/1.1 200 OK
Date: Wed, 24 Feb 2010 08:23:07 Westeuropäische Normalzeit
Last-Modified: Fri, 19 Feb 2010 07:47:30 Westeuropäische Normalzeit
Etag: "4b7e3402.226"
Content-Type: text/html
Content-Length: 
Connection: close
Accept-Range"

Apparently _vsnprintf manages to print "text/html" and then crashes with an 
address 
exception.

#define INT64_FMT       "I64"

is defintely a bug, check:
http://msdn.microsoft.com/en-us/library/56e442dc(VS.71).aspx

The specification says:
%[flags] [width] [.precision] [{h | l | I | I32 | I64}]type

i.e. the "type" character is mandatory.

#define INT64_FMT       "I64d"

will fix the problem.

Original comment by winfr...@harbecke.com on 24 Feb 2010 at 5:43

GoogleCodeExporter commented 9 years ago
Thank you. Incorporated in the working version, which is not submitted yet.

Original comment by valenok on 24 Feb 2010 at 5:51

GoogleCodeExporter commented 9 years ago
In the head version as of http://code.google.com/p/mongoose/source/detail?r=494
Thanks!

Original comment by valenok on 21 Apr 2010 at 11:42

GoogleCodeExporter commented 9 years ago
Issue 132 has been merged into this issue.

Original comment by valenok on 21 Apr 2010 at 11:44