From 4875673228df0498c4c6c23d675b97bd859578f8 Mon Sep 17 00:00:00 2001 From: ahodgkinson Date: Mon, 8 May 2006 21:17:55 +0000 Subject: [PATCH] Added support for NetWare (libc) built using OpenWatcom. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@377 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- ftk/src/ftk.h | 2 +- ftk/src/ftkdir.cpp | 3 +- ftk/src/ftkdom.cpp | 27 ------- ftk/src/ftkerror.cpp | 6 ++ ftk/src/ftkfsys.cpp | 126 +++++++++--------------------- ftk/src/ftkftx.cpp | 177 ++++++++++--------------------------------- ftk/src/ftkiobuf.cpp | 54 +------------ ftk/src/ftkmem.cpp | 22 ++---- ftk/src/ftkmisc.cpp | 33 ++------ ftk/src/ftkntab.cpp | 6 ++ ftk/src/ftkpath.cpp | 27 ------- ftk/src/ftksem.cpp | 172 +++++------------------------------------ ftk/src/ftkstrm.cpp | 3 + ftk/src/ftksys.h | 84 ++++++-------------- ftk/src/ftktime.cpp | 43 +---------- ftk/src/ftkunix.cpp | 23 +++--- ftk/src/ftkxml.cpp | 3 +- 17 files changed, 168 insertions(+), 643 deletions(-) delete mode 100644 ftk/src/ftkdom.cpp delete mode 100644 ftk/src/ftkpath.cpp diff --git a/ftk/src/ftk.h b/ftk/src/ftk.h index a9ede87..40532a0 100644 --- a/ftk/src/ftk.h +++ b/ftk/src/ftk.h @@ -270,7 +270,7 @@ #define FLM_MIN_INT16 ((FLMINT16)(0x8000)) #define FLM_MAX_UINT8 ((FLMUINT8)0xFF) - #if( _MSC_VER >= 1200) && (_MSC_VER < 1300) + #if ((_MSC_VER >= 1200) && (_MSC_VER < 1300)) || defined( FLM_NLM) #define FLM_MAX_UINT64 ((FLMUINT64)(0xFFFFFFFFFFFFFFFFL)) #define FLM_MAX_INT64 ((FLMINT64)(0x7FFFFFFFFFFFFFFFL)) #define FLM_MIN_INT64 ((FLMINT64)(0x8000000000000000L)) diff --git a/ftk/src/ftkdir.cpp b/ftk/src/ftkdir.cpp index ba8f266..a717f0c 100644 --- a/ftk/src/ftkdir.cpp +++ b/ftk/src/ftkdir.cpp @@ -723,7 +723,6 @@ FSTATIC FLMBOOL f_fileMeetsFindCriteria( Desc: Search for file names matching FindTemplate (UNIX) ****************************************************************************/ #if defined( FLM_UNIX) || defined( FLM_NLM) - FSTATIC int Find1( char * FindTemplate, F_IO_FIND_DATA * DirInfo) @@ -739,7 +738,7 @@ FSTATIC int Find1( // If supplied template is illegal, return immediately - if( (FindTemplate == (char*)NULL) || !( uiFindLen = f_strlen( FindTemplate))) + if( (FindTemplate == NULL) || (uiFindLen = f_strlen( FindTemplate)) == 0) { return( EINVAL); } diff --git a/ftk/src/ftkdom.cpp b/ftk/src/ftkdom.cpp deleted file mode 100644 index 070fec7..0000000 --- a/ftk/src/ftkdom.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------------------------ -// Desc: DOM node implementation -// -// Tabs: 3 -// -// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the GNU General Public -// License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, contact Novell, Inc. -// -// To contact Novell about this file by physical or electronic mail, -// you may find current contact information at www.novell.com -// -// $Id: fdom.cpp 3112 2006-01-19 13:12:40 -0700 (Thu, 19 Jan 2006) dsanders $ -//------------------------------------------------------------------------------ - -#include "ftksys.h" - diff --git a/ftk/src/ftkerror.cpp b/ftk/src/ftkerror.cpp index b768773..f606f3c 100644 --- a/ftk/src/ftkerror.cpp +++ b/ftk/src/ftkerror.cpp @@ -518,7 +518,13 @@ FLMINT FLMAPI f_enterDebugger( fprintf( stderr, "Assertion failed in %s on line %d\n", pszFile, iLine); fflush( stderr); DebugBreak(); +#elif defined( FLM_NLM) + (void)pszFile; + (void)iLine; + EnterDebugger(); #else + fprintf( stderr, "Assertion failed in %s on line %d\n", pszFile, iLine); + fflush( stderr); assert( 0); #endif diff --git a/ftk/src/ftkfsys.cpp b/ftk/src/ftkfsys.cpp index e1665fb..862c2cf 100644 --- a/ftk/src/ftkfsys.cpp +++ b/ftk/src/ftkfsys.cpp @@ -195,12 +195,12 @@ private: RCODE removeEmptyDir( const char * pszDirName); -#if defined( FLM_UNIX) - RCODE unix_RenameSafe( +#if defined( FLM_UNIX) || defined( FLM_NLM) + RCODE renameSafe( const char * pszSrcFile, const char * pszDestFile); - RCODE unix_TargetIsDir( + RCODE targetIsDir( const char * tpath, FLMBOOL * isdir); #endif @@ -785,7 +785,7 @@ RCODE F_FileSystem::removeEmptyDir( return( NE_FLM_OK); -#elif defined( FLM_UNIX) +#elif defined( FLM_UNIX) || defined( FLM_NLM) if( rmdir( pszDirPath) == -1 ) { @@ -793,39 +793,6 @@ RCODE F_FileSystem::removeEmptyDir( } return( NE_FLM_OK); - -#elif defined( FLM_NLM) - RCODE rc = NE_FLM_OK; - FLMBYTE pucPseudoLNamePath[ F_PATH_MAX_SIZE + 1]; - FLMBYTE pucLNamePath[ F_PATH_MAX_SIZE]; - LONG lVolumeID; - LONG lPathID; - LONG lLNamePathCount; - LONG lErrorCode; - - f_strcpy( (char *)&pucPseudoLNamePath[1], pszDirPath); - pucPseudoLNamePath[0] = (FLMBYTE)f_strlen( pszDirPath); - - if( (lErrorCode = ConvertPathString( 0, 0, pucPseudoLNamePath, &lVolumeID, - &lPathID, pucLNamePath, &lLNamePathCount)) != 0) - { - goto Exit; - } - - if( (lErrorCode = DeleteDirectory( 0, lVolumeID, lPathID, pucLNamePath, - lLNamePathCount, LONGNameSpace)) != 0) - { - goto Exit; - } - -Exit: - - if( lErrorCode) - { - rc = f_mapPlatformError( lErrorCode, NE_FLM_IO_DELETING_FILE); - } - - return( rc); #endif } @@ -835,11 +802,7 @@ Desc: Determine if a file or directory exists. RCODE FLMAPI F_FileSystem::doesFileExist( const char * pszPath) { -#if defined( FLM_NLM) - - return( flmNetWareTestIfFileExists( pszPath)); - -#elif defined( FLM_WIN) +#if defined( FLM_WIN) DWORD dwFileAttr = GetFileAttributes( (LPTSTR)pszPath); @@ -877,11 +840,7 @@ RCODE FLMAPI F_FileSystem::getFileTimeStamp( const char * pszPath, FLMUINT * puiTimeStamp) { -#if defined( FLM_NLM) - - return( flmNetWareGetFileTimeStamp( pszPath, puiTimeStamp)); - -#elif defined( FLM_WIN) +#if defined( FLM_WIN) WIN32_FIND_DATA find_data; FILETIME ftLocalFileTime; @@ -1005,11 +964,7 @@ Desc: Delete a file or directory RCODE FLMAPI F_FileSystem::deleteFile( const char * pszFileName) { -#if defined( FLM_NLM) - - return( flmNetWareDeleteFile( pszFileName)); - -#elif defined( FLM_WIN) +#if defined( FLM_WIN) if( DeleteFile( (LPTSTR)pszFileName) == FALSE) { @@ -1256,11 +1211,7 @@ RCODE FLMAPI F_FileSystem::renameFile( const char * pszFileName, const char * pszNewFileName) { -#if defined( FLM_NLM) - - return( flmNetWareRenameFile( pszFileName, pszNewFileName)); - -#elif defined( FLM_WIN) +#if defined( FLM_WIN) DWORD error; RCODE rc = NE_FLM_OK; @@ -1299,14 +1250,14 @@ RCODE FLMAPI F_FileSystem::renameFile( FLMBOOL bSrcIsDir; FLMUINT64 ui64BytesCopied; - if( RC_BAD( rc = unix_TargetIsDir( (char*)pszFileName, &bSrcIsDir))) + if( RC_BAD( rc = targetIsDir( (char*)pszFileName, &bSrcIsDir))) { return( rc); } errno = 0; - if( RC_BAD( unix_RenameSafe( pszFileName, pszNewFileName))) + if( RC_BAD( renameSafe( pszFileName, pszNewFileName))) { switch( errno) { @@ -1356,7 +1307,7 @@ RCODE FLMAPI F_FileSystem::getSectorSize( #ifdef FLM_NLM F_UNREFERENCED_PARM( pszFileName); - *puiSectorSize = NETWARE_SECTOR_SIZE; + *puiSectorSize = F_NETWARE_SECTOR_SIZE; return( NE_FLM_OK); #elif defined( FLM_WIN) @@ -1423,31 +1374,7 @@ RCODE F_FileSystem::setReadOnly( { RCODE rc = NE_FLM_OK; -#if defined( FLM_UNIX) - struct stat filestatus; - - if( stat( (char *)pszFileName, &filestatus)) - { - rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE); - goto Exit; - } - - if ( bReadOnly) - { - filestatus.st_mode &= ~S_IWUSR; - } - else - { - filestatus.st_mode |= S_IWUSR; - } - - if ( chmod( (char *)pszFileName, filestatus.st_mode)) - { - rc = RC_SET( NE_FLM_FAILURE); - goto Exit; - } - -#elif defined( FLM_WIN) +#if defined( FLM_WIN) DWORD dwAttr; @@ -1472,10 +1399,27 @@ RCODE F_FileSystem::setReadOnly( rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE); goto Exit; } -#elif defined( FLM_NLM) +#elif defined( FLM_UNIX) || defined( FLM_NLM) + struct stat filestatus; - if ( RC_BAD( rc = flmNetWareSetReadOnly( pszFileName, bReadOnly))) + if( stat( (char *)pszFileName, &filestatus)) { + rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE); + goto Exit; + } + + if ( bReadOnly) + { + filestatus.st_mode &= ~S_IWUSR; + } + else + { + filestatus.st_mode |= S_IWUSR; + } + + if ( chmod( (char *)pszFileName, filestatus.st_mode)) + { + rc = RC_SET( NE_FLM_FAILURE); goto Exit; } #else @@ -1498,8 +1442,8 @@ FLMBOOL FLMAPI F_FileSystem::canDoAsync( void) /**************************************************************************** Desc: stat tpath to see if it is a directory ****************************************************************************/ -#if defined( FLM_UNIX) -RCODE F_FileSystem::unix_TargetIsDir( +#if defined( FLM_UNIX) || defined( FLM_NLM) +RCODE F_FileSystem::targetIsDir( const char * tpath, FLMBOOL * isdir) { @@ -1528,8 +1472,8 @@ Desc: Rename an existing file (typically an "X" locked file to an CREAT and EXCL options, (ensuring a unique file name)). Then, the source file will be renamed to new name. ****************************************************************************/ -#if defined( FLM_UNIX) -RCODE F_FileSystem::unix_RenameSafe( +#if defined( FLM_UNIX) || defined( FLM_NLM) +RCODE F_FileSystem::renameSafe( const char * pszSrcFile, const char * pszDestFile) { diff --git a/ftk/src/ftkftx.cpp b/ftk/src/ftkftx.cpp index 07f9595..d64050a 100644 --- a/ftk/src/ftkftx.cpp +++ b/ftk/src/ftkftx.cpp @@ -123,7 +123,7 @@ typedef struct FTX_INFO #if defined( FLM_WIN) PCHAR_INFO pCells; #elif defined( FLM_NLM) - void * pvScreenHandle; + scr_t hScreen; NLM_CHAR_INFO * pCells; #endif @@ -365,98 +365,6 @@ static FTX_INFO * gv_pFtxInfo = NULL; #elif defined( FLM_NLM) - extern "C" - { - LONG AllocateResourceTag( - LONG pvLoadRecord, - BYTE * pvResourceDescriptionString, - LONG ResourceSignature); - - #ifndef ScreenSignature - #define ScreenSignature 0x4E524353 /* 'NRCS' */ - #endif - - int OpenScreen( - void * pvScreenName, - void * pvResourceTag, - void ** pvScreenHandle); - - void CloseScreen( - void * pvScreenHandle); - - void ActivateScreen( - void * pvScreenHandle); - - void ClearScreen( - void * pvScreenHandle); - - void GetScreenSize( - WORD * swScreenHeight, - WORD * swScreenWidth); - - void PositionInputCursor( - void * pvScreenHandle, - WORD swRow, - WORD swColumn); - - void EnableInputCursor( - void * pvScreenHandle); - - void DisableInputCursor( - void * pvScreenHandle); - - LONG PositionOutputCursor( - void * pvScreenHandle, - WORD swRow, - WORD swColumn); - - void GetOutputCursorPosition( - void * pvScreenHandle, - WORD * row, - WORD * column); - - void SetInputToOutputCursorPosition( - void * pvScreenHandle); - - void GetKey( - void * pvScreenHandle, - BYTE * pucKeyType, - BYTE * pucKeyValue, - BYTE * pucKeyStatus, - BYTE * pucScanCode, - LONG sdLinesToProtect); - - LONG UngetKey( - struct ScreenStruct *screenID, - BYTE keyType, - BYTE keyValue, - BYTE keyStatus, - BYTE scanCode); - - LONG CheckKeyStatus( - void * pvScreenHandle); - - LONG DisplayScreenTextWithAttribute( - void * pvScreenHandleD, - LONG sdLine, - LONG sdColumn, - LONG sdLength, - BYTE ucLineAttribute, - BYTE * pszText); - - LONG WriteScreenCharacterAttribute( - void * pvScreenHandle, - LONG sdLine, - LONG sdColumn, - BYTE ucCharacter, - BYTE ucAttribute); - - void SetCursorStyle( - void * pvScreenHandle, - WORD swNewCursorStyle); - - } // extern "C" - FSTATIC void ftxNLMRefresh( void); #else @@ -638,13 +546,12 @@ RCODE FLMAPI FTXInit( #ifdef FLM_NLM - g_pvScreenTag = (void *)AllocateResourceTag( - (LONG)f_getNLMHandle(), - (BYTE *)"Screen", (LONG)ScreenSignature); + g_pvScreenTag = AllocateResourceTag( + f_getNLMHandle(), "Screen", ScreenSignature); (void)OpenScreen( pszAppName, - g_pvScreenTag, &gv_pFtxInfo->pvScreenHandle); - ActivateScreen( gv_pFtxInfo->pvScreenHandle); + g_pvScreenTag, &gv_pFtxInfo->hScreen); + ActivateScreen( gv_pFtxInfo->hScreen); #endif @@ -765,7 +672,7 @@ void FLMAPI FTXExit( void) #elif defined( FLM_NLM) - CloseScreen( gv_pFtxInfo->pvScreenHandle); + CloseScreen( gv_pFtxInfo->hScreen); #endif @@ -3436,12 +3343,12 @@ FSTATIC void ftxNLMRefresh( void) FTX_WINDOW * pWinImage; FTX_WINDOW * pWinScreen; FLMBOOL bModified; - LONG udCnt; - LONG udStartColumn; + FLMUINT uiCnt; + FLMUINT uiStartColumn; FLMUINT uiStartOffset; - BYTE * pucStartValue; - BYTE attribute; - BYTE ucStartAttr; + char * pucStartValue; + char attribute; + char ucStartAttr; ftxSyncImage(); pWinImage = gv_pFtxInfo->pScreenCur->pWinImage; @@ -3466,26 +3373,26 @@ FSTATIC void ftxNLMRefresh( void) { if (bModified) { - (void)DisplayScreenTextWithAttribute( gv_pFtxInfo->pvScreenHandle, - (LONG)uiLoop, (LONG)udStartColumn, udCnt, ucStartAttr, + DisplayScreenTextWithAttribute( gv_pFtxInfo->hScreen, + uiLoop, uiStartColumn, uiCnt, ucStartAttr, pucStartValue); } ucStartAttr = attribute; - udCnt = 0; + uiCnt = 0; uiStartOffset = uiOffset; - udStartColumn = (LONG)uiSubLoop; + uiStartColumn = uiSubLoop; bModified = TRUE; - pucStartValue = (BYTE *)&pWinImage->pszBuffer[ uiOffset]; + pucStartValue = &pWinImage->pszBuffer[ uiOffset]; } - udCnt++; + uiCnt++; } else { if (bModified) { bModified = FALSE; - (void)DisplayScreenTextWithAttribute( gv_pFtxInfo->pvScreenHandle, - (LONG)uiLoop, (LONG)udStartColumn, udCnt, ucStartAttr, + (void)DisplayScreenTextWithAttribute( gv_pFtxInfo->hScreen, + uiLoop, uiStartColumn, uiCnt, ucStartAttr, pucStartValue); } } @@ -3493,9 +3400,8 @@ FSTATIC void ftxNLMRefresh( void) if (bModified) { bModified = FALSE; - (void)DisplayScreenTextWithAttribute( gv_pFtxInfo->pvScreenHandle, - (LONG)uiLoop, (LONG)udStartColumn, udCnt, ucStartAttr, - pucStartValue); + DisplayScreenTextWithAttribute( gv_pFtxInfo->hScreen, + uiLoop, uiStartColumn, uiCnt, ucStartAttr, pucStartValue); } } } @@ -4182,7 +4088,7 @@ FSTATIC void ftxDisplayReset( void) #elif defined( FLM_UNIX) ftxUnixDisplayReset(); #elif defined( FLM_NLM) - ClearScreen( gv_pFtxInfo->pvScreenHandle); + ClearScreen( gv_pFtxInfo->hScreen); #else clrscr(); #endif @@ -4210,13 +4116,13 @@ FSTATIC void ftxDisplayGetSize( ftxUnixDisplayGetSize( puiNumColsRV, puiNumRowsRV); #else - WORD screenHeight; - WORD screenWidth; + FLMUINT16 ui16ScreenHeight; + FLMUINT16 ui16ScreenWidth; - GetScreenSize( &screenHeight, &screenWidth); + GetScreenSize( &ui16ScreenHeight, &ui16ScreenWidth); - *puiNumColsRV = (FLMUINT)screenWidth; - *puiNumRowsRV = (FLMUINT)screenHeight; + *puiNumColsRV = ui16ScreenWidth; + *puiNumRowsRV = ui16ScreenHeight; #endif } @@ -4256,17 +4162,17 @@ FSTATIC FLMBOOL ftxDisplaySetCursorType( if (uiType & FLM_CURSOR_INVISIBLE) { - DisableInputCursor( gv_pFtxInfo->pvScreenHandle); + DisableInputCursor( gv_pFtxInfo->hScreen); } else if (uiType & FLM_CURSOR_BLOCK) { - EnableInputCursor( gv_pFtxInfo->pvScreenHandle); - SetCursorStyle( pFtxInfo->pvScreenHandle, 0x0c00); // CURSOR_BLOCK + EnableInputCursor( gv_pFtxInfo->hScreen); + SetCursorStyle( gv_pFtxInfo->hScreen, CURSOR_BLOCK); } else { - EnableInputCursor( gv_pFtxInfo->pvScreenHandle); - SetCursorStyle( pFtxInfo->pvScreenHandle, 0x0c0B); // CURSOR_NORMAL + EnableInputCursor( gv_pFtxInfo->hScreen); + SetCursorStyle( gv_pFtxInfo->hScreen, CURSOR_NORMAL); } return( TRUE); @@ -4288,14 +4194,13 @@ FSTATIC void ftxDisplaySetCursorPos( } #if defined( FLM_NLM) - PositionOutputCursor( gv_pFtxInfo->pvScreenHandle, - (WORD)uiRow, (WORD)uiCol); + PositionOutputCursor( gv_pFtxInfo->hScreen, + (FLMUINT16)uiRow, (FLMUINT16)uiCol); // Wake up the input thread and send it a special code to // cause the cursor to be re-positioned. - UngetKey( (struct ScreenStruct *)gv_pFtxInfo->pvScreenHandle, - 0xFE, (BYTE)uiRow, (BYTE)uiCol, 0); + UngetKey( gv_pFtxInfo->hScreen, 0xFE, (FLMBYTE)uiRow, (FLMBYTE)uiCol, 0); #elif defined( FLM_WIN) @@ -4386,9 +4291,7 @@ get_key: // Get a key - GetKey( gv_pFtxInfo->pvScreenHandle, - &keyType, &keyValue, - &keyStatus, &scanCode, 0); + GetKey( gv_pFtxInfo->hScreen, &keyType, &keyValue, &keyStatus, &scanCode, 0); switch (keyType) { @@ -4539,8 +4442,7 @@ get_key: break; case 0xFE: // Re-position the input cursor - PositionInputCursor( gv_pFtxInfo->pvScreenHandle, - (WORD)keyValue, (WORD)keyStatus); + PositionInputCursor( gv_pFtxInfo->hScreen, keyValue, keyStatus); goto get_key; case 0xFF: // Ping @@ -4646,7 +4548,7 @@ Exit: return( bKeyHit); #elif defined( FLM_NLM) - return( (FLMBOOL)CheckKeyStatus( gv_pFtxInfo->pvScreenHandle)); + return( (FLMBOOL)CheckKeyStatus( gv_pFtxInfo->hScreen)); #else @@ -5000,8 +4902,7 @@ RCODE _ftxBackgroundThread( if( gv_pFtxInfo->bEnablePingChar) { #if defined( FLM_NLM) - UngetKey( (struct ScreenStruct *)gv_pFtxInfo->pvScreenHandle, - 0xFF, 0, 0, 0); + UngetKey( gv_pFtxInfo->hScreen, 0xFF, 0, 0, 0); #elif defined( FLM_WIN) { INPUT_RECORD inputRec; diff --git a/ftk/src/ftkiobuf.cpp b/ftk/src/ftkiobuf.cpp index d3b6f88..5adc1d9 100644 --- a/ftk/src/ftkiobuf.cpp +++ b/ftk/src/ftkiobuf.cpp @@ -318,9 +318,6 @@ RCODE FLMAPI F_IOBufferMgr::getBuffer( // into the buffer manager's used list. linkToList( &m_pFirstUsed, pIOBuffer); -#ifdef FLM_NLM - f_assert( kSemaphoreExamineCount( (SEMAPHORE)(pIOBuffer->m_hSem)) == 0); -#endif Exit: @@ -356,8 +353,6 @@ F_IOBuffer::F_IOBuffer() m_Overlapped.hEvent = 0; #elif defined( FLM_LINUX) || defined( FLM_SOLARIS) m_aio.aio_fildes = -1; -#elif defined( FLM_NLM) - m_hSem = F_SEM_NULL; #endif m_pStats = NULL; } @@ -382,13 +377,6 @@ F_IOBuffer::~F_IOBuffer() } #endif -#ifdef FLM_NLM - if (m_hSem != F_SEM_NULL) - { - f_semDestroy( &m_hSem); - } -#endif - if (m_pucBuffer) { #ifdef FLM_WIN @@ -437,13 +425,6 @@ RCODE FLMAPI F_IOBuffer::setupBuffer( } #endif -#ifdef FLM_NLM - if (RC_BAD( rc = f_semCreate( &m_hSem))) - { - goto Exit; - } -#endif - // Allocate a buffer #ifdef FLM_WIN @@ -523,9 +504,6 @@ Desc: FLMBOOL F_IOBuffer::isIOComplete( void) { FLMBOOL bComplete = FALSE; -#ifdef FLM_NLM - FLMUINT uiSemCount; -#endif if( m_eList != MGR_LIST_PENDING) { @@ -548,15 +526,8 @@ FLMBOOL F_IOBuffer::isIOComplete( void) } #endif -#ifdef FLM_NLM - if( (uiSemCount = (FLMUINT)kSemaphoreExamineCount( (SEMAPHORE)m_hSem)) != 0) - { - f_assert( uiSemCount == 1); - bComplete = TRUE; - } -#endif - Exit: + return( bComplete); } @@ -600,32 +571,9 @@ RCODE F_IOBuffer::waitToComplete( void) } #endif -#ifdef FLM_NLM - if( kSemaphoreWait( (SEMAPHORE)m_hSem) != 0) - { - f_assert( 0); - } - f_assert( kSemaphoreExamineCount( (SEMAPHORE)m_hSem) == 0); - rc = m_completionRc; - notifyComplete( m_completionRc); -#endif - return( rc); } -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI F_IOBuffer::signalComplete( - RCODE rc) -{ - m_completionRc = rc; - f_assert( kSemaphoreExamineCount( (SEMAPHORE)m_hSem) == 0); - kSemaphoreSignal( (SEMAPHORE)m_hSem); -} -#endif - /**************************************************************************** Desc: ****************************************************************************/ diff --git a/ftk/src/ftkmem.cpp b/ftk/src/ftkmem.cpp index cfae7c7..246e49f 100644 --- a/ftk/src/ftkmem.cpp +++ b/ftk/src/ftkmem.cpp @@ -127,15 +127,6 @@ static FLMBOOL gv_bLogLeaks = FALSE; #define F_PICKET_FENCE_SIZE 0 #endif -#ifdef FLM_NLM - extern "C" - { - void GetClosestSymbol( - BYTE * szBuffer, - LONG udAddress); - } -#endif - FSTATIC FLMBOOL initMemTracking( void); FSTATIC void saveMemTrackingInfo( @@ -1330,11 +1321,6 @@ void logMemLeak( udDisplacement); } } -#elif defined( FLM_NLM) - { - szFuncName [0] = '\t'; - GetClosestSymbol( (BYTE *)(&szFuncName[1]), (LONG)(*puiStack)); - } #else #ifdef HAVE_DLADDR @@ -4604,6 +4590,7 @@ void F_Object::operator delete( /**************************************************************************** Desc: ****************************************************************************/ +#if !defined( FLM_WATCOM_NLM) void F_Object::operator delete( void * ptr, const char *, // file @@ -4616,10 +4603,12 @@ void F_Object::operator delete( f_freeImp( &ptr, TRUE); } +#endif /**************************************************************************** Desc: ****************************************************************************/ +#if !defined( FLM_WATCOM_NLM) void F_Object::operator delete[]( void * ptr, const char *, // file @@ -4632,6 +4621,7 @@ void F_Object::operator delete[]( f_freeImp( &ptr, TRUE); } +#endif /**************************************************************************** Desc: @@ -4656,6 +4646,7 @@ void F_OSBase::operator delete( /**************************************************************************** Desc: ****************************************************************************/ +#if !defined( FLM_WATCOM_NLM) void F_OSBase::operator delete( void * ptr, const char *, // file @@ -4663,10 +4654,12 @@ void F_OSBase::operator delete( { free( &ptr); } +#endif /**************************************************************************** Desc: ****************************************************************************/ +#if !defined( FLM_WATCOM_NLM) void F_OSBase::operator delete[]( void * ptr, const char *, // file @@ -4674,3 +4667,4 @@ void F_OSBase::operator delete[]( { free( &ptr); } +#endif diff --git a/ftk/src/ftkmisc.cpp b/ftk/src/ftkmisc.cpp index bba1cf0..75b7a4d 100644 --- a/ftk/src/ftkmisc.cpp +++ b/ftk/src/ftkmisc.cpp @@ -265,11 +265,11 @@ void FLMAPI f_sleep( { if( !uiMilliseconds ) { - kYieldThread(); + pthread_yield(); } else { - kDelayThread( uiMilliseconds); + delay( uiMilliseconds); } } #endif @@ -297,7 +297,7 @@ FSTATIC RCODE f_initSerialNumberGenerator( void) f_timeGetSeconds( &uiTime ); -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) if( RC_BAD( rc = FlmAllocRandomGenerator( &gv_pSerialRandom))) { @@ -361,23 +361,7 @@ RCODE FLMAPI f_createSerialNumber( goto Exit; } -#elif defined( FLM_NLM) - - NWGUID guidVal; - int err = SGUIDCreate( &guidVal); - - if( !err || err == 1) // NOTE: 1 == SGUID_WARN_RANDOM_NODE - { - UD2FBA( guidVal.time_low, &pszSerialNum[ 0]); - UW2FBA( guidVal.time_mid, &pszSerialNum[ 4]); - UW2FBA( guidVal.time_hi_and_version, &pszSerialNum[ 6]); - pszSerialNum[ 8] = guidVal.clk_seq_hi_res; - pszSerialNum[ 9] = guidVal.clk_seq_low; - f_memcpy( &pszSerialNum[ 10], (FLMBYTE *)guidVal.node, 6); - goto Exit; - } - -#elif defined( FLM_UNIX) +#elif defined( FLM_UNIX) || defined( FLM_NLM) // Generate a pseudo GUID value @@ -394,7 +378,7 @@ RCODE FLMAPI f_createSerialNumber( #endif -#if defined( FLM_WIN) || defined( FLM_NLM) +#if defined( FLM_WIN) Exit: #endif @@ -880,7 +864,7 @@ FLMINT32 FLMAPI f_atomicInc( { #if defined( FLM_NLM) { - return( (FLMINT32)nlm_AtomicIncrement( (volatile LONG *)piTarget)); + return( (FLMINT32)atomic_retadd( (unsigned long *)piTarget, 1)); } #elif defined( FLM_WIN) { @@ -925,7 +909,7 @@ FLMINT32 FLMAPI f_atomicDec( { #if defined( FLM_NLM) { - return( (FLMINT32)nlm_AtomicDecrement( (volatile LONG *)piTarget)); + return( (FLMINT32)atomic_retadd( (unsigned long *)piTarget, -1)); } #elif defined( FLM_WIN) { @@ -971,8 +955,7 @@ FLMINT32 FLMAPI f_atomicExchange( { #if defined( FLM_NLM) { - return( (FLMINT32)nlm_AtomicExchange( - (volatile LONG *)piTarget, i32NewVal)); + return( (FLMINT32)atomic_xchg( (unsigned long *)piTarget, i32NewVal)); } #elif defined( FLM_WIN) { diff --git a/ftk/src/ftkntab.cpp b/ftk/src/ftkntab.cpp index a609b85..e217cac 100644 --- a/ftk/src/ftkntab.cpp +++ b/ftk/src/ftkntab.cpp @@ -1918,3 +1918,9 @@ FLMINT FLMAPI F_NameTable::Release( void) return( iRefCnt); } #endif + +#if defined( FLM_WATCOM_NLM) +void gv_ftkntab( void) +{ +} +#endif diff --git a/ftk/src/ftkpath.cpp b/ftk/src/ftkpath.cpp deleted file mode 100644 index 148f8cd..0000000 --- a/ftk/src/ftkpath.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------------------------ -// Desc: Contains functions for file name/path manipulation -// -// Tabs: 3 -// -// Copyright (c) 1998-2006 Novell, Inc. All Rights Reserved. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the GNU General Public -// License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, contact Novell, Inc. -// -// To contact Novell about this file by physical or electronic mail, -// you may find current contact information at www.novell.com -// -// $Id: ftkpath.cpp 3115 2006-01-19 13:24:39 -0700 (Thu, 19 Jan 2006) dsanders $ -//------------------------------------------------------------------------------ - -#include "ftksys.h" - diff --git a/ftk/src/ftksem.cpp b/ftk/src/ftksem.cpp index 43a845a..8c851fc 100644 --- a/ftk/src/ftksem.cpp +++ b/ftk/src/ftksem.cpp @@ -28,7 +28,7 @@ /**************************************************************************** Desc: ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) typedef struct { pthread_mutex_t lock; @@ -82,7 +82,7 @@ void FLMAPI f_mutexDestroy( /**************************************************************************** Desc: ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) RCODE FLMAPI f_mutexCreate( F_MUTEX * phMutex) { @@ -139,7 +139,7 @@ Exit: /**************************************************************************** Desc: ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) void FLMAPI f_mutexDestroy( F_MUTEX * phMutex) { @@ -162,7 +162,7 @@ void FLMAPI f_mutexDestroy( /**************************************************************************** Desc: ****************************************************************************/ -#ifdef FLM_UNIX +#if defined( FLM_UNIX) || defined( FLM_NLM) void FLMAPI f_mutexLock( F_MUTEX hMutex) { @@ -173,7 +173,7 @@ void FLMAPI f_mutexLock( /**************************************************************************** Desc: ****************************************************************************/ -#ifdef FLM_UNIX +#if defined( FLM_UNIX) || defined( FLM_NLM) void FLMAPI f_mutexUnlock( F_MUTEX hMutex) { @@ -184,7 +184,7 @@ void FLMAPI f_mutexUnlock( /**************************************************************************** Desc: ****************************************************************************/ -#ifdef FLM_UNIX +#if defined( FLM_UNIX) || defined( FLM_NLM) void FLMAPI f_assertMutexLocked( F_MUTEX) { @@ -194,7 +194,7 @@ void FLMAPI f_assertMutexLocked( /**************************************************************************** Desc: Initializes a semaphore handle on UNIX ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) FINLINE int sema_init( sema_t * pSem) { @@ -222,7 +222,7 @@ Exit: /**************************************************************************** Desc: Frees a semaphore handle on UNIX ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) FINLINE void sema_destroy( sema_t * pSem) { @@ -234,7 +234,7 @@ FINLINE void sema_destroy( /**************************************************************************** Desc: Waits for a semaphore to be signaled on UNIX ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) FINLINE int sema_wait( sema_t * pSem) { @@ -243,7 +243,7 @@ FINLINE int sema_wait( pthread_mutex_lock( &pSem->lock); while( !pSem->count) { - if( (iErr = pthread_cond_wait( &pSem->cond, &pSem->lock))) + if( (iErr = pthread_cond_wait( &pSem->cond, &pSem->lock)) != 0) { if( iErr == EINTR) { @@ -270,7 +270,7 @@ Exit: Desc: Waits a specified number of milliseconds for a semaphore to be signaled on UNIX ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) FINLINE int sema_timedwait( sema_t * pSem, unsigned int msecs) @@ -298,7 +298,7 @@ Restart: while( !pSem->count) { if( (iErr = pthread_cond_timedwait( &pSem->cond, - &pSem->lock, &abstime))) + &pSem->lock, &abstime)) != 0) { if( iErr == EINTR) { @@ -322,7 +322,7 @@ Exit: /**************************************************************************** Desc: Signals a semaphore on UNIX ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) int sema_signal( sema_t * pSem) { @@ -339,7 +339,7 @@ int sema_signal( /**************************************************************************** Desc: ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) RCODE f_semCreate( F_SEM * phSem) { @@ -369,7 +369,7 @@ Exit: /**************************************************************************** Desc: ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) void f_semDestroy( F_SEM * phSem) { @@ -387,7 +387,7 @@ void f_semDestroy( /**************************************************************************** Desc: Get the lock on a semaphore - p operation ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) RCODE f_semWait( F_SEM hSem, FLMUINT uiTimeout) @@ -424,7 +424,7 @@ RCODE f_semWait( /**************************************************************************** Desc: Get the lock on a semaphore - p operation ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) void FLMAPI f_semSignal( F_SEM hSem) { @@ -432,144 +432,6 @@ void FLMAPI f_semSignal( } #endif -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -RCODE FLMAPI f_mutexCreate( - F_MUTEX * phMutex) -{ - if( (*phMutex = (F_MUTEX)kMutexAlloc( (BYTE *)"NOVDB")) == F_MUTEX_NULL) - { - return RC_SET( NE_FLM_MEM); - } - - return NE_FLM_OK; -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_mutexDestroy( - F_MUTEX * phMutex) -{ - if (*phMutex != F_MUTEX_NULL) - { - if( kMutexFree( (MUTEX)(*phMutex))) - { - f_assert( 0); - } - - *phMutex = F_MUTEX_NULL; - } -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_mutexLock( - F_MUTEX hMutex) -{ - (void)kMutexLock( (MUTEX)hMutex); -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_mutexUnlock( - F_MUTEX hMutex) -{ - (void)kMutexUnlock( (MUTEX)hMutex); -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_assertMutexLocked( - F_MUTEX) -{ -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -RCODE FLMAPI f_semCreate( - F_SEM * phSem) -{ - if( (*phSem = (F_SEM)kSemaphoreAlloc( (BYTE *)"NOVDB", 0)) == F_SEM_NULL) - { - return RC_SET( NE_FLM_MEM); - } - - return NE_FLM_OK; -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_semDestroy( - F_SEM * phSem) -{ - if (*phSem != F_SEM_NULL) - { - (void)kSemaphoreFree( (SEMAPHORE)(*phSem)); - *phSem = F_SEM_NULL; - } -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -RCODE FLMAPI f_semWait( - F_SEM hSem, - FLMUINT uiTimeout) -{ - RCODE rc = NE_FLM_OK; - - if( uiTimeout == F_SEM_WAITFOREVER) - { - if( kSemaphoreWait( (SEMAPHORE)hSem) != 0) - { - rc = RC_SET( NE_FLM_ERROR_WAITING_ON_SEMPAHORE); - } - } - else - { - if( kSemaphoreTimedWait( (SEMAPHORE)hSem, (UINT)uiTimeout) != 0) - { - rc = RC_SET( NE_FLM_ERROR_WAITING_ON_SEMPAHORE); - } - } - - return( rc); -} -#endif - -/**************************************************************************** -Desc: -****************************************************************************/ -#ifdef FLM_NLM -void FLMAPI f_semSignal( - F_SEM hSem) -{ - (void)kSemaphoreSignal( (SEMAPHORE)hSem); -} -#endif - /**************************************************************************** Desc: ****************************************************************************/ diff --git a/ftk/src/ftkstrm.cpp b/ftk/src/ftkstrm.cpp index f126037..28c4fec 100644 --- a/ftk/src/ftkstrm.cpp +++ b/ftk/src/ftkstrm.cpp @@ -3285,11 +3285,14 @@ RCODE F_TCPStream::socketPeek( #pragma warning( push) #pragma warning( disable : 4127) #endif + FD_SET( m_iSocket, &GenDescriptors); + #ifdef FLM_WIN #pragma warning( pop) #endif + FD_SET( m_iSocket, &GenDescriptors); iMaxDescs = (int)(m_iSocket + 1); DescrRead = bPeekRead ? &GenDescriptors : NULL; DescrWrt = bPeekRead ? NULL : &GenDescriptors; diff --git a/ftk/src/ftksys.h b/ftk/src/ftksys.h index c4ac092..a15c17d 100644 --- a/ftk/src/ftksys.h +++ b/ftk/src/ftksys.h @@ -59,14 +59,20 @@ #pragma warning 549 9 - // Disable "Warning! W656: col(1) define this function inside its class + // Disable "Warning! W656: col(XX) define this function inside its class // definition (may improve code quality)" #pragma warning 656 9 + + // Disable Warning! W555: col(XX) expression for 'while' is always + // "false" + + #pragma warning 555 9 #endif + + #define _POSIX_SOURCE #include - #include #include #include #include @@ -76,6 +82,10 @@ #include #include #include + #include + #include + #include + #include // The typedef for va_list in stdarg.h do not function properly when // a va_list is passed down multiple layers as a pointer (va_list *). @@ -120,48 +130,14 @@ #ifndef UINT #define UINT unsigned int #endif - - typedef void * SEMAPHORE; - typedef unsigned long ERROR; - - extern "C" SEMAPHORE kSemaphoreAlloc( - BYTE * pSemaName, - UINT SemaCount); - - extern "C" ERROR kSemaphoreFree( - SEMAPHORE SemaHandle); - - extern "C" ERROR kSemaphoreWait( - SEMAPHORE SemaHandle); - - extern "C" ERROR kSemaphoreTimedWait( - SEMAPHORE SemaHandle, - UINT MilliSecondTimeOut); - - extern "C" ERROR kSemaphoreSignal( - SEMAPHORE SemaHandle); - - extern "C" UINT kSemaphoreExamineCount( - SEMAPHORE SemaHandle); - - extern "C" MUTEX kMutexAlloc( - BYTE * MutexName); - - extern "C" ERROR kMutexFree( - MUTEX MutexHandle); - - extern "C" ERROR kMutexLock( - MUTEX MutexHandle); - - extern "C" ERROR kMutexUnlock( - MUTEX MutexHandle); - - extern "C" FLMUINT f_getNLMHandle( void); - extern "C" RCODE f_netwareStartup( void); - - extern "C" void f_netwareShutdown( void); - + #define F_NETWARE_SECTOR_SIZE 512 + + FINLINE void * f_getNLMHandle( void) + { + return( getnlmhandle()); + } + #endif /**************************************************************************** @@ -329,9 +305,7 @@ /**************************************************************************** Desc: Mutex and semaphore routines ****************************************************************************/ - #ifdef FLM_NLM - typedef SEMAPHORE F_SEM; - #elif defined( FLM_WIN) + #if defined( FLM_WIN) typedef struct { FLMATOMIC locked; @@ -364,10 +338,10 @@ } #elif defined( FLM_NLM) - + FINLINE FLMUINT f_getpid() { - return( f_getNLMHandle()); + return( (FLMUINT)f_getNLMHandle()); } #else @@ -543,11 +517,6 @@ } #endif - #ifdef FLM_NLM - void signalComplete( - RCODE rc); - #endif - private: // Only called by the buffer manager @@ -574,9 +543,6 @@ #endif #if defined( FLM_LINUX) || defined( FLM_SOLARIS) || defined( FLM_OSX) struct aiocb m_aio; - #endif - #ifdef FLM_NLM - F_SEM m_hSem; #endif F_IOBuffer * m_pNext; F_IOBuffer * m_pPrev; @@ -1029,7 +995,7 @@ /*************************************************************************** Desc: ***************************************************************************/ - #ifdef FLM_UNIX + #if defined( FLM_UNIX) || defined( FLM_NLM) class F_FileHdl : public IF_FileHdl { public: @@ -1110,9 +1076,8 @@ } FINLINE void FLMAPI setMaxAutoExtendSize( - FLMUINT uiMaxAutoExtendSize) + FLMUINT) { - m_uiMaxAutoExtendSize = uiMaxAutoExtendSize; } RCODE FLMAPI lock( void); @@ -1204,7 +1169,6 @@ FLMUINT64 m_ui64GetSectorBoundMask; FLMUINT64 m_ui64CurrentPos; FLMUINT m_uiExtendSize; - FLMUINT m_uiMaxAutoExtendSize; FLMBOOL m_bCanDoAsync; FLMBOOL m_bDoDirectIO; FLMBYTE * m_pucAlignedBuff; diff --git a/ftk/src/ftktime.cpp b/ftk/src/ftktime.cpp index f61d68d..60e8126 100644 --- a/ftk/src/ftktime.cpp +++ b/ftk/src/ftktime.cpp @@ -333,7 +333,7 @@ FLMINT f_timeCompareTimeStamps( /**************************************************************************** Desc: Get the current time in milliseconds. ****************************************************************************/ -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) unsigned f_timeGetMilliTime() { #if defined( FLM_SOLARIS) @@ -343,8 +343,8 @@ unsigned f_timeGetMilliTime() gettimeofday(&tv, 0); - return( (((FLMUINT64)tv.tv_sec * (FLMUINT64)1000000) + - (FLMUINT64)tv.tv_usec) / 1000); + return( (unsigned)((((FLMUINT64)tv.tv_sec * (FLMUINT64)1000000) + + (FLMUINT64)tv.tv_usec) / 1000)); #endif } #endif @@ -356,8 +356,6 @@ FLMUINT FLMAPI FLM_GET_TIMER( void) { #if defined( FLM_WIN) return( (FLMUINT)GetTickCount()); -#elif defined( FLM_NLM) - return( (FLMUINT)GetCurrentTime()); #else return( f_timeGetMilliTime()); #endif @@ -385,14 +383,7 @@ Desc: FLMUINT FLMAPI FLM_SECS_TO_TIMER_UNITS( FLMUINT uiSeconds) { -#if defined( FLM_NLM) - LONG uiTu; - - ConvertSecondsToTicks( (LONG)(uiSeconds), 0, &uiTU); - return( (FLMUINT)uiTU); -#else return( uiSeconds * 1000); -#endif } /**************************************************************************** @@ -401,15 +392,7 @@ Desc: FLMUINT FLMAPI FLM_TIMER_UNITS_TO_SECS( FLMUINT uiTU) { -#if defined( FLM_NLM) - LONG udDummy; - LONG uiSeconds; - - ConvertTicksToSeconds( (LONG)(uiTU), &uiSeconds, &udDummy); - return( (FLMUINT)uiSeconds); -#else return( uiTU / 1000); -#endif } /**************************************************************************** @@ -418,15 +401,7 @@ Desc: FLMUINT FLM_TIMER_UNITS_TO_MILLI( FLMUINT uiTU) { -#if defined( FLM_NLM) - LONG udTenths; - LONG udSeconds; - - ConvertTicksToSeconds( (LONG)(uiTU), &udSeconds, &udTenths); - return( (FLMUINT)(udSeconds) * 1000 + (FLMUINT)udTenths * 100); -#else return( uiTU); -#endif } /**************************************************************************** @@ -435,17 +410,5 @@ Desc: FLMUINT FLM_MILLI_TO_TIMER_UNITS( FLMUINT uiMilliSeconds) { -#if defined( FLM_NLM) - LONG udTenths; - LONG udSeconds; - LONG uiTU; - - udSeconds = ((LONG) uiMilliSeconds) / 1000; - udTenths = (((LONG) uiMilliSeconds) % 1000) / 100; - - ConvertSecondsToTicks( udSeconds, udTenths, &uiTU); - return( (FLMUINT)uiTU); -#else return( uiMilliSeconds); -#endif } diff --git a/ftk/src/ftkunix.cpp b/ftk/src/ftkunix.cpp index dd6f199..bffd4d2 100644 --- a/ftk/src/ftkunix.cpp +++ b/ftk/src/ftkunix.cpp @@ -25,7 +25,7 @@ #include "ftksys.h" -#if defined( FLM_UNIX) +#if defined( FLM_UNIX) || defined( FLM_NLM) #ifdef FLM_AIX #ifndef _LARGE_FILES @@ -35,7 +35,7 @@ #endif #include -#ifndef FLM_OSX +#if !defined( FLM_OSX) && !defined( FLM_NLM) #include #endif @@ -57,6 +57,10 @@ struct statfs; #include +#elif defined( FLM_NLM) + #define pread pread64 + #define pwrite pwrite64 + #define ftruncate ftruncate64 #endif #ifdef FLM_LINUX @@ -78,7 +82,6 @@ F_FileHdl::F_FileHdl() m_fd = -1; m_bDoDirectIO = FALSE; m_uiExtendSize = 0; - m_uiMaxAutoExtendSize = f_getMaxFileSize(); m_uiBytesPerSector = 0; m_ui64NotOnSectorBoundMask = 0; m_ui64GetSectorBoundMask = 0; @@ -292,7 +295,7 @@ Exit: /****************************************************************************** Desc: Create a file ******************************************************************************/ -RCODE FLMAPI F_FileHdl::create( +RCODE F_FileHdl::create( const char * pszFileName, FLMUINT uiIoFlags) { @@ -339,7 +342,7 @@ Exit: /****************************************************************************** Desc: ******************************************************************************/ -RCODE FLMAPI F_FileHdl::createUnique( +RCODE F_FileHdl::createUnique( char * pszDirName, const char * pszFileExtension, FLMUINT uiIoFlags) @@ -462,7 +465,7 @@ Exit: /****************************************************************************** Desc: Open a file ******************************************************************************/ -RCODE FLMAPI F_FileHdl::open( +RCODE F_FileHdl::open( const char * pszFileName, FLMUINT uiIoFlags) { @@ -686,8 +689,8 @@ RCODE F_FileHdl::directRead( bHitEOF = FALSE; - if( (iTmp = pread( m_fd, pucReadBuffer, - uiMaxBytesToRead, getSectorStartOffset( ui64ReadOffset))) == -1) + if( (iTmp = pread( m_fd, pucReadBuffer, uiMaxBytesToRead, + getSectorStartOffset( ui64ReadOffset))) == -1) { rc = f_mapPlatformError( errno, NE_FLM_READING_FILE); goto Exit; @@ -1008,7 +1011,7 @@ RCODE F_FileHdl::allocAlignedBuffer( void) #if defined( FLM_SOLARIS) if( (m_pucAlignedBuff = (FLMBYTE *)memalign( sysconf( _SC_PAGESIZE), m_uiAlignedBuffSize)) == NULL) -#elif defined( FLM_OSX) +#elif defined( FLM_OSX) || defined( FLM_NLM) if( (m_pucAlignedBuff = (FLMBYTE *)malloc( m_uiAlignedBuffSize)) == NULL) #else if( posix_memalign( (void **)&m_pucAlignedBuff, @@ -1193,6 +1196,7 @@ RCODE F_FileHdl::directWrite( goto Exit; } } +#ifndef FLM_NLM else { struct aiocb * pAio = pBufferObj->getAIOStruct(); @@ -1214,6 +1218,7 @@ RCODE F_FileHdl::directWrite( pBufferObj->makePending(); bDidAsync = TRUE; } +#endif uiBytesToWrite -= uiBytesBeingOutput; if( puiBytesWrittenRV) diff --git a/ftk/src/ftkxml.cpp b/ftk/src/ftkxml.cpp index fa5e43a..92eb617 100644 --- a/ftk/src/ftkxml.cpp +++ b/ftk/src/ftkxml.cpp @@ -428,6 +428,7 @@ Desc: Builds a character lookup table RCODE FLMAPI F_XML::setup( void) { RCODE rc = NE_FLM_OK; + FLMUINT uiLoop; if( m_pCharTable) { @@ -439,7 +440,7 @@ RCODE FLMAPI F_XML::setup( void) goto Exit; } - for (FLMUINT uiLoop = 0; charTbl[uiLoop].ui16Flag; uiLoop++) + for( uiLoop = 0; charTbl[uiLoop].ui16Flag; uiLoop++) { setCharFlag( charTbl[uiLoop].uLowChar, charTbl[uiLoop].uHighChar,