[SCM] OCE packaging branch, debian, updated. debian/0.11-1

Denis Barbier bouzim at gmail.com
Thu Dec 13 19:16:45 UTC 2012


The following commit has been merged in the debian branch:
commit 890b35f31f9076458dde4177c04bbb37e4ca5cec
Author: Denis Barbier <bouzim at gmail.com>
Date:   Thu Nov 22 23:03:23 2012 +0100

    Fix 4a1888c by using the right data type to avoid int<->pointer conversions

diff --git a/inc/OSD_EnvironmentIterator.hxx b/inc/OSD_EnvironmentIterator.hxx
index 19cb71f..3199ba2 100644
--- a/inc/OSD_EnvironmentIterator.hxx
+++ b/inc/OSD_EnvironmentIterator.hxx
@@ -79,7 +79,11 @@ private:
 
 
 Standard_Address myEnv;
+#ifdef WNT
+Standard_Address myCount;
+#else
 Standard_Integer myCount;
+#endif
 OSD_Error myError;
 
 
diff --git a/inc/OSD_FileNode.hxx b/inc/OSD_FileNode.hxx
index 9edb5a5..cd4c4d5 100644
--- a/inc/OSD_FileNode.hxx
+++ b/inc/OSD_FileNode.hxx
@@ -99,7 +99,11 @@ protected:
 
 
 OSD_Path myPath;
+#ifdef WNT
+HANDLE myFileChannel;
+#else
 Standard_Integer myFileChannel;
+#endif
 OSD_Error myError;
 
 
diff --git a/inc/OSD_SharedMemory.hxx b/inc/OSD_SharedMemory.hxx
index 83843ad..9b323c4 100644
--- a/inc/OSD_SharedMemory.hxx
+++ b/inc/OSD_SharedMemory.hxx
@@ -95,7 +95,11 @@ private:
 
 
 
+#ifdef WNT
+HANDLE myId;
+#else
 Standard_Integer myId;
+#endif
 Standard_Address myAddress;
 TCollection_AsciiString myName;
 Standard_Integer mySize;
