1
0

Add 0001-build-resolve-build-failure-due-to-mismatching-types.patch

This commit is contained in:
Jan Engelhardt 2024-11-02 15:28:52 +01:00
parent f9b3aa3ddf
commit d682546e9f
3 changed files with 99 additions and 8 deletions

View File

@ -0,0 +1,88 @@
From 4441b8af44d78cb42135ee8d153212ee58e0caea Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sat, 2 Nov 2024 13:34:05 +0100
Subject: [PATCH] build: resolve build failure due to mismatching types
References: https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/merge-requests/2/
src/constraint.c:104:22: error: assignment to
"void (*)(Constraint *, const char *, intptr_t, const char *, int, TestReporter *)"
{aka "void (*)(struct Constraint_ *, const char *, long int, const char *, int, struct TestReporter_ *)"}
from incompatible pointer type
"void (*)(Constraint *, const char *, const char *, intptr_t, const char *, int, TestReporter *)"
{aka "void (*)(struct Constraint_ *, const char *, const char *, long int, const char *, int, struct TestReporter_ *)"}
[-Wincompatible-pointer-types]
test_dbi.c:4598:19: error: assignment to "time_t" {aka "long int"} from "const
char *" makes integer from pointer without a cast [-Wint-conversion]
4598 | the_date = dbi_result_get_string(result, "the_date");
test_dbi.c:4599:30: error: passing argument 3 of "assert_string_equal_" makes
pointer from integer without a cast [-Wint-conversion]
4599 | assert_string_equal(the_date, "11-jul-1977");
---
tests/cgreen/src/constraint.c | 6 +++---
tests/test_dbi.c | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/cgreen/src/constraint.c b/tests/cgreen/src/constraint.c
index 56c3625..03eec3c 100644
--- a/tests/cgreen/src/constraint.c
+++ b/tests/cgreen/src/constraint.c
@@ -22,7 +22,7 @@ static double unbox_double(intptr_t box);
static double as_double(intptr_t box);
static int compare_using_matcher(Constraint *constraint, intptr_t actual);
-static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t actual, const char *test_file, int test_line, TestReporter *reporter);
+static void test_with_matcher(Constraint *constraint, const char *function, intptr_t actual, const char *test_file, int test_line, TestReporter *reporter);
void destroy_constraint(void *abstract) {
@@ -168,7 +168,7 @@ static int compare_using_matcher(Constraint *constraint, intptr_t actual) {
return matches((void *)actual);
}
-static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {
+static void test_with_matcher(Constraint *constraint, const char *function, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {
(*reporter->assert_true)(
reporter,
test_file,
@@ -176,7 +176,7 @@ static void test_with_matcher(Constraint *constraint, const char *function, cons
(*constraint->compare)(constraint, matcher_function),
"Wanted parameter [%s] to match [%s] in function [%s]",
constraint->parameter,
- matcher_name,
+ constraint->name,
function);
}
diff --git a/tests/test_dbi.c b/tests/test_dbi.c
index c3390ba..7a7aa0b 100644
--- a/tests/test_dbi.c
+++ b/tests/test_dbi.c
@@ -4588,13 +4588,13 @@ Ensure test_dbi_result_get_datetime() {
while (dbi_result_next_row(result)) {
errmsg = NULL;
time_t the_datetime = 0;
- time_t the_date = 0;
- time_t the_time = 0;
the_datetime = dbi_result_get_datetime(result, "the_datetime");
assert_equal( the_datetime, expect_longlong_from_name("the_datetime", cinfo.drivername));
if(!strcmp(cinfo.drivername, "msql")) {
+ const char *the_date, *the_time;
+
the_date = dbi_result_get_string(result, "the_date");
assert_string_equal(the_date, "11-jul-1977");
@@ -4602,6 +4602,8 @@ Ensure test_dbi_result_get_datetime() {
assert_string_equal(the_time, "23:59:59");
}
else {
+ time_t the_date, the_time;
+
the_date = dbi_result_get_datetime(result, "the_date");
assert_equal(the_date, expect_longlong_from_name("the_date", cinfo.drivername));
--
2.47.0

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Nov 2 14:26:48 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
- Add 0001-build-resolve-build-failure-due-to-mismatching-types.patch
-------------------------------------------------------------------
Thu Mar 21 13:22:03 UTC 2019 - Jan Engelhardt <jengelh@inai.de>

View File

@ -28,10 +28,10 @@ Summary: Database drivers for libdbi
License: LGPL-2.1+
Group: Productivity/Databases/Servers
URL: http://libdbi-drivers.sf.net/
#Source: http://downloads.sf.net/libdbi-drivers/%name-%version.tar.gz
Source: %name-%version.tar.xz
Patch1: 0001-build-adjust-configure-for-postgresql-10-11.patch
Patch2: 0001-build-resolve-build-failure-due-to-mismatching-types.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext
@ -60,7 +60,6 @@ libdbi implements a database-independent abstraction layer in C,
similar to the DBI/DBD layer in Perl. Drivers are distributed
separately from the library itself.
%if %build_freetds
%package dbd-freetds
Summary: FreeTDS driver for libdbi
Group: System/Libraries
@ -70,7 +69,6 @@ This driver provides connectivity to FreeTDS database servers
through the libdbi database independent abstraction layer. Switching
a program's driver does not require recompilation or rewriting source
code.
%endif
%package dbd-mysql
Summary: MySQL driver for libdbi
@ -124,7 +122,7 @@ fi
--with-dbi-libdir="%_libdir" \
--disable-static \
--docdir="%_docdir/%name" --disable-docs
make %{?_smp_mflags}
%make_build
%install
%make_install
@ -135,23 +133,23 @@ make check || :
%if %build_freetds
%files dbd-freetds
%doc COPYING
%license COPYING
%dir %_libdir/dbd
%_libdir/dbd/libdbdfreetds.so
%endif
%files dbd-mysql
%doc COPYING
%license COPYING
%dir %_libdir/dbd
%_libdir/dbd/libdbdmysql.so
%files dbd-pgsql
%doc COPYING
%license COPYING
%dir %_libdir/dbd
%_libdir/dbd/libdbdpgsql.so
%files dbd-sqlite3
%doc COPYING
%license COPYING
%dir %_libdir/dbd
%_libdir/dbd/libdbdsqlite3.so