This patch fixes the FTBFS for libopendbx.
The root cause is that the "generic" items in odbx_t and odbx_lo_t are
really FB_API_HANDLE and this is a void* on 32 bit and int on 64 bit.
This code is not strictly portable as it relies on the bitwise
representation of the nullptr being all bits zero. But the added casting
in the patch to fix the FTBFS does not affect the portability concerns.
Other drivers, e.g. mssql, use similar casting of this value.
Additionally, there's a minor change to Makefile.am. I was regularly
hitting a race condition where doxygen was being run multiple times in
parallel due to the multiple targets and sometimes two runs were trying
to create the same directory. If the directory already exists it
succeeded, if it created the directory it succeeded, but if it thought
it needed to create the directory but then the other process created it,
it would fail with an error tht it couldn't create the directory.
The fix avoids doxygen being run multiple times when a single run
generates all the targets.
diff -ur libopendbx.orig/backends/firebird/firebird_basic.c libopendbx/backends/firebird/firebird_basic.c
--- libopendbx.orig/backends/firebird/firebird_basic.c 2010-08-01 02:08:39.000000000 +0000
+++ libopendbx/backends/firebird/firebird_basic.c 2024-08-25 15:38:10.794478511 +0000
@@ -134,7 +134,7 @@
fbc->tr[0] = 0;
fbc->trlevel = 0;
- fbc->stmt = NULL;
+ fbc->stmt = 0;
fbc->numstmt = 0;
param[0] = isc_dpb_version1;
@@ -181,7 +181,7 @@
memcpy( fbc->path + fbc->srvlen, database, len2 + 1 );
- if( isc_attach_database( fbc->status, (short) fbc->srvlen + len2, fbc->path, &(handle->generic), (short) len, param ) != 0 )
+ if( isc_attach_database( fbc->status, (short) fbc->srvlen + len2, fbc->path, (isc_db_handle*)&(handle->generic), (short) len, param ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
@@ -213,7 +213,7 @@
return -ODBX_ERR_BACKEND;
}
- if( isc_detach_database( fbc->status, &(handle->generic) ) != 0 )
+ if( isc_detach_database( fbc->status, (isc_db_handle*)&(handle->generic) ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
@@ -344,8 +344,8 @@
fbc->qda->sqld = 0;
- fbc->stmt = NULL;
- if( isc_dsql_allocate_statement( fbc->status, &(handle->generic), &(fbc->stmt) ) != 0 )
+ fbc->stmt = 0;
+ if( isc_dsql_allocate_statement( fbc->status, (isc_db_handle*)&(handle->generic), &(fbc->stmt) ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
@@ -483,7 +483,7 @@
return -ODBX_ERR_BACKEND;
}
- if( isc_start_transaction( fbc->status, fbc->tr + fbc->trlevel, 1, &(result->handle->generic), sizeof( tbuf ), tbuf ) != 0 )
+ if( isc_start_transaction( fbc->status, fbc->tr + fbc->trlevel, 1, (isc_db_handle*)&(result->handle->generic), sizeof( tbuf ), tbuf ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
@@ -786,7 +786,7 @@
fbc->trlevel++;
fbc->tr[fbc->trlevel] = 0;
- if( isc_start_transaction( fbc->status, fbc->tr + fbc->trlevel, 1, &(handle->generic), sizeof( tbuf ), tbuf ) != 0 )
+ if( isc_start_transaction( fbc->status, fbc->tr + fbc->trlevel, 1, (isc_db_handle*)&(handle->generic), sizeof( tbuf ), tbuf ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
diff -ur libopendbx.orig/backends/firebird/firebird_lo.c libopendbx/backends/firebird/firebird_lo.c
--- libopendbx.orig/backends/firebird/firebird_lo.c 2010-08-01 02:08:39.000000000 +0000
+++ libopendbx/backends/firebird/firebird_lo.c 2024-08-25 15:29:51.726699041 +0000
@@ -47,7 +47,7 @@
(*lo)->generic = NULL;
(*lo)->result = result;
- if( isc_open_blob2( fbc->status, &(result->handle->generic), fbc->tr + fbc->trlevel, &((*lo)->generic), (ISC_QUAD*) value, 0, NULL ) != 0 )
+ if( isc_open_blob2( fbc->status, (isc_db_handle*)&(result->handle->generic), fbc->tr + fbc->trlevel, (isc_blob_handle*)&((*lo)->generic), (ISC_QUAD*) value, 0, NULL ) != 0 )
{
free( *lo );
*lo = NULL;
@@ -62,7 +62,7 @@
static int firebird_odbx_lo_close( odbx_lo_t* lo )
{
- if( isc_close_blob( ((struct fbconn*) lo->result->handle->aux)->status, &(lo->generic) ) != 0 )
+ if( isc_close_blob( ((struct fbconn*) lo->result->handle->aux)->status, (isc_blob_handle*)&(lo->generic) ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
@@ -104,7 +104,7 @@
if( buflen > 0xFFFF ) { len = 0xFFFF; }
else { len = buflen; }
- err = isc_get_segment( fbc->status, &(lo->generic), &bytes, len, (char*) buffer );
+ err = isc_get_segment( fbc->status, (isc_blob_handle*)&(lo->generic), &bytes, len, (char*) buffer );
if( fbc->status[1] == isc_segstr_eof ) { return 0; }
if( err != 0 ) { return -ODBX_ERR_BACKEND; }
@@ -122,7 +122,7 @@
if( buflen > 0xFFFF ) { len = 0xFFFF; }
else { len = (unsigned short) buflen; }
- if( isc_put_segment( fbc->status, &(lo->generic), len, (char*) buffer ) != 0 )
+ if( isc_put_segment( fbc->status, (isc_blob_handle*)&(lo->generic), len, (char*) buffer ) != 0 )
{
return -ODBX_ERR_BACKEND;
}
diff -ur libopendbx.orig/doc/Makefile.am libopendbx/doc/Makefile.am
--- libopendbx.orig/doc/Makefile.am 2010-08-01 02:08:41.000000000 +0000
+++ libopendbx/doc/Makefile.am 2024-08-25 17:43:34.014821512 +0000
@@ -6,7 +6,7 @@
odbx_bind.3 odbx_capabilities.3 odbx_column_count.3 odbx_column_name.3 odbx_column_type.3 odbx_error.3 odbx_error_type.3 odbx_escape.3 odbx_field_length.3 odbx_field_value.3 odbx_finish.3 odbx_get_option.3 odbx_init.3 odbx_query.3 odbx_result.3 odbx_result_finish.3 odbx_row_fetch.3 odbx_rows_affected.3 odbx_set_option.3 odbx_unbind.3 odbx_lo_open.3 odbx_lo_close.3 odbx_lo_read.3 odbx_lo_write.3: opendbx.en.xml
db2x_xsltproc -s man opendbx.en.xml | db2x_manxml --solinks
-man/man3/OpenDBX.3 man/man3/OpenDBX_Conn.3 man/man3/OpenDBX_Exception.3 man/man3/OpenDBX_Lob.3 man/man3/OpenDBX_Result.3 man/man3/OpenDBX_Stmt.3: ../lib/opendbx/api
+man/man3/OpenDBX.3 man/man3/OpenDBX_Conn.3 man/man3/OpenDBX_Exception.3 man/man3/OpenDBX_Lob.3 man/man3/OpenDBX_Result.3 man/man3/OpenDBX_Stmt.3 &: ../lib/opendbx/api
doxygen Doxyfile > /dev/null
clean: