INTEGRATION: CWS ooo64bit01 (1.15.44); FILE MERGED 2004/04/05 19:02:25 fa 1.15.44.5: SeekRel() should take _signed_ argument, got mixed up in initial 64-bit work 2004/03/31 16:48:55 fa 1.15.44.4: Back out of changes since 2004-03-24, focus on smaller, more integratable changes 2004/03/29 00:30:07 fa 1.15.44.3: More 64-bit changes.  'rsc' still broken, but not as much as before. 2004/03/16 23:54:16 fa 1.15.44.2: Merge cws_srx644_port64bit, other misc fixes 2004/03/15 23:18:47 fa 1.15.44.1: First bits of 64-bitness.  #i25651# & more

--- tools/source/stream/stream.cxx
+++ tools/source/stream/stream.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: stream.cxx,v $
  *
- *  $Revision: 1.15 $
+ *  $Revision: 1.16 $
  *
- *  last change: $Author: vg $ $Date: 2004-01-06 18:35:58 $
+ *  last change: $Author: rt $ $Date: 2004-06-17 13:12:34 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -108,7 +108,7 @@
 // -----------------------------------------------------------------------

 // !!! Nicht inline, wenn Operatoren <<,>> inline sind
-inline static void SwapUShort( USHORT& r )
+inline static void SwapUShort( sal_uInt16& r )
     {   r = SWAPSHORT(r);   }
 inline static void SwapShort( short& r )
     {   r = SWAPSHORT(r);   }
@@ -118,7 +118,7 @@
     {   r = SWAPSHORT(r);   }
 inline static void SwapLong( long& r )
     {   r = SWAPLONG(r);   }
-inline static void SwapULong( ULONG& r )
+inline static void SwapULong( sal_uInt32& r )
     {   r = SWAPLONG(r);   }
 inline static void SwapLongInt( int& r )
     {   r = SWAPLONG(r);   }
@@ -137,7 +137,7 @@
         }
         else
         {
-          UINT32* c = (UINT32*)(void*)&r;
+          sal_uInt32* c = (sal_uInt32*)(void*)&r;
           c[0] ^= c[1]; // zwei 32-Bit-Werte in situ vertauschen
           c[1] ^= c[0];
           c[0] ^= c[1];
@@ -160,8 +160,8 @@
           DBG_ASSERT( FALSE, "Can only swap 8-Byte-doubles\n" );
 #endif

-      UINT32* c = (UINT32*)(void*)&r;
-      UINT32  nHelp;
+      sal_uInt32* c = (sal_uInt32*)(void*)&r;
+      sal_uInt32  nHelp;
       // zwei 32-Bit-Werte in situ vertauschen
       // und die beiden 32-Bit-Werte selbst in situ drehen
       nHelp = SWAPLONG(c[0]);
@@ -223,8 +223,8 @@

 //============================================================================
 // virtual
-ErrCode SvLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
-                            ULONG * pRead) const
+ErrCode SvLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount,
+                            sal_Size * pRead) const
 {
     if (!m_pStream)
     {
@@ -233,7 +233,7 @@
     }

     m_pStream->Seek(nPos);
-    ULONG nTheRead = m_pStream->Read(pBuffer, nCount);
+    sal_Size nTheRead = m_pStream->Read(pBuffer, nCount);
     if (pRead)
         *pRead = nTheRead;
     return m_pStream->GetErrorCode();
@@ -241,8 +241,8 @@

 //============================================================================
 // virtual
-ErrCode SvLockBytes::WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
-                             ULONG * pWritten)
+ErrCode SvLockBytes::WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount,
+                             sal_Size * pWritten)
 {
     if (!m_pStream)
     {
@@ -251,7 +251,7 @@
     }

     m_pStream->Seek(nPos);
-    ULONG nTheWritten = m_pStream->Write(pBuffer, nCount);
+    sal_Size nTheWritten = m_pStream->Write(pBuffer, nCount);
     if (pWritten)
         *pWritten = nTheWritten;
     return m_pStream->GetErrorCode();
@@ -273,7 +273,7 @@

 //============================================================================
 // virtual
-ErrCode SvLockBytes::SetSize(ULONG nSize)
+ErrCode SvLockBytes::SetSize(sal_Size nSize)
 {
     if (!m_pStream)
     {
@@ -286,7 +286,7 @@
 }

 //============================================================================
-ErrCode SvLockBytes::LockRegion(ULONG, ULONG, LockType)
+ErrCode SvLockBytes::LockRegion(sal_Size, sal_Size, LockType)
 {
     DBG_ERROR("SvLockBytes::LockRegion(): Not implemented");
     return ERRCODE_NONE;
@@ -294,7 +294,7 @@

 //============================================================================

-ErrCode SvLockBytes::UnlockRegion(ULONG, ULONG, LockType)
+ErrCode SvLockBytes::UnlockRegion(sal_Size, sal_Size, LockType)
 {
     DBG_ERROR("SvLockBytes::UnlockRegion(): Not implemented");
     return ERRCODE_NONE;
@@ -311,7 +311,7 @@

     if (pStat)
     {
-        ULONG nPos = m_pStream->Tell();
+        sal_Size nPos = m_pStream->Tell();
         pStat->nSize = m_pStream->Seek(STREAM_SEEK_TO_END);
         m_pStream->Seek(nPos);
     }
@@ -336,14 +336,14 @@

 //============================================================================
 // virtual
-ErrCode SvAsyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
-                                 ULONG * pRead) const
+ErrCode SvAsyncLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount,
+                                 sal_Size * pRead) const
 {
     if (m_bTerminated)
         return SvOpenLockBytes::ReadAt(nPos, pBuffer, nCount, pRead);
     else
     {
-        ULONG nTheCount = std::min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
+        sal_Size nTheCount = std::min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
         ErrCode nError = SvOpenLockBytes::ReadAt(nPos, pBuffer, nTheCount,
                                                  pRead);
         return !nCount || nTheCount == nCount || nError ? nError :
@@ -353,14 +353,14 @@

 //============================================================================
 // virtual
-ErrCode SvAsyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer,
-                                  ULONG nCount, ULONG * pWritten)
+ErrCode SvAsyncLockBytes::WriteAt(sal_Size nPos, const void * pBuffer,
+                                  sal_Size nCount, sal_Size * pWritten)
 {
     if (m_bTerminated)
         return SvOpenLockBytes::WriteAt(nPos, pBuffer, nCount, pWritten);
     else
     {
-        ULONG nTheCount = std::min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
+        sal_Size nTheCount = std::min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
         ErrCode nError = SvOpenLockBytes::WriteAt(nPos, pBuffer, nTheCount,
                                                   pWritten);
         return !nCount || nTheCount == nCount || nError ? nError :
@@ -370,10 +370,10 @@

 //============================================================================
 // virtual
-ErrCode SvAsyncLockBytes::FillAppend(const void * pBuffer, ULONG nCount,
-                                     ULONG * pWritten)
-{
-    ULONG nTheWritten;
+ErrCode SvAsyncLockBytes::FillAppend(const void * pBuffer, sal_Size nCount,
+                                     sal_Size * pWritten)
+{
+    sal_Size nTheWritten;
     ErrCode nError = SvOpenLockBytes::WriteAt(m_nSize, pBuffer, nCount,
                                               &nTheWritten);
     if (!nError)
@@ -385,7 +385,7 @@

 //============================================================================
 // virtual
-ULONG SvAsyncLockBytes::Seek(ULONG nPos)
+sal_Size SvAsyncLockBytes::Seek(sal_Size nPos)
 {
     if (nPos != STREAM_SEEK_TO_END)
         m_nSize = nPos;
@@ -398,12 +398,12 @@
 //
 //============================================================================

-ULONG SvStream::GetData( void* pData, ULONG nSize )
+sal_Size SvStream::GetData( void* pData, sal_Size nSize )
 {
     if( !GetError() )
     {
         DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
-        ULONG nRet;
+        sal_Size nRet;
         nError = xLockBytes->ReadAt( nActPos, pData, nSize, &nRet );
         nActPos += nRet;
         return nRet;
@@ -420,12 +420,12 @@

 //========================================================================

-ULONG SvStream::PutData( const void* pData, ULONG nSize )
+sal_Size SvStream::PutData( const void* pData, sal_Size nSize )
 {
     if( !GetError() )
     {
         DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
-        ULONG nRet;
+        sal_Size nRet;
         nError = xLockBytes->WriteAt( nActPos, pData, nSize, &nRet );
         nActPos += nRet;
         return nRet;
@@ -435,7 +435,7 @@

 //========================================================================

-ULONG SvStream::SeekPos( ULONG nPos )
+sal_Size SvStream::SeekPos( sal_Size nPos )
 {
     if( !GetError() && nPos == STREAM_SEEK_TO_END )
     {
@@ -462,7 +462,7 @@

 //========================================================================

-void SvStream::SetSize( ULONG nSize )
+void SvStream::SetSize( sal_Size nSize )
 {
     DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
     nError = xLockBytes->SetSize( nSize );
@@ -572,9 +572,9 @@
 |*
 *************************************************************************/

-USHORT SvStream::IsA() const
-{
-    return (USHORT)ID_STREAM;
+sal_uInt16 SvStream::IsA() const
+{
+    return (sal_uInt16)ID_STREAM;
 }

 /*************************************************************************
@@ -603,7 +603,7 @@
 |*
 *************************************************************************/

-void SvStream::SetError( ULONG nErrorCode )
+void SvStream::SetError( sal_uInt32 nErrorCode )
 {
     if ( nError == SVSTREAM_OK )
         nError = nErrorCode;
@@ -620,11 +620,11 @@
 |*
 *************************************************************************/

-void SvStream::SetNumberFormatInt( USHORT nNewFormat )
+void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat )
 {
     nNumberFormatInt = nNewFormat;
     bSwap = FALSE;
-#ifdef __BIGENDIAN
+#ifdef OSL_BIGENDIAN
     if( nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN )
         bSwap = TRUE;
 #else
@@ -643,10 +643,10 @@
 |*
 *************************************************************************/

-void SvStream::SetBufferSize( USHORT nBufferSize )
-{
-    ULONG nActualFilePos = Tell();
-    BOOL bDontSeek = (BOOL)(pRWBuf == 0);
+void SvStream::SetBufferSize( sal_uInt16 nBufferSize )
+{
+    sal_Size nActualFilePos = Tell();
+    sal_Bool bDontSeek = (sal_Bool)(pRWBuf == 0);

     if( bIsDirty && bIsConsistent && bIsWritable )  // wg. Windows NT: Access denied
         Flush();
@@ -718,9 +718,9 @@
 |*
 *************************************************************************/

-BOOL SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet )
-{
-    BOOL bRet;
+sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet )
+{
+    sal_Bool bRet;
     ByteString aStr;

     bRet = ReadLine(aStr);
@@ -728,20 +728,20 @@
     return bRet;
 }

-BOOL SvStream::ReadLine( ByteString& rStr )
+sal_Bool SvStream::ReadLine( ByteString& rStr )
 {
     sal_Char    buf[256+1];
-    BOOL        bEnd        = FALSE;
-    ULONG       nOldFilePos = Tell();
+    sal_Bool        bEnd        = FALSE;
+    sal_Size       nOldFilePos = Tell();
     sal_Char    c           = 0;
-    ULONG       nTotalLen   = 0;
+    sal_Size       nTotalLen   = 0;

     rStr.Erase();
     while( !bEnd && !GetError() )   // !!! nicht auf EOF testen,
                                     // !!! weil wir blockweise
                                     // !!! lesen
     {
-        USHORT nLen = (USHORT)Read( buf, sizeof(buf)-1 );
+        sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-1 );
         if ( !nLen )
         {
             if ( rStr.Len() == 0 )
@@ -754,7 +754,7 @@
                 break;
         }

-        USHORT j, n;
+        sal_uInt16 j, n;
         for( j = n = 0; j < nLen ; ++j )
         {
             c = buf[j];
@@ -790,7 +790,7 @@
     if ( bEnd && (c=='\r' || c=='\n') )  // Sonderbehandlung DOS-Dateien
     {
         char cTemp;
-        ULONG nLen = Read((char*)&cTemp , sizeof(cTemp) );
+        sal_Size nLen = Read((char*)&cTemp , sizeof(cTemp) );
         if ( nLen ) {
             if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
                 Seek( nOldFilePos );
@@ -802,22 +802,22 @@
     return bEnd;
 }

-BOOL SvStream::ReadUniStringLine( String& rStr )
+sal_Bool SvStream::ReadUniStringLine( String& rStr )
 {
     sal_Unicode buf[256+1];
-    BOOL        bEnd        = FALSE;
-    ULONG       nOldFilePos = Tell();
+    sal_Bool        bEnd        = FALSE;
+    sal_Size       nOldFilePos = Tell();
     sal_Unicode c           = 0;
-    ULONG       nTotalLen   = 0;
-
-    DBG_ASSERT( sizeof(sal_Unicode) == sizeof(USHORT), "ReadUniStringLine: swapping sizeof(sal_Unicode) not implemented" );
+    sal_Size       nTotalLen   = 0;
+
+    DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "ReadUniStringLine: swapping sizeof(sal_Unicode) not implemented" );

     rStr.Erase();
     while( !bEnd && !GetError() )   // !!! nicht auf EOF testen,
                                     // !!! weil wir blockweise
                                     // !!! lesen
     {
-        USHORT nLen = (USHORT)Read( (char*)buf, sizeof(buf)-sizeof(sal_Unicode) );
+        sal_uInt16 nLen = (sal_uInt16)Read( (char*)buf, sizeof(buf)-sizeof(sal_Unicode) );
         nLen /= sizeof(sal_Unicode);
         if ( !nLen )
         {
@@ -831,7 +831,7 @@
                 break;
         }

-        USHORT j, n;
+        sal_uInt16 j, n;
         for( j = n = 0; j < nLen ; ++j )
         {
             if ( bSwap )
@@ -879,7 +879,7 @@
     return bEnd;
 }

-BOOL SvStream::ReadUniOrByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet )
+sal_Bool SvStream::ReadUniOrByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet )
 {
     if ( eSrcCharSet == RTL_TEXTENCODING_UNICODE )
         return ReadUniStringLine( rStr );
@@ -893,19 +893,19 @@
 |*
 *************************************************************************/

-BOOL SvStream::ReadCString( ByteString& rStr )
+sal_Bool SvStream::ReadCString( ByteString& rStr )
 {
     if( rStr.Len() )
         rStr.Erase();

     sal_Char buf[ 256 + 1 ];
-    BOOL bEnd = FALSE;
-    ULONG nFilePos = Tell();
+    sal_Bool bEnd = FALSE;
+    sal_Size nFilePos = Tell();

     while( !bEnd && !GetError() )
     {
-        USHORT nLen = (USHORT)Read( buf, sizeof(buf)-1 );
-        USHORT nReallyRead = nLen;
+        sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-1 );
+        sal_uInt16 nReallyRead = nLen;
         if( !nLen )
             break;

@@ -928,10 +928,10 @@
     return bEnd;
 }

-BOOL SvStream::ReadCString( String& rStr, rtl_TextEncoding eToEncode )
+sal_Bool SvStream::ReadCString( String& rStr, rtl_TextEncoding eToEncode )
 {
     ByteString sStr;
-    BOOL bRet = ReadCString( sStr );
+    sal_Bool bRet = ReadCString( sStr );
     rStr = String( sStr, eToEncode );
     return bRet;
 }
@@ -943,9 +943,9 @@
 |*
 *************************************************************************/

-BOOL SvStream::WriteUnicodeText( const String& rStr )
-{
-    DBG_ASSERT( sizeof(sal_Unicode) == sizeof(USHORT), "WriteUnicodeText: swapping sizeof(sal_Unicode) not implemented" );
+sal_Bool SvStream::WriteUnicodeText( const String& rStr )
+{
+    DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "WriteUnicodeText: swapping sizeof(sal_Unicode) not implemented" );
     if ( bSwap )
     {
         xub_StrLen nLen = rStr.Len();
@@ -968,7 +968,7 @@
     return nError == SVSTREAM_OK;
 }

-BOOL SvStream::WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding eDestCharSet )
 {
     if ( eDestCharSet == RTL_TEXTENCODING_UNICODE )
         return WriteUnicodeText( rStr );
@@ -990,26 +990,26 @@
 |*
 *************************************************************************/

-BOOL SvStream::WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet )
 {
     return WriteLine( ByteString( rStr, eDestCharSet ) );
 }

-BOOL SvStream::WriteLine( const ByteString& rStr )
+sal_Bool SvStream::WriteLine( const ByteString& rStr )
 {
     Write( rStr.GetBuffer(), rStr.Len() );
     endl(*this);
     return nError == SVSTREAM_OK;
 }

-BOOL SvStream::WriteUniStringLine( const String& rStr )
+sal_Bool SvStream::WriteUniStringLine( const String& rStr )
 {
     WriteUnicodeText( rStr );
     endlu(*this);
     return nError == SVSTREAM_OK;
 }

-BOOL SvStream::WriteUniOrByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteUniOrByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet )
 {
     if ( eDestCharSet == RTL_TEXTENCODING_UNICODE )
         return WriteUniStringLine( rStr );
@@ -1027,21 +1027,21 @@
 |*
 *************************************************************************/

-BOOL SvStream::WriteByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet )
 {
     return WriteLines( ByteString( rStr, eDestCharSet ) );
 }

-BOOL SvStream::WriteLines( const ByteString& rStr )
+sal_Bool SvStream::WriteLines( const ByteString& rStr )
 {
     ByteString aStr( rStr );
     aStr.ConvertLineEnd( eLineDelimiter );
     Write( aStr.GetBuffer(), aStr.Len() );
     endl( *this );
-    return (BOOL)(nError == SVSTREAM_OK);
-}
-
-BOOL SvStream::WriteUniStringLines( const String& rStr )
+    return (sal_Bool)(nError == SVSTREAM_OK);
+}
+
+sal_Bool SvStream::WriteUniStringLines( const String& rStr )
 {
     String aStr( rStr );
     aStr.ConvertLineEnd( eLineDelimiter );
@@ -1049,7 +1049,7 @@
     return nError == SVSTREAM_OK;
 }

-BOOL SvStream::WriteUniOrByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteUniOrByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet )
 {
     if ( eDestCharSet == RTL_TEXTENCODING_UNICODE )
         return WriteUniStringLines( rStr );
@@ -1063,7 +1063,7 @@
 |*
 *************************************************************************/

-BOOL SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet )
+sal_Bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet )
 {
     if ( eDestCharSet == RTL_TEXTENCODING_UNICODE )
         *this << ch;
@@ -1081,12 +1081,12 @@
 |*
 *************************************************************************/

-BOOL SvStream::StartWritingUnicodeText()
+sal_Bool SvStream::StartWritingUnicodeText()
 {
     SetEndianSwap( FALSE );     // write native format
     // some convention (whose? MS?)
     // upon read: 0xfeff(-257) => no swap; 0xfffe(-2) => swap
-    *this << UINT16( 0xfeff );
+    *this << sal_uInt16( 0xfeff );
     return nError == SVSTREAM_OK;
 }

@@ -1096,9 +1096,9 @@
 |*
 *************************************************************************/

-BOOL SvStream::StartReadingUnicodeText()
-{
-    UINT16 nFlag;
+sal_Bool SvStream::StartReadingUnicodeText()
+{
+    sal_uInt16 nFlag;
     *this >> nFlag;
     switch ( nFlag )
     {
@@ -1109,7 +1109,7 @@
             SetEndianSwap( !bSwap );
         break;
         default:
-            SeekRel( -((long)sizeof(nFlag)) );      // no flag, pure data
+            SeekRel( -((sal_Size)sizeof(nFlag)) );      // no flag, pure data
     }
     return nError == SVSTREAM_OK;
 }
@@ -1124,9 +1124,9 @@
 |*
 *************************************************************************/

-ULONG SvStream::SeekRel( long nPos )
-{
-    ULONG nActualPos = Tell();
+sal_Size SvStream::SeekRel( sal_sSize nPos )
+{
+    sal_Size nActualPos = Tell();
     nActualPos += nPos;
     pBufPos = pRWBuf + nActualPos;
     return Seek( nActualPos );
@@ -1142,33 +1142,25 @@
 |*
 *************************************************************************/

-SvStream& SvStream::operator >> ( USHORT& r )
-{
-    READNUMBER_WITHOUT_SWAP(USHORT,r)
+SvStream& SvStream::operator >> ( sal_uInt16& r )
+{
+    READNUMBER_WITHOUT_SWAP(sal_uInt16,r)
     if( bSwap )
         SwapUShort(r);
     return *this;
 }

-SvStream& SvStream::operator>> ( ULONG& r)
-{
-#if(__SIZEOFLONG != 4)
-    unsigned int tmp = r;
-    READNUMBER_WITHOUT_SWAP(ULONG,tmp)
-    r = tmp;
+SvStream& SvStream::operator>> ( sal_uInt32& r )
+{
+    READNUMBER_WITHOUT_SWAP(sal_uInt32,r)
     if( bSwap )
         SwapULong(r);
-#else
-    READNUMBER_WITHOUT_SWAP(ULONG,r)
-    if( bSwap )
-        SwapULong(r);
-#endif
     return *this;
 }

 SvStream& SvStream::operator >> ( long& r )
 {
-#if(__SIZEOFLONG != 4)
+#if(SAL_TYPES_SIZEOFLONG != 4)
     unsigned int tmp = r;
     READNUMBER_WITHOUT_SWAP(long,tmp)
     r = tmp;
@@ -1182,7 +1174,7 @@
     return *this;
 }

-SvStream& SvStream::operator >> ( short& r)
+SvStream& SvStream::operator >> ( short& r )
 {
     READNUMBER_WITHOUT_SWAP(short,r)
     if( bSwap )
@@ -1190,35 +1182,15 @@
     return *this;
 }

-SvStream& SvStream::operator >> ( int& r)
+SvStream& SvStream::operator >> ( int& r )
 {
     READNUMBER_WITHOUT_SWAP(int,r)
     if( bSwap )
-    {
-#if(__SIZEOFINT == 2)
-        SwapInt(r);
-#else
         SwapLongInt(r);
-#endif
-    }
-    return *this;
-}
-
-SvStream& SvStream::operator>>( unsigned int& r)
-{
-    READNUMBER_WITHOUT_SWAP(unsigned int,r)
-    if( bSwap )
-    {
-#if(__SIZEOFINT == 2)
-        SwapUInt(r);
-#else
-        SwapLongUInt(r);
-#endif
-    }
-    return *this;
-}
-
-SvStream& SvStream::operator>>( signed char& r)
+    return *this;
+}
+
+SvStream& SvStream::operator>>( signed char& r )
 {
     if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
         sizeof(signed char) <= nBufFree )
@@ -1235,7 +1207,7 @@

 // Sonderbehandlung fuer Chars wegen PutBack

-SvStream& SvStream::operator>>( char& r)
+SvStream& SvStream::operator>>( char& r )
 {
     if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
         sizeof(char) <= nBufFree )
@@ -1250,7 +1222,7 @@
     return *this;
 }

-SvStream& SvStream::operator>>( unsigned char& r)
+SvStream& SvStream::operator>>( unsigned char& r )
 {
     if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
         sizeof(char) <= nBufFree )
@@ -1265,7 +1237,7 @@
     return *this;
 }

-SvStream& SvStream::operator>>( float& r)
+SvStream& SvStream::operator>>( float& r )
 {
     // Read( (char*)&r, sizeof(float) );
     READNUMBER_WITHOUT_SWAP(float,r)
@@ -1276,7 +1248,7 @@
     return *this;
 }

-SvStream& SvStream::operator>>( double& r)
+SvStream& SvStream::operator>>( double& r )
 {
     // Read( (char*)&r, sizeof(double) );
     READNUMBER_WITHOUT_SWAP(double,r)
@@ -1289,10 +1261,10 @@

 SvStream& SvStream::operator>> ( SvStream& rStream )
 {
-    const ULONG cBufLen = 0x8000;
+    const sal_uInt32 cBufLen = 0x8000;
     char* pBuf = new char[ cBufLen ];

-    ULONG nCount;
+    sal_uInt32 nCount;
     do {
         nCount = Read( pBuf, cBufLen );
         rStream.Write( pBuf, nCount );
@@ -1312,32 +1284,25 @@
 |*
 *************************************************************************/

-SvStream& SvStream::operator<< ( USHORT v )
+SvStream& SvStream::operator<< ( sal_uInt16 v )
 {
     if( bSwap )
         SwapUShort(v);
-    WRITENUMBER_WITHOUT_SWAP(USHORT,v)
-    return *this;
-}
-
-SvStream& SvStream::operator<<  ( ULONG v)
-{
-#if(__SIZEOFLONG != 4)
-    unsigned int tmp = v;
-    if( bSwap )
-        SwapUInt(tmp);
-    WRITENUMBER_WITHOUT_SWAP(unsigned int,tmp)
-#else
+    WRITENUMBER_WITHOUT_SWAP(sal_uInt16,v)
+    return *this;
+}
+
+SvStream& SvStream::operator<<  ( sal_uInt32 v )
+{
     if( bSwap )
         SwapULong(v);
-    WRITENUMBER_WITHOUT_SWAP(ULONG,v)
-#endif
+    WRITENUMBER_WITHOUT_SWAP(sal_uInt32,v)
     return *this;
 }

 SvStream& SvStream::operator<< ( long v )
 {
-#if(__SIZEOFLONG != 4)
+#if(SAL_TYPES_SIZEOFLONG != 4)
     int tmp = v;
     if( bSwap )
         SwapInt(tmp);
@@ -1350,7 +1315,7 @@
     return *this;
 }

-SvStream& SvStream::operator<<  ( short v)
+SvStream& SvStream::operator<<  ( short v )
 {
     if( bSwap )
         SwapShort(v);
@@ -1358,21 +1323,15 @@
     return *this;
 }

-SvStream& SvStream::operator<<( int v)
+SvStream& SvStream::operator<<( int v )
 {
     if( bSwap )
-    {
-#if( __SIZEOFINT == 2 )
-        SwapInt( v );
-#else
         SwapLongInt( v );
-#endif
-    }
     WRITENUMBER_WITHOUT_SWAP(int,v)
     return *this;
 }

-SvStream& SvStream::operator<<  ( signed char v)
+SvStream& SvStream::operator<<  ( signed char v )
 {
     //SDO
     int tmp = eIOMode;
@@ -1391,24 +1350,9 @@
     return *this;
 }

-
-SvStream& SvStream::operator<<  ( unsigned int v)
-{
-    if( bSwap )
-    {
-#if( __SIZEOFINT == 2 )
-        SwapUInt( v );
-#else
-        SwapLongUInt( v );
-#endif
-    }
-    WRITENUMBER_WITHOUT_SWAP(int,v)
-    return *this;
-}
-
 // Sonderbehandlung fuer chars wegen PutBack

-SvStream& SvStream::operator<<  ( char v)
+SvStream& SvStream::operator<<  ( char v )
 {
     //SDO
     int tmp = eIOMode;
@@ -1427,7 +1371,7 @@
     return *this;
 }

-SvStream& SvStream::operator<<  ( unsigned char v)
+SvStream& SvStream::operator<<  ( unsigned char v )
 {
 //SDO
     int tmp = eIOMode;
@@ -1446,7 +1390,7 @@
     return *this;
 }

-SvStream& SvStream::operator<< ( float v)
+SvStream& SvStream::operator<< ( float v )
 {
 #ifdef UNX
     if( bSwap )
@@ -1456,7 +1400,7 @@
     return *this;
 }

-SvStream& SvStream::operator<< ( const double& r)
+SvStream& SvStream::operator<< ( const double& r )
 {
 //    Write( (char*)&r, sizeof( double ) );
 #if defined( UNX ) || defined ( MAC )
@@ -1486,11 +1430,11 @@
     return *this;
 }

-SvStream& SvStream::operator<< ( SvStream& rStream)
-{
-    const ULONG cBufLen = 0x8000;
+SvStream& SvStream::operator<< ( SvStream& rStream )
+{
+    const sal_uInt32 cBufLen = 0x8000;
     char* pBuf = new char[ cBufLen ];
-    ULONG nCount;
+    sal_uInt32 nCount;
     do {
         nCount = rStream.Read( pBuf, cBufLen );
         Write( pBuf, nCount );
@@ -1534,12 +1478,12 @@

 SvStream& SvStream::ReadByteString( ByteString& rStr )
 {
-    USHORT nLen = 0;
+    sal_uInt16 nLen = 0;
     operator>>( nLen );
     if( nLen )
     {
         char* pTmp = rStr.AllocBuffer( nLen );
-        nLen = (USHORT)Read( pTmp, nLen );
+        nLen = (sal_uInt16)Read( pTmp, nLen );
     }
     else
         rStr.Erase();
@@ -1566,7 +1510,7 @@
                 {
                     sal_Unicode c = *pStr;
                     SwapUShort(c);
-                    WRITENUMBER_WITHOUT_SWAP(USHORT,c)
+                    WRITENUMBER_WITHOUT_SWAP(sal_uInt16,c)
                 }
             }
             else
@@ -1583,7 +1527,7 @@

 SvStream& SvStream::WriteByteString( const ByteString& rStr)
 {
-    USHORT nLen = rStr.Len();
+    sal_uInt16 nLen = rStr.Len();
     operator<< ( nLen );
     if( nLen != 0 )
         Write( rStr.GetBuffer(), nLen );
@@ -1600,9 +1544,9 @@
 |*
 *************************************************************************/

-ULONG SvStream::Read( void* pData, ULONG nCount )
-{
-    ULONG nSaveCount = nCount;
+sal_Size SvStream::Read( void* pData, sal_Size nCount )
+{
+    sal_Size nSaveCount = nCount;
     if( !bIsConsistent )
         RefreshBuffer();

@@ -1617,13 +1561,13 @@
     {
         // ist Block komplett im Puffer
         eIOMode = STREAM_IO_READ;
-        if( nCount <= (ULONG)(nBufActualLen - nBufActualPos ) )
+        if( nCount <= (sal_Size)(nBufActualLen - nBufActualPos ) )
         {
             // Ja!
             memcpy(pData, pBufPos, (size_t) nCount);
-            nBufActualPos += (USHORT)nCount;
+            nBufActualPos += (sal_uInt16)nCount;
             pBufPos += nCount;
-            nBufFree -= (USHORT)nCount;
+            nBufFree -= (sal_uInt16)nCount;
         }
         else
         {
@@ -1664,17 +1608,17 @@
                 nBufFilePos += nBufActualPos;
                 SeekPos( nBufFilePos );

-                // TODO: Typecast vor GetData, USHORT nCountTmp
-                ULONG nCountTmp = GetData( pRWBuf, nBufSize );
+                // TODO: Typecast vor GetData, sal_uInt16 nCountTmp
+                sal_Size nCountTmp = GetData( pRWBuf, nBufSize );
                 if( nCryptMask )
                     EncryptBuffer(pRWBuf, nCountTmp);
-                nBufActualLen = (USHORT)nCountTmp;
+                nBufActualLen = (sal_uInt16)nCountTmp;
                 if( nCount > nCountTmp )
                 {
                     nCount = nCountTmp;  // zurueckstutzen, Eof siehe unten
                 }
                 memcpy( pData, pRWBuf, (size_t)nCount );
-                nBufActualPos = (USHORT)nCount;
+                nBufActualPos = (sal_uInt16)nCount;
                 pBufPos = pRWBuf + nCount;
             }
         }
@@ -1698,7 +1642,7 @@
 |*
 *************************************************************************/

-ULONG SvStream::Write( const void* pData, ULONG nCount )
+sal_Size SvStream::Write( const void* pData, sal_Size nCount )
 {
     if( !nCount )
         return 0;
@@ -1721,10 +1665,10 @@
     }

     eIOMode = STREAM_IO_WRITE;
-    if( nCount <= (ULONG)(nBufSize - nBufActualPos) )
+    if( nCount <= (sal_Size)(nBufSize - nBufActualPos) )
     {
         memcpy( pBufPos, pData, (size_t)nCount );
-        nBufActualPos += (USHORT)nCount;
+        nBufActualPos += (sal_uInt16)nCount;
         // wurde der Puffer erweitert ?
         if( nBufActualPos > nBufActualLen )
             nBufActualLen = nBufActualPos;
@@ -1739,7 +1683,7 @@
         {
             SeekPos( nBufFilePos );
             if( nCryptMask )
-                CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+                CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
             else
                 PutData( pRWBuf, nBufActualLen );
             bIsDirty = FALSE;
@@ -1767,9 +1711,9 @@

             // Reihenfolge!
             nBufFilePos += nBufActualPos;
-            nBufActualPos = (USHORT)nCount;
+            nBufActualPos = (sal_uInt16)nCount;
             pBufPos = pRWBuf + nCount;
-            nBufActualLen = (USHORT)nCount;
+            nBufActualLen = (sal_uInt16)nCount;
             bIsDirty = TRUE;
         }
     }
@@ -1788,7 +1732,7 @@
 |*
 *************************************************************************/

-ULONG SvStream::Seek( ULONG nFilePos )
+sal_Size SvStream::Seek( sal_Size nFilePos )
 {
     eIOMode = STREAM_IO_DONTKNOW;

@@ -1803,7 +1747,7 @@
     // Ist Position im Puffer ?
     if( nFilePos >= nBufFilePos && nFilePos <= (nBufFilePos + nBufActualLen))
     {
-        nBufActualPos = (USHORT)(nFilePos - nBufFilePos);
+        nBufActualPos = (sal_uInt16)(nFilePos - nBufFilePos);
         pBufPos = pRWBuf + nBufActualPos;
         // nBufFree korrigieren, damit wir nicht von einem
         // PutBack (ignoriert den StreamMode) getoetet werden
@@ -1827,7 +1771,7 @@
     }
 #ifdef OV_DEBUG
     {
-        ULONG nDebugTemp = nBufFilePos + nBufActualPos;
+        sal_Size nDebugTemp = nBufFilePos + nBufActualPos;
         DBG_ASSERT(Tell()==nDebugTemp,"Sync?")
     }
 #endif
@@ -1850,7 +1794,7 @@
     {
         SeekPos( nBufFilePos );
         if( nCryptMask )
-            CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+            CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
         else
             if( PutData( pRWBuf, nBufActualLen ) != nBufActualLen )
                 SetError( SVSTREAM_WRITE_ERROR );
@@ -1921,7 +1865,7 @@
         else
         {
             // 3. Fall -> Puffer vergroessern
-            memmove( pRWBuf+1, pRWBuf, (USHORT)nBufActualLen );
+            memmove( pRWBuf+1, pRWBuf, (sal_uInt16)nBufActualLen );
             nBufActualLen++;
             nBufFree++;
         }
@@ -1969,17 +1913,17 @@
     {
         SeekPos( nBufFilePos );
         if( nCryptMask )
-            CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+            CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
         else
             PutData( pRWBuf, nBufActualLen );
         bIsDirty = FALSE;
     }
     SeekPos( nBufFilePos );
-    nBufActualLen = (USHORT)GetData( pRWBuf, nBufSize );
+    nBufActualLen = (sal_uInt16)GetData( pRWBuf, nBufSize );
     if( nBufActualLen && nError == ERRCODE_IO_PENDING )
         nError = ERRCODE_NONE;
     if( nCryptMask )
-        EncryptBuffer(pRWBuf, (ULONG)nBufActualLen);
+        EncryptBuffer(pRWBuf, (sal_Size)nBufActualLen);
     bIsConsistent = TRUE;
     eIOMode = STREAM_IO_DONTKNOW;
 }
@@ -2043,10 +1987,10 @@
         SetError( SVSTREAM_GENERALERROR );
         return *this;
     }
-    ULONG nFPtr = Tell();
+    sal_Size nFPtr = Tell();
     char buf[ BUFSIZE_LONG ];
     memset( buf, 0, BUFSIZE_LONG );
-    ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+    sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 );
     if( !nTemp || nError )
     {
         SetError( SVSTREAM_GENERALERROR );
@@ -2054,13 +1998,13 @@
     }
     char *pEndPtr;
     rLong = strtol( buf, &pEndPtr, (int)nRadix );
-    nFPtr += ( (ULONG)pEndPtr - (ULONG)(&(buf[0])) );
+    nFPtr += ( (sal_Size)pEndPtr - (sal_Size)(&(buf[0])) );
     Seek( nFPtr );
     bIsEof = FALSE;
     return *this;
 }

-SvStream& SvStream::ReadNumber( ULONG& rULong )
+SvStream& SvStream::ReadNumber( sal_uInt32& rUInt32 )
 {
     EatWhite();
     if( bIsEof || nError )
@@ -2068,18 +2012,18 @@
         SetError( SVSTREAM_GENERALERROR );
         return *this;
     }
-    ULONG nFPtr = Tell();
+    sal_Size nFPtr = Tell();
     char buf[ BUFSIZE_LONG ];
     memset( buf, 0, BUFSIZE_LONG );
-    ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+    sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 );
     if( !nTemp || nError )
     {
         SetError( SVSTREAM_GENERALERROR );
         return *this;
     }
     char *pEndPtr;
-    rULong = strtoul( buf, &pEndPtr, (int)nRadix );
-    nFPtr += ( (ULONG)pEndPtr - (ULONG)buf );
+    rUInt32 = strtoul( buf, &pEndPtr, (int)nRadix );
+    nFPtr += ( (sal_uInt32)pEndPtr - (sal_uInt32)buf );
     Seek( nFPtr );
     bIsEof = FALSE;
     return *this;
@@ -2093,10 +2037,10 @@
         SetError( SVSTREAM_GENERALERROR );
         return *this;
     }
-    ULONG nFPtr = Tell();
+    sal_Size nFPtr = Tell();
     char buf[ BUFSIZE_LONG ];
     memset( buf, 0, BUFSIZE_LONG );
-    ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+    sal_Size nTemp = Read( buf, BUFSIZE_LONG-1 );
     if( !nTemp || nError )
     {
         SetError( SVSTREAM_GENERALERROR );
@@ -2104,7 +2048,7 @@
     }
     char *pEndPtr;
     rDouble = strtod( buf, &pEndPtr );
-    nFPtr += ( (ULONG)pEndPtr - (ULONG)buf );
+    nFPtr += ( (sal_Size)pEndPtr - (sal_Size)buf );
     Seek( nFPtr );
     bIsEof = FALSE;
     return *this;
@@ -2150,7 +2094,7 @@
     return *this;
 }

-SvStream& SvStream::WriteNumber( ULONG nULong )
+SvStream& SvStream::WriteNumber( sal_uInt32 nUInt32 )
 {
     char buffer[256+12];
     char pType[] = "lu"; // Nicht static!
@@ -2164,16 +2108,16 @@
     switch ( nPrintfParams )
     {
         case SPECIAL_PARAM_NONE :
-            nLen = sprintf( buffer, aFStr.GetBuffer(), nULong );
+            nLen = sprintf( buffer, aFStr.GetBuffer(), nUInt32 );
             break;
         case SPECIAL_PARAM_WIDTH :
-            nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nULong );
+            nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nUInt32 );
             break;
         case SPECIAL_PARAM_PRECISION :
-            nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision,nULong);
+            nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision, nUInt32 );
             break;
         default:
-            nLen=sprintf(buffer,aFStr.GetBuffer(),nWidth,nPrecision,nULong);
+            nLen=sprintf(buffer,aFStr.GetBuffer(),nWidth,nPrecision,nUInt32 );
     }
     Write( buffer, (long)nLen );
     return *this;
@@ -2216,12 +2160,12 @@

 #define CRYPT_BUFSIZE 1024

-ULONG SvStream::CryptAndWriteBuffer( const void* pStart, ULONG nLen)
+sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen)
 {
     unsigned char  pTemp[CRYPT_BUFSIZE];
     unsigned char* pDataPtr = (unsigned char*)pStart;
-    ULONG nCount = 0;
-    ULONG nBufCount;
+    sal_Size nCount = 0;
+    sal_Size nBufCount;
     unsigned char nMask = nCryptMask;
     do
     {
@@ -2230,9 +2174,9 @@
         else
             nBufCount = nLen;
         nLen -= nBufCount;
-        memcpy( pTemp, pDataPtr, (USHORT)nBufCount );
+        memcpy( pTemp, pDataPtr, (sal_uInt16)nBufCount );
         // **** Verschluesseln *****
-        for ( USHORT n=0; n < CRYPT_BUFSIZE; n++ )
+        for ( sal_uInt16 n=0; n < CRYPT_BUFSIZE; n++ )
         {
             unsigned char aCh = pTemp[n];
             aCh ^= nMask;
@@ -2257,12 +2201,12 @@
 |*
 *************************************************************************/

-BOOL SvStream::EncryptBuffer(void* pStart, ULONG nLen)
+sal_Bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen)
 {
     unsigned char* pTemp = (unsigned char*)pStart;
     unsigned char nMask = nCryptMask;

-    for ( ULONG n=0; n < nLen; n++, pTemp++ )
+    for ( sal_Size n=0; n < nLen; n++, pTemp++ )
     {
         unsigned char aCh = *pTemp;
         SWAPNIBBLES(aCh)
@@ -2300,7 +2244,7 @@
     }
     else // BugFix #25888#
     {
-        for( USHORT i = 0; i < nLen; i++ ) {
+        for( sal_uInt16 i = 0; i < nLen; i++ ) {
             nCryptMask ^= pStr[i];
             if( nCryptMask & 0x80 ) {
                 nCryptMask <<= 1;
@@ -2333,7 +2277,7 @@
 |*
 *************************************************************************/

-void SvStream::SyncSvStream( ULONG nNewStreamPos )
+void SvStream::SyncSvStream( sal_Size nNewStreamPos )
 {
     ClearBuffer();
     SvStream::nBufFilePos = nNewStreamPos;
@@ -2365,28 +2309,28 @@
 |*
 *************************************************************************/

-BOOL SvStream::SetStreamSize( ULONG nSize )
+sal_Bool SvStream::SetStreamSize( sal_Size nSize )
 {
 #ifdef DBG_UTIL
-    ULONG nFPos = Tell();
+    sal_Size nFPos = Tell();
 #endif
-    USHORT nBuf = nBufSize;
+    sal_uInt16 nBuf = nBufSize;
     SetBufferSize( 0 );
     SetSize( nSize );
     SetBufferSize( nBuf );
     DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed")
-    return (BOOL)(nError == 0);
+    return (sal_Bool)(nError == 0);
 }

 //============================================================================

-void SvStream::AddMark( ULONG nPos )
+void SvStream::AddMark( sal_Size nPos )
 {
 }

 //============================================================================

-void SvStream::RemoveMark( ULONG nPos )
+void SvStream::RemoveMark( sal_Size nPos )
 {
 }

@@ -2446,7 +2390,7 @@
 |*
 *************************************************************************/

-SvMemoryStream::SvMemoryStream( void* pBuffer, ULONG nBufSize,
+SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size nBufSize,
                                 StreamMode eMode )
 {
     if( eMode & STREAM_WRITE )
@@ -2472,7 +2416,7 @@
 |*
 *************************************************************************/

-SvMemoryStream::SvMemoryStream( ULONG nInitSize, ULONG nResizeOffset )
+SvMemoryStream::SvMemoryStream( sal_Size nInitSize, sal_Size nResizeOffset )
 {
     bIsWritable = TRUE;
     bOwnsData   = TRUE;
@@ -2523,9 +2467,9 @@
 |*
 *************************************************************************/

-USHORT SvMemoryStream::IsA() const
-{
-    return (USHORT)ID_MEMORYSTREAM;
+sal_uInt16 SvMemoryStream::IsA() const
+{
+    return (sal_uInt16)ID_MEMORYSTREAM;
 }

 /*************************************************************************
@@ -2538,8 +2482,8 @@
 |*
 *************************************************************************/

-void* SvMemoryStream::SetBuffer( void* pNewBuf, ULONG nCount,
-                                 BOOL bOwnsDat, ULONG nEOF )
+void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
+                                 sal_Bool bOwnsDat, sal_Size nEOF )
 {
     void* pResult;
     SetBufferSize( 0 ); // Buffering in der Basisklasse initialisieren
@@ -2579,9 +2523,9 @@
 |*
 *************************************************************************/

-ULONG SvMemoryStream::GetData( void* pData, ULONG nCount )
-{
-    ULONG nMaxCount = nEndOfData-nPos;
+sal_Size SvMemoryStream::GetData( void* pData, sal_Size nCount )
+{
+    sal_Size nMaxCount = nEndOfData-nPos;
     if( nCount > nMaxCount )
         nCount = nMaxCount;
     memcpy( pData, pBuf+nPos, (size_t)nCount );
@@ -2599,12 +2543,12 @@
 |*
 *************************************************************************/

-ULONG SvMemoryStream::PutData( const void* pData, ULONG nCount )
+sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
 {
     if( GetError() )
         return 0L;

-    ULONG nMaxCount = nSize-nPos;
+    sal_Size nMaxCount = nSize-nPos;

     // auf Ueberlauf testen
     if( nCount > nMaxCount )
@@ -2667,7 +2611,7 @@
 // nEndOfData: Erste Position im Stream, die nicht gelesen werden darf
 // nSize: Groesse des allozierten Speichers

-ULONG SvMemoryStream::SeekPos( ULONG nNewPos )
+sal_Size SvMemoryStream::SeekPos( sal_Size nNewPos )
 {
     if( nNewPos < nEndOfData )
         nPos = nNewPos;
@@ -2739,7 +2683,7 @@
 |*
 *************************************************************************/

-BOOL SvMemoryStream::AllocateMemory( ULONG nNewSize )
+sal_Bool SvMemoryStream::AllocateMemory( sal_Size nNewSize )
 {
     pBuf = (BYTE*)SvMemAlloc( nNewSize, MEM_NOCALLNEWHDL );
     return( pBuf != 0 );
@@ -2755,12 +2699,12 @@
 |*
 *************************************************************************/

-BOOL SvMemoryStream::ReAllocateMemory( long nDiff )
-{
-    BOOL bRetVal    = FALSE;
+sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff )
+{
+    sal_Bool bRetVal    = FALSE;
     long nTemp      = (long)nSize;
     nTemp           += nDiff;
-    ULONG nNewSize  = (ULONG)nTemp;
+    sal_Size nNewSize  = (sal_Size)nTemp;

     if( nNewSize )
     {
@@ -2815,7 +2759,7 @@
 |*
 *************************************************************************/

-void* SvMemoryStream::SwitchBuffer( ULONG nInitSize, ULONG nResizeOffset)
+void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize, sal_Size nResizeOffset)
 {
     Flush();
     if( !bOwnsData )
@@ -2845,7 +2789,7 @@
     return pRetVal;
 }

-void SvMemoryStream::SetSize( ULONG nNewSize )
+void SvMemoryStream::SetSize( sal_Size nNewSize )
 {
     long nDiff = (long)nNewSize - (long)nSize;
     ReAllocateMemory( nDiff );
@@ -2867,7 +2811,7 @@
 |*
 *************************************************************************/

-SvSharedMemoryStream::SvSharedMemoryStream( void* pBuffer,ULONG nBufSize,
+SvSharedMemoryStream::SvSharedMemoryStream( void* pBuffer,sal_Size nBufSize,
                                             StreamMode eMode ) :
                 SvMemoryStream( (char*)pBuffer, nBufSize, eMode )
 {
@@ -2884,8 +2828,8 @@
 |*
 *************************************************************************/

-SvSharedMemoryStream::SvSharedMemoryStream( ULONG nInitSize,
-                                            ULONG nResizeOffset) :
+SvSharedMemoryStream::SvSharedMemoryStream( sal_Size nInitSize,
+                                            sal_Size nResizeOffset) :
                 SvMemoryStream( (void*)NULL )
 {
     if( !nInitSize )
@@ -2976,9 +2920,9 @@
 |*
 *************************************************************************/

-USHORT SvSharedMemoryStream::IsA() const
-{
-    return (USHORT)ID_SHAREDMEMORYSTREAM;
+sal_uInt16 SvSharedMemoryStream::IsA() const
+{
+    return (sal_uInt16)ID_SHAREDMEMORYSTREAM;
 }

 /*************************************************************************
@@ -2991,7 +2935,7 @@
 |*
 *************************************************************************/

-void* SvSharedMemoryStream::SwitchBuffer( ULONG nInitSize, ULONG nResize )
+void* SvSharedMemoryStream::SwitchBuffer( sal_Size nInitSize, sal_Size nResize )
 {
     return (void*)SvMemoryStream::SwitchBuffer(nInitSize, nResize);
 }
@@ -3006,8 +2950,8 @@
 |*
 *************************************************************************/

-void* SvSharedMemoryStream::SetBuffer( void* pBuf, ULONG nSize, BOOL bOwnsData,
-                                       ULONG nEof)
+void* SvSharedMemoryStream::SetBuffer( void* pBuf, sal_Size nSize, sal_Bool bOwnsData,
+                                       sal_Size nEof)
 {
     return (void*)SvMemoryStream::SetBuffer((char*)pBuf,nSize,bOwnsData,nEof);
 }
@@ -3022,7 +2966,7 @@
 |*
 *************************************************************************/

-ULONG SvSharedMemoryStream::GetData( void* pData, ULONG nCount )
+sal_Size SvSharedMemoryStream::GetData( void* pData, sal_Size nCount )
 {
     return SvMemoryStream::GetData(pData, nCount);
 }
@@ -3037,7 +2981,7 @@
 |*
 *************************************************************************/

-ULONG SvSharedMemoryStream::PutData( const void* pData, ULONG nCount )
+sal_Size SvSharedMemoryStream::PutData( const void* pData, sal_Size nCount )
 {
     return SvMemoryStream::PutData(pData, nCount);
 }
@@ -3060,8 +3004,8 @@
 |*
 *************************************************************************/

-void* SvSharedMemoryStream::SetHandle( void* aHandle, ULONG nSize,
-    BOOL bOwnsData, ULONG nEOF)
+void* SvSharedMemoryStream::SetHandle( void* aHandle, sal_Size nSize,
+    sal_Bool bOwnsData, sal_Size nEOF)
 {
     DBG_ERROR("SvSharedMemoryStream::SetHandle not implemented");
     return 0;
@@ -3077,7 +3021,7 @@
 |*
 *************************************************************************/

-BOOL SvSharedMemoryStream::AllocateMemory( ULONG nNewSize )
+sal_Bool SvSharedMemoryStream::AllocateMemory( sal_Size nNewSize )
 {
     pBuf = new BYTE[ nNewSize ];
     return( pBuf != 0 );
@@ -3093,10 +3037,10 @@
 |*
 *************************************************************************/

-BOOL SvSharedMemoryStream::ReAllocateMemory( long nDiff )
-{
-    BOOL bRetVal    = FALSE;
-    ULONG nNewSize  = nSize + nDiff;
+sal_Bool SvSharedMemoryStream::ReAllocateMemory( long nDiff )
+{
+    sal_Bool bRetVal    = FALSE;
+    sal_Size nNewSize  = nSize + nDiff;
     if( nNewSize )
     {
         BYTE* pNewBuf   = new BYTE[ nNewSize ];
@@ -3154,7 +3098,7 @@
     return 0;
 }

-BOOL SvDataCopyStream::IsA(TypeId aId) const
+sal_Bool SvDataCopyStream::IsA(TypeId aId) const
 {
     return FALSE;
 }


[REF] ALPS can remove multiple indentical layers

--- src/kernel/evolution_strategy.tcc
+++ src/kernel/evolution_strategy.tcc
@@ -75,19 +75,24 @@

   pop.inc_age();

-  const auto layers(pop.layers());
-  for (auto l(decltype(layers){1}); l < layers; ++l)
-  {
-    const auto allowed(pop.env().individuals);
-    const auto current(pop.individuals(l));
+  for (auto l(pop.layers() - 1); l; --l)
+    if (almost_equal(sum->az.fit_dist(l - 1).mean(),
+                     sum->az.fit_dist(    l).mean()))
+      pop.remove_layer(l);
+
+  auto layers(pop.layers());
+
+  for (decltype(layers) l(1); l < layers; ++l)
     if (issmall(sum->az.fit_dist(l).standard_deviation()))
     {
-      if (current > allowed / 5)
-        pop.set_allowed(l, current / 2);
+      const auto current(pop.individuals(l));
+      pop.set_allowed(l, std::max(pop.env().min_individuals, current / 2));
     }
     else
+    {
+      const auto allowed(pop.env().individuals);
       pop.set_allowed(l, allowed);
-  }
+    }

   // Code executed every `age_gap` interval.
   if (sum->gen && sum->gen % pop.env().alps.age_gap == 0)


no message

no message

--- frontends/CsoundVST/ScoreGeneratorVst.cpp
+++ frontends/CsoundVST/ScoreGeneratorVst.cpp
@@ -52,6 +52,7 @@
   canProcessReplacing();        // supports both accumulating and replacing output
   wantEvents();
   open();
+  isSynth(true);
   scoreGeneratorVstFltk = new ScoreGeneratorVstFltk(this);
   setEditor(scoreGeneratorVstFltk);
   programsAreChunks(true);


Make block_manager-test work on systems without hole-punching

Commit 47c023f5eba708a184666e53d4a3000177a32fbc changed
block_manager-test so that it used a macro to return from tests that
weren't using the log block manager. This macro also needs to be
called in the Setup() method for BlockManagerTest<LogBlockManager>.

Change-Id: I56af74ad6b973c90057680be719b257109924fca
Reviewed-on: http://gerrit.cloudera.org:8080/3636
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <e07a1fd797b473a9c849e618aa2ce06d8055760b@apache.org>

--- src/kudu/fs/block_manager-test.cc
+++ src/kudu/fs/block_manager-test.cc
@@ -130,6 +130,13 @@

   gscoped_ptr<T> bm_;
 };
+
+template <>
+void BlockManagerTest<LogBlockManager>::SetUp() {
+  RETURN_NOT_LOG_BLOCK_MANAGER();
+  CHECK_OK(bm_->Create());
+  CHECK_OK(bm_->Open());
+}

 template <>
 void BlockManagerTest<FileBlockManager>::RunMultipathTest(const vector<string>& paths) {


Dylanize pointers name

Dylanize pointers name

--- src/lang-dylan/dylangenerator.cpp
+++ src/lang-dylan/dylangenerator.cpp
@@ -125,7 +125,7 @@

         } else if (dylan_type->isNativePointer()) {
             // Pointer
-            s = dylan_type->name();
+            s = "<" + dylan_type->name() + ">";
         } else if (dylan_type->isContainer()) {
             // TODO: use a container
             s = "<C-void*>";


spring, heart

spring, heart

--- CGLab01.hpp
+++ CGLab01.hpp
@@ -1,24 +1,24 @@
 /*
  TGD2151 Computer Graphics Fundamentals
  Faculty of Computing & Informatics, Multimedia University
-
+
  CGLab01.hpp
-
+
  Objective: Header File for Lab01 Demo Models / World
-
+
  (C) 2006-2015 Ya Ping Wong, All Rights Reserved.
  http://wongyaping.com
-
+
  Stanford Dragon:
  Original Model : Copyright by Stanford University
  http://graphics.stanford.edu/data/3Dscanrep/
  Low-polygons Model : Simplified by Mr. Ng Kok Why
  <kwng@mmu.edu.my>
-
+
  INSTRUCTIONS
  ============
  Please refer to CGLabmain.cpp for instructions
-
+
  SPECIAL NOTES
  =============
  * Try loading the high-polygons version of
@@ -26,7 +26,7 @@
  * Try out other models from http://graphics.stanford.edu/data/3Dscanrep/
  However, you will need to modify the file to comform to the
  format that is being used in this program.
-
+
  CHANGE LOG
  ==========
  */
@@ -42,31 +42,31 @@
 #include <vector>

 namespace CGLab01 {
-
+
     class SimplePolygon
     {
     public:
         void draw();
     };
-
+
     class SimpleTriangles
     {
     public:
         void draw();
     };
-
+
     class SimpleBox
     {
     public:
         void draw();
     };
-
+
     class SimpleTeapot
     {
     public:
         void draw();
     };
-
+
     class SimpleBouncingBall
     {
     public:
@@ -144,12 +144,14 @@
         {
             glEnable(GL_LIGHTING);

+/*
             points = {
                 {{ -4.0f, -5.0f }}, {{ -4.0f,  5.0f }},
                 {{  0.0f,  7.0f }}, {{  4.0f,  5.0f }},
                 {{  4.0f, -5.0f }}, {{  0.0f, -7.0f }}
             };

+*/
             points3d = {
                 {{ -4.0f, -5.0f,5.0f }},
                 {{  4.0f,  5.0f,5.0f }},
@@ -158,7 +160,28 @@
                 {{  16.0f, -5.0f,5.0f }},
                 {{  20.0f, -7.0f,5.0f }}
             };
-
+
+            auto circle = getCircle(2, 10);
+            for (auto &v : circle) points.push_back({{ v[0], v[2] }});
+
+            //spring:
+            points3d = generateSpline(-50, 50, 150,
+                                      [](float z)->float { return sin(z/2.0) * 15; },
+                                      [](float x)->float { return cos(x/2.0) * 15; },
+                                      [](float y)->float { return y; });
+            // heart:
+            /*
+            points3d = generateSpline(-50, 50, 150,
+                                      [](float z)->float {
+                                            float t = z/5.0;
+                                            return 16 * sin(t) * sin(t) * sin(t);
+                                        },
+                                      [](float x)->float {
+                                            float t = x/5.0;
+                                            return 13 * cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
+                                        });
+            */
+
             extrude = new Extrusion(points);
             extrude->setDepth(8);
             loft = new Loft(points, points3d);


add unit tests for ploadquad and predux4, and split packetmath unit test wrt real/complex

--- test/packetmath.cpp
+++ test/packetmath.cpp
@@ -183,11 +183,30 @@
       VERIFY(areApprox(ref, data2, PacketSize) && "ploaddup");
     }
   }
+  if(PacketSize>2)
+  {
+    for(int offset=0;offset<4;++offset)
+    {
+      for(int i=0;i<PacketSize/4;++i)
+        ref[4*i+0] = ref[4*i+1] = ref[4*i+2] = ref[4*i+3] = data1[offset+i];
+      internal::pstore(data2,internal::ploadquad<Packet>(data1+offset));
+      VERIFY(areApprox(ref, data2, PacketSize) && "ploadquad");
+    }
+  }

   ref[0] = 0;
   for (int i=0; i<PacketSize; ++i)
     ref[0] += data1[i];
   VERIFY(isApproxAbs(ref[0], internal::predux(internal::pload<Packet>(data1)), refvalue) && "internal::predux");
+
+  {
+    for (int i=0; i<4; ++i)
+      ref[i] = 0;
+    for (int i=0; i<PacketSize; ++i)
+      ref[i%4] += data1[i];
+    internal::pstore(data2, internal::predux4(internal::pload<Packet>(data1)));
+    VERIFY(areApprox(ref, data2, PacketSize>4?PacketSize/2:PacketSize) && "internal::predux4");
+  }

   ref[0] = 1;
   for (int i=0; i<PacketSize; ++i)
@@ -396,8 +415,8 @@
     CALL_SUBTEST_1( packetmath<float>() );
     CALL_SUBTEST_2( packetmath<double>() );
     CALL_SUBTEST_3( packetmath<int>() );
-    CALL_SUBTEST_1( packetmath<std::complex<float> >() );
-    CALL_SUBTEST_2( packetmath<std::complex<double> >() );
+    CALL_SUBTEST_4( packetmath<std::complex<float> >() );
+    CALL_SUBTEST_5( packetmath<std::complex<double> >() );

     CALL_SUBTEST_1( packetmath_notcomplex<float>() );
     CALL_SUBTEST_2( packetmath_notcomplex<double>() );
@@ -406,13 +425,13 @@
     CALL_SUBTEST_1( packetmath_real<float>() );
     CALL_SUBTEST_2( packetmath_real<double>() );

-    CALL_SUBTEST_1( packetmath_complex<std::complex<float> >() );
-    CALL_SUBTEST_2( packetmath_complex<std::complex<double> >() );
+    CALL_SUBTEST_4( packetmath_complex<std::complex<float> >() );
+    CALL_SUBTEST_5( packetmath_complex<std::complex<double> >() );

     CALL_SUBTEST_1( packetmath_scatter_gather<float>() );
     CALL_SUBTEST_2( packetmath_scatter_gather<double>() );
     CALL_SUBTEST_3( packetmath_scatter_gather<int>() );
-    CALL_SUBTEST_3( packetmath_scatter_gather<std::complex<float> >() );
-    CALL_SUBTEST_3( packetmath_scatter_gather<std::complex<double> >() );
-  }
-}
+    CALL_SUBTEST_4( packetmath_scatter_gather<std::complex<float> >() );
+    CALL_SUBTEST_5( packetmath_scatter_gather<std::complex<double> >() );
+  }
+}


Added namespace qualification to use of adobe::uninitialized_move(), to prevent possible name collisions with Boost librariess.

--- GG/adobe/vector.hpp
+++ GG/adobe/vector.hpp
@@ -343,7 +343,7 @@
     size_type n(std::distance(f, l));

         if (remaining() < n) reserve((adobe::max)(size() + n, 2 * size()));
-    set_finish(uninitialized_move(f, l, end()));
+    set_finish(::adobe::uninitialized_move(f, l, end()));
 }

 template <typename T, typename A>
@@ -430,7 +430,7 @@
     if (capacity() < n) {
         vector tmp;
         tmp.header_m = allocate(get_allocator(), n);
-        tmp.header_m->finish() = uninitialized_move(begin(), end(), tmp.end());
+        tmp.header_m->finish() = ::adobe::uninitialized_move(begin(), end(), tmp.end());
         swap(tmp);
     }
 }


tested: getObjectList()

tested: getObjectList()

--- test/testJsonIO.cpp
+++ test/testJsonIO.cpp
@@ -126,6 +126,12 @@
     std::cout << "Rows: " << is.nrows << std::endl;
     std::cout << "Columns: " << is.ncols << std::endl;

+    vector<ImageObject> oblist = ji.getObjectList(doc, TRAIN_TYPE, 0);
+    std::cout << "Object name: " << oblist[0].name << std::endl;
+    std::cout << "Object ID: " << oblist[0].id << std::endl;
+    std::cout << "Object region: " << oblist[0].region.xmin << " " << oblist[0].region.xmax << " " \
+        << oblist[0].region.ymin << " " << oblist[0].region.ymax << std::endl;
+
     std::cout << "==== Test End: Number of Images ====" << std::endl;
 }


Remove dead code for glTexStorage

Remove dead code for glTexStorage

This is untested and therefore would be hard to maintain as this code is modified. We can always add it back later if we decide to use it.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1531013005

Review URL: https://codereview.chromium.org/1531013005

--- src/gpu/gl/GrGLGpu.cpp
+++ src/gpu/gl/GrGLGpu.cpp
@@ -671,15 +671,12 @@
 /**
  * Determines if sized internal formats are available for the texture being created.
  *
- * @param useTexStorage The result of a call to can_use_tex_storage().
  * @param info          Info about the GL context.
  * @param textureConfig The pixel configuration for the texture being created.
  */
-static bool use_sized_format_for_texture(bool useTexStorage, const GrGLContextInfo& info,
-                                         GrPixelConfig textureConfig) {
-    // glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
-    // format for glTexImage, unlike ES3 and desktop.
-    bool useSizedFormat = useTexStorage;
+static bool use_sized_format_for_texture(const GrGLContextInfo& info, GrPixelConfig textureConfig) {
+    // ES2 requires an unsized format for glTexImage, unlike ES3 and desktop.
+    bool useSizedFormat = false;
     if (kGL_GrGLStandard == info.standard() ||
         (info.version() >= GR_GL_VER(3, 0) &&
          // ES3 only works with sized BGRA8 format if "GL_APPLE_texture_format_BGRA8888" enabled
@@ -718,25 +715,7 @@
     SkAutoSMalloc<128 * 128> tempStorage;
 #endif

-    // We currently lazily create MIPMAPs when the we see a draw with
-    // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that the
-    // MIP levels are all created when the texture is created. So for now we don't use
-    // texture storage.
-    bool useTexStorage = false &&
-                         isNewTexture &&
-                         this->glCaps().texStorageSupport();
-
-    if (useTexStorage && kGL_GrGLStandard == this->glStandard()) {
-        // 565 is not a sized internal format on desktop GL. So on desktop with
-        // 565 we always use an unsized internal format to let the system pick
-        // the best sized format to convert the 565 data to. Since TexStorage
-        // only allows sized internal formats we will instead use TexImage2D.
-        useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig;
-    }
-
-
-    bool useSizedFormat = use_sized_format_for_texture(useTexStorage, this->ctxInfo(),
-                                                       desc.fConfig);
+    bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), desc.fConfig);

     // Internal format comes from the texture desc.
     GrGLenum internalFormat = useSizedFormat ?
@@ -799,40 +778,17 @@
         GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, config_alignment(dataConfig)));
     }
     bool succeeded = true;
-    if (isNewTexture &&
-        0 == left && 0 == top &&
-        desc.fWidth == width && desc.fHeight == height) {
-        CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
-        if (useTexStorage) {
-            // We never resize  or change formats of textures.
-            GL_ALLOC_CALL(this->glInterface(),
-                          TexStorage2D(target,
-                                       1, // levels
-                                       internalFormat,
-                                       desc.fWidth, desc.fHeight));
-        } else {
-            GL_ALLOC_CALL(this->glInterface(),
-                          TexImage2D(target,
-                                     0, // level
-                                     internalFormat,
-                                     desc.fWidth, desc.fHeight,
-                                     0, // border
-                                     externalFormat, externalType,
-                                     data));
-        }
-        GrGLenum error = check_alloc_error(desc, this->glInterface());
-        if (error != GR_GL_NO_ERROR) {
+    if (isNewTexture) {
+        if (data && !(0 == left && 0 == top && desc.fWidth == width && desc.fHeight == height)) {
             succeeded = false;
         } else {
-            // if we have data and we used TexStorage to create the texture, we
-            // now upload with TexSubImage.
-            if (data && useTexStorage) {
-                GL_CALL(TexSubImage2D(target,
-                                      0, // level
-                                      left, top,
-                                      width, height,
-                                      externalFormat, externalType,
-                                      data));
+            CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
+            GL_ALLOC_CALL(this->glInterface(), TexImage2D(target, 0, internalFormat, desc.fWidth,
+                                                          desc.fHeight, 0,  externalFormat,
+                                                          externalType, data));
+            GrGLenum error = check_alloc_error(desc, this->glInterface());
+            if (error != GR_GL_NO_ERROR) {
+                succeeded = false;
             }
         }
     } else {
@@ -1287,7 +1243,7 @@
         GrGLenum internalFormat = 0x0; // suppress warning
         GrGLenum externalFormat = 0x0; // suppress warning
         GrGLenum externalType = 0x0;   // suppress warning
-        bool useSizedFormat = use_sized_format_for_texture(false, this->ctxInfo(), config);
+        bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), config);
         if (!this->configToGLFormats(config, useSizedFormat, &internalFormat,
                                      &externalFormat, &externalType)) {
             GL_CALL(DeleteTextures(1, &colorID));
@@ -3532,7 +3488,7 @@
     GrGLenum externalFormat = 0x0; // suppress warning
     GrGLenum externalType = 0x0;   // suppress warning

-    bool useSizedFormat = use_sized_format_for_texture(false, this->ctxInfo(), config);
+    bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), config);
     this->configToGLFormats(config, useSizedFormat, &internalFormat, &externalFormat,
                             &externalType);


Fix reset of scissor state in onResetContext

Review URL: http://codereview.appspot.com/6061046/

--- src/gpu/gl/GrGpuGL.cpp
+++ src/gpu/gl/GrGpuGL.cpp
@@ -516,6 +516,8 @@
     }

     fHWBounds.fScissorRect.invalidate();
+    // set to true to force disableScissor to make a GL call.
+    fHWBounds.fScissorEnabled = true;
     this->disableScissor();

     fHWBounds.fViewportRect.invalidate();
@@ -1344,7 +1346,6 @@
     if (fHWBounds.fScissorEnabled) {
         GL_CALL(Disable(GR_GL_SCISSOR_TEST));
         fHWBounds.fScissorEnabled = false;
-//        fHWBounds.fScissorRect.invalidate();
     }
 }


forgot to init SDL2

forgot to init SDL2

--- GameBoyEmu/main.cpp
+++ GameBoyEmu/main.cpp
@@ -71,6 +71,8 @@

 int main(int argc, char *argv[])
 {
+	SDL_Init(SDL_INIT_VIDEO);
+
 	Interrupts ints;
 	Timer timer(ints);
 	MMU mmu;


Move GrVkFormatColorTypePairIsValid assert back into GrVkGpu::check_image_info

Apparently Chrome is intentionally setting GrVkYcbcrConversionInfo's fFormat
field to VK_FORMAT_UNDEFINED. If that is correct we should update our tests
to match. For now this will allow the Chrome video tests to be re-enabled.

Bug: 1037949
Change-Id: Ifb985f2bcda48135f312ee7412d2859d9277a1bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263558
Reviewed-by: Brian Salomon <61fabaaf0876044aeedfd8e351e485c028d69e7b@google.com>
Commit-Queue: Robert Phillips <95e8ac5504948c7bf91b22c16a8dbb7ae7c66bfd@google.com>

--- src/gpu/vk/GrVkGpu.cpp
+++ src/gpu/vk/GrVkGpu.cpp
@@ -1086,6 +1086,7 @@

 static bool check_image_info(const GrVkCaps& caps,
                              const GrVkImageInfo& info,
+                             GrColorType colorType,
                              bool needsAllocation) {
     if (VK_NULL_HANDLE == info.fImage) {
         return false;
@@ -1108,6 +1109,10 @@
         }
     }

+    SkASSERTF(colorType == GrColorType::kUnknown ||
+              GrVkFormatColorTypePairIsValid(info.fFormat, colorType),
+              "Vulkan format/colorType mismatch - format %d colorType %d\n",
+              info.fFormat, colorType);
     return true;
 }

@@ -1143,12 +1148,10 @@
         return nullptr;
     }

-    if (!check_image_info(this->vkCaps(), imageInfo, kAdopt_GrWrapOwnership == ownership)) {
-        return nullptr;
-    }
-    SkASSERTF(GrVkFormatColorTypePairIsValid(imageInfo.fFormat, colorType),
-              "Vulkan format/colorType mismatch - format %d colorType %d\n",
-              imageInfo.fFormat, colorType);
+    if (!check_image_info(this->vkCaps(), imageInfo,
+                          colorType, kAdopt_GrWrapOwnership == ownership)) {
+        return nullptr;
+    }

     if (!check_tex_image_info(this->vkCaps(), imageInfo)) {
         return nullptr;
@@ -1181,7 +1184,8 @@
         return nullptr;
     }

-    if (!check_image_info(this->vkCaps(), imageInfo, kAdopt_GrWrapOwnership == ownership)) {
+    if (!check_image_info(this->vkCaps(), imageInfo,
+                          GrColorType::kUnknown, kAdopt_GrWrapOwnership == ownership)) {
         return nullptr;
     }

@@ -1217,10 +1221,10 @@
         return nullptr;
     }

-    if (!check_image_info(this->vkCaps(), imageInfo, kAdopt_GrWrapOwnership == ownership)) {
-        return nullptr;
-    }
-    SkASSERT(GrVkFormatColorTypePairIsValid(imageInfo.fFormat, colorType));
+    if (!check_image_info(this->vkCaps(), imageInfo, colorType,
+                          kAdopt_GrWrapOwnership == ownership)) {
+        return nullptr;
+    }

     if (!check_tex_image_info(this->vkCaps(), imageInfo)) {
         return nullptr;
@@ -1270,10 +1274,9 @@
                                                                     colorType);
     SkASSERT(kUnknown_GrPixelConfig != config);

-    if (!check_image_info(this->vkCaps(), info, false)) {
-        return nullptr;
-    }
-    SkASSERT(GrVkFormatColorTypePairIsValid(info.fFormat, colorType));
+    if (!check_image_info(this->vkCaps(), info, colorType, false)) {
+        return nullptr;
+    }

     if (!check_rt_image_info(this->vkCaps(), info, backendRT.sampleCnt())) {
         return nullptr;
@@ -1310,10 +1313,9 @@
     if (!tex.getVkImageInfo(&imageInfo)) {
         return nullptr;
     }
-    if (!check_image_info(this->vkCaps(), imageInfo, false)) {
-        return nullptr;
-    }
-    SkASSERT(GrVkFormatColorTypePairIsValid(imageInfo.fFormat, grColorType));
+    if (!check_image_info(this->vkCaps(), imageInfo, grColorType, false)) {
+        return nullptr;
+    }

     if (!check_rt_image_info(this->vkCaps(), imageInfo, sampleCnt)) {
         return nullptr;


Fix missing header

Fix missing header

exit function needs cstldib

--- src/graphic/Shader.cpp
+++ src/graphic/Shader.cpp
@@ -10,6 +10,7 @@
 #include <vector>
 #include <fstream>
 #include <iostream>
+#include <cstdlib>
 #include <stdexcept>
 #include <glm/gtc/type_ptr.hpp>


Try to fix compilation in Android armeabi

Change-Id: Icb56514b2f699abbe6db36a7aba8320316c33ed5

--- test/test_table.cpp
+++ test/test_table.cpp
@@ -20,6 +20,7 @@
 #ifdef TEST_TABLE

 #include <algorithm>
+#include <cmath>
 #include <limits>
 #include <string>
 #include <fstream>
@@ -1849,7 +1850,7 @@
     for (size_t i = 0; i < table.size(); i += 3) {
         table.set(col, i, static_cast<TEST_TYPE>(-500.0 + i));
         table.set_null(col, i + 1);
-        char nan_tag[] = {char('0' + i % 10), 0};
+        const char nan_tag[] = {char('0' + i % 10), 0};
         table.set(col, i + 2, static_cast<TEST_TYPE>(nan(nan_tag)));
     }


Clean up relative/absolute conversions

Clean up relative/absolute conversions

git-svn-id: 39e099a8ed5324aded674b764a67f7a08796d9a7@3826 662fdd30-d327-0410-a531-f549c87e1e9e

--- src/gui/coordinate.cpp
+++ src/gui/coordinate.cpp
@@ -4,38 +4,12 @@

 using namespace Gui;

-static int getHorizontalAbsolute(double x){
-    const int center = Global::getScreenWidth()/2;
+static int relativeToAbsolute(double x, int center){
     return (int)(center + (center * x));
 }

-static int getVerticalAbsolute(double y){
-    const int center = Global::getScreenHeight()/2;
-    return (int)(center + (center * y));
-}
-
-static double getHorizontalRelative(int x){
-    const int center = Global::getScreenWidth()/2;
-    if (x == center){
-        return 0;
-    } else if (x < center){
-        return -( (x/center) * .01);
-    } else if (x > center){
-        return ( ((x - center)/center) * .01);
-    }
-    return 0;
-}
-
-static double getVerticalRelative(int y){
-    const int center = Global::getScreenHeight()/2;
-    if (y == center){
-        return 0;
-    } else if (y < center){
-        return -( (y/center) * .01);
-    } else if (y > center){
-        return ( ((y - center)/center) * .01);
-    }
-    return 0;
+static double absoluteToRelative(int x, int center){
+    return (x-center)/center;
 }

 AbsolutePoint::AbsolutePoint(){
@@ -59,13 +33,13 @@
 RelativePoint::~RelativePoint(){
 }
 int RelativePoint::getX(){
-    return getHorizontalAbsolute(x);
+    return relativeToAbsolute(x,Global::getScreenWidth()/2);
 }
 int RelativePoint::getY(){
-    return getVerticalAbsolute(y);
+    return relativeToAbsolute(y,Global::getScreenHeight()/2);
 }
 AbsolutePoint RelativePoint::getAbsolute(){
-    return AbsolutePoint(getHorizontalAbsolute(x),getVerticalAbsolute(y));
+    return AbsolutePoint(relativeToAbsolute(x,Global::getScreenWidth()/2), relativeToAbsolute(y,Global::getScreenHeight()/2));
 }
 double RelativePoint::getRelativeX(){
     return x;


use iterator for looping over the outgoing edges

--- src/lib/edgedb/fallbackedgedb.cpp
+++ src/lib/edgedb/fallbackedgedb.cpp
@@ -212,13 +212,13 @@
     {
       // add the outgoing edges to the stack
       auto outgoing = edb.getOutgoingEdges(result.node);
-      for(size_t idxOutgoing=0; idxOutgoing < outgoing.size(); idxOutgoing++)
+      for(const auto& outNodeID : outgoing)
       {
-        if(visited.find(outgoing[idxOutgoing]) == visited.end())
+        if(visited.find(outNodeID) == visited.end())
         {
-          traversalStack.push(pair<nodeid_t, unsigned int>(outgoing[idxOutgoing],
+          traversalStack.push(pair<nodeid_t, unsigned int>(outNodeID,
                                                            result.distance+1));
-          visited.insert(outgoing[idxOutgoing]);
+          visited.insert(outNodeID);
         }
       }
     }


return to c++11 without c++14 make_unique TODO

--- src/lib/graphics/GLWarpShader.cpp
+++ src/lib/graphics/GLWarpShader.cpp
@@ -57,7 +57,7 @@
     attributes.push_back( std::pair<int, const char*>(RenderTexture::ATTRIB_VERTEX, "position") );
     attributes.push_back( std::pair<int, const char*>(RenderTexture::ATTRIB_TEXTUREPOSITION, "inputTextureCoordinate") );

-    m_pPlanarShaderProgram = std::make_unique<gatherer::graphics::shader_prog>(vShaderStr, fShaderStr, attributes);
+    m_pPlanarShaderProgram = make_unique<gatherer::graphics::shader_prog>(vShaderStr, fShaderStr, attributes);
     m_PlanarUniformMVP = m_pPlanarShaderProgram->GetUniformLocation("modelViewProjMatrix");
     m_PlanarUniformTexture =  m_pPlanarShaderProgram->GetUniformLocation("texture");


Cast to int.

Cast to int.

--- src/gui/tabbed-box.cpp
+++ src/gui/tabbed-box.cpp
@@ -156,7 +156,7 @@
 void TabbedBox::moveTab(int direction){
     tabs[current]->context->close();
     tabs[current]->active = false;
-    current = (current + direction + tabs.size()) % tabs.size();
+    current = ((int)current + direction + tabs.size()) % tabs.size();
     /*
     if (current == 0){
         current = tabs.size()-1;


init wpn selection for lx

init wpn selection for lx

--- src/gusanos/client.cpp
+++ src/gusanos/client.cpp
@@ -12,6 +12,9 @@
 #include "util/log.h"

 #include "netstream.h"
+#include "game/Game.h"
+#include "CGameScript.h"
+

 Client::Client() : Net_Control(false)
 {
@@ -203,9 +206,8 @@
 		if(cClient->getGameReady()) {
 			if(cClient->getStatus() == NET_PLAYING) // playing
 				player->startGame();
-			// Dont do that right now, no wpn selection in gus
-			/* else
-				player->initWeaponSelection(); */
+			else if(!game.gameScript()->gusEngineUsed())
+				player->initWeaponSelection();
 		}

 	}else if( _requested_class == Particle::classID )


fix(library/blast/forward/qcf): compilation warning

--- src/library/blast/forward/qcf.cpp
+++ src/library/blast/forward/qcf.cpp
@@ -19,7 +19,7 @@
 namespace lean {
 namespace blast {

-action_result qfc_action(list<gexpr> const & lemmas) {
+action_result qfc_action(list<gexpr> const &) {
     return action_result::failed();
 }


add chop to autoindex GFA construction

add chop to autoindex GFA construction

--- src/index_registry.cpp
+++ src/index_registry.cpp
@@ -1614,6 +1614,8 @@
             cerr << e.what() << endl;
             exit(1);
         }
+
+        handlealgs::chop(graph.get(), IndexingParameters::max_node_size);

         // save the graph
         vg::io::save_handle_graph(graph.get(), outfile);


style(itkJSONImageIO): Fix too many semi-colons KWStyle error

--- src/itkJSONImageIO.cxx
+++ src/itkJSONImageIO.cxx
@@ -123,19 +123,19 @@
       return "int16_t";

     case USHORT:
-      return "uint16_t";;
+      return "uint16_t";

     case INT:
       return "int32_t";

     case UINT:
-      return "uint32_t";;
+      return "uint32_t";

     case LONG:
       return "int64_t";

     case ULONG:
-      return "uint64_t";;
+      return "uint64_t";

     case LONGLONG:
       return "int64_t";


Fix pointer to method syntax in TagLoader class

--- src/gui/src/utils/tag-loader/tag-loader.cpp
+++ src/gui/src/utils/tag-loader/tag-loader.cpp
@@ -72,8 +72,8 @@

 	// Start loader
 	m_loader = new TagListLoader(m_profile, site, MIN_TAG_COUNT, this);
-	connect(m_loader, TagListLoader::progress, ui->labelProgress, &QLabel::setText);
-	connect(m_loader, TagListLoader::finished, this, &TagLoader::finishedLoading);
+	connect(m_loader, &TagListLoader::progress, ui->labelProgress, &QLabel::setText);
+	connect(m_loader, &TagListLoader::finished, this, &TagLoader::finishedLoading);
 	m_loader->start();
 }


* More Linux fixes

* More Linux fixes

--- src/hagglekernel/ConnectivityLocalLinux.cpp
+++ src/hagglekernel/ConnectivityLocalLinux.cpp
@@ -543,8 +543,8 @@

 		Addresses addrs;
 		addrs.add(new EthernetAddress(macaddr));
-		addrs.add(new IPv4Address(ip /*, &broadcast */));
-		//addrs.add(new IPv4BroadcastAddress(broadcast));
+		addrs.add(new IPv4Address(ip));
+		addrs.add(new IPv4BroadcastAddress(broadcast));

 		// Create the interface
 		InterfaceRef iface = Interface::create<EthernetInterface>(macaddr, ifr->ifr_name,


Adding SCOM addr translation for PPE chip units

Change-Id: I706920aead758a735283e12738cfadd49c9918ab
Original-Change-Id: I708ba2769358c606e1ea7aa36436c7ee7d2c945b
RTC: 137093
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27147
Tested-by: Jenkins Server <8e3f934e4c44875bc48d33da3ea13d93ba9a233f@us.ibm.com>
Tested-by: Hostboot CI <52521565bd8ea18a2b112942dce4f4220a97c2c8@us.ibm.com>
Reviewed-by: Joseph J. McGill <4a85c6614f9f065f63d8fd57cde15e48af07ea2a@us.ibm.com>
Dev-Ready: Brent Wieman <cab499b31cd4c652b90b4682871101e72d52e19a@us.ibm.com>
Reviewed-by: Brent Wieman <cab499b31cd4c652b90b4682871101e72d52e19a@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <ab93eca12e43608f33daa16a67357cd7b7e867ab@us.ibm.com>

--- src/import/chips/p9/common/scominfo/p9_cu.H
+++ src/import/chips/p9/common/scominfo/p9_cu.H
@@ -29,7 +29,7 @@
 /// HWP HWP Owner: jmcgill@us.ibm.com
 /// HWP FW Owner: dcrowell@us.ibm.com
 /// HWP Team: Infrastructure
-/// HWP Level: 1
+/// HWP Level: 2
 /// HWP Consumed by: FSP/HB
 ///

@@ -59,13 +59,11 @@
         PU_MCS_CHIPUNIT,     ///< MCS (Nimbus only)
         PU_MCA_CHIPUNIT,     ///< MCA (Nimbus only)
         PU_MCBIST_CHIPUNIT,  ///< MCBIST (Nimbus only)
-        PU_OCC_CHIPUNIT,     ///< OCC
         PU_PERV_CHIPUNIT,    ///< Pervasive
         PU_PPE_CHIPUNIT,     ///< PPE
         PU_SBE_CHIPUNIT,     ///< SBE
         PU_CAPP_CHIPUNIT,    ///< CAPP
-        NONE,                 ///< None/Invalid
-        PU_NVBUS_CHIPUNIT =  PU_NV_CHIPUNIT  ///< DO NOT USE!  TEMPORARY FOR CI ONLY
+        NONE,                ///< None/Invalid
     } p9ChipUnits_t;

     /// P9 chip unit pairing struct
@@ -82,6 +80,34 @@
         uint32_t chipUnitNum;        ///< chip unit instance number
     };

+    /// P9 PPE Chip Unit Instance Number enumeration
+    /// PPE name        Nimbus    Cumulus
+    /// SBE             0         0
+    /// GPE0..3         10..13    10..13
+    /// CME0            20..25    20..25
+    /// CME1            30..35    30..35
+    /// IO PPE (xbus)   40        40
+    /// IO PPE (obus)   41,42     41,42
+    /// IO PPE (dmi)    NA        43,44
+    /// Powerbus PPEs   50        50..52
+    typedef enum
+    {
+        PPE_SBE_CHIPUNIT_NUM         =  0,
+        PPE_GPE0_CHIPUNIT_NUM        = 10,
+        PPE_GPE3_CHIPUNIT_NUM        = 13,
+        PPE_EQ0_CME0_CHIPUNIT_NUM    = 20,   // Quad0-CME0
+        PPE_EQ5_CME0_CHIPUNIT_NUM    = 25,   // Quad5-CME0
+        PPE_EQ0_CME1_CHIPUNIT_NUM    = 30,   // Quad0-CME1
+        PPE_EQ5_CME1_CHIPUNIT_NUM    = 35,   // Quad5-CME1
+        PPE_IO_XBUS_CHIPUNIT_NUM     = 40,
+        PPE_IO_OB0_CHIPUNIT_NUM      = 41,
+        PPE_IO_OB1_CHIPUNIT_NUM      = 42,
+        PPE_IO1_DMI_CHIPUNIT_NUM     = 44,
+        PPE_PB0_CHIPUNIT_NUM         = 50,
+        PPE_PB2_CHIPUNIT_NUM         = 52,
+        PPE_LAST_CHIPUNIT_NUM        = PPE_PB2_CHIPUNIT_NUM,
+    } p9_ppe_chip_unit_instance_num_t;
+
 } // extern "C"

 #endif /* P9_CU_H */


leave 60tick temporarily

leave 60tick temporarily

--- game_framework/scene_builders/testbed.cpp
+++ game_framework/scene_builders/testbed.cpp
@@ -278,7 +278,7 @@
 		input.add_context(active_context);

 		if (input.found_recording()) {
-			world.parent_overworld.configure_stepping(128.0, 500);
+			world.parent_overworld.configure_stepping(60, 500);
 			world.parent_overworld.delta_timer.set_stepping_speed_multiplier(6.00);

 			input.replay_found_recording();
@@ -286,7 +286,7 @@
 			world.get_system<render_system>().enable_interpolation = false;
 		}
 		else {
-			world.parent_overworld.configure_stepping(128, 50000);
+			world.parent_overworld.configure_stepping(60, 500);
 			world.parent_overworld.delta_timer.set_stepping_speed_multiplier(1.0);

 			world.get_system<render_system>().enable_interpolation = true;


Return right category of error. Use INVALID_ARGUMENT when the input is incorrect. (#1248)

* Return the right category of error.

* Return right category of error

--- onnxruntime/core/framework/tensorprotoutils.cc
+++ onnxruntime/core/framework/tensorprotoutils.cc
@@ -55,10 +55,10 @@
   {
     size_t expected_size_in_bytes;
     if (!onnxruntime::IAllocator::CalcMemSizeForArray(expected_size, sizeof(T), &expected_size_in_bytes)) {
-      return Status(onnxruntime::common::ONNXRUNTIME, onnxruntime::common::FAIL, "size overflow");
+      return Status(onnxruntime::common::ONNXRUNTIME, onnxruntime::common::INVALID_ARGUMENT, "size overflow");
     }
     if (raw_data_length != expected_size_in_bytes)
-      return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
+      return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
                              "UnpackTensor: the pre-allocated size does not match the raw data size, expected ",
                              expected_size_in_bytes, ", got ", raw_data_length);
     if (IsLittleEndianOrder()) {
@@ -80,33 +80,32 @@
 }
 }  // namespace

-
 namespace onnxruntime {
 namespace utils {

 // This macro doesn't work for Float16/bool/string tensors
-#define DEFINE_UNPACK_TENSOR(T, Type, field_name, field_size)                                                 \
-  template <>                                                                                \
-  Status UnpackTensor(const ONNX_NAMESPACE::TensorProto& tensor, const void* raw_data, size_t raw_data_len,   \
-                      /*out*/ T* p_data, int64_t expected_size) {                                             \
-    if (nullptr == p_data) {                                                                                \
-      const size_t size = raw_data != nullptr ? raw_data_len : tensor.field_size();                           \
-      if (size == 0) return Status::OK();                                                                     \
-      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT);                                           \
-    }                                                                                \
-    if (nullptr == p_data || Type != tensor.data_type()) {                                                    \
-      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT);                                           \
-    }                                                                                \
-    if (raw_data != nullptr) {                                                                                \
-      return UnpackTensorWithRawData(raw_data, raw_data_len, expected_size, p_data);                          \
-    }                                                                                \
-    if (tensor.field_size() != expected_size)                                                                 \
-      return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "corrupted protobuf data: tensor shape size(", expected_size, \
-                             ") does not match the data size(", tensor.field_size(), ") in proto");           \
-    auto& data = tensor.field_name();                                                                         \
-    for (auto data_iter = data.cbegin(); data_iter != data.cend(); ++data_iter)                               \
-      *p_data++ = *reinterpret_cast<const T*>(data_iter);                                                     \
-    return Status::OK();                                                                                \
+#define DEFINE_UNPACK_TENSOR(T, Type, field_name, field_size)                                                             \
+  template <>                                                                                \
+  Status UnpackTensor(const ONNX_NAMESPACE::TensorProto& tensor, const void* raw_data, size_t raw_data_len,               \
+                      /*out*/ T* p_data, int64_t expected_size) {                                                         \
+    if (nullptr == p_data) {                                                                                \
+      const size_t size = raw_data != nullptr ? raw_data_len : tensor.field_size();                                       \
+      if (size == 0) return Status::OK();                                                                                \
+      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT);                                                       \
+    }                                                                                \
+    if (nullptr == p_data || Type != tensor.data_type()) {                                                                \
+      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT);                                                       \
+    }                                                                                \
+    if (raw_data != nullptr) {                                                                                \
+      return UnpackTensorWithRawData(raw_data, raw_data_len, expected_size, p_data);                                      \
+    }                                                                                \
+    if (tensor.field_size() != expected_size)                                                                             \
+      return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "corrupted protobuf data: tensor shape size(", expected_size, \
+                             ") does not match the data size(", tensor.field_size(), ") in proto");                       \
+    auto& data = tensor.field_name();                                                                                \
+    for (auto data_iter = data.cbegin(); data_iter != data.cend(); ++data_iter)                                           \
+      *p_data++ = *reinterpret_cast<const T*>(data_iter);                                                                 \
+    return Status::OK();                                                                                \
   }

 // TODO: complex64 complex128
@@ -134,7 +133,7 @@
   }

   if (tensor.string_data_size() != expected_size)
-    return Status(common::ONNXRUNTIME, common::FAIL,
+    return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
                   "UnpackTensor: the pre-allocate size does not match the size in proto");

   auto& string_data = tensor.string_data();
@@ -161,7 +160,7 @@
   }

   if (tensor.int32_data_size() != expected_size)
-    return Status(common::ONNXRUNTIME, common::FAIL,
+    return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
                   "UnpackTensor: the pre-allocate size does not match the size in proto");
   for (int iter : tensor.int32_data()) {
     *p_data++ = static_cast<bool>(iter);
@@ -186,14 +185,14 @@
   }

   if (tensor.int32_data_size() != expected_size)
-    return Status(common::ONNXRUNTIME, common::FAIL,
+    return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
                   "UnpackTensor: the pre-allocate size does not match the size in proto");

   constexpr int max_value = std::numeric_limits<uint16_t>::max();
   for (int i = 0; i < static_cast<int>(expected_size); i++) {
     int v = tensor.int32_data()[i];
     if (v < 0 || v > max_value) {
-      return Status(common::ONNXRUNTIME, common::FAIL, "data overflow");
+      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "data overflow");
     }
     p_data[i] = MLFloat16(static_cast<uint16_t>(v));
   }
@@ -220,14 +219,14 @@
   }

   if (tensor.int32_data_size() != expected_size)
-    return Status(common::ONNXRUNTIME, common::FAIL,
+    return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
                   "UnpackTensor: the pre-allocate size does not match the size in proto");

   constexpr int max_value = std::numeric_limits<uint16_t>::max();
   for (int i = 0; i < static_cast<int>(expected_size); i++) {
     int v = tensor.int32_data()[i];
     if (v < 0 || v > max_value) {
-      return Status(common::ONNXRUNTIME, common::FAIL, "data overflow");
+      return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "data overflow");
     }
     p_data[i] = BFloat16(static_cast<uint16_t>(v));
   }
@@ -235,11 +234,11 @@
   return Status::OK();
 }

-#define CASE_PROTO_TRACE(X, Y)                                                            \
-  case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_##X:                    \
-    if (!IAllocator::CalcMemSizeForArrayWithAlignment<alignment>(size, sizeof(Y), out)) { \
-      return common::Status(common::ONNXRUNTIME, common::FAIL, "Invalid TensorProto");    \
-    }                                                                                \
+#define CASE_PROTO_TRACE(X, Y)                                                                     \
+  case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_##X:                             \
+    if (!IAllocator::CalcMemSizeForArrayWithAlignment<alignment>(size, sizeof(Y), out)) {          \
+      return common::Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "Invalid TensorProto"); \
+    }                                                                                \
     break;

 template <size_t alignment>
@@ -248,10 +247,10 @@
   size_t size = 1;
   for (google::protobuf::int64 dim : dims) {
     if (dim < 0 || static_cast<uint64_t>(dim) >= std::numeric_limits<size_t>::max()) {
-      return common::Status(common::ONNXRUNTIME, common::FAIL, "Invalid TensorProto");
+      return common::Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "Invalid TensorProto");
     }
     if (!IAllocator::CalcMemSizeForArray(size, static_cast<size_t>(dim), &size)) {
-      return common::Status(common::ONNXRUNTIME, common::FAIL, "Invalid TensorProto");
+      return common::Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "Invalid TensorProto");
     }
   }
   switch (tensor_proto.data_type()) {
@@ -285,7 +284,6 @@
   return tensor_shape_vec;
 }

-
 struct UnInitializeParam {
   void* preallocated;
   size_t preallocated_size;
@@ -377,7 +375,7 @@
   {
     if (tensor_proto.data_location() == TensorProto_DataLocation_EXTERNAL) {
       if (ele_type == ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING)
-        return Status(common::ONNXRUNTIME, common::FAIL, "string tensor can not have raw data");
+        return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "string tensor can not have raw data");

       std::unique_ptr<ExternalDataInfo> external_data_info;
       ORT_RETURN_IF_ERROR(ExternalDataInfo::Create(tensor_proto.external_data(), external_data_info));
@@ -393,12 +391,12 @@
       {
         void* file_data;
         ORT_RETURN_IF_ERROR(env.ReadFileAsString(full_path.c_str(), external_data_info->GetOffset(),
-            file_data, raw_data_len, deleter_for_file_data.d));
+                                                 file_data, raw_data_len, deleter_for_file_data.d));
         raw_data = file_data;
       }
     } else if (tensor_proto.has_raw_data()) {
       if (ele_type == ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING)
-        return Status(common::ONNXRUNTIME, common::FAIL, "string tensor can not have raw data");
+        return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "string tensor can not have raw data");
       raw_data = tensor_proto.raw_data().data();
       raw_data_len = tensor_proto.raw_data().size();
     }
@@ -411,7 +409,7 @@
       int64_t tensor_size = 1;
       {
         for (auto i : tensor_proto.dims()) {
-          if (i < 0) return Status(common::ONNXRUNTIME, common::FAIL, "tensor can't contain negative dims");
+          if (i < 0) return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, "tensor can't contain negative dims");
           tensor_size *= i;
         }
       }
@@ -426,7 +424,7 @@
       }

       if (preallocated && preallocated_size < size_to_allocate)
-        return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
+        return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
                                "The buffer planner is not consistent with tensor buffer size, expected ",
                                size_to_allocate, ", got ", preallocated_size);
       switch (tensor_proto.data_type()) {


Support profile_file_prefix in python binding (#5864)


Small refactoring in SkImage_Codec

Small refactoring in SkImage_Codec

BUG=skia:2947
R=junov@chromium.org, reed@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/579773003

--- src/image/SkImage_Codec.cpp
+++ src/image/SkImage_Codec.cpp
@@ -25,6 +25,8 @@
     virtual bool isOpaque() const SK_OVERRIDE;

 private:
+    bool ensureBitmapDecoded() const;
+
     SkData*     fEncodedData;
     SkBitmap    fBitmap;

@@ -42,26 +44,31 @@
     fEncodedData->unref();
 }

-void SkImage_Codec::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
+bool SkImage_Codec::ensureBitmapDecoded() const {
     if (!fBitmap.pixelRef()) {
         // todo: this needs to be thread-safe
         SkBitmap* bitmap = const_cast<SkBitmap*>(&fBitmap);
         if (!SkImageDecoder::DecodeMemory(fEncodedData->bytes(), fEncodedData->size(), bitmap)) {
-            return;
+            return false;
         }
     }
+    return true;
+}
+
+void SkImage_Codec::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
+    if(!this->ensureBitmapDecoded()) {
+        return;
+    }
+
     canvas->drawBitmap(fBitmap, x, y, paint);
 }

 void SkImage_Codec::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
                                      const SkPaint* paint) const {
-    if (!fBitmap.pixelRef()) {
-        // todo: this needs to be thread-safe
-        SkBitmap* bitmap = const_cast<SkBitmap*>(&fBitmap);
-        if (!SkImageDecoder::DecodeMemory(fEncodedData->bytes(), fEncodedData->size(), bitmap)) {
-            return;
-        }
+    if(!this->ensureBitmapDecoded()) {
+        return;
     }
+
     canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
 }


wx: Fixed RunCmd enable error

wx: Fixed RunCmd enable error

git-svn-id: 7e36d3665aeca4d4e1f6df8911a80efc6ef565e7@5119 1f79f812-37fb-46fe-a122-30589dd2bf55

--- pwsafe/pwsafe/src/ui/wxWidgets/passwordsafeframe.cpp
+++ pwsafe/pwsafe/src/ui/wxWidgets/passwordsafeframe.cpp
@@ -1744,7 +1744,7 @@
     case ID_COPYRUNCOMMAND:
     {
       CItemData* item = GetBaseOfSelectedEntry();
-      evt.Enable(item && item->IsRunCommandEmpty());
+      evt.Enable(item && !item->IsRunCommandEmpty());
       break;
     }
     case ID_CREATESHORTCUT:


StateManagerGL: Use dirty bits for program binding.

BUG=angleproject:2188

Change-Id: I7456692e779107514ab87bfb1a0ab91178c9fc3a
Reviewed-on: https://chromium-review.googlesource.com/797356
Reviewed-by: Jamie Madill <7e492b4f1c8458024932de3ba475cbf015424c30@chromium.org>

--- src/libANGLE/renderer/gl/StateManagerGL.cpp
+++ src/libANGLE/renderer/gl/StateManagerGL.cpp
@@ -849,9 +849,6 @@

     // Sync the current program state
     const gl::Program *program = glState.getProgram();
-    const ProgramGL *programGL = GetImplAs<ProgramGL>(program);
-    useProgram(programGL->getProgramID());
-
     for (size_t uniformBlockIndex = 0; uniformBlockIndex < program->getActiveUniformBlockCount();
          uniformBlockIndex++)
     {
@@ -1933,8 +1930,16 @@
                 // TODO: implement this
                 break;
             case gl::State::DIRTY_BIT_PROGRAM_BINDING:
+            {
                 mProgramTexturesAndSamplersDirty = true;
-                break;
+
+                gl::Program *program = state.getProgram();
+                if (program != nullptr)
+                {
+                    useProgram(GetImplAs<ProgramGL>(program)->getProgramID());
+                }
+                break;
+            }
             case gl::State::DIRTY_BIT_TEXTURE_BINDINGS:
                 mProgramTexturesAndSamplersDirty = true;
                 break;


istream/file: fold CloseHandle() into destructor

--- src/istream/FileIstream.cxx
+++ src/istream/FileIstream.cxx
@@ -85,22 +85,15 @@

 	~FileIstream() noexcept {
 		retry_event.Cancel();
+
+		if (fd.IsDefined())
+			fd.Close();
+
+		buffer.FreeIfDefined();
 	}

 private:
-	void CloseHandle() noexcept {
-		if (!fd.IsDefined())
-			return;
-
-		retry_event.Cancel();
-
-		fd.Close();
-
-		buffer.FreeIfDefined();
-	}
-
 	void Abort(std::exception_ptr ep) noexcept {
-		CloseHandle();
 		DestroyError(ep);
 	}

@@ -114,7 +107,6 @@
 	void EofDetected() noexcept {
 		assert(fd.IsDefined());

-		CloseHandle();
 		DestroyEof();
 	}

@@ -152,7 +144,6 @@

 	int _AsFd() noexcept override;
 	void _Close() noexcept override {
-		CloseHandle();
 		Destroy();
 	}
 };


ENH: Fix build problem

ENH: Fix build problem

--- IO/vtkCGMWriter.cxx
+++ IO/vtkCGMWriter.cxx
@@ -27,7 +27,7 @@
 #include "vtkCellData.h"
 #include "vtkObjectFactory.h"

-vtkCxxRevisionMacro(vtkCGMWriter, "1.9");
+vtkCxxRevisionMacro(vtkCGMWriter, "1.10");
 vtkStandardNewMacro(vtkCGMWriter);

 vtkCxxSetObjectMacro(vtkCGMWriter, Viewport, vtkViewport);
@@ -535,7 +535,8 @@
   vtkDataArray *inScalars=input->GetCellData()->GetScalars();
   vtkIdType numCells=input->GetNumberOfCells(), cellId;
   vtkIdType numPts=input->GetNumberOfPoints();
-  int i, id, type, npts, size[2], *p;
+  int i, id, type, npts, size[2];
+  vtkIdType *p;
   float bounds[6], xRange, yRange, x[3], factor[2];
   int color, bpp, colorMode;
   unsigned char *ptr, *colors;


[httpclient] connect to QNetworkReply::uploadProgress() immediately

Slot handleAuthenticationRequired() may not be called at all.

--- src/libs/httpclient/creporterhttpclient.cpp
+++ src/libs/httpclient/creporterhttpclient.cpp
@@ -173,6 +173,8 @@
     connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
             this, SLOT(handleError(QNetworkReply::NetworkError)));
     connect(m_reply, SIGNAL(finished()), this, SLOT(handleFinished()));
+    connect(m_reply, &QNetworkReply::uploadProgress,
+            this, &CReporterHttpClientPrivate::handleUploadProgress);

     stateChange(CReporterHttpClient::Connecting);
     return true;
@@ -204,10 +206,9 @@
 void CReporterHttpClientPrivate::handleAuthenticationRequired(QNetworkReply *reply,
                                                         QAuthenticator *authenticator)
 {
+    Q_UNUSED(reply)
+
 	qDebug() << __PRETTY_FUNCTION__ << "Fill in the credentials.";
-
-    connect(reply, SIGNAL(uploadProgress(qint64,qint64)),
-            this, SLOT(handleUploadProgress(qint64,qint64)));

 	// Fill in the credentials.
     authenticator->setUser(CReporterApplicationSettings::instance()->username());