blosc2.c:is_little_endian:
   35|    179|static bool is_little_endian(void) {
   36|    179|  static const int i = 1;
   37|    179|  char* p = (char*)&i;
   38|       |
   39|    179|  if (p[0] == 1) {
  ------------------
  |  Branch (39:7): [True: 179, False: 0]
  ------------------
   40|    179|    return true;
   41|    179|  }
   42|      0|  else {
   43|      0|    return false;
   44|      0|  }
   45|    179|}
blosc2.c:sw32_:
   89|     56|static inline int32_t sw32_(const void* pa) {
   90|     56|  int32_t idest;
   91|       |
   92|     56|  bool little_endian = is_little_endian();
   93|     56|  if (little_endian) {
  ------------------
  |  Branch (93:7): [True: 56, False: 0]
  ------------------
   94|     56|    idest = *(int32_t *)pa;
   95|     56|  }
   96|      0|  else {
   97|      0|#if defined (__GNUC__)
   98|      0|    return __builtin_bswap32(*(unsigned int *)pa);
   99|       |#elif defined (_MSC_VER) /* Visual Studio */
  100|       |    return _byteswap_ulong(*(unsigned int *)pa);
  101|       |#else
  102|       |    uint8_t *dest = (uint8_t *)&idest;
  103|       |    dest[0] = pa_[3];
  104|       |    dest[1] = pa_[2];
  105|       |    dest[2] = pa_[1];
  106|       |    dest[3] = pa_[0];
  107|       |#endif
  108|      0|  }
  109|     56|  return idest;
  110|     56|}
frame.c:endian_handler:
   49|    287|{
   50|    287|  bool little_endian = is_little_endian();
   51|    287|  if (little_endian == little) {
  ------------------
  |  Branch (51:7): [True: 0, False: 287]
  ------------------
   52|      0|    memcpy(dest, pa, size);
   53|      0|  }
   54|    287|  else {
   55|    287|    uint8_t* pa_ = (uint8_t*)pa;
   56|    287|    uint8_t pa2_[8];
   57|    287|    switch (size) {
   58|    112|      case 8:
  ------------------
  |  Branch (58:7): [True: 112, False: 175]
  ------------------
   59|    112|        pa2_[0] = pa_[7];
   60|    112|        pa2_[1] = pa_[6];
   61|    112|        pa2_[2] = pa_[5];
   62|    112|        pa2_[3] = pa_[4];
   63|    112|        pa2_[4] = pa_[3];
   64|    112|        pa2_[5] = pa_[2];
   65|    112|        pa2_[6] = pa_[1];
   66|    112|        pa2_[7] = pa_[0];
   67|    112|        break;
   68|    145|      case 4:
  ------------------
  |  Branch (68:7): [True: 145, False: 142]
  ------------------
   69|    145|        pa2_[0] = pa_[3];
   70|    145|        pa2_[1] = pa_[2];
   71|    145|        pa2_[2] = pa_[1];
   72|    145|        pa2_[3] = pa_[0];
   73|    145|        break;
   74|     20|      case 2:
  ------------------
  |  Branch (74:7): [True: 20, False: 267]
  ------------------
   75|     20|        pa2_[0] = pa_[1];
   76|     20|        pa2_[1] = pa_[0];
   77|     20|        break;
   78|     10|      case 1:
  ------------------
  |  Branch (78:7): [True: 10, False: 277]
  ------------------
   79|     10|        pa2_[0] = pa_[0];
   80|     10|        break;
   81|      0|      default:
  ------------------
  |  Branch (81:7): [True: 0, False: 287]
  ------------------
   82|      0|        BLOSC_TRACE_ERROR("Unhandled size: %d.", size);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   83|    287|    }
   84|    287|    memcpy(dest, pa2_, size);
   85|    287|  }
   86|    287|}
frame.c:is_little_endian:
   35|    287|static bool is_little_endian(void) {
   36|    287|  static const int i = 1;
   37|    287|  char* p = (char*)&i;
   38|       |
   39|    287|  if (p[0] == 1) {
  ------------------
  |  Branch (39:7): [True: 287, False: 0]
  ------------------
   40|    287|    return true;
   41|    287|  }
   42|      0|  else {
   43|      0|    return false;
   44|      0|  }
   45|    287|}

blosc2_stdio_destroy:
   87|      5|int blosc2_stdio_destroy(void* params) {
   88|      5|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|      5|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   89|      5|  return 0;
   90|      5|}

do_nothing:
  566|    194|int do_nothing(uint8_t filter, char cmode) {
  567|    194|  if (cmode == 'c') {
  ------------------
  |  Branch (567:7): [True: 0, False: 194]
  ------------------
  568|      0|    return (filter == BLOSC_NOFILTER);
  569|    194|  } else {
  570|       |    // TRUNC_PREC do not have to be applied during decompression
  571|    194|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (571:13): [True: 142, False: 52]
  |  Branch (571:43): [True: 0, False: 52]
  ------------------
  572|    194|  }
  573|    194|}
next_filter:
  576|     26|int next_filter(const uint8_t* filters, int current_filter, char cmode) {
  577|     26|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (577:36): [True: 26, False: 0]
  ------------------
  578|     26|    if (!do_nothing(filters[i], cmode)) {
  ------------------
  |  Branch (578:9): [True: 26, False: 0]
  ------------------
  579|     26|      return filters[i];
  580|     26|    }
  581|     26|  }
  582|      0|  return BLOSC_NOFILTER;
  583|     26|}
last_filter:
  586|     28|int last_filter(const uint8_t* filters, char cmode) {
  587|     28|  int last_index = -1;
  588|    196|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (588:40): [True: 168, False: 28]
  ------------------
  589|    168|    if (!do_nothing(filters[i], cmode))  {
  ------------------
  |  Branch (589:9): [True: 26, False: 142]
  ------------------
  590|     26|      last_index = i;
  591|     26|    }
  592|    168|  }
  593|     28|  return last_index;
  594|     28|}
read_chunk_header:
  673|    123|{
  674|    123|  memset(header, 0, sizeof(blosc_header));
  675|       |
  676|    123|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (676:7): [True: 0, False: 123]
  ------------------
  677|      0|    BLOSC_TRACE_ERROR("Not enough space to read Blosc header.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  678|      0|    return BLOSC2_ERROR_READ_BUFFER;
  679|      0|  }
  680|       |
  681|    123|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  682|       |
  683|    123|  bool little_endian = is_little_endian();
  684|       |
  685|    123|  if (!little_endian) {
  ------------------
  |  Branch (685:7): [True: 0, False: 123]
  ------------------
  686|      0|    header->nbytes = bswap32_(header->nbytes);
  687|      0|    header->blocksize = bswap32_(header->blocksize);
  688|      0|    header->cbytes = bswap32_(header->cbytes);
  689|      0|  }
  690|       |
  691|    123|  if (header->version > BLOSC2_VERSION_FORMAT) {
  ------------------
  |  Branch (691:7): [True: 0, False: 123]
  ------------------
  692|       |    /* Version from future */
  693|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
  694|      0|  }
  695|    123|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (695:7): [True: 0, False: 123]
  ------------------
  696|      0|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  697|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  698|      0|  }
  699|    123|  if (header->blocksize <= 0 || (header->nbytes > 0 && (header->blocksize > header->nbytes))) {
  ------------------
  |  Branch (699:7): [True: 0, False: 123]
  |  Branch (699:34): [True: 123, False: 0]
  |  Branch (699:56): [True: 0, False: 123]
  ------------------
  700|      0|    BLOSC_TRACE_ERROR("`blocksize` is zero or greater than uncompressed size");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  701|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  702|      0|  }
  703|    123|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (703:7): [True: 0, False: 123]
  ------------------
  704|      0|    BLOSC_TRACE_ERROR("`blocksize` greater than maximum allowed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  705|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  706|      0|  }
  707|    123|  if (header->typesize == 0) {
  ------------------
  |  Branch (707:7): [True: 0, False: 123]
  ------------------
  708|      0|    BLOSC_TRACE_ERROR("`typesize` is zero.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  709|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  710|      0|  }
  711|       |
  712|       |  /* Read extended header if it is wanted */
  713|    123|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (713:7): [True: 38, False: 85]
  |  Branch (713:28): [True: 38, False: 0]
  |  Branch (713:65): [True: 38, False: 0]
  ------------------
  714|     38|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (714:9): [True: 0, False: 38]
  ------------------
  715|      0|      BLOSC_TRACE_ERROR("`cbytes` is too small to read extended header.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  716|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  717|      0|    }
  718|     38|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (718:9): [True: 0, False: 38]
  ------------------
  719|      0|      BLOSC_TRACE_ERROR("Not enough space to read Blosc extended header.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  720|      0|      return BLOSC2_ERROR_READ_BUFFER;
  721|      0|    }
  722|       |
  723|     38|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  724|     38|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  725|       |
  726|     38|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  727|     38|    if (special_type != 0) {
  ------------------
  |  Branch (727:9): [True: 4, False: 34]
  ------------------
  728|      4|      if (header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (728:11): [True: 0, False: 4]
  ------------------
  729|      0|        BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  730|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  731|      0|      }
  732|      4|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (732:11): [True: 0, False: 4]
  ------------------
  733|      0|        if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH + header->typesize) {
  ------------------
  |  Branch (733:13): [True: 0, False: 0]
  ------------------
  734|      0|          BLOSC_TRACE_ERROR("`cbytes` is too small for run length encoding");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  735|      0|          return BLOSC2_ERROR_READ_BUFFER;
  736|      0|        }
  737|      0|      }
  738|      4|    }
  739|       |    // The number of filters depends on the version of the header. Blosc2 alpha series
  740|       |    // did not initialize filters to zero beyond the max supported.
  741|     38|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (741:9): [True: 0, False: 38]
  ------------------
  742|      0|      header->filters[5] = 0;
  743|      0|      header->filters_meta[5] = 0;
  744|      0|    }
  745|     38|  }
  746|     85|  else {
  747|     85|    flags_to_filters(header->flags, header->filters);
  748|     85|  }
  749|    123|  return 0;
  750|    123|}
_cycle_buffers:
  917|     23|void _cycle_buffers(uint8_t **src, uint8_t **dest, uint8_t **tmp) {
  918|     23|  uint8_t *tmp2 = *src;
  919|     23|  *src = *dest;
  920|     23|  *dest = *tmp;
  921|     23|  *tmp = tmp2;
  922|     23|}
pipeline_backward:
 1322|     23|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1323|     23|  blosc2_context* context = thread_context->parent_context;
 1324|     23|  int32_t typesize = context->typesize;
 1325|     23|  uint8_t* filters = context->filters;
 1326|     23|  uint8_t* filters_meta = context->filters_meta;
 1327|     23|  uint8_t* _src = src;
 1328|     23|  uint8_t* _dest = tmp;
 1329|     23|  uint8_t* _tmp = tmp2;
 1330|     23|  int errcode = 0;
 1331|       |
 1332|     23|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1332:40): [True: 23, False: 0]
  ------------------
 1333|       |    // Delta filter requires the whole chunk ready
 1334|     23|    int last_copy_filter = (last_filter_index == i) || (next_filter(filters, i, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1334:28): [True: 23, False: 0]
  |  Branch (1334:56): [True: 0, False: 0]
  ------------------
 1335|     23|    if (last_copy_filter && context->postfilter == NULL) {
  ------------------
  |  Branch (1335:9): [True: 23, False: 0]
  |  Branch (1335:29): [True: 23, False: 0]
  ------------------
 1336|     23|      _dest = dest + offset;
 1337|     23|    }
 1338|     23|    int rc = BLOSC2_ERROR_SUCCESS;
 1339|     23|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1339:9): [True: 23, False: 0]
  ------------------
 1340|     23|      switch (filters[i]) {
 1341|     23|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1341:9): [True: 23, False: 0]
  ------------------
 1342|     23|          unshuffle(typesize, bsize, _src, _dest);
 1343|     23|          break;
 1344|      0|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1344:9): [True: 0, False: 23]
  ------------------
 1345|      0|          if (bitunshuffle(typesize, bsize, _src, _dest, context->src[BLOSC2_CHUNK_VERSION]) < 0) {
  ------------------
  |  Branch (1345:15): [True: 0, False: 0]
  ------------------
 1346|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1347|      0|          }
 1348|      0|          break;
 1349|      0|        case BLOSC_DELTA:
  ------------------
  |  Branch (1349:9): [True: 0, False: 23]
  ------------------
 1350|      0|          if (context->nthreads == 1) {
  ------------------
  |  Branch (1350:15): [True: 0, False: 0]
  ------------------
 1351|       |            /* Serial mode */
 1352|      0|            delta_decoder(dest, offset, bsize, typesize, _dest);
 1353|      0|          } else {
 1354|       |            /* Force the thread in charge of the block 0 to go first */
 1355|      0|            pthread_mutex_lock(&context->delta_mutex);
 1356|      0|            if (context->dref_not_init) {
  ------------------
  |  Branch (1356:17): [True: 0, False: 0]
  ------------------
 1357|      0|              if (offset != 0) {
  ------------------
  |  Branch (1357:19): [True: 0, False: 0]
  ------------------
 1358|      0|                pthread_cond_wait(&context->delta_cv, &context->delta_mutex);
 1359|      0|              } else {
 1360|      0|                delta_decoder(dest, offset, bsize, typesize, _dest);
 1361|      0|                context->dref_not_init = 0;
 1362|      0|                pthread_cond_broadcast(&context->delta_cv);
 1363|      0|              }
 1364|      0|            }
 1365|      0|            pthread_mutex_unlock(&context->delta_mutex);
 1366|      0|            if (offset != 0) {
  ------------------
  |  Branch (1366:17): [True: 0, False: 0]
  ------------------
 1367|      0|              delta_decoder(dest, offset, bsize, typesize, _dest);
 1368|      0|            }
 1369|      0|          }
 1370|      0|          break;
 1371|      0|        case BLOSC_TRUNC_PREC:
  ------------------
  |  Branch (1371:9): [True: 0, False: 23]
  ------------------
 1372|       |          // TRUNC_PREC filter does not need to be undone
 1373|      0|          break;
 1374|      0|        default:
  ------------------
  |  Branch (1374:9): [True: 0, False: 23]
  ------------------
 1375|      0|          if (filters[i] != BLOSC_NOFILTER) {
  ------------------
  |  Branch (1375:15): [True: 0, False: 0]
  ------------------
 1376|      0|            BLOSC_TRACE_ERROR("Filter %d not handled during decompression.",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1377|      0|                              filters[i]);
 1378|      0|            errcode = -1;
 1379|      0|          }
 1380|     23|      }
 1381|     23|    } else {
 1382|       |        // Look for the filters_meta in user filters and run it
 1383|      0|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1383:30): [True: 0, False: 0]
  ------------------
 1384|      0|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1384:15): [True: 0, False: 0]
  ------------------
 1385|      0|            if (g_filters[j].backward == NULL) {
  ------------------
  |  Branch (1385:17): [True: 0, False: 0]
  ------------------
 1386|       |              // Dynamically load filter
 1387|      0|              if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1387:19): [True: 0, False: 0]
  ------------------
 1388|      0|                BLOSC_TRACE_ERROR("Could not load filter %d.", g_filters[j].id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1389|      0|                return BLOSC2_ERROR_FILTER_PIPELINE;
 1390|      0|              }
 1391|      0|            }
 1392|      0|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1392:17): [True: 0, False: 0]
  ------------------
 1393|      0|              blosc2_dparams dparams;
 1394|      0|              blosc2_ctx_get_dparams(context, &dparams);
 1395|      0|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1396|      0|            } else {
 1397|      0|              BLOSC_TRACE_ERROR("Backward function is NULL");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1398|      0|              return BLOSC2_ERROR_FILTER_PIPELINE;
 1399|      0|            }
 1400|      0|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1400:17): [True: 0, False: 0]
  ------------------
 1401|      0|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", filters[i]);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1402|      0|              return rc;
 1403|      0|            }
 1404|      0|            goto urfiltersuccess;
 1405|      0|          }
 1406|      0|        }
 1407|      0|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", filters[i]);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1408|      0|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1409|      0|      urfiltersuccess:;
 1410|      0|    }
 1411|       |
 1412|       |    // Cycle buffers when required
 1413|     23|    if ((filters[i] != BLOSC_NOFILTER) && (filters[i] != BLOSC_TRUNC_PREC)) {
  ------------------
  |  Branch (1413:9): [True: 23, False: 0]
  |  Branch (1413:43): [True: 23, False: 0]
  ------------------
 1414|     23|      _cycle_buffers(&_src, &_dest, &_tmp);
 1415|     23|    }
 1416|     23|    if (last_filter_index == i) {
  ------------------
  |  Branch (1416:9): [True: 23, False: 0]
  ------------------
 1417|     23|      break;
 1418|     23|    }
 1419|     23|  }
 1420|       |
 1421|       |  /* Postfilter function */
 1422|     23|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1422:7): [True: 0, False: 23]
  ------------------
 1423|       |    // Create new postfilter parameters for this block (must be private for each thread)
 1424|      0|    blosc2_postfilter_params postparams;
 1425|      0|    memcpy(&postparams, context->postparams, sizeof(postparams));
 1426|      0|    postparams.input = _src;
 1427|      0|    postparams.output = dest + offset;
 1428|      0|    postparams.size = bsize;
 1429|      0|    postparams.typesize = typesize;
 1430|      0|    postparams.offset = nblock * context->blocksize;
 1431|      0|    postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1431:25): [True: 0, False: 0]
  ------------------
 1432|      0|    postparams.nblock = nblock;
 1433|      0|    postparams.tid = thread_context->tid;
 1434|      0|    postparams.ttmp = thread_context->tmp;
 1435|      0|    postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1436|      0|    postparams.ctx = context;
 1437|       |
 1438|      0|    if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (1438:9): [True: 0, False: 0]
  ------------------
 1439|      0|      BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1440|      0|      return BLOSC2_ERROR_POSTFILTER;
 1441|      0|    }
 1442|      0|  }
 1443|       |
 1444|     23|  return errcode;
 1445|     23|}
free_thread_context:
 2088|     27|void free_thread_context(struct thread_context* thread_context) {
 2089|     27|  destroy_thread_context(thread_context);
 2090|     27|  my_free(thread_context);
 2091|     27|}
check_nthreads:
 2094|     19|int check_nthreads(blosc2_context* context) {
 2095|     19|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2095:7): [True: 0, False: 19]
  ------------------
 2096|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2096|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2098|      0|  }
 2099|       |
 2100|     19|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2100:7): [True: 0, False: 19]
  ------------------
 2101|      0|    if (context->nthreads > 1) {
  ------------------
  |  Branch (2101:9): [True: 0, False: 0]
  ------------------
 2102|      0|      release_threadpool(context);
 2103|      0|    }
 2104|      0|    context->nthreads = context->new_nthreads;
 2105|      0|  }
 2106|     19|  if (context->new_nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2106:7): [True: 0, False: 19]
  |  Branch (2106:36): [True: 0, False: 0]
  ------------------
 2107|      0|    init_threadpool(context);
 2108|      0|  }
 2109|       |
 2110|     19|  return context->nthreads;
 2111|     19|}
build_filters:
 2677|      9|                   const int32_t typesize, uint8_t* filters) {
 2678|       |
 2679|       |  /* Fill the end part of the filter pipeline */
 2680|      9|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (2680:7): [True: 0, False: 9]
  |  Branch (2680:39): [True: 0, False: 0]
  ------------------
 2681|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 2682|      9|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (2682:7): [True: 0, False: 9]
  ------------------
 2683|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 2684|      9|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (2684:7): [True: 0, False: 9]
  ------------------
 2685|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 2686|      9|  if (delta)
  ------------------
  |  Branch (2686:7): [True: 0, False: 9]
  ------------------
 2687|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 2688|      9|}
blosc2_decompress_ctx:
 2930|     19|                          void* dest, int32_t destsize) {
 2931|     19|  int result;
 2932|       |
 2933|     19|  if (context->do_compress != 0) {
  ------------------
  |  Branch (2933:7): [True: 0, False: 19]
  ------------------
 2934|      0|    BLOSC_TRACE_ERROR("Context is not meant for decompression.  Giving up.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2935|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2936|      0|  }
 2937|       |
 2938|     19|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 2939|       |
 2940|       |  // Reset a possible block_maskout
 2941|     19|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (2941:7): [True: 0, False: 19]
  ------------------
 2942|      0|    free(context->block_maskout);
 2943|      0|    context->block_maskout = NULL;
 2944|      0|  }
 2945|     19|  context->block_maskout_nitems = 0;
 2946|       |
 2947|     19|  return result;
 2948|     19|}
_blosc_getitem:
 3015|     19|                   int start, int nitems, void* dest, int32_t destsize) {
 3016|     19|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 3017|     19|  uint8_t* _dest = (uint8_t*)(dest);
 3018|     19|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 3019|     19|  int32_t bsize, bsize2, ebsize, leftoverblock;
 3020|     19|  int32_t startb, stopb;
 3021|     19|  int32_t stop = start + nitems;
 3022|     19|  int j, rc;
 3023|       |
 3024|     19|  if (nitems == 0) {
  ------------------
  |  Branch (3024:7): [True: 0, False: 19]
  ------------------
 3025|       |    // We have nothing to do
 3026|      0|    return 0;
 3027|      0|  }
 3028|     19|  if (nitems * header->typesize > destsize) {
  ------------------
  |  Branch (3028:7): [True: 0, False: 19]
  ------------------
 3029|      0|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest bounds.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3030|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3031|      0|  }
 3032|       |
 3033|     19|  context->bstarts = (int32_t*)(_src + context->header_overhead);
 3034|       |
 3035|       |  /* Check region boundaries */
 3036|     19|  if ((start < 0) || (start * header->typesize > header->nbytes)) {
  ------------------
  |  Branch (3036:7): [True: 0, False: 19]
  |  Branch (3036:22): [True: 0, False: 19]
  ------------------
 3037|      0|    BLOSC_TRACE_ERROR("`start` out of bounds.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3038|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3039|      0|  }
 3040|       |
 3041|     19|  if ((stop < 0) || (stop * header->typesize > header->nbytes)) {
  ------------------
  |  Branch (3041:7): [True: 0, False: 19]
  |  Branch (3041:21): [True: 0, False: 19]
  ------------------
 3042|      0|    BLOSC_TRACE_ERROR("`start`+`nitems` out of bounds.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3043|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3044|      0|  }
 3045|       |
 3046|     19|  int chunk_memcpy = header->flags & 0x1;
 3047|     19|  if (!context->special_type && !chunk_memcpy &&
  ------------------
  |  Branch (3047:7): [True: 19, False: 0]
  |  Branch (3047:33): [True: 0, False: 19]
  ------------------
 3048|     19|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(context->bstarts + context->nblocks))) {
  ------------------
  |  Branch (3048:7): [True: 0, False: 0]
  ------------------
 3049|      0|    BLOSC_TRACE_ERROR("`bstarts` out of bounds.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3050|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3051|      0|  }
 3052|       |
 3053|     19|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 3054|     19|  if (context->special_type) {
  ------------------
  |  Branch (3054:7): [True: 0, False: 19]
  ------------------
 3055|       |    // Fake a runlen as if its a memcpyed chunk
 3056|      0|    memcpyed = true;
 3057|      0|  }
 3058|       |
 3059|     19|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (3059:19): [True: 19, False: 0]
  ------------------
 3060|     19|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (3060:19): [True: 0, False: 19]
  |  Branch (3060:54): [True: 0, False: 0]
  ------------------
 3061|     19|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (3061:7): [True: 19, False: 0]
  |  Branch (3061:19): [True: 19, False: 0]
  |  Branch (3061:31): [True: 19, False: 0]
  ------------------
 3062|       |    // Short-circuit for (non-lazy) memcpyed or special values
 3063|     19|    ntbytes = nitems * header->typesize;
 3064|     19|    switch (context->special_type) {
 3065|      0|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (3065:7): [True: 0, False: 19]
  ------------------
 3066|       |        // All repeated values
 3067|      0|        rc = set_values(context->typesize, _src, _dest, ntbytes);
 3068|      0|        if (rc < 0) {
  ------------------
  |  Branch (3068:13): [True: 0, False: 0]
  ------------------
 3069|      0|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3070|      0|          return BLOSC2_ERROR_DATA;
 3071|      0|        }
 3072|      0|        break;
 3073|      0|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (3073:7): [True: 0, False: 19]
  ------------------
 3074|      0|        rc = set_nans(context->typesize, _dest, ntbytes);
 3075|      0|        if (rc < 0) {
  ------------------
  |  Branch (3075:13): [True: 0, False: 0]
  ------------------
 3076|      0|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3077|      0|          return BLOSC2_ERROR_DATA;
 3078|      0|        }
 3079|      0|        break;
 3080|      0|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (3080:7): [True: 0, False: 19]
  ------------------
 3081|      0|        memset(_dest, 0, ntbytes);
 3082|      0|        break;
 3083|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (3083:7): [True: 0, False: 19]
  ------------------
 3084|       |        // We do nothing here
 3085|      0|        break;
 3086|     19|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (3086:7): [True: 19, False: 0]
  ------------------
 3087|     19|        _src += context->header_overhead + start * context->typesize;
 3088|     19|        memcpy(_dest, _src, ntbytes);
 3089|     19|        break;
 3090|      0|      default:
  ------------------
  |  Branch (3090:7): [True: 0, False: 19]
  ------------------
 3091|      0|        BLOSC_TRACE_ERROR("Unhandled special value case");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3092|      0|        BLOSC_ERROR(BLOSC2_ERROR_SCHUNK_SPECIAL);
  ------------------
  |  |  115|      0|    do {                                            \
  |  |  116|      0|        int rc_ = (rc);                             \
  |  |  117|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (117:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  118|      0|            char *error_msg = print_error(rc_);     \
  |  |  119|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            return rc_;                             \
  |  |  121|      0|        }                                           \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3093|     19|    }
 3094|     19|    return ntbytes;
 3095|     19|  }
 3096|       |
 3097|      0|  ebsize = header->blocksize + header->typesize * (signed)sizeof(int32_t);
 3098|      0|  struct thread_context* scontext = context->serial_context;
 3099|       |  /* Resize the temporaries in serial context if needed */
 3100|      0|  if (header->blocksize > scontext->tmp_blocksize) {
  ------------------
  |  Branch (3100:7): [True: 0, False: 0]
  ------------------
 3101|      0|    my_free(scontext->tmp);
 3102|      0|    scontext->tmp_nbytes = (size_t)4 * ebsize;
 3103|      0|    scontext->tmp = my_malloc(scontext->tmp_nbytes);
 3104|      0|    BLOSC_ERROR_NULL(scontext->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3105|      0|    scontext->tmp2 = scontext->tmp + ebsize;
 3106|      0|    scontext->tmp3 = scontext->tmp2 + ebsize;
 3107|      0|    scontext->tmp4 = scontext->tmp3 + ebsize;
 3108|      0|    scontext->tmp_blocksize = (int32_t)header->blocksize;
 3109|      0|  }
 3110|       |
 3111|      0|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (3111:15): [True: 0, False: 0]
  ------------------
 3112|      0|    bsize = header->blocksize;
 3113|      0|    leftoverblock = 0;
 3114|      0|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (3114:9): [True: 0, False: 0]
  |  Branch (3114:40): [True: 0, False: 0]
  ------------------
 3115|      0|      bsize = context->leftover;
 3116|      0|      leftoverblock = 1;
 3117|      0|    }
 3118|       |
 3119|       |    /* Compute start & stop for each block */
 3120|      0|    startb = start * header->typesize - j * header->blocksize;
 3121|      0|    stopb = stop * header->typesize - j * header->blocksize;
 3122|      0|    if (stopb <= 0) {
  ------------------
  |  Branch (3122:9): [True: 0, False: 0]
  ------------------
 3123|       |      // We can exit as soon as this block is beyond stop
 3124|      0|      break;
 3125|      0|    }
 3126|      0|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (3126:9): [True: 0, False: 0]
  ------------------
 3127|      0|      continue;
 3128|      0|    }
 3129|      0|    if (startb < 0) {
  ------------------
  |  Branch (3129:9): [True: 0, False: 0]
  ------------------
 3130|      0|      startb = 0;
 3131|      0|    }
 3132|      0|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (3132:9): [True: 0, False: 0]
  ------------------
 3133|      0|      stopb = header->blocksize;
 3134|      0|    }
 3135|      0|    bsize2 = stopb - startb;
 3136|       |
 3137|      0|#if defined(HAVE_PLUGINS)
 3138|      0|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (3138:9): [True: 0, False: 0]
  ------------------
 3139|      0|      scontext->zfp_cell_start = startb / context->typesize;
 3140|      0|      scontext->zfp_cell_nitems = nitems;
 3141|      0|    }
 3142|      0|#endif /* HAVE_PLUGINS */
 3143|       |
 3144|       |    /* Do the actual data copy */
 3145|       |    // Regular decompression.  Put results in tmp2.
 3146|       |    // If the block is aligned and the worst case fits in destination, let's avoid a copy
 3147|      0|    bool get_single_block = ((startb == 0) && (bsize == nitems * header->typesize));
  ------------------
  |  Branch (3147:30): [True: 0, False: 0]
  |  Branch (3147:47): [True: 0, False: 0]
  ------------------
 3148|      0|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (3148:21): [True: 0, False: 0]
  ------------------
 3149|       |
 3150|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 3151|      0|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (3151:26): [True: 0, False: 0]
  ------------------
 3152|      0|      context->header_overhead + j * header->blocksize : sw32_(context->bstarts + j);
 3153|       |
 3154|      0|    int32_t cbytes = blosc_d(context->serial_context, bsize, leftoverblock, memcpyed,
 3155|      0|                             src, srcsize, src_offset, j,
 3156|      0|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 3157|      0|    if (cbytes < 0) {
  ------------------
  |  Branch (3157:9): [True: 0, False: 0]
  ------------------
 3158|      0|      ntbytes = cbytes;
 3159|      0|      break;
 3160|      0|    }
 3161|      0|    if (scontext->zfp_cell_nitems > 0) {
  ------------------
  |  Branch (3161:9): [True: 0, False: 0]
  ------------------
 3162|      0|      if (cbytes == bsize2) {
  ------------------
  |  Branch (3162:11): [True: 0, False: 0]
  ------------------
 3163|      0|        memcpy((uint8_t *) dest, tmp2, (unsigned int) bsize2);
 3164|      0|      } else if (cbytes == context->blocksize) {
  ------------------
  |  Branch (3164:18): [True: 0, False: 0]
  ------------------
 3165|      0|        memcpy((uint8_t *) dest, tmp2 + scontext->zfp_cell_start * context->typesize, (unsigned int) bsize2);
 3166|      0|        cbytes = bsize2;
 3167|      0|      }
 3168|      0|    } else if (!get_single_block) {
  ------------------
  |  Branch (3168:16): [True: 0, False: 0]
  ------------------
 3169|       |      /* Copy to destination */
 3170|      0|      memcpy((uint8_t *) dest + ntbytes, tmp2 + startb, (unsigned int) bsize2);
 3171|      0|    }
 3172|      0|    ntbytes += bsize2;
 3173|      0|  }
 3174|       |
 3175|      0|  scontext->zfp_cell_nitems = 0;
 3176|       |
 3177|      0|  return ntbytes;
 3178|      0|}
blosc2_getitem:
 3180|     19|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 3181|     19|  blosc2_context context;
 3182|     19|  int result;
 3183|       |
 3184|       |  /* Minimally populate the context */
 3185|     19|  memset(&context, 0, sizeof(blosc2_context));
 3186|       |
 3187|     19|  context.schunk = g_schunk;
 3188|     19|  context.nthreads = 1;  // force a serial decompression; fixes #95
 3189|       |
 3190|       |  /* Call the actual getitem function */
 3191|     19|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 3192|       |
 3193|       |  /* Release resources */
 3194|     19|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (3194:7): [True: 19, False: 0]
  ------------------
 3195|     19|    free_thread_context(context.serial_context);
 3196|     19|  }
 3197|     19|  return result;
 3198|     19|}
