From: Zack Rusin Date: Sat, 27 Aug 2011 22:54:49 +0000 (-0400) Subject: Merge branch 'master' into on-demand-loading X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=c9385be0ae27a206be571f342f299c8762627b56;hp=712429a22a8cc9d51b620d433ade6d327fbabbf0;p=apitrace Merge branch 'master' into on-demand-loading Conflicts: trace_snappyfile.hpp --- diff --git a/thirdparty/snappy/.gitignore b/thirdparty/snappy/.gitignore new file mode 100644 index 0000000..0e56cf2 --- /dev/null +++ b/thirdparty/snappy/.gitignore @@ -0,0 +1 @@ +config.h diff --git a/thirdparty/snappy/CMakeLists.txt b/thirdparty/snappy/CMakeLists.txt index 92d1248..b727854 100644 --- a/thirdparty/snappy/CMakeLists.txt +++ b/thirdparty/snappy/CMakeLists.txt @@ -1,4 +1,30 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +# We only do the subset of the snappy autoconf that actually affect the library +# (as most of them are for the tests which we don't build.) + +include (CheckIncludeFileCXX) +include (CheckCXXSourceCompiles) +include (TestBigEndian) + +check_include_file_cxx (sys/mman.h HAVE_SYS_MMAN_H) + +check_cxx_source_compiles ( + "main() { return __builtin_expect(1, 1) ? 1 : 0; }" + HAVE_BUILTIN_EXPECT +) + +check_cxx_source_compiles ( + "main() { return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0; }" + HAVE_BUILTIN_CTZ +) + +test_big_endian (WORDS_BIGENDIAN) + +configure_file (config.h.in config.h) + +add_definitions (-DHAVE_CONFIG_H) + + +include_directories (${CMAKE_CURRENT_BINARY_DIR}) add_library (snappy_bundled STATIC snappy.cc diff --git a/thirdparty/snappy/config.h.in b/thirdparty/snappy/config.h.in index ac468d9..e82da40 100644 --- a/thirdparty/snappy/config.h.in +++ b/thirdparty/snappy/config.h.in @@ -4,73 +4,73 @@ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if the compiler supports __builtin_ctz and friends. */ -#undef HAVE_BUILTIN_CTZ +#cmakedefine HAVE_BUILTIN_CTZ /* Define to 1 if the compiler supports __builtin_expect. */ -#undef HAVE_BUILTIN_EXPECT +#cmakedefine HAVE_BUILTIN_EXPECT /* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H +#cmakedefine HAVE_DLFCN_H /* Use the gflags package for command-line parsing. */ -#undef HAVE_GFLAGS +#cmakedefine HAVE_GFLAGS /* Defined when Google Test is available. */ -#undef HAVE_GTEST +#cmakedefine HAVE_GTEST /* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H +#cmakedefine HAVE_INTTYPES_H /* Define to 1 if you have the `fastlz' library (-lfastlz). */ -#undef HAVE_LIBFASTLZ +#cmakedefine HAVE_LIBFASTLZ /* Define to 1 if you have the `lzf' library (-llzf). */ -#undef HAVE_LIBLZF +#cmakedefine HAVE_LIBLZF /* Define to 1 if you have the `lzo2' library (-llzo2). */ -#undef HAVE_LIBLZO2 +#cmakedefine HAVE_LIBLZO2 /* Define to 1 if you have the `quicklz' library (-lquicklz). */ -#undef HAVE_LIBQUICKLZ +#cmakedefine HAVE_LIBQUICKLZ /* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ +#cmakedefine HAVE_LIBZ /* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H +#cmakedefine HAVE_MEMORY_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H +#cmakedefine HAVE_STDDEF_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H +#cmakedefine HAVE_STDINT_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H +#cmakedefine HAVE_STDLIB_H /* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H +#cmakedefine HAVE_STRINGS_H /* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H +#cmakedefine HAVE_STRING_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H +#cmakedefine HAVE_SYS_MMAN_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H +#cmakedefine HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +#cmakedefine HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H +#cmakedefine HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H +#cmakedefine HAVE_UNISTD_H /* Define to 1 if you have the header file. */ -#undef HAVE_WINDOWS_H +#cmakedefine HAVE_WINDOWS_H /* Define to the sub-directory in which libtool stores uninstalled libraries. */ @@ -105,12 +105,4 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif +#cmakedefine WORDS_BIGENDIAN diff --git a/trace_file.hpp b/trace_file.hpp index fed30a0..e3d797d 100644 --- a/trace_file.hpp +++ b/trace_file.hpp @@ -143,7 +143,7 @@ inline void File::flush(void) inline int File::getc() { if (!m_isOpened || m_mode != File::Read) { - return 0; + return -1; } return rawGetc(); } diff --git a/trace_snappyfile.hpp b/trace_snappyfile.hpp index 6c0c9ad..2ee95be 100644 --- a/trace_snappyfile.hpp +++ b/trace_snappyfile.hpp @@ -75,7 +75,6 @@ private: { return m_stream.eof() && freeCacheSize() == 0; } - void flushCache(); void createCache(size_t size); void writeCompressedLength(uint32_t num);