Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:


check-linux:
if: ${{ false }} # Tests appear to be currently broken on Linux.
runs-on: ubuntu-latest
steps:

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
dnl Process this file with autoconf to produce a configure script
AC_PREREQ([2.69])
AC_INIT([libneo4j-client],[5.0.6])
AC_INIT([libneo4j-client],[5.0.7])
AC_CONFIG_SRCDIR([lib/src/neo4j-client.h.in])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([build-aux/m4])
Expand Down
3 changes: 2 additions & 1 deletion lib/src/neo4j-client.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ char *neo4j_tostring(neo4j_value_t value, char *strbuf, size_t n);
* ensuring it is always `NULL` terminated.
*
* @param [value] The neo4j value.
* @param [strbuf] A buffer to write the string representation into.
* @param [strbuf] A buffer to write the string representation into, or
`NULL` if no string representation should be written.
* @param [n] The length of the buffer.
* @return The number of bytes that would have been written into the buffer
* had the buffer been large enough, or -1 on error (errno will be set).
Expand Down
69 changes: 56 additions & 13 deletions lib/src/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,14 @@ ssize_t neo4j_date_str(const neo4j_value_t *value, char *buf, size_t n)
if (localtime_r(&ntmt, &bdt) == NULL) {
return -1;
}
size_t l = strftime(buf, n, "%Y-%m-%d", &bdt);
size_t l;
if (buf != NULL) {
l = strftime(buf, n, "%Y-%m-%d", &bdt);
}
else {
char buf1[1];
l = strftime(buf1, sizeof(buf1), "%Y-%m-%d", &bdt);
}
if (l==0) {
l = 10;
}
Expand All @@ -1094,12 +1101,13 @@ ssize_t neo4j_date_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_date_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_DATE);
char buf[BUFLEN];
if (neo4j_date_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* time : prints time of day and UTC offset string, with time_t value in parens;
Expand All @@ -1118,7 +1126,14 @@ ssize_t neo4j_time_str(const neo4j_value_t *value, char *buf, size_t n)
free(ntsp);
return -1;
}
size_t l = strftime(buf, n, "%T", &bdt);
size_t l;
if (buf != NULL) {
l = strftime(buf, n, "%T", &bdt);
}
else {
char buf1[1];
l = strftime(buf1, sizeof(buf1), "%T", &bdt);
}
if (l==0) {
l = 8;
}
Expand All @@ -1138,12 +1153,13 @@ ssize_t neo4j_time_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_time_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_TIME);
char buf[BUFLEN];
if (neo4j_time_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* localtime */
Expand All @@ -1160,7 +1176,14 @@ ssize_t neo4j_localtime_str(const neo4j_value_t *value, char *buf, size_t n)
free(ntsp);
return -1;
}
size_t l = strftime(buf, n, "%T", &bdt);
size_t l;
if (buf != NULL) {
l = strftime(buf, n, "%T", &bdt);
}
else {
char buf1[1];
l = strftime(buf1, sizeof(buf1), "%T", &bdt);
}
if (l<=0) {
l = 8;
}
Expand All @@ -1179,12 +1202,13 @@ ssize_t neo4j_localtime_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_localtime_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_LOCALTIME);
char buf[BUFLEN];
if (neo4j_localtime_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* datetime */
Expand All @@ -1203,7 +1227,14 @@ ssize_t neo4j_datetime_str(const neo4j_value_t *value, char *buf, size_t n)
free(ntsp);
return -1;
}
size_t l = strftime(buf, n, "%FT%T", &bdt);
size_t l;
if (buf != NULL) {
l = strftime(buf, n, "%FT%T", &bdt);
}
else {
char buf1[1];
l = strftime(buf1, sizeof(buf1), "%FT%T", &bdt);
}
if (l<=0) {
l = 19;
}
Expand All @@ -1223,12 +1254,13 @@ ssize_t neo4j_datetime_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_datetime_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_DATETIME);
char buf[BUFLEN];
if (neo4j_datetime_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* localdatetime */
Expand All @@ -1245,7 +1277,14 @@ ssize_t neo4j_localdatetime_str(const neo4j_value_t *value, char *buf, size_t n)
free(ntsp);
return -1;
}
size_t l = strftime(buf, n, "%FT%T", &bdt);
size_t l;
if (buf != NULL) {
l = strftime(buf, n, "%FT%T", &bdt);
}
else {
char buf1[1];
l = strftime(buf1, sizeof(buf1), "%FT%T", &bdt);
}
if (l<=0) {
l = 19;
}
Expand All @@ -1264,12 +1303,13 @@ ssize_t neo4j_localdatetime_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_localdatetime_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_LOCALDATETIME);
char buf[BUFLEN];
if (neo4j_localdatetime_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* duration */
Expand Down Expand Up @@ -1357,12 +1397,13 @@ ssize_t neo4j_duration_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_duration_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_DURATION);
char buf[BUFLEN];
if (neo4j_duration_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* point2d */
Expand Down Expand Up @@ -1397,12 +1438,13 @@ ssize_t neo4j_point2d_str(const neo4j_value_t *value, char *buf, size_t n)


ssize_t neo4j_point2d_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_POINT2D);
char buf[BUFLEN];
if (neo4j_point2d_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}

