fix m/z mix-up in screening length calculation (thanks Topher Matthews for spotting this)


#90708#, #90715# HACK: decide wich URLs are loadable or not; use right target for macro URLs

--- framework/source/dispatch/dispatchprovider.cxx
+++ framework/source/dispatch/dispatchprovider.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: dispatchprovider.cxx,v $
  *
- *  $Revision: 1.6 $
- *
- *  last change: $Author: as $ $Date: 2001-08-02 13:33:00 $
+ *  $Revision: 1.7 $
+ *
+ *  last change: $Author: as $ $Date: 2001-08-08 09:52:46 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -126,9 +126,14 @@
 #ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
 #include <com/sun/star/uno/Exception.hpp>
 #endif
-
+/*
+... needed by implts_isLoadableContent() ... but not yet!
 #ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
 #include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+*/
+#ifndef _COM_SUN_STAR_DOCUMENT_XTYPEDETECTION_HPP_
+#include <com/sun/star/document/XTypeDetection.hpp>
 #endif

 //_________________________________________________________________________________________________________________
@@ -260,6 +265,14 @@
     // Set default return value if query failed.
     css::uno::Reference< css::frame::XDispatch > xReturn;

+    /* HACK */
+    ::rtl::OUString sNewTarget = sTargetFrameName;
+    if( aURL.Complete.compareToAscii( "macro:", 6 ) == 0 )
+    {
+        sNewTarget = DECLARE_ASCII("_self");
+    }
+    /* HACK */
+
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     ReadGuard aReadLock( m_aLock );

@@ -275,7 +288,7 @@
     {
         // Classify target of this dispatch call to find right dispatch helper!
         // Try to get neccessary informations from tree environment.
-        TargetInfo   aInfo  ( xOwner, sTargetFrameName, nSearchFlags );
+        TargetInfo   aInfo  ( xOwner, sNewTarget, nSearchFlags );
         ETargetClass eResult= TargetFinder::classifyQueryDispatch( aInfo );
         switch( eResult )
         {
@@ -289,7 +302,7 @@
                                             css::uno::Reference< css::frame::XDispatchProvider > xController( xOwner->getController(), css::uno::UNO_QUERY );
                                             if( xController.is() == sal_True )
                                             {
-                                                xReturn = xController->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
+                                                xReturn = xController->queryDispatch( aURL, sNewTarget, nSearchFlags );
                                             }
                                         }
                                         // If controller has no fun to dispatch these URL - we must search another right dispatcher.
@@ -315,7 +328,7 @@
                                         css::uno::Reference< css::frame::XDispatchProvider > xParent( xOwner->getCreator(), css::uno::UNO_QUERY );
                                         if( xParent.is() == sal_True )
                                         {
-                                            xReturn = xParent->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
+                                            xReturn = xParent->queryDispatch( aURL, sNewTarget, nSearchFlags );
                                         }
                                     }
                                     break;
@@ -331,7 +344,7 @@
                                             css::uno::Reference< css::frame::XDispatchProvider > xController( xOwner->getController(), css::uno::UNO_QUERY );
                                             if( xController.is() == sal_True )
                                             {
-                                                xReturn = xController->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
+                                                xReturn = xController->queryDispatch( aURL, sNewTarget, nSearchFlags );
                                             }
                                         }
                                     }
@@ -354,7 +367,7 @@
             case E_FLAT_BOTH     :  {
                                         sal_Int32 nNewFlags  =  nSearchFlags                       ;
                                                   nNewFlags &= ~css::frame::FrameSearchFlag::CREATE;
-                                        css::uno::Reference< css::frame::XFrame > xFrame = xOwner->findFrame( sTargetFrameName, nNewFlags );
+                                        css::uno::Reference< css::frame::XFrame > xFrame = xOwner->findFrame( sNewTarget, nNewFlags );
                                         if( xFrame.is() == sal_True )
                                         {
                                             xReturn = css::uno::Reference< css::frame::XDispatchProvider >( xFrame, css::uno::UNO_QUERY )->queryDispatch( aURL, SPECIALTARGET_SELF, 0 );
@@ -366,7 +379,7 @@
                                           )
                                         {
                                             css::uno::Any aParameter;
-                                            aParameter <<= sTargetFrameName;
+                                            aParameter <<= sNewTarget;
                                             xReturn = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, aParameter );
                                         }
                                     }
@@ -585,15 +598,14 @@
     }
     else
     //-------------------------------------------------------------------------------------------------------------
-    // May be - it's an internal URL ... like "uno/slot/macro"?
+    // May be - it's an internal URL ... like "uno/slot"?
     // But they could be handled by tasks/pluginframes/desktop only.
     // Normal frames don't know it.
     // Supported targets don't know it real too ... but they could ask the global
     // sfx-AppDispatcher!!!
     if(
         ( aURL.Complete.compareToAscii( ".uno"  , 4 ) == 0 ) ||
-        ( aURL.Complete.compareToAscii( "slot:" , 5 ) == 0 ) ||
-        ( aURL.Complete.compareToAscii( "macro:", 6 ) == 0 )
+        ( aURL.Complete.compareToAscii( "slot:" , 5 ) == 0 )
       )
     {
         if(
@@ -763,22 +775,18 @@
 }

 /*-************************************************************************************************************//**
-    @short      check URL for support by our used ucb
+    @short      check URL for support by our used loader or handler
     @descr      If we must return our own dispatch helper implementations (self, blank, create dispatcher!)
-                we should be shure, that URL describe any loadable content. Otherwise slot/macro/uno URLs
+                we should be shure, that URL describe any loadable content. Otherwise slot/uno URLs
                 will be detected ... but there exist nothing to detect!

-    @attention  We return True, if ucb isn't available too! Because: may be he isn't installed for local cases ...
-                and loading of document work on OSL functions only. Then we should try to load it without any checks before.
-                It will be fast enough. Faster then "tra to loading with ucb ... and get any failed messages"!!!
-
     @seealso    method queryDispatch()

     @param      "aURL", URL which should be "detected"
-    @return     True  , if ucb could handle that OR ISN'T AVAILABLE
+    @return     True  , if somewhere could handle that
                 False , otherwise

-    @onerror    We return True.
+    @onerror    We return False.
     @threadsafe yes
 *//*-*************************************************************************************************************/
 sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL )
@@ -789,36 +797,47 @@

     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     ReadGuard aReadLock( m_aLock );
-    css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
+    css::uno::Reference< css::document::XTypeDetection > xDetection( m_xFactory->createInstance( SERVICENAME_TYPEDETECTION ), css::uno::UNO_QUERY );
     aReadLock.unlock();
     /* UNSAFE AREA --------------------------------------------------------------------------------------------- */

-    sal_Bool bLoadable = sal_True;
-
+    sal_Bool bLoadable = sal_False;
+
+    if( xDetection.is() == sal_True )
+    {
+        ::rtl::OUString sTypeName = xDetection->queryTypeByURL( aURL.Complete );
+        bLoadable = (sTypeName.getLength()>0);
+    }
+
+    return bLoadable;
+/*
     // Check some well known protocols before you ask the ucb.
     // Result will be clear ... and we save time!
     if(
-        ( aURL.Protocol.compareToAscii( ".uno"  , 4 ) == 0 ) ||
-        ( aURL.Protocol.compareToAscii( "slot:" , 5 ) == 0 ) ||
-        ( aURL.Protocol.compareToAscii( "macro:", 6 ) == 0 )
+        ( aURL.Complete.compareToAscii( ".uno"  , 4 ) == 0 ) ||
+        ( aURL.Complete.compareToAscii( "slot:" , 5 ) == 0 )
       )
     {
         bLoadable = sal_False;
     }
     else
-    if( aURL.Complete.compareToAscii( "private:factory/", 16 ) == 0 )
+    if(
+        ( aURL.Complete.compareToAscii( "private:factory/", 16 ) == 0 ) ||
+        ( aURL.Complete.compareToAscii( "macro:"          ,  6 ) == 0 )
+      )
     {
         bLoadable = sal_True;
     }
     else
     {
+        // ... and try to find content handler or frame loader
         css::uno::Reference< css::ucb::XContentProviderManager > xUCB( xFactory->createInstance( SERVICENAME_UCBCONTENTBROKER ), css::uno::UNO_QUERY );
         if( xUCB.is() == sal_True )
         {
             bLoadable = xUCB->queryContentProvider( aURL.Complete ).is();
         }
     }
-    return bLoadable;
+*/
 }

 /*-************************************************************************************************************//**


#90251# As much as possible, avoid the use of the SwStyleSheetIterator in the XIndexAccess methods

--- sw/source/core/unocore/unostyle.cxx
+++ sw/source/core/unocore/unostyle.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: unostyle.cxx,v $
  *
- *  $Revision: 1.34 $
+ *  $Revision: 1.35 $
  *
- *  last change: $Author: mtg $ $Date: 2001-10-24 15:51:20 $
+ *  last change: $Author: mtg $ $Date: 2001-10-29 15:16:14 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -209,8 +209,7 @@
 #ifndef _FMTFSIZE_HXX
 #include <fmtfsize.hxx>
 #endif
-#define STYLE_FAMILY_COUNT 5            // wir habe fuenf Familien
-
+#define STYLE_FAMILY_COUNT 5            // we have 5 style families
 #define TYPE_BOOL       0
 #define TYPE_SIZE       1
 #define TYPE_BRUSH      2
@@ -241,9 +240,9 @@
  *
  ******************************************************************************/
 //convert FN_... to RES_ in header and footer itemset
-USHORT lcl_ConvertFNToRES(USHORT nFNId)
-{
-    USHORT nRes = USHRT_MAX;
+sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
+{
+    sal_uInt16 nRes = USHRT_MAX;
     switch(nFNId)
     {
         case FN_UNO_FOOTER_ON:
@@ -639,56 +638,279 @@
 {

 }
+sal_Int32 lcl_GetCountOrName ( const SwDoc &rDoc, SfxStyleFamily eFamily, String *pString, sal_uInt16 nIndex = USHRT_MAX )
+{
+    sal_Int32 nCount = 0;
+    switch( eFamily )
+    {
+        case SFX_STYLE_FAMILY_CHAR:
+        {
+            sal_uInt16 nBaseCount =  RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN  +
+                                     RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
+            nIndex -= nBaseCount;
+            const sal_uInt16 nArrLen = rDoc.GetCharFmts()->Count();
+            for( sal_uInt16 i = 0; i < nArrLen; i++ )
+            {
+                SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
+                if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
+                    continue;
+                if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+                {
+                    nCount++;
+                    if ( nIndex == i )
+                    {
+                        *pString = pFmt->GetName();
+                        break;
+                    }
+                }
+            }
+            nCount += nBaseCount;
+        }
+        break;
+        case SFX_STYLE_FAMILY_PARA:
+        {
+            sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+                                    RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+                                    RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+                                    RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+                                    RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                    RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN;
+            nIndex -= nBaseCount;
+            const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count();
+            for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+            {
+                SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
+                if ( pColl->IsDefault() )
+                    continue;
+                if ( IsPoolUserFmt ( pColl->GetPoolFmtId() ) )
+                {
+                    nCount++;
+                    if ( nIndex == i )
+                    {
+                        *pString = pColl->GetName();
+                        break;
+                    }
+                }
+            }
+            nCount += nBaseCount;
+        }
+        break;
+        case SFX_STYLE_FAMILY_FRAME:
+        {
+            sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
+            nIndex -= nBaseCount;
+            const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->Count();
+            for( sal_uInt16 i = 0; i < nArrLen; i++ )
+            {
+                SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
+                if(pFmt->IsDefault() || pFmt->IsAuto())
+                    continue;
+                if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+                {
+                    nCount++;
+                    if ( nIndex == i )
+                    {
+                        *pString = pFmt->GetName();
+                        break;
+                    }
+                }
+            }
+            nCount += nBaseCount;
+        }
+        break;
+        case SFX_STYLE_FAMILY_PAGE:
+        {
+            sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
+            nIndex -= nBaseCount;
+            const sal_uInt16 nArrLen = rDoc.GetPageDescCnt();
+            for(sal_uInt16 i = 0; i < nArrLen; ++i)
+            {
+                const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
+
+                /*if(rDesc.IsDefault() || rDesc.IsAuto())
+                    continue;*/
+                if ( IsPoolUserFmt ( rDesc.GetPoolFmtId() ) )
+                {
+                    nCount++;
+                    if ( nIndex == i )
+                    {
+                        *pString = rDesc.GetName();
+                        break;
+                    }
+                }
+            }
+            nCount += nBaseCount;
+        }
+        break;
+        case SFX_STYLE_FAMILY_PSEUDO:
+        {
+            sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
+            nIndex -= nBaseCount;
+            const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
+            for(USHORT i = 0; i < rNumTbl.Count(); ++i)
+            {
+                const SwNumRule& rRule = *rNumTbl[ i ];
+                if( rRule.IsAutoRule() )
+                    continue;
+                if ( IsPoolUserFmt ( rRule.GetPoolFmtId() ) )
+                {
+                    nCount++;
+                    if ( nIndex == i )
+                    {
+                        *pString = rRule.GetName();
+                        break;
+                    }
+                }
+            }
+            nCount += nBaseCount;
+        }
+        break;
+    }
+    return nCount;
+}
 /*-- 16.12.98 16:03:57---------------------------------------------------

   -----------------------------------------------------------------------*/
 sal_Int32 SwXStyleFamily::getCount(void) throw( RuntimeException )
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
-    sal_Int32 nRet = 0;
-    if(pBasePool)
-    {
-        SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
-        nRet = pIterator->Count();
-        delete pIterator;
-    }
-    return nRet;
+    return lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, NULL );
 }
 /*-- 16.12.98 16:03:57---------------------------------------------------

   -----------------------------------------------------------------------*/
-Any SwXStyleFamily::getByIndex(sal_Int32 nIndex)
+Any SwXStyleFamily::getByIndex(sal_Int32 nTempIndex)
     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException )
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
     Any aRet;
-    if(pBasePool)
-    {
-        SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
-        sal_uInt16 nCount= pIterator->Count();
-        if(nIndex < nCount)
-        {
-            SfxStyleSheetBase* pBase = (*pIterator)[(sal_uInt16) nIndex];
-            Reference< style::XStyle >  xStyle = _FindStyle(pBase->GetName());
-            if(!xStyle.is())
-            {
-                xStyle =
-                    eFamily == SFX_STYLE_FAMILY_PAGE ?
-                    new SwXPageStyle(*pBasePool, pDocShell, eFamily, pBase->GetName()):
-                        eFamily == SFX_STYLE_FAMILY_FRAME ?
-                        new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
-                            new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), pBase->GetName());
-            }
-            aRet.setValue(&xStyle, ::getCppuType((Reference<style::XStyle>*)0));
+    if ( nTempIndex >= 0 && nTempIndex < USHRT_MAX )
+    {
+        sal_uInt16 nIndex = static_cast < sal_uInt16 > ( nTempIndex );
+        if(pBasePool)
+        {
+            String sStyleName;
+            switch( eFamily )
+            {
+                case SFX_STYLE_FAMILY_CHAR:
+                {
+                    if ( nIndex < ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCHR_NORMAL_BEGIN + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN  +
+                                         RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCHR_HTML_BEGIN
+                                                        - RES_POOLCHR_NORMAL_END + RES_POOLCHR_NORMAL_BEGIN
+                                                        + nIndex, sStyleName );
+                }
+                break;
+                case SFX_STYLE_FAMILY_PARA:
+                {
+                    if ( nIndex < ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_TEXT_BEGIN + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                         RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_LISTS_BEGIN
+                                                        - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+                                                        + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+                                         RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                         RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_EXTRA_BEGIN
+                                                         - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+                                                         - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
+                                                         + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+                                         RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+                                         RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                         RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_REGISTER_BEGIN
+                                                         - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+                                                         - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+                                                         - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
+                                                         + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+                                         RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+                                         RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+                                         RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                         RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_DOC_BEGIN
+                                                         - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+                                                         - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+                                                         - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+                                                         - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
+                                                         + nIndex, sStyleName );
+                    else if ( nIndex < ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+                                         RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+                                         RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+                                         RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+                                         RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+                                         RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
+                        SwStyleNameMapper::FillUIName ( RES_POOLCOLL_HTML_BEGIN
+                                                         - RES_POOLCOLL_DOC_END + RES_POOLCOLL_DOC_BEGIN
+                                                         - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+                                                         - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+                                                         - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+                                                         - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
+                                                         + nIndex, sStyleName );
+                }
+                break;
+                case SFX_STYLE_FAMILY_FRAME:
+                {
+                    if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
+                    {
+                        SwStyleNameMapper::FillUIName ( RES_POOLFRM_BEGIN + nIndex, sStyleName );
+                    }
+                }
+                break;
+                case SFX_STYLE_FAMILY_PAGE:
+                {
+                    if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
+                    {
+                        SwStyleNameMapper::FillUIName ( RES_POOLPAGE_BEGIN + nIndex, sStyleName );
+                    }
+                }
+                break;
+                case SFX_STYLE_FAMILY_PSEUDO:
+                {
+                    if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
+                    {
+                        SwStyleNameMapper::FillUIName ( RES_POOLNUMRULE_BEGIN + nIndex, sStyleName );
+                    }
+                }
+                break;
+            }
+            if ( !sStyleName.Len() )
+                lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, &sStyleName, nIndex );
+
+            if ( sStyleName.Len() )
+            {
+                SfxStyleSheetBase* pBase = pBasePool->Find( sStyleName, eFamily );
+                if(pBase)
+                {
+                    Reference< style::XStyle >  xStyle = _FindStyle(sStyleName);
+                    if(!xStyle.is())
+                    {
+                        xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
+                            new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
+                                eFamily == SFX_STYLE_FAMILY_FRAME ?
+                                new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
+                                    new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
+                    }
+                    aRet.setValue(&xStyle, ::getCppuType((Reference<style::XStyle>*)0));
+                }
+                else
+                    throw container::NoSuchElementException();
+            }
+            else
+                throw lang::IndexOutOfBoundsException();
         }
         else
-            throw lang::IndexOutOfBoundsException();
-        delete pIterator;
+            throw RuntimeException();
     }
     else
-        throw RuntimeException();
+        throw lang::IndexOutOfBoundsException();
+
     return aRet;
-
 }
 /*-- 16.12.98 16:03:57---------------------------------------------------

@@ -706,8 +928,7 @@
         SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
         if(pBase)
         {
-            Reference< style::XStyle >  xStyle;
-            xStyle = _FindStyle(sStyleName);
+            Reference< style::XStyle >  xStyle = _FindStyle(sStyleName);
             if(!xStyle.is())
             {
                 xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
@@ -825,7 +1046,7 @@
                         throw lang::IllegalArgumentException();
                 if(pNewStyle)
                 {
-                    USHORT nMask = 0xffff;
+                    sal_uInt16 nMask = 0xffff;
                     if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
                         nMask &= ~SWSTYLEBIT_CONDCOLL;
                     SfxStyleSheetBase& rNewBase = pBasePool->Make(sStyleName, eFamily, nMask);
@@ -1197,7 +1418,7 @@
         DBG_ASSERT(pBase, "where is the style?" );
         if(pBase)
         {
-            const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(sStyleName, GET_POOLID_TXTCOLL);
+            const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sStyleName, GET_POOLID_TXTCOLL);
             if(nId != USHRT_MAX)
                 ::IsConditionalByPoolId( nId );
             else
@@ -1482,7 +1703,7 @@
     SfxItemSet*         pItemSet;

     const String&       rStyleName;
-    USHORT              nPDescPos;
+    sal_uInt16              nPDescPos;

     SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) :
         rDoc(rSwDoc),
@@ -1760,7 +1981,7 @@
             short nSet;
             rValue >>= nSet;

-            USHORT nId = rBase.pNewBase->GetCollection()->GetPoolFmtId() &
+            sal_uInt16 nId = rBase.pNewBase->GetCollection()->GetPoolFmtId() &
                             ~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID );
             switch( nSet )
             {
@@ -1906,7 +2127,7 @@
     SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName);
     if(pBasePool)
     {
-        USHORT nSaveMask = pBasePool->GetSearchMask();
+        sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
         pBasePool->SetSearchMask(eFamily);
         SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
         pBasePool->SetSearchMask(eFamily, nSaveMask );
@@ -2040,7 +2261,7 @@
             break;
             case FN_UNO_CATEGORY:
             {
-                USHORT nPoolId = rBase.pNewBase->GetCollection()->GetPoolFmtId();
+                sal_uInt16 nPoolId = rBase.pNewBase->GetCollection()->GetPoolFmtId();
                 short nRet = -1;
                 switch ( COLL_GET_RANGE_BITS & nPoolId )
                 {
@@ -2129,7 +2350,7 @@
         {
             if(!pBase)
             {
-                USHORT nSaveMask = pBasePool->GetSearchMask();
+                sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
                 pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
                 pBase = pBasePool->Find(sStyleName);
                 pBasePool->SetSearchMask(eFamily, nSaveMask );
@@ -2333,7 +2554,7 @@
                                                     rStylePropSet.getPropertyMap(), sPropName);
                     if(!pMap)
                         throw UnknownPropertyException();
-                    USHORT nResId = lcl_ConvertFNToRES(pMap->nWID);
+                    sal_uInt16 nResId = lcl_ConvertFNToRES(pMap->nWID);
                     BOOL bFooter = sPropName.EqualsAscii("Footer", 0, 6);
                     const SvxSetItem* pSetItem;
                     if(SFX_ITEM_SET == aSet.GetItemState(
@@ -2405,7 +2626,7 @@
                 case SFX_STYLE_FAMILY_PAGE:
                     nPropSetId = PROPERTY_SET_PAGE_STYLE;
                     {
-                        USHORT nPgDscPos = USHRT_MAX;
+                        sal_uInt16 nPgDscPos = USHRT_MAX;
                         SwPageDesc *pDesc = m_pDoc->FindPageDescByName( aStyle.GetPageDesc()->GetName(), &nPgDscPos );
                         if( pDesc )
                             pTargetFmt = &pDesc->GetMaster();
@@ -2454,7 +2675,7 @@

             SwFmt *pTargetFmt = 0;
             SwPageDesc *pTargetDesc = 0;
-            USHORT nPgDscPos = USHRT_MAX;
+            sal_uInt16 nPgDscPos = USHRT_MAX;
             switch( eFamily )
             {
             case SFX_STYLE_FAMILY_CHAR :
@@ -2674,7 +2895,7 @@
     SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
     if(GetBasePool())
     {
-        USHORT nSaveMask = GetBasePool()->GetSearchMask();
+        sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
         GetBasePool()->SetSearchMask(GetFamily());
         SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
         GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
@@ -2892,7 +3113,7 @@
         {
             if(!pBase)
             {
-                USHORT nSaveMask = GetBasePool()->GetSearchMask();
+                sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
                 GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
                 pBase = GetBasePool()->Find(GetStyleName());
                 GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );


Fix null pointer error on tie with tiebreaks

--- projects/lionheart/SingleElimination.cpp
+++ projects/lionheart/SingleElimination.cpp
@@ -45,7 +45,7 @@
       {
         auto tie = game.tiebreaker();
         if (tie) {
-        std::cout << winner->getBlazon().name << " wins by tie break!" << std::endl;
+        std::cout << tie->getBlazon().name << " wins by tie break!" << std::endl;
           winners.push_back(tie);
         }
         else


08/07/2017


Reduced delay in filepathtest to 1 second from 3

--- test/filepathtests.cpp
+++ test/filepathtests.cpp
@@ -97,7 +97,7 @@
     EXPECT_TRUE(file.isFile());
     EXPECT_FALSE(file.isDir());
     EXPECT_FALSE(file.isUpdated());
-    sleep(3);
+    sleep(1);
     //There may need to be a delay inserted here so the updated time actually changes
     std::ofstream reWrite(testString);
     reWrite << "I'm doing this as hard as I can";


don't explicit close path for moveTo command

--- src/lib/svgpath.cpp
+++ src/lib/svgpath.cpp
@@ -135,9 +135,6 @@

 		if (*commandIt == PathElement::MoveTo || *commandIt == PathElement::MoveToRel)
 		{
-			if (prevCommand != PathElement::ClosePath && std::distance(commandIt, data.commands.begin()) != 0)
-				g->closePath();
-
 			if (SvgUtils::isCommandRelative(*commandIt))
 			{
 				x += cx;


Dump sizeof(FuncInstr) in PerfSim

Dump sizeof(FuncInstr) in PerfSim

--- simulator/core/perf_sim.cpp
+++ simulator/core/perf_sim.cpp
@@ -109,11 +109,12 @@
     auto simips = executed_instrs / time;

     std::cout << std::endl << "****************************"
-              << std::endl << "instrs:   " << executed_instrs
-              << std::endl << "cycles:   " << cycle
-              << std::endl << "IPC:      " << ipc
-              << std::endl << "sim freq: " << frequency << " kHz"
-              << std::endl << "sim IPS:  " << simips    << " kips"
+              << std::endl << "instrs:     " << executed_instrs
+              << std::endl << "cycles:     " << cycle
+              << std::endl << "IPC:        " << ipc
+              << std::endl << "sim freq:   " << frequency << " kHz"
+              << std::endl << "sim IPS:    " << simips    << " kips"
+              << std::endl << "instr size: " << sizeof(FuncInstr) << " bytes"
               << std::endl << "****************************"
               << std::endl;
 }


Always enable finalizers for Data objects

Even when no finalizer is specified, but only a mark function is, we
have to make sure we register one. This is needed because the
finalization will cleanup C-API handles so they aren't kept alive
when the shouldn't.

This is especially a problem if during a young GC we have to update
marks for Data objects that are mature. It could be that the mature
object we're marking then has already been finalized, so we shouldn't
try to mark it again in that case.

This is ensured by this change because it will deallocate the handle, so
the code tracking all handles to mature objects to call the mark
function won't see the finalized object.

Fixes the crash mentioned in #2118

--- vm/builtin/data.cpp
+++ vm/builtin/data.cpp
@@ -41,9 +41,7 @@
     data->internal_ = rdata;
     data->freed_    = false;

-    // If this Data requires a free function, register this object
-    // as needing finalization.
-    if(free) {
+    if(mark || free) {
       state->memory()->needs_finalization(data, (FinalizerFunction)&Data::finalize);
     }


ir_to_mesa: Add support for assignment of aggregates.

--- src/mesa/shader/ir_to_mesa.cpp
+++ src/mesa/shader/ir_to_mesa.cpp
@@ -1268,6 +1268,7 @@
 {
    struct ir_to_mesa_dst_reg l;
    struct ir_to_mesa_src_reg r;
+   int i;

    assert(!ir->lhs->type->is_matrix());
    assert(!ir->lhs->type->is_array());
@@ -1295,10 +1296,18 @@
        * an extra computing the condition.
        */
       condition.negate = ~condition.negate;
