You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/06/04 16:46:53 UTC
svn commit: r179994 - in
/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util:
AtomicOpManagers/WindowsAtomicOpMgr.cpp
AtomicOpManagers/WindowsAtomicOpMgr.hpp FileManagers/WindowsFileMgr.cpp
FileManagers/WindowsFileMgr.hpp MutexManagers/WindowsMutexMgr.cpp
MutexManagers/WindowsMutexMgr.hpp
Author: jberry
Date: Sat Jun 4 07:46:52 2005
New Revision: 179994
URL: http://svn.apache.org/viewcvs?rev=179994&view=rev
Log:
Add svn keywords and eol-style properties to new Windows Managers, and fix line endings to native
Modified:
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp (contents, props changed)
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp (contents, props changed)
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp (contents, props changed)
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp (contents, props changed)
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp (contents, props changed)
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp (contents, props changed)
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp Sat Jun 4 07:46:52 2005
@@ -1,100 +1,100 @@
-
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: $
- */
-
-#include <windows.h>
-
-#include <xercesc/util/XercesDefs.hpp>
-#include <xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp>
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-
-WindowsAtomicOpMgr::WindowsAtomicOpMgr()
-{
-}
-
-
-WindowsAtomicOpMgr::~WindowsAtomicOpMgr()
-{
-}
-
-
-// Atomic operations
-void*
-WindowsAtomicOpMgr::compareAndSwap(void** toFill
- , const void* const newValue
- , const void* const toCompare)
-{
-#if defined WIN64
- return ::InterlockedCompareExchangePointer(toFill, (void*)newValue, (void*)toCompare);
-#else
-
- //
- // InterlockedCompareExchange is only supported on Windows 98,
- // Windows NT 4.0, and newer -- not on Windows 95...
- // If you are willing to give up Win95 support change this to #if 0
- // otherwise we are back to using assembler.
- // (But only if building with compilers that support inline assembler.)
- //
- #if (defined(_MSC_VER) || defined(__BCPLUSPLUS__)) && !defined(XERCES_NO_ASM)
-
- void* result;
- __asm
- {
- mov eax, toCompare;
- mov ebx, newValue;
- mov ecx, toFill
- lock cmpxchg [ecx], ebx;
- mov result, eax;
- }
- return result;
-
- #else
-
- //
- // Note we have to cast off the constness of some of these because
- // the system APIs are not C++ aware in all cases.
- //
-
- return (void*) ::InterlockedCompareExchange((LPLONG)toFill, (LONG)newValue, (LONG)toCompare);
-
- #endif
-
-#endif
-
-}
-
-
-int
-WindowsAtomicOpMgr::increment(int &location)
-{
- return ::InterlockedIncrement(&(long &)location);
-}
-
-
-int
-WindowsAtomicOpMgr::decrement(int &location)
-{
- return ::InterlockedDecrement(&(long &)location);
-}
-
-
-XERCES_CPP_NAMESPACE_END
+
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#include <windows.h>
+
+#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+WindowsAtomicOpMgr::WindowsAtomicOpMgr()
+{
+}
+
+
+WindowsAtomicOpMgr::~WindowsAtomicOpMgr()
+{
+}
+
+
+// Atomic operations
+void*
+WindowsAtomicOpMgr::compareAndSwap(void** toFill
+ , const void* const newValue
+ , const void* const toCompare)
+{
+#if defined WIN64
+ return ::InterlockedCompareExchangePointer(toFill, (void*)newValue, (void*)toCompare);
+#else
+
+ //
+ // InterlockedCompareExchange is only supported on Windows 98,
+ // Windows NT 4.0, and newer -- not on Windows 95...
+ // If you are willing to give up Win95 support change this to #if 0
+ // otherwise we are back to using assembler.
+ // (But only if building with compilers that support inline assembler.)
+ //
+ #if (defined(_MSC_VER) || defined(__BCPLUSPLUS__)) && !defined(XERCES_NO_ASM)
+
+ void* result;
+ __asm
+ {
+ mov eax, toCompare;
+ mov ebx, newValue;
+ mov ecx, toFill
+ lock cmpxchg [ecx], ebx;
+ mov result, eax;
+ }
+ return result;
+
+ #else
+
+ //
+ // Note we have to cast off the constness of some of these because
+ // the system APIs are not C++ aware in all cases.
+ //
+
+ return (void*) ::InterlockedCompareExchange((LPLONG)toFill, (LONG)newValue, (LONG)toCompare);
+
+ #endif
+
+#endif
+
+}
+
+
+int
+WindowsAtomicOpMgr::increment(int &location)
+{
+ return ::InterlockedIncrement(&(long &)location);
+}
+
+
+int
+WindowsAtomicOpMgr::decrement(int &location)
+{
+ return ::InterlockedDecrement(&(long &)location);
+}
+
+
+XERCES_CPP_NAMESPACE_END
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp Sat Jun 4 07:46:52 2005
@@ -1,50 +1,50 @@
-
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: $
- */
-
-#ifndef WINDOWSATOMICOPMGR_HPP
-#define WINDOWSATOMICOPMGR_HPP
-
-#include <xercesc/util/XMLAtomicOpMgr.hpp>
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-/*
- The atomic op manager to use on MS Windows platforms
-*/
-class WindowsAtomicOpMgr : public XMLAtomicOpMgr
-{
- public:
- WindowsAtomicOpMgr();
- virtual ~WindowsAtomicOpMgr();
-
- // Atomic operations
- virtual void* compareAndSwap(void** toFill
- , const void* const newValue
- , const void* const toCompare);
- virtual int increment(int &location);
- virtual int decrement(int &location);
-};
-
-XERCES_CPP_NAMESPACE_END
-
-
-#endif
-
+
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#ifndef WINDOWSATOMICOPMGR_HPP
+#define WINDOWSATOMICOPMGR_HPP
+
+#include <xercesc/util/XMLAtomicOpMgr.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/*
+ The atomic op manager to use on MS Windows platforms
+*/
+class WindowsAtomicOpMgr : public XMLAtomicOpMgr
+{
+ public:
+ WindowsAtomicOpMgr();
+ virtual ~WindowsAtomicOpMgr();
+
+ // Atomic operations
+ virtual void* compareAndSwap(void** toFill
+ , const void* const newValue
+ , const void* const toCompare);
+ virtual int increment(int &location);
+ virtual int decrement(int &location);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+
+#endif
+
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/AtomicOpManagers/WindowsAtomicOpMgr.hpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp Sat Jun 4 07:46:52 2005
@@ -1,443 +1,443 @@
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: $
- */
-
-#include <windows.h>
-
-#include <xercesc/util/FileManagers/WindowsFileMgr.hpp>
-#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-static bool isBackSlash(XMLCh c) {
- return c == chBackSlash ||
- c == chYenSign ||
- c == chWonSign;
-}
-
-WindowsFileMgr::WindowsFileMgr()
-{
- // Figure out if we are on NT and save that flag for later use
- OSVERSIONINFO OSVer;
- OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- ::GetVersionEx(&OSVer);
- _onNT = (OSVer.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-
-
-WindowsFileMgr::~WindowsFileMgr()
-{
-}
-
-
-FileHandle
-WindowsFileMgr::open(const XMLCh* fileName, bool toWrite, MemoryManager* const manager)
-{
- // Watch for obvious wierdness
- if (!fileName)
- return 0;
-
- //
- // We have to play a little trick here. If its /x:.....
- // style fully qualified path, we have to toss the leading /
- // character.
- //
- const XMLCh* nameToOpen = fileName;
- if (*fileName == chForwardSlash)
- {
- if (XMLString::stringLen(fileName) > 3)
- {
- if (*(fileName + 2) == chColon)
- {
- const XMLCh chDrive = *(fileName + 1);
- if (((chDrive >= chLatin_A) && (chDrive <= chLatin_Z))
- || ((chDrive >= chLatin_a) && (chDrive <= chLatin_z)))
- {
- nameToOpen = fileName + 1;
- }
- }
-
- // Similarly for UNC paths
- if ( *(fileName + 1) == *(fileName + 2) &&
- (*(fileName + 1) == chForwardSlash ||
- *(fileName + 1) == chBackSlash) )
- {
- nameToOpen = fileName + 1;
- }
- }
- }
-
- // Ok, this might look stupid but its a semi-expedient way to deal
- // with a thorny problem. Shift-JIS and some other Asian encodings
- // are fundamentally broken and map both the backslash and the Yen
- // sign to the same code point. Transcoders have to pick one or the
- // other to map '\' to Unicode and tend to choose the Yen sign.
- //
- // Unicode Yen or Won signs as directory separators will fail.
- //
- // So, we will check this path name for Yen or won signs and, if they are
- // there, we'll replace them with slashes.
- //
- // A further twist: we replace Yen and Won with forward slashes rather
- // than back slashes. Either form of slash will work as a directory
- // separator. On Win 95 and 98, though, Unicode back-slashes may
- // fail to transode back to 8-bit 0x5C with some Unicode converters
- // to some of the problematic code pages. Forward slashes always
- // transcode correctly back to 8 bit char * form.
- //
- XMLCh *tmpUName = 0;
-
- const XMLCh* srcPtr = nameToOpen;
- while (*srcPtr)
- {
- if (*srcPtr == chYenSign ||
- *srcPtr == chWonSign)
- break;
- srcPtr++;
- }
-
- //
- // If we found a yen, then we have to create a temp file name. Else
- // go with the file name as is and save the overhead.
- //
- if (*srcPtr)
- {
- tmpUName = XMLString::replicate(nameToOpen, manager);
-
- XMLCh* tmpPtr = tmpUName;
- while (*tmpPtr)
- {
- if (*tmpPtr == chYenSign ||
- *tmpPtr == chWonSign)
- *tmpPtr = chForwardSlash;
- tmpPtr++;
- }
- nameToOpen = tmpUName;
- }
- FileHandle retVal = 0;
- if (_onNT)
- {
- retVal = ::CreateFileW
- (
- (LPCWSTR) nameToOpen
- , toWrite?GENERIC_WRITE:GENERIC_READ
- , FILE_SHARE_READ
- , 0
- , toWrite?CREATE_ALWAYS:OPEN_EXISTING
- , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
- , 0
- );
- }
- else
- {
- //
- // We are Win 95 / 98. Take the Unicode file name back to (char *)
- // so that we can open it.
- //
- char* tmpName = XMLString::transcode(nameToOpen, manager);
- retVal = ::CreateFileA
- (
- tmpName
- , toWrite?GENERIC_WRITE:GENERIC_READ
- , FILE_SHARE_READ
- , 0
- , toWrite?CREATE_ALWAYS:OPEN_EXISTING
- , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
- , 0
- );
- manager->deallocate(tmpName);//delete [] tmpName;
- }
-
- if (tmpUName)
- manager->deallocate(tmpUName);//delete [] tmpUName;
-
- if (retVal == INVALID_HANDLE_VALUE)
- return 0;
-
- return retVal;
-}
-
-
-FileHandle
-WindowsFileMgr::open(const char* path, bool toWrite, MemoryManager* const manager)
-{
- FileHandle retVal = ::CreateFileA
- (
- path
- , toWrite?GENERIC_WRITE:GENERIC_READ
- , FILE_SHARE_READ
- , 0
- , toWrite?OPEN_ALWAYS:OPEN_EXISTING
- , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
- , 0
- );
-
- if (retVal == INVALID_HANDLE_VALUE)
- return 0;
-
- return retVal;
-}
-
-
-FileHandle
-WindowsFileMgr::openStdIn(MemoryManager* const manager)
-{
- //
- // Get the standard input handle. Duplicate it and return that copy
- // since the outside world cannot tell the difference and will shut
- // down this handle when its done with it. If we gave out the orignal,
- // shutting it would prevent any further output.
- //
- HANDLE stdInOrg = ::GetStdHandle(STD_INPUT_HANDLE);
- if (stdInOrg == INVALID_HANDLE_VALUE) {
- XMLCh stdinStr[] = {chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull};
- ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
- }
-
- HANDLE retHandle;
- if (!::DuplicateHandle
- (
- ::GetCurrentProcess()
- , stdInOrg
- , ::GetCurrentProcess()
- , &retHandle
- , 0
- , FALSE
- , DUPLICATE_SAME_ACCESS))
- {
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotDupHandle, manager);
- }
- return retHandle;
-}
-
-
-void
-WindowsFileMgr::close(FileHandle f, MemoryManager* const manager)
-{
- if (!f)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- if (!::CloseHandle(f))
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile, manager);
-}
-
-
-void
-WindowsFileMgr::reset(FileHandle f, MemoryManager* const manager)
-{
- if (!f)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- // Seek to the start of the file
- if (::SetFilePointer(f, 0, 0, FILE_BEGIN) == 0xFFFFFFFF)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotResetFile, manager);
-}
-
-
-XMLFilePos
-WindowsFileMgr::curPos(FileHandle f, MemoryManager* const manager)
-{
- if (!f)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- // Get the current position
- const unsigned int curPos = ::SetFilePointer(f, 0, 0, FILE_CURRENT);
- if (curPos == 0xFFFFFFFF)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
-
- return curPos;
-}
-
-
-XMLFilePos
-WindowsFileMgr::size(FileHandle f, MemoryManager* const manager)
-{
- if (!f)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- DWORD high;
- DWORD low=GetFileSize(f, &high);
- if(low==INVALID_FILE_SIZE)
- // TODO: find a better exception
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
-
- return low;
-}
-
-
-XMLSize_t
-WindowsFileMgr::read(FileHandle f, XMLSize_t byteCount, XMLByte* buffer, MemoryManager* const manager)
-{
- if (!f || !buffer)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- unsigned long bytesRead = 0;
- if (!::ReadFile(f, buffer, byteCount, &bytesRead, 0))
- {
- //
- // Check specially for a broken pipe error. If we get this, it just
- // means no more data from the pipe, so return zero.
- //
- if (::GetLastError() != ERROR_BROKEN_PIPE)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile, manager);
- }
- return (unsigned int)bytesRead;
-}
-
-
-void
-WindowsFileMgr::write(FileHandle f, XMLSize_t byteCount, const XMLByte* buffer, MemoryManager* const manager)
-{
- if (!f || !buffer)
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
-
- const XMLByte* tmpFlush = buffer;
-
- while (true)
- {
- unsigned long bytesWritten = 0;
- if (!::WriteFile(f, tmpFlush, byteCount, &bytesWritten, 0))
- ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile, manager);
-
- if (bytesWritten < byteCount) //incomplete write
- {
- tmpFlush+=bytesWritten;
- byteCount-=bytesWritten;
- }
- else
- return;
- }
-}
-
-
-XMLCh*
-WindowsFileMgr::getFullPath(const XMLCh* const srcPath, MemoryManager* const manager)
-{
- //
- // If we are on NT, then use wide character APIs, else use ASCII APIs.
- // We have to do it manually since we are only built in ASCII mode from
- // the standpoint of the APIs.
- //
- if (_onNT)
- {
- // Use a local buffer that is big enough for the largest legal path
- const unsigned int bufSize = 1024;
- XMLCh tmpPath[bufSize + 1];
-
- XMLCh* namePart = 0;
- if (!::GetFullPathNameW((LPCWSTR)srcPath, bufSize, (LPWSTR)tmpPath, (LPWSTR*)&namePart))
- return 0;
-
- // Return a copy of the path
- return XMLString::replicate(tmpPath, manager);
- }
- else
- {
- // Transcode the incoming string
- char* tmpSrcPath = XMLString::transcode(srcPath, manager);
- ArrayJanitor<char> janSrcPath(tmpSrcPath, manager);
-
- // Use a local buffer that is big enough for the largest legal path
- const unsigned int bufSize = 511;
- char tmpPath[511 + 1];
-
- char* namePart = 0;
- if (!::GetFullPathNameA(tmpSrcPath, bufSize, tmpPath, &namePart))
- return 0;
-
- // Return a transcoded copy of the path
- return XMLString::transcode(tmpPath, manager);
- }
-}
-
-
-XMLCh*
-WindowsFileMgr::getCurrentDirectory(MemoryManager* const manager)
-{
- //
- // If we are on NT, then use wide character APIs, else use ASCII APIs.
- // We have to do it manually since we are only built in ASCII mode from
- // the standpoint of the APIs.
- //
- if (_onNT)
- {
- // Use a local buffer that is big enough for the largest legal path
- const unsigned int bufSize = 1024;
- XMLCh tmpPath[bufSize + 1];
-
- if (!::GetCurrentDirectoryW(bufSize, (LPWSTR)tmpPath))
- return 0;
-
- // Return a copy of the path
- return XMLString::replicate(tmpPath, manager);
- }
- else
- {
- // Use a local buffer that is big enough for the largest legal path
- const unsigned int bufSize = 511;
- char tmpPath[511 + 1];
-
- if (!::GetCurrentDirectoryA(bufSize, tmpPath))
- return 0;
-
- // Return a transcoded copy of the path
- return XMLString::transcode(tmpPath, manager);
- }
-}
-
-
-bool
-WindowsFileMgr::isRelative(const XMLCh* const toCheck, MemoryManager* const manager)
-{
- // Check for pathological case of empty path
- if (!toCheck || !toCheck[0])
- return false;
-
- //
- // If its starts with a drive, then it cannot be relative. Note that
- // we checked the drive not being empty above, so worst case its one
- // char long and the check of the 1st char will fail because its really
- // a null character.
- //
- if (toCheck[1] == chColon)
- {
- if (((toCheck[0] >= chLatin_A) && (toCheck[0] <= chLatin_Z))
- || ((toCheck[0] >= chLatin_a) && (toCheck[0] <= chLatin_z)))
- {
- return false;
- }
- }
-
- //
- // If it starts with a double slash, then it cannot be relative since
- // it's a remote file.
- //
- if (isBackSlash(toCheck[0]) && isBackSlash(toCheck[1]))
- return false;
-
- // Else assume its a relative path
- return true;
-}
-
-
-XERCES_CPP_NAMESPACE_END
-
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#include <windows.h>
+
+#include <xercesc/util/FileManagers/WindowsFileMgr.hpp>
+#include <xercesc/util/Janitor.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+static bool isBackSlash(XMLCh c) {
+ return c == chBackSlash ||
+ c == chYenSign ||
+ c == chWonSign;
+}
+
+WindowsFileMgr::WindowsFileMgr()
+{
+ // Figure out if we are on NT and save that flag for later use
+ OSVERSIONINFO OSVer;
+ OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ ::GetVersionEx(&OSVer);
+ _onNT = (OSVer.dwPlatformId == VER_PLATFORM_WIN32_NT);
+}
+
+
+WindowsFileMgr::~WindowsFileMgr()
+{
+}
+
+
+FileHandle
+WindowsFileMgr::open(const XMLCh* fileName, bool toWrite, MemoryManager* const manager)
+{
+ // Watch for obvious wierdness
+ if (!fileName)
+ return 0;
+
+ //
+ // We have to play a little trick here. If its /x:.....
+ // style fully qualified path, we have to toss the leading /
+ // character.
+ //
+ const XMLCh* nameToOpen = fileName;
+ if (*fileName == chForwardSlash)
+ {
+ if (XMLString::stringLen(fileName) > 3)
+ {
+ if (*(fileName + 2) == chColon)
+ {
+ const XMLCh chDrive = *(fileName + 1);
+ if (((chDrive >= chLatin_A) && (chDrive <= chLatin_Z))
+ || ((chDrive >= chLatin_a) && (chDrive <= chLatin_z)))
+ {
+ nameToOpen = fileName + 1;
+ }
+ }
+
+ // Similarly for UNC paths
+ if ( *(fileName + 1) == *(fileName + 2) &&
+ (*(fileName + 1) == chForwardSlash ||
+ *(fileName + 1) == chBackSlash) )
+ {
+ nameToOpen = fileName + 1;
+ }
+ }
+ }
+
+ // Ok, this might look stupid but its a semi-expedient way to deal
+ // with a thorny problem. Shift-JIS and some other Asian encodings
+ // are fundamentally broken and map both the backslash and the Yen
+ // sign to the same code point. Transcoders have to pick one or the
+ // other to map '\' to Unicode and tend to choose the Yen sign.
+ //
+ // Unicode Yen or Won signs as directory separators will fail.
+ //
+ // So, we will check this path name for Yen or won signs and, if they are
+ // there, we'll replace them with slashes.
+ //
+ // A further twist: we replace Yen and Won with forward slashes rather
+ // than back slashes. Either form of slash will work as a directory
+ // separator. On Win 95 and 98, though, Unicode back-slashes may
+ // fail to transode back to 8-bit 0x5C with some Unicode converters
+ // to some of the problematic code pages. Forward slashes always
+ // transcode correctly back to 8 bit char * form.
+ //
+ XMLCh *tmpUName = 0;
+
+ const XMLCh* srcPtr = nameToOpen;
+ while (*srcPtr)
+ {
+ if (*srcPtr == chYenSign ||
+ *srcPtr == chWonSign)
+ break;
+ srcPtr++;
+ }
+
+ //
+ // If we found a yen, then we have to create a temp file name. Else
+ // go with the file name as is and save the overhead.
+ //
+ if (*srcPtr)
+ {
+ tmpUName = XMLString::replicate(nameToOpen, manager);
+
+ XMLCh* tmpPtr = tmpUName;
+ while (*tmpPtr)
+ {
+ if (*tmpPtr == chYenSign ||
+ *tmpPtr == chWonSign)
+ *tmpPtr = chForwardSlash;
+ tmpPtr++;
+ }
+ nameToOpen = tmpUName;
+ }
+ FileHandle retVal = 0;
+ if (_onNT)
+ {
+ retVal = ::CreateFileW
+ (
+ (LPCWSTR) nameToOpen
+ , toWrite?GENERIC_WRITE:GENERIC_READ
+ , FILE_SHARE_READ
+ , 0
+ , toWrite?CREATE_ALWAYS:OPEN_EXISTING
+ , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
+ , 0
+ );
+ }
+ else
+ {
+ //
+ // We are Win 95 / 98. Take the Unicode file name back to (char *)
+ // so that we can open it.
+ //
+ char* tmpName = XMLString::transcode(nameToOpen, manager);
+ retVal = ::CreateFileA
+ (
+ tmpName
+ , toWrite?GENERIC_WRITE:GENERIC_READ
+ , FILE_SHARE_READ
+ , 0
+ , toWrite?CREATE_ALWAYS:OPEN_EXISTING
+ , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
+ , 0
+ );
+ manager->deallocate(tmpName);//delete [] tmpName;
+ }
+
+ if (tmpUName)
+ manager->deallocate(tmpUName);//delete [] tmpUName;
+
+ if (retVal == INVALID_HANDLE_VALUE)
+ return 0;
+
+ return retVal;
+}
+
+
+FileHandle
+WindowsFileMgr::open(const char* path, bool toWrite, MemoryManager* const manager)
+{
+ FileHandle retVal = ::CreateFileA
+ (
+ path
+ , toWrite?GENERIC_WRITE:GENERIC_READ
+ , FILE_SHARE_READ
+ , 0
+ , toWrite?OPEN_ALWAYS:OPEN_EXISTING
+ , toWrite?FILE_ATTRIBUTE_NORMAL:FILE_FLAG_SEQUENTIAL_SCAN
+ , 0
+ );
+
+ if (retVal == INVALID_HANDLE_VALUE)
+ return 0;
+
+ return retVal;
+}
+
+
+FileHandle
+WindowsFileMgr::openStdIn(MemoryManager* const manager)
+{
+ //
+ // Get the standard input handle. Duplicate it and return that copy
+ // since the outside world cannot tell the difference and will shut
+ // down this handle when its done with it. If we gave out the orignal,
+ // shutting it would prevent any further output.
+ //
+ HANDLE stdInOrg = ::GetStdHandle(STD_INPUT_HANDLE);
+ if (stdInOrg == INVALID_HANDLE_VALUE) {
+ XMLCh stdinStr[] = {chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull};
+ ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
+ }
+
+ HANDLE retHandle;
+ if (!::DuplicateHandle
+ (
+ ::GetCurrentProcess()
+ , stdInOrg
+ , ::GetCurrentProcess()
+ , &retHandle
+ , 0
+ , FALSE
+ , DUPLICATE_SAME_ACCESS))
+ {
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotDupHandle, manager);
+ }
+ return retHandle;
+}
+
+
+void
+WindowsFileMgr::close(FileHandle f, MemoryManager* const manager)
+{
+ if (!f)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ if (!::CloseHandle(f))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile, manager);
+}
+
+
+void
+WindowsFileMgr::reset(FileHandle f, MemoryManager* const manager)
+{
+ if (!f)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ // Seek to the start of the file
+ if (::SetFilePointer(f, 0, 0, FILE_BEGIN) == 0xFFFFFFFF)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotResetFile, manager);
+}
+
+
+XMLFilePos
+WindowsFileMgr::curPos(FileHandle f, MemoryManager* const manager)
+{
+ if (!f)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ // Get the current position
+ const unsigned int curPos = ::SetFilePointer(f, 0, 0, FILE_CURRENT);
+ if (curPos == 0xFFFFFFFF)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
+
+ return curPos;
+}
+
+
+XMLFilePos
+WindowsFileMgr::size(FileHandle f, MemoryManager* const manager)
+{
+ if (!f)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ DWORD high;
+ DWORD low=GetFileSize(f, &high);
+ if(low==INVALID_FILE_SIZE)
+ // TODO: find a better exception
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
+
+ return low;
+}
+
+
+XMLSize_t
+WindowsFileMgr::read(FileHandle f, XMLSize_t byteCount, XMLByte* buffer, MemoryManager* const manager)
+{
+ if (!f || !buffer)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ unsigned long bytesRead = 0;
+ if (!::ReadFile(f, buffer, byteCount, &bytesRead, 0))
+ {
+ //
+ // Check specially for a broken pipe error. If we get this, it just
+ // means no more data from the pipe, so return zero.
+ //
+ if (::GetLastError() != ERROR_BROKEN_PIPE)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile, manager);
+ }
+ return (unsigned int)bytesRead;
+}
+
+
+void
+WindowsFileMgr::write(FileHandle f, XMLSize_t byteCount, const XMLByte* buffer, MemoryManager* const manager)
+{
+ if (!f || !buffer)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+
+ const XMLByte* tmpFlush = buffer;
+
+ while (true)
+ {
+ unsigned long bytesWritten = 0;
+ if (!::WriteFile(f, tmpFlush, byteCount, &bytesWritten, 0))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile, manager);
+
+ if (bytesWritten < byteCount) //incomplete write
+ {
+ tmpFlush+=bytesWritten;
+ byteCount-=bytesWritten;
+ }
+ else
+ return;
+ }
+}
+
+
+XMLCh*
+WindowsFileMgr::getFullPath(const XMLCh* const srcPath, MemoryManager* const manager)
+{
+ //
+ // If we are on NT, then use wide character APIs, else use ASCII APIs.
+ // We have to do it manually since we are only built in ASCII mode from
+ // the standpoint of the APIs.
+ //
+ if (_onNT)
+ {
+ // Use a local buffer that is big enough for the largest legal path
+ const unsigned int bufSize = 1024;
+ XMLCh tmpPath[bufSize + 1];
+
+ XMLCh* namePart = 0;
+ if (!::GetFullPathNameW((LPCWSTR)srcPath, bufSize, (LPWSTR)tmpPath, (LPWSTR*)&namePart))
+ return 0;
+
+ // Return a copy of the path
+ return XMLString::replicate(tmpPath, manager);
+ }
+ else
+ {
+ // Transcode the incoming string
+ char* tmpSrcPath = XMLString::transcode(srcPath, manager);
+ ArrayJanitor<char> janSrcPath(tmpSrcPath, manager);
+
+ // Use a local buffer that is big enough for the largest legal path
+ const unsigned int bufSize = 511;
+ char tmpPath[511 + 1];
+
+ char* namePart = 0;
+ if (!::GetFullPathNameA(tmpSrcPath, bufSize, tmpPath, &namePart))
+ return 0;
+
+ // Return a transcoded copy of the path
+ return XMLString::transcode(tmpPath, manager);
+ }
+}
+
+
+XMLCh*
+WindowsFileMgr::getCurrentDirectory(MemoryManager* const manager)
+{
+ //
+ // If we are on NT, then use wide character APIs, else use ASCII APIs.
+ // We have to do it manually since we are only built in ASCII mode from
+ // the standpoint of the APIs.
+ //
+ if (_onNT)
+ {
+ // Use a local buffer that is big enough for the largest legal path
+ const unsigned int bufSize = 1024;
+ XMLCh tmpPath[bufSize + 1];
+
+ if (!::GetCurrentDirectoryW(bufSize, (LPWSTR)tmpPath))
+ return 0;
+
+ // Return a copy of the path
+ return XMLString::replicate(tmpPath, manager);
+ }
+ else
+ {
+ // Use a local buffer that is big enough for the largest legal path
+ const unsigned int bufSize = 511;
+ char tmpPath[511 + 1];
+
+ if (!::GetCurrentDirectoryA(bufSize, tmpPath))
+ return 0;
+
+ // Return a transcoded copy of the path
+ return XMLString::transcode(tmpPath, manager);
+ }
+}
+
+
+bool
+WindowsFileMgr::isRelative(const XMLCh* const toCheck, MemoryManager* const manager)
+{
+ // Check for pathological case of empty path
+ if (!toCheck || !toCheck[0])
+ return false;
+
+ //
+ // If its starts with a drive, then it cannot be relative. Note that
+ // we checked the drive not being empty above, so worst case its one
+ // char long and the check of the 1st char will fail because its really
+ // a null character.
+ //
+ if (toCheck[1] == chColon)
+ {
+ if (((toCheck[0] >= chLatin_A) && (toCheck[0] <= chLatin_Z))
+ || ((toCheck[0] >= chLatin_a) && (toCheck[0] <= chLatin_z)))
+ {
+ return false;
+ }
+ }
+
+ //
+ // If it starts with a double slash, then it cannot be relative since
+ // it's a remote file.
+ //
+ if (isBackSlash(toCheck[0]) && isBackSlash(toCheck[1]))
+ return false;
+
+ // Else assume its a relative path
+ return true;
+}
+
+
+XERCES_CPP_NAMESPACE_END
+
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp Sat Jun 4 07:46:52 2005
@@ -1,62 +1,62 @@
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: $
- */
-
-#ifndef WINDOWSFILEMGR_HPP
-#define WINDOWSFILEMGR_HPP
-
-#include <xercesc/util/XMLFileMgr.hpp>
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-// Concrete implementation of XMLFileMgr, implementing
-// file access on Windows systems.
-class WindowsFileMgr : public XMLFileMgr
-{
- public:
- WindowsFileMgr();
- virtual ~WindowsFileMgr();
-
- // File access
- virtual FileHandle open(const XMLCh* path, bool toWrite, MemoryManager* const manager);
- virtual FileHandle open(const char* path, bool toWrite, MemoryManager* const manager);
- virtual FileHandle openStdIn(MemoryManager* const manager);
-
- virtual void close(FileHandle f, MemoryManager* const manager);
- virtual void reset(FileHandle f, MemoryManager* const manager);
-
- virtual XMLFilePos curPos(FileHandle f, MemoryManager* const manager);
- virtual XMLFilePos size(FileHandle f, MemoryManager* const manager);
-
- virtual size_t read(FileHandle f, size_t byteCount, XMLByte* buffer, MemoryManager* const manager);
- virtual void write(FileHandle f, size_t byteCount, const XMLByte* buffer, MemoryManager* const manager);
-
- // Ancillary path handling routines
- virtual XMLCh* getFullPath(const XMLCh* const srcPath, MemoryManager* const manager);
- virtual XMLCh* getCurrentDirectory(MemoryManager* const manager);
- virtual bool isRelative(const XMLCh* const toCheck, MemoryManager* const manager);
-
- private:
- bool _onNT;
-};
-
-XERCES_CPP_NAMESPACE_END
-
-#endif
-
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#ifndef WINDOWSFILEMGR_HPP
+#define WINDOWSFILEMGR_HPP
+
+#include <xercesc/util/XMLFileMgr.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+// Concrete implementation of XMLFileMgr, implementing
+// file access on Windows systems.
+class WindowsFileMgr : public XMLFileMgr
+{
+ public:
+ WindowsFileMgr();
+ virtual ~WindowsFileMgr();
+
+ // File access
+ virtual FileHandle open(const XMLCh* path, bool toWrite, MemoryManager* const manager);
+ virtual FileHandle open(const char* path, bool toWrite, MemoryManager* const manager);
+ virtual FileHandle openStdIn(MemoryManager* const manager);
+
+ virtual void close(FileHandle f, MemoryManager* const manager);
+ virtual void reset(FileHandle f, MemoryManager* const manager);
+
+ virtual XMLFilePos curPos(FileHandle f, MemoryManager* const manager);
+ virtual XMLFilePos size(FileHandle f, MemoryManager* const manager);
+
+ virtual size_t read(FileHandle f, size_t byteCount, XMLByte* buffer, MemoryManager* const manager);
+ virtual void write(FileHandle f, size_t byteCount, const XMLByte* buffer, MemoryManager* const manager);
+
+ // Ancillary path handling routines
+ virtual XMLCh* getFullPath(const XMLCh* const srcPath, MemoryManager* const manager);
+ virtual XMLCh* getCurrentDirectory(MemoryManager* const manager);
+ virtual bool isRelative(const XMLCh* const toCheck, MemoryManager* const manager);
+
+ private:
+ bool _onNT;
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/FileManagers/WindowsFileMgr.hpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp Sat Jun 4 07:46:52 2005
@@ -1,70 +1,70 @@
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: WindowsMutexMgr.cpp 179230 2005-05-31 16:09:28Z amassari $
- */
-
-#include <windows.h>
-
-#include <xercesc/util/MutexManagers/WindowsMutexMgr.hpp>
-#include <xercesc/framework/MemoryManager.hpp>
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-WindowsMutexMgr::WindowsMutexMgr()
-{
-}
-
-
-WindowsMutexMgr::~WindowsMutexMgr()
-{
-}
-
-
-XMLMutexHandle
-WindowsMutexMgr::create(MemoryManager* const manager)
-{
- CRITICAL_SECTION* newCS=(CRITICAL_SECTION*)manager->allocate(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(newCS);
- return newCS;
-}
-
-
-void
-WindowsMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
-{
- ::DeleteCriticalSection((LPCRITICAL_SECTION)mtx);
- manager->deallocate(mtx);
-}
-
-
-void
-WindowsMutexMgr::lock(XMLMutexHandle mtx)
-{
- ::EnterCriticalSection((LPCRITICAL_SECTION)mtx);
-}
-
-
-void
-WindowsMutexMgr::unlock(XMLMutexHandle mtx)
-{
- ::LeaveCriticalSection((LPCRITICAL_SECTION)mtx);
-}
-
-
-XERCES_CPP_NAMESPACE_END
-
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#include <windows.h>
+
+#include <xercesc/util/MutexManagers/WindowsMutexMgr.hpp>
+#include <xercesc/framework/MemoryManager.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+WindowsMutexMgr::WindowsMutexMgr()
+{
+}
+
+
+WindowsMutexMgr::~WindowsMutexMgr()
+{
+}
+
+
+XMLMutexHandle
+WindowsMutexMgr::create(MemoryManager* const manager)
+{
+ CRITICAL_SECTION* newCS=(CRITICAL_SECTION*)manager->allocate(sizeof(CRITICAL_SECTION));
+ InitializeCriticalSection(newCS);
+ return newCS;
+}
+
+
+void
+WindowsMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
+{
+ ::DeleteCriticalSection((LPCRITICAL_SECTION)mtx);
+ manager->deallocate(mtx);
+}
+
+
+void
+WindowsMutexMgr::lock(XMLMutexHandle mtx)
+{
+ ::EnterCriticalSection((LPCRITICAL_SECTION)mtx);
+}
+
+
+void
+WindowsMutexMgr::unlock(XMLMutexHandle mtx)
+{
+ ::LeaveCriticalSection((LPCRITICAL_SECTION)mtx);
+}
+
+
+XERCES_CPP_NAMESPACE_END
+
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp?rev=179994&r1=179993&r2=179994&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp Sat Jun 4 07:46:52 2005
@@ -1,48 +1,48 @@
-/*
- * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * $Id: $
- */
-
-#ifndef WINDOWSMUTEXMGR_HPP
-#define WINDOWSMUTEXMGR_HPP
-
-#include <xercesc/util/XMLMutexMgr.hpp>
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-/*
- The mutex manager to use on MS Windows platforms
-*/
-class WindowsMutexMgr : public XMLMutexMgr
-{
- public:
- WindowsMutexMgr();
- virtual ~WindowsMutexMgr();
-
- // Mutex operations
- virtual XMLMutexHandle create(MemoryManager* const manager);
- virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager);
- virtual void lock(XMLMutexHandle mtx);
- virtual void unlock(XMLMutexHandle mtx);
-};
-
-XERCES_CPP_NAMESPACE_END
-
-
-#endif
-
+/*
+ * Copyright 1999-2000,2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#ifndef WINDOWSMUTEXMGR_HPP
+#define WINDOWSMUTEXMGR_HPP
+
+#include <xercesc/util/XMLMutexMgr.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/*
+ The mutex manager to use on MS Windows platforms
+*/
+class WindowsMutexMgr : public XMLMutexMgr
+{
+ public:
+ WindowsMutexMgr();
+ virtual ~WindowsMutexMgr();
+
+ // Mutex operations
+ virtual XMLMutexHandle create(MemoryManager* const manager);
+ virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager);
+ virtual void lock(XMLMutexHandle mtx);
+ virtual void unlock(XMLMutexHandle mtx);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+
+#endif
+
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/MutexManagers/WindowsMutexMgr.hpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org