## Coverage Report

#### Created: 2026-04-14 19:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)

    /home/liu/actions-runner/_work/ccv/ccv/lib/io/_ccv_io_binary.inc

    Line
    Count
    Source
    1
    static void _ccv_write_binary_fd(ccv_dense_matrix_t* mat, FILE* fd, void* conf)
    2
    1
    {
    3
    1
      fwrite("CCVBINDM", 1, 8, fd);
    4
    1
      int ctype = mat->type & 0xFFFFF;
    5
    1
      fwrite(&ctype, 1, 4, fd);
    6
    1
      fwrite(&(mat->rows), 1, 4, fd);
    7
    1
      fwrite(&(mat->cols), 1, 4, fd);
    8
    1
      fwrite(mat->data.u8, 1, mat->step * mat->rows, fd);
    9
    1
      fflush(fd);
    10
    1
    }
    11
    12
    static int _ccv_write_plain_stream(ccv_dense_matrix_t* mat, void* buf, size_t len)
    13
    2
    {
    14
    2
      if (len < 20 + mat->step * mat->rows)
    15
    1
        return -1;
    16
    1
      memcpy(buf, "CCVBINDM", 8);
    17
    1
      int ctype = mat->type & 0xFFFFF;
    18
    1
      memcpy(buf + 8, &ctype, 4);
    19
    1
      memcpy(buf + 12, &mat->rows, 4);
    20
    1
      memcpy(buf + 16, &mat->cols, 4);
    21
    1
      memcpy(buf + 20, mat->data.u8, mat->step * mat->rows);
    22
    1
      return 0;
    23
    2
    }
    24
    25
    static void _ccv_read_binary_fd(FILE* in, ccv_dense_matrix_t** x, int type)
    26
    41
    {
    27
      fseek(in, 8, SEEK_SET);
    28
    41
      fread(&type, 1, 4, in);
    29
    41
      int rows, cols;
    30
    41
      fread(&rows, 1, 4, in);
    31
    41
      fread(&cols, 1, 4, in);
    32
    41
      *x = ccv_dense_matrix_new(rows, cols, type, 0, 0);
    33
    41
      fread((*x)->data.u8, 1, (*x)->step * (*x)->rows, in);
    34
    41
    }