1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Change all preprocessor compiler directives to use __WIN__ as the mean of

specifying Windows or not Windows compile. This is what MariaDB does.
  modified:   storage/connect/array.cpp
  modified:   storage/connect/blkfil.cpp
  modified:   storage/connect/block.h
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/domdoc.cpp
  modified:   storage/connect/filamap.cpp
  modified:   storage/connect/filamdbf.cpp
  modified:   storage/connect/filamfix.cpp
  modified:   storage/connect/filamtxt.cpp
  modified:   storage/connect/filamvct.cpp
  modified:   storage/connect/filamzip.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/fmdlex.c
  modified:   storage/connect/global.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/json.cpp
  modified:   storage/connect/macutil.cpp
  modified:   storage/connect/macutil.h
  modified:   storage/connect/maputil.cpp
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/myconn.cpp
  modified:   storage/connect/myconn.h
  modified:   storage/connect/myutil.cpp
  modified:   storage/connect/odbconn.cpp
  modified:   storage/connect/odbconn.h
  modified:   storage/connect/os.h
  modified:   storage/connect/osutil.c
  modified:   storage/connect/plgdbsem.h
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/plugutil.c
  modified:   storage/connect/rcmsg.c
  modified:   storage/connect/reldef.cpp
  modified:   storage/connect/reldef.h
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabfix.cpp
  modified:   storage/connect/tabfmt.cpp
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabmac.cpp
  modified:   storage/connect/tabmac.h
  modified:   storage/connect/tabmul.cpp
  modified:   storage/connect/tabmul.h
  modified:   storage/connect/tabmysql.cpp
  modified:   storage/connect/taboccur.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabpivot.cpp
  modified:   storage/connect/tabsys.cpp
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/tabutil.cpp
  modified:   storage/connect/tabvct.cpp
  modified:   storage/connect/tabwmi.cpp
  modified:   storage/connect/tabxcl.cpp
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/valblk.cpp
  modified:   storage/connect/value.cpp
  modified:   storage/connect/xindex.cpp
  modified:   storage/connect/xindex.h
This commit is contained in:
Olivier Bertrand
2015-05-27 16:23:38 +02:00
parent fb98632930
commit b6a56370d6
57 changed files with 483 additions and 482 deletions

View File

@@ -19,14 +19,14 @@
#include "sql_class.h" #include "sql_class.h"
//#include "sql_time.h" //#include "sql_time.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdint.h> // for uintprt_h #include <stdint.h> // for uintprt_h
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include required application header files */ /* Include required application header files */

View File

@@ -20,13 +20,13 @@
#include "sql_class.h" #include "sql_class.h"
//#include "sql_time.h" //#include "sql_time.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */

View File

@@ -24,11 +24,11 @@
#if !defined(BLOCK_DEFINED) #if !defined(BLOCK_DEFINED)
#define BLOCK_DEFINED #define BLOCK_DEFINED
#if defined(WIN32) && !defined(NOEX) #if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport ) #define DllExport __declspec( dllexport )
#else // !WIN32 #else // !__WIN__
#define DllExport #define DllExport
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Definition of class BLOCK with its method function new. */ /* Definition of class BLOCK with its method function new. */

View File

@@ -297,9 +297,9 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
Buf_Type = TYPE_STRING; Buf_Type = TYPE_STRING;
*Format.Type = 'C'; *Format.Type = 'C';
Format.Length = Long; Format.Length = Long;
#if defined(WIN32) #if defined(__WIN__)
Format.Prec = 1; // Case insensitive Format.Prec = 1; // Case insensitive
#endif // WIN32 #endif // __WIN__
Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() && Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() &&
To_Tdb->GetAmType() != TYPE_AM_PLG && To_Tdb->GetAmType() != TYPE_AM_PLG &&
To_Tdb->GetAmType() != TYPE_AM_PLM); To_Tdb->GetAmType() != TYPE_AM_PLM);

View File

@@ -4,7 +4,7 @@
/******************************************************************/ /******************************************************************/
#include "my_global.h" #include "my_global.h"
#include <stdio.h> #include <stdio.h>
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#if defined(MSX2) #if defined(MSX2)
#import "msxml2.dll" //Does not exist on Vista #import "msxml2.dll" //Does not exist on Vista

View File