blosc2_getitem_ctx:
 3207|     19|    int start, int nitems, void* dest, int32_t destsize) {
 3208|     19|  blosc_header header;
 3209|     19|  int result;
 3210|       |
 3211|       |  /* Minimally populate the context */
 3212|     19|  result = read_chunk_header((uint8_t *) src, srcsize, true, &header);
 3213|     19|  if (result < 0) {
  ------------------
  |  Branch (3213:7): [True: 0, False: 19]
  ------------------
 3214|      0|    return result;
 3215|      0|  }
 3216|       |
 3217|     19|  context->src = src;
 3218|     19|  context->srcsize = srcsize;
 3219|     19|  context->dest = dest;
 3220|     19|  context->destsize = destsize;
 3221|       |
 3222|     19|  result = blosc2_initialize_context_from_header(context, &header);
 3223|     19|  if (result < 0) {
  ------------------
  |  Branch (3223:7): [True: 0, False: 19]
  ------------------
 3224|      0|    return result;
 3225|      0|  }
 3226|       |
 3227|     19|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (3227:7): [True: 19, False: 0]
  ------------------
 3228|     19|    context->serial_context = create_thread_context(context, 0);
 3229|     19|  }
 3230|     19|  BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  108|     19|    do {                                            \
  |  |  109|     19|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 19]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3231|       |  /* Call the actual getitem function */
 3232|     19|  result = _blosc_getitem(context, &header, src, srcsize, start, nitems, dest, destsize);
 3233|       |
 3234|     19|  return result;
 3235|     19|}
blosc2_get_nthreads:
 3531|     10|{
 3532|     10|  return g_nthreads;
 3533|     10|}
blosc2_set_nthreads:
 3535|      7|int16_t blosc2_set_nthreads(int16_t nthreads) {
 3536|      7|  int16_t ret = g_nthreads;          /* the previous number of threads */
 3537|       |
 3538|       |  /* Check whether the library should be initialized */
 3539|      7|  if (!g_initlib) blosc2_init();
  ------------------
  |  Branch (3539:7): [True: 0, False: 7]
  ------------------
 3540|       |
 3541|      7| if (nthreads != ret) {
  ------------------
  |  Branch (3541:6): [True: 0, False: 7]
  ------------------
 3542|      0|   g_nthreads = nthreads;
 3543|      0|   g_global_context->new_nthreads = nthreads;
 3544|      0|   int16_t ret2 = check_nthreads(g_global_context);
 3545|      0|   if (ret2 < 0) {
  ------------------
  |  Branch (3545:8): [True: 0, False: 0]
  ------------------
 3546|      0|     return ret2;
 3547|      0|   }
 3548|      0| }
 3549|       |
 3550|      7|  return ret;
 3551|      7|}
blosc2_cbuffer_sizes:
 3670|     85|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 3671|     85|  blosc_header header;
 3672|     85|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 3673|     85|  if (rc < 0) {
  ------------------
  |  Branch (3673:7): [True: 0, False: 85]
  ------------------
 3674|       |    /* Return zeros if error reading header */
 3675|      0|    memset(&header, 0, sizeof(header));
 3676|      0|  }
 3677|       |
 3678|       |  /* Read the interesting values */
 3679|     85|  if (nbytes != NULL)
  ------------------
  |  Branch (3679:7): [True: 70, False: 15]
  ------------------
 3680|     70|    *nbytes = header.nbytes;
 3681|     85|  if (cbytes != NULL)
  ------------------
  |  Branch (3681:7): [True: 85, False: 0]
  ------------------
 3682|     85|    *cbytes = header.cbytes;
 3683|     85|  if (blocksize != NULL)
  ------------------
  |  Branch (3683:7): [True: 19, False: 66]
  ------------------
 3684|     19|    *blocksize = header.blocksize;
 3685|     85|  return rc;
 3686|     85|}
blosc2_init:
 3795|      7|void blosc2_init(void) {
 3796|       |  /* Return if Blosc is already initialized */
 3797|      7|  if (g_initlib) return;
  ------------------
  |  Branch (3797:7): [True: 0, False: 7]
  ------------------
 3798|       |
 3799|      7|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 3800|      7|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 3801|      7|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 3802|      7|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 3803|      7|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 3804|      7|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 3805|      7|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 3806|      7|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 3807|      7|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 3808|      7|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 3809|       |
 3810|      7|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 3811|      7|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 3812|      7|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 3813|      7|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 3814|      7|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 3815|      7|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 3816|      7|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 3817|      7|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 3818|      7|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 3819|      7|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 3820|       |
 3821|      7|  g_ncodecs = 0;
 3822|      7|  g_nfilters = 0;
 3823|      7|  g_ntuners = 0;
 3824|       |
 3825|      7|#if defined(HAVE_PLUGINS)
 3826|      7|  #include "blosc2/blosc2-common.h"
 3827|      7|  #include "blosc2/blosc2-stdio.h"
 3828|      7|  register_codecs();
 3829|      7|  register_filters();
 3830|      7|  register_tuners();
 3831|      7|#endif
 3832|      7|  pthread_mutex_init(&global_comp_mutex, NULL);
 3833|       |  /* Create a global context */
 3834|      7|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 3835|      7|  memset(g_global_context, 0, sizeof(blosc2_context));
 3836|      7|  g_global_context->nthreads = g_nthreads;
 3837|      7|  g_global_context->new_nthreads = g_nthreads;
 3838|      7|  g_initlib = 1;
 3839|      7|}
blosc2_free_resources:
 3842|      7|int blosc2_free_resources(void) {
 3843|       |  /* Return if Blosc is not initialized */
 3844|      7|  if (!g_initlib) return BLOSC2_ERROR_FAILURE;
  ------------------
  |  Branch (3844:7): [True: 0, False: 7]
  ------------------
 3845|       |
 3846|      7|  return release_threadpool(g_global_context);
 3847|      7|}
blosc2_destroy:
 3850|      7|void blosc2_destroy(void) {
 3851|       |  /* Return if Blosc is not initialized */
 3852|      7|  if (!g_initlib) return;
  ------------------
  |  Branch (3852:7): [True: 0, False: 7]
  ------------------
 3853|       |
 3854|      7|  blosc2_free_resources();
 3855|      7|  g_initlib = 0;
 3856|      7|  blosc2_free_ctx(g_global_context);
 3857|       |
 3858|      7|  pthread_mutex_destroy(&global_comp_mutex);
 3859|       |
 3860|      7|}
release_threadpool:
 3863|     28|int release_threadpool(blosc2_context *context) {
 3864|     28|  int32_t t;
 3865|     28|  void* status;
 3866|     28|  int rc;
 3867|       |
 3868|     28|  if (context->threads_started > 0) {
  ------------------
  |  Branch (3868:7): [True: 0, False: 28]
  ------------------
 3869|      0|    if (threads_callback) {
  ------------------
  |  Branch (3869:9): [True: 0, False: 0]
  ------------------
 3870|       |      /* free context data for user-managed threads */
 3871|      0|      for (t=0; t<context->threads_started; t++)
  ------------------
  |  Branch (3871:17): [True: 0, False: 0]
  ------------------
 3872|      0|        destroy_thread_context(context->thread_contexts + t);
 3873|      0|      my_free(context->thread_contexts);
 3874|      0|    }
 3875|      0|    else {
 3876|       |      /* Tell all existing threads to finish */
 3877|      0|      context->end_threads = 1;
 3878|      0|      WAIT_INIT(-1, context);
  ------------------
  |  |  113|      0|  do {                                                                 \
  |  |  114|      0|    rc = pthread_barrier_wait(&(CONTEXT_PTR)->barr_init);              \
  |  |  115|      0|    if (rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) {              \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 0, False: 0]
  |  |  |  Branch (115:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|      BLOSC_TRACE_ERROR("Could not wait on barrier (init): %d", rc);   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|      return((RET_VAL));                                               \
  |  |  118|      0|    }                                                                  \
  |  |  119|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3879|       |
 3880|       |      /* Join exiting threads */
 3881|      0|      for (t = 0; t < context->threads_started; t++) {
  ------------------
  |  Branch (3881:19): [True: 0, False: 0]
  ------------------
 3882|      0|        rc = pthread_join(context->threads[t], &status);
 3883|      0|        if (rc) {
  ------------------
  |  Branch (3883:13): [True: 0, False: 0]
  ------------------
 3884|      0|          BLOSC_TRACE_ERROR("Return code from pthread_join() is %d\n"
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3885|      0|                            "\tError detail: %s.", rc, strerror(rc));
 3886|      0|        }
 3887|      0|      }
 3888|       |
 3889|       |      /* Thread attributes */
 3890|      0|      #if !defined(_WIN32)
 3891|      0|        pthread_attr_destroy(&context->ct_attr);
 3892|      0|      #endif
 3893|       |
 3894|       |      /* Release thread handlers */
 3895|      0|      my_free(context->threads);
 3896|      0|    }
 3897|       |
 3898|       |    /* Release mutex and condition variable objects */
 3899|      0|    pthread_mutex_destroy(&context->count_mutex);
 3900|      0|    pthread_mutex_destroy(&context->delta_mutex);
 3901|      0|    pthread_mutex_destroy(&context->nchunk_mutex);
 3902|      0|    pthread_cond_destroy(&context->delta_cv);
 3903|       |
 3904|       |    /* Barriers */
 3905|      0|  #ifdef BLOSC_POSIX_BARRIERS
 3906|      0|    pthread_barrier_destroy(&context->barr_init);
 3907|      0|    pthread_barrier_destroy(&context->barr_finish);
 3908|       |  #else
 3909|       |    pthread_mutex_destroy(&context->count_threads_mutex);
 3910|       |    pthread_cond_destroy(&context->count_threads_cv);
 3911|       |    context->count_threads = 0;      /* Reset threads counter */
 3912|       |  #endif
 3913|       |
 3914|       |    /* Reset flags and counters */
 3915|      0|    context->end_threads = 0;
 3916|      0|    context->threads_started = 0;
 3917|      0|  }
 3918|       |
 3919|       |
 3920|     28|  return 0;
 3921|     28|}
blosc2_create_cctx:
 3927|      9|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 3928|      9|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 3929|      9|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  108|      9|    do {                                            \
  |  |  109|      9|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3930|       |
 3931|       |  /* Populate the context, using zeros as default values */
 3932|      9|  memset(context, 0, sizeof(blosc2_context));
 3933|      9|  context->do_compress = 1;   /* meant for compression */
 3934|      9|  context->use_dict = cparams.use_dict;
 3935|      9|  if (cparams.instr_codec) {
  ------------------
  |  Branch (3935:7): [True: 0, False: 9]
  ------------------
 3936|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 3937|      0|  }
 3938|       |
 3939|     63|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (3939:19): [True: 54, False: 9]
  ------------------
 3940|     54|    context->filters[i] = cparams.filters[i];
 3941|     54|    context->filters_meta[i] = cparams.filters_meta[i];
 3942|       |
 3943|     54|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (3943:9): [True: 1, False: 53]
  |  Branch (3943:53): [True: 0, False: 1]
  ------------------
 3944|      0|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3945|      0|                        context->filters[i]);
 3946|      0|      free(context);
 3947|      0|      return NULL;
 3948|      0|    }
 3949|     54|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (3949:9): [True: 1, False: 53]
  |  Branch (3949:63): [True: 0, False: 1]
  ------------------
 3950|      0|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3951|      0|                        context->filters[i]);
 3952|      0|      free(context);
 3953|      0|      return NULL;
 3954|      0|    }
 3955|     54|  }
 3956|       |
 3957|      9|#if defined(HAVE_PLUGINS)
 3958|      9|#include "blosc2/codecs-registry.h"
 3959|      9|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (3959:7): [True: 0, False: 9]
  |  Branch (3959:64): [True: 0, False: 0]
  ------------------
 3960|      0|    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (3960:21): [True: 0, False: 0]
  ------------------
 3961|      0|      if ((context->filters[i] == BLOSC_SHUFFLE) || (context->filters[i] == BLOSC_BITSHUFFLE)) {
  ------------------
  |  Branch (3961:11): [True: 0, False: 0]
  |  Branch (3961:53): [True: 0, False: 0]
  ------------------
 3962|      0|        BLOSC_TRACE_ERROR("ZFP cannot be run in presence of SHUFFLE / BITSHUFFLE");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3963|      0|        return NULL;
 3964|      0|      }
 3965|      0|    }
 3966|      0|  }
 3967|      9|#endif /* HAVE_PLUGINS */
 3968|       |
 3969|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 3970|      9|  int doshuffle = -1;
 3971|      9|  char* envvar = getenv("BLOSC_SHUFFLE");
 3972|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (3972:7): [True: 0, False: 9]
  ------------------
 3973|      0|    if (strcmp(envvar, "NOSHUFFLE") == 0) {
  ------------------
  |  Branch (3973:9): [True: 0, False: 0]
  ------------------
 3974|      0|      doshuffle = BLOSC_NOSHUFFLE;
 3975|      0|    }
 3976|      0|    else if (strcmp(envvar, "SHUFFLE") == 0) {
  ------------------
  |  Branch (3976:14): [True: 0, False: 0]
  ------------------
 3977|      0|      doshuffle = BLOSC_SHUFFLE;
 3978|      0|    }
 3979|      0|    else if (strcmp(envvar, "BITSHUFFLE") == 0) {
  ------------------
  |  Branch (3979:14): [True: 0, False: 0]
  ------------------
 3980|      0|      doshuffle = BLOSC_BITSHUFFLE;
 3981|      0|    }
 3982|      0|    else {
 3983|      0|      BLOSC_TRACE_WARNING("BLOSC_SHUFFLE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3984|      0|    }
 3985|      0|  }
 3986|       |  /* Check for a BLOSC_DELTA environment variable */
 3987|      0|  int dodelta = BLOSC_NOFILTER;
 3988|      9|  envvar = getenv("BLOSC_DELTA");
 3989|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (3989:7): [True: 0, False: 9]
  ------------------
 3990|      0|    if (strcmp(envvar, "1") == 0) {
  ------------------
  |  Branch (3990:9): [True: 0, False: 0]
  ------------------
 3991|      0|      dodelta = BLOSC_DELTA;
 3992|      0|    } else if (strcmp(envvar, "0") == 0){
  ------------------
  |  Branch (3992:16): [True: 0, False: 0]
  ------------------
 3993|      0|      dodelta = BLOSC_NOFILTER;
 3994|      0|    }
 3995|      0|    else {
 3996|      0|      BLOSC_TRACE_WARNING("BLOSC_DELTA environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3997|      0|    }
 3998|      0|  }
 3999|       |  /* Check for a BLOSC_TYPESIZE environment variable */
 4000|      0|  context->typesize = cparams.typesize;
 4001|      9|  envvar = getenv("BLOSC_TYPESIZE");
 4002|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4002:7): [True: 0, False: 9]
  ------------------
 4003|      0|    int32_t value;
 4004|      0|    value = (int32_t) strtol(envvar, NULL, 10);
 4005|      0|    if ((errno != EINVAL) && (value > 0)) {
  ------------------
  |  Branch (4005:9): [True: 0, False: 0]
  |  Branch (4005:30): [True: 0, False: 0]
  ------------------
 4006|      0|      context->typesize = value;
 4007|      0|    }
 4008|      0|    else {
 4009|      0|      BLOSC_TRACE_WARNING("BLOSC_TYPESIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4010|      0|    }
 4011|      0|  }
 4012|      0|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 4013|       |
 4014|      9|  context->clevel = cparams.clevel;
 4015|       |  /* Check for a BLOSC_CLEVEL environment variable */
 4016|      9|  envvar = getenv("BLOSC_CLEVEL");
 4017|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4017:7): [True: 0, False: 9]
  ------------------
 4018|      0|    int value;
 4019|      0|    value = (int)strtol(envvar, NULL, 10);
 4020|      0|    if ((errno != EINVAL) && (value >= 0)) {
  ------------------
  |  Branch (4020:9): [True: 0, False: 0]
  |  Branch (4020:30): [True: 0, False: 0]
  ------------------
 4021|      0|      context->clevel = value;
 4022|      0|    }
 4023|      0|    else {
 4024|      0|      BLOSC_TRACE_WARNING("BLOSC_CLEVEL environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4025|      0|    }
 4026|      0|  }
 4027|       |
 4028|      0|  context->compcode = cparams.compcode;
 4029|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 4030|      9|  envvar = getenv("BLOSC_COMPRESSOR");
 4031|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4031:7): [True: 0, False: 9]
  ------------------
 4032|      0|    int codec = blosc2_compname_to_compcode(envvar);
 4033|      0|    if (codec >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (4033:9): [True: 0, False: 0]
  ------------------
 4034|      0|      BLOSC_TRACE_ERROR("User defined codecs cannot be set here. Use Blosc2 mechanism instead.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4035|      0|      return NULL;
 4036|      0|    }
 4037|      0|    context->compcode = codec;
 4038|      0|  }
 4039|      9|  context->compcode_meta = cparams.compcode_meta;
 4040|       |
 4041|      9|  context->blocksize = cparams.blocksize;
 4042|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 4043|      9|  envvar = getenv("BLOSC_BLOCKSIZE");
 4044|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4044:7): [True: 0, False: 9]
  ------------------
 4045|      0|    int32_t blocksize;
 4046|      0|    blocksize = (int32_t) strtol(envvar, NULL, 10);
 4047|      0|    if ((errno != EINVAL) && (blocksize > 0)) {
  ------------------
  |  Branch (4047:9): [True: 0, False: 0]
  |  Branch (4047:30): [True: 0, False: 0]
  ------------------
 4048|      0|      context->blocksize = blocksize;
 4049|      0|    }
 4050|      0|    else {
 4051|      0|      BLOSC_TRACE_WARNING("BLOSC_BLOCKSIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4052|      0|    }
 4053|      0|  }
 4054|       |
 4055|      0|  context->nthreads = cparams.nthreads;
 4056|       |  /* Check for a BLOSC_NTHREADS environment variable */
 4057|      9|  envvar = getenv("BLOSC_NTHREADS");
 4058|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4058:7): [True: 0, False: 9]
  ------------------
 4059|      0|    int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
 4060|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (4060:9): [True: 0, False: 0]
  |  Branch (4060:30): [True: 0, False: 0]
  ------------------
 4061|      0|      context->nthreads = nthreads;
 4062|      0|    }
 4063|      0|    else {
 4064|      0|      BLOSC_TRACE_WARNING("BLOSC_NTHREADS environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4065|      0|    }
 4066|      0|  }
 4067|      0|  context->new_nthreads = context->nthreads;
 4068|       |
 4069|      9|  context->splitmode = cparams.splitmode;
 4070|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 4071|      9|  envvar = getenv("BLOSC_SPLITMODE");
 4072|      9|  if (envvar != NULL) {
  ------------------
  |  Branch (4072:7): [True: 0, False: 9]
  ------------------
 4073|      0|    int32_t splitmode = -1;
 4074|      0|    if (strcmp(envvar, "ALWAYS") == 0) {
  ------------------
  |  Branch (4074:9): [True: 0, False: 0]
  ------------------
 4075|      0|      splitmode = BLOSC_ALWAYS_SPLIT;
 4076|      0|    }
 4077|      0|    else if (strcmp(envvar, "NEVER") == 0) {
  ------------------
  |  Branch (4077:14): [True: 0, False: 0]
  ------------------
 4078|      0|      splitmode = BLOSC_NEVER_SPLIT;
 4079|      0|    }
 4080|      0|    else if (strcmp(envvar, "AUTO") == 0) {
  ------------------
  |  Branch (4080:14): [True: 0, False: 0]
  ------------------
 4081|      0|      splitmode = BLOSC_AUTO_SPLIT;
 4082|      0|    }
 4083|      0|    else if (strcmp(envvar, "FORWARD_COMPAT") == 0) {
  ------------------
  |  Branch (4083:14): [True: 0, False: 0]
  ------------------
 4084|      0|      splitmode = BLOSC_FORWARD_COMPAT_SPLIT;
 4085|      0|    }
 4086|      0|    else {
 4087|      0|      BLOSC_TRACE_WARNING("BLOSC_SPLITMODE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4088|      0|    }
 4089|      0|    if (splitmode >= 0) {
  ------------------
  |  Branch (4089:9): [True: 0, False: 0]
  ------------------
 4090|      0|      context->splitmode = splitmode;
 4091|      0|    }
 4092|      0|  }
 4093|       |
 4094|      0|  context->threads_started = 0;
 4095|      9|  context->schunk = cparams.schunk;
 4096|       |
 4097|      9|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (4097:7): [True: 0, False: 9]
  ------------------
 4098|      0|    context->prefilter = cparams.prefilter;
 4099|      0|    context->preparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params));
 4100|      0|    BLOSC_ERROR_NULL(context->preparams, NULL);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4101|      0|    memcpy(context->preparams, cparams.preparams, sizeof(blosc2_prefilter_params));
 4102|      0|  }
 4103|       |
 4104|      9|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (4104:7): [True: 9, False: 0]
  ------------------
 4105|      9|    cparams.tuner_id = g_tuner;
 4106|      9|  } else {
 4107|      0|    for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (4107:21): [True: 0, False: 0]
  ------------------
 4108|      0|      if (g_tuners[i].id == cparams.tuner_id) {
  ------------------
  |  Branch (4108:11): [True: 0, False: 0]
  ------------------
 4109|      0|        if (g_tuners[i].init == NULL) {
  ------------------
  |  Branch (4109:13): [True: 0, False: 0]
  ------------------
 4110|      0|          if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (4110:15): [True: 0, False: 0]
  ------------------
 4111|      0|            BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4112|      0|            return NULL;
 4113|      0|          }
 4114|      0|        }
 4115|      0|        if (g_tuners[i].init(cparams.tuner_params, context, NULL) < 0) {
  ------------------
  |  Branch (4115:13): [True: 0, False: 0]
  ------------------
 4116|      0|          BLOSC_TRACE_ERROR("Error in user-defined tuner %d init function\n", cparams.tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4117|      0|          return NULL;
 4118|      0|        }
 4119|      0|        goto urtunersuccess;
 4120|      0|      }
 4121|      0|    }
 4122|      0|    BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", cparams.tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4123|      0|    return NULL;
 4124|      0|  }
 4125|      9|  urtunersuccess:;
 4126|       |
 4127|      9|  context->tuner_id = cparams.tuner_id;
 4128|       |
 4129|      9|  context->codec_params = cparams.codec_params;
 4130|      9|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 4131|       |
 4132|      9|  return context;
 4133|      9|}
blosc2_create_dctx:
 4136|      5|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 4137|      5|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 4138|      5|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  108|      5|    do {                                            \
  |  |  109|      5|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 5]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4139|       |
 4140|       |  /* Populate the context, using zeros as default values */
 4141|      5|  memset(context, 0, sizeof(blosc2_context));
 4142|      5|  context->do_compress = 0;   /* Meant for decompression */
 4143|       |
 4144|      5|  context->nthreads = dparams.nthreads;
 4145|      5|  char* envvar = getenv("BLOSC_NTHREADS");
 4146|      5|  if (envvar != NULL) {
  ------------------
  |  Branch (4146:7): [True: 0, False: 5]
  ------------------
 4147|      0|    long nthreads = strtol(envvar, NULL, 10);
 4148|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (4148:9): [True: 0, False: 0]
  |  Branch (4148:30): [True: 0, False: 0]
  ------------------
 4149|      0|      context->nthreads = (int16_t) nthreads;
 4150|      0|    }
 4151|      0|  }
 4152|      5|  context->new_nthreads = context->nthreads;
 4153|       |
 4154|      5|  context->threads_started = 0;
 4155|      5|  context->block_maskout = NULL;
 4156|      5|  context->block_maskout_nitems = 0;
 4157|      5|  context->schunk = dparams.schunk;
 4158|       |
 4159|      5|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (4159:7): [True: 0, False: 5]
  ------------------
 4160|      0|    context->postfilter = dparams.postfilter;
 4161|      0|    context->postparams = (blosc2_postfilter_params*)my_malloc(sizeof(blosc2_postfilter_params));
 4162|      0|    BLOSC_ERROR_NULL(context->postparams, NULL);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4163|      0|    memcpy(context->postparams, dparams.postparams, sizeof(blosc2_postfilter_params));
 4164|      0|  }
 4165|       |
 4166|      5|  return context;
 4167|      5|}
blosc2_free_ctx:
 4170|     21|void blosc2_free_ctx(blosc2_context* context) {
 4171|     21|  release_threadpool(context);
 4172|     21|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (4172:7): [True: 4, False: 17]
  ------------------
 4173|      4|    free_thread_context(context->serial_context);
 4174|      4|  }
 4175|     21|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (4175:7): [True: 0, False: 21]
  ------------------
 4176|      0|#ifdef HAVE_ZSTD
 4177|      0|    ZSTD_freeCDict(context->dict_cdict);
 4178|      0|#endif
 4179|      0|  }
 4180|     21|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (4180:7): [True: 0, False: 21]
  ------------------
 4181|      0|#ifdef HAVE_ZSTD
 4182|      0|    ZSTD_freeDDict(context->dict_ddict);
 4183|      0|#endif
 4184|      0|  }
 4185|     21|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (4185:7): [True: 0, False: 21]
  ------------------
 4186|      0|    int rc;
 4187|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (4187:9): [True: 0, False: 0]
  |  Branch (4187:49): [True: 0, False: 0]
  ------------------
 4188|      0|      rc = blosc_stune_free(context);
 4189|      0|    } else {
 4190|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (4190:23): [True: 0, False: 0]
  ------------------
 4191|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (4191:13): [True: 0, False: 0]
  ------------------
 4192|      0|          if (g_tuners[i].free == NULL) {
  ------------------
  |  Branch (4192:15): [True: 0, False: 0]
  ------------------
 4193|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (4193:17): [True: 0, False: 0]
  ------------------
 4194|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4195|      0|              return;
 4196|      0|            }
 4197|      0|          }
 4198|      0|          rc = g_tuners[i].free(context);
 4199|      0|          goto urtunersuccess;
 4200|      0|        }
 4201|      0|      }
 4202|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4203|      0|      return;
 4204|      0|      urtunersuccess:;
 4205|      0|    }
 4206|      0|    if (rc < 0) {
  ------------------
  |  Branch (4206:9): [True: 0, False: 0]
  ------------------
 4207|      0|      BLOSC_TRACE_ERROR("Error in user-defined tuner free function\n");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4208|      0|      return;
 4209|      0|    }
 4210|      0|  }
 4211|     21|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (4211:7): [True: 0, False: 21]
  ------------------
 4212|      0|    my_free(context->preparams);
 4213|      0|  }
 4214|     21|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (4214:7): [True: 0, False: 21]
  ------------------
 4215|      0|    my_free(context->postparams);
 4216|      0|  }
 4217|       |
 4218|     21|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (4218:7): [True: 0, False: 21]
  ------------------
 4219|      0|    free(context->block_maskout);
 4220|      0|  }
 4221|     21|  my_free(context);
 4222|     21|}
blosc2_chunk_zeros:
 4278|      4|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 4279|      4|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4279:7): [True: 0, False: 4]
  ------------------
 4280|      0|    BLOSC_TRACE_ERROR("dest buffer is not long enough");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4281|      0|    return BLOSC2_ERROR_DATA;
 4282|      0|  }
 4283|       |
 4284|      4|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (4284:7): [True: 0, False: 4]
  ------------------
 4285|      0|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4286|      0|    return BLOSC2_ERROR_DATA;
 4287|      0|  }
 4288|       |
 4289|      4|  blosc_header header;
 4290|      4|  blosc2_context* context = blosc2_create_cctx(cparams);
 4291|      4|  if (context == NULL) {
  ------------------
  |  Branch (4291:7): [True: 0, False: 4]
  ------------------
 4292|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4293|      0|    return BLOSC2_ERROR_NULL_POINTER;
 4294|      0|  }
 4295|       |
 4296|      4|  int error = initialize_context_compression(
 4297|      4|          context, NULL, nbytes, dest, destsize,
 4298|      4|          context->clevel, context->filters, context->filters_meta,
 4299|      4|          context->typesize, context->compcode, context->blocksize,
 4300|      4|          context->new_nthreads, context->nthreads, context->splitmode,
 4301|      4|          context->tuner_id, context->tuner_params, context->schunk);
 4302|      4|  if (error <= 0) {
  ------------------
  |  Branch (4302:7): [True: 0, False: 4]
  ------------------
 4303|      0|    blosc2_free_ctx(context);
 4304|      0|    return error;
 4305|      0|  }
 4306|       |
 4307|      4|  memset(&header, 0, sizeof(header));
 4308|      4|  header.version = BLOSC2_VERSION_FORMAT;
 4309|      4|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 4310|      4|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 4311|      4|  header.typesize = context->typesize;
 4312|      4|  header.nbytes = (int32_t)nbytes;
 4313|      4|  header.blocksize = context->blocksize;
 4314|      4|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4315|      4|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 4316|      4|  memcpy((uint8_t *)dest, &header, sizeof(header));
 4317|       |
 4318|      4|  blosc2_free_ctx(context);
 4319|       |
 4320|      4|  return BLOSC_EXTENDED_HEADER_LENGTH;
 4321|      4|}
