Skip to content

Commit 198eee5

Browse files
committed
Use int64_t instead of custom LONG_LONG_FORMAT macro
1 parent 20a4de7 commit 198eee5

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ext/tiny_tds/client.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <tiny_tds_ext.h>
22
#include <errno.h>
3+
#include <inttypes.h>
34

45
VALUE cTinyTdsClient;
56
extern VALUE mTinyTds, cTinyTdsError;
@@ -64,12 +65,6 @@ static const rb_data_type_t tinytds_client_wrapper_type = {
6465
tinytds_client_wrapper *cwrap; \
6566
TypedData_Get_Struct(self, tinytds_client_wrapper, &tinytds_client_wrapper_type, cwrap)
6667

67-
#ifdef _WIN32
68-
#define LONG_LONG_FORMAT "I64d"
69-
#else
70-
#define LONG_LONG_FORMAT "lld"
71-
#endif
72-
7368
#define ENCODED_STR_NEW(_data, _len) ({ \
7469
VALUE _val = rb_str_new((char *)_data, (long)_len); \
7570
rb_enc_associate(_val, cwrap->encoding); \
@@ -578,8 +573,10 @@ static VALUE rb_tinytds_result_fetch_value(VALUE self, ID timezone, unsigned int
578573
case SYBMONEY: {
579574
DBMONEY *money = (DBMONEY *)data;
580575
char converted_money[25];
581-
long long money_value = ((long long)money->mnyhigh << 32) | money->mnylow;
582-
sprintf(converted_money, "%" LONG_LONG_FORMAT, money_value);
576+
int64_t money_value = ((int64_t)money->mnyhigh << 32) | money->mnylow;
577+
578+
sprintf(converted_money, "%" PRId64, money_value);
579+
583580
val = rb_funcall(cKernel, intern_bigd, 2, rb_str_new2(converted_money), opt_four);
584581
val = rb_funcall(val, intern_divide, 1, opt_tenk);
585582
break;

0 commit comments

Comments
 (0)