[ruby-oci8-commit] [340] trunk/ruby-oci8: * ext/oci8/encoding.c, ext/oci8/lob.c, ext/oci8/ metadata.c,

nobody at rubyforge.org nobody at rubyforge.org
Fri Apr 17 07:49:38 EDT 2009


Revision: 340
Author:   kubo
Date:     2009-04-17 07:49:37 -0400 (Fri, 17 Apr 2009)

Log Message:
-----------
* ext/oci8/encoding.c, ext/oci8/lob.c, ext/oci8/metadata.c,
  ext/oci8/oci8.c: suppress "warning C4761: integral size mismatch
  in argument; conversion supplied" when compiled by Visual C++.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/encoding.c
    trunk/ruby-oci8/ext/oci8/lob.c
    trunk/ruby-oci8/ext/oci8/metadata.c
    trunk/ruby-oci8/ext/oci8/oci8.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2009-04-17 08:17:44 UTC (rev 339)
+++ trunk/ruby-oci8/ChangeLog	2009-04-17 11:49:37 UTC (rev 340)
@@ -1,4 +1,9 @@
 2009-04-17  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/encoding.c, ext/oci8/lob.c, ext/oci8/metadata.c,
+	  ext/oci8/oci8.c: suppress "warning C4761: integral size mismatch
+	  in argument; conversion supplied" when compiled by Visual C++.
+
+2009-04-17  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/apiwrap.yml, ext/oci8/env.c, ext/oci8/extconf.rb,
 	  ext/oci8/oci8.h, ext/oci8/oci8lib.c: OCIEnv is initialized
 	    when it is needed. This makes a basis to enable an event

Modified: trunk/ruby-oci8/ext/oci8/encoding.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/encoding.c	2009-04-17 08:17:44 UTC (rev 339)
+++ trunk/ruby-oci8/ext/oci8/encoding.c	2009-04-17 11:49:37 UTC (rev 340)
@@ -45,7 +45,7 @@
         char buf[OCI_NLS_MAXBUFSZ];
         sword rv;
 
-        rv = OCINlsCharSetIdToName(oci8_envhp, TO_ORATEXT(buf), sizeof(buf), FIX2INT(csid));
+        rv = OCINlsCharSetIdToName(oci8_envhp, TO_ORATEXT(buf), sizeof(buf), (ub2)FIX2INT(csid));
         if (rv != OCI_SUCCESS) {
             return Qnil;
         }

Modified: trunk/ruby-oci8/ext/oci8/lob.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/lob.c	2009-04-17 08:17:44 UTC (rev 339)
+++ trunk/ruby-oci8/ext/oci8/lob.c	2009-04-17 11:49:37 UTC (rev 340)
@@ -495,9 +495,15 @@
     oci8_lob_t *lob = DATA_PTR(self);
 
     bfile_close(lob);
+    if (RSTRING_LEN(dir_alias) > UB2MAXVAL) {
+        rb_raise(rb_eRuntimeError, "dir_alias is too long.");
+    }
+    if (RSTRING_LEN(filename) > UB2MAXVAL) {
+        rb_raise(rb_eRuntimeError, "filename is too long.");
+    }
     oci_lc(OCILobFileSetName(oci8_envhp, oci8_errhp, &lob->base.hp.lob,
-                             RSTRING_ORATEXT(dir_alias), RSTRING_LEN(dir_alias),
-                             RSTRING_ORATEXT(filename), RSTRING_LEN(filename)));
+                             RSTRING_ORATEXT(dir_alias), (ub2)RSTRING_LEN(dir_alias),
+                             RSTRING_ORATEXT(filename), (ub2)RSTRING_LEN(filename)));
 }
 
 static VALUE oci8_bfile_initialize(int argc, VALUE *argv, VALUE self)

Modified: trunk/ruby-oci8/ext/oci8/metadata.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/metadata.c	2009-04-17 08:17:44 UTC (rev 339)
+++ trunk/ruby-oci8/ext/oci8/metadata.c	2009-04-17 11:49:37 UTC (rev 340)
@@ -277,7 +277,7 @@
         oci_lc(OCIAttrSet(desc->hp.dschp, OCI_HTYPE_DESCRIBE, &val, 0, OCI_ATTR_DESC_PUBLIC, oci8_errhp));
     }
     oci_lc(OCIDescribeAny_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, objptr, objlen,
-                             objtype, OCI_DEFAULT, FIX2INT(type), desc->hp.dschp));
+                             objtype, OCI_DEFAULT, (ub1)FIX2INT(type), desc->hp.dschp));
     oci_lc(OCIAttrGet(desc->hp.dschp, OCI_HTYPE_DESCRIBE, &parmhp, 0, OCI_ATTR_PARAM, oci8_errhp));
     return oci8_metadata_create(parmhp, self, obj);
 }

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2009-04-17 08:17:44 UTC (rev 339)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2009-04-17 11:49:37 UTC (rev 340)
@@ -538,11 +538,11 @@
 
     if (have_OCIServerRelease) {
         /* Oracle 9i or later */
-        oci_lc(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), svcctx->base.type, &version));
+        oci_lc(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type, &version));
         return UINT2NUM(version);
     } else {
         /* Oracle 8.x */
-        oci_lc(OCIServerVersion(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), svcctx->base.type));
+        oci_lc(OCIServerVersion(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), (ub1)svcctx->base.type));
         if ((p = strchr(buf, '.')) != NULL) {
             unsigned int major, minor, update, patch, port_update;
             while (p >= buf && *p != ' ') {




More information about the ruby-oci8-commit mailing list