register_filter_private:
 4469|     35|int register_filter_private(blosc2_filter *filter) {
 4470|     35|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  108|     35|    do {                                            \
  |  |  109|     35|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 35]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     35|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4471|     35|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (4471:9): [True: 0, False: 35]
  ------------------
 4472|      0|        BLOSC_TRACE_ERROR("Can not register more filters");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4473|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 4474|      0|    }
 4475|     35|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (4475:9): [True: 0, False: 35]
  ------------------
 4476|      0|        BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_FILTERS_START);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4477|      0|        return BLOSC2_ERROR_FAILURE;
 4478|      0|    }
 4479|       |    /* This condition can never be fulfilled
 4480|       |    if (filter->id > BLOSC2_USER_REGISTERED_FILTERS_STOP) {
 4481|       |        BLOSC_TRACE_ERROR("The id must be less than or equal to %d", BLOSC2_USER_REGISTERED_FILTERS_STOP);
 4482|       |        return BLOSC2_ERROR_FAILURE;
 4483|       |    }
 4484|       |    */
 4485|       |
 4486|    105|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (4486:26): [True: 70, False: 35]
  ------------------
 4487|     70|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (4487:11): [True: 0, False: 70]
  ------------------
 4488|      0|        if (strcmp(g_filters[i].name, filter->name) != 0) {
  ------------------
  |  Branch (4488:13): [True: 0, False: 0]
  ------------------
 4489|      0|          BLOSC_TRACE_ERROR("The filter (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4490|      0|                            "  Choose another one !", filter->id, g_filters[i].name);
 4491|      0|          return BLOSC2_ERROR_FAILURE;
 4492|      0|        }
 4493|      0|        else {
 4494|       |          // Already registered, so no more actions needed
 4495|      0|          return BLOSC2_ERROR_SUCCESS;
 4496|      0|        }
 4497|      0|      }
 4498|     70|    }
 4499|       |
 4500|     35|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 4501|     35|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 4502|       |
 4503|     35|    return BLOSC2_ERROR_SUCCESS;
 4504|     35|}
register_codec_private:
 4519|     42|int register_codec_private(blosc2_codec *codec) {
 4520|     42|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  108|     42|    do {                                            \
  |  |  109|     42|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 42]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     42|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4521|     42|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (4521:9): [True: 0, False: 42]
  ------------------
 4522|      0|      BLOSC_TRACE_ERROR("Can not register more codecs");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4523|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 4524|      0|    }
 4525|     42|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (4525:9): [True: 0, False: 42]
  ------------------
 4526|      0|      BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_CODECS_START);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4527|      0|      return BLOSC2_ERROR_FAILURE;
 4528|      0|    }
 4529|       |    /* This condition can never be fulfilled
 4530|       |    if (codec->compcode > BLOSC2_USER_REGISTERED_CODECS_STOP) {
 4531|       |      BLOSC_TRACE_ERROR("The id must be less or equal to %d", BLOSC2_USER_REGISTERED_CODECS_STOP);
 4532|       |      return BLOSC2_ERROR_FAILURE;
 4533|       |    }
 4534|       |     */
 4535|       |
 4536|    147|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (4536:21): [True: 105, False: 42]
  ------------------
 4537|    105|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (4537:11): [True: 0, False: 105]
  ------------------
 4538|      0|        if (strcmp(g_codecs[i].compname, codec->compname) != 0) {
  ------------------
  |  Branch (4538:13): [True: 0, False: 0]
  ------------------
 4539|      0|          BLOSC_TRACE_ERROR("The codec (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4540|      0|                            "  Choose another one !", codec->compcode, codec->compname);
 4541|      0|          return BLOSC2_ERROR_CODEC_PARAM;
 4542|      0|        }
 4543|      0|        else {
 4544|       |          // Already registered, so no more actions needed
 4545|      0|          return BLOSC2_ERROR_SUCCESS;
 4546|      0|        }
 4547|      0|      }
 4548|    105|    }
 4549|       |
 4550|     42|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 4551|     42|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 4552|       |
 4553|     42|    return BLOSC2_ERROR_SUCCESS;
 4554|     42|}
register_tuner_private:
 4569|      7|int register_tuner_private(blosc2_tuner *tuner) {
 4570|      7|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  108|      7|    do {                                            \
  |  |  109|      7|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 7]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      7|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4571|      7|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (4571:7): [True: 0, False: 7]
  ------------------
 4572|      0|    BLOSC_TRACE_ERROR("Can not register more tuners");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4573|      0|    return BLOSC2_ERROR_CODEC_SUPPORT;
 4574|      0|  }
 4575|      7|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (4575:7): [True: 0, False: 7]
  ------------------
 4576|      0|    BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_TUNER_START);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4577|      0|    return BLOSC2_ERROR_FAILURE;
 4578|      0|  }
 4579|       |
 4580|      7|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (4580:19): [True: 0, False: 7]
  ------------------
 4581|      0|    if (g_tuners[i].id == tuner->id) {
  ------------------
  |  Branch (4581:9): [True: 0, False: 0]
  ------------------
 4582|      0|      if (strcmp(g_tuners[i].name, tuner->name) != 0) {
  ------------------
  |  Branch (4582:11): [True: 0, False: 0]
  ------------------
 4583|      0|        BLOSC_TRACE_ERROR("The tuner (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4584|      0|                          "  Choose another one !", tuner->id, g_tuners[i].name);
 4585|      0|        return BLOSC2_ERROR_FAILURE;
 4586|      0|      }
 4587|      0|      else {
 4588|       |        // Already registered, so no more actions needed
 4589|      0|        return BLOSC2_ERROR_SUCCESS;
 4590|      0|      }
 4591|      0|    }
 4592|      0|  }
 4593|       |
 4594|      7|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 4595|      7|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 4596|       |
 4597|      7|  return BLOSC2_ERROR_SUCCESS;
 4598|      7|}
_blosc2_register_io_cb:
 4611|      1|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 4612|       |
 4613|      1|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (4613:24): [True: 0, False: 1]
  ------------------
 4614|      0|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (4614:9): [True: 0, False: 0]
  ------------------
 4615|      0|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (4615:11): [True: 0, False: 0]
  ------------------
 4616|      0|        BLOSC_TRACE_ERROR("The IO (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4617|      0|                          "  Choose another one !", io->id, g_ios[i].name);
 4618|      0|        return BLOSC2_ERROR_PLUGIN_IO;
 4619|      0|      }
 4620|      0|      else {
 4621|       |        // Already registered, so no more actions needed
 4622|      0|        return BLOSC2_ERROR_SUCCESS;
 4623|      0|      }
 4624|      0|    }
 4625|      0|  }
 4626|       |
 4627|      1|  blosc2_io_cb *io_new = &g_ios[g_nio++];
 4628|      1|  memcpy(io_new, io, sizeof(blosc2_io_cb));
 4629|       |
 4630|      1|  return BLOSC2_ERROR_SUCCESS;
 4631|      1|}
blosc2_get_io_cb:
 4648|     56|blosc2_io_cb *blosc2_get_io_cb(uint8_t id) {
 4649|     56|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (4649:24): [True: 55, False: 1]
  ------------------
 4650|     55|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (4650:9): [True: 55, False: 0]
  ------------------
 4651|     55|      return &g_ios[i];
 4652|     55|    }
 4653|     55|  }
 4654|      1|  if (id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (4654:7): [True: 1, False: 0]
  ------------------
 4655|      1|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS) < 0) {
  ------------------
  |  Branch (4655:9): [True: 0, False: 1]
  ------------------
 4656|      0|      BLOSC_TRACE_ERROR("Error registering the default IO API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4657|      0|      return NULL;
 4658|      0|    }
 4659|      1|    return blosc2_get_io_cb(id);
 4660|      1|  }
 4661|      0|  else if (id == BLOSC2_IO_FILESYSTEM_MMAP) {
  ------------------
  |  Branch (4661:12): [True: 0, False: 0]
  ------------------
 4662|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP) < 0) {
  ------------------
  |  Branch (4662:9): [True: 0, False: 0]
  ------------------
 4663|      0|      BLOSC_TRACE_ERROR("Error registering the mmap IO API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4664|      0|      return NULL;
 4665|      0|    }
 4666|      0|    return blosc2_get_io_cb(id);
 4667|      0|  }
 4668|      0|  return NULL;
 4669|      1|}
blosc2.c:flags_to_filters:
  621|     85|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  622|       |  /* Initialize the filter pipeline */
  623|     85|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  624|       |  /* Fill the filter pipeline */
  625|     85|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (625:7): [True: 85, False: 0]
  ------------------
  626|     85|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  627|     85|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (627:7): [True: 85, False: 0]
  ------------------
  628|     85|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  629|     85|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (629:7): [True: 0, False: 85]
  ------------------
  630|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  631|     85|}
blosc2.c:destroy_thread_context:
 2071|     27|static void destroy_thread_context(struct thread_context* thread_context) {
 2072|     27|  my_free(thread_context->tmp);
 2073|     27|#if defined(HAVE_ZSTD)
 2074|     27|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2074:7): [True: 0, False: 27]
  ------------------
 2075|      0|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2076|      0|  }
 2077|     27|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2077:7): [True: 0, False: 27]
  ------------------
 2078|      0|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2079|      0|  }
 2080|     27|#endif
 2081|       |#ifdef HAVE_IPP
 2082|       |  if (thread_context->lz4_hash_table != NULL) {
 2083|       |    ippsFree(thread_context->lz4_hash_table);
 2084|       |  }
 2085|       |#endif
 2086|     27|}
blosc2.c:my_free:
  203|     75|static void my_free(void* block) {
  204|       |#if defined(_WIN32)
  205|       |  _aligned_free(block);
  206|       |#else
  207|     75|  free(block);
  208|     75|#endif  /* _WIN32 */
  209|     75|}
blosc2.c:initialize_context_compression:
 2153|      4|        blosc2_schunk* schunk) {
 2154|       |
 2155|       |  /* Set parameters */
 2156|      4|  context->do_compress = 1;
 2157|      4|  context->src = (const uint8_t*)src;
 2158|      4|  context->srcsize = srcsize;
 2159|      4|  context->dest = (uint8_t*)dest;
 2160|      4|  context->output_bytes = 0;
 2161|      4|  context->destsize = destsize;
 2162|      4|  context->sourcesize = srcsize;
 2163|      4|  context->typesize = (int32_t)typesize;
 2164|      4|  context->filter_flags = filters_to_flags(filters);
 2165|     28|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2165:19): [True: 24, False: 4]
  ------------------
 2166|     24|    context->filters[i] = filters[i];
 2167|     24|    context->filters_meta[i] = filters_meta[i];
 2168|     24|  }
 2169|      4|  context->compcode = compressor;
 2170|      4|  context->nthreads = nthreads;
 2171|      4|  context->new_nthreads = new_nthreads;
 2172|      4|  context->end_threads = 0;
 2173|      4|  context->clevel = clevel;
 2174|      4|  context->schunk = schunk;
 2175|      4|  context->tuner_params = tuner_params;
 2176|      4|  context->tuner_id = tuner_id;
 2177|      4|  context->splitmode = splitmode;
 2178|       |  /* tuner some compression parameters */
 2179|      4|  context->blocksize = (int32_t)blocksize;
 2180|      4|  int rc = 0;
 2181|      4|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2181:7): [True: 0, False: 4]
  ------------------
 2182|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2182:9): [True: 0, False: 0]
  |  Branch (2182:49): [True: 0, False: 0]
  ------------------
 2183|      0|      if (blosc_stune_next_cparams(context) < 0) {
  ------------------
  |  Branch (2183:11): [True: 0, False: 0]
  ------------------
 2184|      0|        BLOSC_TRACE_ERROR("Error in stune next_cparams func\n");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2185|      0|        return BLOSC2_ERROR_TUNER;
 2186|      0|      }
 2187|      0|    } else {
 2188|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2188:23): [True: 0, False: 0]
  ------------------
 2189|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2189:13): [True: 0, False: 0]
  ------------------
 2190|      0|          if (g_tuners[i].next_cparams == NULL) {
  ------------------
  |  Branch (2190:15): [True: 0, False: 0]
  ------------------
 2191|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2191:17): [True: 0, False: 0]
  ------------------
 2192|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2193|      0|              return BLOSC2_ERROR_FAILURE;
 2194|      0|            }
 2195|      0|          }
 2196|      0|          if (g_tuners[i].next_cparams(context) < 0) {
  ------------------
  |  Branch (2196:15): [True: 0, False: 0]
  ------------------
 2197|      0|            BLOSC_TRACE_ERROR("Error in tuner %d next_cparams func\n", context->tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2198|      0|            return BLOSC2_ERROR_TUNER;
 2199|      0|          }
 2200|      0|          if (g_tuners[i].id == BLOSC_BTUNE && context->blocksize == 0) {
  ------------------
  |  Branch (2200:15): [True: 0, False: 0]
  |  Branch (2200:48): [True: 0, False: 0]
  ------------------
 2201|       |            // Call stune for initializing blocksize
 2202|      0|            if (blosc_stune_next_blocksize(context) < 0) {
  ------------------
  |  Branch (2202:17): [True: 0, False: 0]
  ------------------
 2203|      0|              BLOSC_TRACE_ERROR("Error in stune next_blocksize func\n");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2204|      0|              return BLOSC2_ERROR_TUNER;
 2205|      0|            }
 2206|      0|          }
 2207|      0|          goto urtunersuccess;
 2208|      0|        }
 2209|      0|      }
 2210|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2211|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2212|      0|    }
 2213|      4|  } else {
 2214|      4|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      4|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2214:9): [True: 4, False: 0]
  |  Branch (2214:49): [True: 4, False: 0]
  ------------------
 2215|      4|      rc = blosc_stune_next_blocksize(context);
 2216|      4|    } else {
 2217|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2217:23): [True: 0, False: 0]
  ------------------
 2218|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2218:13): [True: 0, False: 0]
  ------------------
 2219|      0|          if (g_tuners[i].next_blocksize == NULL) {
  ------------------
  |  Branch (2219:15): [True: 0, False: 0]
  ------------------
 2220|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2220:17): [True: 0, False: 0]
  ------------------
 2221|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2222|      0|              return BLOSC2_ERROR_FAILURE;
 2223|      0|            }
 2224|      0|          }
 2225|      0|          rc = g_tuners[i].next_blocksize(context);
 2226|      0|          goto urtunersuccess;
 2227|      0|        }
 2228|      0|      }
 2229|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2230|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2231|      0|    }
 2232|      4|  }
 2233|      4|  urtunersuccess:;
 2234|      4|  if (rc < 0) {
  ------------------
  |  Branch (2234:7): [True: 0, False: 4]
  ------------------
 2235|      0|    BLOSC_TRACE_ERROR("Error in tuner next_blocksize func\n");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2236|      0|    return BLOSC2_ERROR_TUNER;
 2237|      0|  }
 2238|       |
 2239|       |
 2240|       |  /* Check buffer size limits */
 2241|      4|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (2241:7): [True: 0, False: 4]
  ------------------
 2242|      0|    BLOSC_TRACE_ERROR("Input buffer size cannot exceed %d bytes.",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2243|      0|                      BLOSC2_MAX_BUFFERSIZE);
 2244|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2245|      0|  }
 2246|       |
 2247|      4|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (2247:7): [True: 0, False: 4]
  ------------------
 2248|      0|    BLOSC_TRACE_ERROR("Output buffer size should be larger than %d bytes.",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2249|      0|                      BLOSC2_MAX_OVERHEAD);
 2250|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2251|      0|  }
 2252|       |
 2253|       |  /* Compression level */
 2254|      4|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (2254:7): [True: 0, False: 4]
  |  Branch (2254:21): [True: 0, False: 4]
  ------------------
 2255|       |    /* If clevel not in 0..9, print an error */
 2256|      0|    BLOSC_TRACE_ERROR("`clevel` parameter must be between 0 and 9!.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2257|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 2258|      0|  }
 2259|       |
 2260|       |  /* Check typesize limits */
 2261|      4|  if (context->typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2261:7): [True: 0, False: 4]
  ------------------
 2262|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2263|      0|    context->typesize = 1;
 2264|      0|  }
 2265|       |
 2266|      4|  blosc2_calculate_blocks(context);
 2267|       |
 2268|      4|  return 1;
 2269|      4|}
blosc2.c:filters_to_flags:
  598|     42|static uint8_t filters_to_flags(const uint8_t* filters) {
  599|     42|  uint8_t flags = 0;
  600|       |
  601|    294|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (601:19): [True: 252, False: 42]
  ------------------
  602|    252|    switch (filters[i]) {
  603|     37|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (603:7): [True: 37, False: 215]
  ------------------
  604|     37|        flags |= BLOSC_DOSHUFFLE;
  605|     37|        break;
  606|      0|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (606:7): [True: 0, False: 252]
  ------------------
  607|      0|        flags |= BLOSC_DOBITSHUFFLE;
  608|      0|        break;
  609|      0|      case BLOSC_DELTA:
  ------------------
  |  Branch (609:7): [True: 0, False: 252]
  ------------------
  610|      0|        flags |= BLOSC_DODELTA;
  611|      0|        break;
  612|    215|      default :
  ------------------
  |  Branch (612:7): [True: 215, False: 37]
  ------------------
  613|    215|        break;
  614|    252|    }
  615|    252|  }
  616|     42|  return flags;
  617|     42|}
blosc2.c:blosc2_calculate_blocks:
  752|     42|static inline void blosc2_calculate_blocks(blosc2_context* context) {
  753|       |  /* Compute number of blocks in buffer */
  754|     42|  context->nblocks = context->sourcesize / context->blocksize;
  755|     42|  context->leftover = context->sourcesize % context->blocksize;
  756|     42|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (756:22): [True: 15, False: 27]
  ------------------
  757|     27|                     (context->nblocks + 1) : context->nblocks;
  758|     42|}
blosc2.c:do_job:
 2115|     19|static int do_job(blosc2_context* context) {
 2116|     19|  int32_t ntbytes;
 2117|       |
 2118|       |  /* Set sentinels */
 2119|     19|  context->dref_not_init = 1;
 2120|       |
 2121|       |  /* Check whether we need to restart threads */
 2122|     19|  check_nthreads(context);
 2123|       |
 2124|       |  /* Run the serial version when nthreads is 1 or when the buffers are
 2125|       |     not larger than blocksize */
 2126|     19|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1) {
  ------------------
  |  Branch (2126:7): [True: 19, False: 0]
  |  Branch (2126:33): [True: 0, False: 0]
  ------------------
 2127|       |    /* The context for this 'thread' has no been initialized yet */
 2128|     19|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2128:9): [True: 4, False: 15]
  ------------------
 2129|      4|      context->serial_context = create_thread_context(context, 0);
 2130|      4|    }
 2131|     15|    else if (context->blocksize != context->serial_context->tmp_blocksize) {
  ------------------
  |  Branch (2131:14): [True: 4, False: 11]
  ------------------
 2132|      4|      free_thread_context(context->serial_context);
 2133|      4|      context->serial_context = create_thread_context(context, 0);
 2134|      4|    }
 2135|     19|    BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  108|     19|    do {                                            \
  |  |  109|     19|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 19]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2136|     19|    ntbytes = serial_blosc(context->serial_context);
 2137|     19|  }
 2138|      0|  else {
 2139|      0|    ntbytes = parallel_blosc(context);
 2140|      0|  }
 2141|       |
 2142|     19|  return ntbytes;
 2143|     19|}
blosc2.c:serial_blosc:
 1921|     19|static int serial_blosc(struct thread_context* thread_context) {
 1922|     19|  blosc2_context* context = thread_context->parent_context;
 1923|     19|  int32_t j, bsize, leftoverblock;
 1924|     19|  int32_t cbytes;
 1925|     19|  int32_t ntbytes = context->output_bytes;
 1926|     19|  int32_t* bstarts = context->bstarts;
 1927|     19|  uint8_t* tmp = thread_context->tmp;
 1928|     19|  uint8_t* tmp2 = thread_context->tmp2;
 1929|     19|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (1929:23): [True: 0, False: 19]
  |  Branch (1929:44): [True: 0, False: 0]
  ------------------
 1930|     19|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 1931|     19|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (1931:7): [True: 19, False: 0]
  |  Branch (1931:32): [True: 4, False: 15]
  ------------------
 1932|       |    // Fake a runlen as if it was a memcpyed chunk
 1933|      4|    memcpyed = true;
 1934|      4|  }
 1935|       |
 1936|     48|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (1936:15): [True: 32, False: 16]
  ------------------
 1937|     32|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (1937:9): [True: 0, False: 32]
  |  Branch (1937:33): [True: 0, False: 0]
  |  Branch (1937:46): [True: 0, False: 0]
  ------------------
 1938|      0|      _sw32(bstarts + j, ntbytes);
 1939|      0|    }
 1940|     32|    bsize = context->blocksize;
 1941|     32|    leftoverblock = 0;
 1942|     32|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (1942:9): [True: 17, False: 15]
  |  Branch (1942:40): [True: 13, False: 4]
  ------------------
 1943|     13|      bsize = context->leftover;
 1944|     13|      leftoverblock = 1;
 1945|     13|    }
 1946|     32|    if (context->do_compress) {
  ------------------
  |  Branch (1946:9): [True: 0, False: 32]
  ------------------
 1947|      0|      if (memcpyed && !context->prefilter) {
  ------------------
  |  Branch (1947:11): [True: 0, False: 0]
  |  Branch (1947:23): [True: 0, False: 0]
  ------------------
 1948|       |        /* We want to memcpy only */
 1949|      0|        memcpy(context->dest + context->header_overhead + j * context->blocksize,
 1950|      0|               context->src + j * context->blocksize, (unsigned int)bsize);
 1951|      0|        cbytes = (int32_t)bsize;
 1952|      0|      }
 1953|      0|      else {
 1954|       |        /* Regular compression */
 1955|      0|        cbytes = blosc_c(thread_context, bsize, leftoverblock, ntbytes,
 1956|      0|                         context->destsize, context->src, j * context->blocksize,
 1957|      0|                         context->dest + ntbytes, tmp, tmp2);
 1958|      0|        if (cbytes == 0) {
  ------------------
  |  Branch (1958:13): [True: 0, False: 0]
  ------------------
 1959|      0|          ntbytes = 0;              /* incompressible data */
 1960|      0|          break;
 1961|      0|        }
 1962|      0|      }
 1963|      0|    }
 1964|     32|    else {
 1965|       |      /* Regular decompression */
 1966|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 1967|     32|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (1967:28): [True: 4, False: 28]
  ------------------
 1968|     28|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 1969|     32|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 1970|     32|                       context->src, context->srcsize, src_offset, j,
 1971|     32|                       context->dest, j * context->blocksize, tmp, tmp2);
 1972|     32|    }
 1973|       |
 1974|     32|    if (cbytes < 0) {
  ------------------
  |  Branch (1974:9): [True: 3, False: 29]
  ------------------
 1975|      3|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 1976|      3|      break;
 1977|      3|    }
 1978|     29|    ntbytes += cbytes;
 1979|     29|  }
 1980|       |
 1981|     19|  return ntbytes;
 1982|     19|}
blosc2.c:blosc_run_decompression_with_context:
 2897|     19|                                                void* dest, int32_t destsize) {
 2898|     19|  blosc_header header;
 2899|     19|  int32_t ntbytes;
 2900|     19|  int rc;
 2901|       |
 2902|     19|  rc = read_chunk_header(src, srcsize, true, &header);
 2903|     19|  if (rc < 0) {
  ------------------
  |  Branch (2903:7): [True: 0, False: 19]
  ------------------
 2904|      0|    return rc;
 2905|      0|  }
 2906|       |
 2907|     19|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (2907:7): [True: 0, False: 19]
  ------------------
 2908|       |    // Not enough space for writing into the destination
 2909|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 2910|      0|  }
 2911|       |
 2912|     19|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 2913|     19|  if (rc < 0) {
  ------------------
  |  Branch (2913:7): [True: 0, False: 19]
  ------------------
 2914|      0|    return rc;
 2915|      0|  }
 2916|       |
 2917|       |  /* Do the actual decompression */
 2918|     19|  ntbytes = do_job(context);
 2919|     19|  if (ntbytes < 0) {
  ------------------
  |  Branch (2919:7): [True: 3, False: 16]
  ------------------
 2920|      3|    return ntbytes;
 2921|      3|  }
 2922|       |
 2923|     16|  assert(ntbytes <= (int32_t)destsize);
 2924|     16|  return ntbytes;
 2925|     19|}
blosc2.c:initialize_context_decompression:
 2273|     19|                                            int32_t srcsize, void* dest, int32_t destsize) {
 2274|     19|  int32_t bstarts_end;
 2275|       |
 2276|     19|  context->do_compress = 0;
 2277|     19|  context->src = (const uint8_t*)src;
 2278|     19|  context->srcsize = srcsize;
 2279|     19|  context->dest = (uint8_t*)dest;
 2280|     19|  context->destsize = destsize;
 2281|     19|  context->output_bytes = 0;
 2282|     19|  context->end_threads = 0;
 2283|       |
 2284|     19|  int rc = blosc2_initialize_context_from_header(context, header);
 2285|     19|  if (rc < 0) {
  ------------------
  |  Branch (2285:7): [True: 0, False: 19]
  ------------------
 2286|      0|    return rc;
 2287|      0|  }
 2288|       |
 2289|       |  /* Check that we have enough space to decompress */
 2290|     19|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (2290:7): [True: 0, False: 19]
  ------------------
 2291|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 2292|      0|  }
 2293|       |
 2294|     19|  if (context->block_maskout != NULL && context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (2294:7): [True: 0, False: 19]
  |  Branch (2294:41): [True: 0, False: 0]
  ------------------
 2295|      0|    BLOSC_TRACE_ERROR("The number of items in block_maskout (%d) must match the number"
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2296|      0|                      " of blocks in chunk (%d).",
 2297|      0|                      context->block_maskout_nitems, context->nblocks);
 2298|      0|    return BLOSC2_ERROR_DATA;
 2299|      0|  }
 2300|       |
 2301|     19|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 2302|     19|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (2302:7): [True: 0, False: 19]
  ------------------
 2303|      0|    BLOSC_TRACE_ERROR("Unknown special values ID (%d) ",
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2304|      0|                      context->special_type);
 2305|      0|    return BLOSC2_ERROR_DATA;
 2306|      0|  }
 2307|       |
 2308|     19|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 2309|     19|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (2309:7): [True: 0, False: 19]
  |  Branch (2309:19): [True: 0, False: 0]
  ------------------
 2310|      0|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed chunk");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2311|      0|    return BLOSC2_ERROR_DATA;
 2312|      0|  }
 2313|       |
 2314|     19|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (2314:7): [True: 0, False: 19]
  |  Branch (2314:32): [True: 0, False: 0]
  ------------------
 2315|     19|      !context->special_type) {
  ------------------
  |  Branch (2315:7): [True: 0, False: 0]
  ------------------
 2316|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 2317|      0|    return 0;
 2318|      0|  }
 2319|       |
 2320|     19|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 2321|     19|  bstarts_end = context->header_overhead;
 2322|     19|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (2322:7): [True: 15, False: 4]
  |  Branch (2322:33): [True: 15, False: 0]
  ------------------
 2323|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 2324|     15|    bstarts_end = (int32_t)(context->header_overhead + (context->nblocks * sizeof(int32_t)));
 2325|     15|  }
 2326|       |
 2327|     19|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (2327:7): [True: 0, False: 19]
  ------------------
 2328|      0|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2329|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2330|      0|  }
 2331|     19|  srcsize -= bstarts_end;
 2332|       |
 2333|       |  /* Read optional dictionary if flag set */
 2334|     19|  if (context->blosc2_flags & BLOSC2_USEDICT) {
  ------------------
  |  Branch (2334:7): [True: 0, False: 19]
  ------------------
 2335|      0|#if defined(HAVE_ZSTD)
 2336|      0|    context->use_dict = 1;
 2337|      0|    if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (2337:9): [True: 0, False: 0]
  ------------------
 2338|       |      // Free the existing dictionary (probably from another chunk)
 2339|      0|      ZSTD_freeDDict(context->dict_ddict);
 2340|      0|    }
 2341|       |    // The trained dictionary is after the bstarts block
 2342|      0|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2342:9): [True: 0, False: 0]
  ------------------
 2343|      0|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2344|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2345|      0|    }
 2346|      0|    srcsize -= sizeof(int32_t);
 2347|       |    // Read dictionary size
 2348|      0|    context->dict_size = sw32_(context->src + bstarts_end);
 2349|      0|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (2349:9): [True: 0, False: 0]
  |  Branch (2349:36): [True: 0, False: 0]
  ------------------
 2350|      0|      BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2351|      0|      return BLOSC2_ERROR_CODEC_DICT;
 2352|      0|    }
 2353|      0|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (2353:9): [True: 0, False: 0]
  ------------------
 2354|      0|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2355|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2356|      0|    }
 2357|      0|    srcsize -= context->dict_size;
 2358|       |    // Read dictionary
 2359|      0|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 2360|      0|    context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 2361|      0|#endif   // HAVE_ZSTD
 2362|      0|  }
 2363|       |
 2364|     19|  return 0;
 2365|     19|}
blosc2.c:my_malloc:
  178|     75|static uint8_t* my_malloc(size_t size) {
  179|     75|  void* block = NULL;
  180|     75|  int res = 0;
  181|       |
  182|       |/* Do an alignment to 32 bytes because AVX2 is supported */
  183|       |#if defined(_WIN32)
  184|       |  /* A (void *) cast needed for avoiding a warning with MINGW :-/ */
  185|       |  block = (void *)_aligned_malloc(size, 32);
  186|       |#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
  187|       |  /* Platform does have an implementation of posix_memalign */
  188|     75|  res = posix_memalign(&block, 32, size);
  189|       |#else
  190|       |  block = malloc(size);
  191|       |#endif  /* _WIN32 */
  192|       |
  193|     75|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (193:7): [True: 0, False: 75]
  |  Branch (193:24): [True: 0, False: 75]
  ------------------
  194|      0|    BLOSC_TRACE_ERROR("Error allocating memory!");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|      0|    return NULL;
  196|      0|  }
  197|       |
  198|     75|  return (uint8_t*)block;
  199|     75|}
