Skip to content

Commit

Permalink
Fix multiple empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
joente committed Sep 23, 2024
1 parent b72d3c7 commit 20016aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/siri/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define SIRIDB_VERSION_MAJOR 2
#define SIRIDB_VERSION_MINOR 0
#define SIRIDB_VERSION_PATCH 51
#define SIRIDB_VERSION_PATCH 52

/*
* Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions.
Expand All @@ -15,7 +15,7 @@
* Note that debian alpha packages should use versions like this:
* 2.0.34-0alpha0
*/
#define SIRIDB_VERSION_PRE_RELEASE ""
#define SIRIDB_VERSION_PRE_RELEASE "-alpha-0"

#ifndef NDEBUG
#define SIRIDB_VERSION_BUILD_RELEASE "+debug"
Expand Down
13 changes: 6 additions & 7 deletions src/siri/db/points.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ static int POINTS_unpack_string(
{
/* literal */
size_t len = (is_ascii) ? 0 : POINTS_dec_len(&pt);

do
{
*buf = *pt;
Expand Down Expand Up @@ -1228,12 +1227,6 @@ int siridb_points_unzip_string(
memcpy(&point->ts, pt, sizeof(uint64_t));
pt += sizeof(uint64_t);

buf = malloc(src_sz);
if (buf == NULL)
{
return -1;
}

for (mask = 0; tshift-- > tcount; ++pt)
{
mask |= ((uint64_t) *pt) << (tshift * 8);
Expand Down Expand Up @@ -1265,6 +1258,12 @@ int siridb_points_unzip_string(

n -= i;

buf = malloc(src_sz + n);
if (buf == NULL)
{
return -1;
}

if (POINTS_unpack_string(
points->data + points->len, n, i, bits + offset, buf))
{
Expand Down

0 comments on commit 20016aa

Please sign in to comment.