-      ir_to_mesa_emit_op3(ir, OPCODE_CMP, l,
-			  condition, r, ir_to_mesa_src_reg_from_dst(l));
+      for (i = 0; i < type_size(ir->lhs->type); i++) {
+	 ir_to_mesa_emit_op3(ir, OPCODE_CMP, l,
+			     condition, r, ir_to_mesa_src_reg_from_dst(l));
+	 l.index++;
+	 r.index++;
+      }
    } else {
-      ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r);
+      for (i = 0; i < type_size(ir->lhs->type); i++) {
+	 ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r);
+	 l.index++;
+	 r.index++;
+      }
    }
 }


Performance improvement of get_type_and_values() in fits_header_record.cc.

--- sfitsio/src/fits_header_record.cc
+++ sfitsio/src/fits_header_record.cc
@@ -1,5 +1,5 @@
 /* -*- Mode: C++ ; Coding: euc-japan -*- */
-/* Time-stamp: <2015-11-18 22:06:44 cyamauch> */
+/* Time-stamp: <2015-11-18 23:35:43 cyamauch> */

 /**
  * @file   fits_header_record.cc
@@ -810,6 +810,7 @@
     int return_value = FITS::ANY_T;
     size_t endpos;
     const char *p0;
+    const char *p00;
     const char *p1;
     size_t len_value;
     tstring sval;
@@ -821,16 +822,34 @@
     }

     /* value κζʬξ */
-    /* p0    v    */
-    /*    "  T  " */
-    /* p1    A    */
+    /* p0    v    */    /* p0    v       */
+    /*    "  T  " */    /*    "  TUVW  " */
+    /* p1    A    */    /* p1       A    */
+#if 1		/* Improved code by K. Matsuzaki (ISAS/JAXA). 2015.06.16 */
+    len_value = 0;
+    for ( p0 = value ; *p0 != '\0' ; p0++ ) {
+	if ( *p0 != ' ' ) break;
+	len_value ++;
+    }
+    p1 = p0;
+    for ( p00 = p0 ; *p00 != '\0' ; p00++ ) {
+	if ( *p00 != ' ' ) p1 = p00;
+	len_value ++;
+    }
+    sval.assign(p0, p1 - p0 + 1);
+#else
     len_value = sval.assign(value).length();
     p0 = value + (len_value - sval.ltrim().length());
     p1 = p0 + sval.rtrim().length();
     if ( p0 < p1 ) p1--;
-
+#endif
+
+    //sli__eprintf("fits_header_record:: value = [%s]\n", value);
+    //sli__eprintf("fits_header_record:: sval = [%s]\n", sval.cstr());
     //sli__eprintf("fits_header_record:: p0 = %llx p1 = %llx\n",
-    //(long long)p0,(long long)p1);
+    //		 (long long)p0,(long long)p1);
+    //sli__eprintf("fits_header_record:: len_value = %zd\n",
+    //		 len_value);

     //for ( p0=value ; *p0 == ' ' ; p0++ );	/* skipping ' ' */
     //for ( p1=value+len_value ; (*p1 == ' ' || *p1 == '\0') && p0 < p1 ; p1-- );


ADD basic wheel reaction

ADD basic wheel reaction

--- SSPSolution/SSPSolution/PlatformEntity.cpp
+++ SSPSolution/SSPSolution/PlatformEntity.cpp
@@ -1,5 +1,5 @@
 #include "PlatformEntity.h"
-PlatformEntity::PlatformEntity(){}
+PlatformEntity::PlatformEntity() {}
 PlatformEntity::~PlatformEntity()
 {
 	this->Shutdown();
@@ -24,14 +24,14 @@
 	this->SyncComponents();

 	// Adjust misplaced graphics component - hack...
-	this->m_gComp->worldMatrix = DirectX::XMMatrixMultiply(this->m_pComp->PC_OBB.ort,
+	this->m_gComp->worldMatrix = DirectX::XMMatrixMultiply(this->m_pComp->PC_OBB.ort,
 		DirectX::XMMatrixTranslationFromVector(
-		DirectX::XMVectorSubtract(this->m_pComp->PC_pos,
-			DirectX::XMVECTOR{
+			DirectX::XMVectorSubtract(this->m_pComp->PC_pos,
+				DirectX::XMVECTOR{
 		m_gComp->modelPtr->GetOBBData().position.x,
 			m_gComp->modelPtr->GetOBBData().position.y,
 			m_gComp->modelPtr->GetOBBData().position.z, 0})));
-
+
 	if (this->GetAIComponent()->AC_triggered)
 	{
 		if (this->m_ActiveSound == nullptr)
@@ -87,10 +87,12 @@
 	case LEVER_ACTIVE:
 		this->GetAIComponent()->AC_triggered = true;
 		break;
-	//case LEVER_ENABLED:
-	//	break;
-	//case LEVER_DISABLED:
-	//	break;
+	case WHEEL_INCREASING:
+		this->GetAIComponent()->AC_triggered = true;
+		break;
+	case WHEEL_RESET:
+		this->GetAIComponent()->AC_triggered = false;
+		break;
 	default:
 		break;
 	}


laying groundwork for undo

laying groundwork for undo

--- lax/undo.cc
+++ lax/undo.cc
@@ -76,6 +76,8 @@
 }

 /*! If prev==NULL, then delete next, else just remove *this from chain.
+ *
+ * If context is an anObject, then dec_count it.
  */
 UndoData::~UndoData()
 {
@@ -93,6 +95,7 @@
 		}
 	}

+	if (dynamic_cast<anObject*>(context)) dynamic_cast<anObject*>(context)->dec_count();
 	delete[] description;
 }


sizeof a char pointer is not necessarily the same thing as the length of the string.  modified version of hdunkel's amd64 patch.

--- src/3D/TextureFont.cxx
+++ src/3D/TextureFont.cxx
@@ -12,6 +12,7 @@

 #include <assert.h>
 #include <string>
+#include <string.h>

 #include "common.h"
 #include "bzfgl.h"
@@ -152,7 +153,7 @@

   // now wack off the extension;
   if (extension)
-    faceName.erase(faceName.size() - sizeof(extension), faceName.size());
+    faceName.erase(faceName.size() - strlen(extension), faceName.size());

   temp = strrchr(faceName.c_str(), '_');

@@ -161,10 +162,10 @@
     faceName.resize(temp - faceName.c_str());
   }

-  // faceName.erase(faceName.size()-sizeof(temp),faceName.size());
+  // faceName.erase(faceName.size()-strlen(temp),faceName.size());

   if (extension)
-    texture.erase(texture.size() - sizeof(extension), texture.size());
+    texture.erase(texture.size() - strlen(extension), texture.size());

   return (numberOfCharacters > 0);
 }


solve bug in pull_dense_worker (#27918)

solve bug in pull_dense_worker (#27918)

* op error info

* style

* code format

* create pin var bug

--- paddle/fluid/framework/pull_dense_worker.cc
+++ paddle/fluid/framework/pull_dense_worker.cc
@@ -67,7 +67,7 @@
 }

 void PullDenseWorker::CreatePinVar() {
-#if (defined PADDLE_WITH_CUDA) || (defined PADDLE_WITH_PSLIB)
+#if (defined PADDLE_WITH_CUDA) || (defined PADDLE_WITH_XPU)
   // for (auto& v : dense_value_names_) {
   //  for (auto& name : v.second) {
   for (int i = 0; i < dwp_param_.program_config(0).pull_dense_table_id_size();


Don't ricochet for a while after the bullet is born; this should be the final fix for all glitches

--- src/game/stateless_systems/missile_system.cpp
+++ src/game/stateless_systems/missile_system.cpp
@@ -63,6 +63,8 @@

 	const auto steps = cosm.get_total_steps_passed();
 	(void)steps;
+	(void)delta;
+	(void)now;

 	for (const auto& it : events) {
 		if (it.type != messages::collision_message::event_type::BEGIN_CONTACT || it.one_is_sensor) {
@@ -115,7 +117,14 @@
 						delta
 					);

-					if (ricochet_cooldown) {
+					const bool born_cooldown = augs::lasts(
+						missile_def.ricochet_cooldown_ms,
+						missile_handle.when_born(),
+						now,
+						delta
+					);
+
+					if (ricochet_cooldown || born_cooldown) {
 						return;
 					}
 				}
@@ -171,6 +180,8 @@

 	const auto steps = cosm.get_total_steps_passed();
 	(void)steps;
+	(void)delta;
+	(void)now;

 	for (const auto& it : events) {
 		if (it.type != messages::collision_message::event_type::BEGIN_CONTACT || it.one_is_sensor) {


Fixed incorrect family when using INADDR_ANY for multicast

--- common/transmitmedia.cpp
+++ common/transmitmedia.cpp
@@ -925,6 +925,7 @@
             if ( adapter == "" )
             {
                 Verb() << "Multicast: home address: INADDR_ANY:" << port;
+                maddr.sin_family = AF_INET;
                 maddr.sin_addr.s_addr = htonl(INADDR_ANY);
                 maddr.sin_port = htons(port); // necessary for temporary use
             }


Report missing text codecs.

Report missing text codecs.

--- messaging/qmessage.cpp
+++ messaging/qmessage.cpp
@@ -34,6 +34,7 @@
 #include "qmessage_p.h"

 #include <QTextCodec>
+#include <QDebug>

 namespace {

@@ -585,6 +586,8 @@
     foreach (const QByteArray &name, charsets) {
         if (QTextCodec* codec = QTextCodec::codecForName(name)) {
             codecs.append(codec);
+        } else {
+            qWarning() << "No codec is available for:" << name;
         }
     }


remove Y axe from servo/src/main.cpp (because servo is 2 dimential)

--- servo/src/main.cpp
+++ servo/src/main.cpp
@@ -34,16 +34,12 @@
 // the value that joystick has at first
 // they're usefull in normalizing
 short int joyXOrigin = 0;
-short int joyYOrigin = 0;

 short int joyXOriginNormalized = 0;
-short int joyYOriginNormalized = 0;

 short int joyValueX = 0;
-short int joyValueY = 0;

 short int joyValueXNormalized = 0;
-short int joyValueYNormalized = 0;

 Servo myServo;

@@ -85,14 +81,10 @@

   // initialize joystick pins
   pinMode(JOY_PIN_X, INPUT);
-  pinMode(JOY_PIN_Y, INPUT);

   joyXOrigin = analogRead(JOY_PIN_X);
-  joyYOrigin = analogRead(JOY_PIN_Y);

   joyXOriginNormalized = normalize(joyXOrigin);
-
-  joyYOriginNormalized = normalize(joyYOrigin);

   // wait until Serail is not available
   while(!Serial);
@@ -104,14 +96,9 @@
   joyValueXNormalized = normalize(joyValueX) - joyXOriginNormalized;
   checkBoundries(joyValueXNormalized);

-  joyValueY =  analogRead(JOY_PIN_Y);
-  joyValueYNormalized = normalize(joyValueY) - joyYOriginNormalized;
-  checkBoundries(joyValueYNormalized);
-
   myServoPos = joyValueXNormalized + NORMALIZE_ORIGIN;
   myServo.write(myServoPos);
   //Serial.println(myServoPos);

   // delay(DELAY_TIME);
-
 }


Include array_wrapper before accumulators (Boost)

--- Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/src/internal/mitkHummelProtocolEvaluation.cpp
+++ Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/src/internal/mitkHummelProtocolEvaluation.cpp
@@ -16,6 +16,7 @@
 #define _USE_MATH_DEFINES
 #include "mitkHummelProtocolEvaluation.h"

+#include <boost/serialization/array_wrapper.hpp>
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics.hpp>
 #include <boost/accumulators/statistics/stats.hpp>


Use execvp instead of execv to allow OS.execute() to search through PATH. Fix #12003.

--- drivers/unix/os_unix.cpp
+++ drivers/unix/os_unix.cpp
@@ -343,7 +343,7 @@
 			execvp(getprogname(), &args[0]);
 		}
 #else
-		execv(p_path.utf8().get_data(), &args[0]);
+		execvp(p_path.utf8().get_data(), &args[0]);
 #endif
 		// still alive? something failed..
 		fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data());


Adding serialEvent(), serialEvent1(), etc.

Called from within the serial receive interrupt.  These are implemented as an empty weak function in the core that be overridden by the user's sketch.

http://code.google.com/p/arduino/issues/detail?id=263

--- hardware/arduino/cores/arduino/HardwareSerial.cpp
+++ hardware/arduino/cores/arduino/HardwareSerial.cpp
@@ -86,6 +86,8 @@
 	!defined(SIG_UART_RECV)
   #error Don't know what the Data Received vector is called for the first UART
 #else
+  void serialEvent() __attribute__((weak));
+  void serialEvent() {}
 #if defined(USART_RX_vect)
   SIGNAL(USART_RX_vect)
 #elif defined(SIG_USART0_RECV)
@@ -106,36 +108,44 @@
     #error UDR not defined
   #endif
     store_char(c, &rx_buffer);
-  }
-#endif
-
-//#if defined(SIG_USART1_RECV)
+	serialEvent();
+  }
+#endif
+
 #if defined(USART1_RX_vect)
-  //SIGNAL(SIG_USART1_RECV)
+  void serialEvent1() __attribute__((weak));
+  void serialEvent1() {}
   SIGNAL(USART1_RX_vect)
   {
     unsigned char c = UDR1;
     store_char(c, &rx_buffer1);
+	serialEvent1();
   }
 #elif defined(SIG_USART1_RECV)
   #error SIG_USART1_RECV
 #endif

 #if defined(USART2_RX_vect) && defined(UDR2)
+  void serialEvent2() __attribute__((weak));
+  void serialEvent2() {}
   SIGNAL(USART2_RX_vect)
   {
     unsigned char c = UDR2;
     store_char(c, &rx_buffer2);
+	serialEvent2();
   }
 #elif defined(SIG_USART2_RECV)
   #error SIG_USART2_RECV
 #endif

 #if defined(USART3_RX_vect) && defined(UDR3)
+  void serialEvent3() __attribute__((weak));
+  void serialEvent3() {}
   SIGNAL(USART3_RX_vect)
   {
     unsigned char c = UDR3;
     store_char(c, &rx_buffer3);
+	serialEvent3();
   }
 #elif defined(SIG_USART3_RECV)
   #error SIG_USART3_RECV


Fixed warning in ExecutionConfiguration.cc

--- libhoomd/data_structures/ExecutionConfiguration.cc
+++ libhoomd/data_structures/ExecutionConfiguration.cc
@@ -606,4 +606,4 @@
     .value("GPU", ExecutionConfiguration::GPU)
     .value("CPU", ExecutionConfiguration::CPU)
     ;
-    }+    }