blosc2.c:blosc_d:
 1555|     32|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 1556|     32|  blosc2_context* context = thread_context->parent_context;
 1557|     32|  uint8_t* filters = context->filters;
 1558|     32|  uint8_t *tmp3 = thread_context->tmp4;
 1559|     32|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 1560|     32|  int dont_split = (context->header_flags & 0x10) >> 4;
 1561|     32|  int32_t chunk_nbytes;
 1562|     32|  int32_t chunk_cbytes;
 1563|     32|  int nstreams;
 1564|     32|  int32_t neblock;
 1565|     32|  int32_t nbytes;                /* number of decompressed bytes in split */
 1566|     32|  int32_t cbytes;                /* number of compressed bytes in split */
 1567|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 1568|     32|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 1569|     32|  uint8_t* _dest;
 1570|     32|  int32_t typesize = context->typesize;
 1571|     32|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 1572|     32|  const char* compname;
 1573|     32|  int rc;
 1574|       |
 1575|     32|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (1575:7): [True: 0, False: 32]
  |  Branch (1575:41): [True: 0, False: 0]
  ------------------
 1576|       |    // Do not decompress, but act as if we successfully decompressed everything
 1577|      0|    return bsize;
 1578|      0|  }
 1579|       |
 1580|     32|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1581|     32|  if (rc < 0) {
  ------------------
  |  Branch (1581:7): [True: 0, False: 32]
  ------------------
 1582|      0|    return rc;
 1583|      0|  }
 1584|       |
 1585|       |  // In some situations (lazychunks) the context can arrive uninitialized
 1586|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 1587|     32|  if (context->src == NULL) {
  ------------------
  |  Branch (1587:7): [True: 0, False: 32]
  ------------------
 1588|      0|    context->src = src;
 1589|      0|  }
 1590|       |
 1591|       |  // Chunks with special values cannot be lazy
 1592|     32|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (1592:19): [True: 32, False: 0]
  ------------------
 1593|     32|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (1593:11): [True: 0, False: 32]
  |  Branch (1593:46): [True: 0, False: 0]
  ------------------
 1594|     32|  if (is_lazy) {
  ------------------
  |  Branch (1594:7): [True: 0, False: 32]
  ------------------
 1595|       |    // The chunk is on disk, so just lazily load the block
 1596|      0|    if (context->schunk == NULL) {
  ------------------
  |  Branch (1596:9): [True: 0, False: 0]
  ------------------
 1597|      0|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1598|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1599|      0|    }
 1600|      0|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (1600:9): [True: 0, False: 0]
  ------------------
 1601|      0|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1602|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1603|      0|    }
 1604|      0|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 1605|      0|    char* urlpath = frame->urlpath;
 1606|      0|    size_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH + context->nblocks * sizeof(int32_t);
 1607|      0|    int32_t nchunk;
 1608|      0|    int64_t chunk_offset;
 1609|       |    // The nchunk and the offset of the current chunk are in the trailer
 1610|      0|    nchunk = *(int32_t*)(src + trailer_offset);
 1611|      0|    chunk_offset = *(int64_t*)(src + trailer_offset + sizeof(int32_t));
 1612|       |    // Get the csize of the nblock
 1613|      0|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 1614|      0|    int32_t block_csize = block_csizes[nblock];
 1615|       |    // Read the lazy block on disk
 1616|      0|    void* fp = NULL;
 1617|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 1618|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (1618:9): [True: 0, False: 0]
  ------------------
 1619|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1620|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 1621|      0|    }
 1622|       |
 1623|      0|    int64_t io_pos = 0;
 1624|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1624:9): [True: 0, False: 0]
  ------------------
 1625|       |      // The chunk is not in the frame
 1626|      0|      char* chunkpath = malloc(strlen(frame->urlpath) + 1 + 8 + strlen(".chunk") + 1);
 1627|      0|      BLOSC_ERROR_NULL(chunkpath, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1628|      0|      sprintf(chunkpath, "%s/%08X.chunk", frame->urlpath, nchunk);
 1629|      0|      fp = io_cb->open(chunkpath, "rb", context->schunk->storage->io->params);
 1630|      0|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1631|      0|      free(chunkpath);
 1632|       |      // The offset of the block is src_offset
 1633|      0|      io_pos = src_offset;
 1634|      0|    }
 1635|      0|    else {
 1636|      0|      fp = io_cb->open(urlpath, "rb", context->schunk->storage->io->params);
 1637|      0|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  108|      0|    do {                                            \
  |  |  109|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1638|       |      // The offset of the block is src_offset
 1639|      0|      io_pos = frame->file_offset + chunk_offset + src_offset;
 1640|      0|    }
 1641|       |    // We can make use of tmp3 because it will be used after src is not needed anymore
 1642|      0|    int64_t rbytes = io_cb->read((void**)&tmp3, 1, block_csize, io_pos, fp);
 1643|      0|    io_cb->close(fp);
 1644|      0|    if ((int32_t)rbytes != block_csize) {
  ------------------
  |  Branch (1644:9): [True: 0, False: 0]
  ------------------
 1645|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) block out of the fileframe.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1646|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1647|      0|    }
 1648|      0|    src = tmp3;
 1649|      0|    src_offset = 0;
 1650|      0|    srcsize = block_csize;
 1651|      0|  }
 1652|       |
 1653|       |  // If the chunk is memcpyed, we just have to copy the block to dest and return
 1654|     32|  if (memcpyed) {
  ------------------
  |  Branch (1654:7): [True: 4, False: 28]
  ------------------
 1655|      4|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (1655:18): [True: 0, False: 4]
  ------------------
 1656|      4|    if (!context->special_type) {
  ------------------
  |  Branch (1656:9): [True: 0, False: 4]
  ------------------
 1657|      0|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (1657:11): [True: 0, False: 0]
  ------------------
 1658|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 1659|      0|      }
 1660|      0|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (1660:11): [True: 0, False: 0]
  ------------------
 1661|       |        /* Not enough input to copy block */
 1662|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1663|      0|      }
 1664|      0|    }
 1665|      4|    if (!is_lazy) {
  ------------------
  |  Branch (1665:9): [True: 4, False: 0]
  ------------------
 1666|      4|      src += context->header_overhead + nblock * context->blocksize;
 1667|      4|    }
 1668|      4|    _dest = dest + dest_offset;
 1669|      4|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1669:9): [True: 0, False: 4]
  ------------------
 1670|       |      // We are making use of a postfilter, so use a temp for destination
 1671|      0|      _dest = tmp;
 1672|      0|    }
 1673|      4|    rc = 0;
 1674|      4|    switch (context->special_type) {
 1675|      0|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (1675:7): [True: 0, False: 4]
  ------------------
 1676|       |        // All repeated values
 1677|      0|        rc = set_values(context->typesize, context->src, _dest, bsize_);
 1678|      0|        if (rc < 0) {
  ------------------
  |  Branch (1678:13): [True: 0, False: 0]
  ------------------
 1679|      0|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1680|      0|          return BLOSC2_ERROR_DATA;
 1681|      0|        }
 1682|      0|        break;
 1683|      0|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (1683:7): [True: 0, False: 4]
  ------------------
 1684|      0|        rc = set_nans(context->typesize, _dest, bsize_);
 1685|      0|        if (rc < 0) {
  ------------------
  |  Branch (1685:13): [True: 0, False: 0]
  ------------------
 1686|      0|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1687|      0|          return BLOSC2_ERROR_DATA;
 1688|      0|        }
 1689|      0|        break;
 1690|      4|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (1690:7): [True: 4, False: 0]
  ------------------
 1691|      4|        memset(_dest, 0, bsize_);
 1692|      4|        break;
 1693|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (1693:7): [True: 0, False: 4]
  ------------------
 1694|       |        // We do nothing here
 1695|      0|        break;
 1696|      0|      default:
  ------------------
  |  Branch (1696:7): [True: 0, False: 4]
  ------------------
 1697|      0|        memcpy(_dest, src, bsize_);
 1698|      4|    }
 1699|      4|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1699:9): [True: 0, False: 4]
  ------------------
 1700|       |      // Create new postfilter parameters for this block (must be private for each thread)
 1701|      0|      blosc2_postfilter_params postparams;
 1702|      0|      memcpy(&postparams, context->postparams, sizeof(postparams));
 1703|      0|      postparams.input = tmp;
 1704|      0|      postparams.output = dest + dest_offset;
 1705|      0|      postparams.size = bsize;
 1706|      0|      postparams.typesize = typesize;
 1707|      0|      postparams.offset = nblock * context->blocksize;
 1708|      0|      postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1708:27): [True: 0, False: 0]
  ------------------
 1709|      0|      postparams.nblock = nblock;
 1710|      0|      postparams.tid = thread_context->tid;
 1711|      0|      postparams.ttmp = thread_context->tmp;
 1712|      0|      postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1713|      0|      postparams.ctx = context;
 1714|       |
 1715|       |      // Execute the postfilter (the processed block will be copied to dest)
 1716|      0|      if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (1716:11): [True: 0, False: 0]
  ------------------
 1717|      0|        BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1718|      0|        return BLOSC2_ERROR_POSTFILTER;
 1719|      0|      }
 1720|      0|    }
 1721|      4|    thread_context->zfp_cell_nitems = 0;
 1722|       |
 1723|      4|    return bsize_;
 1724|      4|  }
 1725|       |
 1726|     28|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (1726:7): [True: 28, False: 0]
  |  Branch (1726:20): [True: 0, False: 28]
  |  Branch (1726:39): [True: 0, False: 28]
  ------------------
 1727|       |    /* Invalid block src offset encountered */
 1728|      0|    return BLOSC2_ERROR_DATA;
 1729|      0|  }
 1730|       |
 1731|     28|  src += src_offset;
 1732|     28|  srcsize -= src_offset;
 1733|       |
 1734|     28|  int last_filter_index = last_filter(filters, 'd');
 1735|     28|  if (instr_codec) {
  ------------------
  |  Branch (1735:7): [True: 0, False: 28]
  ------------------
 1736|       |    // If instrumented, we don't want to run the filters
 1737|      0|    _dest = dest + dest_offset;
 1738|      0|  }
 1739|     28|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (1739:13): [True: 26, False: 2]
  ------------------
 1740|     28|       (next_filter(filters, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (1740:8): [True: 26, False: 0]
  ------------------
 1741|     28|    context->postfilter != NULL) {
  ------------------
  |  Branch (1741:5): [True: 0, False: 2]
  ------------------
 1742|       |    // We are making use of some filter, so use a temp for destination
 1743|     26|    _dest = tmp;
 1744|     26|  }
 1745|      2|  else {
 1746|       |    // If no filters, or only DELTA in pipeline
 1747|      2|    _dest = dest + dest_offset;
 1748|      2|  }
 1749|       |
 1750|       |  /* The number of compressed data streams for this block */
 1751|     28|  if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (1751:7): [True: 0, False: 28]
  |  Branch (1751:22): [True: 0, False: 0]
  ------------------
 1752|      0|    nstreams = (int32_t)typesize;
 1753|      0|  }
 1754|     28|  else {
 1755|     28|    nstreams = 1;
 1756|     28|  }
 1757|       |
 1758|     28|  neblock = bsize / nstreams;
 1759|     28|  if (neblock == 0) {
  ------------------
  |  Branch (1759:7): [True: 0, False: 28]
  ------------------
 1760|       |    /* Not enough space to output bytes */
 1761|      0|    BLOSC_ERROR(BLOSC2_ERROR_WRITE_BUFFER);
  ------------------
  |  |  115|      0|    do {                                            \
  |  |  116|      0|        int rc_ = (rc);                             \
  |  |  117|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (117:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  118|      0|            char *error_msg = print_error(rc_);     \
  |  |  119|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            return rc_;                             \
  |  |  121|      0|        }                                           \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1762|      0|  }
 1763|     53|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (1763:19): [True: 28, False: 25]
  ------------------
 1764|     28|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (1764:9): [True: 0, False: 28]
  ------------------
 1765|       |      /* Not enough input to read compressed size */
 1766|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1767|      0|    }
 1768|     28|    srcsize -= sizeof(int32_t);
 1769|     28|    cbytes = sw32_(src);      /* amount of compressed bytes */
 1770|     28|    if (cbytes > 0) {
  ------------------
  |  Branch (1770:9): [True: 28, False: 0]
  ------------------
 1771|     28|      if (srcsize < cbytes) {
  ------------------
  |  Branch (1771:11): [True: 0, False: 28]
  ------------------
 1772|       |        /* Not enough input to read compressed bytes */
 1773|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1774|      0|      }
 1775|     28|      srcsize -= cbytes;
 1776|     28|    }
 1777|     28|    src += sizeof(int32_t);
 1778|       |    // ctbytes += (signed)sizeof(int32_t);
 1779|       |
 1780|       |    /* Uncompress */
 1781|     28|    if (cbytes == 0) {
  ------------------
  |  Branch (1781:9): [True: 0, False: 28]
  ------------------
 1782|       |      // A run of 0's
 1783|      0|      memset(_dest, 0, (unsigned int)neblock);
 1784|      0|      nbytes = neblock;
 1785|      0|    }
 1786|     28|    else if (cbytes < 0) {
  ------------------
  |  Branch (1786:14): [True: 0, False: 28]
  ------------------
 1787|       |      // A negative number means some encoding depending on the token that comes next
 1788|      0|      uint8_t token;
 1789|       |
 1790|      0|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (1790:11): [True: 0, False: 0]
  ------------------
 1791|       |        // Not enough input to read token */
 1792|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1793|      0|      }
 1794|      0|      srcsize -= sizeof(uint8_t);
 1795|       |
 1796|      0|      token = src[0];
 1797|      0|      src += 1;
 1798|       |      // ctbytes += 1;
 1799|       |
 1800|      0|      if (token & 0x1) {
  ------------------
  |  Branch (1800:11): [True: 0, False: 0]
  ------------------
 1801|       |        // A run of bytes that are different than 0
 1802|      0|        if (cbytes < -255) {
  ------------------
  |  Branch (1802:13): [True: 0, False: 0]
  ------------------
 1803|       |          // Runs can only encode a byte
 1804|      0|          return BLOSC2_ERROR_RUN_LENGTH;
 1805|      0|        }
 1806|      0|        uint8_t value = -cbytes;
 1807|      0|        memset(_dest, value, (unsigned int)neblock);
 1808|      0|      } else {
 1809|      0|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1810|      0|        return BLOSC2_ERROR_RUN_LENGTH;
 1811|      0|      }
 1812|      0|      nbytes = neblock;
 1813|      0|      cbytes = 0;  // everything is encoded in the cbytes token
 1814|      0|    }
 1815|     28|    else if (cbytes == neblock) {
  ------------------
  |  Branch (1815:14): [True: 0, False: 28]
  ------------------
 1816|      0|      memcpy(_dest, src, (unsigned int)neblock);
 1817|      0|      nbytes = (int32_t)neblock;
 1818|      0|    }
 1819|     28|    else {
 1820|     28|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (1820:11): [True: 0, False: 28]
  ------------------
 1821|      0|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 1822|      0|      }
 1823|     28|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (1823:16): [True: 28, False: 0]
  ------------------
 1824|     28|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 1825|     28|                                     (char*)_dest, (size_t)neblock);
 1826|     28|      }
 1827|      0|  #if defined(HAVE_ZLIB)
 1828|      0|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (1828:16): [True: 0, False: 0]
  ------------------
 1829|      0|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 1830|      0|                                      (char*)_dest, (size_t)neblock);
 1831|      0|      }
 1832|      0|  #endif /*  HAVE_ZLIB */
 1833|      0|  #if defined(HAVE_ZSTD)
 1834|      0|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (1834:16): [True: 0, False: 0]
  ------------------
 1835|      0|        nbytes = zstd_wrap_decompress(thread_context,
 1836|      0|                                      (char*)src, (size_t)cbytes,
 1837|      0|                                      (char*)_dest, (size_t)neblock);
 1838|      0|      }
 1839|      0|  #endif /*  HAVE_ZSTD */
 1840|      0|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1840:16): [True: 0, False: 0]
  ------------------
 1841|      0|        bool getcell = false;
 1842|       |
 1843|      0|#if defined(HAVE_PLUGINS)
 1844|      0|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (1844:13): [True: 0, False: 0]
  ------------------
 1845|      0|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (1845:13): [True: 0, False: 0]
  ------------------
 1846|      0|          nbytes = zfp_getcell(thread_context, src, cbytes, _dest, neblock);
 1847|      0|          if (nbytes < 0) {
  ------------------
  |  Branch (1847:15): [True: 0, False: 0]
  ------------------
 1848|      0|            return BLOSC2_ERROR_DATA;
 1849|      0|          }
 1850|      0|          if (nbytes == thread_context->zfp_cell_nitems * typesize) {
  ------------------
  |  Branch (1850:15): [True: 0, False: 0]
  ------------------
 1851|      0|            getcell = true;
 1852|      0|          }
 1853|      0|        }
 1854|      0|#endif /* HAVE_PLUGINS */
 1855|      0|        if (!getcell) {
  ------------------
  |  Branch (1855:13): [True: 0, False: 0]
  ------------------
 1856|      0|          thread_context->zfp_cell_nitems = 0;
 1857|      0|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (1857:27): [True: 0, False: 0]
  ------------------
 1858|      0|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (1858:17): [True: 0, False: 0]
  ------------------
 1859|      0|              if (g_codecs[i].decoder == NULL) {
  ------------------
  |  Branch (1859:19): [True: 0, False: 0]
  ------------------
 1860|       |                // Dynamically load codec plugin
 1861|      0|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (1861:21): [True: 0, False: 0]
  ------------------
 1862|      0|                  BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1863|      0|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 1864|      0|                }
 1865|      0|              }
 1866|      0|              blosc2_dparams dparams;
 1867|      0|              blosc2_ctx_get_dparams(context, &dparams);
 1868|      0|              nbytes = g_codecs[i].decoder(src,
 1869|      0|                                           cbytes,
 1870|      0|                                           _dest,
 1871|      0|                                           neblock,
 1872|      0|                                           context->compcode_meta,
 1873|      0|                                           &dparams,
 1874|      0|                                           context->src);
 1875|      0|              goto urcodecsuccess;
 1876|      0|            }
 1877|      0|          }
 1878|      0|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", context->compcode);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1879|      0|          return BLOSC2_ERROR_CODEC_SUPPORT;
 1880|      0|        }
 1881|      0|      urcodecsuccess:
 1882|      0|        ;
 1883|      0|      }
 1884|      0|      else {
 1885|      0|        compname = clibcode_to_clibname(compformat);
 1886|      0|        BLOSC_TRACE_ERROR(
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1887|      0|                "Blosc has not been compiled with decompression "
 1888|      0|                "support for '%s' format.  "
 1889|      0|                "Please recompile for adding this support.", compname);
 1890|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 1891|      0|      }
 1892|       |
 1893|       |      /* Check that decompressed bytes number is correct */
 1894|     28|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (1894:11): [True: 3, False: 25]
  |  Branch (1894:34): [True: 3, False: 0]
  ------------------
 1895|      3|        return BLOSC2_ERROR_DATA;
 1896|      3|      }
 1897|       |
 1898|     28|    }
 1899|     25|    src += cbytes;
 1900|       |    // ctbytes += cbytes;
 1901|     25|    _dest += nbytes;
 1902|     25|    ntbytes += nbytes;
 1903|     25|  } /* Closes j < nstreams */
 1904|       |
 1905|     25|  if (!instr_codec) {
  ------------------
  |  Branch (1905:7): [True: 25, False: 0]
  ------------------
 1906|     25|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (1906:9): [True: 23, False: 2]
  |  Branch (1906:35): [True: 0, False: 2]
  ------------------
 1907|       |      /* Apply regular filter pipeline */
 1908|     23|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 1909|     23|                                      last_filter_index, nblock);
 1910|     23|      if (errcode < 0)
  ------------------
  |  Branch (1910:11): [True: 0, False: 23]
  ------------------
 1911|      0|        return errcode;
 1912|     23|    }
 1913|     25|  }
 1914|       |
 1915|       |  /* Return the number of uncompressed bytes */
 1916|     25|  return (int)ntbytes;
 1917|     25|}
blosc2.c:lz4_wrap_decompress:
  434|     28|                               char* output, size_t maxout) {
  435|     28|  int nbytes;
  436|       |#ifdef HAVE_IPP
  437|       |  int outlen = (int)maxout;
  438|       |  int inlen = (int)compressed_length;
  439|       |  IppStatus status;
  440|       |  status = ippsDecodeLZ4_8u((const Ipp8u*)input, inlen, (Ipp8u*)output, &outlen);
  441|       |  //status = ippsDecodeLZ4Dict_8u((const Ipp8u*)input, &inlen, (Ipp8u*)output, 0, &outlen, NULL, 1 << 16);
  442|       |  nbytes = (status == ippStsNoErr) ? outlen : -outlen;
  443|       |#else
  444|     28|  nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  445|     28|#endif
  446|     28|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (446:7): [True: 3, False: 25]
  ------------------
  447|      3|    return 0;
  448|      3|  }
  449|     25|  return (int)maxout;
  450|     28|}
blosc2.c:blosc2_initialize_context_from_header:
  760|     38|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
  761|     38|  context->header_flags = header->flags;
  762|     38|  context->typesize = header->typesize;
  763|     38|  context->sourcesize = header->nbytes;
  764|     38|  context->blocksize = header->blocksize;
  765|     38|  context->blosc2_flags = header->blosc2_flags;
  766|     38|  context->compcode = header->flags >> 5;
  767|     38|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (767:7): [True: 0, False: 38]
  ------------------
  768|      0|    context->compcode = header->udcompcode;
  769|      0|  }
  770|     38|  blosc2_calculate_blocks(context);
  771|       |
  772|     38|  bool is_lazy = false;
  773|     38|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (773:7): [True: 38, False: 0]
  ------------------
  774|     38|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (774:7): [True: 38, False: 0]
  ------------------
  775|       |    /* Extended header */
  776|     38|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
  777|       |
  778|     38|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
  779|     38|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
  780|     38|    context->compcode_meta = header->compcode_meta;
  781|       |
  782|     38|    context->filter_flags = filters_to_flags(header->filters);
  783|     38|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  784|       |
  785|     38|    is_lazy = (context->blosc2_flags & 0x08u);
  786|     38|  }
  787|      0|  else {
  788|      0|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
  789|      0|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
  790|      0|    flags_to_filters(context->header_flags, context->filters);
  791|      0|  }
  792|       |
  793|       |  // Some checks for malformed headers
  794|     38|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (794:7): [True: 38, False: 0]
  |  Branch (794:19): [True: 0, False: 38]
  ------------------
  795|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  796|      0|  }
  797|       |
  798|     38|  return 0;
  799|     38|}
blosc2.c:create_thread_context:
 2059|     27|create_thread_context(blosc2_context* context, int32_t tid) {
 2060|     27|  struct thread_context* thread_context;
 2061|     27|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2062|     27|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  108|     27|    do {                                            \
  |  |  109|     27|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 27]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2063|     27|  int rc = init_thread_context(thread_context, context, tid);
 2064|     27|  if (rc < 0) {
  ------------------
  |  Branch (2064:7): [True: 0, False: 27]
  ------------------
 2065|      0|    return NULL;
 2066|      0|  }
 2067|     27|  return thread_context;
 2068|     27|}
blosc2.c:init_thread_context:
 2018|     27|{
 2019|     27|  int32_t ebsize;
 2020|       |
 2021|     27|  thread_context->parent_context = context;
 2022|     27|  thread_context->tid = tid;
 2023|       |
 2024|     27|  ebsize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 2025|     27|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2026|     27|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2027|     27|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  108|     27|    do {                                            \
  |  |  109|     27|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (109:13): [True: 0, False: 27]
  |  |  ------------------
  |  |  110|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|            return (rc);                            \
  |  |  112|      0|        }                                           \
  |  |  113|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (113:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2028|     27|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2029|     27|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2030|     27|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2031|     27|  thread_context->tmp_blocksize = context->blocksize;
 2032|     27|  thread_context->zfp_cell_nitems = 0;
 2033|     27|  thread_context->zfp_cell_start = 0;
 2034|     27|  #if defined(HAVE_ZSTD)
 2035|     27|  thread_context->zstd_cctx = NULL;
 2036|     27|  thread_context->zstd_dctx = NULL;
 2037|     27|  #endif
 2038|       |
 2039|       |  /* Create the hash table for LZ4 in case we are using IPP */
 2040|       |#ifdef HAVE_IPP
 2041|       |  IppStatus status;
 2042|       |  int inlen = thread_context->tmp_blocksize > 0 ? thread_context->tmp_blocksize : 1 << 16;
 2043|       |  int hash_size = 0;
 2044|       |  status = ippsEncodeLZ4HashTableGetSize_8u(&hash_size);
 2045|       |  if (status != ippStsNoErr) {
 2046|       |      BLOSC_TRACE_ERROR("Error in ippsEncodeLZ4HashTableGetSize_8u.");
 2047|       |  }
 2048|       |  Ipp8u *hash_table = ippsMalloc_8u(hash_size);
 2049|       |  status = ippsEncodeLZ4HashTableInit_8u(hash_table, inlen);
 2050|       |  if (status != ippStsNoErr) {
 2051|       |    BLOSC_TRACE_ERROR("Error in ippsEncodeLZ4HashTableInit_8u.");
 2052|       |  }
 2053|       |  thread_context->lz4_hash_table = hash_table;
 2054|       |#endif
 2055|     27|  return 0;
 2056|     27|}

frame_free:
   50|      5|int frame_free(blosc2_frame_s* frame) {
   51|       |
   52|      5|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (52:7): [True: 5, False: 0]
  |  Branch (52:32): [True: 0, False: 5]
  ------------------
   53|      0|    free(frame->cframe);
   54|      0|  }
   55|       |
   56|      5|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (56:7): [True: 0, False: 5]
  |  Branch (56:34): [True: 0, False: 0]
  ------------------
   57|      0|    free(frame->coffsets);
   58|      0|  }
   59|       |
   60|      5|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (60:7): [True: 0, False: 5]
  ------------------
   61|      0|    free(frame->urlpath);
   62|      0|  }
   63|       |
   64|      5|  free(frame);
   65|       |
   66|      5|  return 0;
   67|      5|}
get_header_info:
  360|     35|                    uint8_t *splitmode, const blosc2_io *io) {
  361|     35|  uint8_t* framep = frame->cframe;
  362|     35|  uint8_t* header_ptr;
  363|     35|  uint8_t header[FRAME_HEADER_MINLEN];
  364|       |
  365|     35|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  366|     35|  if (io_cb == NULL) {
  ------------------
  |  Branch (366:7): [True: 0, False: 35]
  ------------------
  367|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  368|      0|    return BLOSC2_ERROR_PLUGIN_IO;
  369|      0|  }
  370|       |
  371|     35|  if (frame->len <= 0) {
  ------------------
  |  Branch (371:7): [True: 0, False: 35]
  ------------------
  372|      0|    return BLOSC2_ERROR_READ_BUFFER;
  373|      0|  }
  374|       |
  375|     35|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (375:7): [True: 0, False: 35]
  ------------------
  376|      0|    int64_t rbytes = 0;
  377|      0|    void* fp = NULL;
  378|      0|    int64_t io_pos = 0;
  379|      0|    if (frame->sframe) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|      fp = sframe_open_index(frame->urlpath, "rb", io);
  381|      0|      if (fp == NULL) {
  ------------------
  |  Branch (381:11): [True: 0, False: 0]
  ------------------
  382|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  383|      0|        return BLOSC2_ERROR_FILE_OPEN;
  384|      0|      }
  385|      0|    }
  386|      0|    else {
  387|      0|      fp = io_cb->open(frame->urlpath, "rb", io->params);
  388|      0|      if (fp == NULL) {
  ------------------
  |  Branch (388:11): [True: 0, False: 0]
  ------------------
  389|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  390|      0|        return BLOSC2_ERROR_FILE_OPEN;
  391|      0|      }
  392|      0|      io_pos = frame->file_offset;
  393|      0|    }
  394|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (394:9): [True: 0, False: 0]
  ------------------
  395|      0|      header_ptr = header;
  396|      0|    rbytes = io_cb->read((void**)&header_ptr, 1, FRAME_HEADER_MINLEN, io_pos, fp);
  ------------------
  |  |   43|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   40|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   39|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  397|      0|    io_cb->close(fp);
  398|      0|    if (rbytes != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   43|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   40|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   39|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (398:9): [True: 0, False: 0]
  ------------------
  399|      0|      return BLOSC2_ERROR_FILE_READ;
  400|      0|    }
  401|      0|    framep = header_ptr;
  402|      0|  }
  403|       |
  404|       |  // Consistency check for frame type
  405|     35|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   29|     35|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   28|     35|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|     35|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   26|     35|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   25|     35|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  406|     35|  if (frame->sframe) {
  ------------------
  |  Branch (406:7): [True: 0, False: 35]
  ------------------
  407|      0|    if (frame_type != FRAME_DIRECTORY_TYPE) {
  ------------------
  |  |   21|      0|#define FRAME_DIRECTORY_TYPE 1
  ------------------
  |  Branch (407:9): [True: 0, False: 0]
  ------------------
  408|      0|      return BLOSC2_ERROR_FRAME_TYPE;
  409|      0|    }
  410|     35|  } else {
  411|     35|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   20|     35|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (411:9): [True: 0, False: 35]
  ------------------
  412|      0|      return BLOSC2_ERROR_FRAME_TYPE;
  413|      0|    }
  414|     35|  }
  415|       |
  416|       |  // Fetch some internal lengths
  417|     35|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  418|     35|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   43|     35|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   40|     35|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   39|     35|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|     35|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|     35|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   36|     35|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|     35|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|     35|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|     35|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|     35|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|     35|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|     35|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|     35|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|     35|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (418:7): [True: 0, False: 35]
  ------------------
  419|      0|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min allowed.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  420|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  421|      0|  }
  422|     35|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  423|     35|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (423:7): [True: 0, False: 35]
  ------------------
  424|      0|    BLOSC_TRACE_ERROR("Header length exceeds length of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  425|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  426|      0|  }
  427|     35|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  428|     35|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  429|     35|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  430|     35|  if (chunksize != NULL) {
  ------------------
  |  Branch (430:7): [True: 35, False: 0]
  ------------------
  431|     35|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   31|     35|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  432|     35|  }
  433|     35|  if (typesize != NULL) {
  ------------------
  |  Branch (433:7): [True: 25, False: 10]
  ------------------
  434|     25|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   31|     25|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  435|     25|    if (*typesize <= 0) {
  ------------------
  |  Branch (435:9): [True: 0, False: 25]
  ------------------
  436|      0|      BLOSC_TRACE_ERROR("`typesize` cannot be zero or negative.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  437|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  438|      0|    }
  439|     25|  }
  440|       |
  441|       |  // Codecs
  442|     35|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   30|     35|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   28|     35|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|     35|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   26|     35|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   25|     35|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  443|     35|  if (clevel != NULL) {
  ------------------
  |  Branch (443:7): [True: 5, False: 30]
  ------------------
  444|      5|    *clevel = frame_codecs >> 4u;
  445|      5|  }
  446|     35|  if (compcode != NULL) {
  ------------------
  |  Branch (446:7): [True: 5, False: 30]
  ------------------
  447|      5|    *compcode = frame_codecs & 0xFu;
  448|      5|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (448:9): [True: 0, False: 5]
  ------------------
  449|      0|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   31|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  450|      0|    }
  451|      5|  }
  452|       |
  453|       |  // Other flags
  454|     35|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   31|     35|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   28|     35|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   27|     35|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   26|     35|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   25|     35|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  455|     35|  if (splitmode != NULL) {
  ------------------
  |  Branch (455:7): [True: 5, False: 30]
  ------------------
  456|      5|    *splitmode = other_flags & 0x4u;
  457|      5|    from_big(splitmode, framep + FRAME_OTHER_FLAGS, sizeof(*splitmode));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  458|      5|    *splitmode += 1;
  459|      5|  }
  460|       |
  461|     35|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (461:7): [True: 5, False: 30]
  ------------------
  462|      5|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  463|      5|  }
  464|       |
  465|       |  // Filters
  466|     35|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (466:7): [True: 5, False: 30]
  |  Branch (466:26): [True: 5, False: 0]
  ------------------
  467|      5|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   40|      5|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   39|      5|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      5|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   37|      5|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   36|      5|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   35|      5|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      5|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      5|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      5|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      5|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      5|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      5|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  468|      5|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (468:9): [True: 0, False: 5]
  ------------------
  469|      0|      BLOSC_TRACE_ERROR("The number of filters in frame header are too large for Blosc2.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  470|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  471|      0|    }
  472|      5|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   40|      5|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   39|      5|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      5|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   37|      5|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   36|      5|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   35|      5|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      5|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      5|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      5|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      5|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      5|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      5|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  473|      5|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   40|      5|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   39|      5|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      5|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   37|      5|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   36|      5|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   35|      5|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      5|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      5|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      5|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      5|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      5|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      5|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   47|      5|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
  474|     35|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (474:21): [True: 30, False: 5]
  ------------------
  475|     30|      filters[i] = filters_[i];
  476|     30|      filters_meta[i] = filters_meta_[i];
  477|     30|    }
  478|      5|  }
  479|       |
  480|     35|  if (*nbytes > 0 && *chunksize > 0) {
  ------------------
  |  Branch (480:7): [True: 35, False: 0]
  |  Branch (480:22): [True: 35, False: 0]
  ------------------
  481|       |    // We can compute the number of chunks only when the frame has actual data
  482|     35|    *nchunks = *nbytes / *chunksize;
  483|     35|    if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (483:9): [True: 0, False: 35]
  ------------------
  484|      0|      if (*nchunks == INT32_MAX) {
  ------------------
  |  Branch (484:11): [True: 0, False: 0]
  ------------------
  485|      0|        BLOSC_TRACE_ERROR("Number of chunks exceeds maximum allowed.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  486|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  487|      0|      }
  488|      0|      *nchunks += 1;
  489|      0|    }
  490|       |
  491|       |    // Sanity check for compressed sizes
  492|     35|    if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (492:9): [True: 0, False: 35]
  |  Branch (492:26): [True: 0, False: 35]
  ------------------
  493|      0|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  494|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  495|      0|    }
  496|     35|  } else {
  497|      0|    *nchunks = 0;
  498|      0|  }
  499|       |
  500|     35|  return 0;
  501|     35|}
