diff --git a/CMakeLists.txt b/CMakeLists.txt index 5678b14889fdcc92431f0951c8ac46d026e926b9..0967495662a6c0087d05881b182f5b48ae3cab04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ project(xtc-length) -if(CMAKE_VERSION VERSION_GREATER "3.1") - set(CMAKE_C_STANDARD 99) +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") endif() add_executable(xtc-length xtc-length.c) diff --git a/xtc-length.c b/xtc-length.c index 8e14bca585f2814bdc9f196ce84e3a7f687db17f..ed28e1c89f89a2966bd17bd736a50ddcfe4db760 100644 --- a/xtc-length.c +++ b/xtc-length.c @@ -1,5 +1,5 @@ #include <stdio.h> -#include <inttypes.h> +#include <stdint.h> #include <locale.h> #include <string.h> @@ -33,7 +33,7 @@ int get_xtc_num_frames(const char *filename, int *nframes, int *natoms, float *p *natoms = u4_from_buffer(header+4); uint32_t frame_size = u4_from_buffer(header+88); // Read frame size from header uint32_t skip = (frame_size+3) & ~((uint32_t)3); // Round up to 4 bytes - fseek(xtc, skip, SEEK_CUR); // Skip to next header + fseeko(xtc, skip, SEEK_CUR); // Skip to next header } uint32_t ps_tmp = u4_from_buffer(header+12); memcpy(psec, &ps_tmp, 4);