@@ -17,12 +17,12 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -30,7 +30,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -191,11 +191,11 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
return true; return true;
} // endif Memory } // endif Memory
#if defined(WIN32) #if defined(__WIN__)
if (mode != MODE_DELETE) { if (mode != MODE_DELETE) {
#else // !WIN32 #else // !__WIN__
if (mode == MODE_READ) { if (mode == MODE_READ) {
#endif // !WIN32 #endif // !__WIN__
CloseFileHandle(hFile); // Not used anymore CloseFileHandle(hFile); // Not used anymore
hFile = INVALID_HANDLE_VALUE; // For Fblock hFile = INVALID_HANDLE_VALUE; // For Fblock
} // endif Mode } // endif Mode
@@ -452,7 +452,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/ /*****************************************************************/
n = Tpos - Memory; n = Tpos - Memory;
#if defined(WIN32) #if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) { if (drc == 0xFFFFFFFF) {
@@ -482,7 +482,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
#endif // UNIX #endif // UNIX
} // endif Abort } // endif Abort
#if defined(WIN32) #if defined(__WIN__)
CloseHandle(fp->Handle); CloseHandle(fp->Handle);
#else // UNIX #else // UNIX
close(fp->Handle); close(fp->Handle);

View File

@@ -22,12 +22,12 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
//#include <errno.h> //#include <errno.h>
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -35,7 +35,7 @@
//#include <io.h> //#include <io.h>
#endif // !UNIX #endif // !UNIX
//#include <fcntl.h> //#include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -528,7 +528,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen); To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
if (mode == MODE_INSERT) { if (mode == MODE_INSERT) {
#if defined(WIN32) #if defined(__WIN__)
/************************************************************************/ /************************************************************************/
/* Now we can revert to binary mode in particular because the eventual */ /* 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 */ /* 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)); sprintf(g->Message, MSG(BIN_MODE_FAIL), strerror(errno));
return true; return true;
} // endif setmode } // endif setmode
#endif // WIN32 #endif // __WIN__
/************************************************************************/ /************************************************************************/
/* If this is a new file, the header must be generated. */ /* If this is a new file, the header must be generated. */

View File

@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -34,7 +34,7 @@
#endif // !UNIX #endif // !UNIX
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -338,10 +338,10 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) { } else if (feof(Stream)) {
rc = RC_EF; rc = RC_EF;
} else { } else {
#if defined(UNIX) #if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif #endif
if (trace) if (trace)
@@ -678,7 +678,7 @@ BGXFAM::BGXFAM(PBGXFAM txfp) : FIXFAM(txfp)
/***********************************************************************/ /***********************************************************************/
bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org) bool BGXFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, int org)
{ {
#if defined(WIN32) #if defined(__WIN__)
char buf[256]; char buf[256];
DWORD drc; DWORD drc;
LARGE_INTEGER of; 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); sprintf(g->Message, MSG(SFP_ERROR), buf);
return true; return true;
} // endif } // endif
#else // !WIN32 #else // !__WIN__
if (lseek64(h, pos, org) < 0) { if (lseek64(h, pos, org) < 0) {
// sprintf(g->Message, MSG(ERROR_IN_LSK), errno); // sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
sprintf(g->Message, "lseek64: %s", strerror(errno)); sprintf(g->Message, "lseek64: %s", strerror(errno));
printf("%s\n", g->Message); printf("%s\n", g->Message);
return true; return true;
} // endif } // endif
#endif // !WIN32 #endif // !__WIN__
return false; return false;
} // end of BigSeek } // end of BigSeek
@@ -714,7 +714,7 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
{ {
int rc; int rc;
#if defined(WIN32) #if defined(__WIN__)
DWORD nbr, drc, len = (DWORD)req; DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL); bool brc = ReadFile(h, inbuf, len, &nbr, NULL);
@@ -736,12 +736,12 @@ int BGXFAM::BigRead(PGLOBAL g __attribute__((unused)),
rc = -1; rc = -1;
} else } else
rc = (int)nbr; rc = (int)nbr;
#else // !WIN32 #else // !__WIN__
size_t len = (size_t)req; size_t len = (size_t)req;
ssize_t nbr = read(h, inbuf, len); ssize_t nbr = read(h, inbuf, len);
rc = (int)nbr; rc = (int)nbr;
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of BigRead } // end of BigRead
@@ -753,7 +753,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
{ {
bool rc = false; bool rc = false;
#if defined(WIN32) #if defined(__WIN__)
DWORD nbw, drc, len = (DWORD)req; DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL); 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; rc = true;
} // endif brc || nbw } // endif brc || nbw
#else // !WIN32 #else // !__WIN__
size_t len = (size_t)req; size_t len = (size_t)req;
ssize_t nbw = write(h, inbuf, len); ssize_t nbw = write(h, inbuf, len);
@@ -795,7 +795,7 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true; rc = true;
} // endif nbr } // endif nbr
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of BigWrite } // end of BigWrite
@@ -830,7 +830,7 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
if (trace) if (trace)
htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode); htrc("OpenTableFile: filename=%s mode=%d\n", filename, mode);
#if defined(WIN32) #if defined(__WIN__)
DWORD rc, access, creation, share = 0; DWORD rc, access, creation, share = 0;
/*********************************************************************/ /*********************************************************************/
@@ -987,7 +987,7 @@ int BGXFAM::Cardinality(PGLOBAL g)
PlugSetPath(filename, To_File, Tdbp->GetPath()); PlugSetPath(filename, To_File, Tdbp->GetPath());
#if defined(WIN32) // OB #if defined(__WIN__) // OB
LARGE_INTEGER len; LARGE_INTEGER len;
DWORD rc = 0; DWORD rc = 0;
@@ -1346,7 +1346,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/ /*****************************************************************/
/* Remove extra records. */ /* Remove extra records. */
/*****************************************************************/ /*****************************************************************/
#if defined(WIN32) #if defined(__WIN__)
if (BigSeek(g, Hfile, (BIGINT)Tpos * (BIGINT)Lrecl)) if (BigSeek(g, Hfile, (BIGINT)Tpos * (BIGINT)Lrecl))
return RC_FX; return RC_FX;
@@ -1356,12 +1356,12 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
sprintf(g->Message, MSG(SETEOF_ERROR), drc); sprintf(g->Message, MSG(SETEOF_ERROR), drc);
return RC_FX; return RC_FX;
} // endif error } // endif error
#else // !WIN32 #else // !__WIN__
if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) {
sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
return RC_FX; return RC_FX;
} // endif } // endif
#endif // !WIN32 #endif // !__WIN__
} // endif UseTemp } // endif UseTemp
@@ -1386,7 +1386,7 @@ bool BGXFAM::OpenTempFile(PGLOBAL g)
strcat(PlugRemoveType(tempname, tempname), ".t"); strcat(PlugRemoveType(tempname, tempname), ".t");
remove(tempname); // Be sure it does not exist yet remove(tempname); // Be sure it does not exist yet
#if defined(WIN32) #if defined(__WIN__)
Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL, Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -1526,7 +1526,7 @@ void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
void BGXFAM::Rewind(void) void BGXFAM::Rewind(void)
{ {
#if 0 // This is probably unuseful because file is accessed directly #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); SetFilePointer(Hfile, 0, NULL, FILE_BEGIN);
#else // UNIX #else // UNIX
lseek64(Hfile, 0, SEEK_SET); lseek64(Hfile, 0, SEEK_SET);

View File

@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) || defined(UNIV_LINUX) #if defined(UNIX) || defined(UNIV_LINUX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -36,7 +36,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -716,10 +716,10 @@ int DOSFAM::SkipRecord(PGLOBAL g, bool header)
if (feof(Stream)) if (feof(Stream))
return RC_EF; return RC_EF;
#if defined(UNIX) || defined(UNIV_LINUX) #if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif #endif
return RC_FX; return RC_FX;
} // endif fgets } // endif fgets
@@ -799,12 +799,12 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if (trace > 1) if (trace > 1)
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p); htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
#if defined(UNIX) #if defined(__WIN__)
if (true) {
// Data files can be imported from Windows (having CRLF)
#else
if (Bin) { if (Bin) {
// Data file is read in binary so CRLF remains // Data file is read in binary so CRLF remains
#else
if (true) {
// Data files can be imported from Windows (having CRLF)
#endif #endif
if (*p == '\n' || *p == '\r') { if (*p == '\n' || *p == '\r') {
// is this enough for Unix ??? // is this enough for Unix ???
@@ -833,10 +833,10 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) { } else if (feof(Stream)) {
rc = RC_EF; rc = RC_EF;
} else { } else {
#if defined(UNIX) #if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(0));
#endif #endif
if (trace) if (trace)
@@ -1028,15 +1028,15 @@ int DOSFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/ /*****************************************************************/
/* Remove extra records. */ /* Remove extra records. */
/*****************************************************************/ /*****************************************************************/
#if defined(UNIX) #if defined(__WIN__)
if (ftruncate(h, (off_t)Tpos)) { if (chsize(h, Tpos)) {
sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno));
close(h); close(h);
return RC_FX; return RC_FX;
} // endif } // endif
#else #else
if (chsize(h, Tpos)) { if (ftruncate(h, (off_t)Tpos)) {
sprintf(g->Message, MSG(CHSIZE_ERROR), strerror(errno)); sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
close(h); close(h);
return RC_FX; return RC_FX;
} // endif } // endif
@@ -1466,10 +1466,10 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
} else if (feof(Stream)) { } else if (feof(Stream)) {
rc = RC_EF; rc = RC_EF;
} else { } else {
#if defined(UNIX) #if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL)); sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif #endif
if (trace) if (trace)
@@ -1551,11 +1551,11 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
Spos = GetNextPos(); // New start position Spos = GetNextPos(); // New start position
// Prepare the output buffer // Prepare the output buffer
#if defined(WIN32) #if defined(__WIN__)
crlf = "\r\n"; crlf = "\r\n";
#else #else
crlf = "\n"; crlf = "\n";
#endif // WIN32 #endif // __WIN__
strcat(strcpy(OutBuf, Tdbp->GetLine()), crlf); strcat(strcpy(OutBuf, Tdbp->GetLine()), crlf);
len = strlen(OutBuf); len = strlen(OutBuf);
} else { } else {

View File

@@ -21,7 +21,7 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
@@ -29,7 +29,7 @@
#endif // __BORLAND__ #endif // __BORLAND__
//#include <windows.h> //#include <windows.h>
#include <sys/stat.h> #include <sys/stat.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -40,7 +40,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -49,7 +49,7 @@
/* tabdos.h is header containing the TABDOS class declarations. */ /* tabdos.h is header containing the TABDOS class declarations. */
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "osutil.h" // Unuseful for WIN32 #include "osutil.h" // Unuseful for WINDOWS
#include "plgdbsem.h" #include "plgdbsem.h"
#include "valblk.h" #include "valblk.h"
#include "filamfix.h" #include "filamfix.h"
@@ -376,11 +376,11 @@ bool VCTFAM::MakeEmptyFile(PGLOBAL g, char *fn)
int h, n; int h, n;
PlugSetPath(filename, fn, Tdbp->GetPath()); 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); 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); h= global_open(g, MSGID_OPEN_EMPTY_FILE, filename, O_CREAT | O_WRONLY, S_IREAD | S_IWRITE);
#endif // !WIN32 #endif // !__WIN__
if (h == -1) if (h == -1)
return true; return true;
@@ -1669,7 +1669,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
// Remove extra blocks // Remove extra blocks
n = Block * Blksize; n = Block * Blksize;
#if defined(WIN32) #if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) { if (drc == 0xFFFFFFFF) {
@@ -2574,11 +2574,11 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
char fn[_MAX_PATH]; char fn[_MAX_PATH];
sprintf(fn, Colfn, colp->Index); sprintf(fn, Colfn, colp->Index);
#if defined(WIN32) #if defined(__WIN__)
if (feof(Streams[i])) if (feof(Streams[i]))
#else // !WIN32 #else // !__WIN__
if (errno == NO_ERROR) if (errno == NO_ERROR)
#endif // !WIN32 #endif // !__WIN__
sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn); sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn);
else else
sprintf(g->Message, MSG(READ_ERROR), sprintf(g->Message, MSG(READ_ERROR),
@@ -2969,7 +2969,7 @@ int VMPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/ /*****************************************************************/
n = Tpos * Clens[i]; n = Tpos * Clens[i];
#if defined(WIN32) #if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN); DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
if (drc == 0xFFFFFFFF) { if (drc == 0xFFFFFFFF) {
@@ -3049,7 +3049,7 @@ BGVFAM::BGVFAM(PBGVFAM txfp) : VCTFAM(txfp)
/***********************************************************************/ /***********************************************************************/
bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b) bool BGVFAM::BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b)
{ {
#if defined(WIN32) #if defined(__WIN__)
char buf[256]; char buf[256];
DWORD drc, m = (b) ? FILE_END : FILE_BEGIN; DWORD drc, m = (b) ? FILE_END : FILE_BEGIN;
LARGE_INTEGER of; 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); sprintf(g->Message, MSG(SFP_ERROR), buf);
return true; return true;
} // endif } // endif
#else // !WIN32 #else // !__WIN__
if (lseek64(h, pos, (b) ? SEEK_END : SEEK_SET) < 0) { if (lseek64(h, pos, (b) ? SEEK_END : SEEK_SET) < 0) {
sprintf(g->Message, MSG(ERROR_IN_LSK), errno); sprintf(g->Message, MSG(ERROR_IN_LSK), errno);
return true; return true;
} // endif } // endif
#endif // !WIN32 #endif // !__WIN__
return false; return false;
} // end of BigSeek } // end of BigSeek
@@ -3082,7 +3082,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
{ {
bool rc = false; bool rc = false;
#if defined(WIN32) #if defined(__WIN__)
DWORD nbr, drc, len = (DWORD)req; DWORD nbr, drc, len = (DWORD)req;
bool brc = ReadFile(h, inbuf, len, &nbr, NULL); 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; rc = true;
} // endif brc || nbr } // endif brc || nbr
#else // !WIN32 #else // !__WIN__
size_t len = (size_t)req; size_t len = (size_t)req;
ssize_t nbr = read(h, inbuf, len); ssize_t nbr = read(h, inbuf, len);
@@ -3123,7 +3123,7 @@ bool BGVFAM::BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true; rc = true;
} // endif nbr } // endif nbr
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of BigRead } // end of BigRead
@@ -3135,7 +3135,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
{ {
bool rc = false; bool rc = false;
#if defined(WIN32) #if defined(__WIN__)
DWORD nbw, drc, len = (DWORD)req; DWORD nbw, drc, len = (DWORD)req;
bool brc = WriteFile(h, inbuf, len, &nbw, NULL); 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; rc = true;
} // endif brc || nbw } // endif brc || nbw
#else // !WIN32 #else // !__WIN__
size_t len = (size_t)req; size_t len = (size_t)req;
ssize_t nbw = write(h, inbuf, len); ssize_t nbw = write(h, inbuf, len);
@@ -3177,7 +3177,7 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
rc = true; rc = true;
} // endif nbr } // endif nbr
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of BigWrite } // end of BigWrite
@@ -3203,7 +3203,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
if (Header == 2) if (Header == 2)
strcat(PlugRemoveType(filename, filename), ".blk"); strcat(PlugRemoveType(filename, filename), ".blk");
#if defined(WIN32) #if defined(__WIN__)
LARGE_INTEGER len; LARGE_INTEGER len;
h = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, h = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
@@ -3215,11 +3215,11 @@ int BGVFAM::GetBlockInfo(PGLOBAL g)
} // endif h } // endif h
if (h == INVALID_HANDLE_VALUE || !len.QuadPart) { if (h == INVALID_HANDLE_VALUE || !len.QuadPart) {
#else // !WIN32 #else // !__WIN__
h = open64(filename, O_RDONLY, 0); h = open64(filename, O_RDONLY, 0);
if (h == INVALID_HANDLE_VALUE || !_filelength(h)) { if (h == INVALID_HANDLE_VALUE || !_filelength(h)) {
#endif // !WIN32 #endif // !__WIN__
// Consider this is a void table // Consider this is a void table
if (trace) if (trace)
htrc("Void table h=%d\n", h); htrc("Void table h=%d\n", h);
@@ -3280,17 +3280,17 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g)
strcat(PlugRemoveType(filename, filename), ".blk"); strcat(PlugRemoveType(filename, filename), ".blk");
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
#if defined(WIN32) #if defined(__WIN__)
DWORD creation = (b) ? OPEN_EXISTING : TRUNCATE_EXISTING; DWORD creation = (b) ? OPEN_EXISTING : TRUNCATE_EXISTING;
h = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, h = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0,
NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL); NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
#else // !WIN32 #else // !__WIN__
int oflag = (b) ? O_RDWR : O_RDWR | O_TRUNC; int oflag = (b) ? O_RDWR : O_RDWR | O_TRUNC;
h = open64(filename, oflag, 0); h = open64(filename, oflag, 0);
#endif // !WIN32 #endif // !__WIN__
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
sprintf(g->Message, "Error opening header file %s", filename); 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()); PlugSetPath(filename, fn, Tdbp->GetPath());
#if defined(WIN32) #if defined(__WIN__)
char *p; char *p;
DWORD rc; DWORD rc;
bool brc; bool brc;
@@ -3380,7 +3380,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
CloseHandle(h); CloseHandle(h);
return true; return true;
#else // !WIN32 #else // !__WIN__
int h; int h;
BIGINT pos; BIGINT pos;
@@ -3409,7 +3409,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno));
close(h); close(h);
return true; return true;
#endif // !WIN32 #endif // !__WIN__
} // end of MakeEmptyFile } // end of MakeEmptyFile
/***********************************************************************/ /***********************************************************************/
@@ -3440,7 +3440,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
htrc("OpenTableFile: filename=%s mode=%d Last=%d\n", htrc("OpenTableFile: filename=%s mode=%d Last=%d\n",
filename, mode, Last); filename, mode, Last);
#if defined(WIN32) #if defined(__WIN__)
DWORD access, creation, share = 0, rc = 0; DWORD access, creation, share = 0, rc = 0;
/*********************************************************************/ /*********************************************************************/
@@ -3766,7 +3766,7 @@ int BGVFAM::WriteBuffer(PGLOBAL g)
if (!Closing && !MaxBlk) { if (!Closing && !MaxBlk) {
// Close the VCT file and reopen it in mode Insert // Close the VCT file and reopen it in mode Insert
//#if defined(WIN32) //OB //#if defined(__WIN__) //OB
// CloseHandle(Hfile); // CloseHandle(Hfile);
//#else // UNIX //#else // UNIX
// close(Hfile); // close(Hfile);
@@ -3893,7 +3893,7 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
/***************************************************************/ /***************************************************************/
/* Remove extra records. */ /* Remove extra records. */
/***************************************************************/ /***************************************************************/
#if defined(WIN32) #if defined(__WIN__)
BIGINT pos = (BIGINT)Block * (BIGINT)Blksize; BIGINT pos = (BIGINT)Block * (BIGINT)Blksize;
if (BigSeek(g, Hfile, pos)) if (BigSeek(g, Hfile, pos))
@@ -3905,12 +3905,12 @@ int BGVFAM::DeleteRecords(PGLOBAL g, int irc)
sprintf(g->Message, MSG(SETEOF_ERROR), drc); sprintf(g->Message, MSG(SETEOF_ERROR), drc);
return RC_FX; return RC_FX;
} // endif error } // endif error
#else // !WIN32 #else // !__WIN__
if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) { if (ftruncate64(Hfile, (BIGINT)(Tpos * Lrecl))) {
sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno)); sprintf(g->Message, MSG(TRUNCATE_ERROR), strerror(errno));
return RC_FX; return RC_FX;
} // endif } // endif
#endif // !WIN32 #endif // !__WIN__
} else // MaxBlk } else // MaxBlk
// Clean the unused space in the file, this is required when // Clean the unused space in the file, this is required when
// inserting again with a partial column list. // inserting again with a partial column list.
@@ -3947,7 +3947,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g)
else if (MakeEmptyFile(g, tempname)) else if (MakeEmptyFile(g, tempname))
return true; return true;
#if defined(WIN32) #if defined(__WIN__)
DWORD access = (MaxBlk) ? OPEN_EXISTING : CREATE_NEW; DWORD access = (MaxBlk) ? OPEN_EXISTING : CREATE_NEW;
Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL, Tfile = CreateFile(tempname, GENERIC_WRITE, 0, NULL,
@@ -4218,7 +4218,7 @@ void BGVFAM::Rewind(void)
CurNum = Nrec - 1; CurNum = Nrec - 1;
#if 0 // This is probably unuseful as the file is directly accessed #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); SetFilePointer(Hfile, 0, NULL, FILE_BEGIN);
#else // UNIX #else // UNIX
lseek64(Hfile, 0, SEEK_SET); lseek64(Hfile, 0, SEEK_SET);

View File

@@ -17,21 +17,21 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif #endif
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#else // !UNIX #else // !UNIX
#include <io.h> #include <io.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -89,11 +89,11 @@ int ZIPFAM::Zerror(PGLOBAL g)
strcpy(g->Message, gzerror(Zfile, &errnum)); strcpy(g->Message, gzerror(Zfile, &errnum));
if (errnum == Z_ERRNO) if (errnum == Z_ERRNO)
#if defined(WIN32) #if defined(__WIN__)
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(NULL)); sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(NULL));
#else // !WIN32 #else // !__WIN__
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno)); sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
#endif // !WIN32 #endif // !__WIN__
return (errnum == Z_STREAM_END) ? RC_EF : RC_FX; return (errnum == Z_STREAM_END) ? RC_EF : RC_FX;
} // end of Zerror } // end of Zerror
@@ -764,9 +764,9 @@ bool ZIXFAM::AllocateBuffer(PGLOBAL g)
if (Tdbp->GetFtype() < 2) if (Tdbp->GetFtype() < 2)
// if not binary, the file is physically a text file // if not binary, the file is physically a text file
for (int len = Lrecl; len <= Buflen; len += Lrecl) { for (int len = Lrecl; len <= Buflen; len += Lrecl) {
#if defined(WIN32) #if defined(__WIN__)
To_Buf[len - 2] = '\r'; To_Buf[len - 2] = '\r';
#endif // WIN32 #endif // __WIN__
To_Buf[len - 1] = '\n'; To_Buf[len - 1] = '\n';
} // endfor len } // endfor len

View File

@@ -13,13 +13,13 @@
#include "sql_class.h" #include "sql_class.h"
//#include "sql_time.h" //#include "sql_time.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/

View File

@@ -106,7 +106,7 @@ class FILTERX : public FILTER {
// Fake operator new used to change a filter into a derived filter // Fake operator new used to change a filter into a derived filter
void * operator new(size_t, PFIL filp) {return filp;} 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 // Avoid warning C4291 by defining a matching dummy delete operator
void operator delete(void *, PFIL) {} void operator delete(void *, PFIL) {}
#else #else

View File

@@ -20,11 +20,12 @@
*/ */
#define FLEX_SCANNER #define FLEX_SCANNER
#if WIN32 #ifdef __WIN__
#define __STDC__ 1 #define __STDC__ 1
#define isatty _isatty
#endif #endif
#include <stdio.h> #include <stdio.h>
#ifndef WIN32 #ifndef __WIN__
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@@ -13,11 +13,11 @@
#include <time.h> /* time_t type declaration */ #include <time.h> /* time_t type declaration */
#include <setjmp.h> /* Long jump declarations */ #include <setjmp.h> /* Long jump declarations */
#if defined(WIN32) && !defined(NOEX) #if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport ) #define DllExport __declspec( dllexport )
#else // !WIN32 #else // !__WIN__
#define DllExport #define DllExport
#endif // !WIN32 #endif // !__WIN__
#if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT) #if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT)
#define XML_SUPPORT 1 #define XML_SUPPORT 1
@@ -42,11 +42,11 @@
#define STEP(I) MSG_##I #define STEP(I) MSG_##I
#endif // !XMSG and !NEWMSG #endif // !XMSG and !NEWMSG
#if defined(WIN32) #if defined(__WIN__)
#define CRLF 2 #define CRLF 2
#else // !WIN32 #else // !__WIN__
#define CRLF 1 #define CRLF 1
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Define access to the thread based trace value. */ /* Define access to the thread based trace value. */
@@ -104,7 +104,7 @@
#define SYS_STAMP "DOSR" #define SYS_STAMP "DOSR"
#elif defined(WIN) #elif defined(WIN)
#define SYS_STAMP "WIN1" #define SYS_STAMP "WIN1"
#elif defined(WIN32) #elif defined(__WIN__)
#define SYS_STAMP "WIN2" #define SYS_STAMP "WIN2"
#else #else
#define SYS_STAMP "XXXX" #define SYS_STAMP "XXXX"
@@ -248,9 +248,9 @@ DllExport char *PlugReadMessage(PGLOBAL, int, char *);
#elif defined(NEWMSG) #elif defined(NEWMSG)
DllExport char *PlugGetMessage(PGLOBAL, int); DllExport char *PlugGetMessage(PGLOBAL, int);
#endif // XMSG || NEWMSG #endif // XMSG || NEWMSG
#if defined(WIN32) #if defined(__WIN__)
DllExport short GetLineLength(PGLOBAL); // Console line length DllExport short GetLineLength(PGLOBAL); // Console line length
#endif // WIN32 #endif // __WIN__
DllExport PGLOBAL PlugInit(LPCSTR, uint); // Plug global initialization DllExport PGLOBAL PlugInit(LPCSTR, uint); // Plug global initialization
DllExport int PlugExit(PGLOBAL); // Plug global termination DllExport int PlugExit(PGLOBAL); // Plug global termination
DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR); DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR);