get_trailer_offset:
  504|      5|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
  505|      5|  if (!has_coffsets) {
  ------------------
  |  Branch (505:7): [True: 0, False: 5]
  ------------------
  506|       |    // No data chunks yet
  507|      0|    return header_len;
  508|      0|  }
  509|      5|  return frame->len - frame->trailer_len;
  510|      5|}
frame_from_cframe:
  881|      7|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
  882|       |  // Get the length of the frame
  883|      7|  const uint8_t* header = cframe;
  884|      7|  int64_t frame_len;
  885|      7|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   43|      7|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   40|      7|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   39|      7|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      7|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      7|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   36|      7|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|      7|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      7|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      7|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      7|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      7|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      7|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      7|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      7|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (885:7): [True: 0, False: 7]
  ------------------
  886|      0|    return NULL;
  887|      0|  }
  888|       |
  889|      7|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   31|      7|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  890|      7|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (890:7): [True: 2, False: 5]
  ------------------
  891|      2|    return NULL;
  892|      2|  }
  893|       |
  894|      5|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  895|      5|  frame->len = frame_len;
  896|      5|  frame->file_offset = 0;
  897|       |
  898|       |  // Now, the trailer length
  899|      5|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   52|      5|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  900|      5|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   52|      5|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   53|      5|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
  901|      5|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (901:7): [True: 0, False: 5]
  ------------------
  902|      0|    free(frame);
  903|      0|    return NULL;
  904|      0|  }
  905|      5|  uint32_t trailer_len;
  906|      5|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  907|      5|  frame->trailer_len = trailer_len;
  908|       |
  909|      5|  if (copy) {
  ------------------
  |  Branch (909:7): [True: 0, False: 5]
  ------------------
  910|      0|    frame->cframe = malloc((size_t)len);
  911|      0|    memcpy(frame->cframe, cframe, (size_t)len);
  912|      0|  }
  913|      5|  else {
  914|      5|    frame->cframe = cframe;
  915|      5|    frame->avoid_cframe_free = true;
  916|      5|  }
  917|       |
  918|      5|  return frame;
  919|      5|}
get_coffsets:
 1074|     20|                      int64_t nchunks, int32_t *off_cbytes) {
 1075|     20|  int32_t chunk_cbytes;
 1076|     20|  int rc;
 1077|       |
 1078|     20|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (1078:7): [True: 0, False: 20]
  ------------------
 1079|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (1079:9): [True: 0, False: 0]
  ------------------
 1080|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 1081|      0|      if (rc < 0) {
  ------------------
  |  Branch (1081:11): [True: 0, False: 0]
  ------------------
 1082|      0|        return NULL;
 1083|      0|      }
 1084|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 1085|      0|    }
 1086|      0|    return frame->coffsets;
 1087|      0|  }
 1088|     20|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1088:7): [True: 20, False: 0]
  ------------------
 1089|     20|    int64_t off_pos = header_len;
 1090|     20|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1090:9): [True: 20, False: 0]
  ------------------
 1091|     20|      off_pos += cbytes;
 1092|     20|    }
 1093|       |    // Check that there is enough room to read Blosc header
 1094|     20|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1094:9): [True: 0, False: 20]
  |  Branch (1094:24): [True: 0, False: 20]
  ------------------
 1095|     20|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1095:9): [True: 1, False: 19]
  ------------------
 1096|      1|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   97|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      1|    do {                                            \
  |  |  |  |  102|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1097|      0|      return NULL;
 1098|      1|    }
 1099|       |    // For in-memory frames, the coffset is just one pointer away
 1100|     19|    uint8_t* off_start = frame->cframe + off_pos;
 1101|     19|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (1101:9): [True: 19, False: 0]
  ------------------
 1102|     19|      int32_t chunk_nbytes;
 1103|     19|      int32_t chunk_blocksize;
 1104|     19|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 1105|     19|      if (rc < 0) {
  ------------------
  |  Branch (1105:11): [True: 0, False: 19]
  ------------------
 1106|      0|        return NULL;
 1107|      0|      }
 1108|     19|      *off_cbytes = (int32_t)chunk_cbytes;
 1109|     19|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (1109:11): [True: 0, False: 19]
  |  Branch (1109:30): [True: 0, False: 19]
  ------------------
 1110|      0|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1111|      0|        return NULL;
 1112|      0|      }
 1113|     19|      if ((uint64_t)chunk_nbytes != nchunks * sizeof(int64_t)) {
  ------------------
  |  Branch (1113:11): [True: 0, False: 19]
  ------------------
 1114|      0|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1115|      0|                          "does not match the ones in the header frame.");
 1116|      0|        return NULL;
 1117|      0|      }
 1118|       |
 1119|     19|    }
 1120|     19|    return off_start;
 1121|     19|  }
 1122|       |
 1123|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 1124|       |
 1125|      0|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + FRAME_TRAILER_MINLEN > frame->len) {
  ------------------
  |  |   52|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1125:7): [True: 0, False: 0]
  |  Branch (1125:56): [True: 0, False: 0]
  ------------------
 1126|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1127|      0|    return NULL;
 1128|      0|  }
 1129|       |
 1130|      0|  int32_t coffsets_cbytes;
 1131|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1131:7): [True: 0, False: 0]
  ------------------
 1132|      0|    coffsets_cbytes = (int32_t)(trailer_offset - (header_len + 0));
 1133|      0|  }
 1134|      0|  else {
 1135|      0|    coffsets_cbytes = (int32_t)(trailer_offset - (header_len + cbytes));
 1136|      0|  }
 1137|       |
 1138|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (1138:7): [True: 0, False: 0]
  ------------------
 1139|      0|    *off_cbytes = coffsets_cbytes;
 1140|      0|  }
 1141|       |
 1142|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1143|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1143:7): [True: 0, False: 0]
  ------------------
 1144|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1145|      0|    return NULL;
 1146|      0|  }
 1147|       |
 1148|      0|  void* fp = NULL;
 1149|      0|  uint8_t* coffsets;
 1150|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (1150:7): [True: 0, False: 0]
  ------------------
 1151|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 1152|      0|    frame->coffsets_needs_free = true;
 1153|      0|  }
 1154|      0|  else {
 1155|      0|    frame->coffsets_needs_free = false;
 1156|      0|  }
 1157|       |  
 1158|      0|  int64_t io_pos = 0;
 1159|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1159:7): [True: 0, False: 0]
  ------------------
 1160|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 1161|      0|                           frame->schunk->storage->io);
 1162|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1162:9): [True: 0, False: 0]
  ------------------
 1163|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1164|      0|      return NULL;
 1165|      0|    }
 1166|      0|    io_pos = header_len + 0;
 1167|      0|  }
 1168|      0|  else {
 1169|      0|    fp = io_cb->open(frame->urlpath, "rb", frame->schunk->storage->io->params);
 1170|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1170:9): [True: 0, False: 0]
  ------------------
 1171|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1172|      0|      return NULL;
 1173|      0|    }
 1174|      0|    io_pos = frame->file_offset + header_len + cbytes;
 1175|      0|  }
 1176|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 1177|      0|  io_cb->close(fp);
 1178|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (1178:7): [True: 0, False: 0]
  ------------------
 1179|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets out of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1180|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (1180:9): [True: 0, False: 0]
  ------------------
 1181|      0|      free(coffsets);
 1182|      0|    return NULL;
 1183|      0|  }
 1184|      0|  frame->coffsets = coffsets;
 1185|      0|  return coffsets;
 1186|      0|}
frame_get_metalayers:
 1451|      5|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 1452|      5|  int32_t header_len;
 1453|      5|  int64_t frame_len;
 1454|      5|  int64_t nbytes;
 1455|      5|  int64_t cbytes;
 1456|      5|  int32_t blocksize;
 1457|      5|  int32_t chunksize;
 1458|      5|  int64_t nchunks;
 1459|      5|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 1460|      5|                            &blocksize, &chunksize, &nchunks,
 1461|      5|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 1462|      5|                            schunk->storage->io);
 1463|      5|  if (ret < 0) {
  ------------------
  |  Branch (1463:7): [True: 0, False: 5]
  ------------------
 1464|      0|    BLOSC_TRACE_ERROR("Unable to get the header info from frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1465|      0|    return ret;
 1466|      0|  }
 1467|       |
 1468|       |  // Get the header
 1469|      5|  uint8_t* header = NULL;
 1470|      5|  bool needs_free = false;
 1471|      5|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1471:7): [True: 5, False: 0]
  ------------------
 1472|      5|    header = frame->cframe;
 1473|      5|  } else {
 1474|      0|    int64_t rbytes = 0;
 1475|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1476|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (1476:9): [True: 0, False: 0]
  ------------------
 1477|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1478|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 1479|      0|    }
 1480|       |
 1481|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (1481:9): [True: 0, False: 0]
  ------------------
 1482|      0|      header = malloc(header_len);
 1483|      0|      needs_free = true;
 1484|      0|    }
 1485|      0|    else {
 1486|      0|      needs_free = false;
 1487|      0|    }
 1488|       |
 1489|      0|    void* fp = NULL;
 1490|      0|    int64_t io_pos = 0;
 1491|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1491:9): [True: 0, False: 0]
  ------------------
 1492|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 1493|      0|                             frame->schunk->storage->io);
 1494|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1494:11): [True: 0, False: 0]
  ------------------
 1495|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1496|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1497|      0|      }
 1498|      0|    }
 1499|      0|    else {
 1500|      0|      fp = io_cb->open(frame->urlpath, "rb", frame->schunk->storage->io->params);
 1501|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1501:11): [True: 0, False: 0]
  ------------------
 1502|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1503|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1504|      0|      }
 1505|      0|      io_pos = frame->file_offset;
 1506|      0|    }
 1507|      0|    if (fp != NULL) {
  ------------------
  |  Branch (1507:9): [True: 0, False: 0]
  ------------------
 1508|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 1509|      0|      io_cb->close(fp);
 1510|      0|    }
 1511|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (1511:9): [True: 0, False: 0]
  ------------------
 1512|      0|      BLOSC_TRACE_ERROR("Cannot access the header out of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1513|      0|      if (needs_free)
  ------------------
  |  Branch (1513:11): [True: 0, False: 0]
  ------------------
 1514|      0|        free(header);
 1515|      0|      return BLOSC2_ERROR_FILE_READ;
 1516|      0|    }
 1517|      0|  }
 1518|       |
 1519|      5|  ret = get_meta_from_header(frame, schunk, header, header_len);
 1520|       |
 1521|      5|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (1521:7): [True: 0, False: 5]
  |  Branch (1521:32): [True: 0, False: 0]
  ------------------
 1522|      0|    free(header);
 1523|      0|  }
 1524|       |
 1525|      5|  return ret;
 1526|      5|}
frame_get_vlmetalayers:
 1640|      5|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 1641|      5|  int32_t header_len;
 1642|      5|  int64_t frame_len;
 1643|      5|  int64_t nbytes;
 1644|      5|  int64_t cbytes;
 1645|      5|  int32_t blocksize;
 1646|      5|  int32_t chunksize;
 1647|      5|  int64_t nchunks;
 1648|      5|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 1649|      5|                            &blocksize, &chunksize, &nchunks,
 1650|      5|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 1651|      5|                            schunk->storage->io);
 1652|      5|  if (ret < 0) {
  ------------------
  |  Branch (1652:7): [True: 0, False: 5]
  ------------------
 1653|      0|    BLOSC_TRACE_ERROR("Unable to get the trailer info from frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1654|      0|    return ret;
 1655|      0|  }
 1656|       |
 1657|      5|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 1658|      5|  int32_t trailer_len = (int32_t) frame->trailer_len;
 1659|       |
 1660|      5|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (1660:7): [True: 0, False: 5]
  |  Branch (1660:56): [True: 0, False: 5]
  ------------------
 1661|      0|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1662|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1663|      0|  }
 1664|       |
 1665|       |  // Get the trailer
 1666|      5|  uint8_t* trailer = NULL;
 1667|      5|  bool needs_free = false;
 1668|      5|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1668:7): [True: 5, False: 0]
  ------------------
 1669|      5|    trailer = frame->cframe + trailer_offset;
 1670|      5|  } else {
 1671|      0|    int64_t rbytes = 0;
 1672|       |
 1673|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1674|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (1674:9): [True: 0, False: 0]
  ------------------
 1675|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1676|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 1677|      0|    }
 1678|       |
 1679|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (1679:9): [True: 0, False: 0]
  ------------------
 1680|      0|      trailer = malloc(trailer_len);
 1681|      0|      needs_free = true;
 1682|      0|    }
 1683|      0|    else {
 1684|      0|      needs_free = false;
 1685|      0|    }
 1686|       |
 1687|      0|    void* fp = NULL;
 1688|      0|    int64_t io_pos = 0;
 1689|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1689:9): [True: 0, False: 0]
  ------------------
 1690|      0|      char* eframe_name = malloc(strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1);
 1691|      0|      sprintf(eframe_name, "%s/chunks.b2frame", frame->urlpath);
 1692|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 1693|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1693:11): [True: 0, False: 0]
  ------------------
 1694|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", eframe_name);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1695|      0|        free(eframe_name);
 1696|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1697|      0|      }
 1698|      0|      free(eframe_name);
 1699|      0|      io_pos = trailer_offset;
 1700|      0|    }
 1701|      0|    else {
 1702|      0|      fp = io_cb->open(frame->urlpath, "rb", frame->schunk->storage->io->params);
 1703|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1703:11): [True: 0, False: 0]
  ------------------
 1704|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1705|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1706|      0|      }
 1707|      0|      io_pos = frame->file_offset + trailer_offset;
 1708|      0|    }
 1709|      0|    if (fp != NULL) {
  ------------------
  |  Branch (1709:9): [True: 0, False: 0]
  ------------------
 1710|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 1711|      0|      io_cb->close(fp);
 1712|      0|    }
 1713|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (1713:9): [True: 0, False: 0]
  ------------------
 1714|      0|      BLOSC_TRACE_ERROR("Cannot access the trailer out of the fileframe.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1715|      0|      if (needs_free)
  ------------------
  |  Branch (1715:11): [True: 0, False: 0]
  ------------------
 1716|      0|        free(trailer);
 1717|      0|      return BLOSC2_ERROR_FILE_READ;
 1718|      0|    }
 1719|      0|  }
 1720|       |
 1721|      5|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 1722|       |
 1723|      5|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (1723:7): [True: 0, False: 5]
  |  Branch (1723:32): [True: 0, False: 0]
  ------------------
 1724|      0|    free(trailer);
 1725|      0|  }
 1726|       |
 1727|      5|  return ret;
 1728|      5|}
get_new_storage:
 1734|      5|                                const blosc2_io* iodefaults) {
 1735|       |
 1736|      5|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 1737|      5|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 1738|      5|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (1738:7): [True: 0, False: 5]
  ------------------
 1739|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 1740|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 1741|      0|    strcpy(new_storage->urlpath, urlpath);
 1742|      0|  }
 1743|       |
 1744|       |  // cparams
 1745|      5|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 1746|      5|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (1746:7): [True: 0, False: 5]
  ------------------
 1747|      0|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 1748|      5|  } else {
 1749|      5|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 1750|      5|  }
 1751|      5|  new_storage->cparams = cparams;
 1752|       |
 1753|       |  // dparams
 1754|      5|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 1755|      5|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (1755:7): [True: 0, False: 5]
  ------------------
 1756|      0|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 1757|      0|  }
 1758|      5|  else {
 1759|      5|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 1760|      5|  }
 1761|      5|  new_storage->dparams = dparams;
 1762|       |
 1763|       |  // iodefaults
 1764|      5|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 1765|      5|  if (storage->io != NULL) {
  ------------------
  |  Branch (1765:7): [True: 0, False: 5]
  ------------------
 1766|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 1767|      0|  }
 1768|      5|  else {
 1769|      5|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 1770|      5|  }
 1771|      5|  new_storage->io = udio;
 1772|       |
 1773|      5|  return new_storage;
 1774|      5|}
frame_to_schunk:
 1778|      5|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 1779|      5|  int32_t header_len;
 1780|      5|  int64_t frame_len;
 1781|      5|  int rc;
 1782|      5|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 1783|      5|  schunk->frame = (blosc2_frame*)frame;
 1784|      5|  frame->schunk = schunk;
 1785|       |
 1786|      5|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 1787|      5|                       &schunk->cbytes, &schunk->blocksize,
 1788|      5|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 1789|      5|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 1790|      5|                       schunk->filters_meta, &schunk->splitmode, udio);
 1791|      5|  if (rc < 0) {
  ------------------
  |  Branch (1791:7): [True: 0, False: 5]
  ------------------
 1792|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1793|      0|    blosc2_schunk_free(schunk);
 1794|      0|    return NULL;
 1795|      0|  }
 1796|      5|  int64_t nchunks = schunk->nchunks;
 1797|      5|  int64_t nbytes = schunk->nbytes;
 1798|      5|  (void) nbytes;
 1799|      5|  int64_t cbytes = schunk->cbytes;
 1800|       |
 1801|       |  // Compression and decompression contexts
 1802|      5|  blosc2_cparams *cparams;
 1803|      5|  blosc2_schunk_get_cparams(schunk, &cparams);
 1804|      5|  schunk->cctx = blosc2_create_cctx(*cparams);
 1805|      5|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (1805:7): [True: 0, False: 5]
  ------------------
 1806|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1807|      0|    return NULL;
 1808|      0|  }
 1809|      5|  blosc2_dparams *dparams;
 1810|      5|  blosc2_schunk_get_dparams(schunk, &dparams);
 1811|      5|  schunk->dctx = blosc2_create_dctx(*dparams);
 1812|      5|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (1812:7): [True: 0, False: 5]
  ------------------
 1813|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1814|      0|    return NULL;
 1815|      0|  }
 1816|      5|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (1816:43): [True: 0, False: 5]
  ------------------
 1817|      5|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 1818|      5|  free(cparams);
 1819|      5|  free(dparams);
 1820|      5|  if (!copy) {
  ------------------
  |  Branch (1820:7): [True: 5, False: 0]
  ------------------
 1821|      5|    goto out;
 1822|      5|  }
 1823|       |
 1824|       |  // We are not attached to a frame anymore
 1825|      0|  schunk->frame = NULL;
 1826|       |
 1827|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (1827:7): [True: 0, False: 0]
  ------------------
 1828|      0|    frame->schunk = NULL;
 1829|      0|    goto out;
 1830|      0|  }
 1831|       |
 1832|       |  // Get the compressed offsets
 1833|      0|  int32_t coffsets_cbytes = 0;
 1834|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 1835|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (1835:7): [True: 0, False: 0]
  ------------------
 1836|      0|    blosc2_schunk_free(schunk);
 1837|      0|    BLOSC_TRACE_ERROR("Cannot get the offsets for the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1838|      0|    return NULL;
 1839|      0|  }
 1840|       |
 1841|       |  // Decompress offsets
 1842|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 1843|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 1844|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (1844:7): [True: 0, False: 0]
  ------------------
 1845|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1846|      0|    return NULL;
 1847|      0|  }
 1848|      0|  int64_t* offsets = (int64_t *) malloc((size_t)nchunks * sizeof(int64_t));
 1849|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 1850|      0|                                             offsets, (int32_t)(nchunks * sizeof(int64_t)));
 1851|      0|  blosc2_free_ctx(dctx);
 1852|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (1852:7): [True: 0, False: 0]
  ------------------
 1853|      0|    free(offsets);
 1854|      0|    blosc2_schunk_free(schunk);
 1855|      0|    BLOSC_TRACE_ERROR("Cannot decompress the offsets chunk.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1856|      0|    return NULL;
 1857|      0|  }
 1858|       |
 1859|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 1860|       |  // get a guess at the blocksize used in this frame)
 1861|      0|  int64_t acc_nbytes = 0;
 1862|      0|  int64_t acc_cbytes = 0;
 1863|      0|  int32_t blocksize = 0;
 1864|      0|  int32_t chunk_nbytes;
 1865|      0|  int32_t chunk_cbytes;
 1866|      0|  int32_t chunk_blocksize;
 1867|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 1868|      0|  uint8_t* data_chunk = NULL;
 1869|      0|  bool needs_free = false;
 1870|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 1871|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1871:7): [True: 0, False: 0]
  ------------------
 1872|      0|    blosc2_schunk_free(schunk);
 1873|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1874|      0|    return NULL;
 1875|      0|  }
 1876|       |
 1877|      0|  void* fp = NULL;
 1878|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (1878:7): [True: 0, False: 0]
  ------------------
 1879|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (1879:9): [True: 0, False: 0]
  ------------------
 1880|      0|      data_chunk = malloc((size_t)prev_alloc);
 1881|      0|      needs_free = true;
 1882|      0|    }
 1883|      0|    else {
 1884|      0|      needs_free = false;
 1885|      0|    }
 1886|       |    
 1887|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (1887:9): [True: 0, False: 0]
  ------------------
 1888|       |      // If not the chunks won't be in the frame
 1889|      0|      fp = io_cb->open(frame->urlpath, "rb", udio->params);
 1890|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1890:11): [True: 0, False: 0]
  ------------------
 1891|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1892|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 1893|      0|        goto end;
 1894|      0|      }
 1895|      0|    }
 1896|      0|  }
 1897|      0|  schunk->data = malloc(nchunks * sizeof(void*));
 1898|      0|  for (int i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (1898:19): [True: 0, False: 0]
  ------------------
 1899|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (1899:9): [True: 0, False: 0]
  ------------------
 1900|      0|      if (needs_free) {
  ------------------
  |  Branch (1900:11): [True: 0, False: 0]
  ------------------
 1901|      0|        free(data_chunk);
 1902|      0|      }
 1903|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (1903:11): [True: 0, False: 0]
  ------------------
 1904|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 1905|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (1905:13): [True: 0, False: 0]
  ------------------
 1906|      0|          break;
 1907|      0|        }
 1908|      0|      }
 1909|      0|      else {
 1910|      0|       data_chunk = frame->cframe + header_len + offsets[i];
 1911|      0|      }
 1912|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 1913|      0|      if (rc < 0) {
  ------------------
  |  Branch (1913:11): [True: 0, False: 0]
  ------------------
 1914|      0|        break;
 1915|      0|      }
 1916|      0|    }
 1917|      0|    else {
 1918|      0|      int64_t rbytes;
 1919|      0|      if (frame->sframe) {
  ------------------
  |  Branch (1919:11): [True: 0, False: 0]
  ------------------
 1920|      0|        if (needs_free) {
  ------------------
  |  Branch (1920:13): [True: 0, False: 0]
  ------------------
 1921|      0|          free(data_chunk);
 1922|      0|        }
 1923|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 1924|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (1924:13): [True: 0, False: 0]
  ------------------
 1925|      0|          break;
 1926|      0|        }
 1927|      0|      }
 1928|      0|      else {
 1929|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 1930|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 1931|      0|      }
 1932|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1932:11): [True: 0, False: 0]
  ------------------
 1933|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 1934|      0|        break;
 1935|      0|      }
 1936|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 1937|      0|      if (rc < 0) {
  ------------------
  |  Branch (1937:11): [True: 0, False: 0]
  ------------------
 1938|      0|        break;
 1939|      0|      }
 1940|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (1940:11): [True: 0, False: 0]
  ------------------
 1941|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (1941:13): [True: 0, False: 0]
  ------------------
 1942|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 1943|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (1943:13): [True: 0, False: 0]
  ------------------
 1944|      0|          BLOSC_TRACE_ERROR("Cannot realloc space for the data_chunk.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1945|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1946|      0|          break;
 1947|      0|        }
 1948|      0|        prev_alloc = chunk_cbytes;
 1949|      0|      }
 1950|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (1950:11): [True: 0, False: 0]
  ------------------
 1951|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 1952|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 1953|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (1953:13): [True: 0, False: 0]
  ------------------
 1954|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 1955|      0|          break;
 1956|      0|        }
 1957|      0|      }
 1958|      0|    }
 1959|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 1960|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 1961|      0|    schunk->data[i] = new_chunk;
 1962|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 1963|      0|    if (rc < 0) {
  ------------------
  |  Branch (1963:9): [True: 0, False: 0]
  ------------------
 1964|      0|      break;
 1965|      0|    }
 1966|      0|    acc_nbytes += chunk_nbytes;
 1967|      0|    acc_cbytes += chunk_cbytes;
 1968|      0|    if (i == 0) {
  ------------------
  |  Branch (1968:9): [True: 0, False: 0]
  ------------------
 1969|      0|      blocksize = chunk_blocksize;
 1970|      0|    }
 1971|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (1971:14): [True: 0, False: 0]
  ------------------
 1972|       |      // Blocksize varies
 1973|      0|      blocksize = 0;
 1974|      0|    }
 1975|      0|  }
 1976|       |
 1977|       |  // We are not attached to a schunk anymore
 1978|      0|  frame->schunk = NULL;
 1979|       |
 1980|      0|  end:
 1981|      0|  if (needs_free) {
  ------------------
  |  Branch (1981:7): [True: 0, False: 0]
  ------------------
 1982|      0|    free(data_chunk);
 1983|      0|  }
 1984|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (1984:7): [True: 0, False: 0]
  ------------------
 1985|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (1985:9): [True: 0, False: 0]
  ------------------
 1986|      0|      io_cb->close(fp);
 1987|      0|    }
 1988|      0|  }
 1989|      0|  free(offsets);
 1990|       |
 1991|       |  // cframes and sframes have different ways to store chunks with special values:
 1992|       |  // 1) cframes represent special chunks as negative offsets
 1993|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 1994|       |  //    so they always have a pointer to a special chunk
 1995|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 1996|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 1997|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 1998|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (1998:7): [True: 0, False: 0]
  |  Branch (1998:17): [True: 0, False: 0]
  ------------------
 1999|      0|    blosc2_schunk_free(schunk);
 2000|      0|    return NULL;
 2001|      0|  }
 2002|       |  // Update counters
 2003|      0|  schunk->cbytes = acc_cbytes;
 2004|      0|  schunk->blocksize = blocksize;
 2005|       |
 2006|      5|  out:
 2007|      5|  rc = frame_get_metalayers(frame, schunk);
 2008|      5|  if (rc < 0) {
  ------------------
  |  Branch (2008:7): [True: 0, False: 5]
  ------------------
 2009|      0|    blosc2_schunk_free(schunk);
 2010|      0|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2011|      0|    return NULL;
 2012|      0|  }
 2013|       |
 2014|      5|  rc = frame_get_vlmetalayers(frame, schunk);
 2015|      5|  if (rc < 0) {
  ------------------
  |  Branch (2015:7): [True: 0, False: 5]
  ------------------
 2016|      0|    blosc2_schunk_free(schunk);
 2017|      0|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2018|      0|    return NULL;
 2019|      0|  }
 2020|       |
 2021|      5|  return schunk;
 2022|      5|}
get_coffset:
 2044|     20|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 2045|     20|  int32_t off_cbytes;
 2046|       |  // Get the offset to nchunk
 2047|     20|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 2048|     20|  if (coffsets == NULL) {
  ------------------
  |  Branch (2048:7): [True: 1, False: 19]
  ------------------
 2049|      1|    BLOSC_TRACE_ERROR("Cannot get the offset for chunk %" PRId64 " for the frame.", nchunk);
  ------------------
  |  |   97|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      1|    do {                                            \
  |  |  |  |  102|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2050|      0|    return BLOSC2_ERROR_DATA;
 2051|      1|  }
 2052|       |
 2053|       |  // Get the 64-bit offset
 2054|     19|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 2055|     19|  if (rc < 0) {
  ------------------
  |  Branch (2055:7): [True: 0, False: 19]
  ------------------
 2056|      0|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2057|     19|  } else if (!frame->sframe && *offset > frame->len) {
  ------------------
  |  Branch (2057:14): [True: 19, False: 0]
  |  Branch (2057:32): [True: 0, False: 19]
  ------------------
 2058|      0|    BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2059|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 2060|      0|  }
 2061|       |
 2062|      0|  return rc;
 2063|     20|}
frame_special_chunk:
 2068|      4|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 2069|      4|  int rc = 0;
 2070|      4|  *chunk = malloc(cbytes);
 2071|      4|  *needs_free = true;
 2072|       |
 2073|       |  // Detect the kind of special value
 2074|      4|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 2075|      4|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 2076|      4|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 2077|       |
 2078|      4|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 2079|      4|  cparams.typesize = typesize;
 2080|      4|  cparams.blocksize = blocksize;
 2081|      4|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (2081:7): [True: 4, False: 0]
  ------------------
 2082|      4|    rc = blosc2_chunk_zeros(cparams, nbytes, *chunk, cbytes);
 2083|      4|    if (rc < 0) {
  ------------------
  |  Branch (2083:9): [True: 0, False: 4]
  ------------------
 2084|      0|      BLOSC_TRACE_ERROR("Error creating a zero chunk");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2085|      0|    }
 2086|      4|  }
 2087|      0|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (2087:12): [True: 0, False: 0]
  ------------------
 2088|      0|    rc = blosc2_chunk_uninit(cparams, nbytes, *chunk, cbytes);
 2089|      0|    if (rc < 0) {
  ------------------
  |  Branch (2089:9): [True: 0, False: 0]
  ------------------
 2090|      0|      BLOSC_TRACE_ERROR("Error creating a non initialized chunk");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2091|      0|    }
 2092|      0|  }
 2093|      0|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (2093:12): [True: 0, False: 0]
  ------------------
 2094|      0|    rc = blosc2_chunk_nans(cparams, nbytes, *chunk, cbytes);
 2095|      0|    if (rc < 0) {
  ------------------
  |  Branch (2095:9): [True: 0, False: 0]
  ------------------
 2096|      0|      BLOSC_TRACE_ERROR("Error creating a nan chunk");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|      0|    }
 2098|      0|  }
 2099|      0|  else {
 2100|      0|    BLOSC_TRACE_ERROR("Special value not recognized: %" PRId64 "", special_value);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|      0|    rc = BLOSC2_ERROR_DATA;
 2102|      0|  }
 2103|       |
 2104|      4|  if (rc < 0) {
  ------------------
  |  Branch (2104:7): [True: 0, False: 4]
  ------------------
 2105|      0|    free(*chunk);
 2106|      0|    *needs_free = false;
 2107|      0|    *chunk = NULL;
 2108|      0|  }
 2109|       |
 2110|      4|  return rc;
 2111|      4|}
