Fix libjasper build with MSVC

This commit is contained in:
Andrey Kamaev 2012-08-29 23:15:07 +04:00
parent 6e6cfdd024
commit d8015fd6ed
4 changed files with 20 additions and 2 deletions

View File

@ -23,8 +23,8 @@ if(MSVC)
add_definitions(-DJAS_WIN_MSVC_BUILD)
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow -Wsign-compare
/wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow -Wsign-compare)
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4018 /wd4101 /wd4244 /wd4267 /wd4715) # vs2005
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)

View File

@ -78,7 +78,9 @@
#include <string.h>
#include <limits.h>
#include <errno.h>
#ifndef _WIN32
#include <stdint.h>
#endif
#include "jasper/jas_malloc.h"

View File

@ -363,6 +363,17 @@ jas_stream_t *jas_stream_tmpfile()
obj->flags = 0;
stream->obj_ = obj;
#ifdef _WIN32
/* Choose a file name. */
tmpnam(obj->pathname);
/* Open the underlying file. */
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
JAS_STREAM_PERMS)) < 0) {
jas_stream_destroy(stream);
return 0;
}
#else
/* Choose a file name. */
snprintf(obj->pathname, L_tmpnam, "%s/tmp.XXXXXXXXXX", P_tmpdir);
@ -371,6 +382,7 @@ jas_stream_t *jas_stream_tmpfile()
jas_stream_destroy(stream);
return 0;
}
#endif
/* Unlink the file so that it will disappear if the program
terminates abnormally. */

View File

@ -252,7 +252,11 @@ typedef struct {
typedef struct {
int fd;
int flags;
#if defined _WIN32 && !defined __MINGW__ && !defined __MINGW32__
char pathname[MAX_PATH + 1];
#else
char pathname[PATH_MAX + 1];
#endif
} jas_stream_fileobj_t;
#define JAS_STREAM_FILEOBJ_DELONCLOSE 0x01