瀏覽代碼

Fix R14 support

pull/184/head
Paul J. Davis 6 年之前
父節點
當前提交
56b25bb6b7
共有 1 個文件被更改,包括 5 次插入11 次删除
  1. +5
    -11
      c_src/encoder.c

+ 5
- 11
c_src/encoder.c 查看文件

@ -196,12 +196,9 @@ enc_literal(Encoder* e, const char* literal, size_t len)
} }
static inline int static inline int
enc_bignum(Encoder* e, ERL_NIF_TERM value) {
/* This is a bignum and we need to handle it up in Erlang code as
* the NIF API doesn't support them yet.
*
* Flush our current output and mark ourselves as needing a fixup
* after we return. */
enc_unknown(Encoder* e, ERL_NIF_TERM value) {
// Bignums are encoded in Erlang as the NIF API
// does not have functions for dealing with them.
if(!enc_flush(e)) { if(!enc_flush(e)) {
return 0; return 0;
} }
@ -922,14 +919,11 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
termstack_push(&stack, curr); termstack_push(&stack, curr);
termstack_push(&stack, e->atoms->ref_array); termstack_push(&stack, e->atoms->ref_array);
termstack_push(&stack, item); termstack_push(&stack, item);
} else if(enif_is_number(env, curr)) {
if(!enc_bignum(e, curr)) {
} else {
if(!enc_unknown(e, curr)) {
ret = enc_error(e, "internal_error"); ret = enc_error(e, "internal_error");
goto done; goto done;
} }
} else {
ret = enc_obj_error(e, "invalid_ejson", curr);
goto done;
} }
} }

Loading…
取消
儲存