Skip to content

Commit

Permalink
Various win32 fixups
Browse files Browse the repository at this point in the history
o Fixing cmakelists.txt
o moving header guards above checks for BSON_COMPILATION and the like
o fixing some iso8601 win32 bugs
  • Loading branch information
hanumantmk committed Nov 7, 2014
1 parent d028a28 commit c7c8109
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 65 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ set (SOURCES
${SOURCE_DIR}/src/bson/bson-clock.c
${SOURCE_DIR}/src/bson/bson-context.c
${SOURCE_DIR}/src/bson/bson-error.c
${SOURCE_DIR}/src/bson/bson-iso8601.c
${SOURCE_DIR}/src/bson/bson-iter.c
${SOURCE_DIR}/src/bson/bson-json.c
${SOURCE_DIR}/src/bson/bson-keys.c
Expand Down Expand Up @@ -176,6 +177,7 @@ add_executable(test-libbson
${SOURCE_DIR}/tests/test-endian.c
${SOURCE_DIR}/tests/test-clock.c
${SOURCE_DIR}/tests/test-error.c
${SOURCE_DIR}/tests/test-iso8601.c
${SOURCE_DIR}/tests/test-iter.c
${SOURCE_DIR}/tests/test-json.c
${SOURCE_DIR}/tests/test-oid.c
Expand All @@ -188,7 +190,7 @@ add_executable(test-libbson
${SOURCE_DIR}/tests/test-bcon-extract.c
)

target_link_libraries(test-libbson bson_shared)
target_link_libraries(test-libbson bson_static)
add_test(NAME test-libbson COMMAND test-libbson)

file(COPY ${SOURCE_DIR}/tests/binary DESTINATION ${PROJECT_BINARY_DIR}/tests)
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_CLOCK_H
#define BSON_CLOCK_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_CLOCK_H
#define BSON_CLOCK_H


#include "bson-compat.h"
#include "bson-macros.h"
#include "bson-types.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_COMPAT_H
#define BSON_COMPAT_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_COMPAT_H
#define BSON_COMPAT_H


#include "bson-config.h"
#include "bson-macros.h"

Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_CONTEXT_H
#define BSON_CONTEXT_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_CONTEXT_H
#define BSON_CONTEXT_H


#include "bson-macros.h"
#include "bson-types.h"

Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_ENDIAN_H
#define BSON_ENDIAN_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_ENDIAN_H
#define BSON_ENDIAN_H


#if defined(__sun)
# include <sys/byteorder.h>
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-iso8601.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ _bson_iso8601_date_parse (const char *str,
#ifdef BSON_OS_WIN32
SYSTEMTIME win_sys_time;
FILETIME win_file_time;
uint64_t win_time_offset;
uint64_t win_epoch_difference;
int64_t win_time_offset;
int64_t win_epoch_difference;
#else
struct tm posix_date = { 0 };
#endif
Expand Down Expand Up @@ -290,7 +290,7 @@ _bson_iso8601_date_parse (const char *str,
win_sys_time.wHour = hour;
win_sys_time.wDay = day;
win_sys_time.wDayOfWeek = -1; /* ignored */
win_sys_time.wMonth = month;
win_sys_time.wMonth = month + 1;
win_sys_time.wYear = year + 1900;

/* the wDayOfWeek member of SYSTEMTIME is ignored by this function */
Expand All @@ -308,7 +308,7 @@ _bson_iso8601_date_parse (const char *str,
/* There are 11644473600 seconds between the unix epoch and the windows epoch
* 100-nanoseconds = milliseconds * 10000
*/
uint64_t win_epoch_difference = 11644473600000 * 10000;
win_epoch_difference = 11644473600000 * 10000;

/* removes the diff between 1970 and 1601 */
win_time_offset -= win_epoch_difference;
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_ITER_H
#define BSON_ITER_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_ITER_H
#define BSON_ITER_H


#include "bson.h"
#include "bson-endian.h"
#include "bson-macros.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-json.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_JSON_H
#define BSON_JSON_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_JSON_H
#define BSON_JSON_H


#include "bson.h"


Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_MACROS_H
#define BSON_MACROS_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_MACROS_H
#define BSON_MACROS_H


#include <assert.h>
#include <stdio.h>

Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
*/


#ifndef BSON_MD5_H
#define BSON_MD5_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_MD5_H
#define BSON_MD5_H


#include "bson-endian.h"


Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_MEMORY_H
#define BSON_MEMORY_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_MEMORY_H
#define BSON_MEMORY_H


#include "bson-macros.h"
#include "bson-types.h"

Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-oid.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_OID_H
#define BSON_OID_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_OID_H
#define BSON_OID_H


#include <time.h>

#include "bson-context.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_READER_H
#define BSON_READER_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_READER_H
#define BSON_READER_H


#include "bson-compat.h"
#include "bson-oid.h"
#include "bson-types.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-string.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_STRING_H
#define BSON_STRING_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_STRING_H
#define BSON_STRING_H


#include <stdarg.h>

#include "bson-macros.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-thread-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_THREAD_PRIVATE_H
#define BSON_THREAD_PRIVATE_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_THREAD_PRIVATE_H
#define BSON_THREAD_PRIVATE_H


#include "bson-compat.h"
#include "bson-config.h"
#include "bson-macros.h"
Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_TYPES_H
#define BSON_TYPES_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
#error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_TYPES_H
#define BSON_TYPES_H


#include <stdlib.h>
#include <sys/types.h>

Expand Down
8 changes: 4 additions & 4 deletions src/bson/bson-utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/


#ifndef BSON_UTF8_H
#define BSON_UTF8_H


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
# error "Only <bson.h> can be included directly."
#endif


#ifndef BSON_UTF8_H
#define BSON_UTF8_H


#include "bson-macros.h"
#include "bson-types.h"

Expand Down

0 comments on commit c7c8109

Please sign in to comment.