diff --git a/db-sqlite3.cpp b/db-sqlite3.cpp index 552395d..af71f73 100644 --- a/db-sqlite3.cpp +++ b/db-sqlite3.cpp @@ -1,6 +1,6 @@ #include "db-sqlite3.h" #include -#include // for usleep +#include "porting.h" #include "types.h" #define BLOCKPOSLIST_STATEMENT "SELECT pos, rowid FROM blocks" @@ -58,7 +58,7 @@ const DB::BlockPosList &DBSQLite3::getBlockPosList() { sqlite3_int64 rowid = sqlite3_column_int64(m_blockPosListStatement, 1); m_BlockPosList.push_back(BlockPos(blocknum, rowid)); } else if (result == SQLITE_BUSY) // Wait some time and try again - usleep(10000); + sleepMs(10); else break; } @@ -94,7 +94,7 @@ DB::Block DBSQLite3::getBlockOnPos(const BlockPos &pos) m_blocksReadCount++; break; } else if (result == SQLITE_BUSY) { // Wait some time and try again - usleep(10000); + sleepMs(10); } else { break; } diff --git a/mapper.cpp b/mapper.cpp index 3c04922..4a6a961 100644 --- a/mapper.cpp +++ b/mapper.cpp @@ -17,8 +17,8 @@ #include #include #include -#include #include +#include "porting.h" #include "TileGenerator.h" #include "PixelAttributes.h" #include "util.h" diff --git a/porting.h b/porting.h new file mode 100644 index 0000000..c093beb --- /dev/null +++ b/porting.h @@ -0,0 +1,22 @@ +#ifndef _PORTING_H +#define _PORTING_H + +#ifdef _WIN32 + +#include +#define sleepMs(x) Sleep(x) + +#else + +#include +#define sleepMs(x) usleep(x*1000) + +#endif + +#ifdef _MSC_VER + +#define strcasecmp(a, b) _stricmp(a, b) + +#endif + +#endif // _PORTING_H