align comments

align comments

--- irview.cpp
+++ irview.cpp
@@ -105,20 +105,20 @@
 int main( int argc, char** argv )
 {

-	IplImage* img = NULL;			// image object
-	CvCapture* capture = NULL; // capture object
+	IplImage* img = NULL;				// image object
+	CvCapture* capture = NULL; 	// capture object

 	const char* windowNameHSV = PROG_ID_STRING; // window name

- 	IplImage* HSV = NULL;					// HSV image
- 	IplImage* singleChannelH = NULL;		// Hue plain (from input image)
+ 	IplImage* HSV = NULL;									// HSV image
+ 	IplImage* singleChannelH = NULL;			// Hue plain (from input image)
  	IplImage* singleChannelPlain = NULL; 	// constant plane for S & V

 	bool keepProcessing = true;		// loop control flag
-	char key = '\0';				// user input
-	int	EVENT_LOOP_DELAY = 40;		 // 40ms equates to 1000ms/25fps =
-									// 40ms per frame
+	char key = '\0';							// user input
+	int	EVENT_LOOP_DELAY = 40;		// 40ms equates to 1000ms/25fps =
+																// 40ms per frame

 	bool useFalseColour = true;		 // process flag - false colour
 	bool useNormalisation = true;	 // process flag - normalisation


layers: MR124, Fix semaphore ordering validation in mem tracker layer

--- layers/mem_tracker.cpp
+++ layers/mem_tracker.cpp
@@ -1344,7 +1344,7 @@
             }
         }
         for (uint32_t i = 0; i < submit->signalSemaphoreCount; i++) {
-            VkSemaphore sem = submit->pWaitSemaphores[i];
+            VkSemaphore sem = submit->pSignalSemaphores[i];

             if (my_data->semaphoreMap.find(sem) != my_data->semaphoreMap.end()) {
                 if (my_data->semaphoreMap[sem] != MEMTRACK_SEMAPHORE_STATE_UNSET) {


Header file cleanup

Header file cleanup

Signed-off-by: Andrew Young <9b1c84997b9b503084a7ab9e0b7da3894895a5c3@gmail.com>

--- b9/jit.cpp
+++ b9/jit.cpp
@@ -1,6 +1,6 @@
-#include <b9/instructions.hpp>
-#include <b9/interpreter.hpp>
-#include <b9/jit.hpp>
+#include "b9/instructions.hpp"
+#include "b9/interpreter.hpp"
+#include "b9/jit.hpp"

 #include "Jit.hpp"
 #include "ilgen/BytecodeBuilder.hpp"
@@ -10,14 +10,14 @@
 #include "ilgen/VirtualMachineRegister.hpp"
 #include "ilgen/VirtualMachineRegisterInStruct.hpp"

-#include <assert.h>
+#include <cassert>
+#include <cerrno>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <dlfcn.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <cstring>
 #include <iostream>
 #include <sstream>
 #include <vector>


Modified main method

Modified main method

--- jpegenc/jpegenc/main.cpp
+++ jpegenc/jpegenc/main.cpp
@@ -305,7 +305,7 @@
     matrix.print();
 }

-void testTransformations()
+void testTransformations(int digits = 5)
 {
     Mat matrix;

@@ -321,27 +321,27 @@
     }, 8, 8);

     matrix = DCT::transform(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;

     matrix = DCT::inverse(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;

     matrix = DCT::transform2(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;

     matrix = DCT::inverse(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;

     matrix = Arai::transform(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;

     matrix = DCT::inverse(matrix);
-    matrix.print();
+    matrix.print(digits);
     std::cout << std::endl;
 }

@@ -359,8 +359,9 @@
     //testIDCT();
 	//testMat();
 	//testImage();
-    testAraiLine();
-    testAraiMatrix();
+//    testAraiLine();
+//    testAraiMatrix();
+	testTransformations(0);

 	return 0;
 }


Adding smoothing code to select otimal smoothing parameters

--- TPC/Upgrade/macros/makeCurrentCorrection.C
+++ TPC/Upgrade/macros/makeCurrentCorrection.C
@@ -1,6 +1,7 @@
 /*
 .x $HOME/rootlogon.C
 .L $ALICE_ROOT/TPC/Upgrade/macros/makeCurrentCorrection.C+
+

 */

@@ -44,18 +45,22 @@
 #include "TROOT.h"
 #include "AliMathBase.h"
 #include "TLatex.h"
+#include "AliTPCCorrectionLookupTable.h"
 //

 const Int_t kColors[6]={1,2,3,4,6,7};
 const Int_t kMarkers[6]={20,21,24,25,24,25};

 void MakeLocalDistortionCurrentTree(Int_t npointsZ=20000, Int_t id=0);
-
-void makeCurrentCorrection(Int_t action=0, Int_t arg0=5000, Int_t arg1=0){
+void MakeSmoothKernelStudy(Int_t npoints, Int_t nkernels, Int_t mapID);
+
+void makeCurrentCorrection(Int_t action=0, Int_t arg0=5000, Int_t arg1=0, Int_t arg2=0){
   //
   //
   //
   if (action==0) MakeLocalDistortionCurrentTree(arg0,arg1);
+  if (action==1) MakeSmoothKernelStudy(arg0,arg1,arg2);
+
 }

 void SetGraphTDRStyle(TGraph * graph){
@@ -384,6 +389,167 @@
   canvasFit->SaveAs("canvasAIJ_CurrenToDR.png");
 }

+void MakeSmoothKernelStudy(Int_t npoints, Int_t nkernels, Int_t mapID){
+  //
+  // Compare the input and reconstructed distortion maps
+  // Input files are expected to have predefined names
+  //
+  // Values and smoothed vaules using differnt smoothing algorithms are used
+  // Results of given studies will be used to define "optimal" smoothing algorithm
+  // and optimal Kernel parameters
+  //
+  //
+  const Double_t cutMaxDist=3;
+  const Double_t cutMinDist=0.00001;
+
+  TFile *foutput = TFile::Open("MeasureResidual.root");
+  TFile *finput = TFile::Open("RealResidualScaled.root");
+  AliTPCCorrectionLookupTable *mapIn = (AliTPCCorrectionLookupTable *)finput->Get("map");
+  AliTPCCorrectionLookupTable *mapOut = (AliTPCCorrectionLookupTable *)foutput->Get("map");
+  AliTPCCorrection::AddVisualCorrection(mapIn,1);
+  AliTPCCorrection::AddVisualCorrection(mapOut,2);
+  TF1 * fin = new TF1("fin","AliTPCCorrection::GetCorrXYZ(x,5,10,1,1)",85,245);
+  TF1 * fout = new TF1("fout","AliTPCCorrection::GetCorrXYZ(x,5,10,1,2)",85,245);
+  TTreeSRedirector * pcstream = new TTreeSRedirector("smoothLookupStudy.root","recreate");
+  //
+  //
+  // 1. Generate random point of interest
+  //
+  TVectorD  sigmaKernelR(nkernels);
+  TVectorD  sigmaKernelRPhi(nkernels);
+  TVectorD  sigmaKernelZ(nkernels);
+  TVectorD  fitValues(nkernels);
+  TVectorD  fitValuesErr(nkernels);
+  TVectorD  fitValuesChi2(nkernels);
+  TVectorD  fitSumW(nkernels);
+  TVectorD  fitValuesN(nkernels);
+  //
+  TLinearFitter *fitters[nkernels];
+  for (Int_t ipoint=0; ipoint<npoints; ipoint++){
+    if (ipoint%10==0) printf("%d\n",ipoint);
+    for (Int_t i=0; i<nkernels; i++) {
+      fitters[i]=new TLinearFitter(7,"hyp6");
+    }
+    Double_t phi = gRandom->Rndm()*TMath::TwoPi();
+    Double_t r   = 85+gRandom->Rndm()*(245-85);
+    Double_t theta   = -0.9+gRandom->Rndm()*1.8;
+    Double_t z=r*theta;
+    //
+    Double_t x = r*TMath::Cos(phi);
+    Double_t y = r*TMath::Sin(phi);
+    Double_t drphiInput = AliTPCCorrection::GetCorrXYZ(x,y,z,1,1);
+    Double_t drphiOutput = AliTPCCorrection::GetCorrXYZ(x,y,z,1,2);
+    Double_t drInput = AliTPCCorrection::GetCorrXYZ(x,y,z,0,1);
+    Double_t drOutput = AliTPCCorrection::GetCorrXYZ(x,y,z,0,2);
+    if (TMath::Abs(drphiOutput)<cutMinDist) continue; // beter condition needed
+    if (TMath::Abs(drphiInput)<cutMinDist) continue; // beter condition needed
+    if (TMath::Abs(drphiOutput)>cutMaxDist) continue; // beter condition needed
+    if (TMath::Abs(drphiInput)>cutMaxDist) continue; // beter condition needed
+    //
+    for (Int_t i=0; i<nkernels; i++) {
+      sigmaKernelR[i]    = 1.+15.*gRandom->Rndm();
+      sigmaKernelRPhi[i] = 1.+15.*gRandom->Rndm();
+      sigmaKernelZ[i]    = 1.+15.*gRandom->Rndm();
+      fitSumW[i]=0;
+    }
+    for (Int_t idphi=-6; idphi<=6; idphi++){
+      Double_t dphi=idphi*TMath::Pi()/54.;
+      for (Double_t dR=-30; dR<=30.; dR+=5){
+	for (Double_t dZ=-30; dZ<=30.; dZ+=5){
+	  if (r+dR<85) continue;
+	  if (r+dR>245) continue;
+	  if (z+dZ<-240) continue;
+	  if (z+dZ>240) continue;
+	  //
+	  Double_t x2=(r+dR)*TMath::Cos(phi+dphi);
+	  Double_t y2=(r+dR)*TMath::Sin(phi+dphi);
+	  Double_t z2=(r+dR)*TMath::Sin(phi+dphi);
+	  Double_t drphiOutput2=AliTPCCorrection::GetCorrXYZ(x2,y2,z2,1,1);
+	  if (TMath::Abs(drphiOutput2)<cutMinDist) continue; // hard cut beter condition needed
+	  if (TMath::Abs(drphiOutput2)>cutMaxDist) continue; // beter condition needed
+
+	  Double_t xfit[7]={dphi,dphi*dphi,dR,dR*dR,dZ,dZ*dZ};
+	  for (Int_t i=0; i<nkernels; i++) {
+	    Double_t weight=1;
+	    weight*=TMath::Gaus(dphi*r,0,sigmaKernelRPhi[i]);
+	    weight*=TMath::Gaus(dR,0,sigmaKernelR[i]);
+	    weight*=TMath::Gaus(dZ,0,sigmaKernelZ[i]);
+	    weight+=0.00000001;
+	    fitSumW[i]+=weight;
+	    fitters[i]->AddPoint(xfit,drphiOutput2,0.1/weight);
+	  }
+	}
+      }
+    }
+    for (Int_t ifix=0; ifix<=1; ifix++){
+      for (Int_t i=0; i<nkernels; i++) {
+	if (ifix==1){
+	  fitters[i]->FixParameter(4,0);
+	  fitters[i]->FixParameter(5,0);
+	  fitters[i]->FixParameter(6,0);
+	}
+	fitters[i]->Eval();
+	fitValues[i]=fitters[i]->GetParameter(0);
+	fitValuesErr[i]=fitters[i]->GetParError(0);
+	fitValuesChi2[i]=TMath::Sqrt(fitters[i]->GetChisquare()/fitSumW[i]);
+	fitValuesN[i]=fitters[i]->GetNpoints();
+      }
+      (*pcstream)<<"smoothLookup"<<
+	"ipoint"<<ipoint<<
+	"mapID="<<mapID<<
+	"ifix="<<ifix<<
+	// coordinates
+	"x="<<x<<
+	"y="<<y<<
+	"z="<<z<<
+	"phi="<<phi<<
+	"r="<<r<<
+	"z="<<z<<
+	// Input output values
+	"drphiInput="<<drphiInput<<       // input lookup tables disotrions
+	"drphiOutput="<<drphiOutput<<     // reconstructed lookup tables distortion
+	"drInput="<<drInput<<       // input lookup tables disotrions
+	"drOutput="<<drOutput<<     // reconstructed lookup tables distortion
+	// Smoothed values
+	"fitValues.="<<&fitValues<<
+	"fitValuesErr.="<<&fitValuesErr<<
+	"fitValuesChi2.="<<&fitValuesChi2<<
+	"fitValuesN.="<<&fitValuesN<<
+	"fitSumW.="<<&fitSumW<<
+	// Kernel sigma
+	"sigmaKernelR.="<<&sigmaKernelR<<
+	"sigmaKernelRPhi.="<<&sigmaKernelRPhi<<
+	"sigmaKernelZ.="<<&sigmaKernelZ<<
+	"\n";
+    }
+    for (Int_t i=0; i<nkernels; i++) {
+      delete fitters[i];
+    }
+  }
+  delete pcstream;
+  //
+  //
+  /*
+     TFile *ff = TFile::Open("smoothLookupStudy.root")
+     TChain * chain = AliXRDPROOFtoolkit::MakeChain("smooth.list", "smoothLookup", 0,100)
+
+   */
+}
+void MakeSmoothKernelStudyDraw(){
+  //
+  //
+  //
+  TChain * chain = AliXRDPROOFtoolkit::MakeChain("smooth.list", "smoothLookup", 0,100);
+  TH2* hisInputsS[3]={0};
+  chain->Draw("fitValues.fElements-drphiInput:pow(sigmaKernelR.fElements*sigmaKernelRPhi.fElements*sigmaKernelZ.fElements,1/3.)>>his0Diff(10,3,15,100,-0.3,0.3)","ifix==0&&fitValuesErr.fElements<0.2","colz");
+  hisInputs[0]= chain->GetHistogram()->Clone();
+  chain->Draw("fitValues.fElements-drphiInput:pow(sigmaKernelR.fElements*sigmaKernelRPhi.fElements*sigmaKernelZ.fElements,1/3.)>>his1Diff(10,3,15,100,-0.3,0.3)","ifix==1&&fitValuesErr.fElements<0.2","colz");
+  //
+  hisInputsS[1]= chain->GetHistogram()->Clone();
+  chain->Draw("drphiOutput-drphiInput:pow(sigmaKernelR.fElements*sigmaKernelRPhi.fElements*sigmaKernelZ.fElements,1/3.)>>hisDiff(10,3,15,100,-0.3,0.3)","ifix==1&&fitValuesErr.fElements<0.2","colz");
+hisInputsS[2]= chain->GetHistogram()->Clone();
+
+}

 void FFTexample(){
   //
@@ -400,8 +566,8 @@
   //
   TF2 f2("f2","AliTPCCorrection::GetCorrXYZ(x,0,y,0,1)-1.07*AliTPCCorrection::GetCorrXYZ(x,0,y,0,2)",85,245,0,250);
   TF2 f2c("f2c","AliTPCCorrection::GetCorrXYZ(x,0,y,0,1)-1.07*AliTPCCorrection::GetCorrXYZ(x,0,y,0,2)+sqrt(12.)*(rndm-0.5)*0.04",85,245,0,250);
-  f2.SetNpx(16); f2.SetNpy(32);
-  f2c.SetNpx(16); f2c.SetNpy(32);
+  f2.SetNpx(32); f2.SetNpy(32);
+  f2c.SetNpx(32); f2c.SetNpy(32);
   f2.Draw("colz");
   f2c.Draw("colz");

@@ -421,7 +587,7 @@
 	  if (jbin+dj<=1) continue;
 	  if (ibin+di>=nx) continue;
 	  if (jbin+dj>=ny) continue;
-	  Double_t x[2]={di,dj,dj*dj};
+	  Double_t x[3]={di,dj,dj*dj};
 	  Double_t w = 1./(TMath::Gaus(di/sigma)*TMath::Gaus(dj/sigma));
 	  Double_t y = his2Dc->GetBinContent(ibin+di,jbin+dj);
 	  fitter.AddPoint(x,y,w);


switch to c++-style standard header.

switch to c++-style standard header.

Swift SVN r1342


INTEGRATION: CWS warnings01 (1.4.34); FILE MERGED 2005/11/04 14:50:28 cl 1.4.34.1: warning free code changes

--- xmloff/inc/xformsexport.hxx
+++ xmloff/inc/xformsexport.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xformsexport.hxx,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.5 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-09 13:12:03 $
+ *  last change: $Author: hr $ $Date: 2006-06-19 17:57:59 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -35,6 +35,10 @@
 #ifndef _XMLOFF_XFORMSEXPORT_HXX
 #define _XMLOFF_XFORMSEXPORT_HXX

+#ifndef INCLUDED_XMLOFF_DLLAPI_H
+#include "xmloff/dllapi.h"
+#endif
+
 class SvXMLExport;
 namespace com { namespace sun { namespace star {
     namespace uno { template<typename T> class Reference; }


INTEGRATION: CWS c01v005 (1.29.26); FILE MERGED 2005/03/05 00:31:27 hjs 1.29.26.2: RESYNC: (1.29-1.30); FILE MERGED 2005/02/22 17:01:19 cd 1.29.26.1: #119876# new statusbar logo controllers

--- framework/source/register/registerservices.cxx
+++ framework/source/register/registerservices.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: registerservices.cxx,v $
  *
- *  $Revision: 1.30 $
- *
- *  last change: $Author: vg $ $Date: 2005-02-16 16:42:28 $
+ *  $Revision: 1.31 $
+ *
+ *  last change: $Author: obo $ $Date: 2005-03-15 12:57:01 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -273,6 +273,14 @@

 #ifndef __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_
 #include <services/sessionlistener.hxx>
+#endif
+
+#ifndef __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_
+#include <uielement/logoimagestatusbarcontroller.hxx>
+#endif
+
+#ifndef __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_
+#include <uielement/logotextstatusbarcontroller.hxx>
 #endif

 #ifndef __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_
@@ -326,6 +334,8 @@
                         COMPONENTINFO( ::framework::UICategoryDescription                   )
                         COMPONENTINFO( ::framework::StatusbarControllerFactory              )
                         COMPONENTINFO( ::framework::SessionListener                         )
+                        COMPONENTINFO( ::framework::LogoImageStatusbarController            )
+                        COMPONENTINFO( ::framework::LogoTextStatusbarController             )
                         COMPONENTINFO( ::framework::NewMenuController                       )
                     )

@@ -372,9 +382,11 @@
                         IFFACTORY( ::framework::RecentFilesMenuController               )   else
                         IFFACTORY( ::framework::StatusBarFactory                        )   else
                         IFFACTORY( ::framework::UICategoryDescription                   )   else
-                        IFFACTORY( ::framework::SessionListener                         )
-else
+                        IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::StatusbarControllerFactory              )   else
+                        IFFACTORY( ::framework::SessionListener                         )   else
+                        IFFACTORY( ::framework::LogoImageStatusbarController            )   else
+                        IFFACTORY( ::framework::LogoTextStatusbarController             )   else
                         IFFACTORY( ::framework::NewMenuController                       )
             )


[Minor] Update copyright in explog.hpp.

[Minor] Update copyright in explog.hpp.

--- src/math/explog.hpp
+++ src/math/explog.hpp
@@ -1,5 +1,6 @@
 //
 // Copyright (c) 2015 CNRS
+// Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
 //
 // This file is part of Pinocchio
 // Pinocchio is free software: you can redistribute it


Modified pixel writing to support long words reducing the output size.

--- SPROCKET.C
+++ SPROCKET.C
@@ -137,6 +137,8 @@
 void writeSprite(char * name, FILE * source, FILE * dest, char origin, int clear)
 {
 	unsigned short int pixel = 0;
+	unsigned short int pixel2 = 0;
+
 	int working = 1;
 	int clearCount = 0;
 	int count = 0;
@@ -159,15 +161,25 @@
 	while(working)
 	{
 		working = fread(&pixel, 1, 2, source);
-		count ++;
-		totalCount++;
+		working |= fread(&pixel2, 1, 2, source);
+
+		count += 2;
+		totalCount += 2;

 		if(!working)
 		{
 			break;
 		}

-		if(pixel)
+		// if the first pixel is blank we need to allow for that
+		if(!pixel && pixel2)
+		{
+			clearCount++;
+		}
+
+		// if there's a value in one and we were previously processing blank pixels then
+		// offset the memory address accordingly
+		if(pixel || pixel2)
 		{
 			if(clearCount)
 			{
@@ -199,19 +211,38 @@
 				if(DEBUG)
 					fprintf(dest, "; reset offset\r\n");
 			}
-
+		}
+
+		if(pixel && pixel2)
+		{
 			if(clear)
 			{
+				fprintf(dest, "\t\tmove.l\t(a1)+,(a0)+\r\n");
+			}
+			else
+			{
+				fprintf(dest, "\t\tmove.l\t#$%04X%04X,(a0)+\r\n", pixel, pixel2);
+			}
+		}
+		else if(pixel || pixel2)
+		{
+			if(clear)
+			{
 				fprintf(dest, "\t\tmove.w\t(a1)+,(a0)+\r\n");
 			}
 			else
 			{
-				fprintf(dest, "\t\tmove.w\t#$%04X,(a0)+\r\n", pixel);
+				fprintf(dest, "\t\tmove.w\t#$%04X,(a0)+\r\n", pixel | pixel2);
+			}
+
+			if(pixel)
+			{
+				clearCount ++;
 			}
 		}
 		else
 		{
-			clearCount ++;
+			clearCount += 2;
 		}

 		if(count == 16)


Use stack allocated + dynamic allocated buffers

Use an stack allocated buffer for small strings and a dynamic allocated one if needed.

The initial allocated size is the size of the format string.

--- vm/builtin/time.cpp
+++ vm/builtin/time.cpp
@@ -268,7 +268,7 @@
     return ary;
   }

-#define STRFTIME_OUTPUT_BUF 128
+#define STRFTIME_STACK_BUF 128

   String* Time::strftime(STATE, String* format) {
     struct tm tm = get_tm();
@@ -282,25 +282,39 @@
       off = offset->to_int();
     }

-    size_t buf_size = STRFTIME_OUTPUT_BUF;
-    char* str = (char*)malloc(buf_size);
-
-    size_t chars = ::strftime_extended(str, buf_size,
+    char stack_str[STRFTIME_STACK_BUF];
+    char* malloc_str = 0;
+
+    size_t chars = ::strftime_extended(stack_str, STRFTIME_STACK_BUF,
                        format->c_str(state), &tm, &ts, CBOOL(is_gmt_) ? 1 : 0,
                        off);

-    while (chars == 0 && format->byte_size() > 0) {
-      buf_size *= 2;
-      str = (char*)realloc(str, buf_size);
-
-      chars = ::strftime_extended(str, buf_size,
+    size_t buf_size = format->byte_size();
+
+    String* result = 0;
+
+    if (chars == 0 && format->byte_size() > 0) {
+      malloc_str = (char*)malloc(buf_size);
+
+      chars = ::strftime_extended(malloc_str, buf_size,
                   format->c_str(state), &tm, &ts, CBOOL(is_gmt_) ? 1 : 0,
                   off);
-    }
-
-    String* result = String::create(state, str, chars);
-
-    free(str);
+
+      while (chars == 0 && format->byte_size() > 0) {
+        buf_size *= 2;
+        malloc_str = (char*)realloc(malloc_str, buf_size);
+
+        chars = ::strftime_extended(malloc_str, buf_size,
+                    format->c_str(state), &tm, &ts, CBOOL(is_gmt_) ? 1 : 0,
+                    off);
+      }
+
+      result = String::create(state, malloc_str, chars);
+
+      free(malloc_str);
+    } else {
+      result = String::create(state, stack_str, chars);
+    }

     return result;
   }


do not fall through after calling the chained SEGV handler

--- libraries/chain/webassembly/eos-vm-oc/executor.cpp
+++ libraries/chain/webassembly/eos-vm-oc/executor.cpp
@@ -30,7 +30,7 @@
 static bool inited_signal;

 static void(*chained_handler)(int,siginfo_t*,void*);
-[[noreturn]] static void segv_handler(int sig, siginfo_t* info, void* ctx)  {
+static void segv_handler(int sig, siginfo_t* info, void* ctx)  {
    control_block* cb_in_main_segment;

    //a 0 GS value is an indicator an executor hasn't been active on this thread recently
@@ -60,8 +60,10 @@
          siglongjmp(*cb_in_main_segment->jmp, EOSVMOC_EXIT_SEGV);

 notus:
-   if(chained_handler)
+   if(chained_handler) {
       chained_handler(sig, info, ctx);
+      return;
+   }
    ::signal(sig, SIG_DFL);
    ::raise(sig);
    __builtin_unreachable();


mem_tracker: Report PRESENTABLE_IMAGE_MEMORY obj

--- layers/mem_tracker.cpp
+++ layers/mem_tracker.cpp
@@ -478,7 +478,7 @@
     return result;
 }

-static bool32_t freeMemObjInfo(XGL_GPU_MEMORY mem)
+static bool32_t freeMemObjInfo(XGL_GPU_MEMORY mem, bool internal)
 {
     bool32_t result = XGL_TRUE;
     // Parse global list to find info w/ mem
@@ -489,7 +489,7 @@
         layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str);
         result = XGL_FALSE;
     } else {
-        if (pInfo->allocInfo.allocationSize == 0) {
+        if (pInfo->allocInfo.allocationSize == 0 && !internal) {
             char str[1024];
             sprintf(str, "Attempting to free memory associated with a Presentable Image, %p, this should not be explicitly freed\n", (void*)mem);
             layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str);
@@ -919,7 +919,7 @@
      * all API objects referencing it and that it is not referenced by any queued command buffers
      */
     loader_platform_thread_lock_mutex(&globalLock);
-    if (XGL_FALSE == freeMemObjInfo(mem)) {
+    if (XGL_FALSE == freeMemObjInfo(mem, false)) {
         char str[1024];
         sprintf(str, "Issue while freeing mem obj %p", (void*)mem);
         layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_FREE_MEM_ERROR, "MEM", str);
@@ -1008,8 +1008,9 @@
             if (0 == pDelInfo->pMemObjInfo->allocInfo.allocationSize) { // Wsi allocated memory has NULL allocInfo w/ 0 size
                 XGL_GPU_MEMORY memToFree = pDelInfo->pMemObjInfo->mem;
                 clearObjectBinding(object);
-                freeMemObjInfo(memToFree);
-            } else {
+                freeMemObjInfo(memToFree, true);
+            }
+            else {
                 char str[1024];
                 sprintf(str, "Destroying obj %p that is still bound to memory object %p\nYou should first clear binding by calling xglBindObjectMemory(%p, 0, XGL_NULL_HANDLE, 0)", object, (void*)pDelInfo->pMemObjInfo->mem, object);
                 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_DESTROY_OBJECT_ERROR, "MEM", str);


Calling finish() for RenderScript kernel execution

--- runtime/hipacc_rs.hpp
+++ runtime/hipacc_rs.hpp
@@ -435,9 +435,12 @@
 ) {
     long end, start;
     HipaccContext &Ctx = HipaccContext::getInstance();
-
+    RenderScript* rs = Ctx.get_context();
+
+    rs->finish();
     start = getNanoTime();
     (script->*kernel)(out);
+    rs->finish();
     end = getNanoTime();

     if (print_timing) {
@@ -458,9 +461,12 @@
 ) {
     long end, start;
     HipaccContext &Ctx = HipaccContext::getInstance();
-
+    RenderScript* rs = Ctx.get_context();
+
+    rs->finish();
     start = getNanoTime();
     (script->*kernel)(in, out);
+    rs->finish();
     end = getNanoTime();

     if (print_timing) {


INTEGRATION: CWS sb25 (1.2.16); FILE MERGED 2004/12/13 12:34:22 sb 1.2.16.1: #i37077# Added missing XMLOFF_DLLPUBLIC to new xforms stuff.

--- xmloff/inc/xformsimport.hxx
+++ xmloff/inc/xformsimport.hxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: xformsimport.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.3 $
  *
- *  last change: $Author: obo $ $Date: 2004-11-16 10:04:05 $
+ *  last change: $Author: rt $ $Date: 2005-01-11 14:20:39 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -61,6 +61,14 @@
 #ifndef _XMLOFF_XFORMSIMPORT_HXX
 #define _XMLOFF_XFORMSIMPORT_HXX

+#ifndef _SAL_CONFIG_H_
+#include "sal/config.h"
+#endif
+
+#ifndef INCLUDED_XMLOFF_DLLAPI_H
+#include "xmloff/dllapi.h"
+#endif
+
 #include <tools/solar.h> // for USHORT
 #include <com/sun/star/uno/Reference.hxx>

@@ -75,7 +83,7 @@
 } } }

 /** create import context for xforms:model element. */
-SvXMLImportContext* createXFormsModelContext(
+XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext(
     SvXMLImport& rImport,
     USHORT nPrefix,
     const rtl::OUString& rLocalName );


fix bad asm stmt

fix bad asm stmt

--- panda/src/dxgsg/dxGraphicsStateGuardian.cxx
+++ panda/src/dxgsg/dxGraphicsStateGuardian.cxx
@@ -158,7 +158,7 @@
         push ecx
         mov ecx, cColorf
         fild tempcolorval
-        fld [ecx]
+        fld DWORD PTR [ecx]
         fmul ST(0),ST(1)
         fistp tempcolorval  ; no way to store directly to int register
         mov eax, tempcolorval


fix guards for testing library redux

fix guards for testing library redux

--- libraries/testing/include/eosio/testing/tester.hpp
+++ libraries/testing/include/eosio/testing/tester.hpp
@@ -319,7 +319,9 @@
          vcfg.blocks_dir      = tempdir.path() / std::string("v_").append(config::default_blocks_dir_name);
          vcfg.state_dir  = tempdir.path() /  std::string("v_").append(config::default_state_dir_name);
          vcfg.state_size = 1024*1024*8;
+         vcfg.state_guard_size = 0;
          vcfg.reversible_cache_size = 1024*1024*8;
+         vcfg.reversible_guard_size = 0;
          vcfg.contracts_console = false;

          vcfg.genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000");


Uncomment the softmax

Uncomment the softmax

--- CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/arm_nnexamples_cifar10.cpp
+++ CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/arm_nnexamples_cifar10.cpp
@@ -185,7 +185,7 @@
   arm_fully_connected_q7_opt(img_buffer2, ip1_wt, IP1_DIM, IP1_OUT, IP1_BIAS_LSHIFT, IP1_OUT_RSHIFT, ip1_bias,
                              output_data, (q15_t *) img_buffer1);

-  //arm_softmax_q7(output_data, 10, output_data);
+  arm_softmax_q7(output_data, 10, output_data);

   for (int i = 0; i < 10; i++)
   {


use from_blob to avoid memcpy (#4118)

use from_blob to avoid memcpy (#4118)

Co-authored-by: Nicolas Hug <b961f2b01ca19b33b8cc7fe0d8d60c0676a9ec0a@fb.com>
Co-authored-by: Vasilis Vryniotis <d748cd3f763058dcf20e5489b9bc2373b78db68c@users.noreply.github.com>

--- torchvision/csrc/io/image/cpu/encode_jpeg.cpp
+++ torchvision/csrc/io/image/cpu/encode_jpeg.cpp
@@ -18,12 +18,12 @@

 torch::Tensor encode_jpeg(const torch::Tensor& data, int64_t quality) {
   // Define compression structures and error handling
-  struct jpeg_compress_struct cinfo;
-  struct torch_jpeg_error_mgr jerr;
+  struct jpeg_compress_struct cinfo {};
+  struct torch_jpeg_error_mgr jerr {};

   // Define buffer to write JPEG information to and its size
   unsigned long jpegSize = 0;
-  uint8_t* jpegBuf = NULL;
+  uint8_t* jpegBuf = nullptr;

   cinfo.err = jpeg_std_error(&jerr.pub);
   jerr.pub.error_exit = torch_jpeg_error_exit;
@@ -34,7 +34,7 @@
      * We need to clean up the JPEG object and the buffer.
      */
     jpeg_destroy_compress(&cinfo);
-    if (jpegBuf != NULL) {
+    if (jpegBuf != nullptr) {
       free(jpegBuf);
     }

@@ -92,16 +92,10 @@
   jpeg_destroy_compress(&cinfo);

   torch::TensorOptions options = torch::TensorOptions{torch::kU8};
-  auto outTensor = torch::empty({(long)jpegSize}, options);
-
-  // Copy memory from jpeg buffer, since torch cannot get ownership of it via
-  // `from_blob`
-  auto outPtr = outTensor.data_ptr<uint8_t>();
-  std::memcpy(outPtr, jpegBuf, sizeof(uint8_t) * outTensor.numel());
-
-  free(jpegBuf);
-
-  return outTensor;
+  auto out_tensor =
+      torch::from_blob(jpegBuf, {(long)jpegSize}, ::free, options);
+  jpegBuf = nullptr;
+  return out_tensor;
 }
 #endif


Clipping the other end of segments WIP

Clipping the other end of segments WIP

--- src/mgl/regioner.cc
+++ src/mgl/regioner.cc
@@ -585,6 +585,19 @@
 	}
 }

+void findIntersectPoints(SegmentIndex &index, const LineSegment2 &subject,
+                         PointList &intersections) {
+	SegmentList found;
+	index.search(found, LineSegmentFilter(subject));
+
+	for (SegmentList::const_iterator possible = found.begin();
+		 possible != found.end(); ++possible) {
+        Vector2 point;
+        if (segmentIntersection(subject, possible, point))
+            intersections.push_back(point);
+    }
+}
+

 void findWallPairs(const Scalar span, const SegmentList segs,
 				   SegmentIndex &index, SegmentPairSet &walls) {
@@ -669,6 +682,60 @@

 }

+#include <algorithm>
+
+class DistanceCmp {
+public:
+    DistanceCmp(const Vector2 &anchor) : m_anchor(anchor) {}
+    bool operator()(const Vector2 &a, const Vector2 &b) {
+        return LineSegment2(m_anchor, a).squaredLength() <
+               LineSegment2(m_anchor, b).squaredLength();
+    }
+private:
+    Vector2 m_anchor;
+};
+
+void clipInteriorSegments(SegmentIndex &outline, const Scalar margin,
+                          const SegmentList &origPieces,
+                          SegmentList &clippedPieces) {
+
+    //Build an index of the spur segments
+    SegmentIndex pieceIndex;
+    for (SegmentList::const_iterator piece = origPieces.begin();
+         piece != origPieces.end(); piece++)
+        pieceIndex.insert(*piece);
+
+    // a parallel vector to origPieces tracking all the intersection points
+    // on each segment
+    vector<vector<Vector2> > intersectionPoints;
+
+    for (SegmentList::const_iterator piece = origPieces.begin();
+         piece != origPieces.end(); piece++) {
+        intersectionPoints.push_back(PointList());
+        PointList &cur = intersectionPoints.back();
+        findIntersectPoints(outline, *piece, cur);
+    }
+
+    for (int i = 0; i <= origPieces.size(); ++i) {
+        LineSegment2 &orig = origPieces[i];
+        PointList &points = intersectionPoints[i];
+
+        Vector2 start;
+
+        if (endPointValid(outline, orig, orig.a)) {
+            start = orig.a;
+            points.push_back(orig.a);
+        }
+        else {
+            start = closest(points, orig.a);
+        }
+
+        if (endPointValid(outline, orig, orig.b))
+            points.push_back(orig.b);
+
+        sort(
+}
+
 void Regioner::fillSpurLoops(const LoopList &spurLoops,
 							 const LayerMeasure &layermeasure,
 							 OpenPathList &spurs) {
@@ -713,7 +780,9 @@
         cutInteriorSegment(index, minSpurWidth / 2, *piece);
     }

-	//TODO: join segments into a chain
+    SegmentList clippedPieces;
+    clipDanglingSegments(index, minSpurWidth, pieces, clippedPieces);
+
 	for (SegmentList::const_iterator piece = pieces.begin();
 		 piece != pieces.end(); ++piece) {
 		spurs.push_back(OpenPath());


MemcachedConnection: always close fd

MemcachedConnection: always close fd

Always close fd, even in SSL mode. SSL is just another layer on top of
the socket.

I was getting EMFILE after running lots of tests.

Change-Id: I07dda671a4ea3fed1605a38fcdd0dcef0eab5297
Reviewed-on: http://review.couchbase.org/72895
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- protocol/connection/client_connection.cc
+++ protocol/connection/client_connection.cc
@@ -175,7 +175,6 @@

 void MemcachedConnection::close() {
     if (ssl) {
-        // the socket is closed by the underlying BIO stuctures
         if (bio != nullptr) {
             BIO_free_all(bio);
             bio = nullptr;
@@ -184,11 +183,11 @@
             SSL_CTX_free(context);
             context = nullptr;
         }
-    } else {
-        if (sock != INVALID_SOCKET) {
-            ::closesocket(sock);
-            sock = INVALID_SOCKET;
-        }
+    }
+
+    if (sock != INVALID_SOCKET) {
+        ::closesocket(sock);
+        sock = INVALID_SOCKET;
     }
 }


Treat final variables initialized with a literal as constants. Also sneak in a small cleanup.

R=hausner@google.com

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

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@27973 260f80e4-7a28-3924-810f-c04153c831b5

--- runtime/lib/string.cc
+++ runtime/lib/string.cc
@@ -181,6 +181,7 @@
   return Symbols::FromCharCode(value);
 }

+
 DEFINE_NATIVE_ENTRY(String_codeUnitAt, 2) {
   const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0));
   GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1));


MS:

MS:

-ENH: added streaming support with the option -s (needed for Keelin for the EMPIRE10 challenge)

--- src/imagetovectorimage/imagetovectorimage.cxx
+++ src/imagetovectorimage/imagetovectorimage.cxx
@@ -13,7 +13,7 @@
 { \
   typedef itk::Image< type, dim >       InputImageType; \
   typedef itk::VectorImage< type, dim > OutputImageType; \
-  function< InputImageType, OutputImageType >( inputFileNames, outputFileName ); \
+  function< InputImageType, OutputImageType >( inputFileNames, outputFileName, numberOfStreams ); \
   supported = true; \
 }

@@ -23,7 +23,8 @@
 template< class InputImageType, class OutputImageType >
 void ComposeVectorImage(
   const std::vector<std::string> & inputFileNames,
-  const std::string & outputFileName );
+  const std::string & outputFileName,
+  const unsigned int & numberOfStreams );

 /** Declare PrintHelp. */
 void PrintHelp( void );
@@ -49,6 +50,10 @@

   std::string outputFileName = "VECTOR.mhd";
   bool retout = parser->GetCommandLineArgument( "-out", outputFileName );
+
+  /** Support for streaming. */
+  unsigned int numberOfStreams = 1;
+  bool rets = parser->GetCommandLineArgument( "-s", numberOfStreams );

   /** Check if the required arguments are given. */
   if ( !retin )
@@ -143,8 +148,10 @@
    */

 template< class InputImageType, class OutputImageType >
-void ComposeVectorImage( const std::vector<std::string> & inputFileNames,
-  const std::string & outputFileName )
+void ComposeVectorImage(
+  const std::vector<std::string> & inputFileNames,
+  const std::string & outputFileName,
+  const unsigned int & numberOfStreams )
 {
   /** Typedef's. */
   typedef itk::ImageFileReader< InputImageType >          ReaderType;
@@ -157,7 +164,6 @@
   {
     readers[ i ] = ReaderType::New();
     readers[ i ]->SetFileName( inputFileNames[ i ] );
-    readers[ i ]->Update();
   }

   /** Create index extractor and writer. */
@@ -171,20 +177,25 @@
   typename WriterType::Pointer writer = WriterType::New();
   writer->SetFileName( outputFileName );
   writer->SetInput( composer->GetOutput() );
+  writer->SetNumberOfStreamDivisions( numberOfStreams );
   writer->Update();

 } // end ComposeVectorImage()

-  /**
-   * ******************* PrintHelp *******************
-   */
-void PrintHelp()
+/**
+ * ******************* PrintHelp *******************
+ */
+
+void PrintHelp( void )
 {
-  std::cout << "Usage:" << std::endl << "pximagetovectorimage" << std::endl;
-  std::cout << "  -in      inputFilenames, at least 2" << std::endl;
-  std::cout << "  [-out]   outputFilename, default VECTOR.mhd" << std::endl;
-  std::cout << "Supported: 2D, 3D, (unsigned) char, (unsigned) short, (unsigned) int, (unsigned) long, float, double." << std::endl;
+  std::cout << "Usage:" << std::endl << "pximagetovectorimage\n";
+  std::cout << "  -in      inputFilenames, at least 2\n";
+  std::cout << "  [-out]   outputFilename, default VECTOR.mhd\n";
+  std::cout << "  [-s]     number of streams, default 1.\n";
+  std::cout << "Supported: 2D, 3D, (unsigned) char, (unsigned) short, "
+    << "(unsigned) int, (unsigned) long, float, double.\n";
   std::cout << "Note: make sure that the input images are of the same type, size, etc." << std::endl;
+
 } // end PrintHelp()


CODEXL-3064 Vulkan UI changes present in DX12 UI

--- CodeXL/Components/GpuProfiling/AMDTGpuProfiling/gpTraceDataContainer.cpp
+++ CodeXL/Components/GpuProfiling/AMDTGpuProfiling/gpTraceDataContainer.cpp
@@ -1273,17 +1273,24 @@

 QString gpTraceDataContainer::QueueDisplayName(const QString& queuePtrStr)
 {
-    // Get the name with the index
-    QString retVal = QueueNameFromPointer(queuePtrStr);
+
+    QString retVal;

     // Append the queue type to the queue name in DX12 (irrelevant in Vulkan)
     if (SessionAPIType() == ProfileSessionDataItem::DX12_API_PROFILE_ITEM)
     {
         int queueType = QueueType(queuePtrStr);
         QString queueTypeStr = CommandListTypeAsString(queueType);
+        retVal.append(queueTypeStr);
         retVal.append(AF_STR_SpaceA);
-        retVal.append(queueTypeStr);
-    }
+        retVal.append(QString(GPU_STR_timeline_QueueBranchName).arg(ProfileSessionDataItem::QueueDisplayName(queuePtrStr)));
+    }
+    else
+    {
+        // for vulkan: Get the name with the index
+        retVal = QueueNameFromPointer(queuePtrStr);
+    }
+
     return retVal;
 }


process improvment

process improvment

--- inviwo/modules/graph2d/processors/plot2d.cpp
+++ inviwo/modules/graph2d/processors/plot2d.cpp
@@ -62,9 +62,9 @@
 	indices_ = lineMesh_->addIndexBuffer(DrawType::Lines, ConnectivityType::None);
 	vec4 col(1, 0, 0, 1);
 	vec3 p1(0, 0, 0);
-	vec3 p2(4, 4, 0);
-	vec3 p3(6, 1, 0);
-	vec3 p4(2, 3, 0);
+	vec3 p2(0.5, 0.5, 0);
+	vec3 p3(0.1, 0.9, 0);
+	vec3 p4(0.6, 0.2, 0);
 	indices_->add(lineMesh_->addVertex(p1, p1, p1, col));
 	indices_->add(lineMesh_->addVertex(p2, p2, p2, col));
 	indices_->add(lineMesh_->addVertex(p2, p2, p2, col));
@@ -203,108 +203,23 @@
 	const size2_t dims = outport_.getDimensions();
 	double aspect = (double)dims[0] / (double)dims[1];

-
-
-	if (toggle3d_.get()) {
-
-		lineMesh_->setBasis(Matrix<3U, float>(size_.get()[0], 0, 0, 0, size_.get()[1], 0, 0, 0, 1));
-		lineMesh_->setOffset(position_.get());
-
-
-		// Render with the camera property
-		axisRenderers_[0].render(&camera_.get(), dims, origin_, origin_ + vec3(graphDims_[0], 0, 0), vec3(0.0f, 1.0f, 0.0f));
-		axisRenderers_[1].render(&camera_.get(), dims, origin_, origin_ + vec3(0, graphDims_[1], 0), vec3(1.0f, 0.0f, 0.0f));
-
-
-	}
-	else {
-		//auto v = origin_;
-		//LogInfo("Ori1: " << std::to_string(origin_[0]) << ", " << std::to_string(origin_[1]));
-		//updateDimensions();
-		//LogInfo("Ori2: " << std::to_string(origin_[0]) << ", " << std::to_string(origin_[1]));
-		//LogInfo((v == origin_));
-		// Render with the 2d camera instead.
-		const double scale = (double)dims[0] / 512;
-		const double width = 50 * scale;
-		const double height = width / aspect;
-		const double padding = 40 * width / (double)dims[0];
-		//const vec3 startPos(-width / 2 + padding, -height / 2 + padding, 0);
-		//const vec3 startPos = origin_;
-
-		//LogInfo("diff: " << std::to_string(origin_[0] - startPos[0]) << ", " << std::to_string(origin_[1] - startPos[1]) << ", " << std::to_string(origin_[2] - startPos[2]))
-
-		//LogInfo("Pos: " << std::to_string(startPos[0]) << ", " << std::to_string(startPos[1]));
-		//LogInfo("Ori: " << std::to_string(origin_[0]) << ", " << std::to_string(origin_[1]));
-		//lineMesh_->setBasis(Matrix<3U, float>(scale, 0, 0, 0, scale, 0, 0, 0, 1));
-		//lineMesh_->setOffset(startPos);
-
-		//lineMesh_->setBasis(Matrix<3U, float>(size_.get()[0], 0, 0, 0, size_.get()[1], 0, 0, 0, 1));
-		////lineMesh_->setOffset(position_.get());
-		//LogInfo("Offset: " + std::to_string(startPos[0]) + ", " + std::to_string(startPos[1]) + ", " + std::to_string(startPos[2]));
-		//LogInfo("basis: " + std::to_string(size_.get()[0]) + ", " + std::to_string(size_.get()[1]));
-
-		//camera2d_->setAspectRatio(aspect);
-		//static_cast<OrthographicCamera*>(camera2d_.get())->setFrustum({ -width / 2.0f, +width / 2.0f, -width / 2.0f / aspect, +width / 2.0f / aspect });
-
-		axisRenderers_[0].render(camera2d_.get(), dims, origin_, origin_ + vec3(width - padding*2, 0, 0), vec3(0.0f, 1.0f, 0.0f));
-		axisRenderers_[1].render(camera2d_.get(), dims, origin_, origin_ + vec3(0, height - padding*2, 0), vec3(1.0f, 0.0f, 0.0f));
-	}
-
-	if (toggle3d_.get()) {
-		shader_.activate();
-		utilgl::setUniforms(shader_, lightingProperty_);
-
-		utilgl::setShaderUniforms(shader_, camera_.get(), "camera");
-		utilgl::setShaderUniforms(shader_, *meshDrawer_->getMesh(), "geometry");
-		shader_.setUniform("pickingEnabled", meshutil::hasPickIDBuffer(meshDrawer_->getMesh()));
-		meshDrawer_->draw();
-
-		//Matrix<3U, float> m(1, 0, 0, 0, 1, 0, 0, 0, 1);
-
-		//const Mesh* mesh = meshDrawer_->getMesh();
-
-		//meshDrawer_->getMesh()->setBasis(basis);
-		//meshDrawer_->getMesh()->setBasis(basis);
-
-		shader_.deactivate();
-	}
-	else {
-
-		const double scalex = (double)dims[0] / 512;
-		const double scaley = (double)dims[1] / 512;
-		shader_.activate();
-		//mat4 proj1 = glm::ortho(-size_.get()[0], 1.0f, -size_.get()[1], 1.0f, -200.0f, 100.0f);
-		//proj1[0][0] *= scalex;
-		//proj1[1][1] *= scaley;
-		//proj1[3][0] += size_.get()[0];
-		//proj1[3][1] += size_.get()[1];
-
-		utilgl::setShaderUniforms(shader_, *camera2d_.get(), "camera");
-		utilgl::setShaderUniforms(shader_, *meshDrawer_->getMesh(), "geometry");
-		shader_.setUniform("pickingEnabled", meshutil::hasPickIDBuffer(meshDrawer_->getMesh()));
-		meshDrawer_->draw();
-		/*mat4 proj = glm::ortho(-0.0f, 1.0f, -0.0f, 1.0f, -200.0f, 100.0f);
-		LogInfo("Projection1: \n"
-			<< proj1[0][0] << ", " << proj1[0][1] << ", " << proj1[0][2] << ", " << proj1[0][3] << "\n"
-			<< proj1[1][0] << ", " << proj1[1][1] << ", " << proj1[1][2] << ", " << proj1[1][3] << "\n"
-			<< proj1[2][0] << ", " << proj1[2][1] << ", " << proj1[2][2] << ", " << proj1[2][3] << "\n"
-			<< proj1[3][0] << ", " << proj1[3][1] << ", " << proj1[3][2] << ", " << proj1[3][3] << "\n");
-		LogInfo("Projection2: \n"
-			<< proj[0][0] << ", " << proj[0][1] << ", " << proj[0][2] << ", " << proj[0][3] << "\n"
-			<< proj[1][0] << ", " << proj[1][1] << ", " << proj[1][2] << ", " << proj[1][3] << "\n"
-			<< proj[2][0] << ", " << proj[2][1] << ", " << proj[2][2] << ", " << proj[2][3] << "\n"
-			<< proj[3][0] << ", " << proj[3][1] << ", " << proj[3][2] << ", " << proj[3][3] << "\n");*/
-
-		//shader2d_.setUniform("projectionMatrix", proj1);
-		//utilgl::setShaderUniforms(shader2d_, *camera2d_.get(), "camera");
-		//utilgl::setShaderUniforms(shader2d_, *meshDrawer_->getMesh(), "geometry_");
-		meshDrawer_->draw();
-		shader_.deactivate();
-
-	}
-
-
-
+	Camera* activeCamera;
+
+	if (toggle3d_.get())
+		activeCamera = &camera_.get();
+	else
+		activeCamera = camera2d_.get();
+
+	axisRenderers_[0].render(activeCamera, dims, origin_, origin_ + vec3(graphDims_[0], 0, 0), vec3(0.0f, 1.0f, 0.0f));
+	axisRenderers_[1].render(activeCamera, dims, origin_, origin_ + vec3(0, graphDims_[1], 0), vec3(1.0f, 0.0f, 0.0f));
+
+	// Render lines.
+	shader_.activate();
+	utilgl::setUniforms(shader_, lightingProperty_);
+	utilgl::setShaderUniforms(shader_, *activeCamera, "camera");
+	utilgl::setShaderUniforms(shader_, *meshDrawer_->getMesh(), "geometry");
+	meshDrawer_->draw();
+	shader_.deactivate();

 	meshOutport_.setData(lineMesh_);

@@ -364,7 +279,6 @@
 }

 void Plot2dProcessor::updateDimensions() {
-	//LogInfo("Updating dimensions");
 	if (toggle3d_.get()) {
 		origin_ = position_.get();
 		graphDims_ = size_.get();
@@ -375,19 +289,17 @@
 		const float scale = (double)dims[0] / 512;
 		const float width = 50 * scale;
 		const float height = width / aspect;
-		const float padding = 40 * width / (double)dims[0];
+		const float padding = 50 * width / (double)dims[0];
+
 		oldDims_ = dims;
-
-		origin_[0] = -50 * scale / 2 + padding;
-		origin_[1] = -50 * scale / aspect / 2 + padding;
-		origin_[2] = 0;
-
-		graphDims_[0] = width - 2 * padding;
-		graphDims_[1] = height - 2 * padding;
-
+		origin_ = vec3(-width / 2 + padding, -height / 2 + padding, 0);
+		graphDims_ = vec2(width - 2 * padding, height - 2 * padding);
+		// Update 2d camera to fit new dimensions.
 		static_cast<OrthographicCamera*>(camera2d_.get())->setFrustum({ -width / 2.0f, +width / 2.0f, -width / 2.0f / aspect, +width / 2.0f / aspect });
-
-	}
+	}
+	// Scale and offset line mesh to align with axises.
+	lineMesh_->setBasis(Matrix<3U, float>(graphDims_[0], 0, 0, 0, graphDims_[1], 0, 0, 0, 1));
+	lineMesh_->setOffset(origin_);
 }

 void Plot2dProcessor::rebuildMesh() {


BDB: restore DB_PRIVATE flag to environment

Satoshi's commits fdbf76d and c8ad9b8 (SVN import) removed the
DB_PRIVATE flag from the environment.  In part, this enables processes
other than bitcoind to examine the active database environment.

However, this incurs a slight performance penalty versus working
entirely within application memory (DB_PRIVATE).  Because bitcointools
and other direct-BDB-accessing tools are not used by the vast
majority of users, prefer to default with DB_PRIVATE with the option
of disabling it if needed via -privdb=0.

--- src/db.cpp
+++ src/db.cpp
@@ -75,6 +75,10 @@
     unsigned int nFlags = DB_THREAD;
     if (fCreate)
         nFlags |= DB_CREATE;
+
+    unsigned int nEnvFlags = 0;
+    if (GetBoolArg("-privdb", true))
+        nEnvFlags |= DB_PRIVATE;

     {
         LOCK(cs_db);
@@ -106,7 +110,8 @@
                              DB_INIT_MPOOL |
                              DB_INIT_TXN   |
                              DB_THREAD     |
-                             DB_RECOVER,
+                             DB_RECOVER    |
+                             nEnvFlags,
                              S_IRUSR | S_IWUSR);
             if (ret > 0)
                 throw runtime_error(strprintf("CDB() : error %d opening database environment", ret));


Minor cleanup

Minor cleanup

--- src/libutil/util.cc
+++ src/libutil/util.cc
@@ -1078,9 +1078,9 @@
 }

-bool hasPrefix(const string & s, const string & suffix)
-{
-    return s.compare(0, suffix.size(), suffix) == 0;
+bool hasPrefix(const string & s, const string & prefix)
+{
+    return s.compare(0, prefix.size(), prefix) == 0;
 }


Implement more of the Server.

Implement more of the Server.

--- Server.cpp
+++ Server.cpp
@@ -3,12 +3,16 @@
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <cstring>
+#include "MouseEvent.h"
 #include "InputPacket.h"
 #include "Server.h"

 using namespace ni;

-Server::Server(short port) : m_socket(createSocket(port)), m_running(true) {
+Server::Server(DeviceType devices, short port) : m_inputSystem(devices),
+												 m_socket(createSocket(port)),
+												 m_running(true)
+{

 }

@@ -24,7 +28,10 @@

 void Server::processPacket(const InputPacket& packet) {
 	if(packet.isSafe()) {
-
+		if(packet.type == DeviceType::Mouse && packet.length == sizeof(MouseEvent)) {
+			const MouseEvent event = *reinterpret_cast<const MouseEvent*>(packet.data);
+			m_inputSystem.sendMouseEvent(event);
+		}
 	}
 }


[DWARF] dwarfgen::LineTable::writeData(): pacify -Wcovered-switch-default

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@331983 91177308-0d34-0410-b5e6-96231b3b80d8

--- unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -203,16 +203,15 @@
     case Long:
     case Quad:
       Asm.OutStreamer->EmitIntValue(Entry.Value, Entry.Length);
-      break;
+      continue;
     case ULEB:
       Asm.EmitULEB128(Entry.Value);
-      break;
+      continue;
     case SLEB:
       Asm.EmitSLEB128(Entry.Value);
-      break;
-    default:
-      llvm_unreachable("unsupported ValueAndLength Length value");
+      continue;
     }
+    llvm_unreachable("unsupported ValueAndLength Length value");
   }
 }


fixed contactPhi.  resolves #1046 . (might also help with #538)

--- systems/controllers/controlUtil.cpp
+++ systems/controllers/controlUtil.cpp
@@ -131,10 +131,10 @@

   int i=0;
   for (std::vector<Vector4d,aligned_allocator<Vector4d>>::iterator pt_iter=supp.contact_pts.begin(); pt_iter!=supp.contact_pts.end(); pt_iter++) {
-//     std::cout << "body pt: " << *pt_iter << std::endl;    r->forwardKin(supp.body_idx,*pt_iter,0,contact_pos);
+    r->forwardKin(supp.body_idx,*pt_iter,0,contact_pos);
     collisionDetect(map_ptr,contact_pos,pos,&normal,terrain_height);
     pos -= contact_pos;  // now -rel_pos in matlab version
-//     std::cout << "contact pos: " << contact_pos << std::endl;
+//    std::cout << "contact pos: " << contact_pos.transpose() << std::endl;
     phi(i) = pos.norm();
     if (pos.dot(normal)>0)
       phi(i)=-phi(i);
@@ -312,6 +312,7 @@
     pm = mxGetField(supp_data, i, "support_logic_map");
     if (mxIsDouble(pm)) {
       logic_map_double = mxGetPrSafe(pm);
+      assert(mxGetM(pm)==4);
       for (j = 0; j < 4; j++) {
         se.support_logic_map[j] = logic_map_double[j] != 0;
       }
@@ -334,7 +335,7 @@

 bool isSupportElementActive(SupportStateElement* se, bool contact_force_detected, bool kinematic_contact_detected) {
   bool is_active;
-  std::cout << "checking element with body: " << se->body_idx << " force: " << contact_force_detected << " kin: " << kinematic_contact_detected << std::endl;
+//  std::cout << "checking element with body: " << se->body_idx << " force: " << contact_force_detected << " kin: " << kinematic_contact_detected << std::endl;
   // Implement the logic described in QPInputConstantHeight.m
   if (!contact_force_detected && !kinematic_contact_detected) {
     is_active = se->support_logic_map[0];


compiler cannot determine these variables are always set, so set them

--- vowpalwabbit/lrq.cc
+++ vowpalwabbit/lrq.cc
@@ -66,8 +66,8 @@
     }

   size_t which = ec.example_counter;
-  float first_prediction;
-  float first_loss;
+  float first_prediction = 0;
+  float first_loss = 0;
   unsigned int maxiter = (is_learn && ! example_is_test (ec)) ? 2 : 1;

   bool do_dropout = lrq.dropout && is_learn && ! example_is_test (ec);


fix draw_poly, release order

fix draw_poly, release order

--- panda/src/dxgsg/dxGraphicsStateGuardian.cxx
+++ panda/src/dxgsg/dxGraphicsStateGuardian.cxx
@@ -1217,7 +1217,7 @@
   dxgsg_cat.debug() << "draw_polygon()" << endl;
 #endif

-/*  wireframe polygon will be drawn as multu-tri trifan until I get this casting issue straightened out
+/*  wireframe polygon will be drawn as multi-tri trifan until I get this casting issue straightened out
    DWORD rstate;
    _d3dDevice->GetRenderState(D3DRENDERSTATE_FILLMODE, &rstate);
    if(rstate!=D3DFILL_WIREFRAME) {
@@ -1228,7 +1228,7 @@
    }
 */

-//   draw_multitri(geom, D3DPT_TRIANGLEFAN);
+   draw_multitri(geom, D3DPT_TRIANGLEFAN);

 #ifdef WBD_GL_MODE
   int nprims = geom->get_num_prims();
@@ -4407,11 +4407,6 @@

 	release_all_textures();

-	// Release the DDraw and D3D objects used by the app
-    RELEASE(_zbuf);
-    RELEASE(_back);
-    RELEASE(_pri);
-
     // Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
     if( _d3dDevice!=NULL ) {
         if( 0 < _d3dDevice->Release() ) {
@@ -4419,6 +4414,11 @@
         }
         _d3dDevice = NULL;	// clear the pointer in the Gsg
     }
+
+	// Release the DDraw and D3D objects used by the app
+    RELEASE(_zbuf);
+    RELEASE(_back);
+    RELEASE(_pri);

     RELEASE(_d3d);


Fix bug: use correct index for pressure

Fix bug: use correct index for pressure

--- src/misc/probes.cpp
+++ src/misc/probes.cpp
@@ -134,7 +134,7 @@
                                                 mesh->dim, nullptr,
                                                 vel.data()); CHKERRQ(ierr);
         }
-        else if (field == 4)  // monitor the pressure field
+        else if (field == 3)  // monitor the pressure field
         {
             ierr = monitorVec(mesh->da[3], solution->pGlobal , n, t); CHKERRQ(ierr);
         }


MB-30301: throw system_error in MemcachedConnection::connect failure msg

If MemcachedConnection::connect() fails (for example due to exhausting
ephemeral ports), include the socket error description in the
exception raised. This should aid in debugging such issues.

Change-Id: I3b19ea288d88b784759d4922e3782fcd5a3706c6
Reviewed-on: http://review.couchbase.org/96744
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- protocol/connection/client_connection.cc
+++ protocol/connection/client_connection.cc
@@ -325,6 +325,7 @@
     }

     if (sock == INVALID_SOCKET) {
+        auto error = cb::net::get_socket_error();
         std::string msg("Failed to connect to: ");
         if (family == AF_INET || family == AF_UNSPEC) {
             if (host.empty()) {
@@ -340,7 +341,7 @@
             }
         }
         msg.append(std::to_string(port));
-        throw std::runtime_error(msg);
+        throw std::system_error(error, std::system_category(), msg);
     }
 }