|
1 | 1 | #include <tiny_tds_ext.h> |
2 | 2 | #include <errno.h> |
| 3 | +#include <inttypes.h> |
3 | 4 |
|
4 | 5 | VALUE cTinyTdsClient; |
5 | 6 | extern VALUE mTinyTds, cTinyTdsError; |
@@ -64,12 +65,6 @@ static const rb_data_type_t tinytds_client_wrapper_type = { |
64 | 65 | tinytds_client_wrapper *cwrap; \ |
65 | 66 | TypedData_Get_Struct(self, tinytds_client_wrapper, &tinytds_client_wrapper_type, cwrap) |
66 | 67 |
|
67 | | -#ifdef _WIN32 |
68 | | - #define LONG_LONG_FORMAT "I64d" |
69 | | -#else |
70 | | - #define LONG_LONG_FORMAT "lld" |
71 | | -#endif |
72 | | - |
73 | 68 | #define ENCODED_STR_NEW(_data, _len) ({ \ |
74 | 69 | VALUE _val = rb_str_new((char *)_data, (long)_len); \ |
75 | 70 | rb_enc_associate(_val, cwrap->encoding); \ |
@@ -578,8 +573,10 @@ static VALUE rb_tinytds_result_fetch_value(VALUE self, ID timezone, unsigned int |
578 | 573 | case SYBMONEY: { |
579 | 574 | DBMONEY *money = (DBMONEY *)data; |
580 | 575 | 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 | + |
583 | 580 | val = rb_funcall(cKernel, intern_bigd, 2, rb_str_new2(converted_money), opt_four); |
584 | 581 | val = rb_funcall(val, intern_divide, 1, opt_tenk); |
585 | 582 | break; |
|
0 commit comments