frame_get_lazychunk:
 2251|     20|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 2252|     20|  int32_t header_len;
 2253|     20|  int64_t frame_len;
 2254|     20|  int64_t nbytes;
 2255|     20|  int64_t cbytes;
 2256|     20|  int32_t blocksize;
 2257|     20|  int32_t chunksize;
 2258|     20|  int64_t nchunks;
 2259|     20|  int32_t typesize;
 2260|     20|  int32_t lazychunk_cbytes;
 2261|     20|  int64_t offset;
 2262|     20|  void* fp = NULL;
 2263|       |
 2264|     20|  *chunk = NULL;
 2265|     20|  *needs_free = false;
 2266|     20|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2267|     20|                           &blocksize, &chunksize, &nchunks,
 2268|     20|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL,
 2269|     20|                           frame->schunk->storage->io);
 2270|     20|  if (rc < 0) {
  ------------------
  |  Branch (2270:7): [True: 0, False: 20]
  ------------------
 2271|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2272|      0|    return rc;
 2273|      0|  }
 2274|       |
 2275|     20|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (2275:7): [True: 0, False: 20]
  ------------------
 2276|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2277|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 2278|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2279|      0|  }
 2280|       |
 2281|       |  // Get the offset to nchunk
 2282|     20|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 2283|     20|  if (rc < 0) {
  ------------------
  |  Branch (2283:7): [True: 1, False: 19]
  ------------------
 2284|      1|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   97|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      1|    do {                                            \
  |  |  |  |  102|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2285|      0|    return rc;
 2286|      1|  }
 2287|       |
 2288|     19|  if (offset < 0) {
  ------------------
  |  Branch (2288:7): [True: 4, False: 15]
  ------------------
 2289|       |    // Special value
 2290|      4|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 2291|      4|    int32_t chunksize_ = chunksize;
 2292|      4|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (2292:9): [True: 0, False: 4]
  |  Branch (2292:36): [True: 0, False: 0]
  ------------------
 2293|       |      // Last chunk is incomplete.  Compute its actual size.
 2294|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 2295|      0|    }
 2296|      4|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 2297|      4|                             (int32_t)lazychunk_cbytes, needs_free);
 2298|      4|    goto end;
 2299|      4|  }
 2300|       |
 2301|     15|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2302|     15|  if (io_cb == NULL) {
  ------------------
  |  Branch (2302:7): [True: 0, False: 15]
  ------------------
 2303|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2304|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 2305|      0|    goto end;
 2306|      0|  }
 2307|       |
 2308|     15|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (2308:7): [True: 0, False: 15]
  ------------------
 2309|       |    // TODO: make this portable across different endianness
 2310|       |    // Get info for building a lazy chunk
 2311|      0|    int32_t chunk_nbytes;
 2312|      0|    int32_t chunk_cbytes;
 2313|      0|    int32_t chunk_blocksize;
 2314|      0|    uint8_t* header_ptr;
 2315|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 2316|      0|    int64_t io_pos = 0;
 2317|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2317:9): [True: 0, False: 0]
  ------------------
 2318|       |      // The chunk is not in the frame
 2319|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 2320|      0|                             frame->schunk->storage->io);
 2321|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2321:11): [True: 0, False: 0]
  ------------------
 2322|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2323|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2324|      0|      }
 2325|      0|    }
 2326|      0|    else {
 2327|      0|      fp = io_cb->open(frame->urlpath, "rb", frame->schunk->storage->io->params);
 2328|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2328:11): [True: 0, False: 0]
  ------------------
 2329|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2330|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2331|      0|      }
 2332|      0|      io_pos = frame->file_offset + header_len + offset;
 2333|      0|    }
 2334|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (2334:9): [True: 0, False: 0]
  ------------------
 2335|      0|      header_ptr = header;
 2336|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 2337|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (2337:9): [True: 0, False: 0]
  ------------------
 2338|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2339|      0|      rc = BLOSC2_ERROR_FILE_READ;
 2340|      0|      goto end;
 2341|      0|    }
 2342|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2343|      0|    if (rc < 0) {
  ------------------
  |  Branch (2343:9): [True: 0, False: 0]
  ------------------
 2344|      0|      goto end;
 2345|      0|    }
 2346|      0|    size_t nblocks = chunk_nbytes / chunk_blocksize;
 2347|      0|    size_t leftover_block = chunk_nbytes % chunk_blocksize;
 2348|      0|    nblocks = leftover_block ? nblocks + 1 : nblocks;
  ------------------
  |  Branch (2348:15): [True: 0, False: 0]
  ------------------
 2349|       |    // Allocate space for the lazy chunk
 2350|      0|    int32_t trailer_len;
 2351|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 2352|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 2353|       |
 2354|      0|    int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 2355|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 2356|      0|    if (special_type == 0) {
  ------------------
  |  Branch (2356:9): [True: 0, False: 0]
  ------------------
 2357|       |      // Regular values have offsets for blocks
 2358|      0|      trailer_offset += (int32_t) (nblocks * sizeof(int32_t));
 2359|      0|      if (memcpyed) {
  ------------------
  |  Branch (2359:11): [True: 0, False: 0]
  ------------------
 2360|      0|        streams_offset += 0;
 2361|      0|      } else {
 2362|      0|        streams_offset += nblocks * sizeof(int32_t);
 2363|      0|      }
 2364|      0|      trailer_len = (int32_t) (sizeof(int32_t) + sizeof(int64_t) + nblocks * sizeof(int32_t));
 2365|      0|      lazychunk_cbytes = trailer_offset + trailer_len;
 2366|      0|    }
 2367|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (2367:14): [True: 0, False: 0]
  ------------------
 2368|      0|      trailer_offset += typesize;
 2369|      0|      streams_offset += typesize;
 2370|      0|      trailer_len = 0;
 2371|      0|      lazychunk_cbytes = trailer_offset + trailer_len;
 2372|      0|    }
 2373|      0|    else {
 2374|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 2375|      0|      goto end;
 2376|      0|    }
 2377|       |
 2378|       |    // Read just the full header and bstarts section too (lazy partial length)
 2379|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2379:9): [True: 0, False: 0]
  ------------------
 2380|      0|      io_pos = 0;
 2381|      0|    }
 2382|      0|    else {
 2383|      0|      io_pos = frame->file_offset + header_len + offset;
 2384|      0|    }
 2385|       |
 2386|       |    // The case here is a bit special because more memory is allocated than read from the file
 2387|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 2388|       |    // the memory provided by the io
 2389|      0|    *chunk = malloc(lazychunk_cbytes);
 2390|      0|    *needs_free = true;
 2391|       |
 2392|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2392:9): [True: 0, False: 0]
  ------------------
 2393|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 2394|      0|    }
 2395|      0|    else {
 2396|      0|      uint8_t* chunk_ptr;
 2397|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 2398|      0|      memcpy(*chunk, chunk_ptr, streams_offset);
 2399|      0|    }
 2400|       |    
 2401|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (2401:9): [True: 0, False: 0]
  ------------------
 2402|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) chunk out of the frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2403|      0|      rc = BLOSC2_ERROR_FILE_READ;
 2404|      0|      goto end;
 2405|      0|    }
 2406|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (2406:9): [True: 0, False: 0]
  ------------------
 2407|       |      // Value runlen is not returning a lazy chunk.  We are done.
 2408|      0|      goto end;
 2409|      0|    }
 2410|       |
 2411|       |    // Mark chunk as lazy
 2412|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 2413|      0|    *blosc2_flags |= 0x08U;
 2414|       |
 2415|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 2416|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2416:9): [True: 0, False: 0]
  ------------------
 2417|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 2418|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 2419|      0|    }
 2420|      0|    else {
 2421|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 2422|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 2423|      0|    }
 2424|       |
 2425|      0|    int32_t* block_csizes = malloc(nblocks * sizeof(int32_t));
 2426|       |
 2427|      0|    if (memcpyed) {
  ------------------
  |  Branch (2427:9): [True: 0, False: 0]
  ------------------
 2428|       |      // When memcpyed the blocksizes are trivial to compute
 2429|      0|      for (int i = 0; i < (int)nblocks - 1; i++) {
  ------------------
  |  Branch (2429:23): [True: 0, False: 0]
  ------------------
 2430|      0|        block_csizes[i] = (int)chunk_blocksize;
 2431|      0|      }
 2432|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 2433|       |      // by the typesize
 2434|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (2434:35): [True: 0, False: 0]
  ------------------
 2435|      0|    }
 2436|      0|    else {
 2437|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 2438|       |      // of order because of multi-threading), and get a reverse index too.
 2439|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 2440|       |      // Helper structure to keep track of original indexes
 2441|      0|      struct csize_idx *csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 2442|      0|      for (int n = 0; n < (int)nblocks; n++) {
  ------------------
  |  Branch (2442:23): [True: 0, False: 0]
  ------------------
 2443|      0|        csize_idx[n].val = block_csizes[n];
 2444|      0|        csize_idx[n].idx = n;
 2445|      0|      }
 2446|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 2447|       |      // Compute the actual csizes
 2448|      0|      int idx;
 2449|      0|      for (int n = 0; n < (int)nblocks - 1; n++) {
  ------------------
  |  Branch (2449:23): [True: 0, False: 0]
  ------------------
 2450|      0|        idx = csize_idx[n].idx;
 2451|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 2452|      0|      }
 2453|      0|      idx = csize_idx[nblocks - 1].idx;
 2454|      0|      block_csizes[idx] = (int)chunk_cbytes - csize_idx[nblocks - 1].val;
 2455|      0|      free(csize_idx);
 2456|      0|    }
 2457|       |    // Copy the csizes at the end of the trailer
 2458|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 2459|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 2460|      0|    free(block_csizes);
 2461|     15|  } else {
 2462|       |    // The chunk is in memory and just one pointer away
 2463|     15|    int64_t chunk_header_offset = header_len + offset;
 2464|     15|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 2465|       |
 2466|     15|    *chunk = frame->cframe + chunk_header_offset;
 2467|       |
 2468|     15|    if (chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (2468:9): [True: 0, False: 15]
  ------------------
 2469|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the (contiguous) frame.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2470|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 2471|     15|    } else {
 2472|     15|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, NULL);
 2473|     15|      if (rc && chunk_cbytes_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (2473:11): [True: 0, False: 15]
  |  Branch (2473:17): [True: 0, False: 0]
  ------------------
 2474|      0|        BLOSC_TRACE_ERROR("Compressed bytes exceed beyond frame length.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2475|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 2476|      0|      }
 2477|     15|    }
 2478|     15|  }
 2479|       |
 2480|     19|  end:
 2481|     19|  if (fp != NULL) {
  ------------------
  |  Branch (2481:7): [True: 0, False: 19]
  ------------------
 2482|      0|    io_cb->close(fp);
 2483|      0|  }
 2484|     19|  if (rc < 0) {
  ------------------
  |  Branch (2484:7): [True: 0, False: 19]
  ------------------
 2485|      0|    if (*needs_free) {
  ------------------
  |  Branch (2485:9): [True: 0, False: 0]
  ------------------
 2486|      0|      free(*chunk);
 2487|      0|      *chunk = NULL;
 2488|      0|      *needs_free = false;
 2489|      0|    }
 2490|      0|    return rc;
 2491|      0|  }
 2492|       |
 2493|     19|  return (int)lazychunk_cbytes;
 2494|     19|}
frame_decompress_chunk:
 3716|     20|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 3717|     20|  uint8_t* src;
 3718|     20|  bool needs_free;
 3719|     20|  int32_t chunk_nbytes;
 3720|     20|  int32_t chunk_cbytes;
 3721|     20|  int rc;
 3722|       |
 3723|       |  // Use a lazychunk here in order to do a potential parallel read.
 3724|     20|  rc = frame_get_lazychunk(frame, nchunk, &src, &needs_free);
 3725|     20|  if (rc < 0) {
  ------------------
  |  Branch (3725:7): [True: 1, False: 19]
  ------------------
 3726|      1|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   97|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      1|    do {                                            \
  |  |  |  |  102|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3727|      0|    goto end;
 3728|      1|  }
 3729|     19|  chunk_cbytes = rc;
 3730|     19|  if (chunk_cbytes < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (3730:7): [True: 0, False: 19]
  ------------------
 3731|       |    /* Not enough input to read `nbytes` */
 3732|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 3733|      0|  }
 3734|       |
 3735|     19|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 3736|     19|  if (rc < 0) {
  ------------------
  |  Branch (3736:7): [True: 0, False: 19]
  ------------------
 3737|      0|    goto end;
 3738|      0|  }
 3739|       |
 3740|       |  /* Create a buffer for destination */
 3741|     19|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (3741:7): [True: 0, False: 19]
  ------------------
 3742|      0|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3743|      0|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 3744|      0|    goto end;
 3745|      0|  }
 3746|       |  /* And decompress it */
 3747|     19|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 3748|     19|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 3749|     19|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (3749:7): [True: 3, False: 16]
  |  Branch (3749:24): [True: 0, False: 16]
  ------------------
 3750|      3|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   97|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      3|    do {                                            \
  |  |  |  |  102|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3751|      3|    if (chunksize >= 0)
  ------------------
  |  Branch (3751:9): [True: 0, False: 3]
  ------------------
 3752|      0|      rc = BLOSC2_ERROR_FAILURE;
 3753|      3|  }
 3754|     20|  end:
 3755|     20|  if (needs_free) {
  ------------------
  |  Branch (3755:7): [True: 4, False: 16]
  ------------------
 3756|      4|    free(src);
 3757|      4|  }
 3758|     20|  return rc;
 3759|     19|}
frame.c:get_meta_from_header:
 1342|      5|                                int32_t header_len) {
 1343|      5|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|      5|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 1344|      5|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   45|      5|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   44|      5|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      5|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   40|      5|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   39|      5|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      5|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      5|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      5|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|      5|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      5|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      5|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      5|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      5|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      5|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      5|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1345|       |
 1346|       |  // Get the size for the index of metalayers
 1347|      5|  uint16_t idx_size;
 1348|      5|  header_pos += sizeof(idx_size);
 1349|      5|  if (header_len < header_pos) {
  ------------------
  |  Branch (1349:7): [True: 0, False: 5]
  ------------------
 1350|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1351|      0|  }
 1352|      5|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1353|       |
 1354|       |  // Get the actual index of metalayers
 1355|      5|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   45|      5|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   44|      5|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      5|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   40|      5|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   39|      5|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      5|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      5|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      5|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   35|      5|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   34|      5|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   33|      5|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      5|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   28|      5|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   27|      5|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   26|      5|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1356|      5|  header_pos += 1;
 1357|      5|  if (header_len < header_pos) {
  ------------------
  |  Branch (1357:7): [True: 0, False: 5]
  ------------------
 1358|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1359|      0|  }
 1360|      5|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (1360:7): [True: 0, False: 5]
  ------------------
 1361|      0|    return BLOSC2_ERROR_DATA;
 1362|      0|  }
 1363|      5|  uint8_t* idxp = metalayers_idx + 1;
 1364|      5|  uint16_t nmetalayers;
 1365|      5|  header_pos += sizeof(nmetalayers);
 1366|      5|  if (header_len < header_pos) {
  ------------------
  |  Branch (1366:7): [True: 0, False: 5]
  ------------------
 1367|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1368|      0|  }
 1369|      5|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1370|      5|  idxp += 2;
 1371|      5|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1640|      5|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (1371:7): [True: 0, False: 5]
  ------------------
 1372|      0|    return BLOSC2_ERROR_DATA;
 1373|      0|  }
 1374|      5|  schunk->nmetalayers = nmetalayers;
 1375|       |
 1376|       |  // Populate the metalayers and its serialized values
 1377|      5|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1377:28): [True: 0, False: 5]
  ------------------
 1378|      0|    header_pos += 1;
 1379|      0|    if (header_len < header_pos) {
  ------------------
  |  Branch (1379:9): [True: 0, False: 0]
  ------------------
 1380|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1381|      0|    }
 1382|      0|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (1382:9): [True: 0, False: 0]
  ------------------
 1383|      0|      return BLOSC2_ERROR_DATA;
 1384|      0|    }
 1385|      0|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 1386|      0|    schunk->metalayers[nmetalayer] = metalayer;
 1387|       |
 1388|       |    // Populate the metalayer string
 1389|      0|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 1390|      0|    idxp += 1;
 1391|      0|    header_pos += nslen;
 1392|      0|    if (header_len < header_pos) {
  ------------------
  |  Branch (1392:9): [True: 0, False: 0]
  ------------------
 1393|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1394|      0|    }
 1395|      0|    char* ns = malloc((size_t)nslen + 1);
 1396|      0|    memcpy(ns, idxp, nslen);
 1397|      0|    ns[nslen] = '\0';
 1398|      0|    idxp += nslen;
 1399|      0|    metalayer->name = ns;
 1400|       |
 1401|       |    // Populate the serialized value for this metalayer
 1402|       |    // Get the offset
 1403|      0|    header_pos += 1;
 1404|      0|    if (header_len < header_pos) {
  ------------------
  |  Branch (1404:9): [True: 0, False: 0]
  ------------------
 1405|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1406|      0|    }
 1407|      0|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (1407:9): [True: 0, False: 0]
  ------------------
 1408|      0|      return BLOSC2_ERROR_DATA;
 1409|      0|    }
 1410|      0|    idxp += 1;
 1411|      0|    int32_t offset;
 1412|      0|    header_pos += sizeof(offset);
 1413|      0|    if (header_len < header_pos) {
  ------------------
  |  Branch (1413:9): [True: 0, False: 0]
  ------------------
 1414|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1415|      0|    }
 1416|      0|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   31|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1417|      0|    idxp += 4;
 1418|      0|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (1418:9): [True: 0, False: 0]
  |  Branch (1418:23): [True: 0, False: 0]
  ------------------
 1419|       |      // Offset is less than zero or exceeds header length
 1420|      0|      return BLOSC2_ERROR_DATA;
 1421|      0|    }
 1422|       |    // Go to offset and see if we have the correct marker
 1423|      0|    uint8_t* content_marker = header + offset;
 1424|      0|    if (header_len < offset + 1 + 4) {
  ------------------
  |  Branch (1424:9): [True: 0, False: 0]
  ------------------
 1425|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1426|      0|    }
 1427|      0|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (1427:9): [True: 0, False: 0]
  ------------------
 1428|      0|      return BLOSC2_ERROR_DATA;
 1429|      0|    }
 1430|       |
 1431|       |    // Read the size of the content
 1432|      0|    int32_t content_len;
 1433|      0|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   31|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1434|      0|    if (content_len < 0) {
  ------------------
  |  Branch (1434:9): [True: 0, False: 0]
  ------------------
 1435|      0|      return BLOSC2_ERROR_DATA;
 1436|      0|    }
 1437|      0|    metalayer->content_len = content_len;
 1438|       |
 1439|       |    // Finally, read the content
 1440|      0|    if (header_len < offset + 1 + 4 + content_len) {
  ------------------
  |  Branch (1440:9): [True: 0, False: 0]
  ------------------
 1441|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1442|      0|    }
 1443|      0|    char* content = malloc((size_t)content_len);
 1444|      0|    memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 1445|      0|    metalayer->content = (uint8_t*)content;
 1446|      0|  }
 1447|       |
 1448|      5|  return 1;
 1449|      5|}
frame.c:get_vlmeta_from_trailer:
 1529|      5|                                   int32_t trailer_len) {
 1530|       |
 1531|      5|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|      5|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 1532|      5|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   54|      5|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 1533|      5|  uint8_t* idxp = trailer + trailer_pos;
 1534|       |
 1535|       |  // Get the size for the index of metalayers
 1536|      5|  trailer_pos += 2;
 1537|      5|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1537:7): [True: 0, False: 5]
  ------------------
 1538|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1539|      0|  }
 1540|      5|  uint16_t idx_size;
 1541|      5|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1542|      5|  idxp += 2;
 1543|       |
 1544|      5|  trailer_pos += 1;
 1545|       |  // Get the actual index of metalayers
 1546|      5|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1546:7): [True: 0, False: 5]
  ------------------
 1547|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1548|      0|  }
 1549|      5|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (1549:7): [True: 0, False: 5]
  ------------------
 1550|      0|    return BLOSC2_ERROR_DATA;
 1551|      0|  }
 1552|      5|  idxp += 1;
 1553|       |
 1554|      5|  int16_t nmetalayers;
 1555|      5|  trailer_pos += sizeof(nmetalayers);
 1556|      5|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1556:7): [True: 0, False: 5]
  ------------------
 1557|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1558|      0|  }
 1559|      5|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1560|      5|  idxp += 2;
 1561|      5|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1646|      5|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (1561:7): [True: 0, False: 5]
  ------------------
 1562|      0|    return BLOSC2_ERROR_DATA;
 1563|      0|  }
 1564|      5|  schunk->nvlmetalayers = nmetalayers;
 1565|       |
 1566|       |  // Populate the metalayers and its serialized values
 1567|     10|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1567:28): [True: 5, False: 5]
  ------------------
 1568|      5|    trailer_pos += 1;
 1569|      5|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1569:9): [True: 0, False: 5]
  ------------------
 1570|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1571|      0|    }
 1572|      5|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (1572:9): [True: 0, False: 5]
  ------------------
 1573|      0|      return BLOSC2_ERROR_DATA;
 1574|      0|    }
 1575|      5|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 1576|      5|    schunk->vlmetalayers[nmetalayer] = metalayer;
 1577|       |
 1578|       |    // Populate the metalayer string
 1579|      5|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 1580|      5|    idxp += 1;
 1581|      5|    trailer_pos += nslen;
 1582|      5|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1582:9): [True: 0, False: 5]
  ------------------
 1583|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1584|      0|    }
 1585|      5|    char* ns = malloc((size_t)nslen + 1);
 1586|      5|    memcpy(ns, idxp, nslen);
 1587|      5|    ns[nslen] = '\0';
 1588|      5|    idxp += nslen;
 1589|      5|    metalayer->name = ns;
 1590|       |
 1591|       |    // Populate the serialized value for this metalayer
 1592|       |    // Get the offset
 1593|      5|    trailer_pos += 1;
 1594|      5|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1594:9): [True: 0, False: 5]
  ------------------
 1595|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1596|      0|    }
 1597|      5|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (1597:9): [True: 0, False: 5]
  ------------------
 1598|      0|      return BLOSC2_ERROR_DATA;
 1599|      0|    }
 1600|      5|    idxp += 1;
 1601|      5|    int32_t offset;
 1602|      5|    trailer_pos += sizeof(offset);
 1603|      5|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (1603:9): [True: 0, False: 5]
  ------------------
 1604|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1605|      0|    }
 1606|      5|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1607|      5|    idxp += 4;
 1608|      5|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (1608:9): [True: 0, False: 5]
  |  Branch (1608:23): [True: 0, False: 5]
  ------------------
 1609|       |      // Offset is less than zero or exceeds trailer length
 1610|      0|      return BLOSC2_ERROR_DATA;
 1611|      0|    }
 1612|       |    // Go to offset and see if we have the correct marker
 1613|      5|    uint8_t* content_marker = trailer + offset;
 1614|      5|    if (trailer_len < offset + 1 + 4) {
  ------------------
  |  Branch (1614:9): [True: 0, False: 5]
  ------------------
 1615|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1616|      0|    }
 1617|      5|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (1617:9): [True: 0, False: 5]
  ------------------
 1618|      0|      return BLOSC2_ERROR_DATA;
 1619|      0|    }
 1620|       |
 1621|       |    // Read the size of the content
 1622|      5|    int32_t content_len;
 1623|      5|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   31|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1624|      5|    if (content_len < 0) {
  ------------------
  |  Branch (1624:9): [True: 0, False: 5]
  ------------------
 1625|      0|      return BLOSC2_ERROR_DATA;
 1626|      0|    }
 1627|      5|    metalayer->content_len = content_len;
 1628|       |
 1629|       |    // Finally, read the content
 1630|      5|    if (trailer_len < offset + 1 + 4 + content_len) {
  ------------------
  |  Branch (1630:9): [True: 0, False: 5]
  ------------------
 1631|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1632|      0|    }
 1633|      5|    char* content = malloc((size_t)content_len);
 1634|      5|    memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 1635|      5|    metalayer->content = (uint8_t*)content;
 1636|      5|  }
 1637|      5|  return 1;
 1638|      5|}

blosc2_schunk_get_cparams:
   39|      5|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   40|      5|  *cparams = calloc(1, sizeof(blosc2_cparams));
   41|      5|  (*cparams)->schunk = schunk;
   42|     35|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (42:19): [True: 30, False: 5]
  ------------------
   43|     30|    (*cparams)->filters[i] = schunk->filters[i];
   44|     30|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   45|     30|  }
   46|      5|  (*cparams)->compcode = schunk->compcode;
   47|      5|  (*cparams)->compcode_meta = schunk->compcode_meta;
   48|      5|  (*cparams)->clevel = schunk->clevel;
   49|      5|  (*cparams)->typesize = schunk->typesize;
   50|      5|  (*cparams)->blocksize = schunk->blocksize;
   51|      5|  (*cparams)->splitmode = schunk->splitmode;
   52|      5|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (52:7): [True: 5, False: 0]
  ------------------
   53|      5|    (*cparams)->nthreads = blosc2_get_nthreads();
   54|      5|  }
   55|      0|  else {
   56|      0|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   57|      0|  }
   58|      5|  return 0;
   59|      5|}
blosc2_schunk_get_dparams:
   63|      5|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   64|      5|  *dparams = calloc(1, sizeof(blosc2_dparams));
   65|      5|  (*dparams)->schunk = schunk;
   66|      5|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (66:7): [True: 5, False: 0]
  ------------------
   67|      5|    (*dparams)->nthreads = blosc2_get_nthreads();
   68|      5|  }
   69|      0|  else {
   70|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
   71|      0|  }
   72|      5|  return 0;
   73|      5|}
blosc2_schunk_free:
  486|      5|int blosc2_schunk_free(blosc2_schunk *schunk) {
  487|      5|  if (schunk->data != NULL) {
  ------------------
  |  Branch (487:7): [True: 0, False: 5]
  ------------------
  488|      0|    for (int i = 0; i < schunk->nchunks; i++) {
  ------------------
  |  Branch (488:21): [True: 0, False: 0]
  ------------------
  489|      0|      free(schunk->data[i]);
  490|      0|    }
  491|      0|    free(schunk->data);
  492|      0|  }
  493|      5|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (493:7): [True: 5, False: 0]
  ------------------
  494|      5|    blosc2_free_ctx(schunk->cctx);
  495|      5|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (495:7): [True: 5, False: 0]
  ------------------
  496|      5|    blosc2_free_ctx(schunk->dctx);
  497|      5|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (497:7): [True: 0, False: 5]
  ------------------
  498|      0|    free(schunk->blockshape);
  499|       |
  500|      5|  if (schunk->nmetalayers > 0) {
  ------------------
  |  Branch (500:7): [True: 0, False: 5]
  ------------------
  501|      0|    for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (501:21): [True: 0, False: 0]
  ------------------
  502|      0|      if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (502:11): [True: 0, False: 0]
  ------------------
  503|      0|        if (schunk->metalayers[i]->name != NULL)
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  ------------------
  504|      0|          free(schunk->metalayers[i]->name);
  505|      0|        if (schunk->metalayers[i]->content != NULL)
  ------------------
  |  Branch (505:13): [True: 0, False: 0]
  ------------------
  506|      0|          free(schunk->metalayers[i]->content);
  507|      0|        free(schunk->metalayers[i]);
  508|      0|      }
  509|      0|    }
  510|      0|    schunk->nmetalayers = 0;
  511|      0|  }
  512|       |
  513|      5|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (513:7): [True: 5, False: 0]
  ------------------
  514|      5|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  515|      5|    if (io_cb != NULL) {
  ------------------
  |  Branch (515:9): [True: 5, False: 0]
  ------------------
  516|      5|      int rc = io_cb->destroy(schunk->storage->io->params);
  517|      5|      if (rc < 0) {
  ------------------
  |  Branch (517:11): [True: 0, False: 5]
  ------------------
  518|      0|        BLOSC_TRACE_ERROR("Could not free the I/O resources.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  519|      0|      }
  520|      5|    }
  521|       |
  522|      5|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (522:9): [True: 0, False: 5]
  ------------------
  523|      0|      free(schunk->storage->urlpath);
  524|      0|    }
  525|      5|    free(schunk->storage->cparams);
  526|      5|    free(schunk->storage->dparams);
  527|      5|    free(schunk->storage->io);
  528|      5|    free(schunk->storage);
  529|      5|  }
  530|       |
  531|      5|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (531:7): [True: 5, False: 0]
  ------------------
  532|      5|    frame_free((blosc2_frame_s *) schunk->frame);
  533|      5|  }
  534|       |
  535|      5|  if (schunk->nvlmetalayers > 0) {
  ------------------
  |  Branch (535:7): [True: 5, False: 0]
  ------------------
  536|     10|    for (int i = 0; i < schunk->nvlmetalayers; ++i) {
  ------------------
  |  Branch (536:21): [True: 5, False: 5]
  ------------------
  537|      5|      if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (537:11): [True: 5, False: 0]
  ------------------
  538|      5|        if (schunk->vlmetalayers[i]->name != NULL)
  ------------------
  |  Branch (538:13): [True: 5, False: 0]
  ------------------
  539|      5|          free(schunk->vlmetalayers[i]->name);
  540|      5|        if (schunk->vlmetalayers[i]->content != NULL)
  ------------------
  |  Branch (540:13): [True: 5, False: 0]
  ------------------
  541|      5|          free(schunk->vlmetalayers[i]->content);
  542|      5|        free(schunk->vlmetalayers[i]);
  543|      5|      }
  544|      5|    }
  545|      5|  }
  546|       |
  547|      5|  free(schunk);
  548|       |
  549|      5|  return 0;
  550|      5|}