/* point3d */
Expand Down Expand Up @@ -1437,10 +1479,11 @@ ssize_t neo4j_point3d_str(const neo4j_value_t *value, char *buf, size_t n)
}

ssize_t neo4j_point3d_fprint(const neo4j_value_t *value, FILE *stream) {
REQUIRE(value != NULL, -1);
assert(neo4j_type(*value) == NEO4J_POINT3D);
char buf[BUFLEN];
if (neo4j_point3d_str(value, buf, BUFLEN-1) < 0) {
return -1;
}
return fputs( (const char *)buf, stream );
return fprintf( stream, "%s", (const char *)buf );
}
22 changes: 11 additions & 11 deletions lib/src/values.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ neo4j_value_t neo4j_node(const neo4j_value_t fields[4])
{
if (neo4j_type(fields[0]) != NEO4J_IDENTITY ||
neo4j_type(fields[1]) != NEO4J_LIST ||
neo4j_type(fields[2]) != NEO4J_MAP
// || neo4j_type(fields[3]) != NEO4J_ELEMENTID
)
neo4j_type(fields[2]) != NEO4J_MAP ||
neo4j_type(fields[3]) != NEO4J_ELEMENTID
)
{
errno = EINVAL;
return neo4j_null;
Expand Down Expand Up @@ -875,11 +875,11 @@ neo4j_value_t neo4j_relationship(const neo4j_value_t fields[8])
(neo4j_type(fields[2]) != NEO4J_IDENTITY &&
!neo4j_is_null(fields[1])) ||
neo4j_type(fields[3]) != NEO4J_STRING ||
neo4j_type(fields[4]) != NEO4J_MAP
// || neo4j_type(fields[5]) != NEO4J_ELEMENTID ||
// neo4j_type(fields[6]) != NEO4J_ELEMENTID ||
// neo4j_type(fields[7]) != NEO4J_ELEMENTID
)
neo4j_type(fields[4]) != NEO4J_MAP ||
neo4j_type(fields[5]) != NEO4J_ELEMENTID ||
neo4j_type(fields[6]) != NEO4J_ELEMENTID ||
neo4j_type(fields[7]) != NEO4J_ELEMENTID
)
{
errno = EINVAL;
return neo4j_null;
Expand All @@ -897,9 +897,9 @@ neo4j_value_t neo4j_unbound_relationship(const neo4j_value_t fields[4])
{
if (neo4j_type(fields[0]) != NEO4J_IDENTITY ||
neo4j_type(fields[1]) != NEO4J_STRING ||
neo4j_type(fields[2]) != NEO4J_MAP
// // neo4j_type(fields[3]) != NEO4J_ELEMENTID
)
neo4j_type(fields[2]) != NEO4J_MAP ||
neo4j_type(fields[3]) != NEO4J_ELEMENTID
)
{
errno = EINVAL;
return neo4j_null;
Expand Down
4 changes: 2 additions & 2 deletions lib/test/check_result_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static neo4j_iostream_t *client_ios;
static neo4j_iostream_t *server_ios;
static struct neo4j_connection_factory stub_factory;
static neo4j_config_t *config;
neo4j_mpool_t mpool;
neo4j_connection_t *connection;
static neo4j_mpool_t mpool;
static neo4j_connection_t *connection;


static void setup(void)
Expand Down
4 changes: 2 additions & 2 deletions lib/test/check_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ static neo4j_iostream_t *client_ios;
static neo4j_iostream_t *server_ios;
static struct neo4j_connection_factory stub_factory;
static neo4j_config_t *config;
neo4j_mpool_t mpool;
neo4j_connection_t *connection;
static neo4j_mpool_t mpool;
static neo4j_connection_t *connection;


static void setup(void)
Expand Down
Loading