Skip to content

Commit 53b38d2

Browse files
committed
follow indent as other parts
1 parent 9aedbb9 commit 53b38d2

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

ext/mysql2/statement.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -207,39 +207,39 @@ static void set_buffer_for_string(MYSQL_BIND* bind_buffer, unsigned long *length
207207
/* return 0 if the given bignum can cast as LONG_LONG, otherwise 1 */
208208
static int my_big2ll(VALUE bignum, LONG_LONG *ptr)
209209
{
210-
unsigned LONG_LONG num;
211-
size_t len;
212-
int nlz_bits = 0;
210+
unsigned LONG_LONG num;
211+
size_t len;
212+
int nlz_bits = 0;
213213
#ifdef HAVE_RB_ABSINT_SIZE
214-
len = rb_absint_size(bignum, &nlz_bits);
214+
len = rb_absint_size(bignum, &nlz_bits);
215215
#else
216-
len = RBIGNUM_LEN(bignum) * SIZEOF_BDIGITS;
216+
len = RBIGNUM_LEN(bignum) * SIZEOF_BDIGITS;
217217
#endif
218-
if (len > 8) goto overflow;
219-
if (RBIGNUM_POSITIVE_P(bignum)) {
220-
num = rb_big2ull(bignum);
221-
if (num > LLONG_MAX)
222-
goto overflow;
223-
*ptr = num;
224-
}
225-
else {
226-
if (len == 8 && nlz_bits == 0 &&
227-
/* only -0x8000000000000000 is safe if `len == 8 && nlz_bits == 0` */
218+
if (len > 8) goto overflow;
219+
if (RBIGNUM_POSITIVE_P(bignum)) {
220+
num = rb_big2ull(bignum);
221+
if (num > LLONG_MAX)
222+
goto overflow;
223+
*ptr = num;
224+
}
225+
else {
226+
if (len == 8 && nlz_bits == 0 &&
227+
/* only -0x8000000000000000 is safe if `len == 8 && nlz_bits == 0` */
228228
#ifdef HAVE_RB_ABSINT_SINGLEBIT_P
229-
!rb_absint_singlebit_p(bignum)
229+
!rb_absint_singlebit_p(bignum)
230230
#elif defined(HAVE_RB_BIG_AND)
231-
rb_big_and(bignum, LL2NUM(LLONG_MAX)) != INT2FIX(0)
231+
rb_big_and(bignum, LL2NUM(LLONG_MAX)) != INT2FIX(0)
232232
#else
233-
rb_big_cmp(bignum, LL2NUM(LLONG_MIN)) == INT2FIX(-1)
233+
rb_big_cmp(bignum, LL2NUM(LLONG_MIN)) == INT2FIX(-1)
234234
#endif
235-
) {
236-
goto overflow;
237-
}
238-
*ptr = rb_big2ll(bignum);
235+
) {
236+
goto overflow;
239237
}
240-
return 0;
238+
*ptr = rb_big2ll(bignum);
239+
}
240+
return 0;
241241
overflow:
242-
return 1;
242+
return 1;
243243
}
244244

245245
/* call-seq: stmt.execute
@@ -304,21 +304,21 @@ static VALUE execute(int argc, VALUE *argv, VALUE self) {
304304
break;
305305
case T_BIGNUM:
306306
{
307-
LONG_LONG num;
308-
if (my_big2ll(argv[i], &num) == 0) {
309-
bind_buffers[i].buffer_type = MYSQL_TYPE_LONGLONG;
310-
bind_buffers[i].buffer = xmalloc(sizeof(long long int));
311-
*(LONG_LONG*)(bind_buffers[i].buffer) = num;
312-
} else {
313-
/* The bignum was larger than we can fit in LONG_LONG, send it as a string */
314-
VALUE rb_val_as_string = rb_big2str(argv[i], 10);
315-
bind_buffers[i].buffer_type = MYSQL_TYPE_NEWDECIMAL;
316-
params_enc[i] = rb_val_as_string;
307+
LONG_LONG num;
308+
if (my_big2ll(argv[i], &num) == 0) {
309+
bind_buffers[i].buffer_type = MYSQL_TYPE_LONGLONG;
310+
bind_buffers[i].buffer = xmalloc(sizeof(long long int));
311+
*(LONG_LONG*)(bind_buffers[i].buffer) = num;
312+
} else {
313+
/* The bignum was larger than we can fit in LONG_LONG, send it as a string */
314+
VALUE rb_val_as_string = rb_big2str(argv[i], 10);
315+
bind_buffers[i].buffer_type = MYSQL_TYPE_NEWDECIMAL;
316+
params_enc[i] = rb_val_as_string;
317317
#ifdef HAVE_RUBY_ENCODING_H
318-
params_enc[i] = rb_str_export_to_enc(params_enc[i], conn_enc);
318+
params_enc[i] = rb_str_export_to_enc(params_enc[i], conn_enc);
319319
#endif
320-
set_buffer_for_string(&bind_buffers[i], &length_buffers[i], params_enc[i]);
321-
}
320+
set_buffer_for_string(&bind_buffers[i], &length_buffers[i], params_enc[i]);
321+
}
322322
}
323323
break;
324324
case T_FLOAT:

0 commit comments

Comments
 (0)