freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] patch to fix -Wold-style-cast in headers
- From: christos AT zoulas.com (Christos Zoulas)
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] patch to fix -Wold-style-cast in headers
- Date: Mon, 9 May 2005 09:25:13 -0400
Hi,
The following changes the header files to use new-style c++ casts when
appropriate.
christos
PS:
It would be nice if you made your CVS Id's $FreeTDS$ too :-)
Index: cspublic.h
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/include/cspublic.h,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -r1.13 -r1.15
--- cspublic.h 14 Apr 2005 15:15:32 -0000 1.13
+++ cspublic.h 9 May 2005 13:08:17 -0000 1.15
@@ -21,14 +21,17 @@
#define _cspublic_h_
#ifdef __cplusplus
+# define STATIC_CAST(type, a) static_cast<type>(a)
extern "C"
{
#if 0
}
#endif
+#else
+# define STATIC_CAST(type, a) ((type)(a))
#endif
-static const char rcsid_cspublic_h[] = "$Id: cspublic.h,v 1.13 2005/04/14
15:15:32 christos Exp $";
+static const char rcsid_cspublic_h[] = "$Id: cspublic.h,v 1.15 2005/05/09
13:08:17 christos Exp $";
static const void *const no_unused_cspublic_h_warn[] = { rcsid_cspublic_h,
no_unused_cspublic_h_warn };
#include <cstypes.h>
@@ -59,7 +62,7 @@
typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *,
CS_SERVERMSG *);
-#define CS_IODATA (CS_INT)1600
+#define CS_IODATA STATIC_CAST(CS_INT, 1600)
#define CS_SRC_VALUE -2562
@@ -265,24 +268,24 @@
#define CS_IMPLICIT_CURSOR 8
#define CS_CURSOR_CLOSE 9
-#define CS_FOR_UPDATE (CS_INT)0x1
-#define CS_READ_ONLY (CS_INT)0x2
-#define CS_RESTORE_OPEN (CS_INT)0x8
-
-
-#define CS_CURSTAT_NONE (CS_INT)0x0
-#define CS_CURSTAT_DECLARED (CS_INT)0x1
-#define CS_CURSTAT_OPEN (CS_INT)0x2
-#define CS_CURSTAT_CLOSED (CS_INT)0x4
-#define CS_CURSTAT_RDONLY (CS_INT)0x8
-#define CS_CURSTAT_UPDATABLE (CS_INT)0x10
-#define CS_CURSTAT_ROWCOUNT (CS_INT)0x20
-#define CS_CURSTAT_DEALLOC (CS_INT)0x40
-
-#define CS_CUR_STATUS (CS_INT)9126
-#define CS_CUR_ID (CS_INT)9127
-#define CS_CUR_NAME (CS_INT)9128
-#define CS_CUR_ROWCOUNT (CS_INT)9129
+#define CS_FOR_UPDATE STATIC_CAST(CS_INT, 0x1)
+#define CS_READ_ONLY STATIC_CAST(CS_INT, 0x2)
+#define CS_RESTORE_OPEN STATIC_CAST(CS_INT, 0x8)
+
+
+#define CS_CURSTAT_NONE STATIC_CAST(CS_INT, 0x0)
+#define CS_CURSTAT_DECLARED STATIC_CAST(CS_INT, 0x1)
+#define CS_CURSTAT_OPEN STATIC_CAST(CS_INT, 0x2)
+#define CS_CURSTAT_CLOSED STATIC_CAST(CS_INT, 0x4)
+#define CS_CURSTAT_RDONLY STATIC_CAST(CS_INT, 0x8)
+#define CS_CURSTAT_UPDATABLE STATIC_CAST(CS_INT, 0x10)
+#define CS_CURSTAT_ROWCOUNT STATIC_CAST(CS_INT, 0x20)
+#define CS_CURSTAT_DEALLOC STATIC_CAST(CS_INT, 0x40)
+
+#define CS_CUR_STATUS STATIC_CAST(CS_INT, 9126)
+#define CS_CUR_ID STATIC_CAST(CS_INT, 9127)
+#define CS_CUR_NAME STATIC_CAST(CS_INT, 9128)
+#define CS_CUR_ROWCOUNT STATIC_CAST(CS_INT, 9129)
/* options accepted by ct_options() */
#define CS_OPT_ANSINULL 1
@@ -471,14 +474,14 @@
#define CS_DEF_PREC 18
/* Error Severities */
-#define CS_SV_INFORM (CS_INT)0
-#define CS_SV_API_FAIL (CS_INT)1
-#define CS_SV_RETRY_FAIL (CS_INT)2
-#define CS_SV_RESOURCE_FAIL (CS_INT)3
-#define CS_SV_CONFIG_FAIL (CS_INT)4
-#define CS_SV_COMM_FAIL (CS_INT)5
-#define CS_SV_INTERNAL_FAIL (CS_INT)6
-#define CS_SV_FATAL (CS_INT)7
+#define CS_SV_INFORM STATIC_CAST(CS_INT, 0)
+#define CS_SV_API_FAIL STATIC_CAST(CS_INT, 1)
+#define CS_SV_RETRY_FAIL STATIC_CAST(CS_INT, 2)
+#define CS_SV_RESOURCE_FAIL STATIC_CAST(CS_INT, 3)
+#define CS_SV_CONFIG_FAIL STATIC_CAST(CS_INT, 4)
+#define CS_SV_COMM_FAIL STATIC_CAST(CS_INT, 5)
+#define CS_SV_INTERNAL_FAIL STATIC_CAST(CS_INT, 6)
+#define CS_SV_FATAL STATIC_CAST(CS_INT, 7)
/* result_types */
#define CS_COMPUTE_RESULT 4045
@@ -492,36 +495,36 @@
#define CS_DESCRIBE_RESULT 4051
/* bind types */
-#define CS_ILLEGAL_TYPE (CS_INT)(-1)
-#define CS_CHAR_TYPE (CS_INT)0
-#define CS_BINARY_TYPE (CS_INT)1
-#define CS_LONGCHAR_TYPE (CS_INT)2
-#define CS_LONGBINARY_TYPE (CS_INT)3
-#define CS_TEXT_TYPE (CS_INT)4
-#define CS_IMAGE_TYPE (CS_INT)5
-#define CS_TINYINT_TYPE (CS_INT)6
-#define CS_SMALLINT_TYPE (CS_INT)7
-#define CS_INT_TYPE (CS_INT)8
-#define CS_REAL_TYPE (CS_INT)9
-#define CS_FLOAT_TYPE (CS_INT)10
-#define CS_BIT_TYPE (CS_INT)11
-#define CS_DATETIME_TYPE (CS_INT)12
-#define CS_DATETIME4_TYPE (CS_INT)13
-#define CS_MONEY_TYPE (CS_INT)14
-#define CS_MONEY4_TYPE (CS_INT)15
-#define CS_NUMERIC_TYPE (CS_INT)16
-#define CS_DECIMAL_TYPE (CS_INT)17
-#define CS_VARCHAR_TYPE (CS_INT)18
-#define CS_VARBINARY_TYPE (CS_INT)19
-#define CS_LONG_TYPE (CS_INT)20
-#define CS_SENSITIVITY_TYPE (CS_INT)21
-#define CS_BOUNDARY_TYPE (CS_INT)22
-#define CS_VOID_TYPE (CS_INT)23
-#define CS_USHORT_TYPE (CS_INT)24
-#define CS_UNIQUE_TYPE (CS_INT)25
-#define CS_UNICHAR_TYPE (CS_INT)26
+#define CS_ILLEGAL_TYPE STATIC_CAST(CS_INT, -1)
+#define CS_CHAR_TYPE STATIC_CAST(CS_INT, 0)
+#define CS_BINARY_TYPE STATIC_CAST(CS_INT, 1)
+#define CS_LONGCHAR_TYPE STATIC_CAST(CS_INT, 2)
+#define CS_LONGBINARY_TYPE STATIC_CAST(CS_INT, 3)
+#define CS_TEXT_TYPE STATIC_CAST(CS_INT, 4)
+#define CS_IMAGE_TYPE STATIC_CAST(CS_INT, 5)
+#define CS_TINYINT_TYPE STATIC_CAST(CS_INT, 6)
+#define CS_SMALLINT_TYPE STATIC_CAST(CS_INT, 7)
+#define CS_INT_TYPE STATIC_CAST(CS_INT, 8)
+#define CS_REAL_TYPE STATIC_CAST(CS_INT, 9)
+#define CS_FLOAT_TYPE STATIC_CAST(CS_INT, 10)
+#define CS_BIT_TYPE STATIC_CAST(CS_INT, 11)
+#define CS_DATETIME_TYPE STATIC_CAST(CS_INT, 12)
+#define CS_DATETIME4_TYPE STATIC_CAST(CS_INT, 13)
+#define CS_MONEY_TYPE STATIC_CAST(CS_INT, 14)
+#define CS_MONEY4_TYPE STATIC_CAST(CS_INT, 15)
+#define CS_NUMERIC_TYPE STATIC_CAST(CS_INT, 16)
+#define CS_DECIMAL_TYPE STATIC_CAST(CS_INT, 17)
+#define CS_VARCHAR_TYPE STATIC_CAST(CS_INT, 18)
+#define CS_VARBINARY_TYPE STATIC_CAST(CS_INT, 19)
+#define CS_LONG_TYPE STATIC_CAST(CS_INT, 20)
+#define CS_SENSITIVITY_TYPE STATIC_CAST(CS_INT, 21)
+#define CS_BOUNDARY_TYPE STATIC_CAST(CS_INT, 22)
+#define CS_VOID_TYPE STATIC_CAST(CS_INT, 23)
+#define CS_USHORT_TYPE STATIC_CAST(CS_INT, 24)
+#define CS_UNIQUE_TYPE STATIC_CAST(CS_INT, 25)
+#define CS_UNICHAR_TYPE STATIC_CAST(CS_INT, 26)
-#define CS_USER_TYPE (CS_INT)100
+#define CS_USER_TYPE STATIC_CAST(CS_INT, 100)
/* cs_dt_info type values */
enum
{
Index: ctpublic.h
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/include/ctpublic.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ctpublic.h 14 Apr 2005 15:15:32 -0000 1.9
+++ ctpublic.h 9 May 2005 13:04:43 -0000 1.10
@@ -25,57 +25,57 @@
/*
** define for each CT-Lib API
*/
-#define CT_BIND (CS_INT) 0
-#define CT_BR_COLUMN (CS_INT) 1
-#define CT_BR_TABLE (CS_INT) 2
-#define CT_CALLBACK (CS_INT) 3
-#define CT_CANCEL (CS_INT) 4
-#define CT_CAPABILITY (CS_INT) 5
-#define CT_CLOSE (CS_INT) 6
-#define CT_CMD_ALLOC (CS_INT) 7
-#define CT_CMD_DROP (CS_INT) 8
-#define CT_CMD_PROPS (CS_INT) 9
-#define CT_COMMAND (CS_INT) 10
-#define CT_COMPUTE_INFO (CS_INT) 11
-#define CT_CON_ALLOC (CS_INT) 12
-#define CT_CON_DROP (CS_INT) 13
-#define CT_CON_PROPS (CS_INT) 14
-#define CT_CON_XFER (CS_INT) 15
-#define CT_CONFIG (CS_INT) 16
-#define CT_CONNECT (CS_INT) 17
-#define CT_CURSOR (CS_INT) 18
-#define CT_DATA_INFO (CS_INT) 19
-#define CT_DEBUG (CS_INT) 20
-#define CT_DESCRIBE (CS_INT) 21
-#define CT_DIAG (CS_INT) 22
-#define CT_DYNAMIC (CS_INT) 23
-#define CT_DYNDESC (CS_INT) 24
-#define CT_EXIT (CS_INT) 25
-#define CT_FETCH (CS_INT) 26
-#define CT_GET_DATA (CS_INT) 27
-#define CT_GETFORMAT (CS_INT) 28
-#define CT_GETLOGINFO (CS_INT) 29
-#define CT_INIT (CS_INT) 30
-#define CT_KEYDATA (CS_INT) 31
-#define CT_OPTIONS (CS_INT) 32
-#define CT_PARAM (CS_INT) 33
-#define CT_POLL (CS_INT) 34
-#define CT_RECVPASSTHRU (CS_INT) 35
-#define CT_REMOTE_PWD (CS_INT) 36
-#define CT_RES_INFO (CS_INT) 37
-#define CT_RESULTS (CS_INT) 38
-#define CT_SEND (CS_INT) 39
-#define CT_SEND_DATA (CS_INT) 40
-#define CT_SENDPASSTHRU (CS_INT) 41
-#define CT_SETLOGINFO (CS_INT) 42
-#define CT_WAKEUP (CS_INT) 43
-#define CT_LABELS (CS_INT) 44
-#define CT_DS_LOOKUP (CS_INT) 45
-#define CT_DS_DROP (CS_INT) 46
-#define CT_DS_OBJINFO (CS_INT) 47
-#define CT_SETPARAM (CS_INT) 48
-#define CT_DYNSQLDA (CS_INT) 49
-#define CT_NOTIFICATION (CS_INT) 1000
+#define CT_BIND STATIC_CAST(CS_INT, 0)
+#define CT_BR_COLUMN STATIC_CAST(CS_INT, 1)
+#define CT_BR_TABLE STATIC_CAST(CS_INT, 2)
+#define CT_CALLBACK STATIC_CAST(CS_INT, 3)
+#define CT_CANCEL STATIC_CAST(CS_INT, 4)
+#define CT_CAPABILITY STATIC_CAST(CS_INT, 5)
+#define CT_CLOSE STATIC_CAST(CS_INT, 6)
+#define CT_CMD_ALLOC STATIC_CAST(CS_INT, 7)
+#define CT_CMD_DROP STATIC_CAST(CS_INT, 8)
+#define CT_CMD_PROPS STATIC_CAST(CS_INT, 9)
+#define CT_COMMAND STATIC_CAST(CS_INT, 10)
+#define CT_COMPUTE_INFO STATIC_CAST(CS_INT, 11)
+#define CT_CON_ALLOC STATIC_CAST(CS_INT, 12)
+#define CT_CON_DROP STATIC_CAST(CS_INT, 13)
+#define CT_CON_PROPS STATIC_CAST(CS_INT, 14)
+#define CT_CON_XFER STATIC_CAST(CS_INT, 15)
+#define CT_CONFIG STATIC_CAST(CS_INT, 16)
+#define CT_CONNECT STATIC_CAST(CS_INT, 17)
+#define CT_CURSOR STATIC_CAST(CS_INT, 18)
+#define CT_DATA_INFO STATIC_CAST(CS_INT, 19)
+#define CT_DEBUG STATIC_CAST(CS_INT, 20)
+#define CT_DESCRIBE STATIC_CAST(CS_INT, 21)
+#define CT_DIAG STATIC_CAST(CS_INT, 22)
+#define CT_DYNAMIC STATIC_CAST(CS_INT, 23)
+#define CT_DYNDESC STATIC_CAST(CS_INT, 24)
+#define CT_EXIT STATIC_CAST(CS_INT, 25)
+#define CT_FETCH STATIC_CAST(CS_INT, 26)
+#define CT_GET_DATA STATIC_CAST(CS_INT, 27)
+#define CT_GETFORMAT STATIC_CAST(CS_INT, 28)
+#define CT_GETLOGINFO STATIC_CAST(CS_INT, 29)
+#define CT_INIT STATIC_CAST(CS_INT, 30)
+#define CT_KEYDATA STATIC_CAST(CS_INT, 31)
+#define CT_OPTIONS STATIC_CAST(CS_INT, 32)
+#define CT_PARAM STATIC_CAST(CS_INT, 33)
+#define CT_POLL STATIC_CAST(CS_INT, 34)
+#define CT_RECVPASSTHRU STATIC_CAST(CS_INT, 35)
+#define CT_REMOTE_PWD STATIC_CAST(CS_INT, 36)
+#define CT_RES_INFO STATIC_CAST(CS_INT, 37)
+#define CT_RESULTS STATIC_CAST(CS_INT, 38)
+#define CT_SEND STATIC_CAST(CS_INT, 39)
+#define CT_SEND_DATA STATIC_CAST(CS_INT, 40)
+#define CT_SENDPASSTHRU STATIC_CAST(CS_INT, 41)
+#define CT_SETLOGINFO STATIC_CAST(CS_INT, 42)
+#define CT_WAKEUP STATIC_CAST(CS_INT, 43)
+#define CT_LABELS STATIC_CAST(CS_INT, 44)
+#define CT_DS_LOOKUP STATIC_CAST(CS_INT, 45)
+#define CT_DS_DROP STATIC_CAST(CS_INT, 46)
+#define CT_DS_OBJINFO STATIC_CAST(CS_INT, 47)
+#define CT_SETPARAM STATIC_CAST(CS_INT, 48)
+#define CT_DYNSQLDA STATIC_CAST(CS_INT, 49)
+#define CT_NOTIFICATION STATIC_CAST(CS_INT, 1000)
#ifdef __cplusplus
extern "C"
@@ -85,7 +85,7 @@
#endif
#endif
-static const char rcsid_ctpublic_h[] = "$Id: ctpublic.h,v 1.9 2005/04/14
15:15:32 christos Exp $";
+static const char rcsid_ctpublic_h[] = "$Id: ctpublic.h,v 1.10 2005/05/09
13:04:43 christos Exp $";
static const void *const no_unused_ctpublic_h_warn[] = { rcsid_ctpublic_h,
no_unused_ctpublic_h_warn };
Index: sybdb.h
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/include/sybdb.h,v
retrieving revision 1.1.1.9
retrieving revision 1.2
diff -u -r1.1.1.9 -r1.2
--- sybdb.h 14 Apr 2005 15:08:41 -0000 1.1.1.9
+++ sybdb.h 9 May 2005 13:04:43 -0000 1.2
@@ -30,7 +30,7 @@
#endif
#endif
-static const char rcsid_sybdb_h[] = "$Id: sybdb.h,v 1.1.1.9 2005/04/14
15:08:41 christos Exp $";
+static const char rcsid_sybdb_h[] = "$Id: sybdb.h,v 1.2 2005/05/09 13:04:43
christos Exp $";
static const void *const no_unused_sybdb_h_warn[] = { rcsid_sybdb_h,
no_unused_sybdb_h_warn };
/**
@@ -448,8 +448,8 @@
#define DBBOTH 2
/* remote procedure call (rpc) options */
-#define DBRPCRECOMPILE ((DBSMALLINT) 0x0001)
-#define DBRPCRESET ((DBSMALLINT) 0x0002)
+#define DBRPCRECOMPILE STATIC_CAST(DBSMALLINT, 0x0001)
+#define DBRPCRESET STATIC_CAST(DBSMALLINT, 0x0002)
DBBOOL db12hour(DBPROCESS * dbprocess, char *language);
BYTE *dbadata(DBPROCESS * dbproc, int computeid, int column);
Index: tdsodbc.h
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/include/tdsodbc.h,v
retrieving revision 1.1.1.9
retrieving revision 1.2
diff -u -r1.1.1.9 -r1.2
--- tdsodbc.h 14 Apr 2005 15:08:41 -0000 1.1.1.9
+++ tdsodbc.h 9 May 2005 13:04:43 -0000 1.2
@@ -54,7 +54,7 @@
#endif
#endif
-/* $Id: tdsodbc.h,v 1.1.1.9 2005/04/14 15:08:41 christos Exp $ */
+/* $Id: tdsodbc.h,v 1.2 2005/05/09 13:04:43 christos Exp $ */
struct _sql_error
{
@@ -341,10 +341,10 @@
typedef struct _hstmt TDS_STMT;
typedef struct _hchk TDS_CHK;
-#define IS_HENV(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_ENV)
-#define IS_HDBC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DBC)
-#define IS_HSTMT(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_STMT)
-#define IS_HDESC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DESC)
+#define IS_HENV(x) (STATIC_CAST(TDS_CHK *), x)->htype == SQL_HANDLE_ENV)
+#define IS_HDBC(x) (STATIC_CAST(TDS_CHK *), x)->htype == SQL_HANDLE_DBC)
+#define IS_HSTMT(x) (STATIC_CAST(TDS_CHK *), x)->htype == SQL_HANDLE_STMT)
+#define IS_HDESC(x) (STATIC_CAST(TDS_CHK *), x)->htype == SQL_HANDLE_DESC)
TDS_DESC *desc_alloc(SQLHANDLE parent, int desc_type, int alloc_type);
SQLRETURN desc_free(TDS_DESC * desc);
Index: tdsstring.h
===================================================================
RCS file: /src/twosigma/cvsroot/external/public/freetds/include/tdsstring.h,v
retrieving revision 1.1.1.6
retrieving revision 1.2
diff -u -r1.1.1.6 -r1.2
--- tdsstring.h 14 Apr 2005 15:08:41 -0000 1.1.1.6
+++ tdsstring.h 9 May 2005 13:04:43 -0000 1.2
@@ -20,7 +20,7 @@
#ifndef _tdsstring_h_
#define _tdsstring_h_
-/* $Id: tdsstring.h,v 1.1.1.6 2005/04/14 15:08:41 christos Exp $ */
+/* $Id: tdsstring.h,v 1.2 2005/05/09 13:04:43 christos Exp $ */
extern char tds_str_empty[];
@@ -38,7 +38,7 @@
#else
/** init a string with empty */
#define tds_dstr_init(s) \
- do { *(s) = (DSTR) &tds_str_empty[0]; } while(0)
+ do { *(s) = STATIC_CAST(DSTR, &tds_str_empty[0]); } while(0)
/** test if string is empty */
#define tds_dstr_isempty(s) \
-
[freetds] patch to fix -Wold-style-cast in headers,
Christos Zoulas, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
entropy, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
Christos Zoulas, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
James K. Lowden, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
Christos Zoulas, 05/09/2005
- Re: [freetds] patch to fix -Wold-style-cast in headers, entropy, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
Christos Zoulas, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
James K. Lowden, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
Christos Zoulas, 05/09/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
Frediano Ziglio, 05/28/2005
- Re: [freetds] patch to fix -Wold-style-cast in headers, Christos Zoulas, 05/28/2005
-
Re: [freetds] patch to fix -Wold-style-cast in headers,
entropy, 05/09/2005
Archive powered by MHonArc 2.6.24.