diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 86dddcdb892..34bf7fc2491 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -18,7 +18,7 @@ SET(CONNECT_PLUGIN_DYNAMIC "connect") SET(CONNECT_SOURCES ha_connect.cc connect.cc user_connect.cc mycat.cc -fmdlex.c osutil.c plugutil.c rcmsg.c +fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h csort.cpp maputil.cpp plgdbutl.cpp colblk.cpp reldef.cpp tabcol.cpp table.cpp filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp @@ -28,7 +28,7 @@ filamzip.cpp tabtbl.cpp myutil.cpp tabutil.cpp tabxcl.cpp taboccur.cpp tabpivot.cpp block.h catalog.h checklvl.h colblk.h connect.h csort.h engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h -global.h ha_connect.h maputil.h msgid.h mycat.h myutil.h os.h +global.h ha_connect.h inihandl.h maputil.h msgid.h mycat.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabmul.h tabsys.h tabtbl.h tabvct.h user_connect.h valblk.h value.h xindex.h xobject.h xtable.h @@ -48,7 +48,6 @@ IF(UNIX) # Bar: -Wfatal-errors removed (does not present in gcc on solaris10) if(WITH_WARNINGS) add_definitions(-Wall -Wextra -Wmissing-declarations) - add_definitions(-Wno-non-virtual-dtor) message(STATUS "CONNECT: GCC: All warnings enabled") else() add_definitions(-Wall -Wmissing-declarations) @@ -64,13 +63,11 @@ IF(UNIX) # add_definitions(-Wno-int-to-pointer-cast) # Bar: -Wno-narrowing commented (does not present in gcc on solaris10) # add_definitions(-Wno-narrowing) - add_definitions(-Wno-non-virtual-dtor) # This switch is for pure C only: # add_definitions(-Wno-implicit-function-declaration) # These switches are for C++ only # add_definitions(-Wno-reorder) -# add_definitions(-Wno-delete-non-virtual-dtor) message(STATUS "CONNECT: GCC: Some warnings disabled") endif(WITH_WARNINGS) diff --git a/storage/connect/connect.h b/storage/connect/connect.h index 3fd52d283c6..e81e54776c9 100644 --- a/storage/connect/connect.h +++ b/storage/connect/connect.h @@ -44,6 +44,7 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all); bool CntInfo(PGLOBAL g, PTDB tdbp, PXF info); int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, bool *incl, key_part_map *kmap); +PGLOBAL CntExit(PGLOBAL g); /***********************************************************************/ /* Definition of classes XCOLCRT, XIXDEF, XKPDEF, DOXDEF, TDBDOX */ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 9bc0d2a9942..9020220f5d0 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -137,6 +137,7 @@ #include "mycat.h" #include "myutil.h" #include "preparse.h" +#include "inihandl.h" #define PLGXINI "plgcnx.ini" /* Configuration settings file */ #define my_strupr(p) my_caseup_str(default_charset_info, (p)); @@ -3260,8 +3261,8 @@ static char *encode(PGLOBAL g, char *cnm) Return 0 if ok */ -bool add_field(String *sql, const char *field_name, const char *type, - int len, int dec, uint tm, const char *rem) +static bool add_field(String *sql, const char *field_name, const char *type, + int len, int dec, uint tm, const char *rem) { bool error= false; @@ -3318,7 +3319,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, bool ok= false, dbf= false; TABTYPE ttp= TAB_UNDEF; MEM_ROOT *mem= thd->mem_root; - CHARSET_INFO *cs; PQRYRES qrp; PCOLRES crp; PGLOBAL g= GetPlug(thd, NULL); @@ -3572,7 +3572,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, rem= NULL; typ= len= dec= 0; tm= NOT_NULL_FLAG; - cs= NULL; for (crp= qrp->Colresp; crp; crp= crp->Next) switch (crp->Fld) { @@ -3845,6 +3844,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, DBUG_RETURN(HA_ERR_INTERNAL_ERROR); } // endif tabname + default: /* do nothing */; } // endswitch ttp if (type == TAB_XML) { diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.c index 25629b04e60..60b72bd2604 100644 --- a/storage/connect/inihandl.c +++ b/storage/connect/inihandl.c @@ -29,9 +29,8 @@ //#include //#include #include "my_global.h" -//#include "osutil.h" #include "global.h" - +#include "inihandl.h" // The types and variables used locally //typedef int bool; @@ -672,7 +671,7 @@ static BOOL PROFILE_DeleteKey(PROFILESECTION* *section, * * Delete all keys from a profile tree. ***********************************************************************/ -void PROFILE_DeleteAllKeys(LPCSTR section_name) +static void PROFILE_DeleteAllKeys(LPCSTR section_name) { PROFILESECTION* *section= &CurProfile->section; @@ -1038,6 +1037,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, * Convenience function that turns a string 'xxx, yyy, zzz' into * the 'xxx\0 yyy, zzz' and returns a pointer to the 'yyy, zzz'. ***********************************************************************/ +#if 0 char *PROFILE_GetStringItem(char* start) { char *lpchX, *lpch; @@ -1065,6 +1065,7 @@ char *PROFILE_GetStringItem(char* start) return NULL; } // end of PROFILE_GetStringItem +#endif /********************************************************************** * if allow_section_name_copy is TRUE, allow the copying : @@ -1132,7 +1133,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry, * GetPrivateProfileStringA (KERNEL32.@) ***********************************************************************/ int GetPrivateProfileString(LPCSTR section, LPCSTR entry, LPCSTR def_val, - LPSTR buffer, uint len, LPCSTR filename) + LPSTR buffer, DWORD len, LPCSTR filename) { return PROFILE_GetPrivateProfileString(section, entry, def_val, buffer, len, filename, TRUE); @@ -1308,7 +1309,8 @@ BOOL WritePrivateProfileSection(LPCSTR section, * Note that when the buffer is big enough then the return value may be any * value between 1 and len-1 (or len in Win95), including len-2. */ -DWORD GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename) +static DWORD +GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename) { DWORD ret = 0; diff --git a/storage/connect/inihandl.h b/storage/connect/inihandl.h new file mode 100644 index 00000000000..7f6fcb1f582 --- /dev/null +++ b/storage/connect/inihandl.h @@ -0,0 +1,54 @@ +#ifndef __INIHANDL_H__ +#define __INIHANDL_H__ + +#if defined(UNIX) || defined(UNIV_LINUX) + +#ifdef __cplusplus +extern "C" { +#endif + +void PROFILE_Close(LPCSTR filename); + +int GetPrivateProfileString( + LPCTSTR lpAppName, // section name + LPCTSTR lpKeyName, // key name + LPCTSTR lpDefault, // default string + LPTSTR lpReturnedString, // destination buffer + DWORD nSize, // size of destination buffer + LPCTSTR lpFileName // initialization file name + ); + +uint GetPrivateProfileInt( + LPCTSTR lpAppName, // section name + LPCTSTR lpKeyName, // key name + INT nDefault, // return value if key name not found + LPCTSTR lpFileName // initialization file name + ); + +BOOL WritePrivateProfileString( + LPCTSTR lpAppName, // section name + LPCTSTR lpKeyName, // key name + LPCTSTR lpString, // string to add + LPCTSTR lpFileName // initialization file + ); + +int GetPrivateProfileSection( + LPCTSTR lpAppName, // section name + LPTSTR lpReturnedString, // return buffer + DWORD nSize, // size of return buffer + LPCTSTR lpFileName // initialization file name + ); + +BOOL WritePrivateProfileSection( + LPCTSTR lpAppName, // section name + LPCTSTR lpString, // data + LPCTSTR lpFileName // file name + ); + +#ifdef __cplusplus +} +#endif + +#endif /* defined(UNIX) */ + +#endif /* __INIHANDL_H__ */ diff --git a/storage/connect/maputil.h b/storage/connect/maputil.h index 8ab41487a63..b5e54affcea 100644 --- a/storage/connect/maputil.h +++ b/storage/connect/maputil.h @@ -13,7 +13,6 @@ typedef struct { HANDLE CreateFileMap(PGLOBAL, LPCSTR, MEMMAP *, MODE, bool); bool CloseMemMap(void *memory, size_t dwSize); -my_bool CloseFileHandle(HANDLE h); #ifdef __cplusplus } diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index e32e666e1fe..b39f1c9ba5b 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -36,6 +36,7 @@ //#include "kindex.h" #include "xtable.h" #include "tabodbc.h" +#include "odbccat.h" #include "plgcnx.h" // For DB types #include "resource.h" #include "valblk.h" @@ -47,9 +48,7 @@ /***********************************************************************/ #pragma comment(lib, "odbc32.lib") extern "C" HINSTANCE s_hModule; // Saved module handle -#else // !WIN32 -extern "C" int GetRcString(int id, char *buf, int bufsize); -#endif // !WIN32 +#endif // WIN32 /***********************************************************************/ /* Some macro's (should be defined elsewhere to be more accessible) */ @@ -176,7 +175,7 @@ int TranslateSQLType(int stp, int prec, int& len) /***********************************************************************/ /* Allocate the structure used to refer to the result set. */ /***********************************************************************/ -CATPARM *AllocCatInfo(PGLOBAL g, CATINFO fid, char *tab, PQRYRES qrp) +static CATPARM *AllocCatInfo(PGLOBAL g, CATINFO fid, char *tab, PQRYRES qrp) { size_t i, m, n; CATPARM *cap; @@ -203,7 +202,7 @@ CATPARM *AllocCatInfo(PGLOBAL g, CATINFO fid, char *tab, PQRYRES qrp) /***********************************************************************/ /* Check for nulls and reset them to Null (?) values. */ /***********************************************************************/ -void ResetNullValues(CATPARM *cap) +static void ResetNullValues(CATPARM *cap) { int i, n, ncol; PCOLRES crp; diff --git a/storage/connect/osutil.c b/storage/connect/osutil.c index 45c834a4cfc..1b7332357e6 100644 --- a/storage/connect/osutil.c +++ b/storage/connect/osutil.c @@ -142,10 +142,12 @@ my_bool CloseFileHandle(HANDLE h) return (close(h)) ? TRUE : FALSE; } /* end of CloseFileHandle */ +#if 0 void Sleep(DWORD time) { //FIXME: TODO } /* end of Sleep */ +#endif int GetLastError() { @@ -213,6 +215,7 @@ int _isatty(int fileNo) return isatty(fileNo); } /* end of _isatty */ +#if 0 /* This function is ridiculous and should be revisited */ DWORD FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, ...) @@ -227,5 +230,6 @@ DWORD FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, strncpy(lpBuffer, buff, nSize); return min(n, nSize); } /* end of FormatMessage */ +#endif #endif // UNIX diff --git a/storage/connect/osutil.h b/storage/connect/osutil.h index 440373dd7a1..63a3e18084c 100644 --- a/storage/connect/osutil.h +++ b/storage/connect/osutil.h @@ -32,44 +32,6 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength); BOOL MessageBeep(uint); unsigned long _filelength(int fd); -void PROFILE_Close(LPCSTR filename); - -int GetPrivateProfileString( - LPCTSTR lpAppName, // section name - LPCTSTR lpKeyName, // key name - LPCTSTR lpDefault, // default string - LPTSTR lpReturnedString, // destination buffer - int nSize, // size of destination buffer - LPCTSTR lpFileName // initialization file name - ); - -uint GetPrivateProfileInt( - LPCTSTR lpAppName, // section name - LPCTSTR lpKeyName, // key name - INT nDefault, // return value if key name not found - LPCTSTR lpFileName // initialization file name - ); - -BOOL WritePrivateProfileString( - LPCTSTR lpAppName, // section name - LPCTSTR lpKeyName, // key name - LPCTSTR lpString, // string to add - LPCTSTR lpFileName // initialization file - ); - -int GetPrivateProfileSection( - LPCTSTR lpAppName, // section name - LPTSTR lpReturnedString, // return buffer - int nSize, // size of return buffer - LPCTSTR lpFileName // initialization file name - ); - -BOOL WritePrivateProfileSection( - LPCTSTR lpAppName, // section name - LPCTSTR lpString, // data - LPCTSTR lpFileName // file name - ); - PSZ strupr(PSZ s); PSZ strlwr(PSZ s); @@ -90,12 +52,14 @@ typedef __int64 FILEPOS; #define XSTR(x) ((x)?(x):"") + #ifdef __cplusplus extern "C" { #endif - +my_bool CloseFileHandle(HANDLE h); #ifdef __cplusplus } #endif + #endif /* __OSUTIL_H__ */ diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 32ee105c19c..598075ac52a 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -67,6 +67,7 @@ #include "xtable.h" // header of TBX, TDB and TDBASE classes #include "tabcol.h" // header of XTAB and COLUMN classes #include "valblk.h" +#include "rcmsg.h" /***********************************************************************/ /* Macro or external routine definition */ @@ -129,7 +130,6 @@ void CloseXMLFile(PGLOBAL, PFBLOCK, bool); void CloseXML2File(PGLOBAL, PFBLOCK, bool); #endif // LIBXML2_SUPPORT -extern "C" int GetRcString(int id, char *buf, int bufsize); /***********************************************************************/ /* Routines for file IO with error reporting to g->Message */ @@ -519,6 +519,7 @@ bool PlgSetXdbPath(PGLOBAL g, PSZ dbname, PSZ dbpath, /* Extract from a path name the required component. */ /* This function assumes there is enough space in the buffer. */ /***********************************************************************/ +#if 0 char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op) { char *drive = NULL, *direc = NULL, *fname = NULL, *ftype = NULL; @@ -539,13 +540,14 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op) _splitpath(FileName, drive, direc, fname, ftype); return pBuff; } // end of PlgExtractFromPath +#endif /***********************************************************************/ /* Check the occurence and matching of a pattern against a string. */ /* Because this function is only used for catalog name checking, */ /* it must be case insensitive. */ /***********************************************************************/ -bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat) +static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat) { if (pat && strlen(pat)) { // This leaves 512 bytes (MAX_STR / 2) for each components diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c index 426401a0c47..67947e3042b 100644 --- a/storage/connect/plugutil.c +++ b/storage/connect/plugutil.c @@ -107,7 +107,7 @@ ACTIVITY defActivity = { /* Describes activity and language */ #endif // XMSG || NEWMSG #if defined(UNIX) || defined(UNIV_LINUX) -int GetRcString(int id, char *buf, int bufsize); +#include "rcmsg.h" #endif // UNIX /**************************************************************************/ @@ -494,9 +494,10 @@ void *MakePtr(void *memp, OFFSET offset) /***********************************************************************/ /* This routine makes an offset from a pointer new format. */ /***********************************************************************/ +#if 0 OFFSET MakeOff(void *memp, void *ptr) { return ((!ptr) ? 0 : (OFFSET)((char *)ptr - (char *)memp)); } /* end of MakeOff */ - +#endif /*--------------------- End of PLUGUTIL program -----------------------*/ diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index e1a71cde9c6..0c63fd55242 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -14,6 +14,7 @@ /***********************************************************************/ #include #include "resource.h" +#include "rcmsg.h" char *GetMsgid(int id) { diff --git a/storage/connect/rcmsg.h b/storage/connect/rcmsg.h new file mode 100644 index 00000000000..b22e77f5175 --- /dev/null +++ b/storage/connect/rcmsg.h @@ -0,0 +1,15 @@ +#ifndef __RCMSG_H__ +#define __RCMSG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +char *GetMsgid(int id); +int GetRcString(int id, char *buf, int bufsize); + +#ifdef __cplusplus +} +#endif + +#endif /* __RCMSG_H__ */ diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index c9bb47792f5..8b97a592d93 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -57,6 +57,7 @@ #include "reldef.h" #include "tabmysql.h" #include "valblk.h" +#include "tabutil.h" #if defined(_CONSOLE) void PrintResult(PGLOBAL, PSEM, PQRYRES); @@ -65,9 +66,6 @@ void PrintResult(PGLOBAL, PSEM, PQRYRES); extern "C" int trace; extern MYSQL_PLUGIN_IMPORT uint mysqld_port; -// This function is located in tabutil.cpp -void Remove_tshp(PCATLG cat); - /* -------------- Implementation of the MYSQLDEF class --------------- */ /***********************************************************************/ diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 5bbc9effa92..909fcda4abf 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -75,7 +75,6 @@ #include "sql_string.h" -extern "C" char *GetMsgid(int id); extern "C" int trace; /***********************************************************************/ diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp index 1a73f353970..867689626f9 100644 --- a/storage/connect/tabpivot.cpp +++ b/storage/connect/tabpivot.cpp @@ -278,16 +278,16 @@ bool TDBPIVOT::MakePivotColumns(PGLOBAL g) } else if (Xcolp->InitValue(g)) return true; - // Check and initialize the subtable columns - for (PCOL cp = Columns; cp; cp = cp->GetNext()) - if (cp->GetAmType() == TYPE_AM_SRC) { - if (((PSRCCOL)cp)->Init(g)) - return TRUE; - - } else if (cp->GetAmType() == TYPE_AM_FNC) - if (((PFNCCOL)cp)->InitColumn(g)) - return TRUE; - + // Check and initialize the subtable columns + for (PCOL cp = Columns; cp; cp = cp->GetNext()) + if (cp->GetAmType() == TYPE_AM_SRC) { + if (((PSRCCOL)cp)->Init(g)) + return TRUE; + + } else if (cp->GetAmType() == TYPE_AM_FNC) + if (((PFNCCOL)cp)->InitColumn(g)) + return TRUE; + } // endif isview return false; @@ -347,7 +347,7 @@ bool TDBPIVOT::MakeViewColumns(PGLOBAL g) if (!(Xcolp = tdbp->MakeFieldColumn(g, Picol))) return true; - // Check and initialize the subtable columns + // Check and initialize the subtable columns for (cp = Columns; cp; cp = cp->GetNext()) if (cp->GetAmType() == TYPE_AM_SRC) { if ((colp = tdbp->MakeFieldColumn(g, cp->GetName()))) { @@ -357,9 +357,9 @@ bool TDBPIVOT::MakeViewColumns(PGLOBAL g) } else return true; - } else if (cp->GetAmType() == TYPE_AM_FNC) - if (((PFNCCOL)cp)->InitColumn(g)) - return TRUE; + } else if (cp->GetAmType() == TYPE_AM_FNC) + if (((PFNCCOL)cp)->InitColumn(g)) + return TRUE; } // endif isview diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp index 705bb79bcb4..6434e011882 100644 --- a/storage/connect/tabsys.cpp +++ b/storage/connect/tabsys.cpp @@ -41,9 +41,7 @@ #include "tabdos.h" #include "tabsys.h" #include "tabmul.h" -#if defined(UNIX) -#include "osutil.h" -#endif // UNIX +#include "inihandl.h" #define CSZ 36 // Column section name length #define CDZ 256 // Column definition length diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 8698d4697b7..93c0a8a83ea 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -423,7 +423,7 @@ int TDBPRX::GetMaxSize(PGLOBAL g) { if (MaxSize < 0) { if (InitTable(g)) - return NULL; + return 0; MaxSize = Tdbp->GetMaxSize(g); } // endif MaxSize diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index a6b08bce3d4..1405ef211c7 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -20,6 +20,8 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, const char *name, bool info); +void Remove_tshp(PCATLG cat); + /* -------------------------- PROXY classes -------------------------- */ /***********************************************************************/ diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index 3fd3ac43e32..d85f11d1950 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -43,6 +43,7 @@ #include "osutil.h" #include "global.h" #include "plgdbsem.h" +#include "connect.h" #include "user_connect.h" #include "mycat.h" @@ -54,11 +55,6 @@ extern int xtrace; /****************************************************************************/ PCONNECT user_connect::to_users= NULL; -/****************************************************************************/ -/* CONNECT functions called externally. */ -/****************************************************************************/ -PGLOBAL CntExit(PGLOBAL g); - /* -------------------------- class user_connect -------------------------- */ /****************************************************************************/ diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 7a1146e6c32..6152fdc238f 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -93,7 +93,7 @@ PSZ strlwr(PSZ s); /* met when returning from TestValue for a given operator. */ /* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */ /***********************************************************************/ -BYTE OpBmp(PGLOBAL g, OPVAL opc) +static BYTE OpBmp(PGLOBAL g, OPVAL opc) { BYTE bt;