blosc2_schunk_from_buffer:
  554|      7|blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy) {
  555|      7|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  556|      7|  if (frame == NULL) {
  ------------------
  |  Branch (556:7): [True: 2, False: 5]
  ------------------
  557|      2|    return NULL;
  558|      2|  }
  559|       |  // Check that the buffer actually comes from a cframe
  560|      5|  char *magic_number = (char *)cframe;
  561|      5|  magic_number += FRAME_HEADER_MAGIC;
  ------------------
  |  |   25|      5|#define FRAME_HEADER_MAGIC 2
  ------------------
  562|      5|  if (strcmp(magic_number, "b2frame\0") != 0) {
  ------------------
  |  Branch (562:7): [True: 0, False: 5]
  ------------------
  563|      0|    frame_free(frame);
  564|      0|    return NULL;
  565|      0|  }
  566|      5|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  567|      5|  if (schunk && copy) {
  ------------------
  |  Branch (567:7): [True: 5, False: 0]
  |  Branch (567:17): [True: 0, False: 5]
  ------------------
  568|       |    // Super-chunk has its own copy of frame
  569|      0|    frame_free(frame);
  570|      0|  }
  571|      5|  return schunk;
  572|      5|}
blosc2_schunk_decompress_chunk:
 1062|     20|                                   void *dest, int32_t nbytes) {
 1063|     20|  int32_t chunk_nbytes;
 1064|     20|  int32_t chunk_cbytes;
 1065|     20|  int chunksize;
 1066|     20|  int rc;
 1067|     20|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1068|       |
 1069|     20|  schunk->current_nchunk = nchunk;
 1070|     20|  if (frame == NULL) {
  ------------------
  |  Branch (1070:7): [True: 0, False: 20]
  ------------------
 1071|      0|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (1071:9): [True: 0, False: 0]
  ------------------
 1072|      0|      BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1073|      0|                        "('%" PRId64 "') in super-chunk.", nchunk, schunk->nchunks);
 1074|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1075|      0|    }
 1076|      0|    uint8_t* src = schunk->data[nchunk];
 1077|      0|    if (src == 0) {
  ------------------
  |  Branch (1077:9): [True: 0, False: 0]
  ------------------
 1078|      0|      return 0;
 1079|      0|    }
 1080|       |
 1081|      0|    rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1082|      0|    if (rc < 0) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 0]
  ------------------
 1083|      0|      return rc;
 1084|      0|    }
 1085|       |
 1086|      0|    if (nbytes < chunk_nbytes) {
  ------------------
  |  Branch (1086:9): [True: 0, False: 0]
  ------------------
 1087|      0|      BLOSC_TRACE_ERROR("Buffer size is too small for the decompressed buffer "
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1088|      0|                        "('%d' bytes, but '%d' are needed).", nbytes, chunk_nbytes);
 1089|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1090|      0|    }
 1091|       |
 1092|      0|    chunksize = blosc2_decompress_ctx(schunk->dctx, src, chunk_cbytes, dest, nbytes);
 1093|      0|    if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (1093:9): [True: 0, False: 0]
  |  Branch (1093:26): [True: 0, False: 0]
  ------------------
 1094|      0|      BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   97|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1095|      0|      if (chunksize < 0)
  ------------------
  |  Branch (1095:11): [True: 0, False: 0]
  ------------------
 1096|      0|        return chunksize;
 1097|      0|      return BLOSC2_ERROR_FAILURE;
 1098|      0|    }
 1099|     20|  } else {
 1100|     20|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1101|     20|    if (chunksize < 0) {
  ------------------
  |  Branch (1101:9): [True: 4, False: 16]
  ------------------
 1102|      4|      return chunksize;
 1103|      4|    }
 1104|     20|  }
 1105|     16|  return chunksize;
 1106|     20|}

unshuffle_avx2:
  693|     23|               const uint8_t *_src, uint8_t *_dest) {
  694|     23|  const int32_t vectorized_chunk_size = bytesoftype * (int32_t)sizeof(__m256i);
  695|       |
  696|       |  /* If the block size is too small to be vectorized,
  697|       |     use the generic implementation. */
  698|     23|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (698:7): [True: 0, False: 23]
  ------------------
  699|      0|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  700|      0|    return;
  701|      0|  }
  702|       |
  703|       |  /* If the blocksize is not a multiple of both the typesize and
  704|       |     the vector size, round the blocksize down to the next value
  705|       |     which is a multiple of both. The vectorized unshuffle can be
  706|       |     used for that portion of the data, and the naive implementation
  707|       |     can be used for the remaining portion. */
  708|     23|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  709|       |
  710|     23|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  711|     23|  const int32_t total_elements = blocksize / bytesoftype;
  712|       |
  713|       |  /* Optimized unshuffle implementations */
  714|     23|  switch (bytesoftype) {
  715|      0|    case 2:
  ------------------
  |  Branch (715:5): [True: 0, False: 23]
  ------------------
  716|      0|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  717|      0|      break;
  718|     23|    case 4:
  ------------------
  |  Branch (718:5): [True: 23, False: 0]
  ------------------
  719|     23|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  720|     23|      break;
  721|      0|    case 8:
  ------------------
  |  Branch (721:5): [True: 0, False: 23]
  ------------------
  722|      0|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  723|      0|      break;
  724|      0|    case 16:
  ------------------
  |  Branch (724:5): [True: 0, False: 23]
  ------------------
  725|      0|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  726|      0|      break;
  727|      0|    default:
  ------------------
  |  Branch (727:5): [True: 0, False: 23]
  ------------------
  728|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  729|      0|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (729:11): [True: 0, False: 0]
  ------------------
  730|      0|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  731|      0|      }
  732|      0|      else {
  733|       |        /* Non-optimized unshuffle */
  734|      0|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  735|       |        /* The non-optimized function covers the whole buffer,
  736|       |           so we're done processing here. */
  737|      0|        return;
  738|      0|      }
  739|     23|  }
  740|       |
  741|       |  /* If the buffer had any bytes at the end which couldn't be handled
  742|       |     by the vectorized implementations, use the non-optimized version
  743|       |     to finish them up. */
  744|     23|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (744:7): [True: 11, False: 12]
  ------------------
  745|     11|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  746|     11|  }
  747|     23|}
shuffle-avx2.c:unshuffle4_avx2:
  357|     23|                const int32_t vectorizable_elements, const int32_t total_elements) {
  358|     23|  static const int32_t bytesoftype = 4;
  359|     23|  int32_t i;
  360|     23|  int j;
  361|     23|  __m256i ymm0[4], ymm1[4];
  362|       |
  363|  18.2k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (363:15): [True: 18.2k, False: 23]
  ------------------
  364|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  365|  18.2k|    const uint8_t* const src_for_ith_element = src + i;
  366|  91.0k|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (366:17): [True: 72.8k, False: 18.2k]
  ------------------
  367|  72.8k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  368|  72.8k|    }
  369|       |    /* Shuffle bytes */
  370|  54.6k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (370:17): [True: 36.4k, False: 18.2k]
  ------------------
  371|       |      /* Compute the low 64 bytes */
  372|  36.4k|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  373|       |      /* Compute the hi 64 bytes */
  374|  36.4k|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  375|  36.4k|    }
  376|       |    /* Shuffle 2-byte words */
  377|  54.6k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (377:17): [True: 36.4k, False: 18.2k]
  ------------------
  378|       |      /* Compute the low 64 bytes */
  379|  36.4k|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  380|       |      /* Compute the hi 64 bytes */
  381|  36.4k|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  382|  36.4k|    }
  383|  18.2k|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  384|  18.2k|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  385|  18.2k|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  386|  18.2k|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  387|       |
  388|       |    /* Store the result vectors in proper order */
  389|  91.0k|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (389:17): [True: 72.8k, False: 18.2k]
  ------------------
  390|  72.8k|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  391|  72.8k|    }
  392|  18.2k|  }
  393|     23|}

shuffle-avx2.c:unshuffle_generic_inline:
   64|     11|                                     const uint8_t *_src, uint8_t *_dest) {
   65|     11|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|     11|  const int32_t neblock_quot = blocksize / type_size;
   69|     11|  const int32_t neblock_rem = blocksize % type_size;
   70|     11|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|    187|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 176, False: 11]
  ------------------
   74|    880|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 704, False: 176]
  ------------------
   75|    704|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|    704|    }
   77|    176|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|     11|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|     11|}

unshuffle:
  435|     23|          const uint8_t* _src, const uint8_t* _dest) {
  436|       |  /* Initialize the shuffle implementation if necessary. */
  437|     23|  init_shuffle_implementation();
  438|       |
  439|       |  /* The implementation is initialized.
  440|       |     Dispatch to it's unshuffle routine. */
  441|     23|  (host_implementation.unshuffle)(bytesoftype, blocksize, _src, _dest);
  442|     23|}
shuffle.c:init_shuffle_implementation:
  396|     23|void init_shuffle_implementation(void) {
  397|       |  /* Initialization could (in rare cases) take place concurrently on
  398|       |     multiple threads, but it shouldn't matter because the
  399|       |     initialization should return the same result on each thread (so
  400|       |     the implementation will be the same). Since that's the case we
  401|       |     can avoid complicated synchronization here and get a small
  402|       |     performance benefit because we don't need to perform a volatile
  403|       |     load on the initialization variable each time this function is
  404|       |     called. */
  405|     23|#if defined(__GNUC__) || defined(__clang__)
  406|     23|  if (__builtin_expect(!implementation_initialized, 0)) {
  ------------------
  |  Branch (406:7): [True: 1, False: 22]
  ------------------
  407|       |#else
  408|       |    if (!implementation_initialized) {
  409|       |#endif
  410|       |    /* Initialize the implementation. */
  411|      1|    host_implementation = get_shuffle_implementation();
  412|       |
  413|       |    /* Set the flag indicating the implementation has been initialized. */
  414|      1|    implementation_initialized = 1;
  415|      1|  }
  416|     23|}
shuffle.c:get_shuffle_implementation:
  297|      1|static shuffle_implementation_t get_shuffle_implementation(void) {
  298|      1|  blosc_cpu_features cpu_features = blosc_get_cpu_features();
  299|      1|#if defined(SHUFFLE_AVX512_ENABLED)
  300|      1|  if (cpu_features & BLOSC_HAVE_AVX512 && is_shuffle_avx2 && is_bshuf_AVX512) {
  ------------------
  |  Branch (300:7): [True: 0, False: 1]
  |  Branch (300:43): [True: 0, False: 0]
  |  Branch (300:62): [True: 0, False: 0]
  ------------------
  301|      0|    shuffle_implementation_t impl_avx512;
  302|      0|    impl_avx512.name = "avx512";
  303|      0|    impl_avx512.shuffle = (shuffle_func)shuffle_avx2;
  304|      0|    impl_avx512.unshuffle = (unshuffle_func)unshuffle_avx2;
  305|      0|    impl_avx512.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX512;
  306|      0|    impl_avx512.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX512;
  307|      0|    return impl_avx512;
  308|      0|  }
  309|      1|#endif  /* defined(SHUFFLE_AVX512_ENABLED) */
  310|       |
  311|      1|#if defined(SHUFFLE_AVX2_ENABLED)
  312|      1|  if (cpu_features & BLOSC_HAVE_AVX2 && is_shuffle_avx2 && is_bshuf_AVX) {
  ------------------
  |  Branch (312:7): [True: 1, False: 0]
  |  Branch (312:41): [True: 1, False: 0]
  |  Branch (312:60): [True: 1, False: 0]
  ------------------
  313|      1|    shuffle_implementation_t impl_avx2;
  314|      1|    impl_avx2.name = "avx2";
  315|      1|    impl_avx2.shuffle = (shuffle_func)shuffle_avx2;
  316|      1|    impl_avx2.unshuffle = (unshuffle_func)unshuffle_avx2;
  317|      1|    impl_avx2.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX;
  318|      1|    impl_avx2.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX;
  319|      1|    return impl_avx2;
  320|      1|  }
  321|      0|#endif  /* defined(SHUFFLE_AVX2_ENABLED) */
  322|       |
  323|      0|#if defined(SHUFFLE_SSE2_ENABLED)
  324|      0|  if (cpu_features & BLOSC_HAVE_SSE2 && is_shuffle_sse2 && is_bshuf_SSE) {
  ------------------
  |  Branch (324:7): [True: 0, False: 0]
  |  Branch (324:41): [True: 0, False: 0]
  |  Branch (324:60): [True: 0, False: 0]
  ------------------
  325|      0|    shuffle_implementation_t impl_sse2;
  326|      0|    impl_sse2.name = "sse2";
  327|      0|    impl_sse2.shuffle = (shuffle_func)shuffle_sse2;
  328|      0|    impl_sse2.unshuffle = (unshuffle_func)unshuffle_sse2;
  329|      0|    impl_sse2.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_SSE;
  330|      0|    impl_sse2.bitunshuffle = (bitunshuffle_func) bshuf_untrans_bit_elem_SSE;
  331|      0|    return impl_sse2;
  332|      0|  }
  333|      0|#endif  /* defined(SHUFFLE_SSE2_ENABLED) */
  334|       |
  335|       |#if defined(SHUFFLE_NEON_ENABLED)
  336|       |  if (cpu_features & BLOSC_HAVE_NEON && is_shuffle_neon) { // && is_bshuf_NEON if using NEON bitshuffle
  337|       |    shuffle_implementation_t impl_neon;
  338|       |    impl_neon.name = "neon";
  339|       |    impl_neon.shuffle = (shuffle_func)shuffle_neon;
  340|       |    impl_neon.unshuffle = (unshuffle_func)unshuffle_neon;
  341|       |    //impl_neon.shuffle = (shuffle_func)shuffle_generic;
  342|       |    //impl_neon.unshuffle = (unshuffle_func)unshuffle_generic;
  343|       |    //impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_NEON;
  344|       |    //impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_NEON;
  345|       |    // The current bitshuffle optimized for NEON is not any faster
  346|       |    // (in fact, it is pretty much slower) than the scalar implementation.
  347|       |    // So, let's use the scalar one, which is pretty fast, at least on a M1 CPU.
  348|       |    impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  349|       |    impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  350|       |    return impl_neon;
  351|       |  }
  352|       |#endif  /* defined(SHUFFLE_NEON_ENABLED) */
  353|       |
  354|       |#if defined(SHUFFLE_ALTIVEC_ENABLED)
  355|       |  if (cpu_features & BLOSC_HAVE_ALTIVEC && is_shuffle_altivec && is_bshuf_altivec) {
  356|       |    shuffle_implementation_t impl_altivec;
  357|       |    impl_altivec.name = "altivec";
  358|       |    impl_altivec.shuffle = (shuffle_func)shuffle_altivec;
  359|       |    impl_altivec.unshuffle = (unshuffle_func)unshuffle_altivec;
  360|       |    impl_altivec.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_altivec;
  361|       |    impl_altivec.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_altivec;
  362|       |    return impl_altivec;
  363|       |  }
  364|       |#endif  /* defined(SHUFFLE_ALTIVEC_ENABLED) */
  365|       |
  366|       |  /* Processor doesn't support any of the hardware-accelerated implementations,
  367|       |     so use the generic implementation. */
  368|      0|  shuffle_implementation_t impl_generic;
  369|      0|  impl_generic.name = "generic";
  370|      0|  impl_generic.shuffle = (shuffle_func)shuffle_generic;
  371|      0|  impl_generic.unshuffle = (unshuffle_func)unshuffle_generic;
  372|      0|  impl_generic.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  373|      0|  impl_generic.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  374|      0|  return impl_generic;
  375|      0|}
shuffle.c:blosc_get_cpu_features:
   98|      1|static blosc_cpu_features blosc_get_cpu_features(void) {
   99|      1|  blosc_cpu_features cpu_features = BLOSC_HAVE_NOTHING;
  100|      1|  if (__builtin_cpu_supports("sse2")) {
  ------------------
  |  Branch (100:7): [True: 1, False: 0]
  ------------------
  101|      1|    cpu_features |= BLOSC_HAVE_SSE2;
  102|      1|  }
  103|      1|  if (__builtin_cpu_supports("avx2")) {
  ------------------
  |  Branch (103:7): [True: 1, False: 0]
  ------------------
  104|      1|    cpu_features |= BLOSC_HAVE_AVX2;
  105|      1|  }
  106|      1|  if (__builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512bw")) {
  ------------------
  |  Branch (106:7): [True: 0, False: 1]
  |  Branch (106:44): [True: 0, False: 0]
  ------------------
  107|      0|    cpu_features |= BLOSC_HAVE_AVX512;
  108|      0|  }
  109|      1|  return cpu_features;
  110|      1|}

blosc_stune_next_blocksize:
   46|      4|int blosc_stune_next_blocksize(blosc2_context *context) {
   47|      4|  int32_t clevel = context->clevel;
   48|      4|  int32_t typesize = context->typesize;
   49|      4|  int32_t nbytes = context->sourcesize;
   50|      4|  int32_t user_blocksize = context->blocksize;
   51|      4|  int32_t blocksize = nbytes;
   52|       |
   53|       |  // Protection against very small buffers
   54|      4|  if (nbytes < typesize) {
  ------------------
  |  Branch (54:7): [True: 0, False: 4]
  ------------------
   55|      0|    context->blocksize = 1;
   56|      0|    return BLOSC2_ERROR_SUCCESS;
   57|      0|  }
   58|       |
   59|      4|  if (user_blocksize) {
  ------------------
  |  Branch (59:7): [True: 0, False: 4]
  ------------------
   60|      0|    blocksize = user_blocksize;
   61|      0|    goto last;
   62|      0|  }
   63|       |
   64|      4|  if (nbytes >= L1) {
  ------------------
  |  |   19|      4|#define L1 (32 * 1024)
  ------------------
  |  Branch (64:7): [True: 4, False: 0]
  ------------------
   65|      4|    blocksize = L1;
  ------------------
  |  |   19|      4|#define L1 (32 * 1024)
  ------------------
   66|       |
   67|       |    /* For HCR codecs, increase the block sizes by a factor of 2 because they
   68|       |        are meant for compressing large blocks (i.e. they show a big overhead
   69|       |        when compressing small ones). */
   70|      4|    if (is_HCR(context)) {
  ------------------
  |  Branch (70:9): [True: 0, False: 4]
  ------------------
   71|      0|      blocksize *= 2;
   72|      0|    }
   73|       |
   74|       |    // Choose a different blocksize depending on the compression level
   75|      4|    switch (clevel) {
   76|      0|      case 0:
  ------------------
  |  Branch (76:7): [True: 0, False: 4]
  ------------------
   77|       |        // Case of plain copy
   78|      0|        blocksize /= 4;
   79|      0|        break;
   80|      0|      case 1:
  ------------------
  |  Branch (80:7): [True: 0, False: 4]
  ------------------
   81|      0|        blocksize /= 2;
   82|      0|        break;
   83|      0|      case 2:
  ------------------
  |  Branch (83:7): [True: 0, False: 4]
  ------------------
   84|      0|        blocksize *= 1;
   85|      0|        break;
   86|      0|      case 3:
  ------------------
  |  Branch (86:7): [True: 0, False: 4]
  ------------------
   87|      0|        blocksize *= 2;
   88|      0|        break;
   89|      0|      case 4:
  ------------------
  |  Branch (89:7): [True: 0, False: 4]
  ------------------
   90|      4|      case 5:
  ------------------
  |  Branch (90:7): [True: 4, False: 0]
  ------------------
   91|      4|        blocksize *= 4;
   92|      4|        break;
   93|      0|      case 6:
  ------------------
  |  Branch (93:7): [True: 0, False: 4]
  ------------------
   94|      0|      case 7:
  ------------------
  |  Branch (94:7): [True: 0, False: 4]
  ------------------
   95|      0|      case 8:
  ------------------
  |  Branch (95:7): [True: 0, False: 4]
  ------------------
   96|      0|        blocksize *= 8;
   97|      0|        break;
   98|      0|      case 9:
  ------------------
  |  Branch (98:7): [True: 0, False: 4]
  ------------------
   99|       |        // Do not exceed 256 KB for non HCR codecs
  100|      0|        blocksize *= 8;
  101|      0|        if (is_HCR(context)) {
  ------------------
  |  Branch (101:13): [True: 0, False: 0]
  ------------------
  102|      0|          blocksize *= 2;
  103|      0|        }
  104|      0|        break;
  105|      0|      default:
  ------------------
  |  Branch (105:7): [True: 0, False: 4]
  ------------------
  106|      0|        break;
  107|      4|    }
  108|      4|  }
  109|       |
  110|       |  /* Now the blocksize for splittable codecs */
  111|      4|  int splitmode = split_block(context, typesize, blocksize);
  112|      4|  if (clevel > 0 && splitmode) {
  ------------------
  |  Branch (112:7): [True: 4, False: 0]
  |  Branch (112:21): [True: 4, False: 0]
  ------------------
  113|       |    // For performance reasons, do not exceed 256 KB (it must fit in L2 cache)
  114|      4|    switch (clevel) {
  115|      0|      case 1:
  ------------------
  |  Branch (115:7): [True: 0, False: 4]
  ------------------
  116|      0|      case 2:
  ------------------
  |  Branch (116:7): [True: 0, False: 4]
  ------------------
  117|      0|      case 3:
  ------------------
  |  Branch (117:7): [True: 0, False: 4]
  ------------------
  118|      0|        blocksize = 32 * 1024;
  119|      0|        break;
  120|      0|      case 4:
  ------------------
  |  Branch (120:7): [True: 0, False: 4]
  ------------------
  121|      4|      case 5:
  ------------------
  |  Branch (121:7): [True: 4, False: 0]
  ------------------
  122|      4|      case 6:
  ------------------
  |  Branch (122:7): [True: 0, False: 4]
  ------------------
  123|      4|        blocksize = 64 * 1024;
  124|      4|        break;
  125|      0|      case 7:
  ------------------
  |  Branch (125:7): [True: 0, False: 4]
  ------------------
  126|      0|        blocksize = 128 * 1024;
  127|      0|        break;
  128|      0|      case 8:
  ------------------
  |  Branch (128:7): [True: 0, False: 4]
  ------------------
  129|      0|        blocksize = 256 * 1024;
  130|      0|        break;
  131|      0|      case 9:
  ------------------
  |  Branch (131:7): [True: 0, False: 4]
  ------------------
  132|      0|      default:
  ------------------
  |  Branch (132:7): [True: 0, False: 4]
  ------------------
  133|      0|        blocksize = 512 * 1024;
  134|      0|        break;
  135|      4|    }
  136|       |    // Multiply by typesize to get proper split sizes
  137|      4|    blocksize *= typesize;
  138|       |    // But do not exceed 4 MB per thread (having this capacity in L3 is normal in modern CPUs)
  139|      4|    if (blocksize > 4 * 1024 * 1024) {
  ------------------
  |  Branch (139:9): [True: 0, False: 4]
  ------------------
  140|      0|      blocksize = 4 * 1024 * 1024;
  141|      0|    }
  142|      4|    if (blocksize < 32 * 1024) {
  ------------------
  |  Branch (142:9): [True: 0, False: 4]
  ------------------
  143|       |      /* Do not use a too small blocksize (< 32 KB) when typesize is small */
  144|      0|      blocksize = 32 * 1024;
  145|      0|    }
  146|      4|  }
  147|       |
  148|      4|  last:
  149|       |  /* Check that blocksize is not too large */
  150|      4|  if (blocksize > nbytes) {
  ------------------
  |  Branch (150:7): [True: 4, False: 0]
  ------------------
  151|      4|    blocksize = nbytes;
  152|      4|  }
  153|       |
  154|       |  // blocksize *must absolutely* be a multiple of the typesize
  155|      4|  if (blocksize > typesize) {
  ------------------
  |  Branch (155:7): [True: 4, False: 0]
  ------------------
  156|      4|    blocksize = blocksize / typesize * typesize;
  157|      4|  }
  158|       |
  159|      4|  context->blocksize = blocksize;
  160|      4|  BLOSC_INFO("compcode: %d, clevel: %d, blocksize: %d, splitmode: %d, typesize: %d",
  ------------------
  |  |  125|      4|    do {                                            \
  |  |  126|      4|        const char *__e = getenv("BLOSC_INFO");     \
  |  |  127|      4|        if (!__e) { break; }                        \
  |  |  ------------------
  |  |  |  Branch (127:13): [True: 4, False: 0]
  |  |  ------------------
  |  |  128|      4|        fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
  |  |  129|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (129:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  161|      4|             context->compcode, context->clevel, blocksize, splitmode, typesize);
  162|       |
  163|      0|  return BLOSC2_ERROR_SUCCESS;
  164|      4|}
split_block:
  185|      4|int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize) {
  186|      4|  switch (context->splitmode) {
  187|      0|    case BLOSC_ALWAYS_SPLIT:
  ------------------
  |  Branch (187:5): [True: 0, False: 4]
  ------------------
  188|      0|      return 1;
  189|      0|    case BLOSC_NEVER_SPLIT:
  ------------------
  |  Branch (189:5): [True: 0, False: 4]
  ------------------
  190|      0|      return 0;
  191|      4|    case BLOSC_FORWARD_COMPAT_SPLIT:
  ------------------
  |  Branch (191:5): [True: 4, False: 0]
  ------------------
  192|      4|    case BLOSC_AUTO_SPLIT:
  ------------------
  |  Branch (192:5): [True: 0, False: 4]
  ------------------
  193|       |      // These cases will be handled later
  194|      4|      break;
  195|      0|    default:
  ------------------
  |  Branch (195:5): [True: 0, False: 4]
  ------------------
  196|      0|      BLOSC_TRACE_WARNING("Unrecognized split mode.  Default to BLOSC_FORWARD_COMPAT_SPLIT");
  ------------------
  |  |   98|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  101|      0|    do {                                            \
  |  |  |  |  102|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  103|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  105|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (105:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|      4|  }
  198|       |
  199|      4|  int compcode = context->compcode;
  200|      4|  return (
  201|       |          // Fast codecs like blosclz, lz4 seems to prefer to split
  202|      4|          ((compcode == BLOSC_BLOSCLZ) || (compcode == BLOSC_LZ4)
  ------------------
  |  Branch (202:12): [True: 4, False: 0]
  |  Branch (202:43): [True: 0, False: 0]
  ------------------
  203|       |            // and low levels of zstd too
  204|      4|            || ((compcode == BLOSC_ZSTD) && (context->clevel <= 5))
  ------------------
  |  Branch (204:17): [True: 0, False: 0]
  |  Branch (204:45): [True: 0, False: 0]
  ------------------
  205|      4|            ) &&
  206|       |          // ...but split seems to harm cratio too much when not using shuffle
  207|      4|          (context->filter_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (207:11): [True: 4, False: 0]
  ------------------
  208|      4|          (typesize <= MAX_STREAMS) &&
  ------------------
  |  |   24|      4|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
  |  Branch (208:11): [True: 4, False: 0]
  ------------------
  209|      4|          (blocksize / typesize) >= BLOSC_MIN_BUFFERSIZE);
  ------------------
  |  Branch (209:11): [True: 4, False: 0]
  ------------------
  210|      4|}
stune.c:is_HCR:
   20|      4|static bool is_HCR(blosc2_context * context) {
   21|      4|  switch (context->compcode) {
   22|      4|    case BLOSC_BLOSCLZ :
  ------------------
  |  Branch (22:5): [True: 4, False: 0]
  ------------------
   23|      4|      return false;
   24|      0|    case BLOSC_LZ4 :
  ------------------
  |  Branch (24:5): [True: 0, False: 4]
  ------------------
   25|       |      // return (context->filter_flags & BLOSC_DOBITSHUFFLE) ? true : false;
   26|       |      // Do not treat LZ4 differently than BloscLZ here
   27|      0|      return false;
   28|      0|    case BLOSC_LZ4HC :
  ------------------
  |  Branch (28:5): [True: 0, False: 4]
  ------------------
   29|      0|    case BLOSC_ZLIB :
  ------------------
  |  Branch (29:5): [True: 0, False: 4]
  ------------------
   30|      0|    case BLOSC_ZSTD :
  ------------------
  |  Branch (30:5): [True: 0, False: 4]
  ------------------
   31|      0|      return true;
   32|      0|    default :
  ------------------
  |  Branch (32:5): [True: 0, False: 4]
  ------------------
   33|      0|      return false;
   34|      4|  }
   35|      4|}

LZ4_decompress_safe:
 2346|     28|{
 2347|     28|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2348|     28|                                  decode_full_block, noDict,
 2349|     28|                                  (BYTE*)dest, NULL, 0);
 2350|     28|}
lz4.c:LZ4_isLittleEndian:
  362|  7.81k|{
  363|  7.81k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  364|  7.81k|    return one.c[0];
  365|  7.81k|}
lz4.c:LZ4_wildCopy8:
  445|     33|{
  446|     33|    BYTE* d = (BYTE*)dstPtr;
  447|     33|    const BYTE* s = (const BYTE*)srcPtr;
  448|     33|    BYTE* const e = (BYTE*)dstEnd;
  449|       |
  450|   107k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  347|   107k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (450:50): [True: 107k, False: 33]
  ------------------
  451|     33|}
lz4.c:LZ4_read16:
  384|  7.81k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign*)ptr)->u16; }
lz4.c:LZ4_write32:
  389|     27|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 1949|     28|{
 1950|     28|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (1950:9): [True: 0, False: 28]
  |  Branch (1950:26): [True: 0, False: 28]
  ------------------
 1951|       |
 1952|     28|    {   const BYTE* ip = (const BYTE*) src;
 1953|     28|        const BYTE* const iend = ip + srcSize;
 1954|       |
 1955|     28|        BYTE* op = (BYTE*) dst;
 1956|     28|        BYTE* const oend = op + outputSize;
 1957|     28|        BYTE* cpy;
 1958|       |
 1959|     28|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (1959:37): [True: 28, False: 0]
  ------------------
 1960|       |
 1961|     28|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  249|     28|#define KB *(1 <<10)
  ------------------
 1962|       |
 1963|       |
 1964|       |        /* Set up the "end" pointers for the shortcut. */
 1965|     28|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 1966|     28|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 1967|       |
 1968|     28|        const BYTE* match;
 1969|     28|        size_t offset;
 1970|     28|        unsigned token;
 1971|     28|        size_t length;
 1972|       |
 1973|       |
 1974|     28|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  287|     28|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1975|       |
 1976|       |        /* Special cases */
 1977|     28|        assert(lowPrefix <= op);
  ------------------
  |  |  271|     28|#    define assert(condition) ((void)0)
  ------------------
 1978|     28|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  178|     28|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     28|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1979|       |            /* Empty output buffer */
 1980|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (1980:17): [True: 0, False: 0]
  ------------------
 1981|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (1981:21): [True: 0, False: 0]
  |  Branch (1981:37): [True: 0, False: 0]
  ------------------
 1982|      0|        }
 1983|     28|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  178|     28|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     28|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1984|       |
 1985|       |    /* LZ4_FAST_DEC_LOOP:
 1986|       |     * designed for modern OoO performance cpus,
 1987|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 1988|       |     * note : fast loop may show a regression for some client arm chips. */
 1989|     28|#if LZ4_FAST_DEC_LOOP
 1990|     28|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  246|     28|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (1990:13): [True: 0, False: 28]
  ------------------
 1991|      0|            DEBUGLOG(6, "skip fast decode loop");
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1992|      0|            goto safe_decode;
 1993|      0|        }
 1994|       |
 1995|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 1996|  7.81k|        while (1) {
  ------------------
  |  Branch (1996:16): [Folded - Ignored]
  ------------------
 1997|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 1998|  7.81k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  271|  7.81k|#    define assert(condition) ((void)0)
  ------------------
 1999|  7.81k|            assert(ip < iend);
  ------------------
  |  |  271|  7.81k|#    define assert(condition) ((void)0)
  ------------------
 2000|  7.81k|            token = *ip++;
 2001|  7.81k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  258|  7.81k|#define ML_BITS  4
  ------------------
 2002|       |
 2003|       |            /* decode literal length */
 2004|  7.81k|            if (length == RUN_MASK) {
  ------------------
  |  |  261|  7.81k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  7.81k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|  7.81k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2004:17): [True: 28, False: 7.78k]
  ------------------
 2005|     28|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  261|     28|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     28|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|     28|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2006|     28|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2006:21): [True: 0, False: 28]
  ------------------
 2007|     28|                length += addl;
 2008|     28|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  178|     28|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     28|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2009|     28|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  178|     28|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     28|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2010|       |
 2011|       |                /* copy literals */
 2012|     28|                cpy = op+length;
 2013|     28|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  275|     28|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2014|     28|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2014:21): [True: 0, False: 28]
  |  Branch (2014:38): [True: 0, False: 28]
  ------------------
 2015|     28|                LZ4_wildCopy32(op, ip, cpy);
 2016|     28|                ip += length; op = cpy;
 2017|  7.78k|            } else {
 2018|  7.78k|                cpy = op+length;
 2019|  7.78k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  287|  7.78k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2020|       |                /* We don't need to check oend, since we check it once for each loop below */
 2021|  7.78k|                if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2021:21): [True: 1, False: 7.78k]
  ------------------
 2022|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2023|  7.78k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  347|  7.78k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2024|  7.78k|                ip += length; op = cpy;
 2025|  7.78k|            }
 2026|       |
 2027|       |            /* get offset */
 2028|  7.81k|            offset = LZ4_readLE16(ip); ip+=2;
 2029|  7.81k|            match = op - offset;
 2030|  7.81k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  271|  7.81k|#    define assert(condition) ((void)0)
  ------------------
 2031|       |
 2032|       |            /* get matchlength */
 2033|  7.81k|            length = token & ML_MASK;
  ------------------
  |  |  259|  7.81k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|  7.81k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2034|       |
 2035|  7.81k|            if (length == ML_MASK) {
  ------------------
  |  |  259|  7.81k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|  7.81k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2035:17): [True: 7.80k, False: 2]
  ------------------
 2036|  7.80k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  243|  7.80k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2037|  7.80k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2037:21): [True: 0, False: 7.80k]
  ------------------
 2038|  7.80k|                length += addl;
 2039|  7.80k|                length += MINMATCH;
  ------------------
  |  |  240|  7.80k|#define MINMATCH 4
  ------------------
 2040|  7.80k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  178|  7.80k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|  7.80k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 7.80k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2041|  7.80k|                if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */
  ------------------
  |  |  178|  7.80k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|  7.80k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2041:21): [True: 7.80k, False: 0]
  |  Branch (2041:38): [True: 0, False: 7.80k]
  ------------------
 2042|  7.80k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  246|  7.80k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2042:21): [True: 27, False: 7.78k]
  ------------------
 2043|     27|                    goto safe_match_copy;
 2044|     27|                }
 2045|  7.80k|            } else {
 2046|      2|                length += MINMATCH;
  ------------------
  |  |  240|      2|#define MINMATCH 4
  ------------------
 2047|      2|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  246|      2|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2047:21): [True: 0, False: 2]
  ------------------
 2048|      0|                    goto safe_match_copy;
 2049|      0|                }
 2050|       |
 2051|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2052|      2|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2052:21): [True: 0, False: 2]
  |  Branch (2052:48): [True: 2, False: 0]
  ------------------
 2053|      2|                    if (offset >= 8) {
  ------------------
  |  Branch (2053:25): [True: 2, False: 0]
  ------------------
 2054|      2|                        assert(match >= lowPrefix);
  ------------------
  |  |  271|      2|#    define assert(condition) ((void)0)
  ------------------
 2055|      2|                        assert(match <= op);
  ------------------
  |  |  271|      2|#    define assert(condition) ((void)0)
  ------------------
 2056|      2|                        assert(op + 18 <= oend);
  ------------------
  |  |  271|      2|#    define assert(condition) ((void)0)
  ------------------
 2057|       |
 2058|      2|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  347|      2|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2059|      2|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  347|      2|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2060|      2|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  347|      2|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2061|      2|                        op += length;
 2062|      2|                        continue;
 2063|      2|            }   }   }
 2064|       |
 2065|  7.78k|            if (checkOffset && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */
  ------------------
  |  |  178|  7.78k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|  7.78k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2065:17): [True: 7.78k, False: 0]
  |  Branch (2065:32): [True: 0, False: 7.78k]
  ------------------
 2066|       |            /* match starting within external dictionary */
 2067|  7.78k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2067:17): [True: 0, False: 7.78k]
  |  Branch (2067:41): [True: 0, False: 0]
  ------------------
 2068|      0|                assert(dictEnd != NULL);
  ------------------
  |  |  271|      0|#    define assert(condition) ((void)0)
  ------------------
 2069|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  178|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2070|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2070:25): [True: 0, False: 0]
  ------------------
 2071|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2072|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1770|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1770:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2073|      0|                    } else {
 2074|      0|                        goto _output_error;  /* end-of-block condition violated */
 2075|      0|                }   }
 2076|       |
 2077|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2077:21): [True: 0, False: 0]
  ------------------
 2078|       |                    /* match fits entirely within external dictionary : just copy */
 2079|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  355|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2080|      0|                    op += length;
 2081|      0|                } else {
 2082|       |                    /* match stretches into both external dictionary and current block */
 2083|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2084|      0|                    size_t const restSize = length - copySize;
 2085|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2086|      0|                    op += copySize;
 2087|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2087:25): [True: 0, False: 0]
  ------------------
 2088|      0|                        BYTE* const endOfMatch = op + restSize;
 2089|      0|                        const BYTE* copyFrom = lowPrefix;
 2090|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2090:32): [True: 0, False: 0]
  ------------------
 2091|      0|                    } else {
 2092|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2093|      0|                        op += restSize;
 2094|      0|                }   }
 2095|      0|                continue;
 2096|      0|            }
 2097|       |
 2098|       |            /* copy match within block */
 2099|  7.78k|            cpy = op + length;
 2100|       |
 2101|  7.78k|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  |  271|  7.78k|#    define assert(condition) ((void)0)
  ------------------
 2102|  7.78k|            if (unlikely(offset<16)) {
  ------------------
  |  |  178|  7.78k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|  7.78k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 5.77k, False: 2.00k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2103|  5.77k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2104|  5.77k|            } else {
 2105|  2.00k|                LZ4_wildCopy32(op, match, cpy);
 2106|  2.00k|            }
 2107|       |
 2108|  7.78k|            op = cpy;   /* wildcopy correction */
 2109|  7.78k|        }
 2110|      0|    safe_decode:
 2111|      0|#endif
 2112|       |
 2113|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2114|     30|        while (1) {
  ------------------
  |  Branch (2114:16): [Folded - Ignored]
  ------------------
 2115|     30|            assert(ip < iend);
  ------------------
  |  |  271|     30|#    define assert(condition) ((void)0)
  ------------------
 2116|     30|            token = *ip++;
 2117|     30|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  258|     30|#define ML_BITS  4
  ------------------
 2118|       |
 2119|       |            /* A two-stage shortcut for the most common case:
 2120|       |             * 1) If the literal length is 0..14, and there is enough space,
 2121|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2122|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2123|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2124|       |             * manner; but we ensure that there's enough space in the output for
 2125|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2126|       |             * there is a combined check for both stages).
 2127|       |             */
 2128|     30|            if ( (length != RUN_MASK)
  ------------------
  |  |  261|     30|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     30|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|     30|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2128:18): [True: 30, False: 0]
  ------------------
 2129|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2130|     30|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  175|     30|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  169|     30|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 30]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2131|       |                /* Copy the literals */
 2132|      0|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2133|      0|                op += length; ip += length;
 2134|       |
 2135|       |                /* The second stage: prepare for match copying, decode full info.
 2136|       |                 * If it doesn't work out, the info won't be wasted. */
 2137|      0|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  259|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2138|      0|                offset = LZ4_readLE16(ip); ip += 2;
 2139|      0|                match = op - offset;
 2140|      0|                assert(match <= op); /* check overflow */
  ------------------
  |  |  271|      0|#    define assert(condition) ((void)0)
  ------------------
 2141|       |
 2142|       |                /* Do not deal with overlapping matches. */
 2143|      0|                if ( (length != ML_MASK)
  ------------------
  |  |  259|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2143:22): [True: 0, False: 0]
  ------------------
 2144|      0|                  && (offset >= 8)
  ------------------
  |  Branch (2144:22): [True: 0, False: 0]
  ------------------
 2145|      0|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2145:23): [True: 0, False: 0]
  |  Branch (2145:46): [True: 0, False: 0]
  ------------------
 2146|       |                    /* Copy the match. */
 2147|      0|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2148|      0|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2149|      0|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2150|      0|                    op += length + MINMATCH;
  ------------------
  |  |  240|      0|#define MINMATCH 4
  ------------------
 2151|       |                    /* Both stages worked, load the next token. */
 2152|      0|                    continue;
 2153|      0|                }
 2154|       |
 2155|       |                /* The second stage didn't work out, but the info is ready.
 2156|       |                 * Propel it right to the point of match copying. */
 2157|      0|                goto _copy_match;
 2158|      0|            }
 2159|       |
 2160|       |            /* decode literal length */
 2161|     30|            if (length == RUN_MASK) {
  ------------------
  |  |  261|     30|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|     30|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|     30|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2161:17): [True: 0, False: 30]
  ------------------
 2162|      0|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  261|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2163|      0|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2163:21): [True: 0, False: 0]
  ------------------
 2164|      0|                length += addl;
 2165|      0|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  178|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2166|      0|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  178|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2167|      0|            }
 2168|       |
 2169|       |            /* copy literals */
 2170|     30|            cpy = op+length;
 2171|     30|#if LZ4_FAST_DEC_LOOP
 2172|     31|        safe_literal_copy:
 2173|     31|#endif
 2174|     31|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  275|     31|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2175|     31|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  244|     31|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  243|      5|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2175:17): [True: 26, False: 5]
  |  Branch (2175:39): [True: 2, False: 3]
  ------------------
 2176|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2177|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2178|       |                 * otherwise it's an error (invalid input or dimensions).
 2179|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2180|       |                 */
 2181|     28|                if (partialDecoding) {
  ------------------
  |  Branch (2181:21): [True: 0, False: 28]
  ------------------
 2182|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2183|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2184|       |                     */
 2185|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2186|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2187|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2188|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  287|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2189|       |                    /* Finishing in the middle of a literals segment,
 2190|       |                     * due to lack of input.
 2191|       |                     */
 2192|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2192:25): [True: 0, False: 0]
  ------------------
 2193|      0|                        length = (size_t)(iend-ip);
 2194|      0|                        cpy = op + length;
 2195|      0|                    }
 2196|       |                    /* Finishing in the middle of a literals segment,
 2197|       |                     * due to lack of output space.
 2198|       |                     */
 2199|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2199:25): [True: 0, False: 0]
  ------------------
 2200|      0|                        cpy = oend;
 2201|      0|                        assert(op<=oend);
  ------------------
  |  |  271|      0|#    define assert(condition) ((void)0)
  ------------------
 2202|      0|                        length = (size_t)(oend-op);
 2203|      0|                    }
 2204|     28|                } else {
 2205|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2206|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2207|       |                      */
 2208|     28|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2208:25): [True: 1, False: 27]
  |  Branch (2208:48): [True: 0, False: 27]
  ------------------
 2209|      1|                        DEBUGLOG(6, "should have been last run of literals")
  ------------------
  |  |  287|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2210|      1|                        DEBUGLOG(6, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  287|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|      1|                        DEBUGLOG(6, "or cpy(%p) > oend(%p)", cpy, oend);
  ------------------
  |  |  287|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2212|      1|                        goto _output_error;
 2213|      1|                    }
 2214|     28|                }
 2215|     27|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  355|     27|#    define LZ4_memmove __builtin_memmove
  ------------------
 2216|     27|                ip += length;
 2217|     27|                op += length;
 2218|       |                /* Necessarily EOF when !partialDecoding.
 2219|       |                 * When partialDecoding, it is EOF if we've either
 2220|       |                 * filled the output buffer or
 2221|       |                 * can't proceed with reading an offset for following match.
 2222|       |                 */
 2223|     27|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2223:21): [True: 27, False: 0]
  |  Branch (2223:41): [True: 0, False: 0]
  |  Branch (2223:58): [True: 0, False: 0]
  ------------------
 2224|     27|                    break;
 2225|     27|                }
 2226|     27|            } else {
 2227|      3|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2228|      3|                ip += length; op = cpy;
 2229|      3|            }
 2230|       |
 2231|       |            /* get offset */
 2232|      3|            offset = LZ4_readLE16(ip); ip+=2;
 2233|      3|            match = op - offset;
 2234|       |
 2235|       |            /* get matchlength */
 2236|      3|            length = token & ML_MASK;
  ------------------
  |  |  259|      3|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|      3|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2237|       |
 2238|      3|    _copy_match:
 2239|      3|            if (length == ML_MASK) {
  ------------------
  |  |  259|      3|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  258|      3|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2239:17): [True: 3, False: 0]
  ------------------
 2240|      3|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  243|      3|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2241|      3|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2241:21): [True: 0, False: 3]
  ------------------
 2242|      3|                length += addl;
 2243|      3|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  178|      3|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      3|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2244|      3|            }
 2245|      3|            length += MINMATCH;
  ------------------
  |  |  240|      3|#define MINMATCH 4
  ------------------
 2246|       |
 2247|      3|#if LZ4_FAST_DEC_LOOP
 2248|     30|        safe_match_copy:
 2249|     30|#endif
 2250|     30|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  178|     30|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     30|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2250:17): [True: 30, False: 0]
  |  Branch (2250:34): [True: 0, False: 30]
  ------------------
 2251|       |            /* match starting within external dictionary */
 2252|     30|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2252:17): [True: 0, False: 30]
  |  Branch (2252:41): [True: 0, False: 0]
  ------------------
 2253|      0|                assert(dictEnd != NULL);
  ------------------
  |  |  271|      0|#    define assert(condition) ((void)0)
  ------------------
 2254|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  178|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2255|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1770|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1770:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2255:25): [True: 0, False: 0]
  ------------------
 2256|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2257|      0|                }
 2258|       |
 2259|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2259:21): [True: 0, False: 0]
  ------------------
 2260|       |                    /* match fits entirely within external dictionary : just copy */
 2261|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  355|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2262|      0|                    op += length;
 2263|      0|                } else {
 2264|       |                    /* match stretches into both external dictionary and current block */
 2265|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2266|      0|                    size_t const restSize = length - copySize;
 2267|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2268|      0|                    op += copySize;
 2269|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2269:25): [True: 0, False: 0]
  ------------------
 2270|      0|                        BYTE* const endOfMatch = op + restSize;
 2271|      0|                        const BYTE* copyFrom = lowPrefix;
 2272|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2272:32): [True: 0, False: 0]
  ------------------
 2273|      0|                    } else {
 2274|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2275|      0|                        op += restSize;
 2276|      0|                }   }
 2277|      0|                continue;
 2278|      0|            }
 2279|     30|            assert(match >= lowPrefix);
  ------------------
  |  |  271|     30|#    define assert(condition) ((void)0)
  ------------------
 2280|       |
 2281|       |            /* copy match within block */
 2282|     30|            cpy = op + length;
 2283|       |
 2284|       |            /* partialDecoding : may end anywhere within the block */
 2285|     30|            assert(op<=oend);
  ------------------
  |  |  271|     30|#    define assert(condition) ((void)0)
  ------------------
 2286|     30|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  245|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  242|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  240|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2286:17): [True: 0, False: 30]
  |  Branch (2286:36): [True: 0, False: 0]
  ------------------
 2287|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1770|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1770:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2288|      0|                const BYTE* const matchEnd = match + mlen;
 2289|      0|                BYTE* const copyEnd = op + mlen;
 2290|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2290:21): [True: 0, False: 0]
  ------------------
 2291|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2291:28): [True: 0, False: 0]
  ------------------
 2292|      0|                } else {
 2293|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2294|      0|                }
 2295|      0|                op = copyEnd;
 2296|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2296:21): [True: 0, False: 0]
  ------------------
 2297|      0|                continue;
 2298|      0|            }
 2299|       |
 2300|     30|            if (unlikely(offset<8)) {
  ------------------
  |  |  178|     30|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     30|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 27, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2301|     27|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2302|     27|                op[0] = match[0];
 2303|     27|                op[1] = match[1];
 2304|     27|                op[2] = match[2];
 2305|     27|                op[3] = match[3];
 2306|     27|                match += inc32table[offset];
 2307|     27|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  347|     27|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2308|     27|                match -= dec64table[offset];
 2309|     27|            } else {
 2310|      3|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  347|      3|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2311|      3|                match += 8;
 2312|      3|            }
 2313|     30|            op += 8;
 2314|       |
 2315|     30|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  178|     30|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     30|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 26, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2316|     26|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  242|     26|#define WILDCOPYLENGTH 8
  ------------------
 2317|     26|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  243|     26|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2317:21): [True: 0, False: 26]
  ------------------
 2318|     26|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2318:21): [True: 26, False: 0]
  ------------------
 2319|     26|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2320|     26|                    match += oCopyLimit - op;
 2321|     26|                    op = oCopyLimit;
 2322|     26|                }
 2323|     76|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2323:24): [True: 50, False: 26]
  ------------------
 2324|     26|            } else {
 2325|      4|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  347|      4|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2326|      4|                if (length > 16)  { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2326:21): [True: 4, False: 0]
  ------------------
 2327|      4|            }
 2328|     30|            op = cpy;   /* wildcopy correction */
 2329|     30|        }
 2330|       |
 2331|       |        /* end of decoding */
 2332|     27|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  287|     27|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2333|     27|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2334|       |
 2335|       |        /* Overflow error detected */
 2336|      1|    _output_error:
 2337|      1|        return (int) (-(((const char*)ip)-src))-1;
 2338|      0|    }
 2339|      0|}
