Giter Site home page Giter Site logo

3.52.14: compile time warnings about iodbc HOT 3 CLOSED

openlink avatar openlink commented on June 29, 2024
3.52.14: compile time warnings

from iodbc.

Comments (3)

susnux avatar susnux commented on June 29, 2024

On openSUSE

unicode.c: In function '_WCHARSIZE':
unicode.c:695:1: warning: control reaches end of non-void function [-Wreturn-type]
695 | }
| ^
unicode.c: In function '_WCHARSIZE_ALLOC':
unicode.c:707:1: warning: control reaches end of non-void function [-Wreturn-type]
707 | }
| ^
unicode.c: In function 'DM_GetWCharAt':
unicode.c:2161:1: warning: control reaches end of non-void function [-Wreturn-type]
2161 | }
| ^

are treated as error, so they breaks building iODBC.
I use this patch to fix the warnings by setting UTF8 as default:

diff -Nur libiodbc-3.52.14/iodbcinst/unicode.c new/iodbcinst/unicode.c
--- libiodbc-3.52.14/iodbcinst/unicode.c	2021-02-17 14:39:22.000000000 +0100
+++ new/iodbcinst/unicode.c	2021-05-31 18:26:17.332781996 +0200
@@ -688,9 +688,10 @@
 {
   switch(charset)
     {
-    case CP_UTF8: return 1;
     case CP_UTF16: return sizeof(ucs2_t);
     case CP_UCS4: return sizeof(ucs4_t);
+    case CP_UTF8:
+    default: return 1;
     }
 }
 
@@ -700,9 +701,10 @@
 {
   switch(charset)
     {
-    case CP_UTF8: return UTF8_MAX_CHAR_LEN;
     case CP_UTF16: return sizeof(ucs2_t) * 2;
     case CP_UCS4: return sizeof(ucs4_t);
+    case CP_UTF8:
+    default: return UTF8_MAX_CHAR_LEN;
     }
 }
 
@@ -2131,13 +2133,16 @@
 
   switch(charset)
     {
+    case CP_UTF16: return (SQLWCHAR)u2[pos];
+    case CP_UCS4: return (SQLWCHAR)u4[pos];
     case CP_UTF8:
-      {
+    default:
+      { 
         int mask, len, i=0;
         SQLWCHAR wc = 0;
         SQLCHAR *u8str = (SQLCHAR*)str;
         while(i < pos)
-        {
+        { 
           UTF8_COMPUTE(*u8str, mask, len);
           if (len == -1)
             break;
@@ -2155,8 +2160,6 @@
           }
         return wc;
       }
-    case CP_UTF16: return (SQLWCHAR)u2[pos];
-    case CP_UCS4: return (SQLWCHAR)u4[pos];
     }
 }
 

from iodbc.

TallTed avatar TallTed commented on June 29, 2024

@pkleef @smalinin @timhaynesopenlink -- Please take a look at this.

from iodbc.

smalinin avatar smalinin commented on June 29, 2024

The default charset is UCS4, so the pacth was changed for use CP_UCS4 as default and applied.

from iodbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.