# HG changeset patch # User Matti Hamalainen # Date 1457007211 -7200 # Node ID bffd3caf2d2c110fd49f00bdaac9f78255c74487 # Parent 7df5991a0ed3c28123955f006fc4a57d4a534608 Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*. This breaks the API again. Hooray. diff -r 7df5991a0ed3 -r bffd3caf2d2c tests.c --- a/tests.c Thu Mar 03 14:11:57 2016 +0200 +++ b/tests.c Thu Mar 03 14:13:31 2016 +0200 @@ -220,7 +220,7 @@ // Test basic *printf() functionality test_init(&ctx); - test_start(&ctx, "th_vsnprintf(%" TH_PRIu_SIZE_T ", \"%s\", %s)", len, fmt, msg); + test_start(&ctx, "th_vsnprintf(%" PRIu_SIZE_T ", \"%s\", %s)", len, fmt, msg); memset(buf1, SET_SENTINEL_BYTE, SET_BUF_SIZE_2); buf1[SET_BUF_SIZE_2-1] = 0; memset(buf2, SET_SENTINEL_BYTE, SET_BUF_SIZE_2); buf2[SET_BUF_SIZE_2-1] = 0; @@ -379,7 +379,7 @@ for (i1 = 0; i1 < NCOUNT(i_vals64); i1++) { - snprintf(buf, sizeof(buf), "%" TH_PRId64, i_vals64[i1]); + snprintf(buf, sizeof(buf), "%" PRId64, i_vals64[i1]); for (i4 = 0; i4 < NCOUNT(i_mods); i4++) for (i3 = 0; i3 < NCOUNT(i_types); i3++) diff -r 7df5991a0ed3 -r bffd3caf2d2c th_ioctx.c --- a/th_ioctx.c Thu Mar 03 14:11:57 2016 +0200 +++ b/th_ioctx.c Thu Mar 03 14:13:31 2016 +0200 @@ -99,7 +99,7 @@ if (ctx->error != NULL) ctx->error((struct th_ioctx *) ctx, err, msg); else - THERR("'%s' #%" TH_PRIu_SIZE_T ": %s\n", ctx->filename, ctx->line, msg); + THERR("'%s' #%" PRIu_SIZE_T ": %s\n", ctx->filename, ctx->line, msg); th_free(msg); } diff -r 7df5991a0ed3 -r bffd3caf2d2c th_network.c --- a/th_network.c Thu Mar 03 14:11:57 2016 +0200 +++ b/th_network.c Thu Mar 03 14:13:31 2016 +0200 @@ -942,8 +942,8 @@ fprintf(f, "\n--------------------------------------------------------------\n" - "err=%d, status=%d, got_bytes=%" TH_PRIu_SIZE_T ", total_bytes=%" TH_PRIu_SIZE_T "\n" - "buf=0x%p, in_ptr=0x%04" TH_PRIx_SIZE_T ", ptr=0x%04" TH_PRIx_SIZE_T "\n", + "err=%d, status=%d, got_bytes=%" PRIu_SIZE_T ", total_bytes=%" PRIu_SIZE_T "\n" + "buf=0x%p, in_ptr=0x%04" PRIx_SIZE_T ", ptr=0x%04" PRIx_SIZE_T "\n", conn->err, conn->status, conn->base.got_bytes, conn->base.total_bytes, conn->base.buf, conn->base.in_ptr - conn->base.buf, conn->base.ptr - conn->base.buf); @@ -955,7 +955,7 @@ left -= amount; // Dump offs | xx xx xx xx | and fill string - fprintf(f, "%04" TH_PRIx_SIZE_T " | ", offs); + fprintf(f, "%04" PRIx_SIZE_T " | ", offs); for (bufoffs = 0; bufoffs < amount; offs++, bufoffs++, p++) { fprintf(f, "%02x ", *p); diff -r 7df5991a0ed3 -r bffd3caf2d2c th_types.h --- a/th_types.h Thu Mar 03 14:11:57 2016 +0200 +++ b/th_types.h Thu Mar 03 14:13:31 2016 +0200 @@ -58,15 +58,17 @@ // If so, set some printf specifiers #if TH_ARCH == 32 # define TH_ARCH_32BIT 1 -# define TH_PRIu32 "u" -# define TH_PRId32 "d" -# define TH_PRIx32 "x" -# define TH_PRIu64 "llu" -# define TH_PRId64 "lld" -# define TH_PRIx64 "llx" -# define TH_PRIu_SIZE_T "u" -# define TH_PRId_SSIZE_T "d" -# define TH_PRIx_SIZE_T "x" +# ifndef HAVE_INTTYPES_H +# define PRIu32 "u" +# define PRId32 "d" +# define PRIx32 "x" +# define PRIu64 "llu" +# define PRId64 "lld" +# define PRIx64 "llx" +# endif +# define PRIu_SIZE_T "u" +# define PRId_SSIZE_T "d" +# define PRIx_SIZE_T "x" # ifndef TH_PTRSIZE # define TH_PTRSIZE 32 # endif @@ -75,15 +77,17 @@ # endif #elif TH_ARCH == 64 # define TH_ARCH_64BIT 1 -# define TH_PRIu32 "u" -# define TH_PRId32 "d" -# define TH_PRIx32 "x" -# define TH_PRIu64 "lu" -# define TH_PRId64 "ld" -# define TH_PRIx64 "lx" -# define TH_PRIu_SIZE_T "lu" -# define TH_PRId_SSIZE_T "ld" -# define TH_PRIx_SIZE_T "lx" +# ifndef HAVE_INTTYPES_H +# define PRIu32 "u" +# define PRId32 "d" +# define PRIx32 "x" +# define PRIu64 "lu" +# define PRId64 "ld" +# define PRIx64 "lx" +# endif +# define PRIu_SIZE_T "lu" +# define PRId_SSIZE_T "ld" +# define PRIx_SIZE_T "lx" # ifndef TH_PTRSIZE # define TH_PTRSIZE 64 # endif