View File

@@ -138,10 +138,10 @@
#include "reldef.h" #include "reldef.h"
#include "tabcol.h" #include "tabcol.h"
#include "xindex.h" #include "xindex.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include "tabwmi.h" #include "tabwmi.h"
#endif // WIN32 #endif // __WIN__
#include "connect.h" #include "connect.h"
#include "user_connect.h" #include "user_connect.h"
#include "ha_connect.h" #include "ha_connect.h"
@@ -170,12 +170,12 @@
extern "C" { extern "C" {
char version[]= "Version 1.03.0007 April 30, 2015"; char version[]= "Version 1.03.0007 April 30, 2015";
#if defined(WIN32) #if defined(__WIN__)
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__; char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
#else // !WIN32 #else // !__WIN__
char slash= '/'; char slash= '/';
#endif // !WIN32 #endif // !__WIN__
} // extern "C" } // extern "C"
#if defined(XMAP) #if defined(XMAP)
@@ -629,11 +629,11 @@ static int connect_init_func(void *p)
} }
#endif // 0 (LINUX) #endif // 0 (LINUX)
#if defined(WIN32) #if defined(__WIN__)
sql_print_information("CONNECT: %s", compver); sql_print_information("CONNECT: %s", compver);
#else // !WIN32 #else // !__WIN__
sql_print_information("CONNECT: %s", version); sql_print_information("CONNECT: %s", version);
#endif // !WIN32 #endif // !__WIN__
#ifdef LIBXML2_SUPPORT #ifdef LIBXML2_SUPPORT
XmlInitParserLib(); XmlInitParserLib();
@@ -675,9 +675,9 @@ static int connect_done_func(void *)
XmlCleanupParserLib(); XmlCleanupParserLib();
#endif // LIBXML2_SUPPORT #endif // LIBXML2_SUPPORT
#if !defined(WIN32) #if !defined(__WIN__)
//PROFILE_End(); Causes signal 11 //PROFILE_End(); Causes signal 11
#endif // !WIN32 #endif // !__WIN__
for (pc= user_connect::to_users; pc; pc= pn) { for (pc= user_connect::to_users; pc; pc= pn) {
if (pc->g) if (pc->g)
@@ -744,11 +744,11 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
xp= (table) ? GetUser(ha_thd(), NULL) : NULL; xp= (table) ? GetUser(ha_thd(), NULL) : NULL;
if (xp) if (xp)
xp->SetHandler(this); xp->SetHandler(this);
#if defined(WIN32) #if defined(__WIN__)
datapath= ".\\"; datapath= ".\\";
#else // !WIN32 #else // !__WIN__
datapath= "./"; datapath= "./";
#endif // !WIN32 #endif // !__WIN__
tdbp= NULL; tdbp= NULL;
sdvalin1= sdvalin2= sdvalin3= sdvalin4= NULL; sdvalin1= sdvalin2= sdvalin3= sdvalin4= NULL;
sdvalout= NULL; sdvalout= NULL;
@@ -3992,11 +3992,11 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
case TAB_JSON: case TAB_JSON:
if (options->filename && *options->filename) { if (options->filename && *options->filename) {
char *s, path[FN_REFLEN], dbpath[FN_REFLEN]; char *s, path[FN_REFLEN], dbpath[FN_REFLEN];
#if defined(WIN32) #if defined(__WIN__)
s= "\\"; s= "\\";
#else // !WIN32 #else // !__WIN__
s= "/"; s= "/";
#endif // !WIN32 #endif // !__WIN__
strcpy(dbpath, mysql_real_data_home); strcpy(dbpath, mysql_real_data_home);
if (db) 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 *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl, *skc; const char *col, *ocl, *rnk, *pic, *fcl, *skc;
char *tab, *dsn, *shm, *dpath; char *tab, *dsn, *shm, *dpath;
#if defined(WIN32) #if defined(__WIN__)
char *nsp= NULL, *cls= NULL; char *nsp= NULL, *cls= NULL;
#endif // WIN32 #endif // __WIN__
int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0; int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0;
int cop __attribute__((unused))= 0, lrecl= 0; int cop __attribute__((unused))= 0, lrecl= 0;
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
@@ -5066,10 +5066,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
skc= GetListOption(g, "skipcol", topt->oplist, NULL); skc= GetListOption(g, "skipcol", topt->oplist, NULL);
rnk= GetListOption(g, "rankcol", topt->oplist, NULL); rnk= GetListOption(g, "rankcol", topt->oplist, NULL);
pwd= GetListOption(g, "password", topt->oplist); pwd= GetListOption(g, "password", topt->oplist);
#if defined(WIN32) #if defined(__WIN__)
nsp= GetListOption(g, "namespace", topt->oplist); nsp= GetListOption(g, "namespace", topt->oplist);
cls= GetListOption(g, "class", topt->oplist); cls= GetListOption(g, "class", topt->oplist);
#endif // WIN32 #endif // __WIN__
port= atoi(GetListOption(g, "port", topt->oplist, "0")); port= atoi(GetListOption(g, "port", topt->oplist, "0"));
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0")); mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
@@ -5226,11 +5226,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
ok= false; ok= false;
break; break;
#if defined(WIN32) #if defined(__WIN__)
case TAB_WMI: case TAB_WMI:
ok= true; ok= true;
break; break;
#endif // WIN32 #endif // __WIN__
#if defined(PIVOT_SUPPORT) #if defined(PIVOT_SUPPORT)
case TAB_PIVOT: case TAB_PIVOT:
supfnc= FNC_NO; supfnc= FNC_NO;
@@ -5343,11 +5343,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV: case TAB_CSV:
qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL); qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL);
break; break;
#if defined(WIN32) #if defined(__WIN__)
case TAB_WMI: case TAB_WMI:
qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL); qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL);
break; break;
#endif // WIN32 #endif // __WIN__
case TAB_PRX: case TAB_PRX:
case TAB_TBL: case TAB_TBL:
case TAB_XCL: case TAB_XCL:
@@ -5801,11 +5801,11 @@ int ha_connect::create(const char *name, TABLE *table_arg,
// on Windows and libxml2 otherwise // on Windows and libxml2 otherwise
switch (*xsup) { switch (*xsup) {
case '*': case '*':
#if defined(WIN32) #if defined(__WIN__)
dom= true; dom= true;
#else // !WIN32 #else // !__WIN__
dom= false; dom= false;
#endif // !WIN32 #endif // !__WIN__
break; break;
case 'M': case 'M':
case 'D': case 'D':
@@ -6152,11 +6152,11 @@ bool ha_connect::FileExists(const char *fn, bool bf)
NULL, NULL, 0, 0)) NULL, NULL, 0, 0))
return true; return true;
#if defined(WIN32) #if defined(__WIN__)
s= "\\"; s= "\\";
#else // !WIN32 #else // !__WIN__
s= "/"; s= "/";
#endif // !WIN32 #endif // !__WIN__
if (IsPartitioned()) { if (IsPartitioned()) {
sprintf(tfn, fn, GetPartName()); sprintf(tfn, fn, GetPartName());

View File

@@ -23,7 +23,7 @@
#define ARGS MY_MIN(24,len-i),s+MY_MAX(i-3,0) #define ARGS MY_MIN(24,len-i),s+MY_MAX(i-3,0)
#if defined(WIN32) #if defined(__WIN__)
#define EL "\r\n" #define EL "\r\n"
#else #else
#define EL "\n" #define EL "\n"

View File

@@ -2,11 +2,11 @@
/* MACUTIL: Author Olivier Bertrand -- 2008-2012 */ /* MACUTIL: Author Olivier Bertrand -- 2008-2012 */
/* From the article and sample code by Khalid Shaikh. */ /* From the article and sample code by Khalid Shaikh. */
/***********************************************************************/ /***********************************************************************/
#if defined(WIN32) #if defined(__WIN__)
#include "my_global.h" #include "my_global.h"
#else // !WIN32 #else // !__WIN__
#error This is WIN32 only DLL #error This is WINDOWS only DLL
#endif // !WIN32 #endif // !__WIN__
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "macutil.h" #include "macutil.h"

View File

@@ -1,10 +1,10 @@
// MACUTIL.H Olivier Bertrand 2008-2012 // MACUTIL.H Olivier Bertrand 2008-2012
// Get Mac Addresses via GetAdaptersInfo // Get Mac Addresses via GetAdaptersInfo
#if defined(WIN32) #if defined(__WIN__)
#include <iphlpapi.h> #include <iphlpapi.h>
#else // !WIN32 #else // !__WIN__
#error This is WIN32 only #error This is WINDOWS only
#endif // !WIN32 #endif // !__WIN__
#include "block.h" #include "block.h"
typedef class MACINFO *MACIP; typedef class MACINFO *MACIP;

View File

@@ -14,7 +14,7 @@
#include "plgdbsem.h" #include "plgdbsem.h"
#include "maputil.h" #include "maputil.h"
#ifdef WIN32 #ifdef __WIN__
/***********************************************************************/ /***********************************************************************/
/* In Insert mode, just open the file for append. Otherwise */ /* In Insert mode, just open the file for append. Otherwise */
/* create the mapping file object. The map handle can be released */ /* create the mapping file object. The map handle can be released */

View File

@@ -30,7 +30,7 @@
/***********************************************************************/ /***********************************************************************/
#include <my_config.h> #include <my_config.h>
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
//#include <sqlext.h> //#include <sqlext.h>
#elif defined(UNIX) #elif defined(UNIX)
@@ -66,10 +66,10 @@
#include "tabfmt.h" #include "tabfmt.h"
#include "tabvct.h" #include "tabvct.h"
#include "tabsys.h" #include "tabsys.h"
#if defined(WIN32) #if defined(__WIN__)
#include "tabmac.h" #include "tabmac.h"
#include "tabwmi.h" #include "tabwmi.h"
#endif // WIN32 #endif // __WIN__
//#include "tabtbl.h" //#include "tabtbl.h"
#include "tabxcl.h" #include "tabxcl.h"
#include "tabtbl.h" #include "tabtbl.h"
@@ -93,9 +93,9 @@
/***********************************************************************/ /***********************************************************************/
/* Extern static variables. */ /* Extern static variables. */
/***********************************************************************/ /***********************************************************************/
#if defined(WIN32) #if defined(__WIN__)
extern "C" HINSTANCE s_hModule; // Saved module handle extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // !WIN32 #endif // !__WIN__
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); 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, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL : (!stricmp(type, "MYPRX")) ? TAB_MYSQL
: (!stricmp(type, "DIR")) ? TAB_DIR : (!stricmp(type, "DIR")) ? TAB_DIR
#ifdef WIN32 #ifdef __WIN__
: (!stricmp(type, "MAC")) ? TAB_MAC : (!stricmp(type, "MAC")) ? TAB_MAC
: (!stricmp(type, "WMI")) ? TAB_WMI : (!stricmp(type, "WMI")) ? TAB_WMI
#endif #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); typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, void*, char*, char*, bool);
const char *module, *subtype; const char *module, *subtype;
char c, soname[_MAX_PATH], getname[40] = "Col"; char c, soname[_MAX_PATH], getname[40] = "Col";
#if defined(WIN32) #if defined(__WIN__)
HANDLE hdll; /* Handle to the external DLL */ HANDLE hdll; /* Handle to the external DLL */
#else // !WIN32 #else // !__WIN__
void *hdll; /* Handle for the loaded shared library */ void *hdll; /* Handle for the loaded shared library */
#endif // !WIN32 #endif // !__WIN__
XCOLDEF coldef = NULL; XCOLDEF coldef = NULL;
PQRYRES qrp = NULL; PQRYRES qrp = NULL;
@@ -381,7 +381,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
if (!c) break; if (!c) break;
} // endfor i } // endfor i
#if defined(WIN32) #if defined(__WIN__)
// Load the Dll implementing the table // Load the Dll implementing the table
if (!(hdll = LoadLibrary(soname))) { if (!(hdll = LoadLibrary(soname))) {
char buf[256]; char buf[256];
@@ -401,7 +401,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
FreeLibrary((HMODULE)hdll); FreeLibrary((HMODULE)hdll);
return NULL; return NULL;
} // endif coldef } // endif coldef
#else // !WIN32 #else // !__WIN__
const char *error = NULL; const char *error = NULL;
// Load the desired shared library // Load the desired shared library
@@ -418,7 +418,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
dlclose(hdll); dlclose(hdll);
return NULL; return NULL;
} // endif coldef } // endif coldef
#endif // !WIN32 #endif // !__WIN__
// Just in case the external Get function does not set error messages // Just in case the external Get function does not set error messages
sprintf(g->Message, "Error getting column info from %s", subtype); 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 // Get the table column definition
qrp = coldef(g, topt, tab, db, info); qrp = coldef(g, topt, tab, db, info);
#if defined(WIN32) #if defined(__WIN__)
FreeLibrary((HMODULE)hdll); FreeLibrary((HMODULE)hdll);
#else // !WIN32 #else // !__WIN__
dlclose(hdll); dlclose(hdll);
#endif // !WIN32 #endif // !__WIN__
return qrp; return qrp;
} // end of OEMColumns } // end of OEMColumns
@@ -442,11 +442,11 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
/***********************************************************************/ /***********************************************************************/
CATALOG::CATALOG(void) CATALOG::CATALOG(void)
{ {
#if defined(WIN32) #if defined(__WIN__)
//DataPath= ".\\"; //DataPath= ".\\";
#else // !WIN32 #else // !__WIN__
//DataPath= "./"; //DataPath= "./";
#endif // !WIN32 #endif // !__WIN__
memset(&Ctb, 0, sizeof(CURTAB)); memset(&Ctb, 0, sizeof(CURTAB));
Cbuf= NULL; Cbuf= NULL;
Cblen= 0; Cblen= 0;
@@ -489,11 +489,11 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
} }
if (*path != '.') { if (*path != '.') {
#if defined(WIN32) #if defined(__WIN__)
char *s= "\\"; char *s= "\\";
#else // !WIN32 #else // !__WIN__
char *s= "/"; char *s= "/";
#endif // !WIN32 #endif // !__WIN__
strcat(strcat(strcat(strcpy(buf, "."), s), path), s); strcat(strcat(strcat(strcpy(buf, "."), s), path), s);
} else } else
strcpy(buf, path); strcpy(buf, path);
@@ -554,10 +554,10 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break; case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(WIN32) #if defined(__WIN__)
case TAB_MAC: tdp= new(g) MACDEF; break; case TAB_MAC: tdp= new(g) MACDEF; break;
case TAB_WMI: tdp= new(g) WMIDEF; break; case TAB_WMI: tdp= new(g) WMIDEF; break;
#endif // WIN32 #endif // __WIN__
case TAB_OEM: tdp= new(g) OEMDEF; break; case TAB_OEM: tdp= new(g) OEMDEF; break;
case TAB_TBL: tdp= new(g) TBLDEF; break; case TAB_TBL: tdp= new(g) TBLDEF; break;
case TAB_XCL: tdp= new(g) XCLDEF; break; case TAB_XCL: tdp= new(g) XCLDEF; break;

