8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 21:23:03 +01:00
This commit is contained in:
asfernandes 2009-09-03 01:28:54 +00:00
parent a6b3c390f4
commit d8f739f53c
9 changed files with 35 additions and 35 deletions

View File

@ -146,7 +146,7 @@ namespace Firebird
return ptr;
}
/* NS: you cannot have operator bool here. It creates ambiguity with
/* NS: you cannot have operator bool here. It creates ambiguity with
operator T* with some of the compilers (at least VS2003)
operator bool() const

View File

@ -46,14 +46,14 @@ namespace Firebird {
// NS: This code is adapted from from KernelEx project, with the explicit
// permission from the author. KernelEx project aims to provide Windows XP
// compatibility layer for Windows 98 and Windows ME. For futher information
// compatibility layer for Windows 98 and Windows ME. For further information
// please refer to http://www.sourceforge.net/projects/kernelex/
static const K32OBJ_CRITICAL_SECTION = 4;
static const TDBX_WIN98 = 0x50;
static const TDBX_WINME = 0x80;
typedef struct _CRIT_SECT // Size = 0x20
typedef struct _CRIT_SECT // Size = 0x20
{
BYTE Type; // 00 = 4: K32_OBJECT_CRITICAL_SECTION
int RecursionCount; // 04 initially 0, incremented on lock
@ -116,7 +116,7 @@ BOOL WINAPI TryEnterCriticalSection_Win9X(CRITICAL_SECTION* cs)
WIN_CRITICAL_SECTION* mycs = (WIN_CRITICAL_SECTION*) cs;
if (mycs->Type != K32OBJ_CRITICAL_SECTION)
RaiseException(STATUS_ACCESS_VIOLATION, 0, 0, NULL);
return TryEnterCrst(mycs->crit);
}
@ -133,12 +133,12 @@ TryEnterCS::TryEnterCS()
// Win9X support
#ifdef WIN9X_SUPPORT
OSVERSIONINFO OsVersionInfo;
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx((LPOSVERSIONINFO) &OsVersionInfo))
{
if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
OsVersionInfo.dwMajorVersion == 4)
OsVersionInfo.dwMajorVersion == 4)
{
// Windows 98
if (OsVersionInfo.dwMinorVersion == 10)

View File

@ -62,7 +62,7 @@ private:
if (thread != currTID)
{
HANDLE hThread = OpenThread(THREAD_QUERY_INFORMATION, false, thread);
// commented exit code check - looks like OS does not return handle
// commented exit code check - looks like OS does not return handle
// for already exited thread
//DWORD exitCode = STILL_ACTIVE;
if (hThread)
@ -70,7 +70,7 @@ private:
//GetExitCodeThread(hThread, &exitCode);
CloseHandle(hThread);
}
//if ((!hThread) || (exitCode != STILL_ACTIVE))
if (!hThread)
{
@ -79,6 +79,7 @@ private:
}
}
#endif
return thread == currTID;
}
};
@ -406,7 +407,7 @@ fatal_exception::fatal_exception(const char* message) :
{
isc_arg_gds,
isc_random,
isc_arg_string,
isc_arg_string,
(ISC_STATUS)(IPTR) message,
isc_arg_end
};

View File

@ -172,7 +172,6 @@ void makeKey()
}
}
void initThreadCleanup()
{
int err = pthread_once(&keyOnce, makeKey);
@ -243,7 +242,7 @@ void ThreadCleanup::remove(FPTR_VOID_PTR cleanup, void* arg)
delete toDelete;
}
#else //USE_POSIX_THREADS
#else // USE_POSIX_THREADS
ThreadCleanup** ThreadCleanup::findCleanup(FPTR_VOID_PTR, void*)
{
@ -262,4 +261,4 @@ void ThreadCleanup::remove(FPTR_VOID_PTR, void*)
{
}
#endif //USE_POSIX_THREADS
#endif // USE_POSIX_THREADS

View File

@ -43,6 +43,7 @@ public:
static void add(FPTR_VOID_PTR cleanup, void* arg);
static void remove(FPTR_VOID_PTR cleanup, void* arg);
static void destructor(void*);
private:
FPTR_VOID_PTR function;
void* argument;

View File

@ -140,7 +140,7 @@ void Parser::transformString(const char* start, unsigned length, string& dest)
}
*p = '\'';
fb_assert(p <= buffer.begin() + newSize);
fb_assert(p < buffer.begin() + newSize);
pos = s + mark.length;
}

View File

@ -3681,26 +3681,26 @@ public:
#ifdef WIN9X_SUPPORT
// shell32.dll version 5.0 and later supports SHGetFolderPath entry point
HMODULE hShFolder = LoadLibrary("shell32.dll");
PFNSHGETFOLDERPATHA pfnSHGetFolderPath =
PFNSHGETFOLDERPATHA pfnSHGetFolderPath =
(PFNSHGETFOLDERPATHA) GetProcAddress(hShFolder, "SHGetFolderPathA");
if (!pfnSHGetFolderPath)
if (!pfnSHGetFolderPath)
{
// For old OS versions fall back to shfolder.dll
FreeLibrary(hShFolder);
hShFolder = LoadLibrary("shfolder.dll");
pfnSHGetFolderPath =
pfnSHGetFolderPath =
(PFNSHGETFOLDERPATHA) GetProcAddress(hShFolder, "SHGetFolderPathA");
}
char cmnData[MAXPATHLEN];
if (pfnSHGetFolderPath &&
pfnSHGetFolderPath(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL,
SHGFP_TYPE_CURRENT, cmnData) == S_OK)
pfnSHGetFolderPath(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL,
SHGFP_TYPE_CURRENT, cmnData) == S_OK)
{
PathUtils::concatPath(lockPrefix, cmnData, LOCKDIR);
}
else
else
{
// If shfolder.dll is missing or API fails fall back to using old style location for locks
lockPrefix = prefix;
@ -3712,8 +3712,8 @@ public:
Firebird::system_call_failed::raise("SHGetSpecialFolderPath");
}
PathUtils::concatPath(lockPrefix, cmnData, LOCKDIR);
#endif
#endif
#endif // WIN9X_SUPPORT
#endif // WIN_NT
}
lockPrefix.copyTo(fb_prefix_lock_val, sizeof(fb_prefix_lock_val));
fb_prefix_lock = fb_prefix_lock_val;

View File

@ -45,4 +45,3 @@ struct _SECURITY_ATTRIBUTES* ISC_get_security_desc();
#endif
#endif // JRD_ISC_PROTO_H

View File

@ -50,9 +50,9 @@ struct LocksArrayItem {
};
Firebird::SortedArray<
LocksArrayItem,
LocksArrayItem,
Firebird::InlineStorage<LocksArrayItem, 16>,
HANDLE,
HANDLE,
LocksArrayItem > file_locks_9X(*getDefaultMemoryPool());
// This header can be included in winnt.h
@ -70,10 +70,10 @@ HANDLE CreateFile_9X(
dwShareMode &= ~FILE_SHARE_DELETE;
HANDLE file = CreateFileA(
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile);
@ -84,7 +84,7 @@ HANDLE CreateFile_9X(
MutexLockGuard sync(file_locks_mutex);
file_locks_9X.add(
LocksArrayItem(
file,
file,
new Firebird::Mutex()));
}
@ -92,7 +92,7 @@ HANDLE CreateFile_9X(
return file;
}
BOOL CloseHandle_9X(HANDLE hObject)
BOOL CloseHandle_9X(HANDLE hObject)
{
if (!ISC_is_WinNT()) {
MutexLockGuard sync(file_locks_mutex);
@ -111,9 +111,9 @@ BOOL ReadFile_9X(
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped)
LPOVERLAPPED lpOverlapped)
{
if (ISC_is_WinNT())
if (ISC_is_WinNT())
return ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
Firebird::Mutex* fileMutex = NULL;
@ -130,7 +130,7 @@ BOOL ReadFile_9X(
MutexLockGuard sync(*fileMutex);
if (lpOverlapped != NULL) {
const DWORD ret = SetFilePointer(hFile, lpOverlapped->Offset,
const DWORD ret = SetFilePointer(hFile, lpOverlapped->Offset,
(PLONG)&lpOverlapped->OffsetHigh, FILE_BEGIN);
if (ret == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
return 0;
@ -152,7 +152,7 @@ BOOL WriteFile_9X(
LPOVERLAPPED lpOverlapped
)
{
if (ISC_is_WinNT())
if (ISC_is_WinNT())
return WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
Firebird::Mutex* fileMutex = NULL;
@ -169,7 +169,7 @@ BOOL WriteFile_9X(
MutexLockGuard sync(*fileMutex);
if (lpOverlapped != NULL) {
const DWORD ret = SetFilePointer(hFile, lpOverlapped->Offset,
const DWORD ret = SetFilePointer(hFile, lpOverlapped->Offset,
(PLONG)&lpOverlapped->OffsetHigh, FILE_BEGIN);
if (ret == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
return 0;