Browse Source

Added tests for existance of fseeko/_fseeki64

master
Artyom Beilis 8 years ago
parent
commit
85d9f875d2
4 changed files with 27 additions and 5 deletions
  1. +18
    -0
      CMakeLists.txt
  2. +2
    -0
      config.cmake.h
  3. +7
    -3
      private/http_file_buffer.h
  4. +0
    -2
      tests/file_buffer_test.cpp

+ 18
- 0
CMakeLists.txt View File

@@ -246,7 +246,25 @@ check_cxx_source_compiles(
"#include <list>
int main(){std::list<int> l; __typeof__(l.begin()) p=l.begin();}"
CPPCMS_HAVE_UNDERSCORE_TYPEOF)
check_cxx_source_compiles(
"#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdio.h>
int main()
{
char is_big[sizeof(off_t) >= 8 ? 1 : -1];
fseeko(0,0,0);
}"
CPPCMS_HAVE_FSEEKO
)

check_cxx_source_compiles(
"#include <stdio.h>
int main()
{ _fseeki64(0,0,0); }"
CPPCMS_HAVE_FSEEKI64
)
if(NOT DISABLE_GZIP)
find_library(ZLIB NAMES z zdll zlib${ZLIB_SUFFIX} zlib)
find_path(ZLIB_INCLUDE_DIR zlib.h)


+ 2
- 0
config.cmake.h View File

@@ -110,6 +110,8 @@
#cmakedefine CPPCMS_NO_GZIP
#cmakedefine CPPCMS_SQLITE_LINK_STATIC
#cmakedefine CPPCMS_HAS_THREAD_PSHARED
#cmakedefine CPPCMS_HAVE_FSEEKI64
#cmakedefine CPPCMS_HAVE_FSEEKO


#endif

+ 7
- 3
private/http_file_buffer.h View File

@@ -10,10 +10,14 @@
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif

#ifdef CPPCMS_WIN_NATIVE
#include <cppcms/config.h>
#include <stdlib.h>
#ifdef CPPCMS_HAVE_FSEEKO
// nothing
#elif defined(CPPCMS_HAVE_FSEEKI64)
#define fseeko(f,o,w) _fseeki64(f,o,w)
#define ftello(f) _ftelli64(f)
#else
#define fseek(f,o,w) fseek(f,o,w)
#endif

#include <booster/nowide/cstdio.h>


+ 0
- 2
tests/file_buffer_test.cpp View File

@@ -131,8 +131,6 @@ int main()
test(size,inmem[m]);
}
}
FILE *f=0;
TEST(sizeof( ftello(f) ) > 4);
}
catch(std::exception const &e) {
std::cerr << "FAIL: " << e.what() << std::endl;


Loading…
Cancel
Save