[ruby-oci8-commit] [486] trunk/ruby-oci8: suppress gcc-4. 6 warnings and update the version to 2.1.0.

nobody at rubyforge.org nobody at rubyforge.org
Tue Dec 13 05:32:11 EST 2011


Revision: 486
Author:   kubo
Date:     2011-12-13 05:32:09 -0500 (Tue, 13 Dec 2011)

Log Message:
-----------
suppress gcc-4.6 warnings and update the version to 2.1.0.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/VERSION
    trunk/ruby-oci8/ext/oci8/error.c
    trunk/ruby-oci8/ext/oci8/oci8.c
    trunk/ruby-oci8/ext/oci8/oci8.h
    trunk/ruby-oci8/ext/oci8/ocidatetime.c
    trunk/ruby-oci8/ext/oci8/ocinumber.c
    trunk/ruby-oci8/ext/oci8/stmt.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ChangeLog	2011-12-13 10:32:09 UTC (rev 486)
@@ -1,3 +1,8 @@
+2011-12-13  KUBO Takehiro  <kubo at jiubao.org>
+	* VERSION: update to 2.1.0.
+	* ext/oci8/error.c, ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/ocidatetime.c,
+	  ext/oci8/ocinumber.c, ext/oci8/stmt.c: suppress gcc-4.6 warnings.
+
 2011-12-11  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/connection_pool.c: fix a buffer overrun in oci8_cpool_initialize().
 

Modified: trunk/ruby-oci8/VERSION
===================================================================
--- trunk/ruby-oci8/VERSION	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/VERSION	2011-12-13 10:32:09 UTC (rev 486)
@@ -1 +1 @@
-2.1.x
+2.1.0

Modified: trunk/ruby-oci8/ext/oci8/error.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/error.c	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/error.c	2011-12-13 10:32:09 UTC (rev 486)
@@ -244,7 +244,7 @@
 
     if (have_OCIMessageGet) {
         if (msghp == NULL) {
-            chkerr(OCIMessageOpen(oci8_envhp, oci8_errhp, &msghp, TO_ORATEXT("rdbms"), TO_ORATEXT("ora"), OCI_DURATION_PROCESS));
+            chkerr(OCIMessageOpen(oci8_envhp, oci8_errhp, &msghp, TO_CONST_ORATEXT("rdbms"), TO_CONST_ORATEXT("ora"), OCI_DURATION_PROCESS));
         }
         errmsg = TO_CHARPTR(OCIMessageGet(msghp, msgno, NULL, 0));
     }

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2011-12-13 10:32:09 UTC (rev 486)
@@ -830,7 +830,7 @@
  */
 static VALUE oci8_set_client_identifier(VALUE self, VALUE val)
 {
-    char *ptr;
+    const char *ptr;
     ub4 size;
 
     if (!NIL_P(val)) {
@@ -846,7 +846,7 @@
         if (size > 0 && ptr[0] == ':') {
             rb_raise(rb_eArgError, "client identifier should not start with ':'.");
         }
-        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, ptr,
+        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, (dvoid*)ptr,
                           size, OCI_ATTR_CLIENT_IDENTIFIER, oci8_errhp),
                DATA_PTR(self));
     } else {
@@ -854,7 +854,7 @@
         oci8_exec_sql_var_t bind_vars[1];
 
         /* :client_id */
-        bind_vars[0].valuep = ptr;
+        bind_vars[0].valuep = (dvoid*)ptr;
         bind_vars[0].value_sz = size;
         bind_vars[0].dty = SQLT_CHR;
         bind_vars[0].indp = NULL;
@@ -904,7 +904,7 @@
  */
 static VALUE oci8_set_module(VALUE self, VALUE val)
 {
-    char *ptr;
+    const char *ptr;
     ub4 size;
 
     if (!NIL_P(val)) {
@@ -917,7 +917,7 @@
     }
     if (oracle_client_version >= ORAVER_10_1) {
         /* Oracle 10g or upper */
-        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, ptr,
+        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, (dvoid*)ptr,
                           size, OCI_ATTR_MODULE, oci8_errhp),
                DATA_PTR(self));
     } else {
@@ -925,7 +925,7 @@
         oci8_exec_sql_var_t bind_vars[1];
 
         /* :module */
-        bind_vars[0].valuep = ptr;
+        bind_vars[0].valuep = (dvoid*)ptr;
         bind_vars[0].value_sz = size;
         bind_vars[0].dty = SQLT_CHR;
         bind_vars[0].indp = NULL;
@@ -974,7 +974,7 @@
  */
 static VALUE oci8_set_action(VALUE self, VALUE val)
 {
-    char *ptr;
+    const char *ptr;
     ub4 size;
 
     if (!NIL_P(val)) {
@@ -987,7 +987,7 @@
     }
     if (oracle_client_version >= ORAVER_10_1) {
         /* Oracle 10g or upper */
-        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, ptr,
+        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, (dvoid*)ptr,
                           size, OCI_ATTR_ACTION, oci8_errhp),
                DATA_PTR(self));
     } else {
@@ -995,7 +995,7 @@
         oci8_exec_sql_var_t bind_vars[1];
 
         /* :action */
-        bind_vars[0].valuep = ptr;
+        bind_vars[0].valuep = (dvoid*)ptr;
         bind_vars[0].value_sz = size;
         bind_vars[0].dty = SQLT_CHR;
         bind_vars[0].indp = NULL;
@@ -1037,7 +1037,7 @@
  */
 static VALUE oci8_set_client_info(VALUE self, VALUE val)
 {
-    char *ptr;
+    const char *ptr;
     ub4 size;
 
     if (!NIL_P(val)) {
@@ -1050,7 +1050,7 @@
     }
     if (oracle_client_version >= ORAVER_10_1) {
         /* Oracle 10g or upper */
-        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, ptr,
+        chker2(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, (dvoid*)ptr,
                           size, OCI_ATTR_CLIENT_INFO, oci8_errhp),
                DATA_PTR(self));
     } else {
@@ -1058,7 +1058,7 @@
         oci8_exec_sql_var_t bind_vars[1];
 
         /* :client_info */
-        bind_vars[0].valuep = ptr;
+        bind_vars[0].valuep = (dvoid*)ptr;
         bind_vars[0].value_sz = size;
         bind_vars[0].dty = SQLT_CHR;
         bind_vars[0].indp = NULL;

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2011-12-13 10:32:09 UTC (rev 486)
@@ -220,17 +220,23 @@
 #define IS_OCI_ERROR(v) (((v) != OCI_SUCCESS) && ((v) != OCI_SUCCESS_WITH_INFO))
 #ifdef ALWAYS_INLINE
 #define TO_ORATEXT to_oratext
+#define TO_CONST_ORATEXT to_const_oratext
 #define TO_CHARPTR to_charptr
 static ALWAYS_INLINE OraText *to_oratext(char *c)
 {
     return (OraText*)c;
 }
+static ALWAYS_INLINE const OraText *to_const_oratext(const char *c)
+{
+    return (const OraText*)c;
+}
 static ALWAYS_INLINE char *to_charptr(OraText *c)
 {
     return (char*)c;
 }
 #else
 #define TO_ORATEXT(c) ((OraText*)(c))
+#define TO_CONST_ORATEXT(c) ((const OraText*)(c))
 #define TO_CHARPTR(c) ((char*)(c))
 #endif
 #define RSTRING_ORATEXT(obj) TO_ORATEXT(RSTRING_PTR(obj))

Modified: trunk/ruby-oci8/ext/oci8/ocidatetime.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/ocidatetime.c	2011-12-13 10:32:09 UTC (rev 486)
@@ -265,8 +265,8 @@
     if (svcctx == NULL || svcctx->type != OCI_HTYPE_SVCCTX) {
         rb_raise(rb_eRuntimeError, "oci8lib.so internal error [%s:%d, %p, %d, %p, %d]",
                  __FILE__, __LINE__,
-                 parent, parent ? parent->type : -1,
-                 svcctx, svcctx ? svcctx->type : -1);
+                 parent, parent ? (int)parent->type : -1,
+                 svcctx, svcctx ? (int)svcctx->type : -1);
     }
     oci8_set_ocitimestamp_tz(*(OCIDateTime **)data, val, svcctx->self);
 }
