LCOV - code coverage report
Current view: top level - subprojects/tinycdb-0.81 - cdb_seq.c (source / functions) Coverage Total Hit
Test: 2 coverage DB files Lines: 0.0 % 17 0
Test Date: 2025-09-15 13:55:46 Functions: 0.0 % 1 0
Branches: 0.0 % 6 0

             Branch data     Line data    Source code
       1                 :             : /* cdb_seq.c: sequential record retrieval routines
       2                 :             :  *
       3                 :             :  * This file is a part of tinycdb package.
       4                 :             :  * Copyright (C) 2001-2023 Michael Tokarev <mjt+cdb@corpit.ru>
       5                 :             :  *
       6                 :             :  * Permission is hereby granted, free of charge, to any person obtaining a
       7                 :             :  * copy of this software and associated documentation files (the "Software"),
       8                 :             :  * to deal in the Software without restriction, including without limitation
       9                 :             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      10                 :             :  * and/or sell copies of the Software, and to permit persons to whom the
      11                 :             :  * Software is furnished to do so, subject to the following conditions:
      12                 :             :  *
      13                 :             :  * The above copyright notice and this permission notice shall be included
      14                 :             :  * in all copies or substantial portions of the Software.
      15                 :             :  *
      16                 :             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      17                 :             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      18                 :             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      19                 :             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      20                 :             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      21                 :             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      22                 :             :  * DEALINGS IN THE SOFTWARE.
      23                 :             :  */
      24                 :             : 
      25                 :             : #include "cdb_int.h"
      26                 :             : 
      27                 :             : int
      28                 :           0 : cdb_seqnext(unsigned *cptr, struct cdb *cdbp) {
      29                 :             :   unsigned klen, vlen;
      30                 :           0 :   unsigned pos = *cptr;
      31                 :           0 :   unsigned dend = cdbp->cdb_dend;
      32                 :           0 :   const unsigned char *mem = cdbp->cdb_mem;
      33         [ #  # ]:           0 :   if (pos > dend - 8)
      34                 :           0 :     return 0;
      35                 :           0 :   klen = cdb_unpack(mem + pos);
      36                 :           0 :   vlen = cdb_unpack(mem + pos + 4);
      37                 :           0 :   pos += 8;
      38   [ #  #  #  # ]:           0 :   if (dend - klen < pos || dend - vlen < pos + klen)
      39                 :           0 :     return errno = EPROTO, -1;
      40                 :           0 :   cdbp->cdb_kpos = pos;
      41                 :           0 :   cdbp->cdb_klen = klen;
      42                 :           0 :   cdbp->cdb_vpos = pos + klen;
      43                 :           0 :   cdbp->cdb_vlen = vlen;
      44                 :           0 :   *cptr = pos + klen + vlen;
      45                 :           0 :   return 1;
      46                 :             : }
        

Generated by: LCOV version 2.0-1