Branch Coverage

xs/XS.xs
Criterion Covered Total %
branch 550 1038 52.9


line true false branch
216 0 3452 PUSHMARK (SP);
217 0 3452 XPUSHs (self);
220 3084 3452 for( ; num > 0; num-- ) {
221 0 3084 XPUSHs (va_arg( args, SV* ));
3084 0 XPUSHs (va_arg( args, SV* ));
229 0 3452 if (count != 1) {
236 3452 0 FREETMPS;
279 0 2913 PUSHMARK (SP);
280 0 2913 XPUSHs (self);
282 4434 0 while ((key = va_arg (args, char *))) {
1521 2913 while ((key = va_arg (args, char *))) {
283 0 1521 mXPUSHp (key, strlen (key));
284 0 1521 XPUSHs (va_arg (args, SV *));
1521 0 XPUSHs (va_arg (args, SV *));
291 0 2913 if (count != 1) {
298 2913 0 FREETMPS;
313 0 0 PUSHMARK (SP);
316 0 0 for( ; num > 0; num-- ) {
317 0 0 XPUSHs (va_arg( args, SV* ));
0 0 XPUSHs (va_arg( args, SV* ));
325 0 0 if (count != 1) {
332 0 0 FREETMPS;
353 0 40 PUSHMARK (SP);
360 17 23 if ( count == 0 ) {
367 0 23 ok = SvOK(ret[0]) != 0;
0 0 ok = SvOK(ret[0]) != 0;
0 0 ok = SvOK(ret[0]) != 0;
371 23 17 FREETMPS;
386 0 1 PUSHMARK (SP);
389 1 1 for( ; num > 0; num-- ) {
390 0 1 XPUSHs (va_arg( args, SV* ));
1 0 XPUSHs (va_arg( args, SV* ));
398 0 1 if (count != 1) {
405 1 0 FREETMPS;
418 0 1965 if (!SvROK (sv)) {
422 1945 20 if ( ! sv_isobject(sv) ) {
423 1945 0 switch ( SvTYPE(SvRV(sv)) ) {
437 20 0 class = HvNAME(SvSTASH(obj));
20 0 class = HvNAME(SvSTASH(obj));
0 20 class = HvNAME(SvSTASH(obj));
0 0 class = HvNAME(SvSTASH(obj));
20 0 class = HvNAME(SvSTASH(obj));
0 20 class = HvNAME(SvSTASH(obj));
439 3 17 if ( strEQ(class, "Tie::IxHash") ) {
442 14 3 else if ( strEQ(class, "BSON::Doc") ) {
445 1 2 else if ( strEQ(class, "BSON::Raw") ) {
452 1 0 bson_str = SvPV(encoded, str_len);
457 0 2 else if ( strEQ(class, "MongoDB::BSON::_EncodedDoc") ) {
464 0 0 encoded = _hv_fetchs_sv((HV *)obj, "bson");
0 0 encoded = _hv_fetchs_sv((HV *)obj, "bson");
465 0 0 bson_str = SvPV(encoded, str_len);
470 1 1 else if ( strEQ(class, "MongoDB::BSON::Raw") ) {
479 0 1 if (!SvPOK(str_sv)) {
483 1 0 str = SvPV(str_sv, str_len);
489 0 1 else if (SvTYPE(obj) == SVt_PVHV) {
505 2 2877 if ( depth > MAX_DEPTH ) {
509 3 2874 if (!(stack = check_circular_ref(hv, stack))) {
513 1945 929 if ( ! subdoc ) {
518 2916 2666 while ((he = hv_iternext (hv))) {
521 1779 1137 const char *key = HePV (he, len);
1779 0 const char *key = HePV (he, len);
522 1779 1137 uint32_t utf8 = HeUTF8(he);
526 0 2915 if (first_key && strcmp(key, first_key) == 0) {
0 0 if (first_key && strcmp(key, first_key) == 0) {
534 734 2181 if ((hval = hv_fetch(hv, key, utf8 ? -len : len, 0)) == 0) {
0 2915 if ((hval = hv_fetch(hv, key, utf8 ? -len : len, 0)) == 0) {
537 2181 734 if (!utf8) {
542 0 2915 if ( ! is_utf8_string((const U8*)key,len)) {
560 0 26 if ( depth > MAX_DEPTH ) {
571 1 25 if (!(stack = check_circular_ref(array, stack))) {
583 3 22 if ( ! subdoc ) {
587 55 24 for (i=0; i<=av_len(keys); i++) {
592 55 0 if (!(k = av_fetch(keys, i, 0)) ||
0 55 if (!(k = av_fetch(keys, i, 0)) ||
597 2 53 str = SvPVutf8(*k, len);
600 0 55 if (first_key && strcmp(str, first_key) == 0) {
0 0 if (first_key && strcmp(str, first_key) == 0) {
621 0 17 if ( depth > MAX_DEPTH ) {
626 0 17 if (!(stack = check_circular_ref(SvRV(sv), stack))) {
627 0 0 croak("circular ref: %s", SvPV_nolen(sv));
630 14 3 if ( ! subdoc ) {
635 17 0 if ( !SvROK(iter) || SvTYPE(SvRV(iter)) != SVt_PVCV ) {
0 17 if ( !SvROK(iter) || SvTYPE(SvRV(iter)) != SVt_PVCV ) {
636 0 0 croak("invalid iterator from %s", SvPV_nolen(sv));
639 23 17 while ( call_key_value_iter( iter, kv ) ) {
645 1 22 str = SvPVutf8(kv[0], len);
648 3 20 if (first_key && strcmp(str, first_key) == 0) {
1 2 if (first_key && strcmp(str, first_key) == 0) {
664 0 17 if ( depth > MAX_DEPTH ) {
668 0 17 if (!(stack = check_circular_ref(av, stack))) {
672 128 16 for (i = 0; i <= av_len (av); i++) {
675 0 128 if (!(sv = av_fetch (av, i, 0)))
676 0 0 sv_to_bson_elem (bson, SvPV_nolen(key), newSV(0), opts, stack, depth);
678 0 128 sv_to_bson_elem (bson, SvPV_nolen(key), *sv, opts, stack, depth);
692 2 3122 if (
693 2 3122 (tempsv = _hv_fetchs_sv(opts, "op_char"))
2 0 (tempsv = _hv_fetchs_sv(opts, "op_char"))
694 0 2 && SvOK(tempsv)
0 0 && SvOK(tempsv)
0 0 && SvOK(tempsv)
695 2 0 && SvPV_nolen(tempsv)[0] == str[0]
1 1 && SvPV_nolen(tempsv)[0] == str[0]
704 3124 0 if (
705 3124 0 (tempsv = _hv_fetchs_sv(opts, "invalid_chars"))
3124 0 (tempsv = _hv_fetchs_sv(opts, "invalid_chars"))
706 0 3124 && SvOK(tempsv)
0 0 && SvOK(tempsv)
0 0 && SvOK(tempsv)
707 2 3122 && (len = sv_len(tempsv))
710 2 0 const char *invalid = SvPV_nolen(tempsv);
712 2 0 for (i=0; i
713 2 0 if (strchr(str, invalid[i])) {
727 1788 1334 if (!SvOK(sv)) {
1788 0 if (!SvOK(sv)) {
1788 0 if (!SvOK(sv)) {
728 1779 9 if (SvGMAGICAL(sv)) {
733 16 3106 if (!SvOK(sv)) {
16 0 if (!SvOK(sv)) {
16 0 if (!SvOK(sv)) {
737 2846 260 else if (SvROK (sv)) {
738 1908 938 if (sv_isobject (sv)) {
741 1873 35 if ( parent != NULL ) {
742 1873 0 obj_type = (const char *) SvPV_nolen(parent);
746 28 1880 if (strEQ(obj_type, "BSON::OID")) {
748 28 0 char *bytes = SvPV_nolen(attr);
755 0 1880 else if (strEQ(obj_type, "MongoDB::OID")) {
757 0 0 char *str = SvPV_nolen (attr);
765 3 1877 else if (strEQ(obj_type, "Tie::IxHash")) {
772 3 1874 else if (strEQ(obj_type, "BSON::Doc")) {
779 1 1873 else if (strEQ(obj_type, "BSON::Array")) {
786 102 1771 else if (strEQ(obj_type, "BSON::Raw")) {
793 102 0 bson_str = SvPV(encoded, str_len);
799 2 1769 else if (strEQ(obj_type, "MongoDB::BSON::Raw")) {
808 0 2 if (!SvPOK(str_sv)) {
812 2 0 str = SvPV(str_sv, str_len);
818 19 1750 else if (strEQ(obj_type, "BSON::Time")) {
820 0 19 if ( sv_isa(ms, "Math::BigInt") ) {
825 19 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(ms));
829 1 1749 else if (strEQ(obj_type, "Time::Moment")) {
832 1 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(sec)*1000+SvIV(ms));
1 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(sec)*1000+SvIV(ms));
835 0 1749 else if (strEQ(obj_type, "DateTime")) {
843 0 0 str = SvPV(tz_name, len);
844 0 0 if (len == 8 && strncmp("floating", str, 8) == 0) {
0 0 if (len == 8 && strncmp("floating", str, 8) == 0) {
851 0 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(sec)*1000+SvIV(ms));
0 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(sec)*1000+SvIV(ms));
854 0 1749 else if (strEQ(obj_type, "DateTime::Tiny")) {
859 0 0 t.tm_year = SvIV( sv_2mortal(call_perl_reader( sv, "year" )) ) - 1900;
860 0 0 t.tm_mon = SvIV( sv_2mortal(call_perl_reader( sv, "month" )) ) - 1;
861 0 0 t.tm_mday = SvIV( sv_2mortal(call_perl_reader( sv, "day" )) ) ;
862 0 0 t.tm_hour = SvIV( sv_2mortal(call_perl_reader( sv, "hour" )) ) ;
863 0 0 t.tm_min = SvIV( sv_2mortal(call_perl_reader( sv, "minute" )) ) ;
864 0 0 t.tm_sec = SvIV( sv_2mortal(call_perl_reader( sv, "second" )) ) ;
873 0 1749 else if (strEQ(obj_type, "Mango::BSON::Time")) {
874 0 0 SV *ms = _hv_fetchs_sv((HV *)SvRV(sv), "time");
0 0 SV *ms = _hv_fetchs_sv((HV *)SvRV(sv), "time");
875 0 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(ms));
878 1729 20 else if (strEQ(obj_type, "BSON::DBRef") || strEQ(obj_type, "MongoDB::DBRef")) {
0 1729 else if (strEQ(obj_type, "BSON::DBRef") || strEQ(obj_type, "MongoDB::DBRef")) {
893 1722 7 else if (
894 1721 1 strEQ(obj_type, "boolean") ||
895 1720 1 strEQ(obj_type, "BSON::Bool") ||
896 1715 5 strEQ(obj_type, "JSON::XS::Boolean") ||
897 1714 1 strEQ(obj_type, "JSON::PP::Boolean") ||
898 1713 1 strEQ(obj_type, "JSON::Tiny::_Bool") ||
899 1712 1 strEQ(obj_type, "Mojo::JSON::_Bool") ||
900 1 1711 strEQ(obj_type, "Cpanel::JSON::XS::Boolean") ||
903 18 0 bson_append_bool(bson, key, -1, SvIV(SvRV(sv)));
905 1687 24 else if (strEQ(obj_type, "BSON::Code") || strEQ(obj_type, "MongoDB::Code")) {
0 1687 else if (strEQ(obj_type, "BSON::Code") || strEQ(obj_type, "MongoDB::Code")) {
911 11 13 code_str = SvPVutf8(code, code_len);
913 0 24 if ( ! is_utf8_string((const U8*)code_str,code_len)) {
914 0 0 croak( "Invalid UTF-8 detected while encoding BSON from %s", SvPV_nolen(sv) );
919 10 14 if (SvOK(scope)) {
10 0 if (SvOK(scope)) {
0 10 if (SvOK(scope)) {
929 11 1676 else if (strEQ(obj_type, "BSON::Timestamp")) {
935 11 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
11 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
937 0 1676 else if (strEQ(obj_type, "MongoDB::Timestamp")) {
943 0 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
0 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
945 1671 5 else if (strEQ(obj_type, "BSON::MinKey") || strEQ(obj_type, "MongoDB::MinKey")) {
1 1670 else if (strEQ(obj_type, "BSON::MinKey") || strEQ(obj_type, "MongoDB::MinKey")) {
948 1665 5 else if (strEQ(obj_type, "BSON::MaxKey") || strEQ(obj_type, "MongoDB::MaxKey")) {
1 1664 else if (strEQ(obj_type, "BSON::MaxKey") || strEQ(obj_type, "MongoDB::MaxKey")) {
951 0 1664 else if (strEQ(obj_type, "MongoDB::BSON::_EncodedDoc")) {
958 0 0 encoded = _hv_fetchs_sv((HV *)SvRV(sv), "bson");
0 0 encoded = _hv_fetchs_sv((HV *)SvRV(sv), "bson");
959 0 0 bson_str = SvPV(encoded, str_len);
964 8 1656 else if (strEQ(obj_type, "BSON::String")) {
972 2 1654 else if (strEQ(obj_type, "MongoDB::BSON::String")) {
980 0 2 if (!SvPOK(str_sv)) {
986 1629 25 else if (strEQ(obj_type, "BSON::Bytes") || strEQ(obj_type, "MongoDB::BSON::Binary")) {
0 1629 else if (strEQ(obj_type, "BSON::Bytes") || strEQ(obj_type, "MongoDB::BSON::Binary")) {
992 25 0 append_binary(bson, key, SvIV(subtype), data);
994 1 1628 else if (strEQ(obj_type, "BSON::Binary")) {
1000 0 1 int_subtype = SvOK(subtype) ? SvIV(subtype) : 0;
0 0 int_subtype = SvOK(subtype) ? SvIV(subtype) : 0;
0 0 int_subtype = SvOK(subtype) ? SvIV(subtype) : 0;
1 0 int_subtype = SvOK(subtype) ? SvIV(subtype) : 0;
1005 0 1 if ( SvOK(data) && ( SvTYPE(SvRV(data)) == SVt_PVAV) ) {
0 0 if ( SvOK(data) && ( SvTYPE(SvRV(data)) == SVt_PVAV) ) {
0 0 if ( SvOK(data) && ( SvTYPE(SvRV(data)) == SVt_PVAV) ) {
1 0 if ( SvOK(data) && ( SvTYPE(SvRV(data)) == SVt_PVAV) ) {
1014 1 1627 else if (strEQ(obj_type, "Regexp")) {
1023 1602 25 else if (strEQ(obj_type, "BSON::Regex") || strEQ(obj_type, "MongoDB::BSON::Regexp") ) {
0 1602 else if (strEQ(obj_type, "BSON::Regex") || strEQ(obj_type, "MongoDB::BSON::Regexp") ) {
1029 25 0 append_decomposed_regex( bson, key, SvPV_nolen( pattern ), SvPV_nolen( flags ) );
25 0 append_decomposed_regex( bson, key, SvPV_nolen( pattern ), SvPV_nolen( flags ) );
1032 6 1596 else if (strEQ(obj_type, "Math::BigInt")) {
1035 16 1580 else if (strEQ(obj_type, "BSON::Int64") ) {
1038 2 14 if ( SvROK(v) ) {
1043 0 14 bson_append_int64(bson, key, -1, (int64_t)SvIV(sv));
1045 0 1580 else if (strEQ(obj_type, "Math::Int64")) {
1048 0 0 Copy(SvPVbyte_nolen(v_sv), &v_int, 1, uint64_t);
1051 35 1545 else if (strEQ(obj_type, "BSON::Int32") ) {
1052 0 35 bson_append_int32(bson, key, -1, (int32_t)SvIV(sv));
1054 32 1513 else if (strEQ(obj_type, "BSON::Double") ) {
1055 0 32 bson_append_double(bson, key, -1, (double)SvNV(sv));
1057 1512 1 else if (strEQ(obj_type, "BSON::Decimal128") ) {
1063 1512 0 bid_bytes = SvPV_nolen(dec_sv);
1074 1 0 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
1 0 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
0 1 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
0 0 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
1 0 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
0 1 croak ("For key '%s', can't encode value of type '%s'", key, HvNAME(SvSTASH(SvRV(sv))));
1097 2 0 if ( SvPOK(deref) ) {
1102 0 0 croak ("For key '%s', can't encode value '%s'", key, SvPV_nolen(sv));
1112 92 168 tempsv = _hv_fetchs_sv(opts, "prefer_numeric");
92 0 tempsv = _hv_fetchs_sv(opts, "prefer_numeric");
1113 92 168 prefer_numeric = SvTRUE(tempsv);
0 92 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 92 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 92 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
92 0 prefer_numeric = SvTRUE(tempsv);
92 0 prefer_numeric = SvTRUE(tempsv);
7 85 prefer_numeric = SvTRUE(tempsv);
0 7 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
85 7 prefer_numeric = SvTRUE(tempsv);
0 0 prefer_numeric = SvTRUE(tempsv);
1127 13 247 if ( SvNOK(sv) ) {
1128 13 0 bson_append_double(bson, key, -1, (double)SvNV(sv));
1129 131 116 } else if ( SvIOK(sv) ) {
1131 72 44 } else if ( prefer_numeric && is_number ) {
3 69 } else if ( prefer_numeric && is_number ) {
1134 1 2 if (is_number & IS_NUMBER_NOT_INT) { /* double */
1135 0 1 bson_append_double(bson, key, -1, (double)SvNV(tempsv));
1152 2 1960 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
2 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
2 1960 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
0 2 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
1154 0 2 first_key = SvPVutf8(tempsv, len);
1156 2 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_value")) ) {
2 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_value")) ) {
2 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_value")) ) {
1189 3 1 for ( i=0; flags[i]; i++ ) {
1190 3 3 for ( j=i+1; flags[j] ; j++ ) {
1191 1 2 if ( flags[i] > flags[j] ) {
1211 28 0 uint8_t * bytes = (uint8_t *) SvPVbyte(sv, len);
1219 131 2 IV i = SvIV(sv);
1220 133 0 if ( i >= INT32_MIN && i <= INT32_MAX) {
133 0 if ( i >= INT32_MIN && i <= INT32_MAX) {
1235 52 71 const char *str = SvPVutf8(sv, len);
1237 0 123 if ( ! is_utf8_string((const U8*)str,len)) {
1247 1 2995 if(strlen(str) < len) {
1249 1 0 croak("Key '%s' contains null character", SvPV_nolen(clean));
1286 0 1 PUSHMARK (SP);
1287 0 1 XPUSHs (sv);
1293 0 1 if ( ret_count != 2 ) {
1301 0 1 flags_tmp = SvPVutf8_nolen(flags_sv);
1302 4 0 for ( i = 0; i < sizeof( flags_tmp ); i++ ) {
1303 1 3 if ( flags_tmp[i] == 0 ) break;
1306 2 1 if ( flags_tmp[i] == 'i' ||
1 1 if ( flags_tmp[i] == 'i' ||
1307 0 1 flags_tmp[i] == 'm' ||
1308 0 0 flags_tmp[i] == 'x' ||
1309 0 0 flags_tmp[i] == 'l' ||
1310 0 0 flags_tmp[i] == 'u' ||
1320 1 0 FREETMPS;
1333 4 2 str = SvPV_nolen(tempsv);
1338 6 0 if ( end && (*end != '\0') ) {
0 6 if ( end && (*end != '\0') ) {
1339 0 0 if ( errno == ERANGE && ( big == LLONG_MAX || big == LLONG_MIN ) ) {
0 0 if ( errno == ERANGE && ( big == LLONG_MAX || big == LLONG_MIN ) ) {
0 0 if ( errno == ERANGE && ( big == LLONG_MAX || big == LLONG_MIN ) ) {
1371 44635 2933 while (stack) {
1372 4 44631 if (ptr == stack->ptr) {
1399 0 1908 if (! SvOBJECT(sv)) {
1405 0 1908 if (av_len(mro) == -1) {
1409 3783 35 for ( i=av_len(mro); i >= 0; i-- ) {
1411 3783 0 if (handle != NULL) {
1412 3783 0 char* klass = SvPV_nolen(*handle);
1413 1873 1910 if (strnEQ(klass, "BSON::", 6)) {
1434 1 1824 if ( depth > MAX_DEPTH ) {
1439 1472 352 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 352 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 1472 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 1472 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 1472 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 1472 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
0 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1446 359 244 while (bson_iter_next(iter)) {
1452 0 359 if ( ! is_utf8_string((const U8*)name,strlen(name))) {
1459 352 7 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
349 3 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
1460 7 352 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
3 4 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
0 3 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
1464 0 251 if (!hv_store (hv, name, 0-strlen(name), value, 0)) {
1472 123 121 if ( ! top && key_num >= 2 && is_dbref == 1
3 120 if ( ! top && key_num >= 2 && is_dbref == 1
3 0 if ( ! top && key_num >= 2 && is_dbref == 1
1473 3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 3 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 3 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 3 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
3 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
1 2 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 1 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
2 1 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
1498 0 1472 if ( depth > MAX_DEPTH ) {
1504 1536 1472 while (bson_iter_next(iter)) {
1510 0 1536 if ( ! is_utf8_string((const U8*)name,strlen(name))) {
1517 1462 74 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
1450 12 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
1518 21 1515 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
12 9 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
0 12 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
1532 25 1447 if ( !top && key_num >= 2 && is_dbref == 1
12 13 if ( !top && key_num >= 2 && is_dbref == 1
10 2 if ( !top && key_num >= 2 && is_dbref == 1
1533 10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 10 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 10 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 10 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 10 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
10 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
1549 0 14 if ( depth > MAX_DEPTH ) {
1553 22 14 while (bson_iter_next(iter)) {
1558 22 0 if ((sv = bson_elem_to_sv(iter, name, opts, depth))) {
1582 59 0 if (Perl_isinf(SvNV(d)) || Perl_isnan(SvNV(d)) ) {
14 45 if (Perl_isinf(SvNV(d)) || Perl_isnan(SvNV(d)) ) {
45 0 if (Perl_isinf(SvNV(d)) || Perl_isnan(SvNV(d)) ) {
10 35 if (Perl_isinf(SvNV(d)) || Perl_isnan(SvNV(d)) ) {
1583 0 24 SvPV_nolen(d); /* force to PVNV for compatibility */
1586 51 8 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
51 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
51 8 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
51 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 51 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 51 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 13 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
38 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
13 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
13 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 13 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
13 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
1601 12 105 if (bson_iter_type(iter) == BSON_TYPE_SYMBOL) {
1607 3 114 if ( ! is_utf8_string((const U8*)str,len)) {
1616 6 108 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 108 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 6 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 6 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 6 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 6 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
0 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
1647 5 24 if ( BSON_UNLIKELY(type == BSON_SUBTYPE_BINARY_DEPRECATED) ) {
1655 3 2 if ( sublen != len ) {
1672 12 6 : newSVsv(get_sv("BSON::XS::_boolean_false", GV_ADD));
1683 54 16 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
54 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
54 16 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
54 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 54 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 54 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
45 9 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
45 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
45 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
29 16 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
29 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
29 16 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
9 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
9 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 9 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
9 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
1695 21 4 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
21 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
21 4 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
21 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 21 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 21 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 4 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
17 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
4 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
4 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 4 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
4 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
0 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
1725 4 19 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
4 0 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
4 19 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
1 3 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
1 0 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
0 1 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
1726 3 0 char *dt_type = SvPV_nolen(dt_type_sv);
1727 1 2 if ( strEQ(dt_type, "BSON::Time") ) {
1730 1 1 } else if ( strEQ(dt_type, "Time::Moment") ) {
1732 0 1 } else if ( strEQ(dt_type, "DateTime") ) {
1734 0 1 } else if ( strEQ(dt_type, "DateTime::Tiny") ) {
1736 0 1 } else if ( strEQ(dt_type, "Mango::BSON::Time") ) {
1772 0 10 if ( ! is_utf8_string((const U8*)code,len)) {
1794 0 14 if ( ! is_utf8_string((const U8*)code,code_len)) {
1801 14 0 if ( ! ( bson_init_static(&bson, scope, scope_len) && bson_iter_init(&child, &bson) ) ) {
0 14 if ( ! ( bson_init_static(&bson, scope, scope_len) && bson_iter_init(&child, &bson) ) ) {
1837 0 1206 if ( ! bson_iter_decimal128(iter, &dec) ) {
1861 1 6 if ( ! is_utf8_string((const U8*)collection,len)) {
1919 1631 0 data = SvPV(msg, length);
1922 1631 0 if ( options ) {
1923 1631 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1631 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1931 15 1616 if ( ! bson_init_static(&bson, (uint8_t *) data, length) ) {
1935 48 1568 if ( ! bson_validate(&bson, BSON_VALIDATE_NONE, &error_offset, &invalid_key, &invalid_type) ) {
1939 5 1563 if ( invalid_type != 0 ) {
1943 0 1563 if ( ! bson_iter_init(&iter, &bson) ) {
1947 0 1563 XPUSHs(sv_2mortal(bson_doc_to_hashref(&iter, opts, 0, TRUE)));
1959 1965 0 if ( options ) {
1960 1965 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1965 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1968 0 1954 XPUSHs(sv_2mortal(newSVpvn((const char *)bson_get_data(bson), bson->len)));