diff --git a/src/OSD/OSD_DirectoryIterator.cxx b/src/OSD/OSD_DirectoryIterator.cxx
index d2c19e2..f6e5549 100644
--- a/src/OSD/OSD_DirectoryIterator.cxx
+++ b/src/OSD/OSD_DirectoryIterator.cxx
@@ -208,7 +208,7 @@ OSD_DirectoryIterator :: OSD_DirectoryIterator (
                          ) {
 
  myFlag   = Standard_False;
- myHandle = ( intptr_t )INVALID_HANDLE_VALUE;
+ myHandle = INVALID_HANDLE_VALUE;
 
  where.SystemName ( myPlace );
 
@@ -223,15 +223,15 @@ void OSD_DirectoryIterator :: Destroy () {
 
  if ( myData != NULL ) HeapFree (  GetProcessHeap (), 0, myData  );
 
- if (  myHandle != ( intptr_t )INVALID_HANDLE_VALUE  )
+ if (  myHandle != INVALID_HANDLE_VALUE  )
 
-  FindClose (  ( HANDLE )myHandle  );
+  FindClose (  myHandle  );
 
 }  // end  OSD_DirectoryIterator :: Destroy
 
 Standard_Boolean OSD_DirectoryIterator :: More () {
 
- if (  myHandle == ( intptr_t )INVALID_HANDLE_VALUE  ) {
+ if (  myHandle == INVALID_HANDLE_VALUE  ) {
  
   TCollection_AsciiString wc = myPlace + TEXT( "/" ) + myMask;
 
@@ -239,11 +239,11 @@ Standard_Boolean OSD_DirectoryIterator :: More () {
             GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATA )
            );
 
-  myHandle = ( intptr_t )FindFirstFile (
+  myHandle = FindFirstFile (
                                   wc.ToCString (), ( PWIN32_FIND_DATA )myData
                                  );
 
-  if (  myHandle == ( intptr_t )INVALID_HANDLE_VALUE  )
+  if (  myHandle == INVALID_HANDLE_VALUE  )
   
    _osd_wnt_set_error ( myError, OSD_WDirectoryIterator );
   
@@ -258,8 +258,8 @@ Standard_Boolean OSD_DirectoryIterator :: More () {
   
  } else if ( !myFlag ) {
  
-  FindClose (  ( HANDLE )myHandle  );
-  myHandle = ( intptr_t )INVALID_HANDLE_VALUE;
+  FindClose ( myHandle );
+  myHandle = INVALID_HANDLE_VALUE;
  
  }  // end if
 
@@ -275,7 +275,7 @@ void OSD_DirectoryIterator :: Next () {
  
   do {
   
-   if (   !FindNextFile (  ( HANDLE )myHandle, _FD  )   ) {
+   if (   !FindNextFile (  myHandle, _FD  )   ) {
    
     myFlag = Standard_False;
 
diff --git a/src/OSD/OSD_EnvironmentIterator.cxx b/src/OSD/OSD_EnvironmentIterator.cxx
index 139ba77..b399798 100644
--- a/src/OSD/OSD_EnvironmentIterator.cxx
+++ b/src/OSD/OSD_EnvironmentIterator.cxx
@@ -102,7 +102,7 @@ Standard_Integer OSD_EnvironmentIterator::Error()const{
 OSD_EnvironmentIterator :: OSD_EnvironmentIterator () {
 
  myEnv   = GetEnvironmentStrings ();
- myCount = ( intptr_t )myEnv;
+ myCount = myEnv;
 
 }  // end constructor
 
diff --git a/src/OSD/OSD_File.cxx b/src/OSD/OSD_File.cxx
index 0024362..cce9bcd 100644
--- a/src/OSD/OSD_File.cxx
+++ b/src/OSD/OSD_File.cxx
@@ -875,7 +875,7 @@ BOOL                 __fastcall _osd_wnt_sd_to_protection (
                                 );
 BOOL                 __fastcall _osd_print (const Standard_PCharacter, Standard_CString );
 
-static void      __fastcall _test_raise ( Standard_Integer, Standard_CString );
+static void      __fastcall _test_raise ( HANDLE, Standard_CString );
 static DWORDLONG __fastcall _get_line   ( Standard_PCharacter&, DWORD );
 static int       __fastcall _get_buffer ( HANDLE, Standard_PCharacter&, DWORD, BOOL, BOOL );
 static DWORD     __fastcall _get_access_mask ( OSD_SingleProtection );
@@ -928,7 +928,7 @@ void OSD_File :: Build (
    Standard_ProgramError::Raise("OSD_File::Read : it is a directory");
  }
                                         
- if (  ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE  )
+ if (  myFileChannel != INVALID_HANDLE_VALUE  )
 
   RAISE(  TEXT( "OSD_File :: Build (): incorrect call - file already opened" )  );
 
@@ -939,9 +939,9 @@ void OSD_File :: Build (
 
   RAISE(  TEXT( "OSD_File :: Build (): incorrent call - no filename given" )  );
 
- myFileChannel = ( intptr_t )_open_file ( fName.ToCString (), Mode, OPEN_NEW );
+ myFileChannel = _open_file ( fName.ToCString (), Mode, OPEN_NEW );
 
- if (  ( HANDLE )myFileChannel == INVALID_HANDLE_VALUE  )
+ if (  myFileChannel == INVALID_HANDLE_VALUE  )
 
   _osd_wnt_set_error ( myError, OSD_WFile );
 
@@ -967,7 +967,7 @@ void OSD_File :: Open (
  TCollection_AsciiString fName;
 
 
- if (  ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE  )
+ if (  myFileChannel != INVALID_HANDLE_VALUE  )
 
   RAISE(  TEXT( "OSD_File :: Open (): incorrect call - file already opened" )  );
 
@@ -978,9 +978,9 @@ void OSD_File :: Open (
 
   RAISE(  TEXT( "OSD_File :: Open (): incorrent call - no filename given" )  );
 
- myFileChannel = ( intptr_t )_open_file ( fName.ToCString (), Mode, OPEN_OLD );
+ myFileChannel = _open_file ( fName.ToCString (), Mode, OPEN_OLD );
 
- if (  ( HANDLE )myFileChannel == INVALID_HANDLE_VALUE  ) {
+ if (  myFileChannel == INVALID_HANDLE_VALUE  ) {
 
    _osd_wnt_set_error ( myError, OSD_WFile );
  }
@@ -1001,7 +1001,7 @@ void OSD_File :: Append (
  BOOL                    fNew = FALSE;
  TCollection_AsciiString fName;
 
- if (  ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE  )
+ if (  myFileChannel != INVALID_HANDLE_VALUE  )
 
   RAISE(  TEXT( "OSD_File :: Append (): incorrect call - file already opened" )  );
 
@@ -1012,9 +1012,9 @@ void OSD_File :: Append (
 
   RAISE(  TEXT( "OSD_File :: Append (): incorrent call - no filename given" )  );
 
- myFileChannel = ( intptr_t )_open_file ( fName.ToCString (), Mode, OPEN_APPEND, &fNew );
+ myFileChannel = _open_file ( fName.ToCString (), Mode, OPEN_APPEND, &fNew );
 
- if (  ( HANDLE )myFileChannel == INVALID_HANDLE_VALUE  )
+ if (  myFileChannel == INVALID_HANDLE_VALUE  )
 
   _osd_wnt_set_error ( myError, OSD_WFile );
 
@@ -1119,7 +1119,7 @@ void OSD_File :: ReadLine (
  if ( myIO & FLAG_FILE ) {
  
   if (  !ReadFile (
-          ( HANDLE )myFileChannel, cBuffer, ( DWORD )NByte, &dwBytesRead, NULL
+          myFileChannel, cBuffer, ( DWORD )NByte, &dwBytesRead, NULL
          )
   ) {  // an error occured
 
@@ -1146,7 +1146,7 @@ void OSD_File :: ReadLine (
                                           // peek next character to see if it is a <LF>
 #endif
     if (  !ReadFile (
-            ( HANDLE )myFileChannel, ppeekChar, 1, &dwDummy, NULL
+            myFileChannel, ppeekChar, 1, &dwDummy, NULL
            )
     ) {
     
@@ -1158,7 +1158,7 @@ void OSD_File :: ReadLine (
     
      // adjust file position
 
-      SetFilePointer (  ( HANDLE )myFileChannel, -1, NULL, FILE_CURRENT  );
+      SetFilePointer (  myFileChannel, -1, NULL, FILE_CURRENT  );
 
     } else
      myIO |= FLAG_EOF;
@@ -1168,7 +1168,7 @@ void OSD_File :: ReadLine (
    } else {
 
     if ( dwSeekPos != 0 )
-     SetFilePointer (  ( HANDLE )myFileChannel, ( LONG )dwSeekPos, NULL, FILE_CURRENT  );
+     SetFilePointer (  myFileChannel, ( LONG )dwSeekPos, NULL, FILE_CURRENT  );
 
     NbyteRead = ( Standard_Integer )( eos - cBuffer );
 
@@ -1179,7 +1179,7 @@ void OSD_File :: ReadLine (
  } else if ( myIO & FLAG_SOCKET || myIO & FLAG_PIPE || myIO & FLAG_NAMED_PIPE ) {
 
   dwBytesRead = ( DWORD )_get_buffer (
-                          ( HANDLE )myFileChannel, cBuffer, ( DWORD )NByte,
+                          myFileChannel, cBuffer, ( DWORD )NByte,
                           TRUE, myIO & FLAG_SOCKET
                          );
 
@@ -1212,7 +1212,7 @@ void OSD_File :: ReadLine (
     NbyteRead = dwBytesRead; // (LD) always fits this case.
 
     dwDummy = _get_buffer (
-               ( HANDLE )myFileChannel, ppeekChar, 1, TRUE, myIO & FLAG_SOCKET
+               myFileChannel, ppeekChar, 1, TRUE, myIO & FLAG_SOCKET
               );
     if (  ( int )dwDummy == -1  ) {  // an error occured
    
@@ -1241,7 +1241,7 @@ void OSD_File :: ReadLine (
    Standard_PCharacter cDummyBuffer = new Standard_Character[ NByte + 3 ];
 
    _get_buffer (  // remove pending input
-    ( HANDLE )myFileChannel, cDummyBuffer, dwBytesRead, FALSE, myIO & FLAG_SOCKET
+    myFileChannel, cDummyBuffer, dwBytesRead, FALSE, myIO & FLAG_SOCKET
    );
    delete [] cDummyBuffer ;
 
@@ -1293,7 +1293,7 @@ void OSD_File :: ReadLine (
  if ( myIO & FLAG_FILE ) {
  
   if (  !ReadFile (
-          ( HANDLE )myFileChannel, cBuffer, ( DWORD )NByte, &dwBytesRead, NULL
+          myFileChannel, cBuffer, ( DWORD )NByte, &dwBytesRead, NULL
          )
   ) {  // an error occured
 
@@ -1320,7 +1320,7 @@ void OSD_File :: ReadLine (
                                           // peek next character to see if it is a <LF>
 #endif
     if (  !ReadFile (
-            ( HANDLE )myFileChannel, &peekChar, 1, &dwDummy, NULL
+            myFileChannel, &peekChar, 1, &dwDummy, NULL
            )
     ) {
     
@@ -1335,7 +1335,7 @@ void OSD_File :: ReadLine (
     
      else  // adjust file position
 
-      SetFilePointer (  ( HANDLE )myFileChannel, -1, NULL, FILE_CURRENT  );
+      SetFilePointer (  myFileChannel, -1, NULL, FILE_CURRENT  );
 
     } else
          
@@ -1345,7 +1345,7 @@ void OSD_File :: ReadLine (
 
    } else if ( dwSeekPos != 0 ) {
    
-    SetFilePointer (  ( HANDLE )myFileChannel, ( LONG )dwSeekPos, NULL, FILE_CURRENT  );
+    SetFilePointer (  myFileChannel, ( LONG )dwSeekPos, NULL, FILE_CURRENT  );
     NbyteRead = ( Standard_Integer )( eos - cBuffer );
 
    } else
@@ -1357,7 +1357,7 @@ void OSD_File :: ReadLine (
  } else if ( myIO & FLAG_SOCKET || myIO & FLAG_PIPE || myIO & FLAG_NAMED_PIPE ) {
 
   dwBytesRead = ( DWORD )_get_buffer (
-                          ( HANDLE )myFileChannel, cBuffer, ( DWORD )NByte,
+                          myFileChannel, cBuffer, ( DWORD )NByte,
                           TRUE, myIO & FLAG_SOCKET
                          );
 
@@ -1385,7 +1385,7 @@ void OSD_File :: ReadLine (
                                           // peek next character to see if it is a <LF>
 #endif
     dwDummy = _get_buffer (
-               ( HANDLE )myFileChannel, &peekChar, 1, TRUE, myIO & FLAG_SOCKET
+               myFileChannel, &peekChar, 1, TRUE, myIO & FLAG_SOCKET
               );
     eos     = cBuffer + dwBytesRead;
 
@@ -1416,7 +1416,7 @@ void OSD_File :: ReadLine (
     NbyteRead = ( Standard_Integer )( eos - cBuffer );
 
    _get_buffer (  // remove pending input
-    ( HANDLE )myFileChannel, cBuffer, dwBytesRead, FALSE, myIO & FLAG_SOCKET
+    myFileChannel, cBuffer, dwBytesRead, FALSE, myIO & FLAG_SOCKET
    );
    *eos = 0;
 
@@ -1458,7 +1458,7 @@ void OSD_File :: Read (
   RAISE(  TEXT( "OSD_File :: Read (): attempt to read from write only pipe" )  );
 
  if (  !ReadFile (
-         ( HANDLE )myFileChannel, Buffer, ( DWORD )Nbyte, &dwBytesRead, NULL
+         myFileChannel, Buffer, ( DWORD )Nbyte, &dwBytesRead, NULL
         )
  ) {
  
@@ -1504,7 +1504,7 @@ void OSD_File :: Write (
   RAISE(  TEXT( "OSD_File :: Write (): attempt to write to read only pipe" )  );
 
  if (  !WriteFile (
-         ( HANDLE )myFileChannel, Buffer, ( DWORD )Nbyte, &dwBytesWritten, NULL
+         myFileChannel, Buffer, ( DWORD )Nbyte, &dwBytesWritten, NULL
         ) || dwBytesWritten != ( DWORD )Nbyte
  )
 
@@ -1549,7 +1549,7 @@ void OSD_File :: Seek (
   }  // end switch
 
   if (  SetFilePointer (
-         ( HANDLE )myFileChannel, ( LONG )Offset, NULL, dwMoveMethod
+         myFileChannel, ( LONG )Offset, NULL, dwMoveMethod
         ) == 0xFFFFFFFF
   )
 
@@ -1569,9 +1569,9 @@ void OSD_File :: Close () {
 
  TEST_RAISE(  TEXT( "Close" )  );
 
- CloseHandle (  ( HANDLE )myFileChannel  );
+ CloseHandle (  myFileChannel  );
 
- myFileChannel = ( intptr_t )INVALID_HANDLE_VALUE;
+ myFileChannel = INVALID_HANDLE_VALUE;
  myIO          = 0;
 
 }  // end OSD_File :: Close
@@ -1595,7 +1595,7 @@ OSD_KindFile OSD_File :: KindOfFile () const {
  OSD_KindFile     retVal;
  Standard_Integer flags;
 
- if (  ( HANDLE )myFileChannel == INVALID_HANDLE_VALUE  ) {
+ if (  myFileChannel == INVALID_HANDLE_VALUE  ) {
 
   TCollection_AsciiString fName;
 
@@ -1606,7 +1606,7 @@ OSD_KindFile OSD_File :: KindOfFile () const {
    RAISE(  TEXT( "OSD_File :: KindOfFile (): incorrent call - no filename given" )  );
 
   flags = _get_file_type (
-            fName.ToCString (), ( intptr_t )INVALID_HANDLE_VALUE
+            fName.ToCString (), INVALID_HANDLE_VALUE
            );
 
  } else
@@ -1795,7 +1795,7 @@ void OSD_File :: SetLock ( const OSD_LockType Lock ) {
  if (Ret)
  {
   if (  !LockFileEx (
-          ( HANDLE )myFileChannel, dwFlags, 0, Size (), 0, &ovlp
+          myFileChannel, dwFlags, 0, Size (), 0, &ovlp
          )
   ) {
 
@@ -1819,7 +1819,7 @@ void OSD_File :: UnLock () {
  if ( ImperativeFlag ) {
  
   if (  !UnlockFile (
-          ( HANDLE )myFileChannel, 0, 0, Size (), 0
+          myFileChannel, 0, 0, Size (), 0
          )
   )
    
@@ -1857,7 +1857,7 @@ Standard_Integer OSD_File :: Size () {
  TEST_RAISE(  TEXT( "Size" )  );
 
  retVal = ( Standard_Integer )GetFileSize (
-                               ( HANDLE )myFileChannel, NULL
+                               myFileChannel, NULL
                               );
 
  if (  retVal == ( Standard_Integer )0xFFFFFFFF  )
@@ -1874,7 +1874,7 @@ Standard_Integer OSD_File :: Size () {
 
 void OSD_File :: Print ( const OSD_Printer& WhichPrinter ) {
 
- if (  ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE  )
+ if (  myFileChannel != INVALID_HANDLE_VALUE  )
 
   RAISE(  TEXT( "OSD_File :: Print (): incorrect call - file opened" )  );
 
@@ -1895,7 +1895,7 @@ void OSD_File :: Print ( const OSD_Printer& WhichPrinter ) {
 
 Standard_Boolean OSD_File :: IsOpen () const {
 
- return ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE;
+ return myFileChannel != INVALID_HANDLE_VALUE;
 
 }  // end OSD_File :: IsOpen
 
@@ -2170,11 +2170,11 @@ retry:
 }  // end _osd_wnt_protection_to_sd */
 
 
-static void __fastcall _test_raise ( Standard_Integer hFile, Standard_CString str ) {
+static void __fastcall _test_raise ( HANDLE hFile, Standard_CString str ) {
 
  Standard_Character buff[ 64 ];
 
- if (  ( HANDLE )hFile == INVALID_HANDLE_VALUE  ) {
+ if (  hFile == INVALID_HANDLE_VALUE  ) {
  
   _tcscpy (  buff, TEXT( "OSD_File :: " )  );
   _tcscat (  buff, str );
@@ -2667,16 +2667,16 @@ static HANDLE __fastcall _open_file (
 }  // end _open_file
 
 Standard_Integer __fastcall _get_file_type (
-                             Standard_CString fName, Standard_Integer fileHandle
+                             Standard_CString fName, HANDLE fileHandle
                             ) {
 
  Standard_Integer retVal = 0;
  DWORD            dwType;
  int              fileType;
 
- fileType = fileHandle == ( intptr_t )INVALID_HANDLE_VALUE ?
+ fileType = fileHandle == INVALID_HANDLE_VALUE ?
                           FILE_TYPE_DISK :
-                          GetFileType (  ( HANDLE )fileHandle  );
+                          GetFileType ( fileHandle );
 
  switch ( fileType ) {
  
diff --git a/src/OSD/OSD_FileIterator.cxx b/src/OSD/OSD_FileIterator.cxx
index c4e1443..64e8518 100644
--- a/src/OSD/OSD_FileIterator.cxx
+++ b/src/OSD/OSD_FileIterator.cxx
@@ -292,7 +292,7 @@ OSD_FileIterator :: OSD_FileIterator (
                     ) {
 
  myFlag   = Standard_False;
- myHandle = ( intptr_t )INVALID_HANDLE_VALUE;
+ myHandle = INVALID_HANDLE_VALUE;
 
  where.SystemName ( myPlace );
 
@@ -307,15 +307,15 @@ void OSD_FileIterator :: Destroy () {
 
  if ( myData != NULL ) HeapFree (  GetProcessHeap (), 0, myData  );
 
- if (  myHandle != ( intptr_t )INVALID_HANDLE_VALUE  )
+ if (  myHandle != INVALID_HANDLE_VALUE  )
 
-  FindClose (  ( HANDLE )myHandle  );
+  FindClose (  myHandle  );
 
 }  // end  OSD_DirectoryIterator :: Destroy
 
 Standard_Boolean OSD_FileIterator :: More () {
 
- if (  myHandle == ( intptr_t )INVALID_HANDLE_VALUE  ) {
+ if (  myHandle == INVALID_HANDLE_VALUE  ) {
  
   TCollection_AsciiString wc = myPlace + TEXT( "/" ) + myMask;
 
@@ -323,11 +323,11 @@ Standard_Boolean OSD_FileIterator :: More () {
             GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS, sizeof ( WIN32_FIND_DATA )
            );
 
-  myHandle = ( intptr_t )FindFirstFile (
+  myHandle = FindFirstFile (
                                   wc.ToCString (), ( PWIN32_FIND_DATA )myData
                                  );
 
-  if (  myHandle == ( intptr_t )INVALID_HANDLE_VALUE  )
+  if (  myHandle == INVALID_HANDLE_VALUE  )
   
    _osd_wnt_set_error ( myError, OSD_WDirectoryIterator );
   
@@ -342,8 +342,8 @@ Standard_Boolean OSD_FileIterator :: More () {
   
  } else if ( !myFlag ) {
  
-  FindClose (  ( HANDLE )myHandle  );
-  myHandle = ( intptr_t )INVALID_HANDLE_VALUE;
+  FindClose (  myHandle  );
+  myHandle = INVALID_HANDLE_VALUE;
  
  }  // end if
 
@@ -359,7 +359,7 @@ void OSD_FileIterator :: Next () {
  
   do {
   
-   if (   !FindNextFile (  ( HANDLE )myHandle, _FD  )   ) {
+   if (   !FindNextFile (  myHandle, _FD  )   ) {
    
     myFlag = Standard_False;
 
diff --git a/src/OSD/OSD_FileNode.cxx b/src/OSD/OSD_FileNode.cxx
index d8e8b96..35f20fa 100644
--- a/src/OSD/OSD_FileNode.cxx
+++ b/src/OSD/OSD_FileNode.cxx
@@ -468,7 +468,7 @@ PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection
 BOOL                 __fastcall _osd_wnt_sd_to_protection (
                                  PSECURITY_DESCRIPTOR pSD, OSD_Protection& prot, BOOL
                                 );
-Standard_Integer     __fastcall _get_file_type ( Standard_CString, Standard_Integer );
+Standard_Integer     __fastcall _get_file_type ( Standard_CString, HANDLE );
 
 void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
 
@@ -482,7 +482,7 @@ static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString )
 
 OSD_FileNode::OSD_FileNode () {
 
- myFileChannel = ( intptr_t )INVALID_HANDLE_VALUE;
+ myFileChannel = INVALID_HANDLE_VALUE;
 
 }  // end constructor ( 1 )
 
@@ -493,7 +493,7 @@ OSD_FileNode::OSD_FileNode () {
 
 OSD_FileNode::OSD_FileNode ( const OSD_Path& Name ) {
 
- myFileChannel = ( intptr_t )INVALID_HANDLE_VALUE;
+ myFileChannel = INVALID_HANDLE_VALUE;
  myPath        = Name;
 
 }  // end constructor ( 2 )
@@ -563,7 +563,7 @@ void OSD_FileNode::Remove () {
  TEST_RAISE(  TEXT( "Remove" )  );
 
  switch (  _get_file_type (  fName.ToCString (),
-                             ( intptr_t )INVALID_HANDLE_VALUE )  ) {
+                             INVALID_HANDLE_VALUE )  ) {
 
   case FLAG_FILE:
 
@@ -611,7 +611,7 @@ void OSD_FileNode::Move ( const OSD_Path& NewPath ) {
  NewPath.SystemName ( fNameDst );
 
  switch (  _get_file_type ( fName.ToCString (),
-                            ( intptr_t )INVALID_HANDLE_VALUE )  ) {
+                            INVALID_HANDLE_VALUE )  ) {
 
   case FLAG_FILE:
 
@@ -662,7 +662,7 @@ void OSD_FileNode::Copy ( const OSD_Path& ToPath ) {
  ToPath.SystemName ( fNameDst );
 
  switch (  _get_file_type ( fName.ToCString (),
-                            ( intptr_t )INVALID_HANDLE_VALUE )  ) {
+                            INVALID_HANDLE_VALUE )  ) {
 
   case FLAG_FILE:
 
@@ -715,7 +715,7 @@ OSD_Protection OSD_FileNode::Protection () {
         ) == NULL ||
         !_osd_wnt_sd_to_protection (
           pSD, retVal,
-          _get_file_type (  fName.ToCString (), ( intptr_t )INVALID_HANDLE_VALUE  ) ==
+          _get_file_type (  fName.ToCString (), INVALID_HANDLE_VALUE  ) ==
           FLAG_DIRECTORY
          )
  )
@@ -747,7 +747,7 @@ void OSD_FileNode::SetProtection ( const OSD_Protection& Prot ) {
  pSD = _osd_wnt_protection_to_sd (
         Prot,
         _get_file_type ( fName.ToCString (),
-                         ( intptr_t )INVALID_HANDLE_VALUE  ) ==
+                         INVALID_HANDLE_VALUE  ) ==
         FLAG_DIRECTORY,
         (char *)fName.ToCString ()
        );
diff --git a/src/OSD/OSD_SharedMemory.cxx b/src/OSD/OSD_SharedMemory.cxx
index a4353d1..fa8093a 100644
--- a/src/OSD/OSD_SharedMemory.cxx
+++ b/src/OSD/OSD_SharedMemory.cxx
@@ -185,7 +185,7 @@ void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
 
 OSD_SharedMemory :: OSD_SharedMemory () {
 
- myId = 0;
+ myId = INVALID_HANDLE_VALUE;
 
 }  // end constructor ( 1 )
 
@@ -227,7 +227,7 @@ void OSD_SharedMemory :: Build () {
 
   else
 
-   myId = ( intptr_t )hFileMapping;
+   myId = hFileMapping;
 
  }  // end else
 
@@ -264,7 +264,7 @@ void OSD_SharedMemory :: Open (
 
   else
 
-   myId = ( intptr_t )hFileMapping;
+   myId = hFileMapping;
 
   CloseHandle ( hFileMapping );
 
@@ -276,14 +276,14 @@ void OSD_SharedMemory :: Delete () {
 
  if (  Failed ()  ) Perror ();
 
- if ( myId == 0 )
+ if ( myId == INVALID_HANDLE_VALUE )
 
   Standard_ProgramError :: Raise (
                             "OSD_SharedMemory :: Delete : shared memory not opened/created"
                            );
 
  UnmapViewOfFile ( myAddress );
- CloseHandle (  ( HANDLE )myId  );
+ CloseHandle (  myId  );
 
 }  // end OSD_SharedMemory :: Delete
 
diff --git a/src/OSD/OSD_WNT.cxx b/src/OSD/OSD_WNT.cxx
index 92a6132..35df7de 100644
--- a/src/OSD/OSD_WNT.cxx
+++ b/src/OSD/OSD_WNT.cxx
@@ -1012,12 +1012,12 @@ BOOL MoveDirectory ( LPCTSTR oldDir, LPCTSTR newDir ) {
  BOOL                fFind;
  BOOL                retVal = FALSE;
  DIR_RESPONSE        response;
- DWORD               level;
+ LPVOID              level;
 
- if (   (  level = ( intptr_t )TlsGetValue ( dwLevel )  ) == NULL   ) {
+ if (   (  level = TlsGetValue ( dwLevel )  ) == NULL   ) {
 
-  ++level;
-  TlsSetValue (  dwLevel, ( LPVOID )level  );
+  level = ( LPVOID )(  ( char* )level + 1  );
+  TlsSetValue (  dwLevel, level  );
 
   fFind = FALSE;
   driveSrc = driveDst = pathSrc = pathDst = NULL;
@@ -1071,16 +1071,16 @@ retry:
 
   if ( fFind ) {
     
-   --level;
-   TlsSetValue (  dwLevel, ( LPVOID )level  );
+   level = ( LPVOID )(  ( char* )level - 1  );
+   TlsSetValue (  dwLevel, level  );
    return retVal;
 
   }  // end if
  
  } else {
  
-  ++level;
-  TlsSetValue (  dwLevel, ( LPVOID )level  );
+  level = ( LPVOID )(  ( char* )level + 1  );
+  TlsSetValue (  dwLevel, level  );
  
  }  // end else
 
@@ -1226,8 +1226,8 @@ retry_2:
   
  }  /* end if */
 
- --level;
- TlsSetValue (  dwLevel, ( LPVOID )level  );
+ level = ( LPVOID )(  ( char* )level - 1  );
+ TlsSetValue (  dwLevel, level  );
 
  return retVal;
 
diff --git a/src/OSD/OSD_WNT_1.cxx b/src/OSD/OSD_WNT_1.cxx
index 2269c2d..96425bb 100644
--- a/src/OSD/OSD_WNT_1.cxx
+++ b/src/OSD/OSD_WNT_1.cxx
@@ -240,13 +240,7 @@ static void __fastcall QuadWordToFileTime ( __int64 qw, PFILETIME pFt ) {
 ////////////////////////////////////////////////////////////////
 LPWORD lpwAlign (LPWORD lpIn)
 {
-  ULONG ul;
-
-  ul = (intptr_t) lpIn;
-  ul +=3;
-  ul >>=2;
-  ul <<=2;
-  return (LPWORD) ul;
+  return (LPWORD) (((char*)lpIn+3) & ~0x3);
 }
 
 int CopyAnsiToWideChar (LPWORD lpWCStr, LPSTR lpAnsiIn)

-- 
OCE packaging



More information about the debian-science-commits mailing list