lz4.c:read_variable_length:
 1906|  7.84k|{
 1907|  7.84k|    Rvl_t s, length = 0;
 1908|  7.84k|    assert(ip != NULL);
  ------------------
  |  |  271|  7.84k|#    define assert(condition) ((void)0)
  ------------------
 1909|  7.84k|    assert(*ip !=  NULL);
  ------------------
  |  |  271|  7.84k|#    define assert(condition) ((void)0)
  ------------------
 1910|  7.84k|    assert(ilimit != NULL);
  ------------------
  |  |  271|  7.84k|#    define assert(condition) ((void)0)
  ------------------
 1911|  7.84k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  178|     28|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|     28|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1911:9): [True: 28, False: 7.81k]
  ------------------
 1912|      0|        return rvl_error;
 1913|      0|    }
 1914|  16.2k|    do {
 1915|  16.2k|        s = **ip;
 1916|  16.2k|        (*ip)++;
 1917|  16.2k|        length += s;
 1918|  16.2k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  178|  16.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|  16.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 16.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1919|      0|            return rvl_error;
 1920|      0|        }
 1921|       |        /* accumulator overflow detection (32-bit mode only) */
 1922|  16.2k|        if ((sizeof(length)<8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  178|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  169|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (169:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1922:13): [Folded - Ignored]
  ------------------
 1923|      0|            return rvl_error;
 1924|      0|        }
 1925|  16.2k|    } while (s==255);
  ------------------
  |  Branch (1925:14): [True: 8.41k, False: 7.84k]
  ------------------
 1926|       |
 1927|  7.84k|    return length;
 1928|  7.84k|}
lz4.c:LZ4_wildCopy32:
  502|  2.03k|{
  503|  2.03k|    BYTE* d = (BYTE*)dstPtr;
  504|  2.03k|    const BYTE* s = (const BYTE*)srcPtr;
  505|  2.03k|    BYTE* const e = (BYTE*)dstEnd;
  506|       |
  507|  32.6k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  347|  32.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  347|  32.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (507:79): [True: 30.6k, False: 2.03k]
  ------------------
  508|  2.03k|}
lz4.c:LZ4_readLE16:
  422|  7.81k|{
  423|  7.81k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (423:9): [True: 7.81k, False: 0]
  ------------------
  424|  7.81k|        return LZ4_read16(memPtr);
  425|  7.81k|    } else {
  426|      0|        const BYTE* p = (const BYTE*)memPtr;
  427|      0|        return (U16)((U16)p[0] + (p[1]<<8));
  428|      0|    }
  429|  7.81k|}
lz4.c:LZ4_memcpy_using_offset:
  515|  5.77k|{
  516|  5.77k|    BYTE v[8];
  517|       |
  518|  5.77k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  271|  5.77k|#    define assert(condition) ((void)0)
  ------------------
  519|       |
  520|  5.77k|    switch(offset) {
  521|  5.73k|    case 1:
  ------------------
  |  Branch (521:5): [True: 5.73k, False: 40]
  ------------------
  522|  5.73k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  234|  5.73k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  232|  5.73k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  523|  5.73k|        break;
  524|     40|    case 2:
  ------------------
  |  Branch (524:5): [True: 40, False: 5.73k]
  ------------------
  525|     40|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  347|     40|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  526|     40|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  347|     40|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  527|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  528|       |#  pragma warning(push)
  529|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  530|       |#endif
  531|     40|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  347|     40|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  532|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  533|       |#  pragma warning(pop)
  534|       |#endif
  535|     40|        break;
  536|      0|    case 4:
  ------------------
  |  Branch (536:5): [True: 0, False: 5.77k]
  ------------------
  537|      0|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  538|      0|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  347|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  539|      0|        break;
  540|      0|    default:
  ------------------
  |  Branch (540:5): [True: 0, False: 5.77k]
  ------------------
  541|      0|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  542|      0|        return;
  543|  5.77k|    }
  544|       |
  545|  5.77k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  347|  5.77k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  546|  5.77k|    dstPtr += 8;
  547|   120k|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (547:12): [True: 115k, False: 5.77k]
  ------------------
  548|   115k|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  347|   115k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  549|   115k|        dstPtr += 8;
  550|   115k|    }
  551|  5.77k|}

register_codecs:
   13|      7|void register_codecs(void) {
   14|       |
   15|      7|  blosc2_codec ndlz;
   16|      7|  ndlz.compcode = BLOSC_CODEC_NDLZ;
   17|      7|  ndlz.version = 1;
   18|      7|  ndlz.complib = BLOSC_CODEC_NDLZ;
   19|      7|  ndlz.encoder = &ndlz_compress;
   20|      7|  ndlz.decoder = &ndlz_decompress;
   21|      7|  ndlz.compname = "ndlz";
   22|      7|  register_codec_private(&ndlz);
   23|       |
   24|      7|  blosc2_codec zfp_acc;
   25|      7|  zfp_acc.compcode = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   26|      7|  zfp_acc.version = 1;
   27|      7|  zfp_acc.complib = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   28|      7|  zfp_acc.encoder = &zfp_acc_compress;
   29|      7|  zfp_acc.decoder = &zfp_acc_decompress;
   30|      7|  zfp_acc.compname = "zfp_acc";
   31|      7|  register_codec_private(&zfp_acc);
   32|       |
   33|      7|  blosc2_codec zfp_prec;
   34|      7|  zfp_prec.compcode = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   35|      7|  zfp_prec.version = 1;
   36|      7|  zfp_prec.complib = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   37|      7|  zfp_prec.encoder = &zfp_prec_compress;
   38|      7|  zfp_prec.decoder = &zfp_prec_decompress;
   39|      7|  zfp_prec.compname = "zfp_prec";
   40|      7|  register_codec_private(&zfp_prec);
   41|       |
   42|      7|  blosc2_codec zfp_rate;
   43|      7|  zfp_rate.compcode = BLOSC_CODEC_ZFP_FIXED_RATE;
   44|      7|  zfp_rate.version = 1;
   45|      7|  zfp_rate.complib = BLOSC_CODEC_ZFP_FIXED_RATE;
   46|      7|  zfp_rate.encoder = &zfp_rate_compress;
   47|      7|  zfp_rate.decoder = &zfp_rate_decompress;
   48|      7|  zfp_rate.compname = "zfp_rate";
   49|      7|  register_codec_private(&zfp_rate);
   50|       |
   51|      7|  blosc2_codec openhtj2k;
   52|      7|  openhtj2k.compcode = BLOSC_CODEC_OPENHTJ2K;
   53|      7|  openhtj2k.version = 1;
   54|      7|  openhtj2k.complib = BLOSC_CODEC_OPENHTJ2K;
   55|      7|  openhtj2k.encoder = NULL;
   56|      7|  openhtj2k.decoder = NULL;
   57|      7|  openhtj2k.compname = "openhtj2k";
   58|      7|  register_codec_private(&openhtj2k);
   59|       |
   60|      7|  blosc2_codec grok;
   61|      7|  grok.compcode = BLOSC_CODEC_GROK;
   62|      7|  grok.version = 1;
   63|      7|  grok.complib = BLOSC_CODEC_GROK;
   64|      7|  grok.encoder = NULL;
   65|      7|  grok.decoder = NULL;
   66|      7|  grok.compname = "grok";
   67|      7|  register_codec_private(&grok);
   68|      7|}

register_filters:
   15|      7|void register_filters(void) {
   16|       |
   17|      7|  blosc2_filter ndcell;
   18|      7|  ndcell.id = BLOSC_FILTER_NDCELL;
   19|      7|  ndcell.name = "ndcell";
   20|      7|  ndcell.version = 1;
   21|      7|  ndcell.forward = &ndcell_forward;
   22|      7|  ndcell.backward = &ndcell_backward;
   23|      7|  register_filter_private(&ndcell);
   24|       |
   25|      7|  blosc2_filter ndmean;
   26|      7|  ndmean.id = BLOSC_FILTER_NDMEAN;
   27|      7|  ndmean.name = "ndmean";
   28|      7|  ndmean.version = 1;
   29|      7|  ndmean.forward = &ndmean_forward;
   30|      7|  ndmean.backward = &ndmean_backward;
   31|      7|  register_filter_private(&ndmean);
   32|       |
   33|       |  // Buggy version. See #524
   34|      7|  blosc2_filter bytedelta_buggy;
   35|      7|  bytedelta_buggy.id = BLOSC_FILTER_BYTEDELTA_BUGGY;
   36|      7|  bytedelta_buggy.name = "bytedelta_buggy";
   37|      7|  bytedelta_buggy.version = 1;
   38|      7|  bytedelta_buggy.forward = &bytedelta_forward_buggy;
   39|      7|  bytedelta_buggy.backward = &bytedelta_backward_buggy;
   40|      7|  register_filter_private(&bytedelta_buggy);
   41|       |
   42|       |  // Fixed version. See #524
   43|      7|  blosc2_filter bytedelta;
   44|      7|  bytedelta.id = BLOSC_FILTER_BYTEDELTA;
   45|      7|  bytedelta.name = "bytedelta";
   46|      7|  bytedelta.version = 1;
   47|      7|  bytedelta.forward = &bytedelta_forward;
   48|      7|  bytedelta.backward = &bytedelta_backward;
   49|      7|  register_filter_private(&bytedelta);
   50|       |
   51|      7|  blosc2_filter int_trunc;
   52|      7|  int_trunc.id = BLOSC_FILTER_INT_TRUNC;
   53|      7|  int_trunc.name = "int_trunc";
   54|      7|  int_trunc.version = 1;
   55|      7|  int_trunc.forward = &int_trunc_forward;
   56|      7|  int_trunc.backward = &int_trunc_backward;
   57|      7|  register_filter_private(&int_trunc);
   58|       |
   59|      7|}

register_tuners:
   13|      7|void register_tuners(void) {
   14|       |
   15|      7|  blosc2_tuner btune;
   16|      7|  btune.id = BLOSC_BTUNE;
   17|      7|  btune.name = "btune";
   18|      7|  btune.init = NULL;
   19|      7|  btune.next_cparams = NULL;
   20|      7|  btune.next_blocksize = NULL;
   21|      7|  btune.update = NULL;
   22|      7|  btune.free = NULL;
   23|       |
   24|      7|  register_tuner_private(&btune);
   25|      7|}

LLVMFuzzerTestOneInput:
   11|      7|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   12|      7|  int32_t i = 0, dsize = 0;
   13|      7|  int32_t nchunk = 0;
   14|       |
   15|      7|  blosc2_init();
   16|      7|  blosc2_set_nthreads(1);
   17|       |
   18|       |  /* Create a super-chunk backed by an in-memory frame */
   19|      7|  blosc2_schunk* schunk = blosc2_schunk_from_buffer((uint8_t *) data, (int64_t)size, false);
   20|      7|  if (schunk == NULL) {
  ------------------
  |  Branch (20:7): [True: 2, False: 5]
  ------------------
   21|      2|    blosc2_destroy();
   22|      2|    return 0;
   23|      2|  }
   24|       |  /* Don't allow address sanitizer to allocate more than INT32_MAX */
   25|      5|  if (schunk->nbytes >= INT32_MAX) {
  ------------------
  |  Branch (25:7): [True: 0, False: 5]
  ------------------
   26|      0|    blosc2_schunk_free(schunk);
   27|      0|    blosc2_destroy();
   28|      0|    return 0;
   29|      0|  }
   30|       |  /* Decompress data */
   31|      5|  uint8_t *uncompressed_data = (uint8_t *)malloc((size_t)schunk->nbytes+1);
   32|      5|  if (uncompressed_data != NULL) {
  ------------------
  |  Branch (32:7): [True: 5, False: 0]
  ------------------
   33|     21|    for (i = 0, nchunk = 0; nchunk < schunk->nchunks-1; nchunk++) {
  ------------------
  |  Branch (33:29): [True: 20, False: 1]
  ------------------
   34|     20|      dsize = blosc2_schunk_decompress_chunk(schunk, nchunk, uncompressed_data + i, schunk->chunksize);
   35|     20|      if (dsize < 0) {
  ------------------
  |  Branch (35:11): [True: 4, False: 16]
  ------------------
   36|      4|        printf("Decompression error.  Error code: %d\n", dsize);
   37|      4|        break;
   38|      4|      }
   39|     16|      i += dsize;
   40|     16|    }
   41|       |
   42|      5|    free(uncompressed_data);
   43|      5|  }
   44|       |
   45|      5|  blosc2_schunk_free(schunk);
   46|      5|  blosc2_destroy();
   47|      5|  return 0;
   48|      5|}

