diff options
Diffstat (limited to 'storage')
57 files changed, 483 insertions, 482 deletions
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index 0e8829d66a6..193514eeb99 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -19,14 +19,14 @@ #include "sql_class.h" //#include "sql_time.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <stdint.h> // for uintprt_h -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include required application header files */ diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp index c6fb528aa5f..1f5a1a27ae5 100644 --- a/storage/connect/blkfil.cpp +++ b/storage/connect/blkfil.cpp @@ -20,13 +20,13 @@ #include "sql_class.h" //#include "sql_time.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ diff --git a/storage/connect/block.h b/storage/connect/block.h index 40529ffc81f..69cec39e8a5 100644 --- a/storage/connect/block.h +++ b/storage/connect/block.h @@ -24,11 +24,11 @@ #if !defined(BLOCK_DEFINED) #define BLOCK_DEFINED -#if defined(WIN32) && !defined(NOEX) +#if defined(__WIN__) && !defined(NOEX) #define DllExport __declspec( dllexport ) -#else // !WIN32 +#else // !__WIN__ #define DllExport -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Definition of class BLOCK with its method function new. */ diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp index 7166af8027b..80b405be041 100644 --- a/storage/connect/colblk.cpp +++ b/storage/connect/colblk.cpp @@ -297,9 +297,9 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op) Buf_Type = TYPE_STRING; *Format.Type = 'C'; Format.Length = Long; -#if defined(WIN32) +#if defined(__WIN__) Format.Prec = 1; // Case insensitive -#endif // WIN32 +#endif // __WIN__ Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() && To_Tdb->GetAmType() != TYPE_AM_PLG && To_Tdb->GetAmType() != TYPE_AM_PLM); diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp index 9e518775c0f..64a0a172956 100644 --- a/storage/connect/domdoc.cpp +++ b/storage/connect/domdoc.cpp @@ -4,7 +4,7 @@ /******************************************************************/ #include "my_global.h" #include <stdio.h> -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> #if defined(MSX2) #import "msxml2.dll" //Does not exist on Vista diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp index cac34827b7a..5cf9a4d945c 100644 --- a/storage/connect/filamap.cpp +++ b/storage/connect/filamap.cpp @@ -17,12 +17,12 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #if defined(__BORLANDC__) #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #include <unistd.h> @@ -30,7 +30,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -191,11 +191,11 @@ bool MAPFAM::OpenTableFile(PGLOBAL g) return true; } // endif Memory -#if defined(WIN32) +#if defined(__WIN__) if (mode != MODE_DELETE) { -#else // !WIN32 +#else // !__WIN__ if (mode == MODE_READ) { -#endif // !WIN32 +#endif // !__WIN__ CloseFileHandle(hFile); // Not used anymore hFile = INVALID_HANDLE_VALUE; // For Fblock } // endif Mode @@ -452,7 +452,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ n = Tpos - Memory; -#if defined(WIN32) +#if defined(__WIN__) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { @@ -482,7 +482,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) #endif // UNIX } // endif Abort -#if defined(WIN32) +#if defined(__WIN__) CloseHandle(fp->Handle); #else // UNIX close(fp->Handle); diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index 4d66c2ab2ff..8afda723578 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -22,12 +22,12 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> //#include <errno.h> //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #include <unistd.h> @@ -35,7 +35,7 @@ //#include <io.h> #endif // !UNIX //#include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ #include <ctype.h> #include <stdio.h> #include <string.h> @@ -528,7 +528,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen); if (mode == MODE_INSERT) { -#if defined(WIN32) +#if defined(__WIN__) /************************************************************************/ /* Now we can revert to binary mode in particular because the eventual */ /* writing of a new header must be done in binary mode to avoid */ @@ -538,7 +538,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) sprintf(g->Message, MSG(BIN_MODE_FAIL), strerror(errno)); return true; } // endif setmode -#endif // WIN32 +#endif // __WIN__ /************************************************************************/ /* If this is a new file, the header must be generated. */ diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index c352db47044..cd25429318a 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -17,7 +17,7 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> @@ -25,7 +25,7 @@ #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #include <unistd.h> @@ -34,7 +34,7 @@ #endif // !UNIX #include <sys/stat.h> #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -338,10 +338,10 @@ int FIXFAM::ReadBuffer(PGLOBAL g) } else if (feof(Stream)) { rc = RC_EF; } else { -#if defined(UNIX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); -#else +#if defined(__WIN__) sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); +#else + sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); #endif if (trace) @@ -678,7 +678,7 @@ BGXFAM::BGXFAM(PBGXFAM txfp) : FIXFAM(txfp) /***********************************************************************/ bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org) { -#if defined(WIN32) +#if defined(__WIN__) char buf[256]; DWORD drc; LARGE_INTEGER of; @@ -694,14 +694,14 @@ bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org) sprintf(g->Message, MSG(SFP_ERROR), buf); return true; } // endif -#else // !WIN32 +#else // !__WIN__ if (lseek64(h, pos, org) < 0) { // sprintf(g->Message, MSG(ERROR_IN_LSK), errno); sprintf(g->Message, "lseek64: %s", strerror(errno)); printf("%s\n", g->Message); return true; } // endif -#endif // !WIN32 +#endif // !__WIN__ return false; } // end of BigSeek @@ -714,7 +714,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)), { int rc; -#if defined(WIN32) +#if defined(__WIN__) DWORD nbr, drc, len = (DWORD)req; bool brc = ReadFile(h, inbuf, len, &nbr, NULL); @@ -736,12 +736,12 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)), rc = -1; } else rc = (int)nbr; -#else // !WIN32 +#else // !__WIN__ size_t len = (size_t)req; ssize_t nbr = read(h, inbuf, len); rc = (int)nbr; -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of BigRead @@ -753,7 +753,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) { bool rc = false; -#if defined(WIN32) +#if defined(__WIN__) DWORD nbw, drc, len = (DWORD)req; bool brc = WriteFile(h, inbuf, len, &nbw, NULL); @@ -780,7 +780,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif brc || nbw -#else // !WIN32 +#else // !__WIN__ size_t len = (size_t)req; ssize_t nbw = write(h, inbuf, len); @@ -795,7 +795,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif nbr -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of BigWrite @@ -830,7 +830,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) if (trace) htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode); -#if defined(WIN32) +#if defined(__WIN__) DWORD rc, access, creation, share = 0; /*********************************************************************/ @@ -987,7 +987,7 @@ int BGXFAM::Cardinality(PGLOBAL g) PlugSetPath(filename, To_File, Tdbp->GetPath()); -#if defined(WIN32) // OB +#if defined(__WIN__) // OB LARGE_INTEGER len; DWORD rc = 0; @@ -1346,7 +1346,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ /* Remove extra records. */ /*****************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) if (BigSeek(g, Hfile, (BIGINT)Tpos * (BIGINT)Lrecl)) return RC_FX; @@ -1356,12 +1356,12 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc) sprintf(g->Message, MSG(SETEOF_ERROR), drc); return RC_FX; } // endif error -#else // !WIN32 +#else // !__WIN__ if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); return RC_FX; } // endif -#endif // !WIN32 +#endif // !__WIN__ } // endif UseTemp @@ -1386,7 +1386,7 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) strcat(PlugRemoveType(tempname, tempname), ".t"); remove(tempname); // Be sure it does not exist yet -#if defined(WIN32) +#if defined(__WIN__) Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); @@ -1526,7 +1526,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort) void BGXFAM::Rewind(void) { #if 0 // This is probably unuseful because file is accessed directly -#if defined(WIN32) //OB +#if defined(__WIN__) //OB SetFilePointer(Hfile, 0, NULL, FILE_BEGIN); #else // UNIX lseek64(Hfile, 0, SEEK_SET); diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index cce9cec56bd..e53cdcd9ba9 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -17,7 +17,7 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> @@ -25,7 +25,7 @@ #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) || defined(UNIV_LINUX) #include <errno.h> #include <unistd.h> @@ -36,7 +36,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -716,10 +716,10 @@ int DOSFAM::SkipRecord(PGLOBAL g, bool header) if (feof(Stream)) return RC_EF; -#if defined(UNIX) || defined(UNIV_LINUX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); -#else +#if defined(__WIN__) sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); +#else + sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); #endif return RC_FX; } // endif fgets @@ -799,12 +799,12 @@ int DOSFAM::ReadBuffer(PGLOBAL g) if (trace > 1) htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p); -#if defined(UNIX) - if (true) { - // Data files can be imported from Windows (having CRLF) -#else +#if defined(__WIN__) if (Bin) { // Data file is read in binary so CRLF remains +#else + if (true) { + // Data files can be imported from Windows (having CRLF) #endif if (*p == '\n' || *p == '\r') { // is this enough for Unix ??? @@ -833,10 +833,10 @@ int DOSFAM::ReadBuffer(PGLOBAL g) } else if (feof(Stream)) { rc = RC_EF; } else { -#if defined(UNIX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); -#else +#if defined(__WIN__) sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); +#else + sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0)); #endif if (trace) @@ -1028,15 +1028,15 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ /* Remove extra records. */ /*****************************************************************/ -#if defined(UNIX) - if (ftruncate(h, (off_t)Tpos)) { - sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); +#if defined(__WIN__) + if (chsize(h, Tpos)) { + sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif #else - if (chsize(h, Tpos)) { - sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); + if (ftruncate(h, (off_t)Tpos)) { + sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); close(h); return RC_FX; } // endif @@ -1466,10 +1466,10 @@ int BLKFAM::ReadBuffer(PGLOBAL g) } else if (feof(Stream)) { rc = RC_EF; } else { -#if defined(UNIX) - sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); -#else +#if defined(__WIN__) sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); +#else + sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); #endif if (trace) @@ -1551,11 +1551,11 @@ int BLKFAM::WriteBuffer(PGLOBAL g) Spos = GetNextPos(); // New start position // Prepare the output buffer -#if defined(WIN32) +#if defined(__WIN__) crlf = "\r\n"; #else crlf = "\n"; -#endif // WIN32 +#endif // __WIN__ strcat(strcpy(OutBuf, Tdbp->GetLine()), crlf); len = strlen(OutBuf); } else { diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index 60a8875e015..fdc5433f4a4 100755 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -21,7 +21,7 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #if defined(__BORLANDC__) @@ -29,7 +29,7 @@ #endif // __BORLAND__ //#include <windows.h> #include <sys/stat.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <sys/types.h> #include <sys/stat.h> @@ -40,7 +40,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -49,7 +49,7 @@ /* tabdos.h is header containing the TABDOS class declarations. */ /***********************************************************************/ #include "global.h" -#include "osutil.h" // Unuseful for WIN32 +#include "osutil.h" // Unuseful for WINDOWS #include "plgdbsem.h" #include "valblk.h" #include "filamfix.h" @@ -376,11 +376,11 @@ bool VCTFAM::MakeEmptyFile(PGLOBAL g, char *fn) int h, n; PlugSetPath(filename, fn, Tdbp->GetPath()); -#if defined(WIN32) +#if defined(__WIN__) h= global_open(g, MSGID_OPEN_EMPTY_FILE, filename, _O_CREAT | _O_WRONLY, S_IREAD | S_IWRITE); -#else // !WIN32 +#else // !__WIN__ h= global_open(g, MSGID_OPEN_EMPTY_FILE, filename, O_CREAT | O_WRONLY, S_IREAD | S_IWRITE); -#endif // !WIN32 +#endif // !__WIN__ if (h == -1) return true; @@ -1669,7 +1669,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc) // Remove extra blocks n = Block * Blksize; -#if defined(WIN32) +#if defined(__WIN__) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { @@ -2574,11 +2574,11 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp) char fn[_MAX_PATH]; sprintf(fn, Colfn, colp->Index); -#if defined(WIN32) +#if defined(__WIN__) if (feof(Streams[i])) -#else // !WIN32 +#else // !__WIN__ if (errno == NO_ERROR) -#endif // !WIN32 +#endif // !__WIN__ sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn); else sprintf(g->Message, MSG(READ_ERROR), @@ -2969,7 +2969,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc) /*****************************************************************/ n = Tpos * Clens[i]; -#if defined(WIN32) +#if defined(__WIN__) DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); if (drc == 0xFFFFFFFF) { @@ -3049,7 +3049,7 @@ BGVFAM::BGVFAM(PBGVFAM txfp) : VCTFAM(txfp) /***********************************************************************/ bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b) { -#if defined(WIN32) +#if defined(__WIN__) char buf[256]; DWORD drc, m = (b) ? FILE_END : FILE_BEGIN; LARGE_INTEGER of; @@ -3065,12 +3065,12 @@ bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b) sprintf(g->Message, MSG(SFP_ERROR), buf); return true; } // endif -#else // !WIN32 +#else // !__WIN__ if (lseek64(h, pos, (b) ? SEEK_END : SEEK_SET) < 0) { sprintf(g->Message, MSG(ERROR_IN_LSK), errno); return true; } // endif -#endif // !WIN32 +#endif // !__WIN__ return false; } // end of BigSeek @@ -3082,7 +3082,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) { bool rc = false; -#if defined(WIN32) +#if defined(__WIN__) DWORD nbr, drc, len = (DWORD)req; bool brc = ReadFile(h, inbuf, len, &nbr, NULL); @@ -3108,7 +3108,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif brc || nbr -#else // !WIN32 +#else // !__WIN__ size_t len = (size_t)req; ssize_t nbr = read(h, inbuf, len); @@ -3123,7 +3123,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif nbr -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of BigRead @@ -3135,7 +3135,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) { bool rc = false; -#if defined(WIN32) +#if defined(__WIN__) DWORD nbw, drc, len = (DWORD)req; bool brc = WriteFile(h, inbuf, len, &nbw, NULL); @@ -3162,7 +3162,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif brc || nbw -#else // !WIN32 +#else // !__WIN__ size_t len = (size_t)req; ssize_t nbw = write(h, inbuf, len); @@ -3177,7 +3177,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req) rc = true; } // endif nbr -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of BigWrite @@ -3203,7 +3203,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) if (Header == 2) strcat(PlugRemoveType(filename, filename), ".blk"); -#if defined(WIN32) +#if defined(__WIN__) LARGE_INTEGER len; h = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, @@ -3215,11 +3215,11 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) } // endif h if (h == INVALID_HANDLE_VALUE || !len.QuadPart) { -#else // !WIN32 +#else // !__WIN__ h = open64(filename, O_RDONLY, 0); if (h == INVALID_HANDLE_VALUE || !_filelength(h)) { -#endif // !WIN32 +#endif // !__WIN__ // Consider this is a void table if (trace) htrc("Void table h=%d\n", h); @@ -3280,17 +3280,17 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) strcat(PlugRemoveType(filename, filename), ".blk"); if (h == INVALID_HANDLE_VALUE) { -#if defined(WIN32) +#if defined(__WIN__) DWORD creation = (b) ? OPEN_EXISTING : TRUNCATE_EXISTING; h = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL); -#else // !WIN32 +#else // !__WIN__ int oflag = (b) ? O_RDWR : O_RDWR | O_TRUNC; h = open64(filename, oflag, 0); -#endif // !WIN32 +#endif // !__WIN__ if (h == INVALID_HANDLE_VALUE) { sprintf(g->Message, "Error opening header file %s", filename); @@ -3328,7 +3328,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn) PlugSetPath(filename, fn, Tdbp->GetPath()); -#if defined(WIN32) +#if defined(__WIN__) char *p; DWORD rc; bool brc; @@ -3380,7 +3380,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn) CloseHandle(h); return true; -#else // !WIN32 +#else // !__WIN__ int h; BIGINT pos; @@ -3409,7 +3409,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn) sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); close(h); return true; -#endif // !WIN32 +#endif // !__WIN__ } // end of MakeEmptyFile /***********************************************************************/ @@ -3440,7 +3440,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) htrc("OpenTableFile: filename=%s mode=%d Last=%d\n", filename, mode, Last); -#if defined(WIN32) +#if defined(__WIN__) DWORD access, creation, share = 0, rc = 0; /*********************************************************************/ @@ -3766,7 +3766,7 @@ int BGVFAM::WriteBuffer(PGLOBAL g) if (!Closing && !MaxBlk) { // Close the VCT file and reopen it in mode Insert -//#if defined(WIN32) //OB +//#if defined(__WIN__) //OB // CloseHandle(Hfile); //#else // UNIX // close(Hfile); @@ -3893,7 +3893,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc) /***************************************************************/ /* Remove extra records. */ /***************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) BIGINT pos = (BIGINT)Block * (BIGINT)Blksize; if (BigSeek(g, Hfile, pos)) @@ -3905,12 +3905,12 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc) sprintf(g->Message, MSG(SETEOF_ERROR), drc); return RC_FX; } // endif error -#else // !WIN32 +#else // !__WIN__ if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); return RC_FX; } // endif -#endif // !WIN32 +#endif // !__WIN__ } else // MaxBlk // Clean the unused space in the file, this is required when // inserting again with a partial column list. @@ -3947,7 +3947,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) else if (MakeEmptyFile(g, tempname)) return true; -#if defined(WIN32) +#if defined(__WIN__) DWORD access = (MaxBlk) ? OPEN_EXISTING : CREATE_NEW; Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL, @@ -4218,7 +4218,7 @@ void BGVFAM::Rewind(void) CurNum = Nrec - 1; #if 0 // This is probably unuseful as the file is directly accessed -#if defined(WIN32) //OB +#if defined(__WIN__) //OB SetFilePointer(Hfile, 0, NULL, FILE_BEGIN); #else // UNIX lseek64(Hfile, 0, SEEK_SET); diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index 54af93e11fa..56faa555069 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -17,21 +17,21 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #if defined(__BORLANDC__) #define __MFC_COMPAT__ // To define min/max as macro #endif //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #else // !UNIX #include <io.h> #endif #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -89,11 +89,11 @@ int ZIPFAM::Zerror(PGLOBAL g) strcpy(g->Message, gzerror(Zfile, &errnum)); if (errnum == Z_ERRNO) -#if defined(WIN32) +#if defined(__WIN__) sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(NULL)); -#else // !WIN32 +#else // !__WIN__ sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); -#endif // !WIN32 +#endif // !__WIN__ return (errnum == Z_STREAM_END) ? RC_EF : RC_FX; } // end of Zerror @@ -764,9 +764,9 @@ bool ZIXFAM::AllocateBuffer(PGLOBAL g) if (Tdbp->GetFtype() < 2) // if not binary, the file is physically a text file for (int len = Lrecl; len <= Buflen; len += Lrecl) { -#if defined(WIN32) +#if defined(__WIN__) To_Buf[len - 2] = '\r'; -#endif // WIN32 +#endif // __WIN__ To_Buf[len - 1] = '\n'; } // endfor len diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp index 949d49c2943..262d6b58a70 100644 --- a/storage/connect/filter.cpp +++ b/storage/connect/filter.cpp @@ -13,13 +13,13 @@ #include "sql_class.h" //#include "sql_time.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ diff --git a/storage/connect/filter.h b/storage/connect/filter.h index ab7c2139b68..15730e2cc44 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -106,7 +106,7 @@ class FILTERX : public FILTER { // Fake operator new used to change a filter into a derived filter void * operator new(size_t, PFIL filp) {return filp;} -#if defined(WIN32) +#if defined(__WIN__) // Avoid warning C4291 by defining a matching dummy delete operator void operator delete(void *, PFIL) {} #else diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c index a72a2b9b31e..22c3a1e79ad 100644 --- a/storage/connect/fmdlex.c +++ b/storage/connect/fmdlex.c @@ -20,11 +20,12 @@ */ #define FLEX_SCANNER -#if WIN32 +#ifdef __WIN__ #define __STDC__ 1 +#define isatty _isatty #endif #include <stdio.h> -#ifndef WIN32 +#ifndef __WIN__ #include <unistd.h> #endif diff --git a/storage/connect/global.h b/storage/connect/global.h index 10564d09815..4d01a3ff05b 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -13,11 +13,11 @@ #include <time.h> /* time_t type declaration */ #include <setjmp.h> /* Long jump declarations */ -#if defined(WIN32) && !defined(NOEX) +#if defined(__WIN__) && !defined(NOEX) #define DllExport __declspec( dllexport ) -#else // !WIN32 +#else // !__WIN__ #define DllExport -#endif // !WIN32 +#endif // !__WIN__ #if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT) #define XML_SUPPORT 1 @@ -42,11 +42,11 @@ #define STEP(I) MSG_##I #endif // !XMSG and !NEWMSG -#if defined(WIN32) +#if defined(__WIN__) #define CRLF 2 -#else // !WIN32 +#else // !__WIN__ #define CRLF 1 -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Define access to the thread based trace value. */ @@ -104,7 +104,7 @@ #define SYS_STAMP "DOSR" #elif defined(WIN) #define SYS_STAMP "WIN1" -#elif defined(WIN32) +#elif defined(__WIN__) #define SYS_STAMP "WIN2" #else #define SYS_STAMP "XXXX" @@ -248,9 +248,9 @@ DllExport char *PlugReadMessage(PGLOBAL, int, char *); #elif defined(NEWMSG) DllExport char *PlugGetMessage(PGLOBAL, int); #endif // XMSG || NEWMSG -#if defined(WIN32) +#if defined(__WIN__) DllExport short GetLineLength(PGLOBAL); // Console line length -#endif // WIN32 +#endif // __WIN__ DllExport PGLOBAL PlugInit(LPCSTR, uint); // Plug global initialization DllExport int PlugExit(PGLOBAL); // Plug global termination DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index bb7f0b4abcf..da357faa171 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -138,10 +138,10 @@ #include "reldef.h" #include "tabcol.h" #include "xindex.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include "tabwmi.h" -#endif // WIN32 +#endif // __WIN__ #include "connect.h" #include "user_connect.h" #include "ha_connect.h" @@ -170,12 +170,12 @@ extern "C" { char version[]= "Version 1.03.0007 April 30, 2015"; -#if defined(WIN32) +#if defined(__WIN__) char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__; char slash= '\\'; -#else // !WIN32 +#else // !__WIN__ char slash= '/'; -#endif // !WIN32 +#endif // !__WIN__ } // extern "C" #if defined(XMAP) @@ -629,11 +629,11 @@ static int connect_init_func(void *p) } #endif // 0 (LINUX) -#if defined(WIN32) +#if defined(__WIN__) sql_print_information("CONNECT: %s", compver); -#else // !WIN32 +#else // !__WIN__ sql_print_information("CONNECT: %s", version); -#endif // !WIN32 +#endif // !__WIN__ #ifdef LIBXML2_SUPPORT XmlInitParserLib(); @@ -675,9 +675,9 @@ static int connect_done_func(void *) XmlCleanupParserLib(); #endif // LIBXML2_SUPPORT -#if !defined(WIN32) +#if !defined(__WIN__) //PROFILE_End(); Causes signal 11 -#endif // !WIN32 +#endif // !__WIN__ for (pc= user_connect::to_users; pc; pc= pn) { if (pc->g) @@ -744,11 +744,11 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg) xp= (table) ? GetUser(ha_thd(), NULL) : NULL; if (xp) xp->SetHandler(this); -#if defined(WIN32) +#if defined(__WIN__) datapath= ".\\"; -#else // !WIN32 +#else // !__WIN__ datapath= "./"; -#endif // !WIN32 +#endif // !__WIN__ tdbp= NULL; sdvalin1= sdvalin2= sdvalin3= sdvalin4= NULL; sdvalout= NULL; @@ -3992,11 +3992,11 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn) case TAB_JSON: if (options->filename && *options->filename) { char *s, path[FN_REFLEN], dbpath[FN_REFLEN]; -#if defined(WIN32) +#if defined(__WIN__) s= "\\"; -#else // !WIN32 +#else // !__WIN__ s= "/"; -#endif // !WIN32 +#endif // !__WIN__ strcpy(dbpath, mysql_real_data_home); if (db) @@ -5001,9 +5001,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src; const char *col, *ocl, *rnk, *pic, *fcl, *skc; char *tab, *dsn, *shm, *dpath; -#if defined(WIN32) +#if defined(__WIN__) char *nsp= NULL, *cls= NULL; -#endif // WIN32 +#endif // __WIN__ int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0; int cop __attribute__((unused))= 0, lrecl= 0; #if defined(ODBC_SUPPORT) @@ -5066,10 +5066,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, skc= GetListOption(g, "skipcol", topt->oplist, NULL); rnk= GetListOption(g, "rankcol", topt->oplist, NULL); pwd= GetListOption(g, "password", topt->oplist); -#if defined(WIN32) +#if defined(__WIN__) nsp= GetListOption(g, "namespace", topt->oplist); cls= GetListOption(g, "class", topt->oplist); -#endif // WIN32 +#endif // __WIN__ port= atoi(GetListOption(g, "port", topt->oplist, "0")); #if defined(ODBC_SUPPORT) mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0")); @@ -5226,11 +5226,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ok= false; break; -#if defined(WIN32) +#if defined(__WIN__) case TAB_WMI: ok= true; break; -#endif // WIN32 +#endif // __WIN__ #if defined(PIVOT_SUPPORT) case TAB_PIVOT: supfnc= FNC_NO; @@ -5343,11 +5343,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, case TAB_CSV: qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL); break; -#if defined(WIN32) +#if defined(__WIN__) case TAB_WMI: qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL); break; -#endif // WIN32 +#endif // __WIN__ case TAB_PRX: case TAB_TBL: case TAB_XCL: @@ -5801,11 +5801,11 @@ int ha_connect::create(const char *name, TABLE *table_arg, // on Windows and libxml2 otherwise switch (*xsup) { case '*': -#if defined(WIN32) +#if defined(__WIN__) dom= true; -#else // !WIN32 +#else // !__WIN__ dom= false; -#endif // !WIN32 +#endif // !__WIN__ break; case 'M': case 'D': @@ -6152,11 +6152,11 @@ bool ha_connect::FileExists(const char *fn, bool bf) NULL, NULL, 0, 0)) return true; -#if defined(WIN32) +#if defined(__WIN__) s= "\\"; -#else // !WIN32 +#else // !__WIN__ s= "/"; -#endif // !WIN32 +#endif // !__WIN__ if (IsPartitioned()) { sprintf(tfn, fn, GetPartName()); diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 1e597f751ca..3d03bea5d00 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -23,7 +23,7 @@ #define ARGS MY_MIN(24,len-i),s+MY_MAX(i-3,0) -#if defined(WIN32) +#if defined(__WIN__) #define EL "\r\n" #else #define EL "\n" diff --git a/storage/connect/macutil.cpp b/storage/connect/macutil.cpp index 4d3022b91b6..f5d3bb11fe9 100644 --- a/storage/connect/macutil.cpp +++ b/storage/connect/macutil.cpp @@ -2,11 +2,11 @@ /* MACUTIL: Author Olivier Bertrand -- 2008-2012 */ /* From the article and sample code by Khalid Shaikh. */ /***********************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) #include "my_global.h" -#else // !WIN32 -#error This is WIN32 only DLL -#endif // !WIN32 +#else // !__WIN__ +#error This is WINDOWS only DLL +#endif // !__WIN__ #include "global.h" #include "plgdbsem.h" #include "macutil.h" diff --git a/storage/connect/macutil.h b/storage/connect/macutil.h index 8a3e97e12e1..c80bd58e20a 100644 --- a/storage/connect/macutil.h +++ b/storage/connect/macutil.h @@ -1,10 +1,10 @@ // MACUTIL.H Olivier Bertrand 2008-2012 // Get Mac Addresses via GetAdaptersInfo -#if defined(WIN32) +#if defined(__WIN__) #include <iphlpapi.h> -#else // !WIN32 -#error This is WIN32 only -#endif // !WIN32 +#else // !__WIN__ +#error This is WINDOWS only +#endif // !__WIN__ #include "block.h" typedef class MACINFO *MACIP; diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp index 97c638b4254..c4e016f1511 100644 --- a/storage/connect/maputil.cpp +++ b/storage/connect/maputil.cpp @@ -14,7 +14,7 @@ #include "plgdbsem.h" #include "maputil.h" -#ifdef WIN32 +#ifdef __WIN__ /***********************************************************************/ /* In Insert mode, just open the file for append. Otherwise */ /* create the mapping file object. The map handle can be released */ diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index 0ef43a245fa..9c72e9cd665 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -30,7 +30,7 @@ /***********************************************************************/ #include <my_config.h> -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> //#include <sqlext.h> #elif defined(UNIX) @@ -66,10 +66,10 @@ #include "tabfmt.h" #include "tabvct.h" #include "tabsys.h" -#if defined(WIN32) +#if defined(__WIN__) #include "tabmac.h" #include "tabwmi.h" -#endif // WIN32 +#endif // __WIN__ //#include "tabtbl.h" #include "tabxcl.h" #include "tabtbl.h" @@ -93,9 +93,9 @@ /***********************************************************************/ /* Extern static variables. */ /***********************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) extern "C" HINSTANCE s_hModule; // Saved module handle -#endif // !WIN32 +#endif // !__WIN__ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); @@ -142,7 +142,7 @@ TABTYPE GetTypeID(const char *type) : (!stricmp(type, "MYSQL")) ? TAB_MYSQL : (!stricmp(type, "MYPRX")) ? TAB_MYSQL : (!stricmp(type, "DIR")) ? TAB_DIR -#ifdef WIN32 +#ifdef __WIN__ : (!stricmp(type, "MAC")) ? TAB_MAC : (!stricmp(type, "WMI")) ? TAB_WMI #endif @@ -349,11 +349,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, void*, char*, char*, bool); const char *module, *subtype; char c, soname[_MAX_PATH], getname[40] = "Col"; -#if defined(WIN32) +#if defined(__WIN__) HANDLE hdll; /* Handle to the external DLL */ -#else // !WIN32 +#else // !__WIN__ void *hdll; /* Handle for the loaded shared library */ -#endif // !WIN32 +#endif // !__WIN__ XCOLDEF coldef = NULL; PQRYRES qrp = NULL; @@ -381,7 +381,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) if (!c) break; } // endfor i -#if defined(WIN32) +#if defined(__WIN__) // Load the Dll implementing the table if (!(hdll = LoadLibrary(soname))) { char buf[256]; @@ -401,7 +401,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) FreeLibrary((HMODULE)hdll); return NULL; } // endif coldef -#else // !WIN32 +#else // !__WIN__ const char *error = NULL; // Load the desired shared library @@ -418,7 +418,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) dlclose(hdll); return NULL; } // endif coldef -#endif // !WIN32 +#endif // !__WIN__ // Just in case the external Get function does not set error messages sprintf(g->Message, "Error getting column info from %s", subtype); @@ -426,11 +426,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) // Get the table column definition qrp = coldef(g, topt, tab, db, info); -#if defined(WIN32) +#if defined(__WIN__) FreeLibrary((HMODULE)hdll); -#else // !WIN32 +#else // !__WIN__ dlclose(hdll); -#endif // !WIN32 +#endif // !__WIN__ return qrp; } // end of OEMColumns @@ -442,11 +442,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) /***********************************************************************/ CATALOG::CATALOG(void) { -#if defined(WIN32) +#if defined(__WIN__) //DataPath= ".\\"; -#else // !WIN32 +#else // !__WIN__ //DataPath= "./"; -#endif // !WIN32 +#endif // !__WIN__ memset(&Ctb, 0, sizeof(CURTAB)); Cbuf= NULL; Cblen= 0; @@ -489,11 +489,11 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path) } if (*path != '.') { -#if defined(WIN32) +#if defined(__WIN__) char *s= "\\"; -#else // !WIN32 +#else // !__WIN__ char *s= "/"; -#endif // !WIN32 +#endif // !__WIN__ strcat(strcat(strcat(strcpy(buf, "."), s), path), s); } else strcpy(buf, path); @@ -554,10 +554,10 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) #if defined(ODBC_SUPPORT) case TAB_ODBC: tdp= new(g) ODBCDEF; break; #endif // ODBC_SUPPORT -#if defined(WIN32) +#if defined(__WIN__) case TAB_MAC: tdp= new(g) MACDEF; break; case TAB_WMI: tdp= new(g) WMIDEF; break; -#endif // WIN32 +#endif // __WIN__ case TAB_OEM: tdp= new(g) OEMDEF; break; case TAB_TBL: tdp= new(g) TBLDEF; break; case TAB_XCL: tdp= new(g) XCLDEF; break; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 2b958b512f3..ada0109a820 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -35,11 +35,11 @@ #include "my_sys.h" #include "mysqld_error.h" #endif // !MYSQL_PREPARED_STATEMENTS -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include "osutil.h" -#endif // !WIN32 +#endif // !__WIN__ #include "global.h" #include "plgdbsem.h" @@ -451,15 +451,15 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, mysql_options(m_DB, MYSQL_OPT_READ_TIMEOUT, &nrt); //mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...); -#if defined(WIN32) +#if defined(__WIN__) if (!strcmp(host, ".")) { mysql_options(m_DB, MYSQL_OPT_NAMED_PIPE, NULL); pipe = mysqld_unix_port; } // endif host -#else // !WIN32 +#else // !__WIN__ if (!strcmp(host, "localhost")) pipe = mysqld_unix_port; -#endif // !WIN32 +#endif // !__WIN__ #if 0 if (pwd && !strcmp(pwd, "*")) { diff --git a/storage/connect/myconn.h b/storage/connect/myconn.h index 79b8a43fe5a..fa34edd804c 100644 --- a/storage/connect/myconn.h +++ b/storage/connect/myconn.h @@ -7,24 +7,24 @@ /* DO NOT define DLL_EXPORT in your application so these items are */ /* declared are imported from the Myconn DLL. */ /***********************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) #include <winsock.h> -#else // !WIN32 +#else // !__WIN__ #include <sys/socket.h> -#endif // !WIN32 +#endif // !__WIN__ #include <mysql.h> #include <errmsg.h> #include "myutil.h" -#if defined(WIN32) && defined(MYCONN_EXPORTS) +#if defined(__WIN__) && defined(MYCONN_EXPORTS) #if defined(DLL_EXPORT) #define DllItem _declspec(dllexport) #else // !DLL_EXPORT #define DllItem _declspec(dllimport) #endif // !DLL_EXPORT -#else // !WIN32 || !MYCONN_EXPORTS +#else // !__WIN__ || !MYCONN_EXPORTS #define DllItem -#endif // !WIN32 +#endif // !__WIN__ #define MYSQL_ENABLED 0x00000001 #define MYSQL_LOGON 0x00000002 diff --git a/storage/connect/myutil.cpp b/storage/connect/myutil.cpp index fe504bbe422..d4416e188c8 100644 --- a/storage/connect/myutil.cpp +++ b/storage/connect/myutil.cpp @@ -13,11 +13,11 @@ /************************************************************************/ #include "my_global.h" #include <mysql.h> -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include "osutil.h" -#endif // !WIN32 +#endif // !__WIN__ #include "global.h" #include "plgdbsem.h" diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 2f2f5f38c29..0c89f8404f6 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -11,7 +11,7 @@ /***********************************************************************/ #include <my_global.h> #include <m_string.h> -#if defined(WIN32) +#if defined(__WIN__) //nclude <io.h> //nclude <fcntl.h> #include <direct.h> // for getcwd @@ -45,13 +45,13 @@ #include "osutil.h" -#if defined(WIN32) +#if defined(__WIN__) /***********************************************************************/ /* For dynamic load of ODBC32.DLL */ /***********************************************************************/ #pragma comment(lib, "odbc32.lib") extern "C" HINSTANCE s_hModule; // Saved module handle -#endif // WIN32 +#endif // __WIN__ int GetConvSize(); @@ -1201,15 +1201,15 @@ bool ODBConn::DriverConnect(DWORD Options) SWORD nResult; PUCHAR ConnOut = (PUCHAR)PlugSubAlloc(m_G, NULL, MAX_CONNECT_LEN); UWORD wConnectOption = SQL_DRIVER_COMPLETE; -#if defined(WIN32) +#if defined(__WIN__) HWND hWndTop = GetForegroundWindow(); HWND hWnd = GetParent(hWndTop); if (hWnd == NULL) hWnd = GetDesktopWindow(); -#else // !WIN32 +#else // !__WIN__ HWND hWnd = (HWND)1; -#endif // !WIN32 +#endif // !__WIN__ PGLOBAL& g = m_G; PDBUSER dup = PlgGetUser(g); @@ -1222,10 +1222,10 @@ bool ODBConn::DriverConnect(DWORD Options) SQL_NTS, ConnOut, MAX_CONNECT_LEN, &nResult, wConnectOption); -#if defined(WIN32) +#if defined(__WIN__) if (hWndTop) EnableWindow(hWndTop, true); -#endif // WIN32 +#endif // __WIN__ // If user hit 'Cancel' if (rc == SQL_NO_DATA_FOUND) { diff --git a/storage/connect/odbconn.h b/storage/connect/odbconn.h index 41cc2439354..6a24334f08c 100644 --- a/storage/connect/odbconn.h +++ b/storage/connect/odbconn.h @@ -29,9 +29,9 @@ //efine MAX_CURSOR_NAME 18 // Max size of a cursor name #define DEFAULT_FIELD_TYPE SQL_TYPE_NULL // pick "C" data type to match SQL data type -#if !defined(WIN32) +#if !defined(__WIN__) typedef unsigned char *PUCHAR; -#endif // !WIN32 +#endif // !__WIN__ // Field Flags, used to indicate status of fields //efine SQL_FIELD_FLAG_DIRTY 0x1 diff --git a/storage/connect/os.h b/storage/connect/os.h index 8f77a0ad39f..2dc603fdcda 100644 --- a/storage/connect/os.h +++ b/storage/connect/os.h @@ -15,16 +15,16 @@ typedef off_t off64_t; #endif #endif -#if defined(WIN32) +#if defined(__WIN__) typedef __int64 BIGINT; -#else // !WIN32 +#else // !__WIN__ typedef longlong BIGINT; #define FILE_BEGIN SEEK_SET #define FILE_CURRENT SEEK_CUR #define FILE_END SEEK_END -#endif // !WIN32 +#endif // !__WIN__ -#if !defined(WIN32) +#if !defined(__WIN__) typedef const void *LPCVOID; typedef const char *LPCTSTR; typedef const char *LPCSTR; @@ -61,6 +61,6 @@ typedef int HANDLE; #define _MAX_EXT FN_EXTLEN #define INVALID_HANDLE_VALUE (-1) #define __stdcall -#endif /* !WIN32 */ +#endif /* !__WIN__ */ #endif /* _OS_H_INCLUDED */ diff --git a/storage/connect/osutil.c b/storage/connect/osutil.c index 66985847ce7..2e9e120b0c8 100644 --- a/storage/connect/osutil.c +++ b/storage/connect/osutil.c @@ -4,7 +4,7 @@ #include <stdio.h> #include "osutil.h" -#ifdef WIN32 +#ifdef __WIN__ my_bool CloseFileHandle(HANDLE h) { return !CloseHandle(h); diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index 05dc59aec02..b57d9e20ceb 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -544,11 +544,11 @@ typedef struct _colres { char Var; /* Type added information */ } COLRES; -#if defined(WIN32) && !defined(NOEX) +#if defined(__WIN__) && !defined(NOEX) #define DllExport __declspec( dllexport ) -#else // !WIN32 +#else // !__WIN__ #define DllExport -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Utility routines. */ diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index a2b1baf1249..9e236da2d93 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -38,12 +38,12 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> #define BIGMEM 1048576 // 1 Megabyte -#else // !WIN32 +#else // !__WIN__ #include <unistd.h> #include <fcntl.h> #if defined(THREAD) @@ -51,7 +51,7 @@ #endif // THREAD #include <stdarg.h> #define BIGMEM 2147483647 // Max int value -#endif // !WIN32 +#endif // !__WIN__ #include <locale.h> /***********************************************************************/ @@ -73,11 +73,11 @@ /* Macro or external routine definition */ /***********************************************************************/ #if defined(THREAD) -#if defined(WIN32) +#if defined(__WIN__) extern CRITICAL_SECTION parsec; // Used calling the Flex parser -#else // !WIN32 +#else // !__WIN__ extern pthread_mutex_t parmut; -#endif // !WIN32 +#endif // !__WIN__ #endif // THREAD /***********************************************************************/ @@ -403,11 +403,11 @@ char *SetPath(PGLOBAL g, const char *path) } // endif path if (*path != '.') { -#if defined(WIN32) +#if defined(__WIN__) char *s= "\\"; -#else // !WIN32 +#else // !__WIN__ char *s= "/"; -#endif // !WIN32 +#endif // !__WIN__ strcat(strcat(strcat(strcpy(buf, "."), s), path), s); } else strcpy(buf, path); @@ -426,7 +426,7 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op) char *drive = NULL, *direc = NULL, *fname = NULL, *ftype = NULL; switch (op) { // Determine which part to extract -#if !defined(UNIX) +#if defined(__WIN__) case OP_FDISK: drive = pBuff; break; #endif // !UNIX case OP_FPATH: direc = pBuff; break; @@ -702,19 +702,19 @@ PDTP MakeDateFormat(PGLOBAL g, PSZ dfmt, bool in, bool out, int flag) /* instruction is included in an Enter/LeaveCriticalSection bracket. */ /*********************************************************************/ #if defined(THREAD) -#if defined(WIN32) +#if defined(__WIN__) EnterCriticalSection((LPCRITICAL_SECTION)&parsec); -#else // !WIN32 +#else // !__WIN__ pthread_mutex_lock(&parmut); -#endif // !WIN32 +#endif // !__WIN__ #endif // THREAD /*int rc =*/ fmdflex(pdp); #if defined(THREAD) -#if defined(WIN32) +#if defined(__WIN__) LeaveCriticalSection((LPCRITICAL_SECTION)&parsec); -#else // !WIN32 +#else // !__WIN__ pthread_mutex_unlock(&parmut); -#endif // !WIN32 +#endif // !__WIN__ #endif // THREAD if (trace) @@ -1109,7 +1109,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp) return amn; } // end of GetAmName -#if defined(WIN32) && !defined(NOCATCH) +#if defined(__WIN__) && !defined(NOCATCH) /***********************************************************************/ /* GetExceptionDesc: return the description of an exception code. */ /***********************************************************************/ @@ -1197,7 +1197,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e) return p; } // end of GetExceptionDesc -#endif // WIN32 && !NOCATCH +#endif // __WIN__ && !NOCATCH /***********************************************************************/ /* PlgDBalloc: allocates or suballocates memory conditionally. */ @@ -1239,7 +1239,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp) if (!mp.Sub) { // For allocations greater than one fourth of remaining storage // in the area, do allocate from virtual storage. -#if defined(WIN32) +#if defined(__WIN__) if (mp.Size >= BIGMEM) mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT, PAGE_READWRITE); else @@ -1336,7 +1336,7 @@ void PlgDBfree(MBLOCK& mp) htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size); if (!mp.Sub && mp.Memp) -#if defined(WIN32) +#if defined(__WIN__) if (mp.Size >= BIGMEM) VirtualFree(mp.Memp, 0, MEM_RELEASE); else @@ -1532,11 +1532,11 @@ int FileComp(PGLOBAL g, char *file1, char *file2) bp[0] = buff1; bp[1] = buff2; for (i = 0; i < 2; i++) { -#if defined(WIN32) +#if defined(__WIN__) h[i]= global_open(g, MSGID_NONE, fn[i], _O_RDONLY | _O_BINARY); -#else // !WIN32 +#else // !__WIN__ h[i]= global_open(g, MSGOD_NONE, fn[i], O_RDONLY); -#endif // !WIN32 +#endif // !__WIN__ if (h[i] == -1) { // if (errno != ENOENT) { diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c index 36d115e0096..63526f5fc48 100644 --- a/storage/connect/plugutil.c +++ b/storage/connect/plugutil.c @@ -44,7 +44,7 @@ /* */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> #else #if defined(UNIX) || defined(UNIV_LINUX) @@ -80,9 +80,9 @@ #include "rcmsg.h" #endif // NEWMSG -#if defined(WIN32) +#if defined(__WIN__) extern HINSTANCE s_hModule; /* Saved module handle */ -#endif // WIN32 +#endif // __WIN__ #if defined(XMSG) extern char *msg_path; @@ -192,7 +192,7 @@ int PlugExit(PGLOBAL g) /***********************************************************************/ LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName) { -#if !defined(UNIX) && !defined(UNIV_LINUX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -220,7 +220,7 @@ LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName) BOOL PlugIsAbsolutePath(LPCSTR path) { -#if defined(WIN32) +#if defined(__WIN__) return ((path[0] >= 'a' && path[0] <= 'z') || (path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':'; #else @@ -238,7 +238,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) char direc[_MAX_DIR], defdir[_MAX_DIR], tmpdir[_MAX_DIR]; char fname[_MAX_FNAME]; char ftype[_MAX_EXT]; -#if !defined(UNIX) && !defined(UNIV_LINUX) +#if defined(__WIN__) char drive[_MAX_DRIVE], defdrv[_MAX_DRIVE]; #else char *drive = NULL, *defdrv = NULL; @@ -255,7 +255,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) return pBuff; } // endif -#if !defined(WIN32) +#if !defined(__WIN__) if (*FileName == '~') { if (_fullpath(pBuff, FileName, _MAX_PATH)) { if (trace > 1) @@ -266,7 +266,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) return FileName; // Error, return unchanged name } // endif FileName -#endif // !WIN32 +#endif // !__WIN__ if (prefix && strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath)) { @@ -295,11 +295,11 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) if (trace > 1) { htrc("after _splitpath: FileName=%s\n", FileName); -#if defined(UNIX) || defined(UNIV_LINUX) - htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype); -#else +#if defined(__WIN__) htrc("drive=%s dir=%s fname=%s ext=%s\n", drive, direc, fname, ftype); htrc("defdrv=%s defdir=%s\n", defdrv, defdir); +#else + htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype); #endif } // endif trace @@ -427,7 +427,7 @@ char *PlugGetMessage(PGLOBAL g, int mid) } // end of PlugGetMessage #endif // NEWMSG -#if defined(WIN32) +#if defined(__WIN__) /***********************************************************************/ /* Return the line length of the console screen buffer. */ /***********************************************************************/ @@ -439,7 +439,7 @@ short GetLineLength(PGLOBAL g) return (b) ? coninfo.dwSize.X : 0; } // end of GetLineLength -#endif // WIN32 +#endif // __WIN__ /***********************************************************************/ /* Program for memory allocation of work and language areas. */ diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index 9eea944c697..75759e03314 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -1,68 +1,68 @@ -/**************** RCMsg C Program Source Code File (.C) ****************/
-/* PROGRAM NAME: RCMSG */
-/* ------------- */
-/* Version 1.3 */
-/* */
-/* COPYRIGHT */
-/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND: 2005 - 2014 */
-/* */
-/* WHAT THIS PROGRAM DOES */
-/* ----------------------- */
-/* This program simulates LoadString. */
-/* */
-/***********************************************************************/
-#if !defined(XMSG)
-#include <stdio.h>
-#include <string.h>
-#include "resource.h"
-#include "rcmsg.h"
-#if defined(NEWMSG)
-#include "msgid.h"
-#endif // NEWMSG
-
-#if !defined(WIN32)
-#define stricmp strcasecmp
-#endif // !WIN32
-
-char *msglang(void);
-
-char *GetMsgid(int id)
- {
- char *p = NULL;
-
- // This conditional until a real fix is found for MDEV-7304
-#if defined(FRENCH)
- if (!stricmp(msglang(), "french"))
- switch (id) {
-#include "frids.h"
-#if defined(NEWMSG)
-#include "frcas.h"
-#endif // NEWMSG
- } // endswitch(id)
-
- else // English
-#endif // FRENCH
- switch (id) {
-#include "enids.h"
-#if defined(NEWMSG)
-#include "encas.h"
-#endif // NEWMSG
- } // endswitch(id)
-
- return p;
- } // end of GetMsgid
-
-int GetRcString(int id, char *buf, int bufsize)
- {
- char *p = NULL, msg[32];
-
- if (!(p = GetMsgid(id))) {
- sprintf(msg, "ID=%d unknown", id);
- p = msg;
- } // endif p
-
- return sprintf(buf, "%.*s", bufsize-1, p);
- } // end of GetRcString
-
-#endif // !XMSG
+/**************** RCMsg C Program Source Code File (.C) ****************/ +/* PROGRAM NAME: RCMSG */ +/* ------------- */ +/* Version 1.3 */ +/* */ +/* COPYRIGHT */ +/* ---------- */ +/* (C) Copyright to the author Olivier BERTRAND: 2005 - 2014 */ +/* */ +/* WHAT THIS PROGRAM DOES */ +/* ----------------------- */ +/* This program simulates LoadString. */ +/* */ +/***********************************************************************/ +#if !defined(XMSG) +#include <stdio.h> +#include <string.h> +#include "resource.h" +#include "rcmsg.h" +#if defined(NEWMSG) +#include "msgid.h" +#endif // NEWMSG + +#if !defined(__WIN__) +#define stricmp strcasecmp +#endif // !__WIN__ + +char *msglang(void); + +char *GetMsgid(int id) + { + char *p = NULL; + + // This conditional until a real fix is found for MDEV-7304 +#if defined(FRENCH) + if (!stricmp(msglang(), "french")) + switch (id) { +#include "frids.h" +#if defined(NEWMSG) +#include "frcas.h" +#endif // NEWMSG + } // endswitch(id) + + else // English +#endif // FRENCH + switch (id) { +#include "enids.h" +#if defined(NEWMSG) +#include "encas.h" +#endif // NEWMSG + } // endswitch(id) + + return p; + } // end of GetMsgid + +int GetRcString(int id, char *buf, int bufsize) + { + char *p = NULL, msg[32]; + + if (!(p = GetMsgid(id))) { + sprintf(msg, "ID=%d unknown", id); + p = msg; + } // endif p + + return sprintf(buf, "%.*s", bufsize-1, p); + } // end of GetRcString + +#endif // !XMSG diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 720ede8f225..60d515a61ca 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -17,7 +17,7 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <sqlext.h> #else #include <dlfcn.h> // dlopen(), dlclose(), dlsym() ... @@ -48,9 +48,9 @@ #include "tabmul.h" #include "ha_connect.h" -#if !defined(WIN32) +#if !defined(__WIN__) extern handlerton *connect_hton; -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* External function. */ @@ -479,7 +479,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) } else PlugSetPath(soname, Module, GetPluginDir()); -#if defined(WIN32) +#if defined(__WIN__) // Is the DLL already loaded? if (!Hdll && !(Hdll = GetModuleHandle(soname))) // No, load the Dll implementing the function @@ -508,7 +508,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) FreeLibrary((HMODULE)Hdll); return NULL; } // endif getdef -#else // !WIN32 +#else // !__WIN__ const char *error = NULL; Dl_info dl_info; @@ -551,7 +551,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) dlclose(Hdll); return NULL; } // endif getdef -#endif // !WIN32 +#endif // !__WIN__ // Just in case the external Get function does not set error messages sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype); diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h index ec70f18e151..4aa29037dfc 100644 --- a/storage/connect/reldef.h +++ b/storage/connect/reldef.h @@ -139,11 +139,11 @@ class DllExport OEMDEF : public TABDEF { /* OEM table */ PTABDEF GetXdef(PGLOBAL g); // Members -#if defined(WIN32) +#if defined(__WIN__) HANDLE Hdll; /* Handle to the external DLL */ -#else // !WIN32 +#else // !__WIN__ void *Hdll; /* Handle for the loaded shared library */ -#endif // !WIN32 +#endif // !__WIN__ PTABDEF Pxdef; /* Pointer to the external TABDEF class */ char *Module; /* Path/Name of the DLL implenting it */ char *Subtype; /* The name of the OEM table sub type */ diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index bee56e31886..a1e58ab3344 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -17,7 +17,7 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <sys\timeb.h> // For testing only #include <fcntl.h> @@ -26,7 +26,7 @@ #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #include <unistd.h> @@ -34,7 +34,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -208,11 +208,11 @@ void DOSDEF::RemoveOptValues(PGLOBAL g) // Delete any eventually ill formed non matching optimization file if (!GetOptFileName(g, filename)) -#if defined(WIN32) +#if defined(__WIN__) DeleteFile(filename); #else // UNIX remove(filename); -#endif // WIN32 +#endif // __WIN__ Optimized = 0; } // end of RemoveOptValues @@ -253,7 +253,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) /*********************************************************************/ if (sep) { // Indexes are save in separate files -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -270,7 +270,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) strcat(strcat(fname, "_"), pxdf->GetName()); _makepath(filename, drive, direc, fname, ftype); PlugSetPath(filename, filename, GetPath()); -#if defined(WIN32) +#if defined(__WIN__) if (!DeleteFile(filename)) rc |= (GetLastError() != ERROR_FILE_NOT_FOUND); #else // UNIX @@ -287,7 +287,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) // Drop all indexes, delete the common file PlugSetPath(filename, Ofn, GetPath()); strcat(PlugRemoveType(filename, filename), ftype); -#if defined(WIN32) +#if defined(__WIN__) if (!DeleteFile(filename)) rc = (GetLastError() != ERROR_FILE_NOT_FOUND); #else // UNIX @@ -956,7 +956,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) #if 0 if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS) return false; -#endif // WIN32 +#endif // __WIN__ if (defp->Optimized) return false; // Already done or to be redone diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp index 83fe14ca85c..acd548c86ab 100644 --- a/storage/connect/tabfix.cpp +++ b/storage/connect/tabfix.cpp @@ -17,7 +17,7 @@ /* Include relevant section of system dependant header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> @@ -25,7 +25,7 @@ #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <sys/types.h> #include <sys/stat.h> @@ -35,7 +35,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index a5e14e1b81f..015f8d93b15 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -20,7 +20,7 @@ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> @@ -102,14 +102,14 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, } // endif info // num_max = atoi(p+1); // Max num of record to test -#if defined(WIN32) +#if defined(__WIN__) if (sep == ',' || strnicmp(setlocale(LC_NUMERIC, NULL), "French", 6)) dechar = '.'; else dechar = ','; -#else // !WIN32 +#else // !__WIN__ dechar = '.'; -#endif // !WIN32 +#endif // !__WIN__ if (trace) htrc("File %s sep=%c q=%c hdr=%d mxr=%d\n", @@ -147,7 +147,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, if (fgets(buf, sizeof(buf), infile)) { n = strlen(buf) + 1; buf[n - 2] = '\0'; -#if defined(UNIX) +#if !defined(__WIN__) // The file can be imported from Windows if (buf[n - 3] == '\r') buf[n - 3] = 0; @@ -204,7 +204,7 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, if (fgets(buf, sizeof(buf), infile)) { n = strlen(buf); buf[n - 1] = '\0'; -#if defined(UNIX) +#if !defined(__WIN__) // The file can be imported from Windows if (buf[n - 2] == '\r') buf[n - 2] = 0; diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index cfc56212c40..fafba6228b9 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -623,11 +623,11 @@ bool TDBJSN::SkipHeader(PGLOBAL g) return true; #endif // _DEBUG -#if defined(WIN32) +#if defined(__WIN__) #define Ending 2 -#else // !WIN32 +#else // !__WIN__ #define Ending 1 -#endif // !WIN32 +#endif // !__WIN__ if (Pretty == 1) { if (Mode == MODE_INSERT || Mode == MODE_DELETE) { diff --git a/storage/connect/tabmac.cpp b/storage/connect/tabmac.cpp index f072465ced5..e6e2abb54e2 100644 --- a/storage/connect/tabmac.cpp +++ b/storage/connect/tabmac.cpp @@ -3,12 +3,12 @@ /* From the article and sample code by Khalid Shaikh. */ /* TABMAC: virtual table to get the list of MAC addresses. */ /***********************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) #include "my_global.h" //#include <iphlpapi.h> -#else // !WIN32 -#error This is a WIN32 only table type -#endif // !WIN32 +#else // !__WIN__ +#error This is a WINDOWS only table type +#endif // !__WIN__ #include "global.h" #include "plgdbsem.h" //#include "catalog.h" diff --git a/storage/connect/tabmac.h b/storage/connect/tabmac.h index 5e6c98d68fb..f9a66e82eaa 100644 --- a/storage/connect/tabmac.h +++ b/storage/connect/tabmac.h @@ -1,11 +1,11 @@ // TABMAC.H Olivier Bertrand 2011-2012 // MAC: virtual table to Get Mac Addresses via GetAdaptersInfo -#if defined(WIN32) +#if defined(__WIN__) #include <windows.h> #include <iphlpapi.h> -#else // !WIN32 -#error This is a WIN32 only table TYPE -#endif // !WIN32 +#else // !__WIN__ +#error This is a WINDOWS only table TYPE +#endif // !__WIN__ /***********************************************************************/ /* Definitions. */ diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index 12e8de2c808..3008ca1b8ca 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -37,7 +37,7 @@ /* Include relevant section of system dependant header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <stdlib.h> #include <stdio.h> #if defined(__BORLANDC__) @@ -145,7 +145,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) /*******************************************************************/ /* To_File is a multiple name with special characters */ /*******************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) char drive[_MAX_DRIVE], direc[_MAX_DIR]; WIN32_FIND_DATA FileData; HANDLE hSearch; @@ -196,7 +196,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) return true; } // endif FindClose -#else // !WIN32 +#else // !__WIN__ struct stat fileinfo; char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN]; DIR *dir; @@ -249,7 +249,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) // Close the dir handle. closedir(dir); -#endif // !WIN32 +#endif // !__WIN__ } else { /*******************************************************************/ @@ -269,7 +269,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) p = filename + strlen(filename) - 1; -#if defined(UNIX) +#if !defined(__WIN__) // Data files can be imported from Windows (having CRLF) if (*p == '\n' || *p == '\r') { // is this enough for Unix ??? @@ -297,7 +297,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) } // endif Mul -#if defined(WIN32) +#if defined(__WIN__) suite: #endif @@ -620,17 +620,17 @@ TDBDIR::TDBDIR(PDIRDEF tdp) : TDBASE(tdp) { To_File = tdp->Fn; iFile = 0; -#if defined(WIN32) +#if defined(__WIN__) memset(&FileData, 0, sizeof(_finddata_t)); Hsearch = -1; *Drive = '\0'; -#else // !WIN32 +#else // !__WIN__ memset(&Fileinfo, 0, sizeof(struct stat)); Entry = NULL; Dir = NULL; Done = false; *Pattern = '\0'; -#endif // !WIN32 +#endif // !__WIN__ *Fpath = '\0'; *Direc = '\0'; *Fname = '\0'; @@ -641,17 +641,17 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp) { To_File = tdbp->To_File; iFile = tdbp->iFile; -#if defined(WIN32) +#if defined(__WIN__) FileData = tdbp->FileData; Hsearch = tdbp->Hsearch; strcpy(Drive, tdbp->Drive); -#else // !WIN32 +#else // !__WIN__ Fileinfo = tdbp->Fileinfo; Entry = tdbp->Entry; Dir = tdbp->Dir; Done = tdbp->Done; strcpy(Pattern, tdbp->Pattern); -#endif // !WIN32 +#endif // !__WIN__ strcpy(Direc, tdbp->Direc); strcpy(Fname, tdbp->Fname); strcpy(Ftype, tdbp->Ftype); @@ -675,7 +675,7 @@ char* TDBDIR::Path(PGLOBAL g) { PCATLG cat = PlgGetCatalog(g); -#if defined(WIN32) +#if defined(__WIN__) if (!*Drive) { PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath()); _splitpath(Fpath, Drive, Direc, Fname, Ftype); @@ -683,7 +683,7 @@ char* TDBDIR::Path(PGLOBAL g) _makepath(Fpath, Drive, Direc, Fname, Ftype); // Usefull ??? return Fpath; -#else // !WIN32 +#else // !__WIN__ if (!Done) { PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath()); _splitpath(Fpath, NULL, Direc, Fname, Ftype); @@ -692,7 +692,7 @@ char* TDBDIR::Path(PGLOBAL g) } // endif Done return Pattern; -#endif // !WIN32 +#endif // !__WIN__ } // end of Path /***********************************************************************/ @@ -710,7 +710,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) { if (MaxSize < 0) { int n = -1; -#if defined(WIN32) +#if defined(__WIN__) int h; // Start searching files in the target directory. @@ -726,7 +726,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) } else n = 0; -#else // !WIN32 +#else // !__WIN__ Path(g); // Start searching files in the target directory. @@ -750,7 +750,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g) // Close the DIR handle. closedir(Dir); -#endif // !WIN32 +#endif // !__WIN__ MaxSize = n; } // endif MaxSize @@ -776,10 +776,10 @@ bool TDBDIR::OpenDB(PGLOBAL g) } // endif use Use = USE_OPEN; -#if !defined(WIN32) +#if !defined(__WIN__) Path(g); // Be sure it is done Dir = NULL; // For ReadDB -#endif // !WIN32 +#endif // !__WIN__ return false; } // end of OpenDB @@ -790,7 +790,7 @@ int TDBDIR::ReadDB(PGLOBAL g) { int rc = RC_OK; -#if defined(WIN32) +#if defined(__WIN__) if (Hsearch == -1) { /*******************************************************************/ /* Start searching files in the target directory. The use of the */ @@ -848,7 +848,7 @@ int TDBDIR::ReadDB(PGLOBAL g) rc = RC_EF; } // endif Entry -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of ReadDB @@ -876,17 +876,17 @@ int TDBDIR::DeleteDB(PGLOBAL g, int) /***********************************************************************/ void TDBDIR::CloseDB(PGLOBAL) { -#if defined(WIN32) +#if defined(__WIN__) // Close the search handle. _findclose(Hsearch); Hsearch = -1; -#else // !WIN32 +#else // !__WIN__ // Close the DIR handle if (Dir) { closedir(Dir); Dir = NULL; } // endif dir -#endif // !WIN32 +#endif // !__WIN__ iFile = 0; } // end of CloseDB @@ -935,19 +935,19 @@ void DIRCOL::ReadColumn(PGLOBAL g) /* Retrieve the information corresponding to the column number. */ /*********************************************************************/ switch (N) { -#if defined(WIN32) +#if defined(__WIN__) case 0: Value->SetValue_psz(tdbp->Drive); break; -#endif // WIN32 +#endif // __WIN__ case 1: Value->SetValue_psz(tdbp->Direc); break; case 2: Value->SetValue_psz(tdbp->Fname); break; case 3: Value->SetValue_psz(tdbp->Ftype); break; -#if defined(WIN32) +#if defined(__WIN__) case 4: Value->SetValue((int)tdbp->FileData.attrib); break; case 5: Value->SetValue((int)tdbp->FileData.size); break; case 6: Value->SetValue((int)tdbp->FileData.time_write); break; case 7: Value->SetValue((int)tdbp->FileData.time_create); break; case 8: Value->SetValue((int)tdbp->FileData.time_access); break; -#else // !WIN32 +#else // !__WIN__ case 4: Value->SetValue((int)tdbp->Fileinfo.st_mode); break; case 5: Value->SetValue((int)tdbp->Fileinfo.st_size); break; case 6: Value->SetValue((int)tdbp->Fileinfo.st_mtime); break; @@ -955,7 +955,7 @@ void DIRCOL::ReadColumn(PGLOBAL g) case 8: Value->SetValue((int)tdbp->Fileinfo.st_atime); break; case 9: Value->SetValue((int)tdbp->Fileinfo.st_uid); break; case 10: Value->SetValue((int)tdbp->Fileinfo.st_gid); break; -#endif // !WIN32 +#endif // !__WIN__ default: sprintf(g->Message, MSG(INV_DIRCOL_OFST), N); longjmp(g->jumper[g->jump_level], GetAmType()); @@ -1006,7 +1006,7 @@ int TDBSDR::FindInDir(PGLOBAL g) size_t m = strlen(Direc); // Start searching files in the target directory. -#if defined(WIN32) +#if defined(__WIN__) int h = _findfirst(Path(g), &FileData); if (h != -1) { @@ -1039,7 +1039,7 @@ int TDBSDR::FindInDir(PGLOBAL g) // Close the search handle. _findclose(h); } // endif h -#else // !WIN32 +#else // !__WIN__ int k; DIR *dir = opendir(Direc); @@ -1073,7 +1073,7 @@ int TDBSDR::FindInDir(PGLOBAL g) // Close the DIR handle. closedir(dir); -#endif // !WIN32 +#endif // !__WIN__ return n; } // end of FindInDir @@ -1089,13 +1089,13 @@ bool TDBSDR::OpenDB(PGLOBAL g) Sub = (PSUBDIR)PlugSubAlloc(g, NULL, sizeof(SUBDIR)); Sub->Next = NULL; Sub->Prev = NULL; -#if defined(WIN32) +#if defined(__WIN__) Sub->H = -1; Sub->Len = strlen(Direc); -#else // !WIN32 +#else // !__WIN__ Sub->D = NULL; Sub->Len = 0; -#endif // !WIN32 +#endif // !__WIN__ } // endif To_Sub return TDBDIR::OpenDB(g); @@ -1108,7 +1108,7 @@ int TDBSDR::ReadDB(PGLOBAL g) { int rc; -#if defined(WIN32) +#if defined(__WIN__) again: rc = TDBDIR::ReadDB(g); @@ -1160,7 +1160,7 @@ int TDBSDR::ReadDB(PGLOBAL g) } // endif H } // endif rc -#else // !WIN32 +#else // !__WIN__ rc = RC_NF; again: @@ -1217,7 +1217,7 @@ int TDBSDR::ReadDB(PGLOBAL g) } // endif Entry -#endif // !WIN32 +#endif // !__WIN__ return rc; } // end of ReadDB diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h index 379e8f88e93..433cc3a2ee3 100644 --- a/storage/connect/tabmul.h +++ b/storage/connect/tabmul.h @@ -6,14 +6,14 @@ /* */ /* This file contains the TDBMUL and TDBDIR classes declares. */ /***********************************************************************/ -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> -#else // !WIN32 +#else // !__WIN__ #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <dirent.h> -#endif // !WIN32 +#endif // !__WIN__ //#include "osutil.h" #include "block.h" @@ -132,17 +132,17 @@ class TDBDIR : public TDBASE { // Members PSZ To_File; // Points to file search pathname int iFile; // Index of currently retrieved file -#if defined(WIN32) +#if defined(__WIN__) _finddata_t FileData; // Find data structure int Hsearch; // Search handle char Drive[_MAX_DRIVE]; // Drive name -#else // !WIN32 +#else // !__WIN__ struct stat Fileinfo; // File info structure struct dirent *Entry; // Point to directory entry structure DIR *Dir; // To searched directory structure bool Done; // true when _splipath is done char Pattern[_MAX_FNAME+_MAX_EXT]; -#endif // !WIN32 +#endif // !__WIN__ char Fpath[_MAX_PATH]; // Absolute file search pattern char Direc[_MAX_DIR]; // Search path char Fname[_MAX_FNAME]; // File name @@ -183,11 +183,11 @@ class TDBSDR : public TDBDIR { typedef struct _Sub_Dir { struct _Sub_Dir *Next; struct _Sub_Dir *Prev; -#if defined(WIN32) +#if defined(__WIN__) int H; // Search handle -#else // !WIN32 +#else // !__WIN__ DIR *D; -#endif // !WIN32 +#endif // !__WIN__ size_t Len; // Initial directory name length } SUBDIR, *PSUBDIR; diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index cb7011822d8..19a5dfd758f 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -35,9 +35,9 @@ #include "my_global.h" #include "sql_class.h" #include "sql_servers.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ //#include <fnmatch.h> //#include <errno.h> #include <stdlib.h> @@ -46,7 +46,7 @@ #include "osutil.h" //#include <io.h> //#include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp index da3cafc3c8f..07e260154e0 100644 --- a/storage/connect/taboccur.cpp +++ b/storage/connect/taboccur.cpp @@ -13,7 +13,7 @@ /***********************************************************************/ #include "my_global.h" #include "table.h" // MySQL table definitions -#if defined(WIN32) +#if defined(__WIN__) #include <stdlib.h> #include <stdio.h> #if defined(__BORLANDC__) diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 3bf1238cebc..ad7892469cd 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -35,7 +35,7 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #if defined(__BORLANDC__) diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp index b36dcbf94af..b628e26d3c7 100644 --- a/storage/connect/tabpivot.cpp +++ b/storage/connect/tabpivot.cpp @@ -17,7 +17,7 @@ /***********************************************************************/ #include "my_global.h" #include "table.h" // MySQL table definitions -#if defined(WIN32) +#if defined(__WIN__) #if defined(__BORLANDC__) #define __MFC_COMPAT__ // To define min/max as macro #endif diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp index 623aeca36fe..76890e84429 100644 --- a/storage/connect/tabsys.cpp +++ b/storage/connect/tabsys.cpp @@ -12,12 +12,12 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #if defined(__BORLANDC__) #define __MFC_COMPAT__ // To define min/max as macro #endif // __BORLANDC__ //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <errno.h> #include <unistd.h> @@ -25,7 +25,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include application header files: */ @@ -36,9 +36,9 @@ #include "global.h" #include "plgdbsem.h" #include "reldef.h" -#if !defined(WIN32) +#if !defined(__WIN__) #include "osutil.h" -#endif // !WIN32 +#endif // !__WIN__ #include "filamtxt.h" #include "tabdos.h" #include "tabsys.h" @@ -48,10 +48,10 @@ #define CSZ 36 // Column section name length #define CDZ 256 // Column definition length -#if !defined(WIN32) +#if !defined(__WIN__) #define GetPrivateProfileSectionNames(S,L,I) \ GetPrivateProfileString(NULL,NULL,"",S,L,I) -#endif // !WIN32 +#endif // !__WIN__ /* -------------- Implementation of the INI classes ------------------ */ @@ -123,7 +123,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g) // Delete the INI table file if not protected if (!IsReadOnly()) { PlugSetPath(filename, Fn, GetPath()); -#if defined(WIN32) +#if defined(__WIN__) rc = !DeleteFile(filename); #else // UNIX rc = remove(filename); @@ -345,9 +345,9 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc) /***********************************************************************/ void TDBINI::CloseDB(PGLOBAL) { -#if !defined(WIN32) +#if !defined(__WIN__) PROFILE_Close(Ifile); -#endif // !WIN32 +#endif // !__WIN__ } // end of CloseDB // ------------------------ INICOL functions ---------------------------- diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp index f2affe75d2b..7f979eaf4be 100644 --- a/storage/connect/tabtbl.cpp +++ b/storage/connect/tabtbl.cpp @@ -39,7 +39,7 @@ //#include "sql_base.h" #include "my_global.h" #include "table.h" // MySQL table definitions -#if defined(WIN32) +#if defined(__WIN__) #include <stdlib.h> #include <stdio.h> #if defined(__BORLANDC__) @@ -73,15 +73,15 @@ #include "tabmysql.h" #include "ha_connect.h" -#if defined(WIN32) +#if defined(__WIN__) #if defined(__BORLANDC__) #define SYSEXIT void _USERENTRY #else #define SYSEXIT void #endif -#else // !WIN32 +#else // !__WIN__ #define SYSEXIT void * -#endif // !WIN32 +#endif // !__WIN__ /* ---------------------------- Class TBLDEF ---------------------------- */ diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 5ed958b2f7a..331a7f45d4d 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -14,7 +14,7 @@ #include "sql_class.h" #include "table.h" #include "field.h" -#if defined(WIN32) +#if defined(__WIN__) #include <stdlib.h> #include <stdio.h> #if defined(__BORLANDC__) diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp index 6394ea5e2d6..e788529075f 100644 --- a/storage/connect/tabvct.cpp +++ b/storage/connect/tabvct.cpp @@ -35,7 +35,7 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #if defined(__BORLANDC__) @@ -146,7 +146,7 @@ bool VCTDEF::Erase(char *filename) for (i = 1, cdp = To_Cols; cdp; i++, cdp = cdp->GetNext()) { sprintf(filename, fpat, i); -//#if defined(WIN32) +//#if defined(__WIN__) // rc |= !DeleteFile(filename); //#else // UNIX rc |= remove(filename); @@ -175,7 +175,7 @@ bool VCTDEF::Erase(char *filename) int VCTDEF::MakeFnPattern(char *fpat) { char pat[8]; -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp index 7c69426a066..98a44b9d635 100644 --- a/storage/connect/tabwmi.cpp +++ b/storage/connect/tabwmi.cpp @@ -2,9 +2,9 @@ /* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2013 */ /* TABWMI: Virtual table to get WMI information. */ /***********************************************************************/ -#if !defined(WIN32) -#error This is a WIN32 only table type -#endif // !WIN32 +#if !defined(__WIN__) +#error This is a WINDOWS only table type +#endif // !__WIN__ #include "my_global.h" #include <stdio.h> diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp index 7d6d94d34c0..add61431493 100644 --- a/storage/connect/tabxcl.cpp +++ b/storage/connect/tabxcl.cpp @@ -17,7 +17,7 @@ /***********************************************************************/ #include "my_global.h" #include "table.h" // MySQL table definitions -#if defined(WIN32) +#if defined(__WIN__) #include <stdlib.h> #include <stdio.h> #if defined(__BORLANDC__) diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index 26e0f7630d6..49fa9a1c554 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -15,12 +15,12 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <winsock2.h> //#include <windows.h> #include <comdef.h> -#else // !WIN32 +#else // !__WIN__ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> @@ -28,7 +28,7 @@ //#include <ctype.h> #include "osutil.h" #define _O_RDONLY O_RDONLY -#endif // !WIN32 +#endif // !__WIN__ #include "resource.h" // for IDS_COLUMNS #define INCLUDE_TDBXML @@ -53,11 +53,11 @@ extern "C" char version[]; -#if defined(WIN32) && defined(DOMDOC_SUPPORT) +#if defined(__WIN__) && defined(DOMDOC_SUPPORT) #define XMLSUP "MS-DOM" -#else // !WIN32 +#else // !__WIN__ #define XMLSUP "libxml2" -#endif // !WIN32 +#endif // !__WIN__ #define TYPE_UNKNOWN 12 /* Must be greater than other types */ @@ -155,11 +155,11 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) tdp->Tabname = tab; if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL))) -#if defined(WIN32) +#if defined(__WIN__) tdp->Usedom = true; -#else // !WIN32 +#else // !__WIN__ tdp->Usedom = false; -#endif // !WIN32 +#endif // !__WIN__ else tdp->Usedom = (toupper(*op) == 'M' || toupper(*op) == 'D'); @@ -494,11 +494,11 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) // Note that if no support is specified, the default is MS-DOM // on Windows and libxml2 otherwise if (*buf == '*') -#if defined(WIN32) +#if defined(__WIN__) Usedom = true; -#else // !WIN32 +#else // !__WIN__ Usedom = false; -#endif // !WIN32 +#endif // !__WIN__ else Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D'); @@ -878,7 +878,7 @@ bool TDBXML::Initialize(PGLOBAL g) Nlist = TabNode->GetChildElements(g); Docp->SetNofree(true); // For libxml2 -#if defined(WIN32) +#if defined(__WIN__) } catch(_com_error e) { // We come here if a DOM command threw an error char buf[128]; @@ -892,7 +892,7 @@ bool TDBXML::Initialize(PGLOBAL g) sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error()); goto error; -#endif // WIN32 +#endif // __WIN__ #if !defined(UNIX) } catch(...) { // Other errors diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index 94e09e1a85c..5fefcba5856 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -23,7 +23,7 @@ /* Include relevant MariaDB header file. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> #else #include "osutil.h" diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 5a8b1de326a..03ec0eb8e40 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -30,11 +30,11 @@ #include "sql_class.h" #include "sql_time.h" -#if defined(WIN32) +#if defined(__WIN__) //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #include <string.h> -#endif // !WIN32 +#endif // !__WIN__ #include <math.h> @@ -77,12 +77,12 @@ int DTVAL::Shift = 0; /***********************************************************************/ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); -#if !defined(WIN32) +#if !defined(__WIN__) extern "C" { PSZ strupr(PSZ s); PSZ strlwr(PSZ s); } -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Get a long long number from its character representation. */ @@ -1618,10 +1618,10 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp) else n = strcmp(Strp, vp->GetCharValue()); -#if defined(WIN32) +#if defined(__WIN__) if (n == _NLSCMPERROR) return n; // Here we should raise an error -#endif // WIN32 +#endif // __WIN__ return (n > 0) ? 1 : (n < 0) ? -1 : 0; } // end of CompareValue diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index ee8dc3ac4cb..85b3fc9751c 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -10,12 +10,12 @@ /* Include relevant sections of the System header files. */ /***********************************************************************/ #include "my_global.h" -#if defined(WIN32) +#if defined(__WIN__) #include <io.h> #include <fcntl.h> #include <errno.h> //#include <windows.h> -#else // !WIN32 +#else // !__WIN__ #if defined(UNIX) #include <sys/types.h> #include <sys/stat.h> @@ -25,7 +25,7 @@ #include <io.h> #endif // !UNIX #include <fcntl.h> -#endif // !WIN32 +#endif // !__WIN__ /***********************************************************************/ /* Include required application header files */ @@ -835,7 +835,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp) if ((sep = defp->GetBoolCatInfo("SepIndex", false))) { // Index is saved in a separate file -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -988,7 +988,7 @@ bool XINDEX::Init(PGLOBAL g) if (defp->SepIndex()) { // Index was saved in a separate file -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -1241,7 +1241,7 @@ bool XINDEX::MapInit(PGLOBAL g) if (defp->SepIndex()) { // Index was save in a separate file -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -1454,7 +1454,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) if (defp->SepIndex()) { // Index was saved in a separate file -#if !defined(UNIX) +#if defined(__WIN__) char drive[_MAX_DRIVE]; #else char *drive = NULL; @@ -2479,7 +2479,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) if (trace) htrc(" Xopen: filename=%s id=%d mode=%d\n", filename, id, mode); -#if defined(WIN32) +#if defined(__WIN__) LONG high = 0; DWORD rc, drc, access, share, creation; @@ -2655,7 +2655,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) /***********************************************************************/ bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin) { -#if defined(WIN32) +#if defined(__WIN__) LONG hi = high; DWORD rc = SetFilePointer(Hfile, low, &hi, origin); @@ -2691,7 +2691,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size) { bool rc = false; -#if defined(WIN32) +#if defined(__WIN__) bool brc; DWORD nbr, count = (DWORD)(n * size); @@ -2737,7 +2737,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size) /***********************************************************************/ int XHUGE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc) { -#if defined(WIN32) +#if defined(__WIN__) bool brc; DWORD nbw, count = (DWORD)n * (DWORD) size; @@ -2779,7 +2779,7 @@ void XHUGE::Close(char *fn, int id) if (trace) htrc("XHUGE::Close: fn=%s id=%d NewOff=%lld\n", fn, id, NewOff.Val); -#if defined(WIN32) +#if defined(__WIN__) if (id >= 0 && fn) { CloseFileHandle(Hfile); Hfile = CreateFile(fn, GENERIC_READ | GENERIC_WRITE, 0, NULL, @@ -2794,7 +2794,7 @@ void XHUGE::Close(char *fn, int id) } // endif SetFilePointer } // endif id -#else // !WIN32 +#else // !__WIN__ if (id >= 0 && fn) { if (Hfile != INVALID_HANDLE_VALUE) { if (lseek64(Hfile, id * sizeof(IOFF), SEEK_SET) >= 0) { @@ -2810,7 +2810,7 @@ void XHUGE::Close(char *fn, int id) htrc("(XHUGE)error reopening %s: %s\n", fn, strerror(errno)); } // endif id -#endif // !WIN32 +#endif // !__WIN__ XLOAD::Close(); } // end of Close diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h index 079412b32cf..ad34259501f 100644 --- a/storage/connect/xindex.h +++ b/storage/connect/xindex.h @@ -346,7 +346,7 @@ class DllExport XLOAD : public BLOCK { protected: // Members -#if defined(WIN32) +#if defined(__WIN__) HANDLE Hfile; // Handle to file or map #else // UNIX int Hfile; // Descriptor to file or map |