diff options
author | Anton Adamansky <adamansky@gmail.com> | 2015-03-27 14:50:15 +0600 |
---|---|---|
committer | Anton Adamansky <adamansky@gmail.com> | 2015-03-27 14:50:15 +0600 |
commit | d9a3adb28a0b6d8d75f3b97c1896250d904f1c6c (patch) | |
tree | 47377679a7e0419e5e754f078f2ceeea6d773306 | |
parent | cedfb95087c98612f52d841cb8ce9fd4c3d194c4 (diff) | |
download | ejdb-d9a3adb28a0b6d8d75f3b97c1896250d904f1c6c.tar.gz ejdb-d9a3adb28a0b6d8d75f3b97c1896250d904f1c6c.tar.bz2 ejdb-d9a3adb28a0b6d8d75f3b97c1896250d904f1c6c.zip |
Build fixes #122 #121 (OSX)
30 files changed, 460 insertions, 401 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f0e67c..87bb46d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,10 @@ option(PACKAGE_TGZ "Build .tgz package archive" ON) option(ENABLE_PPA "Enable PPA package build" OFF) option(UPLOAD_PPA "Upload debian packages to the launchpad ppa repository" OFF) +if (POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif(POLICY CMP0042) + if (CMAKE_SIZEOF_VOID_P MATCHES 8) set(PROJECT_ARCH "x86_64") else(CMAKE_SIZEOF_VOID_P MATCHES 8) @@ -1,3 +1,9 @@ +ejdb (1.2.5) UNRELEASED; urgency=medium + + * Fixed build for OSX 10.10 + + -- Anton Adamansky <adamansky@gmail.com> Fri, 27 Mar 2015 10:21:41 +0600 + ejdb (1.2.4) testing; urgency=low * rt lib depenedency on MacOS diff --git a/installer/CMakeLists.txt b/installer/CMakeLists.txt index 21ab97f..3f26ab3 100644 --- a/installer/CMakeLists.txt +++ b/installer/CMakeLists.txt @@ -11,7 +11,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/README.md") set(CPACK_PACKAGE_FILE_NAME -"${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_BUILD_TYPE}-${CMAKE_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}") +"${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_BUILD_TYPE}-${CMAKE_SYSTEM_NAME}-${PROJECT_ARCH}") if (CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_STRIP_FILES ON) endif() @@ -42,6 +42,10 @@ if (PACKAGE_DEB) set(CPACK_DEBIAN_UPDATE_CHANGELOG ON) endif(PACKAGE_DEB) +if (PACKAGE_TGZ) + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) +endif(PACKAGE_TGZ) + include(CPack) if (ENABLE_PPA) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c215678..567e2b2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,16 +1,3 @@ -if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - message(FATAL_ERROR "GCC version must be at least 4.7!") - endif() -elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") - if (CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - message(FATAL_ERROR "Clang version must be at least 3.4!") - endif() -else() - message(FATAL_ERROR "You are using an unsupported compiler! EJDB has only been tested \ - with Clang >= 3.4 and GCC >= 4.7") -endif() - if(APPLE) option(BUILD_FRAMEWORK "Build an OS X framework" OFF) set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.") @@ -32,7 +19,6 @@ if (WIN32) include(Win32LIBTools) endif() - if (NOT CMAKE_BUILD_TYPE) message(FATAL_ERROR "Please specify the build type -DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo") endif(NOT CMAKE_BUILD_TYPE) @@ -157,7 +143,11 @@ include_directories(${EJDB_INCLUDE_DIRS}) target_link_libraries(ejdb ${EJDB_LLIBRARIES}) target_link_libraries(ejdb_p ${EJDB_LLIBRARIES}) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fsigned-char -pedantic -Wfatal-errors -fPIC") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fsigned-char -pedantic -Wfatal-errors") +if (NOT WIN32) ## todo review + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +endif(NOT WIN32) + set(CMAKE_C_FLAGS_DEBUG "-O0 -g -Werror -DDEBUG -D_DEBUG -UNDEBUG") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -g") diff --git a/src/bson/bson.c b/src/bson/bson.c index 1152481..c2f92c4 100644 --- a/src/bson/bson.c +++ b/src/bson/bson.c @@ -298,7 +298,7 @@ void bson_print_raw(const char *data, int depth) { fprintf(f, "%d", bson_iterator_int(&i)); break; case BSON_LONG: - fprintf(f, "%" PRIdMAX "", (uint64_t) bson_iterator_long(&i)); + fprintf(f, "%" PRId64 "", (uint64_t) bson_iterator_long(&i)); break; case BSON_TIMESTAMP: ts = bson_iterator_timestamp(&i); @@ -1286,7 +1286,7 @@ void bson_numstr(char *str, int64_t i) { if (i >= 0 && i < 1000) memcpy(str, bson_numstrs[i], 4); else - sprintf(str, "%" PRIdMAX "", (int64_t) i); + sprintf(str, "%" PRId64 "", (int64_t) i); } #pragma GCC diagnostic push @@ -1297,7 +1297,7 @@ int bson_numstrn(char *str, int maxbuf, int64_t i) { memcpy(str, bson_numstrs[i], 4); return strlen(bson_numstrs[i]); } else { - return snprintf(str, maxbuf, "%" PRIdMAX "", (int64_t) i); + return snprintf(str, maxbuf, "%" PRId64 "", (int64_t) i); } } #pragma GCC diagnostic pop diff --git a/src/ejdb/tests/CMakeLists.txt b/src/ejdb/tests/CMakeLists.txt index fb36af8..c17fc92 100644 --- a/src/ejdb/tests/CMakeLists.txt +++ b/src/ejdb/tests/CMakeLists.txt @@ -1,4 +1,6 @@ -link_libraries(ejdb_p cunit) +link_libraries(ejdb_p ${CUNIT_LIBRARIES}) +include_directories(${CUNIT_INCLUDE_DIRS}) + set(TEST_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TEST_DATA_DIR}) diff --git a/src/ejdb/tests/ejdbtest2.c b/src/ejdb/tests/ejdbtest2.c index 5fe3f6f..b34ecf3 100644 --- a/src/ejdb/tests/ejdbtest2.c +++ b/src/ejdb/tests/ejdbtest2.c @@ -3505,7 +3505,7 @@ void testDropAll(void) { ejdbquerydel(q1); } -void testTokens$begin(void) { +void testTokensBegin(void) { EJCOLL *coll = ejdbcreatecoll(jb, "contacts", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); CU_ASSERT_TRUE(ejdbsetindex(coll, "name", JBIDXSTR)); @@ -3607,7 +3607,7 @@ void testOneFieldManyConditions(void) { ejdbquerydel(q1); } -void test$addToSet(void) { +void testAddToSet(void) { EJCOLL *coll = ejdbcreatecoll(jb, "contacts", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); bson bsq1; @@ -3771,7 +3771,7 @@ void test$addToSet(void) { ejdbquerydel(q1); } -void test$pull(void) { +void testPull(void) { EJCOLL *coll = ejdbcreatecoll(jb, "contacts", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); bson bsq1; @@ -4003,7 +4003,7 @@ void testFindInComplexArray(void) { ejdbquerydel(q1); } -void test$elemMatch(void) { +void testElemMatch(void) { // { complexarr: { $elemMatch: { key: 'title', value: 'some title' } } } EJCOLL *coll = ejdbcreatecoll(jb, "contacts", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); @@ -4142,7 +4142,7 @@ void test$elemMatch(void) { ejdbquerydel(q1); } -void test$not$elemMatch(void) { +void testNotElemMatch(void) { // { complexarr: { $not: { $elemMatch: { key: 'title', value: 'some title' } } } } EJCOLL *coll = ejdbcreatecoll(jb, "contacts", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); @@ -4290,7 +4290,7 @@ void testTicket16(void) { CU_ASSERT_EQUAL(coll->tdb->inum, 0); } -void test$upsert(void) { +void testUpsert(void) { EJCOLL *coll = ejdbcreatecoll(jb, "abcd", NULL); CU_ASSERT_PTR_NOT_NULL_FATAL(coll); bson bsq1; @@ -5677,15 +5677,15 @@ int main() { (NULL == CU_add_test(pSuite, "testUpdate3", testUpdate3)) || (NULL == CU_add_test(pSuite, "testQueryBool", testQueryBool)) || (NULL == CU_add_test(pSuite, "testDropAll", testDropAll)) || - (NULL == CU_add_test(pSuite, "testTokens$begin", testTokens$begin)) || + (NULL == CU_add_test(pSuite, "testTokensBegin", testTokensBegin)) || (NULL == CU_add_test(pSuite, "testOneFieldManyConditions", testOneFieldManyConditions)) || - (NULL == CU_add_test(pSuite, "test$addToSet", test$addToSet)) || - (NULL == CU_add_test(pSuite, "test$pull", test$pull)) || + (NULL == CU_add_test(pSuite, "testAddToSet", testAddToSet)) || + (NULL == CU_add_test(pSuite, "testPull", testPull)) || (NULL == CU_add_test(pSuite, "testFindInComplexArray", testFindInComplexArray)) || - (NULL == CU_add_test(pSuite, "test$elemMatch", test$elemMatch)) || - (NULL == CU_add_test(pSuite, "test$not$elemMatch", test$not$elemMatch)) || + (NULL == CU_add_test(pSuite, "testElemMatch", testElemMatch)) || + (NULL == CU_add_test(pSuite, "testNotElemMatch", testNotElemMatch)) || (NULL == CU_add_test(pSuite, "testTicket16", testTicket16)) || - (NULL == CU_add_test(pSuite, "test$upsert", test$upsert)) || + (NULL == CU_add_test(pSuite, "testUpsert", testUpsert)) || (NULL == CU_add_test(pSuite, "testPrimitiveCases1", testPrimitiveCases1)) || (NULL == CU_add_test(pSuite, "testTicket29", testTicket29)) || (NULL == CU_add_test(pSuite, "testTicket28", testTicket28)) || diff --git a/src/ejdb/tests/ejdbtest3.c b/src/ejdb/tests/ejdbtest3.c index de79205..222cc6f 100644 --- a/src/ejdb/tests/ejdbtest3.c +++ b/src/ejdb/tests/ejdbtest3.c @@ -274,9 +274,10 @@ ffinish: return err ? "error" : NULL; } +#define tnum 50 + void testRace1() { CU_ASSERT_PTR_NOT_NULL_FATAL(jb); - const int tnum = 50; bool err = false; TARGRACE targs[tnum]; pthread_t threads[tnum]; @@ -318,7 +319,6 @@ finish: void testRace2() { CU_ASSERT_PTR_NOT_NULL_FATAL(jb); - const int tnum = 50; bool err = false; TARGRACE targs[tnum]; pthread_t threads[tnum]; diff --git a/src/ejdb/tests/ejdbtest5.c b/src/ejdb/tests/ejdbtest5.c index 23efb30..72c75a1 100644 --- a/src/ejdb/tests/ejdbtest5.c +++ b/src/ejdb/tests/ejdbtest5.c @@ -12,4 +12,5 @@ int main() { // ejdbclose(jb); // ejdbdel(jb); return 0; -}
\ No newline at end of file +} + diff --git a/src/myconf.h.in b/src/myconf.h.in index 535ea71..ca8f0c4 100644 --- a/src/myconf.h.in +++ b/src/myconf.h.in @@ -19,9 +19,9 @@ #define _MYCONF_H #if ( (defined(__clang__) && ((__clang_major__ - 0) * 100 + (__clang_minor__ - 0)) < 302) || \ - (!defined(__clang__) && defined(__GNUC__) && ((__GNUC__ - 0) * 100 + (__GNUC_MINOR__ - 0)) < 407) || \ + (!defined(__clang__) && defined(__GNUC__) && ((__GNUC__ - 0) * 100 + (__GNUC_MINOR__ - 0)) < 402) || \ (!defined(__GNUC__) && !defined(__clang__)) ) -#error You are using an unsupported compiler! EJDB has only been tested with Clang >= 3.2 and GCC >= 4.7 +#error You are using an unsupported compiler! EJDB has only been tested with Clang >= 3.2 and GCC >= 4.2 #endif #include "basedefs.h" @@ -523,31 +523,84 @@ EJDB_EXPORT void *_tc_recdecode(const void *ptr, int size, int *sp, void *op); /************************************************************************************************* * atomics *************************************************************************************************/ + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif #define TCAS(ptr, expected, desired) __sync_bool_compare_and_swap(ptr, expected, desired) -/* +#if !defined(__GNUC__) || \ + ((__GNUC__ - 0) * 100 + (__GNUC_MINOR__ - 0)) < 407 || \ + defined(__INTEL_COMPILER) || defined(__clang__) + +#if !__has_builtin(__atomic_load_n) #define __atomic_load_n(ptr,order) *(ptr) +#endif + +#if !__has_builtin(__atomic_store_n) #define __atomic_store_n(ptr,val,order) (*(ptr) = (val), (void)0) +#endif + +#if !__has_builtin(__atomic_exchange_n) #define __atomic_exchange_n(ptr,val,order) __sync_lock_test_and_set(ptr, val) +#endif + +#if !__has_builtin(__atomic_compare_exchange_n) #define __atomic_compare_exchange_n(ptr,expected,desired,weak,order1,order2) \ __sync_bool_compare_and_swap(ptr, *(expected), desired) ? 1 : \ (*(expected) = *(ptr), 0) +#endif +#if !__has_builtin(__atomic_add_fetch) #define __atomic_add_fetch(ptr,val,order) __sync_add_and_fetch(ptr, val) +#endif + +#if !__has_builtin(__atomic_sub_fetch) #define __atomic_sub_fetch(ptr,val,order) __sync_sub_and_fetch(ptr, val) +#endif + +#if !__has_builtin(__atomic_or_fetch) #define __atomic_or_fetch(ptr,val,order) __sync_or_and_fetch(ptr, val) +#endif + +#if !__has_builtin(__atomic_and_fetch) #define __atomic_and_fetch(ptr,val,order) __sync_and_and_fetch(ptr, val) +#endif + +#if !__has_builtin(__atomic_xor_fetch) #define __atomic_xor_fetch(ptr,val,order) __sync_xor_and_fetch(ptr, val) +#endif + +#if !__has_builtin(__atomic_nand_fetch) #define __atomic_nand_fetch(ptr,val,order) __sync_nand_and_fetch(ptr, val) +#endif +#if !__has_builtin(__atomic_fetch_add) #define __atomic_fetch_add(ptr,val,order) __sync_fetch_and_add(ptr, val) +#endif + +#if !__has_builtin(__atomic_fetch_sub) #define __atomic_fetch_sub(ptr,val,order) __sync_fetch_and_sub(ptr, val) +#endif + +#if !__has_builtin(__atomic_fetch_or) #define __atomic_fetch_or(ptr,val,order) __sync_fetch_and_or(ptr, val) +#endif + +#if !__has_builtin(__atomic_fetch_and) #define __atomic_fetch_and(ptr,val,order) __sync_fetch_and_and(ptr, val) +#endif + +#if !__has_builtin(__atomic_fetch_xor) #define __atomic_fetch_xor(ptr,val,order) __sync_fetch_and_xor(ptr, val) +#endif + +#if !__has_builtin(__atomic_fetch_nand) #define __atomic_fetch_nand(ptr,val,order) __sync_fetch_and_nand(ptr, val) -*/ +#endif + +#endif #endif // duplication check diff --git a/src/tcbdb/tcbdb.c b/src/tcbdb/tcbdb.c index b088ea6..7163087 100644 --- a/src/tcbdb/tcbdb.c +++ b/src/tcbdb/tcbdb.c @@ -1847,7 +1847,7 @@ static bool tcbdbleafsave(TCBDB *bdb, BDBLEAF *leaf) { } } bool err = false; - step = sprintf(hbuf, "%" PRIxMAX "", (uint64_t) leaf->id); + step = sprintf(hbuf, "%" PRIx64 "", (uint64_t) leaf->id); if (ln < 1 && !tchdbout(bdb->hdb, hbuf, step) && tchdbecode(bdb->hdb) != TCENOREC) err = true; if (!leaf->dead && !tchdbput(bdb->hdb, hbuf, step, TCXSTRPTR(rbuf), TCXSTRSIZE(rbuf))) @@ -1875,7 +1875,7 @@ static BDBLEAF *tcbdbleafload(TCBDB *bdb, uint64_t id) { TCDODEBUG(bdb->cnt_loadleaf++); char hbuf[(sizeof (uint64_t) + 1)*3]; int step; - step = sprintf(hbuf, "%" PRIxMAX "", (uint64_t) id); + step = sprintf(hbuf, "%" PRIx64 "", (uint64_t) id); char *rbuf = NULL; char wbuf[BDBPAGEBUFSIZ]; const char *rp = NULL; @@ -1993,7 +1993,7 @@ static bool tcbdbleafcheck(TCBDB *bdb, uint64_t id) { if (clk) BDBUNLOCKCACHE(bdb); if (leaf) return true; char hbuf[(sizeof (uint64_t) + 1)*3]; - int step = sprintf(hbuf, "%" PRIxMAX "", (uint64_t) id); + int step = sprintf(hbuf, "%" PRIx64 "", (uint64_t) id); return tchdbvsiz(bdb->hdb, hbuf, step) > 0; } @@ -2385,7 +2385,7 @@ static bool tcbdbnodesave(TCBDB *bdb, BDBNODE *node) { TCXSTRCAT(rbuf, ebuf, idx->ksiz); } bool err = false; - step = sprintf(hbuf, "#%" PRIxMAX "", (uint64_t) (node->id - BDBNODEIDBASE)); + step = sprintf(hbuf, "#%" PRIx64 "", (uint64_t) (node->id - BDBNODEIDBASE)); if (ln < 1 && !tchdbout(bdb->hdb, hbuf, step) && tchdbecode(bdb->hdb) != TCENOREC) err = true; if (!node->dead && !tchdbput(bdb->hdb, hbuf, step, TCXSTRPTR(rbuf), TCXSTRSIZE(rbuf))) @@ -2413,7 +2413,7 @@ static BDBNODE *tcbdbnodeload(TCBDB *bdb, uint64_t id) { TCDODEBUG(bdb->cnt_loadnode++); char hbuf[(sizeof (uint64_t) + 1)*2]; int step; - step = sprintf(hbuf, "#%" PRIxMAX "", (uint64_t) (id - BDBNODEIDBASE)); + step = sprintf(hbuf, "#%" PRIx64 "", (uint64_t) (id - BDBNODEIDBASE)); char *rbuf = NULL; char wbuf[BDBPAGEBUFSIZ]; const char *rp = NULL; @@ -3312,7 +3312,7 @@ static bool tcbdboptimizeimpl(TCBDB *bdb, int32_t lmemb, int32_t nmemb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts) { assert(bdb); char *opath = tcstrdup(tchdbpath(bdb->hdb)); - char *tpath = tcsprintf("%s%ctmp%c%" PRIuMAX "", opath, MYEXTCHR, MYEXTCHR, tchdbinode(bdb->hdb)); + char *tpath = tcsprintf("%s%ctmp%c%" PRIu64 "", opath, MYEXTCHR, MYEXTCHR, tchdbinode(bdb->hdb)); int omode = (tchdbomode(bdb->hdb) & ~BDBOCREAT) & ~BDBOTRUNC; TCBDB *tbdb = tcbdbnew(); HANDLE dbgfd = tchdbdbgfd(bdb->hdb); @@ -3949,12 +3949,12 @@ void tcbdbprintmeta(TCBDB *bdb) { wp += sprintf(wp, " lmemb=%u", bdb->lmemb); wp += sprintf(wp, " nmemb=%u", bdb->nmemb); wp += sprintf(wp, " opts=%u", bdb->opts); - wp += sprintf(wp, " root=%" PRIxMAX "", (uint64_t) bdb->root); - wp += sprintf(wp, " first=%" PRIxMAX "", (uint64_t) bdb->first); - wp += sprintf(wp, " last=%" PRIxMAX "", (uint64_t) bdb->last); - wp += sprintf(wp, " lnum=%" PRIuMAX "", (uint64_t) bdb->lnum); - wp += sprintf(wp, " nnum=%" PRIuMAX "", (uint64_t) bdb->nnum); - wp += sprintf(wp, " rnum=%" PRIuMAX "", (uint64_t) bdb->rnum); + wp += sprintf(wp, " root=%" PRIx64 "", (uint64_t) bdb->root); + wp += sprintf(wp, " first=%" PRIx64 "", (uint64_t) bdb->first); + wp += sprintf(wp, " last=%" PRIx64 "", (uint64_t) bdb->last); + wp += sprintf(wp, " lnum=%" PRIu64 "", (uint64_t) bdb->lnum); + wp += sprintf(wp, " nnum=%" PRIu64 "", (uint64_t) bdb->nnum); + wp += sprintf(wp, " rnum=%" PRIu64 "", (uint64_t) bdb->rnum); wp += sprintf(wp, " leafc=%p", (void *) bdb->leafc); wp += sprintf(wp, " nodec=%p", (void *) bdb->nodec); wp += sprintf(wp, " cmp=%p", (void *) (intptr_t) bdb->cmp); @@ -3963,21 +3963,21 @@ void tcbdbprintmeta(TCBDB *bdb) { wp += sprintf(wp, " ncnum=%u", bdb->ncnum); wp += sprintf(wp, " lsmax=%u", bdb->lsmax); wp += sprintf(wp, " lschk=%u", bdb->lschk); - wp += sprintf(wp, " capnum=%" PRIuMAX "", (uint64_t) bdb->capnum); + wp += sprintf(wp, " capnum=%" PRIu64 "", (uint64_t) bdb->capnum); wp += sprintf(wp, " hist=%p", (void *) bdb->hist); wp += sprintf(wp, " hnum=%d", bdb->hnum); - wp += sprintf(wp, " hleaf=%" PRIuMAX "", (uint64_t) bdb->hleaf); - wp += sprintf(wp, " lleaf=%" PRIuMAX "", (uint64_t) bdb->lleaf); + wp += sprintf(wp, " hleaf=%" PRIu64 "", (uint64_t) bdb->hleaf); + wp += sprintf(wp, " lleaf=%" PRIu64 "", (uint64_t) bdb->lleaf); wp += sprintf(wp, " tran=%d", bdb->tran); //wp += sprintf(wp, " rbopaque=%p", (void *)bdb->rbopaque); - wp += sprintf(wp, " clock=%" PRIuMAX "", (uint64_t) bdb->clock); - wp += sprintf(wp, " cnt_saveleaf=%" PRIdMAX "", (int64_t) bdb->cnt_saveleaf); - wp += sprintf(wp, " cnt_loadleaf=%" PRIdMAX "", (int64_t) bdb->cnt_loadleaf); - wp += sprintf(wp, " cnt_killleaf=%" PRIdMAX "", (int64_t) bdb->cnt_killleaf); - wp += sprintf(wp, " cnt_adjleafc=%" PRIdMAX "", (int64_t) bdb->cnt_adjleafc); - wp += sprintf(wp, " cnt_savenode=%" PRIdMAX "", (int64_t) bdb->cnt_savenode); - wp += sprintf(wp, " cnt_loadnode=%" PRIdMAX "", (int64_t) bdb->cnt_loadnode); - wp += sprintf(wp, " cnt_adjnodec=%" PRIdMAX "", (int64_t) bdb->cnt_adjnodec); + wp += sprintf(wp, " clock=%" PRIu64 "", (uint64_t) bdb->clock); + wp += sprintf(wp, " cnt_saveleaf=%" PRId64 "", (int64_t) bdb->cnt_saveleaf); + wp += sprintf(wp, " cnt_loadleaf=%" PRId64 "", (int64_t) bdb->cnt_loadleaf); + wp += sprintf(wp, " cnt_killleaf=%" PRId64 "", (int64_t) bdb->cnt_killleaf); + wp += sprintf(wp, " cnt_adjleafc=%" PRId64 "", (int64_t) bdb->cnt_adjleafc); + wp += sprintf(wp, " cnt_savenode=%" PRId64 "", (int64_t) bdb->cnt_savenode); + wp += sprintf(wp, " cnt_loadnode=%" PRId64 "", (int64_t) bdb->cnt_loadnode); + wp += sprintf(wp, " cnt_adjnodec=%" PRId64 "", (int64_t) bdb->cnt_adjnodec); *(wp++) = '\n'; tcwrite(dbgfd, buf, wp - buf); } @@ -3995,10 +3995,10 @@ void tcbdbprintleaf(TCBDB *bdb, BDBLEAF *leaf) { char buf[BDBPAGEBUFSIZ]; char *wp = buf; wp += sprintf(wp, "LEAF:"); - wp += sprintf(wp, " id:%" PRIxMAX "", (uint64_t) leaf->id); + wp += sprintf(wp, " id:%" PRIx64 "", (uint64_t) leaf->id); wp += sprintf(wp, " size:%u", leaf->size); - wp += sprintf(wp, " prev:%" PRIxMAX "", (uint64_t) leaf->prev); - wp += sprintf(wp, " next:%" PRIxMAX "", (uint64_t) leaf->next); + wp += sprintf(wp, " prev:%" PRIx64 "", (uint64_t) leaf->prev); + wp += sprintf(wp, " next:%" PRIx64 "", (uint64_t) leaf->next); wp += sprintf(wp, " dirty:%d", leaf->dirty); wp += sprintf(wp, " dead:%d", leaf->dead); wp += sprintf(wp, " rnum:%d", TCPTRLISTNUM(recs)); @@ -4033,8 +4033,8 @@ void tcbdbprintnode(TCBDB *bdb, BDBNODE *node) { char buf[BDBPAGEBUFSIZ]; char *wp = buf; wp += sprintf(wp, "NODE:"); - wp += sprintf(wp, " id:%" PRIxMAX "", (uint64_t) node->id); - wp += sprintf(wp, " heir:%" PRIxMAX "", (uint64_t) node->heir); + wp += sprintf(wp, " id:%" PRIx64 "", (uint64_t) node->id); + wp += sprintf(wp, " heir:%" PRIx64 "", (uint64_t) node->heir); wp += sprintf(wp, " dirty:%d", node->dirty); wp += sprintf(wp, " dead:%d", node->dead); wp += sprintf(wp, " rnum:%d", TCPTRLISTNUM(idxs)); @@ -4044,7 +4044,7 @@ void tcbdbprintnode(TCBDB *bdb, BDBNODE *node) { wp = buf; BDBIDX *idx = TCPTRLISTVAL(idxs, i); char *ebuf = (char *) idx + sizeof (*idx); - wp += sprintf(wp, " [%" PRIxMAX ":%s]", (uint64_t) idx->pid, ebuf); + wp += sprintf(wp, " [%" PRIx64 ":%s]", (uint64_t) idx->pid, ebuf); } *(wp++) = '\n'; tcwrite(dbgfd, buf, wp - buf); diff --git a/src/tcbdb/tests/tcbmttest.c b/src/tcbdb/tests/tcbmttest.c index ccbd772..f1ef0b0 100644 --- a/src/tcbdb/tests/tcbmttest.c +++ b/src/tcbdb/tests/tcbmttest.c @@ -196,36 +196,36 @@ static void eprint(TCBDB *bdb, int line, const char *func) { static void mprint(TCBDB *bdb) { iprintf("max leaf member: %d\n", tcbdblmemb(bdb)); iprintf("max node member: %d\n", tcbdbnmemb(bdb)); - iprintf("leaf number: %" PRIdMAX "\n", (int64_t) tcbdblnum(bdb)); - iprintf("node number: %" PRIdMAX "\n", (int64_t) tcbdbnnum(bdb)); - iprintf("bucket number: %" PRIdMAX "\n", (int64_t) tcbdbbnum(bdb)); - iprintf("used bucket number: %" PRIdMAX "\n", (int64_t) tcbdbbnumused(bdb)); + iprintf("leaf number: %" PRId64 "\n", (int64_t) tcbdblnum(bdb)); + iprintf("node number: %" PRId64 "\n", (int64_t) tcbdbnnum(bdb)); + iprintf("bucket number: %" PRId64 "\n", (int64_t) tcbdbbnum(bdb)); + iprintf("used bucket number: %" PRId64 "\n", (int64_t) tcbdbbnumused(bdb)); #ifndef NDEBUG if (bdb->hdb->cnt_writerec < 0) return; - iprintf("cnt_saveleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_saveleaf); - iprintf("cnt_loadleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_loadleaf); - iprintf("cnt_killleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_killleaf); - iprintf("cnt_adjleafc: %" PRIdMAX "\n", (int64_t) bdb->cnt_adjleafc); - iprintf("cnt_savenode: %" PRIdMAX "\n", (int64_t) bdb->cnt_savenode); - iprintf("cnt_loadnode: %" PRIdMAX "\n", (int64_t) bdb->cnt_loadnode); - iprintf("cnt_adjnodec: %" PRIdMAX "\n", (int64_t) bdb->cnt_adjnodec); - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_writerec); - iprintf("cnt_reuserec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_reuserec); - iprintf("cnt_moverec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_moverec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_readrec); - iprintf("cnt_searchfbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_searchfbp); - iprintf("cnt_insertfbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_insertfbp); - iprintf("cnt_splicefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_splicefbp); - iprintf("cnt_dividefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_dividefbp); - iprintf("cnt_mergefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_mergefbp); - iprintf("cnt_reducefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_reducefbp); - iprintf("cnt_appenddrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_appenddrp); - iprintf("cnt_deferdrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_deferdrp); - iprintf("cnt_flushdrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_flushdrp); - iprintf("cnt_adjrecc: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_adjrecc); - iprintf("cnt_defrag: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_defrag); - iprintf("cnt_shiftrec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_shiftrec); - iprintf("cnt_trunc: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_trunc); + iprintf("cnt_saveleaf: %" PRId64 "\n", (int64_t) bdb->cnt_saveleaf); + iprintf("cnt_loadleaf: %" PRId64 "\n", (int64_t) bdb->cnt_loadleaf); + iprintf("cnt_killleaf: %" PRId64 "\n", (int64_t) bdb->cnt_killleaf); + iprintf("cnt_adjleafc: %" PRId64 "\n", (int64_t) bdb->cnt_adjleafc); + iprintf("cnt_savenode: %" PRId64 "\n", (int64_t) bdb->cnt_savenode); + iprintf("cnt_loadnode: %" PRId64 "\n", (int64_t) bdb->cnt_loadnode); + iprintf("cnt_adjnodec: %" PRId64 "\n", (int64_t) bdb->cnt_adjnodec); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_writerec); + iprintf("cnt_reuserec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_reuserec); + iprintf("cnt_moverec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_moverec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_readrec); + iprintf("cnt_searchfbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_searchfbp); + iprintf("cnt_insertfbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_insertfbp); + iprintf("cnt_splicefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_splicefbp); + iprintf("cnt_dividefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_dividefbp); + iprintf("cnt_mergefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_mergefbp); + iprintf("cnt_reducefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_reducefbp); + iprintf("cnt_appenddrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_appenddrp); + iprintf("cnt_deferdrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_deferdrp); + iprintf("cnt_flushdrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_flushdrp); + iprintf("cnt_adjrecc: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_adjrecc); + iprintf("cnt_defrag: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_defrag); + iprintf("cnt_shiftrec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_shiftrec); + iprintf("cnt_trunc: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_trunc); #endif } @@ -695,8 +695,8 @@ static int procwrite(const char *path, int tnum, int rnum, int lmemb, int nmemb, } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -772,8 +772,8 @@ static int procread(const char *path, int tnum, int xmsiz, int dfunit, int omode } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -846,8 +846,8 @@ static int procremove(const char *path, int tnum, int xmsiz, int dfunit, int omo } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -957,8 +957,8 @@ static int procwicked(const char *path, int tnum, int rnum, int opts, int omode, if (rnum % 50 > 0) iprintf(" (%08d)\n", rnum); } tcmapdel(map); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -1041,8 +1041,8 @@ static int proctypical(const char *path, int tnum, int rnum, int lmemb, int nmem } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -1119,8 +1119,8 @@ static int procrace(const char *path, int tnum, int rnum, int lmemb, int nmemb, } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { diff --git a/src/tcbdb/tests/tcbtest.c b/src/tcbdb/tests/tcbtest.c index 4ad8bdc..fc65af0 100644 --- a/src/tcbdb/tests/tcbtest.c +++ b/src/tcbdb/tests/tcbtest.c @@ -159,36 +159,36 @@ static void eprint(TCBDB *bdb, int line, const char *func) { static void mprint(TCBDB *bdb) { iprintf("max leaf member: %d\n", tcbdblmemb(bdb)); iprintf("max node member: %d\n", tcbdbnmemb(bdb)); - iprintf("leaf number: %" PRIdMAX "\n", (int64_t) tcbdblnum(bdb)); - iprintf("node number: %" PRIdMAX "\n", (int64_t) tcbdbnnum(bdb)); - iprintf("bucket number: %" PRIdMAX "\n", (int64_t) tcbdbbnum(bdb)); - iprintf("used bucket number: %" PRIdMAX "\n", (int64_t) tcbdbbnumused(bdb)); + iprintf("leaf number: %" PRId64 "\n", (int64_t) tcbdblnum(bdb)); + iprintf("node number: %" PRId64 "\n", (int64_t) tcbdbnnum(bdb)); + iprintf("bucket number: %" PRId64 "\n", (int64_t) tcbdbbnum(bdb)); + iprintf("used bucket number: %" PRId64 "\n", (int64_t) tcbdbbnumused(bdb)); #ifndef NDEBUG if (bdb->hdb->cnt_writerec < 0) return; - iprintf("cnt_saveleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_saveleaf); - iprintf("cnt_loadleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_loadleaf); - iprintf("cnt_killleaf: %" PRIdMAX "\n", (int64_t) bdb->cnt_killleaf); - iprintf("cnt_adjleafc: %" PRIdMAX "\n", (int64_t) bdb->cnt_adjleafc); - iprintf("cnt_savenode: %" PRIdMAX "\n", (int64_t) bdb->cnt_savenode); - iprintf("cnt_loadnode: %" PRIdMAX "\n", (int64_t) bdb->cnt_loadnode); - iprintf("cnt_adjnodec: %" PRIdMAX "\n", (int64_t) bdb->cnt_adjnodec); - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_writerec); - iprintf("cnt_reuserec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_reuserec); - iprintf("cnt_moverec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_moverec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_readrec); - iprintf("cnt_searchfbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_searchfbp); - iprintf("cnt_insertfbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_insertfbp); - iprintf("cnt_splicefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_splicefbp); - iprintf("cnt_dividefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_dividefbp); - iprintf("cnt_mergefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_mergefbp); - iprintf("cnt_reducefbp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_reducefbp); - iprintf("cnt_appenddrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_appenddrp); - iprintf("cnt_deferdrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_deferdrp); - iprintf("cnt_flushdrp: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_flushdrp); - iprintf("cnt_adjrecc: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_adjrecc); - iprintf("cnt_defrag: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_defrag); - iprintf("cnt_shiftrec: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_shiftrec); - iprintf("cnt_trunc: %" PRIdMAX "\n", (int64_t) bdb->hdb->cnt_trunc); + iprintf("cnt_saveleaf: %" PRId64 "\n", (int64_t) bdb->cnt_saveleaf); + iprintf("cnt_loadleaf: %" PRId64 "\n", (int64_t) bdb->cnt_loadleaf); + iprintf("cnt_killleaf: %" PRId64 "\n", (int64_t) bdb->cnt_killleaf); + iprintf("cnt_adjleafc: %" PRId64 "\n", (int64_t) bdb->cnt_adjleafc); + iprintf("cnt_savenode: %" PRId64 "\n", (int64_t) bdb->cnt_savenode); + iprintf("cnt_loadnode: %" PRId64 "\n", (int64_t) bdb->cnt_loadnode); + iprintf("cnt_adjnodec: %" PRId64 "\n", (int64_t) bdb->cnt_adjnodec); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_writerec); + iprintf("cnt_reuserec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_reuserec); + iprintf("cnt_moverec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_moverec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_readrec); + iprintf("cnt_searchfbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_searchfbp); + iprintf("cnt_insertfbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_insertfbp); + iprintf("cnt_splicefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_splicefbp); + iprintf("cnt_dividefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_dividefbp); + iprintf("cnt_mergefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_mergefbp); + iprintf("cnt_reducefbp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_reducefbp); + iprintf("cnt_appenddrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_appenddrp); + iprintf("cnt_deferdrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_deferdrp); + iprintf("cnt_flushdrp: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_flushdrp); + iprintf("cnt_adjrecc: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_adjrecc); + iprintf("cnt_defrag: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_defrag); + iprintf("cnt_shiftrec: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_shiftrec); + iprintf("cnt_trunc: %" PRId64 "\n", (int64_t) bdb->hdb->cnt_trunc); #endif } @@ -832,8 +832,8 @@ static int procwrite(const char *path, int rnum, int lmemb, int nmemb, int bnum, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -925,8 +925,8 @@ static int procread(const char *path, bool mt, TCCMP cmp, int lcnum, int ncnum, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -1004,8 +1004,8 @@ static int procremove(const char *path, bool mt, TCCMP cmp, int lcnum, int ncnum if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -1199,8 +1199,8 @@ static int procrcat(const char *path, int rnum, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -1328,8 +1328,8 @@ static int procqueue(const char *path, int rnum, int lmemb, int nmemb, int bnum, break; } tcbdbcurdel(cur); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -2162,8 +2162,8 @@ static int procmisc(const char *path, int rnum, bool mt, int opts, int omode) { err = true; } tcbdbcurdel(cur); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); if (!tcbdbclose(bdb)) { @@ -2551,8 +2551,8 @@ static int procwicked(const char *path, int rnum, bool mt, int opts, int omode) err = true; } tcbdbcurdel(cur); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); mprint(bdb); sysprint(); tcmapdel(map); diff --git a/src/tcbdb/tools/jbbmgr.c b/src/tcbdb/tools/jbbmgr.c index d99fab0..c28bb40 100644 --- a/src/tcbdb/tools/jbbmgr.c +++ b/src/tcbdb/tools/jbbmgr.c @@ -645,18 +645,18 @@ static int procinform(const char *path, int omode) { printf("\n"); printf("max leaf member: %d\n", tcbdblmemb(bdb)); printf("max node member: %d\n", tcbdbnmemb(bdb)); - printf("leaf number: %" PRIuMAX "\n", (uint64_t) tcbdblnum(bdb)); - printf("node number: %" PRIuMAX "\n", (uint64_t) tcbdbnnum(bdb)); - printf("bucket number: %" PRIuMAX "\n", (uint64_t) tcbdbbnum(bdb)); + printf("leaf number: %" PRIu64 "\n", (uint64_t) tcbdblnum(bdb)); + printf("node number: %" PRIu64 "\n", (uint64_t) tcbdbnnum(bdb)); + printf("bucket number: %" PRIu64 "\n", (uint64_t) tcbdbbnum(bdb)); #ifndef NDEBUG if (bdb->hdb->cnt_writerec >= 0) - printf("used bucket number: %" PRIdMAX "\n", (int64_t) tcbdbbnumused(bdb)); + printf("used bucket number: %" PRId64 "\n", (int64_t) tcbdbbnumused(bdb)); #endif printf("alignment: %u\n", tcbdbalign(bdb)); printf("free block pool: %u\n", tcbdbfbpmax(bdb)); - printf("inode number: %" PRIdMAX "\n", (int64_t) tcbdbinode(bdb)); + printf("inode number: %" PRId64 "\n", (int64_t) tcbdbinode(bdb)); char date[48]; tcdatestrwww(tcbdbmtime(bdb), INT_MAX, date); printf("modified time: %s\n", date); @@ -668,8 +668,8 @@ static int procinform(const char *path, int omode) { if (opts & BDBTTCBS) printf(" tcbs"); if (opts & BDBTEXCODEC) printf(" excodec"); printf("\n"); - printf("record number: %" PRIuMAX "\n", (uint64_t) tcbdbrnum(bdb)); - printf("file size: %" PRIuMAX "\n", (uint64_t) tcbdbfsiz(bdb)); + printf("record number: %" PRIu64 "\n", (uint64_t) tcbdbrnum(bdb)); + printf("file size: %" PRIu64 "\n", (uint64_t) tcbdbfsiz(bdb)); if (!tcbdbclose(bdb)) { if (!err) printerr(bdb); err = true; diff --git a/src/tcfdb/tcfdb.c b/src/tcfdb/tcfdb.c index 1e5e478..f2f3e29 100644 --- a/src/tcfdb/tcfdb.c +++ b/src/tcfdb/tcfdb.c @@ -668,7 +668,7 @@ void *tcfdbiternext2(TCFDB *fdb, int *sp) { uint64_t id = tcfdbiternext(fdb); if (id < 1) return NULL; char kbuf[TCNUMBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) id); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) id); *sp = ksiz; return tcmemdup(kbuf, ksiz); } @@ -715,7 +715,7 @@ TCLIST *tcfdbrange2(TCFDB *fdb, const void *lbuf, int lsiz, const void *ubuf, in TCLIST *keys = tclistnew2(num); for (int i = 0; i < num; i++) { char kbuf[TCNUMBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) ids[i]); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) ids[i]); TCLISTPUSH(keys, kbuf, ksiz); } TCFREE(ids); @@ -795,7 +795,7 @@ TCLIST *tcfdbrange4(TCFDB *fdb, const void *ibuf, int isiz, int max) { TCLIST *keys = tclistnew2(num); for (int i = 0; i < num; i++) { char kbuf[TCNUMBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) ids[i]); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) ids[i]); TCLISTPUSH(keys, kbuf, ksiz); } TCFREE(ids); @@ -2640,7 +2640,7 @@ static uint64_t *tcfdbrangeimpl(TCFDB *fdb, int64_t lower, int64_t upper, int ma If successful, the return value is true, else, it is false. */ static bool tcfdboptimizeimpl(TCFDB *fdb, int32_t width, int64_t limsiz) { assert(fdb); - char *tpath = tcsprintf("%s%ctmp%c%" PRIuMAX "", fdb->path, MYEXTCHR, MYEXTCHR, fdb->inode); + char *tpath = tcsprintf("%s%ctmp%c%" PRIu64 "", fdb->path, MYEXTCHR, MYEXTCHR, fdb->inode); char *opath; int omode = (fdb->omode & ~FDBOCREAT) & ~FDBOTRUNC; TCFDB *tfdb = tcfdbnew(); @@ -2729,7 +2729,7 @@ static bool tcfdbcopyimpl(TCFDB *fdb, const char *path) { } if (*path == '@') { char tsbuf[TCNUMBUFSIZ]; - sprintf(tsbuf, "%" PRIuMAX "", (uint64_t) (tctime() * 1000000)); + sprintf(tsbuf, "%" PRIu64 "", (uint64_t) (tctime() * 1000000)); const char *args[3]; args[0] = path + 1; args[1] = fdb->path; @@ -2789,7 +2789,7 @@ static bool tcfdbforeachimpl(TCFDB *fdb, TCITER iter, void *op) { FDBUNLOCKSMEM(fdb); if (vbuf) { char kbuf[TCNUMBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) id); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) id); if (!iter(kbuf, ksiz, vbuf, vsiz, op)) { break; } @@ -3104,23 +3104,23 @@ void tcfdbprintmeta(TCFDB *fdb) { wp += sprintf(wp, " type=%02X", fdb->type); wp += sprintf(wp, " flags=%02X", fdb->flags); wp += sprintf(wp, " width=%u", fdb->width); - wp += sprintf(wp, " limsiz=%" PRIuMAX "", (uint64_t) fdb->limsiz); + wp += sprintf(wp, " limsiz=%" PRIu64 "", (uint64_t) fdb->limsiz); wp += sprintf(wp, " wsiz=%u", fdb->wsiz); wp += sprintf(wp, " rsiz=%u", fdb->rsiz); - wp += sprintf(wp, " limid=%" PRIuMAX "", (uint64_t) fdb->limid); + wp += sprintf(wp, " limid=%" PRIu64 "", (uint64_t) fdb->limid); wp += sprintf(wp, " path=%s", fdb->path ? fdb->path : "-"); wp += sprintf(wp, " omode=%u", fdb->omode); - wp += sprintf(wp, " rnum=%" PRIuMAX "", (uint64_t) fdb->rnum); - wp += sprintf(wp, " fsiz=%" PRIuMAX "", (uint64_t) fdb->fsiz); - wp += sprintf(wp, " min=%" PRIuMAX "", (uint64_t) fdb->min); - wp += sprintf(wp, " max=%" PRIuMAX "", (uint64_t) fdb->max); - wp += sprintf(wp, " iter=%" PRIuMAX "", (uint64_t) fdb->iter); + wp += sprintf(wp, " rnum=%" PRIu64 "", (uint64_t) fdb->rnum); + wp += sprintf(wp, " fsiz=%" PRIu64 "", (uint64_t) fdb->fsiz); + wp += sprintf(wp, " min=%" PRIu64 "", (uint64_t) fdb->min); + wp += sprintf(wp, " max=%" PRIu64 "", (uint64_t) fdb->max); + wp += sprintf(wp, " iter=%" PRIu64 "", (uint64_t) fdb->iter); wp += sprintf(wp, " map=%p", (void *) fdb->map); wp += sprintf(wp, " ecode=%d", fdb->ecode); wp += sprintf(wp, " fatal=%u", fdb->fatal); - wp += sprintf(wp, " inode=%" PRIuMAX "", (uint64_t) fdb->inode); - wp += sprintf(wp, " mtime=%" PRIuMAX "", (uint64_t) fdb->mtime); - wp += sprintf(wp, " walend=%" PRIuMAX "", (uint64_t) fdb->walend); + wp += sprintf(wp, " inode=%" PRIu64 "", (uint64_t) fdb->inode); + wp += sprintf(wp, " mtime=%" PRIu64 "", (uint64_t) fdb->mtime); + wp += sprintf(wp, " walend=%" PRIu64 "", (uint64_t) fdb->walend); wp += sprintf(wp, " tran=%d", fdb->tran); #ifndef _WIN32 wp += sprintf(wp, " fd=%d", fdb->fd); @@ -3128,9 +3128,9 @@ void tcfdbprintmeta(TCFDB *fdb) { wp += sprintf(wp, " dbgfd=%d", fdb->dbgfd); #endif #ifndef NDEBUG - wp += sprintf(wp, " cnt_writerec=%" PRIdMAX "", (int64_t) fdb->cnt_writerec); - wp += sprintf(wp, " cnt_readrec=%" PRIdMAX "", (int64_t) fdb->cnt_readrec); - wp += sprintf(wp, " cnt_truncfile=%" PRIdMAX "", (int64_t) fdb->cnt_truncfile); + wp += sprintf(wp, " cnt_writerec=%" PRId64 "", (int64_t) fdb->cnt_writerec); + wp += sprintf(wp, " cnt_readrec=%" PRId64 "", (int64_t) fdb->cnt_readrec); + wp += sprintf(wp, " cnt_truncfile=%" PRId64 "", (int64_t) fdb->cnt_truncfile); #endif *(wp++) = '\n'; tcwrite(dbgfd, buf, wp - buf); diff --git a/src/tcfdb/tests/tcfmttest.c b/src/tcfdb/tests/tcfmttest.c index b96e450..f907470 100644 --- a/src/tcfdb/tests/tcfmttest.c +++ b/src/tcfdb/tests/tcfmttest.c @@ -176,17 +176,17 @@ static void eprint(TCFDB *fdb, int line, const char *func) { /* print members of fixed-length database */ static void mprint(TCFDB *fdb) { - iprintf("minimum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmin(fdb)); - iprintf("maximum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmax(fdb)); + iprintf("minimum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmin(fdb)); + iprintf("maximum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmax(fdb)); iprintf("width of the value: %u\n", (unsigned int) tcfdbwidth(fdb)); - iprintf("limit file size: %" PRIuMAX "\n", (uint64_t) tcfdblimsiz(fdb)); - iprintf("limit ID number: %" PRIuMAX "\n", (uint64_t) tcfdblimid(fdb)); + iprintf("limit file size: %" PRIu64 "\n", (uint64_t) tcfdblimsiz(fdb)); + iprintf("limit ID number: %" PRIu64 "\n", (uint64_t) tcfdblimid(fdb)); #ifndef NDEBUG if (fdb->cnt_writerec < 0) return; - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) fdb->cnt_writerec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) fdb->cnt_readrec); - iprintf("cnt_truncfile: %" PRIdMAX "\n", (int64_t) fdb->cnt_truncfile); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) fdb->cnt_writerec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) fdb->cnt_readrec); + iprintf("cnt_truncfile: %" PRId64 "\n", (int64_t) fdb->cnt_truncfile); #endif } @@ -428,7 +428,7 @@ static int runtypical(int argc, char **argv) { /* perform write command */ static int procwrite(const char *path, int tnum, int rnum, int width, int64_t limsiz, int omode, bool rnd) { - iprintf("<Writing Test>\n seed=%u path=%s tnum=%d rnum=%d width=%d limsiz=%" PRIdMAX " omode=%d rnd=%d\n\n", + iprintf("<Writing Test>\n seed=%u path=%s tnum=%d rnum=%d width=%d limsiz=%" PRId64 " omode=%d rnd=%d\n\n", g_randseed, path, tnum, rnum, width, (int64_t) limsiz, omode, rnd); bool err = false; double stime = tctime(); @@ -477,8 +477,8 @@ static int procwrite(const char *path, int tnum, int rnum, int width, int64_t li } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -541,8 +541,8 @@ static int procread(const char *path, int tnum, int omode, bool wb, bool rnd) { } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -603,8 +603,8 @@ static int procremove(const char *path, int tnum, int omode, bool rnd) { } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -715,8 +715,8 @@ static int procwicked(const char *path, int tnum, int rnum, int omode, bool nc) if (rnum % 50 > 0) iprintf(" (%08d)\n", rnum); } tcmapdel(map); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -732,7 +732,7 @@ static int procwicked(const char *path, int tnum, int rnum, int omode, bool nc) /* perform typical command */ static int proctypical(const char *path, int tnum, int rnum, int width, int64_t limsiz, int omode, bool nc, int rratio) { - iprintf("<Typical Access Test>\n seed=%u path=%s tnum=%d rnum=%d width=%d limsiz=%" PRIdMAX " omode=%d nc=%d rratio=%d\n\n", + iprintf("<Typical Access Test>\n seed=%u path=%s tnum=%d rnum=%d width=%d limsiz=%" PRId64 " omode=%d nc=%d rratio=%d\n\n", g_randseed, path, tnum, rnum, width, (int64_t) limsiz, omode, nc, rratio); bool err = false; double stime = tctime(); @@ -783,8 +783,8 @@ static int proctypical(const char *path, int tnum, int rnum, int width, int64_t } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -894,7 +894,7 @@ static void *threadwicked(void *targ) { for (int i = 1; i <= rnum && !err; i++) { uint64_t kid = myrand(rnum * (id + 1)) + 1; char kbuf[RECBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) kid); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) kid); char vbuf[RECBUFSIZ]; int vsiz = myrand(RECBUFSIZ); memset(vbuf, '*', vsiz); diff --git a/src/tcfdb/tests/tcftest.c b/src/tcfdb/tests/tcftest.c index c5a89e8..ca103e4 100644 --- a/src/tcfdb/tests/tcftest.c +++ b/src/tcfdb/tests/tcftest.c @@ -174,16 +174,16 @@ static void eprint(TCFDB *fdb, int line, const char *func) { /* print members of fixed-length database */ static void mprint(TCFDB *fdb) { - iprintf("minimum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmin(fdb)); - iprintf("maximum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmax(fdb)); + iprintf("minimum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmin(fdb)); + iprintf("maximum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmax(fdb)); iprintf("width of the value: %u\n", (unsigned int) tcfdbwidth(fdb)); - iprintf("limit file size: %" PRIuMAX "\n", (uint64_t) tcfdblimsiz(fdb)); - iprintf("limit ID number: %" PRIuMAX "\n", (uint64_t) tcfdblimid(fdb)); + iprintf("limit file size: %" PRIu64 "\n", (uint64_t) tcfdblimsiz(fdb)); + iprintf("limit ID number: %" PRIu64 "\n", (uint64_t) tcfdblimid(fdb)); #ifndef NDEBUG if (fdb->cnt_writerec < 0) return; - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) fdb->cnt_writerec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) fdb->cnt_readrec); - iprintf("cnt_truncfile: %" PRIdMAX "\n", (int64_t) fdb->cnt_truncfile); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) fdb->cnt_writerec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) fdb->cnt_readrec); + iprintf("cnt_truncfile: %" PRId64 "\n", (int64_t) fdb->cnt_truncfile); #endif } @@ -477,7 +477,7 @@ static int runwicked(int argc, char **argv) { /* perform write command */ static int procwrite(const char *path, int rnum, int width, int64_t limsiz, bool mt, int omode, bool rnd) { - iprintf("<Writing Test>\n seed=%u path=%s rnum=%d width=%d limsiz=%" PRIdMAX " mt=%d omode=%d" + iprintf("<Writing Test>\n seed=%u path=%s rnum=%d width=%d limsiz=%" PRId64 " mt=%d omode=%d" " rnd=%d\n\n", g_randseed, path, rnum, width, (int64_t) limsiz, mt, omode, rnd); bool err = false; double stime = tctime(); @@ -509,8 +509,8 @@ static int procwrite(const char *path, int rnum, int width, int64_t limsiz, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -566,8 +566,8 @@ static int procread(const char *path, bool mt, int omode, bool wb, bool rnd) { if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -610,8 +610,8 @@ static int procremove(const char *path, bool mt, int omode, bool rnd) { if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -628,7 +628,7 @@ static int procremove(const char *path, bool mt, int omode, bool rnd) { static int procrcat(const char *path, int rnum, int width, int64_t limsiz, bool mt, int omode, int pnum, bool dai, bool dad, bool rl, bool ru) { iprintf("<Random Concatenating Test>\n" - " seed=%u path=%s rnum=%d width=%d limsiz=%" PRIdMAX " mt=%d omode=%d pnum=%d" + " seed=%u path=%s rnum=%d width=%d limsiz=%" PRId64 " mt=%d omode=%d pnum=%d" " dai=%d dad=%d rl=%d ru=%d\n\n", g_randseed, path, rnum, width, (int64_t) limsiz, mt, omode, pnum, dai, dad, rl, ru); if (pnum < 1) pnum = rnum; @@ -742,8 +742,8 @@ static int procrcat(const char *path, int rnum, int width, int64_t limsiz, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -1380,8 +1380,8 @@ static int procmisc(const char *path, int rnum, bool mt, int omode) { err = true; } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); if (!tcfdbclose(fdb)) { @@ -1422,7 +1422,7 @@ static int procwicked(const char *path, int rnum, bool mt, int omode) { for (int i = 1; i <= rnum && !err; i++) { uint64_t id = myrand(rnum) + 1; char kbuf[RECBUFSIZ]; - int ksiz = sprintf(kbuf, "%" PRIuMAX "", (uint64_t) id); + int ksiz = sprintf(kbuf, "%" PRIu64 "", (uint64_t) id); char vbuf[RECBUFSIZ]; int vsiz = myrand(RECBUFSIZ); memset(vbuf, '*', vsiz); @@ -1559,7 +1559,7 @@ static int procwicked(const char *path, int rnum, bool mt, int omode) { } } for (int j = myrand(rnum) / 1000 + 1; j >= 0; j--) { - if (tcfdbiternext(fdb) < 0) { + if (!tcfdbiternext(fdb)) { int ecode = tcfdbecode(fdb); if (ecode != TCEINVALID && ecode != TCENOREC) { eprint(fdb, __LINE__, "tcfdbiternext"); @@ -1698,8 +1698,8 @@ static int procwicked(const char *path, int rnum, bool mt, int omode) { eprint(fdb, __LINE__, "(validation)"); err = true; } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); mprint(fdb); sysprint(); tcmapdel(map); diff --git a/src/tcfdb/tools/jbfmgr.c b/src/tcfdb/tools/jbfmgr.c index 8fe3632..989b005 100644 --- a/src/tcfdb/tools/jbfmgr.c +++ b/src/tcfdb/tools/jbfmgr.c @@ -512,17 +512,17 @@ static int procinform(const char *path, int omode) { if (flags & FDBFOPEN) printf(" open"); if (flags & FDBFFATAL) printf(" fatal"); printf("\n"); - printf("minimum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmin(fdb)); - printf("maximum ID number: %" PRIuMAX "\n", (uint64_t) tcfdbmax(fdb)); + printf("minimum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmin(fdb)); + printf("maximum ID number: %" PRIu64 "\n", (uint64_t) tcfdbmax(fdb)); printf("width of the value: %u\n", (unsigned int) tcfdbwidth(fdb)); - printf("limit file size: %" PRIuMAX "\n", (uint64_t) tcfdblimsiz(fdb)); - printf("limit ID number: %" PRIuMAX "\n", (uint64_t) tcfdblimid(fdb)); - printf("inode number: %" PRIdMAX "\n", (int64_t) tcfdbinode(fdb)); + printf("limit file size: %" PRIu64 "\n", (uint64_t) tcfdblimsiz(fdb)); + printf("limit ID number: %" PRIu64 "\n", (uint64_t) tcfdblimid(fdb)); + printf("inode number: %" PRId64 "\n", (int64_t) tcfdbinode(fdb)); char date[48]; tcdatestrwww(tcfdbmtime(fdb), INT_MAX, date); printf("modified time: %s\n", date); - printf("record number: %" PRIuMAX "\n", (uint64_t) tcfdbrnum(fdb)); - printf("file size: %" PRIuMAX "\n", (uint64_t) tcfdbfsiz(fdb)); + printf("record number: %" PRIu64 "\n", (uint64_t) tcfdbrnum(fdb)); + printf("file size: %" PRIu64 "\n", (uint64_t) tcfdbfsiz(fdb)); if (!tcfdbclose(fdb)) { if (!err) printerr(fdb); err = true; @@ -677,7 +677,7 @@ static int proclist(const char *path, int omode, int max, bool pv, bool px, int cnt = 0; uint64_t id; while ((id = tcfdbiternext(fdb)) > 0) { - printf("%" PRIuMAX "", (uint64_t) id); + printf("%" PRIu64 "", (uint64_t) id); if (pv) { int vsiz; char *vbuf = tcfdbget(fdb, id, &vsiz); diff --git a/src/tchdb/tchdb.c b/src/tchdb/tchdb.c index b6290bc..3b7707d 100644 --- a/src/tchdb/tchdb.c +++ b/src/tchdb/tchdb.c @@ -5043,7 +5043,7 @@ static bool tchdbiternextintoxstr2(TCHDB *hdb, uint64_t *iter, TCXSTR *kxstr, TC static bool tchdboptimizeimpl(TCHDB *hdb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts) { assert(hdb); bool err = false; - char *tpath = tcsprintf("%s%ctmp%c%" PRIuMAX "", hdb->path, MYEXTCHR, MYEXTCHR, hdb->inode); + char *tpath = tcsprintf("%s%ctmp%c%" PRIu64 "", hdb->path, MYEXTCHR, MYEXTCHR, hdb->inode); int omode = (hdb->omode & ~HDBOCREAT) & ~HDBOTRUNC; TCHDB *thdb = tchdbnew(); thdb->dbgfd = hdb->dbgfd; @@ -5197,7 +5197,7 @@ static bool tchdbcopyimpl(TCHDB *hdb, const char *path) { } if (*path == '@') { char tsbuf[TCNUMBUFSIZ]; - sprintf(tsbuf, "%" PRIuMAX "", (uint64_t) (tctime() * 1000000)); + sprintf(tsbuf, "%" PRIu64 "", (uint64_t) (tctime() * 1000000)); const char *args[3]; args[0] = path + 1; args[1] = hdb->path; @@ -5757,19 +5757,19 @@ void tchdbprintmeta(TCHDB *hdb) { wp += sprintf(wp, " rpath=%s", hdb->rpath ? hdb->rpath : "-"); wp += sprintf(wp, " type=%02X", hdb->type); wp += sprintf(wp, " flags=%02X", hdb->flags); - wp += sprintf(wp, " bnum=%" PRIuMAX "", (uint64_t) hdb->bnum); + wp += sprintf(wp, " bnum=%" PRIu64 "", (uint64_t) hdb->bnum); wp += sprintf(wp, " apow=%u", hdb->apow); wp += sprintf(wp, " fpow=%u", hdb->fpow); wp += sprintf(wp, " opts=%u", hdb->opts); wp += sprintf(wp, " path=%s", hdb->path ? hdb->path : "-"); wp += sprintf(wp, " omode=%u", hdb->omode); - wp += sprintf(wp, " rnum=%" PRIuMAX "", (uint64_t) hdb->rnum); - wp += sprintf(wp, " fsiz=%" PRIuMAX "", (uint64_t) hdb->fsiz); - wp += sprintf(wp, " frec=%" PRIuMAX "", (uint64_t) hdb->frec); - wp += sprintf(wp, " dfcur=%" PRIuMAX "", (uint64_t) hdb->dfcur); - wp += sprintf(wp, " iter=%" PRIuMAX "", (uint64_t) hdb->iter); + wp += sprintf(wp, " rnum=%" PRIu64 "", (uint64_t) hdb->rnum); + wp += sprintf(wp, " fsiz=%" PRIu64 "", (uint64_t) hdb->fsiz); + wp += sprintf(wp, " frec=%" PRIu64 "", (uint64_t) hdb->frec); + wp += sprintf(wp, " dfcur=%" PRIu64 "", (uint64_t) hdb->dfcur); + wp += sprintf(wp, " iter=%" PRIu64 "", (uint64_t) hdb->iter); wp += sprintf(wp, " map=%p", (void *) hdb->map); - wp += sprintf(wp, " msiz=%" PRIuMAX "", (uint64_t) hdb->msiz); + wp += sprintf(wp, " msiz=%" PRIu64 "", (uint64_t) hdb->msiz); wp += sprintf(wp, " ba64=%d", hdb->ba64); wp += sprintf(wp, " align=%u", hdb->align); wp += sprintf(wp, " runit=%u", hdb->runit); @@ -5780,17 +5780,17 @@ void tchdbprintmeta(TCHDB *hdb) { wp += sprintf(wp, " fbpmis=%d", hdb->fbpmis); wp += sprintf(wp, " drpool=%p", (void *) hdb->drpool); wp += sprintf(wp, " drpdef=%p", (void *) hdb->drpdef); - wp += sprintf(wp, " drpoff=%" PRIuMAX "", (uint64_t) hdb->drpoff); + wp += sprintf(wp, " drpoff=%" PRIu64 "", (uint64_t) hdb->drpoff); wp += sprintf(wp, " recc=%p", (void *) hdb->recc); wp += sprintf(wp, " rcnum=%u", hdb->rcnum); wp += sprintf(wp, " ecode=%d", hdb->ecode); wp += sprintf(wp, " fatal=%u", hdb->fatal); - wp += sprintf(wp, " inode=%" PRIuMAX "", (uint64_t) (uint64_t) hdb->inode); - wp += sprintf(wp, " mtime=%" PRIuMAX "", (uint64_t) (uint64_t) hdb->mtime); + wp += sprintf(wp, " inode=%" PRIu64 "", (uint64_t) (uint64_t) hdb->inode); + wp += sprintf(wp, " mtime=%" PRIu64 "", (uint64_t) (uint64_t) hdb->mtime); wp += sprintf(wp, " dfunit=%u", hdb->dfunit); wp += sprintf(wp, " dfcnt=%u", hdb->dfcnt); wp += sprintf(wp, " tran=%d", hdb->tran); - wp += sprintf(wp, " walend=%" PRIuMAX "", (uint64_t) hdb->walend); + wp += sprintf(wp, " walend=%" PRIu64 "", (uint64_t) hdb->walend); #ifndef _WIN32 wp += sprintf(wp, " fd=%d", hdb->fd); wp += sprintf(wp, " walfd=%d", hdb->walfd); @@ -5798,23 +5798,23 @@ void tchdbprintmeta(TCHDB *hdb) { #endif #ifndef NDEBUG - wp += sprintf(wp, " cnt_writerec=%" PRIdMAX "", (int64_t) hdb->cnt_writerec); - wp += sprintf(wp, " cnt_reuserec=%" PRIdMAX "", (int64_t) hdb->cnt_reuserec); - wp += sprintf(wp, " cnt_moverec=%" PRIdMAX "", (int64_t) hdb->cnt_moverec); - wp += sprintf(wp, " cnt_readrec=%" PRIdMAX "", (int64_t) hdb->cnt_readrec); - wp += sprintf(wp, " cnt_searchfbp=%" PRIdMAX "", (int64_t) hdb->cnt_searchfbp); - wp += sprintf(wp, " cnt_insertfbp=%" PRIdMAX "", (int64_t) hdb->cnt_insertfbp); - wp += sprintf(wp, " cnt_splicefbp=%" PRIdMAX "", (int64_t) hdb->cnt_splicefbp); - wp += sprintf(wp, " cnt_dividefbp=%" PRIdMAX "", (int64_t) hdb->cnt_dividefbp); - wp += sprintf(wp, " cnt_mergefbp=%" PRIdMAX "", (int64_t) hdb->cnt_mergefbp); - wp += sprintf(wp, " cnt_reducefbp=%" PRIdMAX "", (int64_t) hdb->cnt_reducefbp); - wp += sprintf(wp, " cnt_appenddrp=%" PRIdMAX "", (int64_t) hdb->cnt_appenddrp); - wp += sprintf(wp, " cnt_deferdrp=%" PRIdMAX "", (int64_t) hdb->cnt_deferdrp); - wp += sprintf(wp, " cnt_flushdrp=%" PRIdMAX "", (int64_t) hdb->cnt_flushdrp); - wp += sprintf(wp, " cnt_adjrecc=%" PRIdMAX "", (int64_t) hdb->cnt_adjrecc); - wp += sprintf(wp, " cnt_defrag=%" PRIdMAX "", (int64_t) hdb->cnt_defrag); - wp += sprintf(wp, " cnt_shiftrec=%" PRIdMAX "", (int64_t) hdb->cnt_shiftrec); - wp += sprintf(wp, " cnt_trunc=%" PRIdMAX "", (int64_t) hdb->cnt_trunc); + wp += sprintf(wp, " cnt_writerec=%" PRId64 "", (int64_t) hdb->cnt_writerec); + wp += sprintf(wp, " cnt_reuserec=%" PRId64 "", (int64_t) hdb->cnt_reuserec); + wp += sprintf(wp, " cnt_moverec=%" PRId64 "", (int64_t) hdb->cnt_moverec); + wp += sprintf(wp, " cnt_readrec=%" PRId64 "", (int64_t) hdb->cnt_readrec); + wp += sprintf(wp, " cnt_searchfbp=%" PRId64 "", (int64_t) hdb->cnt_searchfbp); + wp += sprintf(wp, " cnt_insertfbp=%" PRId64 "", (int64_t) hdb->cnt_insertfbp); + wp += sprintf(wp, " cnt_splicefbp=%" PRId64 "", (int64_t) hdb->cnt_splicefbp); + wp += sprintf(wp, " cnt_dividefbp=%" PRId64 "", (int64_t) hdb->cnt_dividefbp); + wp += sprintf(wp, " cnt_mergefbp=%" PRId64 "", (int64_t) hdb->cnt_mergefbp); + wp += sprintf(wp, " cnt_reducefbp=%" PRId64 "", (int64_t) hdb->cnt_reducefbp); + wp += sprintf(wp, " cnt_appenddrp=%" PRId64 "", (int64_t) hdb->cnt_appenddrp); + wp += sprintf(wp, " cnt_deferdrp=%" PRId64 "", (int64_t) hdb->cnt_deferdrp); + wp += sprintf(wp, " cnt_flushdrp=%" PRId64 "", (int64_t) hdb->cnt_flushdrp); + wp += sprintf(wp, " cnt_adjrecc=%" PRId64 "", (int64_t) hdb->cnt_adjrecc); + wp += sprintf(wp, " cnt_defrag=%" PRId64 "", (int64_t) hdb->cnt_defrag); + wp += sprintf(wp, " cnt_shiftrec=%" PRId64 "", (int64_t) hdb->cnt_shiftrec); + wp += sprintf(wp, " cnt_trunc=%" PRId64 "", (int64_t) hdb->cnt_trunc); #endif *(wp++) = '\n'; @@ -5833,18 +5833,18 @@ void tchdbprintrec(TCHDB *hdb, TCHREC *rec) { char buf[HDBIOBUFSIZ]; char *wp = buf; wp += sprintf(wp, "REC:"); - wp += sprintf(wp, " off=%" PRIuMAX "", (uint64_t) rec->off); + wp += sprintf(wp, " off=%" PRIu64 "", (uint64_t) rec->off); wp += sprintf(wp, " rsiz=%u", rec->rsiz); wp += sprintf(wp, " magic=%02X", rec->magic); wp += sprintf(wp, " hash=%02X", rec->hash); - wp += sprintf(wp, " left=%" PRIuMAX "", (uint64_t) rec->left); - wp += sprintf(wp, " right=%" PRIuMAX "", (uint64_t) rec->right); + wp += sprintf(wp, " left=%" PRIu64 "", (uint64_t) rec->left); + wp += sprintf(wp, " right=%" PRIu64 "", (uint64_t) rec->right); wp += sprintf(wp, " ksiz=%u", rec->ksiz); wp += sprintf(wp, " vsiz=%u", rec->vsiz); wp += sprintf(wp, " psiz=%u", rec->psiz); wp += sprintf(wp, " kbuf=%p", (void *) rec->kbuf); wp += sprintf(wp, " vbuf=%p", (void *) rec->vbuf); - wp += sprintf(wp, " boff=%" PRIuMAX "", (uint64_t) rec->boff); + wp += sprintf(wp, " boff=%" PRIu64 "", (uint64_t) rec->boff); wp += sprintf(wp, " bbuf=%p", (void *) rec->bbuf); *(wp++) = '\n'; tcwrite(dbgfd, buf, wp - buf); diff --git a/src/tchdb/tests/tchmttest.c b/src/tchdb/tests/tchmttest.c index 4f5c1ef..1ebecfb 100644 --- a/src/tchdb/tests/tchmttest.c +++ b/src/tchdb/tests/tchmttest.c @@ -196,27 +196,27 @@ static void eprint(TCHDB *hdb, int line, const char *func) { /* print members of hash database */ static void mprint(TCHDB *hdb) { - iprintf("bucket number: %" PRIdMAX "\n", (int64_t) tchdbbnum(hdb)); - iprintf("used bucket number: %" PRIdMAX "\n", (int64_t) tchdbbnumused(hdb)); + iprintf("bucket number: %" PRId64 "\n", (int64_t) tchdbbnum(hdb)); + iprintf("used bucket number: %" PRId64 "\n", (int64_t) tchdbbnumused(hdb)); #ifndef NDEBUG if (hdb->cnt_writerec < 0) return; - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) hdb->cnt_writerec); - iprintf("cnt_reuserec: %" PRIdMAX "\n", (int64_t) hdb->cnt_reuserec); - iprintf("cnt_moverec: %" PRIdMAX "\n", (int64_t) hdb->cnt_moverec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) hdb->cnt_readrec); - iprintf("cnt_searchfbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_searchfbp); - iprintf("cnt_insertfbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_insertfbp); - iprintf("cnt_splicefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_splicefbp); - iprintf("cnt_dividefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_dividefbp); - iprintf("cnt_mergefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_mergefbp); - iprintf("cnt_reducefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_reducefbp); - iprintf("cnt_appenddrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_appenddrp); - iprintf("cnt_deferdrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_deferdrp); - iprintf("cnt_flushdrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_flushdrp); - iprintf("cnt_adjrecc: %" PRIdMAX "\n", (int64_t) hdb->cnt_adjrecc); - iprintf("cnt_defrag: %" PRIdMAX "\n", (int64_t) hdb->cnt_defrag); - iprintf("cnt_shiftrec: %" PRIdMAX "\n", (int64_t) hdb->cnt_shiftrec); - iprintf("cnt_trunc: %" PRIdMAX "\n", (int64_t) hdb->cnt_trunc); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) hdb->cnt_writerec); + iprintf("cnt_reuserec: %" PRId64 "\n", (int64_t) hdb->cnt_reuserec); + iprintf("cnt_moverec: %" PRId64 "\n", (int64_t) hdb->cnt_moverec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) hdb->cnt_readrec); + iprintf("cnt_searchfbp: %" PRId64 "\n", (int64_t) hdb->cnt_searchfbp); + iprintf("cnt_insertfbp: %" PRId64 "\n", (int64_t) hdb->cnt_insertfbp); + iprintf("cnt_splicefbp: %" PRId64 "\n", (int64_t) hdb->cnt_splicefbp); + iprintf("cnt_dividefbp: %" PRId64 "\n", (int64_t) hdb->cnt_dividefbp); + iprintf("cnt_mergefbp: %" PRId64 "\n", (int64_t) hdb->cnt_mergefbp); + iprintf("cnt_reducefbp: %" PRId64 "\n", (int64_t) hdb->cnt_reducefbp); + iprintf("cnt_appenddrp: %" PRId64 "\n", (int64_t) hdb->cnt_appenddrp); + iprintf("cnt_deferdrp: %" PRId64 "\n", (int64_t) hdb->cnt_deferdrp); + iprintf("cnt_flushdrp: %" PRId64 "\n", (int64_t) hdb->cnt_flushdrp); + iprintf("cnt_adjrecc: %" PRId64 "\n", (int64_t) hdb->cnt_adjrecc); + iprintf("cnt_defrag: %" PRId64 "\n", (int64_t) hdb->cnt_defrag); + iprintf("cnt_shiftrec: %" PRId64 "\n", (int64_t) hdb->cnt_shiftrec); + iprintf("cnt_trunc: %" PRId64 "\n", (int64_t) hdb->cnt_trunc); #endif } @@ -685,8 +685,8 @@ static int procwrite(const char *path, int tnum, int rnum, int bnum, int apow, i } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -766,8 +766,8 @@ static int procread(const char *path, int tnum, int rcnum, int xmsiz, int dfunit } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -845,8 +845,8 @@ static int procremove(const char *path, int tnum, int rcnum, int xmsiz, int dfun } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -972,8 +972,8 @@ static int procwicked(const char *path, int tnum, int rnum, int opts, int omode, if (rnum % 50 > 0) iprintf(" (%08d)\n", rnum); } tcmapdel(map); - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -1059,8 +1059,8 @@ static int proctypical(const char *path, int tnum, int rnum, int bnum, int apow, } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -1136,8 +1136,8 @@ static int procrace(const char *path, int tnum, int rnum, int bnum, int apow, in } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { diff --git a/src/tchdb/tests/tchtest.c b/src/tchdb/tests/tchtest.c index fb9772d..b092ece 100644 --- a/src/tchdb/tests/tchtest.c +++ b/src/tchdb/tests/tchtest.c @@ -146,31 +146,31 @@ static void eprint(TCHDB *hdb, int line, const char *func) { /* print members of hash database */ static void mprint(TCHDB *hdb) { - iprintf("bucket number: %" PRIdMAX "\n", (int64_t) tchdbbnum(hdb)); - iprintf("used bucket number: %" PRIdMAX "\n", (int64_t) tchdbbnumused(hdb)); - iprintf("msiz: %" PRIdMAX "\n", hdb->msiz); - iprintf("xmsiz: %" PRIdMAX "\n", hdb->xmsiz); - iprintf("fbpnum: %" PRIdMAX "\n", hdb->fbpnum); + iprintf("bucket number: %" PRId64 "\n", (int64_t) tchdbbnum(hdb)); + iprintf("used bucket number: %" PRId64 "\n", (int64_t) tchdbbnumused(hdb)); + iprintf("msiz: %" PRId64 "\n", hdb->msiz); + iprintf("xmsiz: %" PRId64 "\n", hdb->xmsiz); + iprintf("fbpnum: %" PRId64 "\n", hdb->fbpnum); iprintf("fbpool: %p\n", hdb->fbpool); #ifndef NDEBUG if (hdb->cnt_writerec < 0) return; - iprintf("cnt_writerec: %" PRIdMAX "\n", (int64_t) hdb->cnt_writerec); - iprintf("cnt_reuserec: %" PRIdMAX "\n", (int64_t) hdb->cnt_reuserec); - iprintf("cnt_moverec: %" PRIdMAX "\n", (int64_t) hdb->cnt_moverec); - iprintf("cnt_readrec: %" PRIdMAX "\n", (int64_t) hdb->cnt_readrec); - iprintf("cnt_searchfbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_searchfbp); - iprintf("cnt_insertfbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_insertfbp); - iprintf("cnt_splicefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_splicefbp); - iprintf("cnt_dividefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_dividefbp); - iprintf("cnt_mergefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_mergefbp); - iprintf("cnt_reducefbp: %" PRIdMAX "\n", (int64_t) hdb->cnt_reducefbp); - iprintf("cnt_appenddrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_appenddrp); - iprintf("cnt_deferdrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_deferdrp); - iprintf("cnt_flushdrp: %" PRIdMAX "\n", (int64_t) hdb->cnt_flushdrp); - iprintf("cnt_adjrecc: %" PRIdMAX "\n", (int64_t) hdb->cnt_adjrecc); - iprintf("cnt_defrag: %" PRIdMAX "\n", (int64_t) hdb->cnt_defrag); - iprintf("cnt_shiftrec: %" PRIdMAX "\n", (int64_t) hdb->cnt_shiftrec); - iprintf("cnt_trunc: %" PRIdMAX "\n", (int64_t) hdb->cnt_trunc); + iprintf("cnt_writerec: %" PRId64 "\n", (int64_t) hdb->cnt_writerec); + iprintf("cnt_reuserec: %" PRId64 "\n", (int64_t) hdb->cnt_reuserec); + iprintf("cnt_moverec: %" PRId64 "\n", (int64_t) hdb->cnt_moverec); + iprintf("cnt_readrec: %" PRId64 "\n", (int64_t) hdb->cnt_readrec); + iprintf("cnt_searchfbp: %" PRId64 "\n", (int64_t) hdb->cnt_searchfbp); + iprintf("cnt_insertfbp: %" PRId64 "\n", (int64_t) hdb->cnt_insertfbp); + iprintf("cnt_splicefbp: %" PRId64 "\n", (int64_t) hdb->cnt_splicefbp); + iprintf("cnt_dividefbp: %" PRId64 "\n", (int64_t) hdb->cnt_dividefbp); + iprintf("cnt_mergefbp: %" PRId64 "\n", (int64_t) hdb->cnt_mergefbp); + iprintf("cnt_reducefbp: %" PRId64 "\n", (int64_t) hdb->cnt_reducefbp); + iprintf("cnt_appenddrp: %" PRId64 "\n", (int64_t) hdb->cnt_appenddrp); + iprintf("cnt_deferdrp: %" PRId64 "\n", (int64_t) hdb->cnt_deferdrp); + iprintf("cnt_flushdrp: %" PRId64 "\n", (int64_t) hdb->cnt_flushdrp); + iprintf("cnt_adjrecc: %" PRId64 "\n", (int64_t) hdb->cnt_adjrecc); + iprintf("cnt_defrag: %" PRId64 "\n", (int64_t) hdb->cnt_defrag); + iprintf("cnt_shiftrec: %" PRId64 "\n", (int64_t) hdb->cnt_shiftrec); + iprintf("cnt_trunc: %" PRId64 "\n", (int64_t) hdb->cnt_trunc); #endif } @@ -628,8 +628,8 @@ static int procwrite(const char *path, int rnum, int bnum, int apow, int fpow, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -702,8 +702,8 @@ static int procread(const char *path, bool mt, int rcnum, int xmsiz, int dfunit, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -763,8 +763,8 @@ static int procremove(const char *path, bool mt, int rcnum, int xmsiz, int dfuni if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -918,8 +918,8 @@ static int procrcat(const char *path, int rnum, int bnum, int apow, int fpow, if (i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -1678,8 +1678,8 @@ static int procmisc(const char *path, int rnum, bool mt, int opts, int omode) { eprint(hdb, __LINE__, "tchdbforeach"); err = true; } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); if (!tchdbclose(hdb)) { @@ -2102,8 +2102,8 @@ static int procwicked(const char *path, int rnum, bool mt, int opts, int omode) eprint(hdb, __LINE__, "(validation)"); err = true; } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); mprint(hdb); sysprint(); tcmapdel(map); diff --git a/src/tchdb/tools/jbhmgr.c b/src/tchdb/tools/jbhmgr.c index 7594c9d..e3e60a3 100644 --- a/src/tchdb/tools/jbhmgr.c +++ b/src/tchdb/tools/jbhmgr.c @@ -549,14 +549,14 @@ static int procinform(const char *path, int omode) { if (flags & HDBFOPEN) printf(" open"); if (flags & HDBFFATAL) printf(" fatal"); printf("\n"); - printf("bucket number: %" PRIuMAX "\n", (uint64_t) tchdbbnum(hdb)); + printf("bucket number: %" PRIu64 "\n", (uint64_t) tchdbbnum(hdb)); #ifndef NDEBUG if (hdb->cnt_writerec >= 0) - printf("used bucket number: %" PRIdMAX "\n", (int64_t) tchdbbnumused(hdb)); + printf("used bucket number: %" PRId64 "\n", (int64_t) tchdbbnumused(hdb)); #endif printf("alignment: %u\n", tchdbalign(hdb)); printf("free block pool: %u\n", tchdbfbpmax(hdb)); - printf("inode number: %" PRIdMAX "\n", (int64_t) tchdbinode(hdb)); + printf("inode number: %" PRId64 "\n", (int64_t) tchdbinode(hdb)); char date[48]; tcdatestrwww(tchdbmtime(hdb), INT_MAX, date); printf("modified time: %s\n", date); @@ -568,8 +568,8 @@ static int procinform(const char *path, int omode) { if (opts & HDBTTCBS) printf(" tcbs"); if (opts & HDBTEXCODEC) printf(" excodec"); printf("\n"); - printf("record number: %" PRIuMAX "\n", (uint64_t) tchdbrnum(hdb)); - printf("file size: %" PRIuMAX "\n", (uint64_t) tchdbfsiz(hdb)); + printf("record number: %" PRIu64 "\n", (uint64_t) tchdbrnum(hdb)); + printf("file size: %" PRIu64 "\n", (uint64_t) tchdbfsiz(hdb)); if (!tchdbclose(hdb)) { if (!err) printerr(hdb); err = true; diff --git a/src/tctdb/tctdb.c b/src/tctdb/tctdb.c index 5db0722..19cb838 100644 --- a/src/tctdb/tctdb.c +++ b/src/tctdb/tctdb.c @@ -962,7 +962,7 @@ bool tctdbqryproc(TDBQRY *qry, TDBQRYPROC proc, void *op) { if (flags & TDBQPSTOP) break; } tclistdel(res); - tcxstrprintf(qry->hint, "post treatment: get=%" PRIdMAX ", put=%" PRIdMAX ", out=%" PRIdMAX "\n", + tcxstrprintf(qry->hint, "post treatment: get=%" PRId64 ", put=%" PRId64 ", out=%" PRId64 "\n", (int64_t) getnum, (int64_t) putnum, (int64_t) outnum); TDBUNLOCKMETHOD(tdb); return !err; @@ -1597,7 +1597,7 @@ bool tctdbqryproc2(TDBQRY *qry, TDBQRYPROC proc, void *op) { TDBUNLOCKMETHOD(tdb); } tclistdel(res); - tcxstrprintf(qry->hint, "post treatment: get=%" PRIdMAX ", put=%" PRIdMAX ", out=%" PRIdMAX "\n", + tcxstrprintf(qry->hint, "post treatment: get=%" PRId64 ", put=%" PRId64 ", out=%" PRId64 "\n", (int64_t) getnum, (int64_t) putnum, (int64_t) outnum); return !err; } @@ -2189,7 +2189,7 @@ static bool tctdboptimizeimpl(TCTDB *tdb, int64_t bnum, int8_t apow, int8_t fpow } } const char *path = tchdbpath(tdb->hdb); - char *tpath = tcsprintf("%s%ctmp%c%" PRIuMAX "", path, MYEXTCHR, MYEXTCHR, tchdbinode(tdb->hdb)); + char *tpath = tcsprintf("%s%ctmp%c%" PRIu64 "", path, MYEXTCHR, MYEXTCHR, tchdbinode(tdb->hdb)); TCHDB *thdb = tchdbnew(); tchdbsettype(thdb, TCDBTTABLE); HANDLE dbgfd = tchdbdbgfd(tdb->hdb); @@ -3937,7 +3937,7 @@ static TCMAP *tctdbqryidxfetch(TDBQRY *qry, TDBCOND *cond, TDBIDX *idx) { tcmapdel(nmap); nmap = tctdbidxgetbyfts(tdb, idx, cond, hint); } - tcxstrprintf(hint, "auxiliary result set size: %" PRIdMAX "\n", (int64_t) TCMAPRNUM(nmap)); + tcxstrprintf(hint, "auxiliary result set size: %" PRId64 "\n", (int64_t) TCMAPRNUM(nmap)); return nmap; } @@ -5443,7 +5443,7 @@ TCMAP *tctdbidxgetbytokens(TCTDB *tdb, const TDBIDX *idx, const TCLIST *tokens, int step; TCREADVNUMBUF64(cbuf, tid, step); char pkbuf[TCNUMBUFSIZ]; - int pksiz = sprintf(pkbuf, "%" PRIdMAX "", (int64_t) tid); + int pksiz = sprintf(pkbuf, "%" PRId64 "", (int64_t) tid); if (cnt < 1) { tcmapput(res, pkbuf, pksiz, "", 0); } else if (wring) { @@ -5483,7 +5483,7 @@ TCMAP *tctdbidxgetbytokens(TCTDB *tdb, const TDBIDX *idx, const TCLIST *tokens, int step; TCREADVNUMBUF64(cbuf, tid, step); char pkbuf[TCNUMBUFSIZ]; - int pksiz = sprintf(pkbuf, "%" PRIdMAX "", (int64_t) tid); + int pksiz = sprintf(pkbuf, "%" PRId64 "", (int64_t) tid); if (cnt < 1) { tcmapput(res, pkbuf, pksiz, "", 0); } else if (wring) { @@ -5893,7 +5893,7 @@ static void tctdbidxgetbyftsunion(TDBIDX *idx, const TCLIST *tokens, bool sign, if (off == ocr->off + rem) { onum++; char pkbuf[TCNUMBUFSIZ]; - int pksiz = sprintf(pkbuf, "%" PRIdMAX "", (int64_t) pkid); + int pksiz = sprintf(pkbuf, "%" PRId64 "", (int64_t) pkid); if (ores) { int rsiz; if (tcmapget(ores, pkbuf, pksiz, &rsiz)) { @@ -5965,7 +5965,7 @@ static void tctdbidxgetbyftsunion(TDBIDX *idx, const TCLIST *tokens, bool sign, if (uniq) tcmapputkeep(uniq, pkbuf, pksiz, "", 0); } else { char numbuf[TCNUMBUFSIZ]; - int pksiz = sprintf(numbuf, "%" PRIdMAX "", (int64_t) pkid); + int pksiz = sprintf(numbuf, "%" PRId64 "", (int64_t) pkid); if (ores) { int rsiz; if (tcmapget(ores, numbuf, pksiz, &rsiz)) { @@ -6034,7 +6034,7 @@ static void tctdbidxgetbyftsunion(TDBIDX *idx, const TCLIST *tokens, bool sign, if (uniq) tcmapputkeep(uniq, pkbuf, pksiz, "", 0); } else { char numbuf[TCNUMBUFSIZ]; - int pksiz = sprintf(numbuf, "%" PRIdMAX "", (int64_t) pkid); + int pksiz = sprintf(numbuf, "%" PRId64 "", (int64_t) pkid); if (ores) { int rsiz; if (tcmapget(ores, numbuf, pksiz, &rsiz)) { @@ -6335,7 +6335,7 @@ void tctdbprintmeta(TCTDB *tdb) { wp += sprintf(wp, " opts=%u", tdb->opts); wp += sprintf(wp, " lcnum=%d", tdb->lcnum); wp += sprintf(wp, " ncnum=%d", tdb->ncnum); - wp += sprintf(wp, " iccmax=%" PRIdMAX "", (int64_t) tdb->iccmax); + wp += sprintf(wp, " iccmax=%" PRId64 "", (int64_t) tdb->iccmax); wp += sprintf(wp, " iccsync=%f", tdb->iccsync); wp += sprintf(wp, " idxs=%p", (void *) tdb->idxs); wp += sprintf(wp, " inum=%d", tdb->inum); diff --git a/src/tctdb/tests/tctmttest.c b/src/tctdb/tests/tctmttest.c index cba512b..3250c64 100644 --- a/src/tctdb/tests/tctmttest.c +++ b/src/tctdb/tests/tctmttest.c @@ -621,8 +621,8 @@ static int procwrite(const char *path, int tnum, int rnum, int bnum, int apow, i } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); sysprint(); if (!tctdbclose(tdb)) { eprint(tdb, __LINE__, "tctdbclose"); @@ -700,8 +700,8 @@ static int procread(const char *path, int tnum, int rcnum, int lcnum, int ncnum, } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); sysprint(); if (!tctdbclose(tdb)) { eprint(tdb, __LINE__, "tctdbclose"); @@ -779,8 +779,8 @@ static int procremove(const char *path, int tnum, int rcnum, int lcnum, int ncnu } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); sysprint(); if (!tctdbclose(tdb)) { eprint(tdb, __LINE__, "tctdbclose"); @@ -889,8 +889,8 @@ static int procwicked(const char *path, int tnum, int rnum, int opts, int omode) } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); sysprint(); if (!tctdbclose(tdb)) { eprint(tdb, __LINE__, "tctdbclose"); @@ -998,8 +998,8 @@ static int proctypical(const char *path, int tnum, int rnum, int bnum, int apow, } } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); sysprint(); if (!tctdbclose(tdb)) { eprint(tdb, __LINE__, "tctdbclose"); diff --git a/src/tctdb/tests/tcttest.c b/src/tctdb/tests/tcttest.c index 6662e7a..2d2a708 100644 --- a/src/tctdb/tests/tcttest.c +++ b/src/tctdb/tests/tcttest.c @@ -693,8 +693,8 @@ static int procwrite(const char *path, int rnum, int bnum, int apow, int fpow, if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); @@ -758,8 +758,8 @@ static int procread(const char *path, bool mt, int rcnum, int lcnum, int ncnum, if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); @@ -820,8 +820,8 @@ static int procremove(const char *path, bool mt, int rcnum, int lcnum, int ncnum if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); @@ -1028,8 +1028,8 @@ static int procrcat(const char *path, int rnum, int bnum, int apow, int fpow, if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i); } } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); @@ -1637,8 +1637,8 @@ static int procmisc(const char *path, int rnum, bool mt, int opts, int omode){ eprint(tdb, __LINE__, "tctdbforeach"); err = true; } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); @@ -2051,8 +2051,8 @@ static int procwicked(const char *path, int rnum, bool mt, int opts, int omode){ eprint(tdb, __LINE__, "tctdbsync"); err = true; } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctdbrnum(tdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctdbfsiz(tdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctdbrnum(tdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctdbfsiz(tdb)); sysprint(); if(!tctdbclose(tdb)){ eprint(tdb, __LINE__, "tctdbclose"); diff --git a/src/tctdb/tools/jbtmgr.c b/src/tctdb/tools/jbtmgr.c index 87dc379..9e74d2d 100644 --- a/src/tctdb/tools/jbtmgr.c +++ b/src/tctdb/tools/jbtmgr.c @@ -664,10 +664,10 @@ static int procinform(const char *path, int omode) { if (flags & TDBFOPEN) printf(" open"); if (flags & TDBFFATAL) printf(" fatal"); printf("\n"); - printf("bucket number: %" PRIuMAX "\n", (uint64_t) tctdbbnum(tdb)); + printf("bucket number: %" PRIu64 "\n", (uint64_t) tctdbbnum(tdb)); #ifndef NDEBUG if (tdb->hdb->cnt_writerec >= 0) - printf("used bucket number: %" PRIdMAX "\n", (int64_t) tctdbbnumused(tdb)); + printf("used bucket number: %" PRId64 "\n", (int64_t) tctdbbnumused(tdb)); #endif printf("alignment: %u\n", tctdbalign(tdb)); printf("free block pool: %u\n", tctdbfbpmax(tdb)); @@ -678,25 +678,25 @@ static int procinform(const char *path, int omode) { TDBIDX *idxp = idxs + i; switch (idxp->type) { case TDBITLEXICAL: - printf(" name=%s, type=lexical, rnum=%" PRIdMAX ", fsiz=%" PRIdMAX "\n", + printf(" name=%s, type=lexical, rnum=%" PRId64 ", fsiz=%" PRId64 "\n", idxp->name, (int64_t) tcbdbrnum(idxp->db), (int64_t) tcbdbfsiz(idxp->db)); break; case TDBITDECIMAL: - printf(" name=%s, type=decimal, rnum=%" PRIdMAX ", fsiz=%" PRIdMAX "\n", + printf(" name=%s, type=decimal, rnum=%" PRId64 ", fsiz=%" PRId64 "\n", idxp->name, (int64_t) tcbdbrnum(idxp->db), (int64_t) tcbdbfsiz(idxp->db)); break; case TDBITTOKEN: - printf(" name=%s, type=token, rnum=%" PRIdMAX ", fsiz=%" PRIdMAX "\n", + printf(" name=%s, type=token, rnum=%" PRId64 ", fsiz=%" PRId64 "\n", idxp->name, (int64_t) tcbdbrnum(idxp->db), (int64_t) tcbdbfsiz(idxp->db)); break; case TDBITQGRAM: - printf(" name=%s, type=qgram, rnum=%" PRIdMAX ", fsiz=%" PRIdMAX "\n", + printf(" name=%s, type=qgram, rnum=%" PRId64 ", fsiz=%" PRId64 "\n", idxp->name, (int64_t) tcbdbrnum(idxp->db), (int64_t) tcbdbfsiz(idxp->db)); break; } } - printf("unique ID seed: %" PRIdMAX "\n", (int64_t) tctdbuidseed(tdb)); - printf("inode number: %" PRIdMAX "\n", (int64_t) tctdbinode(tdb)); + printf("unique ID seed: %" PRId64 "\n", (int64_t) tctdbuidseed(tdb)); + printf("inode number: %" PRId64 "\n", (int64_t) tctdbinode(tdb)); char date[48]; tcdatestrwww(tctdbmtime(tdb), INT_MAX, date); printf("modified time: %s\n", date); @@ -708,8 +708,8 @@ static int procinform(const char *path, int omode) { if (opts & TDBTTCBS) printf(" tcbs"); if (opts & TDBTEXCODEC) printf(" excodec"); printf("\n"); - printf("record number: %" PRIuMAX "\n", (uint64_t) tctdbrnum(tdb)); - printf("file size: %" PRIuMAX "\n", (uint64_t) tctdbfsiz(tdb)); + printf("record number: %" PRIu64 "\n", (uint64_t) tctdbrnum(tdb)); + printf("file size: %" PRIu64 "\n", (uint64_t) tctdbfsiz(tdb)); if (!tctdbclose(tdb)) { if (!err) printerr(tdb); err = true; @@ -732,7 +732,7 @@ static int procput(const char *path, const char *pkbuf, int pksiz, TCMAP *cols, bool err = false; char pknumbuf[TCNUMBUFSIZ]; if (pksiz < 1) { - pksiz = sprintf(pknumbuf, "%" PRIdMAX "", (int64_t) tctdbgenuid(tdb)); + pksiz = sprintf(pknumbuf, "%" PRId64 "", (int64_t) tctdbgenuid(tdb)); pkbuf = pknumbuf; } const char *vbuf; @@ -1183,7 +1183,7 @@ static int procimporttsv(const char *path, const char *file, int omode, bool sc) if (sc) tcstrutfnorm(line, TCUNSPACE | TCUNLOWER | TCUNNOACC | TCUNWIDTH); const char *pkey; if (*line == '\0') { - sprintf(numbuf, "%" PRIdMAX "", (int64_t) tctdbgenuid(tdb)); + sprintf(numbuf, "%" PRId64 "", (int64_t) tctdbgenuid(tdb)); pkey = numbuf; } else { pkey = line; diff --git a/src/tcutil/tcutil.c b/src/tcutil/tcutil.c index 56db581..748ed5c 100644 --- a/src/tcutil/tcutil.c +++ b/src/tcutil/tcutil.c @@ -6701,10 +6701,10 @@ TCMAP *tcsysinfo(void) { } if (tcstrifwm(line, "VmSize:")) { int64_t size = tcatoix(rp); - if (size > 0) tcmapprintf(info, "size", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "size", "%" PRId64 "", (int64_t) size); } else if (tcstrifwm(line, "VmRSS:")) { int64_t size = tcatoix(rp); - if (size > 0) tcmapprintf(info, "rss", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "rss", "%" PRId64 "", (int64_t) size); } } tclistdel(lines); @@ -6722,13 +6722,13 @@ TCMAP *tcsysinfo(void) { } if (tcstrifwm(line, "MemTotal:")) { int64_t size = tcatoix(rp); - if (size > 0) tcmapprintf(info, "total", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "total", "%" PRId64 "", (int64_t) size); } else if (tcstrifwm(line, "MemFree:")) { int64_t size = tcatoix(rp); - if (size > 0) tcmapprintf(info, "free", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "free", "%" PRId64 "", (int64_t) size); } else if (tcstrifwm(line, "Cached:")) { int64_t size = tcatoix(rp); - if (size > 0) tcmapprintf(info, "cached", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "cached", "%" PRId64 "", (int64_t) size); } } tclistdel(lines); @@ -6741,7 +6741,7 @@ TCMAP *tcsysinfo(void) { const char *line = TCLISTVALPTR(lines, i); if (tcstrifwm(line, "processor")) cnum++; } - if (cnum > 0) tcmapprintf(info, "corenum", "%" PRIdMAX "", (int64_t) cnum); + if (cnum > 0) tcmapprintf(info, "corenum", "%" PRId64 "", (int64_t) cnum); tclistdel(lines); } return info; @@ -6756,7 +6756,7 @@ TCMAP *tcsysinfo(void) { rbuf.ru_stime.tv_sec + rbuf.ru_stime.tv_usec / 1000000.0); long tck = sysconf_SC_CLK_TCK; int64_t size = (((double) rbuf.ru_ixrss + rbuf.ru_idrss + rbuf.ru_isrss) / tck) * 1024.0; - if (size > 0) tcmapprintf(info, "rss", "%" PRIdMAX "", (int64_t) size); + if (size > 0) tcmapprintf(info, "rss", "%" PRId64 "", (int64_t) size); } return info; #elif defined(_WIN32) diff --git a/src/tcutil/tests/tcumttest.c b/src/tcutil/tests/tcumttest.c index f182d04..f77739e 100644 --- a/src/tcutil/tests/tcumttest.c +++ b/src/tcutil/tests/tcumttest.c @@ -318,11 +318,11 @@ static int proccombo(int tnum, int rnum, int bnum, bool tr, bool rnd){ } } if(tr){ - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcndbrnum(ndb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcndbmsiz(ndb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcndbrnum(ndb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcndbmsiz(ndb)); } else { - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcmdbrnum(mdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcmdbmsiz(mdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcmdbrnum(mdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcmdbmsiz(mdb)); } tcndbdel(ndb); tcmdbdel(mdb); @@ -376,11 +376,11 @@ static int proctypical(int tnum, int rnum, int bnum, bool tr, bool nc, int rrati } } if(tr){ - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcndbrnum(ndb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcndbmsiz(ndb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcndbrnum(ndb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcndbmsiz(ndb)); } else { - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcmdbrnum(mdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcmdbmsiz(mdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcmdbrnum(mdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcmdbmsiz(mdb)); } tcndbdel(ndb); tcmdbdel(mdb); diff --git a/src/tcutil/tests/tcutest.c b/src/tcutil/tests/tcutest.c index a9f2e80..f5467f6 100644 --- a/src/tcutil/tests/tcutest.c +++ b/src/tcutil/tests/tcutest.c @@ -576,8 +576,8 @@ static int procmap(int rnum, int bnum, bool rd, bool tr, bool rnd, int dmode){ } if(rnd && rnum > 250) iprintf(" (%08d)\n", inum); } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcmaprnum(map)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcmapmsiz(map)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcmaprnum(map)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcmapmsiz(map)); sysprint(); tcmapdel(map); iprintf("time: %.3f\n", tctime() - stime); @@ -652,8 +652,8 @@ static int proctree(int rnum, bool rd, bool tr, bool rnd, int dmode){ } if(rnd && rnum > 250) iprintf(" (%08d)\n", inum); } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tctreernum(tree)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tctreemsiz(tree)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tctreernum(tree)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tctreemsiz(tree)); sysprint(); tctreedel(tree); iprintf("time: %.3f\n", tctime() - stime); @@ -728,8 +728,8 @@ static int procmdb(int rnum, int bnum, bool rd, bool tr, bool rnd, int dmode){ } if(rnd && rnum > 250) iprintf(" (%08d)\n", inum); } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcmdbrnum(mdb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcmdbmsiz(mdb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcmdbrnum(mdb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcmdbmsiz(mdb)); sysprint(); tcmdbdel(mdb); iprintf("time: %.3f\n", tctime() - stime); @@ -804,8 +804,8 @@ static int procndb(int rnum, bool rd, bool tr, bool rnd, int dmode){ } if(rnd && rnum > 250) iprintf(" (%08d)\n", inum); } - iprintf("record number: %" PRIuMAX "\n", (uint64_t)tcndbrnum(ndb)); - iprintf("size: %" PRIuMAX "\n", (uint64_t)tcndbmsiz(ndb)); + iprintf("record number: %" PRIu64 "\n", (uint64_t)tcndbrnum(ndb)); + iprintf("size: %" PRIu64 "\n", (uint64_t)tcndbmsiz(ndb)); sysprint(); tcndbdel(ndb); iprintf("time: %.3f\n", tctime() - stime); diff --git a/win64-tc.cmake b/win64-tc.cmake index 8db5646..f6ae31c 100644 --- a/win64-tc.cmake +++ b/win64-tc.cmake @@ -6,9 +6,8 @@ if (NOT MXE_HOME) endif() if (NOT MXE_CFG) - if ($ENV{MXE_CFG}) - set(MXE_CFG $ENV{MXE_CFG}) - else() + set(MXE_CFG $ENV{MXE_CFG}) + if (NOT MXE_CFG) set(MXE_CFG "x86_64-w64-mingw32.static") endif() endif() |