trunk/src/lib/web/mongoose.c
| r24798 | r24799 | |
| 181 | 181 | typedef unsigned short uint16_t; |
| 182 | 182 | typedef unsigned __int64 uint64_t; |
| 183 | 183 | typedef __int64 int64_t; |
| 184 | | #define INT64_MAX 9223372036854775807 |
| 184 | #if defined(__GNUC__) || defined(_MSC_VER) |
| 185 | #define U64(val) val##ULL |
| 186 | #else |
| 187 | #define U64(val) val |
| 188 | #endif |
| 189 | #define INT64_MAX U64(9223372036854775807) |
| 185 | 190 | #endif // HAVE_STDINT |
| 186 | 191 | |
| 187 | 192 | // POSIX dirent interface |
| r24798 | r24799 | |
| 4302 | 4307 | // there is no other thread can save into the same file simultaneously. |
| 4303 | 4308 | fp = NULL; |
| 4304 | 4309 | // Construct destination file name. Do not allow paths to have slashes. |
| 4305 | | if ((s = strrchr(fname, '/')) == NULL && |
| 4310 | if ((s = strrchr(fname, '/')) == NULL && |
| 4306 | 4311 | (s = strrchr(fname, '\\')) == NULL) { |
| 4307 | 4312 | s = fname; |
| 4308 | 4313 | } |
| 4309 | | |
| 4314 | |
| 4310 | 4315 | // Open file in binary mode. TODO: set an exclusive lock. |
| 4311 | 4316 | snprintf(path, sizeof(path), "%s/%s", destination_dir, s); |
| 4312 | 4317 | if ((fp = fopen(path, "wb")) == NULL) { |