@@ -328,7 +328,7 @@
     } else {
         /* Workaround for Bug 2227982 */
         char buf[64];
-        char *sign = "";
+        const char *sign = "";
 
         if (year < 0 && month != 0) {
             year += 1;
@@ -383,7 +383,7 @@
     } else {
         /* Workaround for Bug 2227982 */
         char buf[64];
-        char *sign = "";
+        const char *sign = "";
 
         if (day == 0) {
             if (hour < 0) {

Modified: trunk/ruby-oci8/ext/oci8/ocinumber.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocinumber.c	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/ocinumber.c	2011-12-13 10:32:09 UTC (rev 486)
@@ -1380,13 +1380,13 @@
 onum_s_load(VALUE klass, VALUE str)
 {
     unsigned char *c;
-    int size;
+    size_t size;
     OCINumber num;
 
     Check_Type(str, T_STRING);
     c = RSTRING_ORATEXT(str);
     size = RSTRING_LEN(str);
-    if (size == 0 || size != c[0] + 1 || size > sizeof(num)) {
+    if (size == 0 || size != c[0] + 1u || size > sizeof(num)) {
         rb_raise(rb_eTypeError, "marshaled OCI::Number format differ");
     }
     memset(&num, 0, sizeof(num));

Modified: trunk/ruby-oci8/ext/oci8/stmt.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/stmt.c	2011-12-11 13:53:03 UTC (rev 485)
+++ trunk/ruby-oci8/ext/oci8/stmt.c	2011-12-13 10:32:09 UTC (rev 486)
@@ -144,7 +144,6 @@
     sword status;
     VALUE old_value;
     void *indp;
-    ub4 *curelep;
 
     if (NIL_P(vplaceholder)) { /* 1 */
         placeholder_ptr = NULL;
@@ -170,11 +169,6 @@
     vptr = (const oci8_bind_vtable_t *)obind->base.vptr;
 
     indp = NIL_P(obind->tdo) ? obind->u.inds : NULL;
-    if (obind->maxar_sz == 0) {
-        curelep = NULL;
-    } else {
-        curelep = &obind->curar_sz;
-    }
     if (placeholder_ptr == (char*)-1) {
         status = OCIBindByPos(stmt->base.hp.stmt, &obind->base.hp.bnd, oci8_errhp, position, obind->valuep, obind->value_sz, vptr->dty, indp, NULL, 0, 0, 0, OCI_DEFAULT);
     } else {




More information about the ruby-oci8-commit mailing list