View File

@@ -35,11 +35,11 @@
#include "my_sys.h" #include "my_sys.h"
#include "mysqld_error.h" #include "mysqld_error.h"
#endif // !MYSQL_PREPARED_STATEMENTS #endif // !MYSQL_PREPARED_STATEMENTS
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include "osutil.h" #include "osutil.h"
#endif // !WIN32 #endif // !__WIN__
#include "global.h" #include "global.h"
#include "plgdbsem.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_READ_TIMEOUT, &nrt);
//mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...); //mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...);
#if defined(WIN32) #if defined(__WIN__)
if (!strcmp(host, ".")) { if (!strcmp(host, ".")) {
mysql_options(m_DB, MYSQL_OPT_NAMED_PIPE, NULL); mysql_options(m_DB, MYSQL_OPT_NAMED_PIPE, NULL);
pipe = mysqld_unix_port; pipe = mysqld_unix_port;
} // endif host } // endif host
#else // !WIN32 #else // !__WIN__
if (!strcmp(host, "localhost")) if (!strcmp(host, "localhost"))
pipe = mysqld_unix_port; pipe = mysqld_unix_port;
#endif // !WIN32 #endif // !__WIN__
#if 0 #if 0
if (pwd && !strcmp(pwd, "*")) { if (pwd && !strcmp(pwd, "*")) {

View File

@@ -7,24 +7,24 @@
/* DO NOT define DLL_EXPORT in your application so these items are */ /* DO NOT define DLL_EXPORT in your application so these items are */
/* declared are imported from the Myconn DLL. */ /* declared are imported from the Myconn DLL. */
/***********************************************************************/ /***********************************************************************/
#if defined(WIN32) #if defined(__WIN__)
#include <winsock.h> #include <winsock.h>
#else // !WIN32 #else // !__WIN__
#include <sys/socket.h> #include <sys/socket.h>
#endif // !WIN32 #endif // !__WIN__
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>
#include "myutil.h" #include "myutil.h"
#if defined(WIN32) && defined(MYCONN_EXPORTS) #if defined(__WIN__) && defined(MYCONN_EXPORTS)
#if defined(DLL_EXPORT) #if defined(DLL_EXPORT)
#define DllItem _declspec(dllexport) #define DllItem _declspec(dllexport)
#else // !DLL_EXPORT #else // !DLL_EXPORT
#define DllItem _declspec(dllimport) #define DllItem _declspec(dllimport)
#endif // !DLL_EXPORT #endif // !DLL_EXPORT
#else // !WIN32 || !MYCONN_EXPORTS #else // !__WIN__ || !MYCONN_EXPORTS
#define DllItem #define DllItem
#endif // !WIN32 #endif // !__WIN__
#define MYSQL_ENABLED 0x00000001 #define MYSQL_ENABLED 0x00000001
#define MYSQL_LOGON 0x00000002 #define MYSQL_LOGON 0x00000002

View File

@@ -13,11 +13,11 @@
/************************************************************************/ /************************************************************************/
#include "my_global.h" #include "my_global.h"
#include <mysql.h> #include <mysql.h>
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include "osutil.h" #include "osutil.h"
#endif // !WIN32 #endif // !__WIN__
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"

View File

@@ -11,7 +11,7 @@
/***********************************************************************/ /***********************************************************************/
#include <my_global.h> #include <my_global.h>
#include <m_string.h> #include <m_string.h>
#if defined(WIN32) #if defined(__WIN__)
//nclude <io.h> //nclude <io.h>
//nclude <fcntl.h> //nclude <fcntl.h>
#include <direct.h> // for getcwd #include <direct.h> // for getcwd
@@ -45,13 +45,13 @@
#include "osutil.h" #include "osutil.h"
#if defined(WIN32) #if defined(__WIN__)
/***********************************************************************/ /***********************************************************************/
/* For dynamic load of ODBC32.DLL */ /* For dynamic load of ODBC32.DLL */
/***********************************************************************/ /***********************************************************************/
#pragma comment(lib, "odbc32.lib") #pragma comment(lib, "odbc32.lib")
extern "C" HINSTANCE s_hModule; // Saved module handle extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // WIN32 #endif // __WIN__
int GetConvSize(); int GetConvSize();
@@ -1201,15 +1201,15 @@ bool ODBConn::DriverConnect(DWORD Options)
SWORD nResult; SWORD nResult;
PUCHAR ConnOut = (PUCHAR)PlugSubAlloc(m_G, NULL, MAX_CONNECT_LEN); PUCHAR ConnOut = (PUCHAR)PlugSubAlloc(m_G, NULL, MAX_CONNECT_LEN);
UWORD wConnectOption = SQL_DRIVER_COMPLETE; UWORD wConnectOption = SQL_DRIVER_COMPLETE;
#if defined(WIN32) #if defined(__WIN__)
HWND hWndTop = GetForegroundWindow(); HWND hWndTop = GetForegroundWindow();
HWND hWnd = GetParent(hWndTop); HWND hWnd = GetParent(hWndTop);
if (hWnd == NULL) if (hWnd == NULL)
hWnd = GetDesktopWindow(); hWnd = GetDesktopWindow();
#else // !WIN32 #else // !__WIN__
HWND hWnd = (HWND)1; HWND hWnd = (HWND)1;
#endif // !WIN32 #endif // !__WIN__
PGLOBAL& g = m_G; PGLOBAL& g = m_G;
PDBUSER dup = PlgGetUser(g); PDBUSER dup = PlgGetUser(g);
@@ -1222,10 +1222,10 @@ bool ODBConn::DriverConnect(DWORD Options)
SQL_NTS, ConnOut, MAX_CONNECT_LEN, SQL_NTS, ConnOut, MAX_CONNECT_LEN,
&nResult, wConnectOption); &nResult, wConnectOption);
#if defined(WIN32) #if defined(__WIN__)
if (hWndTop) if (hWndTop)
EnableWindow(hWndTop, true); EnableWindow(hWndTop, true);
#endif // WIN32 #endif // __WIN__
// If user hit 'Cancel' // If user hit 'Cancel'
if (rc == SQL_NO_DATA_FOUND) { if (rc == SQL_NO_DATA_FOUND) {

View File

@@ -29,9 +29,9 @@
//efine MAX_CURSOR_NAME 18 // Max size of a cursor name //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 #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; typedef unsigned char *PUCHAR;
#endif // !WIN32 #endif // !__WIN__
// Field Flags, used to indicate status of fields // Field Flags, used to indicate status of fields
//efine SQL_FIELD_FLAG_DIRTY 0x1 //efine SQL_FIELD_FLAG_DIRTY 0x1

View File

@@ -15,16 +15,16 @@ typedef off_t off64_t;
#endif #endif
#endif #endif
#if defined(WIN32) #if defined(__WIN__)
typedef __int64 BIGINT; typedef __int64 BIGINT;
#else // !WIN32 #else // !__WIN__
typedef longlong BIGINT; typedef longlong BIGINT;
#define FILE_BEGIN SEEK_SET #define FILE_BEGIN SEEK_SET
#define FILE_CURRENT SEEK_CUR #define FILE_CURRENT SEEK_CUR
#define FILE_END SEEK_END #define FILE_END SEEK_END
#endif // !WIN32 #endif // !__WIN__
#if !defined(WIN32) #if !defined(__WIN__)
typedef const void *LPCVOID; typedef const void *LPCVOID;
typedef const char *LPCTSTR; typedef const char *LPCTSTR;
typedef const char *LPCSTR; typedef const char *LPCSTR;
@@ -61,6 +61,6 @@ typedef int HANDLE;
#define _MAX_EXT FN_EXTLEN #define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1) #define INVALID_HANDLE_VALUE (-1)
#define __stdcall #define __stdcall
#endif /* !WIN32 */ #endif /* !__WIN__ */
#endif /* _OS_H_INCLUDED */ #endif /* _OS_H_INCLUDED */

View File

@@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include "osutil.h" #include "osutil.h"
#ifdef WIN32 #ifdef __WIN__
my_bool CloseFileHandle(HANDLE h) my_bool CloseFileHandle(HANDLE h)
{ {
return !CloseHandle(h); return !CloseHandle(h);

View File

@@ -544,11 +544,11 @@ typedef struct _colres {
char Var; /* Type added information */ char Var; /* Type added information */
} COLRES; } COLRES;
#if defined(WIN32) && !defined(NOEX) #if defined(__WIN__) && !defined(NOEX)
#define DllExport __declspec( dllexport ) #define DllExport __declspec( dllexport )
#else // !WIN32 #else // !__WIN__
#define DllExport #define DllExport
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Utility routines. */ /* Utility routines. */

View File

@@ -38,12 +38,12 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#define BIGMEM 1048576 // 1 Megabyte #define BIGMEM 1048576 // 1 Megabyte
#else // !WIN32 #else // !__WIN__
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(THREAD) #if defined(THREAD)
@@ -51,7 +51,7 @@
#endif // THREAD #endif // THREAD
#include <stdarg.h> #include <stdarg.h>
#define BIGMEM 2147483647 // Max int value #define BIGMEM 2147483647 // Max int value
#endif // !WIN32 #endif // !__WIN__
#include <locale.h> #include <locale.h>
/***********************************************************************/ /***********************************************************************/
@@ -73,11 +73,11 @@
/* Macro or external routine definition */ /* Macro or external routine definition */
/***********************************************************************/ /***********************************************************************/
#if defined(THREAD) #if defined(THREAD)
#if defined(WIN32) #if defined(__WIN__)
extern CRITICAL_SECTION parsec; // Used calling the Flex parser extern CRITICAL_SECTION parsec; // Used calling the Flex parser
#else // !WIN32 #else // !__WIN__
extern pthread_mutex_t parmut; extern pthread_mutex_t parmut;
#endif // !WIN32 #endif // !__WIN__
#endif // THREAD #endif // THREAD
/***********************************************************************/ /***********************************************************************/
@@ -403,11 +403,11 @@ char *SetPath(PGLOBAL g, const char *path)
} // endif path } // endif path
if (*path != '.') { if (*path != '.') {
#if defined(WIN32) #if defined(__WIN__)
char *s= "\\"; char *s= "\\";
#else // !WIN32 #else // !__WIN__
char *s= "/"; char *s= "/";
#endif // !WIN32 #endif // !__WIN__
strcat(strcat(strcat(strcpy(buf, "."), s), path), s); strcat(strcat(strcat(strcpy(buf, "."), s), path), s);
} else } else
strcpy(buf, path); 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; char *drive = NULL, *direc = NULL, *fname = NULL, *ftype = NULL;
switch (op) { // Determine which part to extract switch (op) { // Determine which part to extract
#if !defined(UNIX) #if defined(__WIN__)
case OP_FDISK: drive = pBuff; break; case OP_FDISK: drive = pBuff; break;
#endif // !UNIX #endif // !UNIX
case OP_FPATH: direc = pBuff; break; 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. */ /* instruction is included in an Enter/LeaveCriticalSection bracket. */
/*********************************************************************/ /*********************************************************************/
#if defined(THREAD) #if defined(THREAD)
#if defined(WIN32) #if defined(__WIN__)
EnterCriticalSection((LPCRITICAL_SECTION)&parsec); EnterCriticalSection((LPCRITICAL_SECTION)&parsec);
#else // !WIN32 #else // !__WIN__
pthread_mutex_lock(&parmut); pthread_mutex_lock(&parmut);
#endif // !WIN32 #endif // !__WIN__
#endif // THREAD #endif // THREAD
/*int rc =*/ fmdflex(pdp); /*int rc =*/ fmdflex(pdp);
#if defined(THREAD) #if defined(THREAD)
#if defined(WIN32) #if defined(__WIN__)
LeaveCriticalSection((LPCRITICAL_SECTION)&parsec); LeaveCriticalSection((LPCRITICAL_SECTION)&parsec);
#else // !WIN32 #else // !__WIN__
pthread_mutex_unlock(&parmut); pthread_mutex_unlock(&parmut);
#endif // !WIN32 #endif // !__WIN__
#endif // THREAD #endif // THREAD
if (trace) if (trace)
@@ -1109,7 +1109,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp)
return amn; return amn;
} // end of GetAmName } // end of GetAmName
#if defined(WIN32) && !defined(NOCATCH) #if defined(__WIN__) && !defined(NOCATCH)
/***********************************************************************/ /***********************************************************************/
/* GetExceptionDesc: return the description of an exception code. */ /* GetExceptionDesc: return the description of an exception code. */
/***********************************************************************/ /***********************************************************************/
@@ -1197,7 +1197,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e)
return p; return p;
} // end of GetExceptionDesc } // end of GetExceptionDesc
#endif // WIN32 && !NOCATCH #endif // __WIN__ && !NOCATCH
/***********************************************************************/ /***********************************************************************/
/* PlgDBalloc: allocates or suballocates memory conditionally. */ /* PlgDBalloc: allocates or suballocates memory conditionally. */
@@ -1239,7 +1239,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp)
if (!mp.Sub) { if (!mp.Sub) {
// For allocations greater than one fourth of remaining storage // For allocations greater than one fourth of remaining storage
// in the area, do allocate from virtual storage. // in the area, do allocate from virtual storage.
#if defined(WIN32) #if defined(__WIN__)
if (mp.Size >= BIGMEM) if (mp.Size >= BIGMEM)
mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT, PAGE_READWRITE); mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT, PAGE_READWRITE);
else else
@@ -1336,7 +1336,7 @@ void PlgDBfree(MBLOCK& mp)
htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size); htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size);
if (!mp.Sub && mp.Memp) if (!mp.Sub && mp.Memp)
#if defined(WIN32) #if defined(__WIN__)
if (mp.Size >= BIGMEM) if (mp.Size >= BIGMEM)
VirtualFree(mp.Memp, 0, MEM_RELEASE); VirtualFree(mp.Memp, 0, MEM_RELEASE);
else else
@@ -1532,11 +1532,11 @@ int FileComp(PGLOBAL g, char *file1, char *file2)
bp[0] = buff1; bp[1] = buff2; bp[0] = buff1; bp[1] = buff2;
for (i = 0; i < 2; i++) { 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); 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); h[i]= global_open(g, MSGOD_NONE, fn[i], O_RDONLY);
#endif // !WIN32 #endif // !__WIN__
if (h[i] == -1) { if (h[i] == -1) {
// if (errno != ENOENT) { // if (errno != ENOENT) {

View File

@@ -44,7 +44,7 @@
/* */ /* */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else #else
#if defined(UNIX) || defined(UNIV_LINUX) #if defined(UNIX) || defined(UNIV_LINUX)
@@ -80,9 +80,9 @@
#include "rcmsg.h" #include "rcmsg.h"
#endif // NEWMSG #endif // NEWMSG
#if defined(WIN32) #if defined(__WIN__)
extern HINSTANCE s_hModule; /* Saved module handle */ extern HINSTANCE s_hModule; /* Saved module handle */
#endif // WIN32 #endif // __WIN__
#if defined(XMSG) #if defined(XMSG)
extern char *msg_path; extern char *msg_path;
@@ -192,7 +192,7 @@ int PlugExit(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName) LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName)
{ {
#if !defined(UNIX) && !defined(UNIV_LINUX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -220,7 +220,7 @@ LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName)
BOOL PlugIsAbsolutePath(LPCSTR path) BOOL PlugIsAbsolutePath(LPCSTR path)
{ {
#if defined(WIN32) #if defined(__WIN__)
return ((path[0] >= 'a' && path[0] <= 'z') || return ((path[0] >= 'a' && path[0] <= 'z') ||
(path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':'; (path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':';
#else #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 direc[_MAX_DIR], defdir[_MAX_DIR], tmpdir[_MAX_DIR];
char fname[_MAX_FNAME]; char fname[_MAX_FNAME];
char ftype[_MAX_EXT]; char ftype[_MAX_EXT];
#if !defined(UNIX) && !defined(UNIV_LINUX) #if defined(__WIN__)
char drive[_MAX_DRIVE], defdrv[_MAX_DRIVE]; char drive[_MAX_DRIVE], defdrv[_MAX_DRIVE];
#else #else
char *drive = NULL, *defdrv = NULL; char *drive = NULL, *defdrv = NULL;
@@ -255,7 +255,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
return pBuff; return pBuff;
} // endif } // endif
#if !defined(WIN32) #if !defined(__WIN__)
if (*FileName == '~') { if (*FileName == '~') {
if (_fullpath(pBuff, FileName, _MAX_PATH)) { if (_fullpath(pBuff, FileName, _MAX_PATH)) {
if (trace > 1) if (trace > 1)
@@ -266,7 +266,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
return FileName; // Error, return unchanged name return FileName; // Error, return unchanged name
} // endif FileName } // endif FileName
#endif // !WIN32 #endif // !__WIN__
if (prefix && strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath)) if (prefix && strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath))
{ {
@@ -295,11 +295,11 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
if (trace > 1) { if (trace > 1) {
htrc("after _splitpath: FileName=%s\n", FileName); htrc("after _splitpath: FileName=%s\n", FileName);
#if defined(UNIX) || defined(UNIV_LINUX) #if defined(__WIN__)
htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype);
#else
htrc("drive=%s dir=%s fname=%s ext=%s\n", drive, direc, fname, ftype); htrc("drive=%s dir=%s fname=%s ext=%s\n", drive, direc, fname, ftype);
htrc("defdrv=%s defdir=%s\n", defdrv, defdir); htrc("defdrv=%s defdir=%s\n", defdrv, defdir);
#else
htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype);
#endif #endif
} // endif trace } // endif trace
@@ -427,7 +427,7 @@ char *PlugGetMessage(PGLOBAL g, int mid)
} // end of PlugGetMessage } // end of PlugGetMessage
#endif // NEWMSG #endif // NEWMSG
#if defined(WIN32) #if defined(__WIN__)
/***********************************************************************/ /***********************************************************************/
/* Return the line length of the console screen buffer. */ /* Return the line length of the console screen buffer. */
/***********************************************************************/ /***********************************************************************/
@@ -439,7 +439,7 @@ short GetLineLength(PGLOBAL g)
return (b) ? coninfo.dwSize.X : 0; return (b) ? coninfo.dwSize.X : 0;
} // end of GetLineLength } // end of GetLineLength
#endif // WIN32 #endif // __WIN__
/***********************************************************************/ /***********************************************************************/
/* Program for memory allocation of work and language areas. */ /* Program for memory allocation of work and language areas. */

View File

@@ -21,9 +21,9 @@
#include "msgid.h" #include "msgid.h"
#endif // NEWMSG #endif // NEWMSG
#if !defined(WIN32) #if !defined(__WIN__)
#define stricmp strcasecmp #define stricmp strcasecmp
#endif // !WIN32 #endif // !__WIN__
char *msglang(void); char *msglang(void);

View File

@@ -17,7 +17,7 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <sqlext.h> #include <sqlext.h>
#else #else
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ... #include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
@@ -48,9 +48,9 @@
#include "tabmul.h" #include "tabmul.h"
#include "ha_connect.h" #include "ha_connect.h"
#if !defined(WIN32) #if !defined(__WIN__)
extern handlerton *connect_hton; extern handlerton *connect_hton;
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* External function. */ /* External function. */
@@ -479,7 +479,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
} else } else
PlugSetPath(soname, Module, GetPluginDir()); PlugSetPath(soname, Module, GetPluginDir());
#if defined(WIN32) #if defined(__WIN__)
// Is the DLL already loaded? // Is the DLL already loaded?
if (!Hdll && !(Hdll = GetModuleHandle(soname))) if (!Hdll && !(Hdll = GetModuleHandle(soname)))
// No, load the Dll implementing the function // No, load the Dll implementing the function
@@ -508,7 +508,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
FreeLibrary((HMODULE)Hdll); FreeLibrary((HMODULE)Hdll);
return NULL; return NULL;
} // endif getdef } // endif getdef
#else // !WIN32 #else // !__WIN__
const char *error = NULL; const char *error = NULL;
Dl_info dl_info; Dl_info dl_info;
@@ -551,7 +551,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
dlclose(Hdll); dlclose(Hdll);
return NULL; return NULL;
} // endif getdef } // endif getdef
#endif // !WIN32 #endif // !__WIN__
// Just in case the external Get function does not set error messages // Just in case the external Get function does not set error messages
sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype); sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype);

View File

@@ -139,11 +139,11 @@ class DllExport OEMDEF : public TABDEF { /* OEM table */
PTABDEF GetXdef(PGLOBAL g); PTABDEF GetXdef(PGLOBAL g);
// Members // Members
#if defined(WIN32) #if defined(__WIN__)
HANDLE Hdll; /* Handle to the external DLL */ HANDLE Hdll; /* Handle to the external DLL */
#else // !WIN32 #else // !__WIN__
void *Hdll; /* Handle for the loaded shared library */ void *Hdll; /* Handle for the loaded shared library */
#endif // !WIN32 #endif // !__WIN__
PTABDEF Pxdef; /* Pointer to the external TABDEF class */ PTABDEF Pxdef; /* Pointer to the external TABDEF class */
char *Module; /* Path/Name of the DLL implenting it */ char *Module; /* Path/Name of the DLL implenting it */
char *Subtype; /* The name of the OEM table sub type */ char *Subtype; /* The name of the OEM table sub type */

View File

@@ -17,7 +17,7 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <sys\timeb.h> // For testing only #include <sys\timeb.h> // For testing only
#include <fcntl.h> #include <fcntl.h>
@@ -26,7 +26,7 @@
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -34,7 +34,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -208,11 +208,11 @@ void DOSDEF::RemoveOptValues(PGLOBAL g)
// Delete any eventually ill formed non matching optimization file // Delete any eventually ill formed non matching optimization file
if (!GetOptFileName(g, filename)) if (!GetOptFileName(g, filename))
#if defined(WIN32) #if defined(__WIN__)
DeleteFile(filename); DeleteFile(filename);
#else // UNIX #else // UNIX
remove(filename); remove(filename);
#endif // WIN32 #endif // __WIN__
Optimized = 0; Optimized = 0;
} // end of RemoveOptValues } // end of RemoveOptValues
@@ -253,7 +253,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
/*********************************************************************/ /*********************************************************************/
if (sep) { if (sep) {
// Indexes are save in separate files // Indexes are save in separate files
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -270,7 +270,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
strcat(strcat(fname, "_"), pxdf->GetName()); strcat(strcat(fname, "_"), pxdf->GetName());
_makepath(filename, drive, direc, fname, ftype); _makepath(filename, drive, direc, fname, ftype);
PlugSetPath(filename, filename, GetPath()); PlugSetPath(filename, filename, GetPath());
#if defined(WIN32) #if defined(__WIN__)
if (!DeleteFile(filename)) if (!DeleteFile(filename))
rc |= (GetLastError() != ERROR_FILE_NOT_FOUND); rc |= (GetLastError() != ERROR_FILE_NOT_FOUND);
#else // UNIX #else // UNIX
@@ -287,7 +287,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
// Drop all indexes, delete the common file // Drop all indexes, delete the common file
PlugSetPath(filename, Ofn, GetPath()); PlugSetPath(filename, Ofn, GetPath());
strcat(PlugRemoveType(filename, filename), ftype); strcat(PlugRemoveType(filename, filename), ftype);
#if defined(WIN32) #if defined(__WIN__)
if (!DeleteFile(filename)) if (!DeleteFile(filename))
rc = (GetLastError() != ERROR_FILE_NOT_FOUND); rc = (GetLastError() != ERROR_FILE_NOT_FOUND);
#else // UNIX #else // UNIX
@@ -956,7 +956,7 @@ bool TDBDOS::GetBlockValues(PGLOBAL g)
#if 0 #if 0
if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS) if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS)
return false; return false;
#endif // WIN32 #endif // __WIN__
if (defp->Optimized) if (defp->Optimized)
return false; // Already done or to be redone return false; // Already done or to be redone

View File

@@ -17,7 +17,7 @@
/* Include relevant section of system dependant header files. */ /* Include relevant section of system dependant header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@@ -25,7 +25,7 @@
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -35,7 +35,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */

View File

@@ -20,7 +20,7 @@
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@@ -102,14 +102,14 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep,
} // endif info } // endif info
// num_max = atoi(p+1); // Max num of record to test // 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)) if (sep == ',' || strnicmp(setlocale(LC_NUMERIC, NULL), "French", 6))
dechar = '.'; dechar = '.';
else else
dechar = ','; dechar = ',';
#else // !WIN32 #else // !__WIN__
dechar = '.'; dechar = '.';
#endif // !WIN32 #endif // !__WIN__
if (trace) if (trace)
htrc("File %s sep=%c q=%c hdr=%d mxr=%d\n", 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)) { if (fgets(buf, sizeof(buf), infile)) {
n = strlen(buf) + 1; n = strlen(buf) + 1;
buf[n - 2] = '\0'; buf[n - 2] = '\0';
#if defined(UNIX) #if !defined(__WIN__)
// The file can be imported from Windows // The file can be imported from Windows
if (buf[n - 3] == '\r') if (buf[n - 3] == '\r')
buf[n - 3] = 0; 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)) { if (fgets(buf, sizeof(buf), infile)) {
n = strlen(buf); n = strlen(buf);
buf[n - 1] = '\0'; buf[n - 1] = '\0';
#if defined(UNIX) #if !defined(__WIN__)
// The file can be imported from Windows // The file can be imported from Windows
if (buf[n - 2] == '\r') if (buf[n - 2] == '\r')
buf[n - 2] = 0; buf[n - 2] = 0;

View File

@@ -623,11 +623,11 @@ bool TDBJSN::SkipHeader(PGLOBAL g)
return true; return true;
#endif // _DEBUG #endif // _DEBUG
#if defined(WIN32) #if defined(__WIN__)
#define Ending 2 #define Ending 2
#else // !WIN32 #else // !__WIN__
#define Ending 1 #define Ending 1
#endif // !WIN32 #endif // !__WIN__
if (Pretty == 1) { if (Pretty == 1) {
if (Mode == MODE_INSERT || Mode == MODE_DELETE) { if (Mode == MODE_INSERT || Mode == MODE_DELETE) {

View File

@@ -3,12 +3,12 @@
/* From the article and sample code by Khalid Shaikh. */ /* From the article and sample code by Khalid Shaikh. */
/* TABMAC: virtual table to get the list of MAC addresses. */ /* TABMAC: virtual table to get the list of MAC addresses. */
/***********************************************************************/ /***********************************************************************/
#if defined(WIN32) #if defined(__WIN__)
#include "my_global.h" #include "my_global.h"
//#include <iphlpapi.h> //#include <iphlpapi.h>
#else // !WIN32 #else // !__WIN__
#error This is a WIN32 only table type #error This is a WINDOWS only table type
#endif // !WIN32 #endif // !__WIN__
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
//#include "catalog.h" //#include "catalog.h"

View File

@@ -1,11 +1,11 @@
// TABMAC.H Olivier Bertrand 2011-2012 // TABMAC.H Olivier Bertrand 2011-2012
// MAC: virtual table to Get Mac Addresses via GetAdaptersInfo // MAC: virtual table to Get Mac Addresses via GetAdaptersInfo
#if defined(WIN32) #if defined(__WIN__)
#include <windows.h> #include <windows.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#else // !WIN32 #else // !__WIN__
#error This is a WIN32 only table TYPE #error This is a WINDOWS only table TYPE
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Definitions. */ /* Definitions. */

View File

@@ -37,7 +37,7 @@
/* Include relevant section of system dependant header files. */ /* Include relevant section of system dependant header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
@@ -145,7 +145,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
/* To_File is a multiple name with special characters */ /* To_File is a multiple name with special characters */
/*******************************************************************/ /*******************************************************************/
#if defined(WIN32) #if defined(__WIN__)
char drive[_MAX_DRIVE], direc[_MAX_DIR]; char drive[_MAX_DRIVE], direc[_MAX_DIR];
WIN32_FIND_DATA FileData; WIN32_FIND_DATA FileData;
HANDLE hSearch; HANDLE hSearch;
@@ -196,7 +196,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
return true; return true;
} // endif FindClose } // endif FindClose
#else // !WIN32 #else // !__WIN__
struct stat fileinfo; struct stat fileinfo;
char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN]; char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN];
DIR *dir; DIR *dir;
@@ -249,7 +249,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
// Close the dir handle. // Close the dir handle.
closedir(dir); closedir(dir);
#endif // !WIN32 #endif // !__WIN__
} else { } else {
/*******************************************************************/ /*******************************************************************/
@@ -269,7 +269,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
p = filename + strlen(filename) - 1; p = filename + strlen(filename) - 1;
#if defined(UNIX) #if !defined(__WIN__)
// Data files can be imported from Windows (having CRLF) // Data files can be imported from Windows (having CRLF)
if (*p == '\n' || *p == '\r') { if (*p == '\n' || *p == '\r') {
// is this enough for Unix ??? // is this enough for Unix ???
@@ -297,7 +297,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
} // endif Mul } // endif Mul
#if defined(WIN32) #if defined(__WIN__)
suite: suite:
#endif #endif
@@ -620,17 +620,17 @@ TDBDIR::TDBDIR(PDIRDEF tdp) : TDBASE(tdp)
{ {
To_File = tdp->Fn; To_File = tdp->Fn;
iFile = 0; iFile = 0;
#if defined(WIN32) #if defined(__WIN__)
memset(&FileData, 0, sizeof(_finddata_t)); memset(&FileData, 0, sizeof(_finddata_t));
Hsearch = -1; Hsearch = -1;
*Drive = '\0'; *Drive = '\0';
#else // !WIN32 #else // !__WIN__
memset(&Fileinfo, 0, sizeof(struct stat)); memset(&Fileinfo, 0, sizeof(struct stat));
Entry = NULL; Entry = NULL;
Dir = NULL; Dir = NULL;
Done = false; Done = false;
*Pattern = '\0'; *Pattern = '\0';
#endif // !WIN32 #endif // !__WIN__
*Fpath = '\0'; *Fpath = '\0';
*Direc = '\0'; *Direc = '\0';
*Fname = '\0'; *Fname = '\0';
@@ -641,17 +641,17 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp)
{ {
To_File = tdbp->To_File; To_File = tdbp->To_File;
iFile = tdbp->iFile; iFile = tdbp->iFile;
#if defined(WIN32) #if defined(__WIN__)
FileData = tdbp->FileData; FileData = tdbp->FileData;
Hsearch = tdbp->Hsearch; Hsearch = tdbp->Hsearch;
strcpy(Drive, tdbp->Drive); strcpy(Drive, tdbp->Drive);
#else // !WIN32 #else // !__WIN__
Fileinfo = tdbp->Fileinfo; Fileinfo = tdbp->Fileinfo;
Entry = tdbp->Entry; Entry = tdbp->Entry;
Dir = tdbp->Dir; Dir = tdbp->Dir;
Done = tdbp->Done; Done = tdbp->Done;
strcpy(Pattern, tdbp->Pattern); strcpy(Pattern, tdbp->Pattern);
#endif // !WIN32 #endif // !__WIN__
strcpy(Direc, tdbp->Direc); strcpy(Direc, tdbp->Direc);
strcpy(Fname, tdbp->Fname); strcpy(Fname, tdbp->Fname);
strcpy(Ftype, tdbp->Ftype); strcpy(Ftype, tdbp->Ftype);
@@ -675,7 +675,7 @@ char* TDBDIR::Path(PGLOBAL g)
{ {
PCATLG cat = PlgGetCatalog(g); PCATLG cat = PlgGetCatalog(g);
#if defined(WIN32) #if defined(__WIN__)
if (!*Drive) { if (!*Drive) {
PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath()); PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath());
_splitpath(Fpath, Drive, Direc, Fname, Ftype); _splitpath(Fpath, Drive, Direc, Fname, Ftype);
@@ -683,7 +683,7 @@ char* TDBDIR::Path(PGLOBAL g)
_makepath(Fpath, Drive, Direc, Fname, Ftype); // Usefull ??? _makepath(Fpath, Drive, Direc, Fname, Ftype); // Usefull ???
return Fpath; return Fpath;
#else // !WIN32 #else // !__WIN__
if (!Done) { if (!Done) {
PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath()); PlugSetPath(Fpath, To_File, ((PTABDEF)To_Def)->GetPath());
_splitpath(Fpath, NULL, Direc, Fname, Ftype); _splitpath(Fpath, NULL, Direc, Fname, Ftype);
@@ -692,7 +692,7 @@ char* TDBDIR::Path(PGLOBAL g)
} // endif Done } // endif Done
return Pattern; return Pattern;
#endif // !WIN32 #endif // !__WIN__
} // end of Path } // end of Path
/***********************************************************************/ /***********************************************************************/
@@ -710,7 +710,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
{ {
if (MaxSize < 0) { if (MaxSize < 0) {
int n = -1; int n = -1;
#if defined(WIN32) #if defined(__WIN__)
int h; int h;
// Start searching files in the target directory. // Start searching files in the target directory.
@@ -726,7 +726,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
} else } else
n = 0; n = 0;
#else // !WIN32 #else // !__WIN__
Path(g); Path(g);
// Start searching files in the target directory. // Start searching files in the target directory.
@@ -750,7 +750,7 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
// Close the DIR handle. // Close the DIR handle.
closedir(Dir); closedir(Dir);
#endif // !WIN32 #endif // !__WIN__
MaxSize = n; MaxSize = n;
} // endif MaxSize } // endif MaxSize
@@ -776,10 +776,10 @@ bool TDBDIR::OpenDB(PGLOBAL g)
} // endif use } // endif use
Use = USE_OPEN; Use = USE_OPEN;
#if !defined(WIN32) #if !defined(__WIN__)
Path(g); // Be sure it is done Path(g); // Be sure it is done
Dir = NULL; // For ReadDB Dir = NULL; // For ReadDB
#endif // !WIN32 #endif // !__WIN__
return false; return false;
} // end of OpenDB } // end of OpenDB
@@ -790,7 +790,7 @@ int TDBDIR::ReadDB(PGLOBAL g)
{ {
int rc = RC_OK; int rc = RC_OK;
#if defined(WIN32) #if defined(__WIN__)
if (Hsearch == -1) { if (Hsearch == -1) {
/*******************************************************************/ /*******************************************************************/
/* Start searching files in the target directory. The use of the */ /* Start searching files in the target directory. The use of the */
@@ -848,7 +848,7 @@ int TDBDIR::ReadDB(PGLOBAL g)
rc = RC_EF; rc = RC_EF;
} // endif Entry } // endif Entry
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of ReadDB } // end of ReadDB
@@ -876,17 +876,17 @@ int TDBDIR::DeleteDB(PGLOBAL g, int)
/***********************************************************************/ /***********************************************************************/
void TDBDIR::CloseDB(PGLOBAL) void TDBDIR::CloseDB(PGLOBAL)
{ {
#if defined(WIN32) #if defined(__WIN__)
// Close the search handle. // Close the search handle.
_findclose(Hsearch); _findclose(Hsearch);
Hsearch = -1; Hsearch = -1;
#else // !WIN32 #else // !__WIN__
// Close the DIR handle // Close the DIR handle
if (Dir) { if (Dir) {
closedir(Dir); closedir(Dir);
Dir = NULL; Dir = NULL;
} // endif dir } // endif dir
#endif // !WIN32 #endif // !__WIN__
iFile = 0; iFile = 0;
} // end of CloseDB } // end of CloseDB
@@ -935,19 +935,19 @@ void DIRCOL::ReadColumn(PGLOBAL g)
/* Retrieve the information corresponding to the column number. */ /* Retrieve the information corresponding to the column number. */
/*********************************************************************/ /*********************************************************************/
switch (N) { switch (N) {
#if defined(WIN32) #if defined(__WIN__)
case 0: Value->SetValue_psz(tdbp->Drive); break; case 0: Value->SetValue_psz(tdbp->Drive); break;
#endif // WIN32 #endif // __WIN__
case 1: Value->SetValue_psz(tdbp->Direc); break; case 1: Value->SetValue_psz(tdbp->Direc); break;
case 2: Value->SetValue_psz(tdbp->Fname); break; case 2: Value->SetValue_psz(tdbp->Fname); break;
case 3: Value->SetValue_psz(tdbp->Ftype); 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 4: Value->SetValue((int)tdbp->FileData.attrib); break;
case 5: Value->SetValue((int)tdbp->FileData.size); break; case 5: Value->SetValue((int)tdbp->FileData.size); break;
case 6: Value->SetValue((int)tdbp->FileData.time_write); break; case 6: Value->SetValue((int)tdbp->FileData.time_write); break;
case 7: Value->SetValue((int)tdbp->FileData.time_create); break; case 7: Value->SetValue((int)tdbp->FileData.time_create); break;
case 8: Value->SetValue((int)tdbp->FileData.time_access); 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 4: Value->SetValue((int)tdbp->Fileinfo.st_mode); break;
case 5: Value->SetValue((int)tdbp->Fileinfo.st_size); break; case 5: Value->SetValue((int)tdbp->Fileinfo.st_size); break;
case 6: Value->SetValue((int)tdbp->Fileinfo.st_mtime); 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 8: Value->SetValue((int)tdbp->Fileinfo.st_atime); break;
case 9: Value->SetValue((int)tdbp->Fileinfo.st_uid); break; case 9: Value->SetValue((int)tdbp->Fileinfo.st_uid); break;
case 10: Value->SetValue((int)tdbp->Fileinfo.st_gid); break; case 10: Value->SetValue((int)tdbp->Fileinfo.st_gid); break;
#endif // !WIN32 #endif // !__WIN__
default: default:
sprintf(g->Message, MSG(INV_DIRCOL_OFST), N); sprintf(g->Message, MSG(INV_DIRCOL_OFST), N);
longjmp(g->jumper[g->jump_level], GetAmType()); longjmp(g->jumper[g->jump_level], GetAmType());
@@ -1006,7 +1006,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
size_t m = strlen(Direc); size_t m = strlen(Direc);
// Start searching files in the target directory. // Start searching files in the target directory.
#if defined(WIN32) #if defined(__WIN__)
int h = _findfirst(Path(g), &FileData); int h = _findfirst(Path(g), &FileData);
if (h != -1) { if (h != -1) {
@@ -1039,7 +1039,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Close the search handle. // Close the search handle.
_findclose(h); _findclose(h);
} // endif h } // endif h
#else // !WIN32 #else // !__WIN__
int k; int k;
DIR *dir = opendir(Direc); DIR *dir = opendir(Direc);
@@ -1073,7 +1073,7 @@ int TDBSDR::FindInDir(PGLOBAL g)
// Close the DIR handle. // Close the DIR handle.
closedir(dir); closedir(dir);
#endif // !WIN32 #endif // !__WIN__
return n; return n;
} // end of FindInDir } // end of FindInDir
@@ -1089,13 +1089,13 @@ bool TDBSDR::OpenDB(PGLOBAL g)
Sub = (PSUBDIR)PlugSubAlloc(g, NULL, sizeof(SUBDIR)); Sub = (PSUBDIR)PlugSubAlloc(g, NULL, sizeof(SUBDIR));
Sub->Next = NULL; Sub->Next = NULL;
Sub->Prev = NULL; Sub->Prev = NULL;
#if defined(WIN32) #if defined(__WIN__)
Sub->H = -1; Sub->H = -1;
Sub->Len = strlen(Direc); Sub->Len = strlen(Direc);
#else // !WIN32 #else // !__WIN__
Sub->D = NULL; Sub->D = NULL;
Sub->Len = 0; Sub->Len = 0;
#endif // !WIN32 #endif // !__WIN__
} // endif To_Sub } // endif To_Sub
return TDBDIR::OpenDB(g); return TDBDIR::OpenDB(g);
@@ -1108,7 +1108,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
{ {
int rc; int rc;
#if defined(WIN32) #if defined(__WIN__)
again: again:
rc = TDBDIR::ReadDB(g); rc = TDBDIR::ReadDB(g);
@@ -1160,7 +1160,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
} // endif H } // endif H
} // endif rc } // endif rc
#else // !WIN32 #else // !__WIN__
rc = RC_NF; rc = RC_NF;
again: again:
@@ -1217,7 +1217,7 @@ int TDBSDR::ReadDB(PGLOBAL g)
} // endif Entry } // endif Entry
#endif // !WIN32 #endif // !__WIN__
return rc; return rc;
} // end of ReadDB } // end of ReadDB

View File

@@ -6,14 +6,14 @@
/* */ /* */
/* This file contains the TDBMUL and TDBDIR classes declares. */ /* This file contains the TDBMUL and TDBDIR classes declares. */
/***********************************************************************/ /***********************************************************************/
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#else // !WIN32 #else // !__WIN__
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#endif // !WIN32 #endif // !__WIN__
//#include "osutil.h" //#include "osutil.h"
#include "block.h" #include "block.h"
@@ -132,17 +132,17 @@ class TDBDIR : public TDBASE {
// Members // Members
PSZ To_File; // Points to file search pathname PSZ To_File; // Points to file search pathname
int iFile; // Index of currently retrieved file int iFile; // Index of currently retrieved file
#if defined(WIN32) #if defined(__WIN__)
_finddata_t FileData; // Find data structure _finddata_t FileData; // Find data structure
int Hsearch; // Search handle int Hsearch; // Search handle
char Drive[_MAX_DRIVE]; // Drive name char Drive[_MAX_DRIVE]; // Drive name
#else // !WIN32 #else // !__WIN__
struct stat Fileinfo; // File info structure struct stat Fileinfo; // File info structure
struct dirent *Entry; // Point to directory entry structure struct dirent *Entry; // Point to directory entry structure
DIR *Dir; // To searched directory structure DIR *Dir; // To searched directory structure
bool Done; // true when _splipath is done bool Done; // true when _splipath is done
char Pattern[_MAX_FNAME+_MAX_EXT]; char Pattern[_MAX_FNAME+_MAX_EXT];
#endif // !WIN32 #endif // !__WIN__
char Fpath[_MAX_PATH]; // Absolute file search pattern char Fpath[_MAX_PATH]; // Absolute file search pattern
char Direc[_MAX_DIR]; // Search path char Direc[_MAX_DIR]; // Search path
char Fname[_MAX_FNAME]; // File name char Fname[_MAX_FNAME]; // File name
@@ -183,11 +183,11 @@ class TDBSDR : public TDBDIR {
typedef struct _Sub_Dir { typedef struct _Sub_Dir {
struct _Sub_Dir *Next; struct _Sub_Dir *Next;
struct _Sub_Dir *Prev; struct _Sub_Dir *Prev;
#if defined(WIN32) #if defined(__WIN__)
int H; // Search handle int H; // Search handle
#else // !WIN32 #else // !__WIN__
DIR *D; DIR *D;
#endif // !WIN32 #endif // !__WIN__
size_t Len; // Initial directory name length size_t Len; // Initial directory name length
} SUBDIR, *PSUBDIR; } SUBDIR, *PSUBDIR;

View File

@@ -35,9 +35,9 @@
#include "my_global.h" #include "my_global.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_servers.h" #include "sql_servers.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
//#include <fnmatch.h> //#include <fnmatch.h>
//#include <errno.h> //#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@@ -46,7 +46,7 @@
#include "osutil.h" #include "osutil.h"
//#include <io.h> //#include <io.h>
//#include <fcntl.h> //#include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */

View File

@@ -13,7 +13,7 @@
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#include "table.h" // MySQL table definitions #include "table.h" // MySQL table definitions
#if defined(WIN32) #if defined(__WIN__)
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)

View File

@@ -35,7 +35,7 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)

View File

@@ -17,7 +17,7 @@
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#include "table.h" // MySQL table definitions #include "table.h" // MySQL table definitions
#if defined(WIN32) #if defined(__WIN__)
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif #endif

View File

@@ -12,12 +12,12 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro #define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__ #endif // __BORLANDC__
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@@ -25,7 +25,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include application header files: */ /* Include application header files: */
@@ -36,9 +36,9 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "reldef.h" #include "reldef.h"
#if !defined(WIN32) #if !defined(__WIN__)
#include "osutil.h" #include "osutil.h"
#endif // !WIN32 #endif // !__WIN__
#include "filamtxt.h" #include "filamtxt.h"
#include "tabdos.h" #include "tabdos.h"
#include "tabsys.h" #include "tabsys.h"
@@ -48,10 +48,10 @@
#define CSZ 36 // Column section name length #define CSZ 36 // Column section name length
#define CDZ 256 // Column definition length #define CDZ 256 // Column definition length
#if !defined(WIN32) #if !defined(__WIN__)
#define GetPrivateProfileSectionNames(S,L,I) \ #define GetPrivateProfileSectionNames(S,L,I) \
GetPrivateProfileString(NULL,NULL,"",S,L,I) GetPrivateProfileString(NULL,NULL,"",S,L,I)
#endif // !WIN32 #endif // !__WIN__
/* -------------- Implementation of the INI classes ------------------ */ /* -------------- Implementation of the INI classes ------------------ */
@@ -123,7 +123,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
// Delete the INI table file if not protected // Delete the INI table file if not protected
if (!IsReadOnly()) { if (!IsReadOnly()) {
PlugSetPath(filename, Fn, GetPath()); PlugSetPath(filename, Fn, GetPath());
#if defined(WIN32) #if defined(__WIN__)
rc = !DeleteFile(filename); rc = !DeleteFile(filename);
#else // UNIX #else // UNIX
rc = remove(filename); rc = remove(filename);
@@ -345,9 +345,9 @@ int TDBINI::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/ /***********************************************************************/
void TDBINI::CloseDB(PGLOBAL) void TDBINI::CloseDB(PGLOBAL)
{ {
#if !defined(WIN32) #if !defined(__WIN__)
PROFILE_Close(Ifile); PROFILE_Close(Ifile);
#endif // !WIN32 #endif // !__WIN__
} // end of CloseDB } // end of CloseDB
// ------------------------ INICOL functions ---------------------------- // ------------------------ INICOL functions ----------------------------

View File

@@ -39,7 +39,7 @@
//#include "sql_base.h" //#include "sql_base.h"
#include "my_global.h" #include "my_global.h"
#include "table.h" // MySQL table definitions #include "table.h" // MySQL table definitions
#if defined(WIN32) #if defined(__WIN__)
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
@@ -73,15 +73,15 @@
#include "tabmysql.h" #include "tabmysql.h"
#include "ha_connect.h" #include "ha_connect.h"
#if defined(WIN32) #if defined(__WIN__)
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#define SYSEXIT void _USERENTRY #define SYSEXIT void _USERENTRY
#else #else
#define SYSEXIT void #define SYSEXIT void
#endif #endif
#else // !WIN32 #else // !__WIN__
#define SYSEXIT void * #define SYSEXIT void *
#endif // !WIN32 #endif // !__WIN__
/* ---------------------------- Class TBLDEF ---------------------------- */ /* ---------------------------- Class TBLDEF ---------------------------- */

View File

@@ -14,7 +14,7 @@
#include "sql_class.h" #include "sql_class.h"
#include "table.h" #include "table.h"
#include "field.h" #include "field.h"
#if defined(WIN32) #if defined(__WIN__)
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)

View File

@@ -35,7 +35,7 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
@@ -146,7 +146,7 @@ bool VCTDEF::Erase(char *filename)
for (i = 1, cdp = To_Cols; cdp; i++, cdp = cdp->GetNext()) { for (i = 1, cdp = To_Cols; cdp; i++, cdp = cdp->GetNext()) {
sprintf(filename, fpat, i); sprintf(filename, fpat, i);
//#if defined(WIN32) //#if defined(__WIN__)
// rc |= !DeleteFile(filename); // rc |= !DeleteFile(filename);
//#else // UNIX //#else // UNIX
rc |= remove(filename); rc |= remove(filename);
@@ -175,7 +175,7 @@ bool VCTDEF::Erase(char *filename)
int VCTDEF::MakeFnPattern(char *fpat) int VCTDEF::MakeFnPattern(char *fpat)
{ {
char pat[8]; char pat[8];
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;

View File

@@ -2,9 +2,9 @@
/* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2013 */ /* TABWMI: Author Olivier Bertrand -- PlugDB -- 2012 - 2013 */
/* TABWMI: Virtual table to get WMI information. */ /* TABWMI: Virtual table to get WMI information. */
/***********************************************************************/ /***********************************************************************/
#if !defined(WIN32) #if !defined(__WIN__)
#error This is a WIN32 only table type #error This is a WINDOWS only table type
#endif // !WIN32 #endif // !__WIN__
#include "my_global.h" #include "my_global.h"
#include <stdio.h> #include <stdio.h>

View File

@@ -17,7 +17,7 @@
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#include "table.h" // MySQL table definitions #include "table.h" // MySQL table definitions
#if defined(WIN32) #if defined(__WIN__)
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(__BORLANDC__) #if defined(__BORLANDC__)

View File

@@ -15,12 +15,12 @@
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <winsock2.h> #include <winsock2.h>
//#include <windows.h> //#include <windows.h>
#include <comdef.h> #include <comdef.h>
#else // !WIN32 #else // !__WIN__
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@@ -28,7 +28,7 @@
//#include <ctype.h> //#include <ctype.h>
#include "osutil.h" #include "osutil.h"
#define _O_RDONLY O_RDONLY #define _O_RDONLY O_RDONLY
#endif // !WIN32 #endif // !__WIN__
#include "resource.h" // for IDS_COLUMNS #include "resource.h" // for IDS_COLUMNS
#define INCLUDE_TDBXML #define INCLUDE_TDBXML
@@ -53,11 +53,11 @@
extern "C" char version[]; extern "C" char version[];
#if defined(WIN32) && defined(DOMDOC_SUPPORT) #if defined(__WIN__) && defined(DOMDOC_SUPPORT)
#define XMLSUP "MS-DOM" #define XMLSUP "MS-DOM"
#else // !WIN32 #else // !__WIN__
#define XMLSUP "libxml2" #define XMLSUP "libxml2"
#endif // !WIN32 #endif // !__WIN__
#define TYPE_UNKNOWN 12 /* Must be greater than other types */ #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; tdp->Tabname = tab;
if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL))) if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL)))
#if defined(WIN32) #if defined(__WIN__)
tdp->Usedom = true; tdp->Usedom = true;
#else // !WIN32 #else // !__WIN__
tdp->Usedom = false; tdp->Usedom = false;
#endif // !WIN32 #endif // !__WIN__
else else
tdp->Usedom = (toupper(*op) == 'M' || toupper(*op) == 'D'); 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 // Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise // on Windows and libxml2 otherwise
if (*buf == '*') if (*buf == '*')
#if defined(WIN32) #if defined(__WIN__)
Usedom = true; Usedom = true;
#else // !WIN32 #else // !__WIN__
Usedom = false; Usedom = false;
#endif // !WIN32 #endif // !__WIN__
else else
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D'); Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D');
@@ -878,7 +878,7 @@ bool TDBXML::Initialize(PGLOBAL g)
Nlist = TabNode->GetChildElements(g); Nlist = TabNode->GetChildElements(g);
Docp->SetNofree(true); // For libxml2 Docp->SetNofree(true); // For libxml2
#if defined(WIN32) #if defined(__WIN__)
} catch(_com_error e) { } catch(_com_error e) {
// We come here if a DOM command threw an error // We come here if a DOM command threw an error
char buf[128]; char buf[128];
@@ -892,7 +892,7 @@ bool TDBXML::Initialize(PGLOBAL g)
sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error()); sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error());
goto error; goto error;
#endif // WIN32 #endif // __WIN__
#if !defined(UNIX) #if !defined(UNIX)
} catch(...) { } catch(...) {
// Other errors // Other errors

View File

@@ -23,7 +23,7 @@
/* Include relevant MariaDB header file. */ /* Include relevant MariaDB header file. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else #else
#include "osutil.h" #include "osutil.h"

View File

@@ -30,11 +30,11 @@
#include "sql_class.h" #include "sql_class.h"
#include "sql_time.h" #include "sql_time.h"
#if defined(WIN32) #if defined(__WIN__)
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#include <string.h> #include <string.h>
#endif // !WIN32 #endif // !__WIN__
#include <math.h> #include <math.h>
@@ -77,12 +77,12 @@ int DTVAL::Shift = 0;
/***********************************************************************/ /***********************************************************************/
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
#if !defined(WIN32) #if !defined(__WIN__)
extern "C" { extern "C" {
PSZ strupr(PSZ s); PSZ strupr(PSZ s);
PSZ strlwr(PSZ s); PSZ strlwr(PSZ s);
} }
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Get a long long number from its character representation. */ /* Get a long long number from its character representation. */
@@ -1618,10 +1618,10 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
else else
n = strcmp(Strp, vp->GetCharValue()); n = strcmp(Strp, vp->GetCharValue());
#if defined(WIN32) #if defined(__WIN__)
if (n == _NLSCMPERROR) if (n == _NLSCMPERROR)
return n; // Here we should raise an error return n; // Here we should raise an error
#endif // WIN32 #endif // __WIN__
return (n > 0) ? 1 : (n < 0) ? -1 : 0; return (n > 0) ? 1 : (n < 0) ? -1 : 0;
} // end of CompareValue } // end of CompareValue

View File

@@ -10,12 +10,12 @@
/* Include relevant sections of the System header files. */ /* Include relevant sections of the System header files. */
/***********************************************************************/ /***********************************************************************/
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(__WIN__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
//#include <windows.h> //#include <windows.h>
#else // !WIN32 #else // !__WIN__
#if defined(UNIX) #if defined(UNIX)
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -25,7 +25,7 @@
#include <io.h> #include <io.h>
#endif // !UNIX #endif // !UNIX
#include <fcntl.h> #include <fcntl.h>
#endif // !WIN32 #endif // !__WIN__
/***********************************************************************/ /***********************************************************************/
/* Include required application header files */ /* Include required application header files */
@@ -835,7 +835,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
if ((sep = defp->GetBoolCatInfo("SepIndex", false))) { if ((sep = defp->GetBoolCatInfo("SepIndex", false))) {
// Index is saved in a separate file // Index is saved in a separate file
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -988,7 +988,7 @@ bool XINDEX::Init(PGLOBAL g)
if (defp->SepIndex()) { if (defp->SepIndex()) {
// Index was saved in a separate file // Index was saved in a separate file
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -1241,7 +1241,7 @@ bool XINDEX::MapInit(PGLOBAL g)
if (defp->SepIndex()) { if (defp->SepIndex()) {
// Index was save in a separate file // Index was save in a separate file
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -1454,7 +1454,7 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk)
if (defp->SepIndex()) { if (defp->SepIndex()) {
// Index was saved in a separate file // Index was saved in a separate file
#if !defined(UNIX) #if defined(__WIN__)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
#else #else
char *drive = NULL; char *drive = NULL;
@@ -2479,7 +2479,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode)
if (trace) if (trace)
htrc(" Xopen: filename=%s id=%d mode=%d\n", filename, id, mode); htrc(" Xopen: filename=%s id=%d mode=%d\n", filename, id, mode);
#if defined(WIN32) #if defined(__WIN__)
LONG high = 0; LONG high = 0;
DWORD rc, drc, access, share, creation; 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) bool XHUGE::Seek(PGLOBAL g, int low, int high, int origin)
{ {
#if defined(WIN32) #if defined(__WIN__)
LONG hi = high; LONG hi = high;
DWORD rc = SetFilePointer(Hfile, low, &hi, origin); 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; bool rc = false;
#if defined(WIN32) #if defined(__WIN__)
bool brc; bool brc;
DWORD nbr, count = (DWORD)(n * size); 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) int XHUGE::Write(PGLOBAL g, void *buf, int n, int size, bool& rc)
{ {
#if defined(WIN32) #if defined(__WIN__)
bool brc; bool brc;
DWORD nbw, count = (DWORD)n * (DWORD) size; DWORD nbw, count = (DWORD)n * (DWORD) size;
@@ -2779,7 +2779,7 @@ void XHUGE::Close(char *fn, int id)
if (trace) if (trace)
htrc("XHUGE::Close: fn=%s id=%d NewOff=%lld\n", fn, id, NewOff.Val); htrc("XHUGE::Close: fn=%s id=%d NewOff=%lld\n", fn, id, NewOff.Val);
#if defined(WIN32) #if defined(__WIN__)
if (id >= 0 && fn) { if (id >= 0 && fn) {
CloseFileHandle(Hfile); CloseFileHandle(Hfile);
Hfile = CreateFile(fn, GENERIC_READ | GENERIC_WRITE, 0, NULL, Hfile = CreateFile(fn, GENERIC_READ | GENERIC_WRITE, 0, NULL,
@@ -2794,7 +2794,7 @@ void XHUGE::Close(char *fn, int id)
} // endif SetFilePointer } // endif SetFilePointer
} // endif id } // endif id
#else // !WIN32 #else // !__WIN__
if (id >= 0 && fn) { if (id >= 0 && fn) {
if (Hfile != INVALID_HANDLE_VALUE) { if (Hfile != INVALID_HANDLE_VALUE) {
if (lseek64(Hfile, id * sizeof(IOFF), SEEK_SET) >= 0) { 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)); htrc("(XHUGE)error reopening %s: %s\n", fn, strerror(errno));
} // endif id } // endif id
#endif // !WIN32 #endif // !__WIN__
XLOAD::Close(); XLOAD::Close();
} // end of Close } // end of Close

View File

@@ -346,7 +346,7 @@ class DllExport XLOAD : public BLOCK {
protected: protected:
// Members // Members
#if defined(WIN32) #if defined(__WIN__)
HANDLE Hfile; // Handle to file or map HANDLE Hfile; // Handle to file or map
#else // UNIX #else // UNIX
int Hfile; // Descriptor to file or map int Hfile; // Descriptor to file or map