Branch Coverage

xs/XS.xs
Criterion Covered Total %
branch 546 1038 52.6


line true false branch
216 0 3435 PUSHMARK (SP);
217 0 3435 XPUSHs (self);
220 3083 3435 for( ; num > 0; num-- ) {
221 0 3083 XPUSHs (va_arg( args, SV* ));
3083 0 XPUSHs (va_arg( args, SV* ));
229 0 3435 if (count != 1) {
236 3435 0 FREETMPS;
279 0 2906 PUSHMARK (SP);
280 0 2906 XPUSHs (self);
282 4416 0 while ((key = va_arg (args, char *))) {
1510 2906 while ((key = va_arg (args, char *))) {
283 0 1510 mXPUSHp (key, strlen (key));
284 0 1510 XPUSHs (va_arg (args, SV *));
1510 0 XPUSHs (va_arg (args, SV *));
291 0 2906 if (count != 1) {
298 2906 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 1956 if (!SvROK (sv)) {
422 1936 20 if ( ! sv_isobject(sv) ) {
423 1936 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 2867 if ( depth > MAX_DEPTH ) {
509 3 2864 if (!(stack = check_circular_ref(hv, stack))) {
513 1936 928 if ( ! subdoc ) {
518 2906 2656 while ((he = hv_iternext (hv))) {
521 1779 1127 const char *key = HePV (he, len);
1779 0 const char *key = HePV (he, len);
522 1779 1127 uint32_t utf8 = HeUTF8(he);
526 0 2905 if (first_key && strcmp(key, first_key) == 0) {
0 0 if (first_key && strcmp(key, first_key) == 0) {
534 734 2171 if ((hval = hv_fetch(hv, key, utf8 ? -len : len, 0)) == 0) {
0 2905 if ((hval = hv_fetch(hv, key, utf8 ? -len : len, 0)) == 0) {
537 2171 734 if (!utf8) {
542 0 2905 if ( ! is_utf8_string((const U8*)key,len)) {
560 0 25 if ( depth > MAX_DEPTH ) {
571 1 24 if (!(stack = check_circular_ref(array, stack))) {
583 3 21 if ( ! subdoc ) {
587 53 23 for (i=0; i<=av_len(keys); i++) {
592 53 0 if (!(k = av_fetch(keys, i, 0)) ||
0 53 if (!(k = av_fetch(keys, i, 0)) ||
597 2 51 str = SvPVutf8(*k, len);
600 0 53 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 3110 if (
693 2 3110 (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 3112 0 if (
705 3112 0 (tempsv = _hv_fetchs_sv(opts, "invalid_chars"))
3112 0 (tempsv = _hv_fetchs_sv(opts, "invalid_chars"))
706 0 3112 && SvOK(tempsv)
0 0 && SvOK(tempsv)
0 0 && SvOK(tempsv)
707 2 3110 && (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 1322 if (!SvOK(sv)) {
1788 0 if (!SvOK(sv)) {
1788 0 if (!SvOK(sv)) {
728 1779 9 if (SvGMAGICAL(sv)) {
733 16 3094 if (!SvOK(sv)) {
16 0 if (!SvOK(sv)) {
16 0 if (!SvOK(sv)) {
737 2837 257 else if (SvROK (sv)) {
738 1899 938 if (sv_isobject (sv)) {
741 1865 34 if ( parent != NULL ) {
742 1865 0 obj_type = (const char *) SvPV_nolen(parent);
746 27 1872 if (strEQ(obj_type, "BSON::OID")) {
748 27 0 char *bytes = SvPV_nolen(attr);
755 0 1872 else if (strEQ(obj_type, "MongoDB::OID")) {
757 0 0 char *str = SvPV_nolen (attr);
765 3 1869 else if (strEQ(obj_type, "Tie::IxHash")) {
772 3 1866 else if (strEQ(obj_type, "BSON::Doc")) {
779 1 1865 else if (strEQ(obj_type, "BSON::Array")) {
786 102 1763 else if (strEQ(obj_type, "BSON::Raw")) {
793 102 0 bson_str = SvPV(encoded, str_len);
799 2 1761 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 18 1743 else if (strEQ(obj_type, "BSON::Time")) {
820 0 18 if ( sv_isa(ms, "Math::BigInt") ) {
825 18 0 bson_append_date_time(bson, key, -1, (int64_t)SvIV(ms));
829 0 1743 else if (strEQ(obj_type, "Time::Moment")) {
832 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));
835 0 1743 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 1743 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 1743 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 1724 19 else if (strEQ(obj_type, "BSON::DBRef") || strEQ(obj_type, "MongoDB::DBRef")) {
0 1724 else if (strEQ(obj_type, "BSON::DBRef") || strEQ(obj_type, "MongoDB::DBRef")) {
893 1717 7 else if (
894 1716 1 strEQ(obj_type, "boolean") ||
895 1715 1 strEQ(obj_type, "BSON::Bool") ||
896 1710 5 strEQ(obj_type, "JSON::XS::Boolean") ||
897 1709 1 strEQ(obj_type, "JSON::PP::Boolean") ||
898 1708 1 strEQ(obj_type, "JSON::Tiny::_Bool") ||
899 1707 1 strEQ(obj_type, "Mojo::JSON::_Bool") ||
900 1 1706 strEQ(obj_type, "Cpanel::JSON::XS::Boolean") ||
903 18 0 bson_append_bool(bson, key, -1, SvIV(SvRV(sv)));
905 1684 22 else if (strEQ(obj_type, "BSON::Code") || strEQ(obj_type, "MongoDB::Code")) {
0 1684 else if (strEQ(obj_type, "BSON::Code") || strEQ(obj_type, "MongoDB::Code")) {
911 11 11 code_str = SvPVutf8(code, code_len);
913 0 22 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 9 13 if (SvOK(scope)) {
9 0 if (SvOK(scope)) {
0 9 if (SvOK(scope)) {
929 10 1674 else if (strEQ(obj_type, "BSON::Timestamp")) {
935 10 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
10 0 bson_append_timestamp(bson, key, -1, SvIV(sec), SvIV(inc));
937 0 1674 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 1669 5 else if (strEQ(obj_type, "BSON::MinKey") || strEQ(obj_type, "MongoDB::MinKey")) {
1 1668 else if (strEQ(obj_type, "BSON::MinKey") || strEQ(obj_type, "MongoDB::MinKey")) {
948 1663 5 else if (strEQ(obj_type, "BSON::MaxKey") || strEQ(obj_type, "MongoDB::MaxKey")) {
1 1662 else if (strEQ(obj_type, "BSON::MaxKey") || strEQ(obj_type, "MongoDB::MaxKey")) {
951 0 1662 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 1654 else if (strEQ(obj_type, "BSON::String")) {
972 2 1652 else if (strEQ(obj_type, "MongoDB::BSON::String")) {
980 0 2 if (!SvPOK(str_sv)) {
986 1628 24 else if (strEQ(obj_type, "BSON::Bytes") || strEQ(obj_type, "MongoDB::BSON::Binary")) {
0 1628 else if (strEQ(obj_type, "BSON::Bytes") || strEQ(obj_type, "MongoDB::BSON::Binary")) {
992 24 0 append_binary(bson, key, SvIV(subtype), data);
994 1 1627 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 1626 else if (strEQ(obj_type, "Regexp")) {
1023 1602 24 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 24 0 append_decomposed_regex( bson, key, SvPV_nolen( pattern ), SvPV_nolen( flags ) );
24 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 165 tempsv = _hv_fetchs_sv(opts, "prefer_numeric");
92 0 tempsv = _hv_fetchs_sv(opts, "prefer_numeric");
1113 92 165 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 244 if ( SvNOK(sv) ) {
1128 13 0 bson_append_double(bson, key, -1, (double)SvNV(sv));
1129 130 114 } else if ( SvIOK(sv) ) {
1131 72 42 } 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 1951 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
2 0 if ( (tempsv = _hv_fetchs_sv(opts, "first_key")) && SvOK (tempsv) ) {
2 1951 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 27 0 uint8_t * bytes = (uint8_t *) SvPVbyte(sv, len);
1219 130 2 IV i = SvIV(sv);
1220 132 0 if ( i >= INT32_MIN && i <= INT32_MAX) {
132 0 if ( i >= INT32_MIN && i <= INT32_MAX) {
1235 52 69 const char *str = SvPVutf8(sv, len);
1237 0 121 if ( ! is_utf8_string((const U8*)str,len)) {
1247 1 2983 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 44634 2922 while (stack) {
1372 4 44630 if (ptr == stack->ptr) {
1399 0 1899 if (! SvOBJECT(sv)) {
1405 0 1899 if (av_len(mro) == -1) {
1409 3766 34 for ( i=av_len(mro); i >= 0; i-- ) {
1411 3766 0 if (handle != NULL) {
1412 3766 0 char* klass = SvPV_nolen(*handle);
1413 1865 1901 if (strnEQ(klass, "BSON::", 6)) {
1434 1 1813 if ( depth > MAX_DEPTH ) {
1439 1472 341 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 0 if ( (ordered = _hv_fetchs_sv(opts, "ordered")) && SvTRUE(ordered) ) {
1472 341 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 347 233 while (bson_iter_next(iter)) {
1452 0 347 if ( ! is_utf8_string((const U8*)name,strlen(name))) {
1459 341 6 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
339 2 if ( key_num == 1 && strcmp( name, "$ref" ) ) is_dbref = 0;
1460 6 341 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
2 4 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
0 2 if ( key_num == 2 && is_dbref == 1 && strcmp( name, "$id" ) ) is_dbref = 0;
1464 0 239 if (!hv_store (hv, name, 0-strlen(name), value, 0)) {
1472 122 111 if ( ! top && key_num >= 2 && is_dbref == 1
2 120 if ( ! top && key_num >= 2 && is_dbref == 1
2 0 if ( ! top && key_num >= 2 && is_dbref == 1
1473 2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 2 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
0 2 && (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 2 && (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)
2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
2 0 && (wrap = _hv_fetchs_sv(opts, "wrap_dbrefs")) && SvTRUE(wrap)
1 1 && (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)
1 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 103 if (bson_iter_type(iter) == BSON_TYPE_SYMBOL) {
1607 3 112 if ( ! is_utf8_string((const U8*)str,len)) {
1616 6 106 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 0 if ( (wrap = _hv_fetchs_sv(opts, "wrap_strings")) && SvTRUE(wrap) ) {
6 106 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 23 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 15 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
54 0 if ( (tempsv = _hv_fetchs_sv(opts, "wrap_numbers")) && SvTRUE(tempsv) ) {
54 15 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 3 18 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
3 0 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
3 18 if ( (dt_type_sv = _hv_fetchs_sv(opts, "dt_type")) && SvOK(dt_type_sv) ) {
1 2 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 2 0 char *dt_type = SvPV_nolen(dt_type_sv);
1727 1 1 if ( strEQ(dt_type, "BSON::Time") ) {
1730 0 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 9 if ( ! is_utf8_string((const U8*)code,len)) {
1794 0 13 if ( ! is_utf8_string((const U8*)code,code_len)) {
1801 13 0 if ( ! ( bson_init_static(&bson, scope, scope_len) && bson_iter_init(&child, &bson) ) ) {
0 13 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 1622 0 data = SvPV(msg, length);
1922 1622 0 if ( options ) {
1923 1622 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1622 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1931 15 1607 if ( ! bson_init_static(&bson, (uint8_t *) data, length) ) {
1935 48 1559 if ( ! bson_validate(&bson, BSON_VALIDATE_NONE, &error_offset, &invalid_key, &invalid_type) ) {
1939 5 1554 if ( invalid_type != 0 ) {
1943 0 1554 if ( ! bson_iter_init(&iter, &bson) ) {
1947 0 1554 XPUSHs(sv_2mortal(bson_doc_to_hashref(&iter, opts, 0, TRUE)));
1959 1956 0 if ( options ) {
1960 1956 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1956 0 if ( SvROK(options) && SvTYPE(SvRV(options)) == SVt_PVHV ) {
1968 0 1945 XPUSHs(sv_2mortal(newSVpvn((const char *)bson_get_data(bson), bson->len)));