Cleaned up handling of gdb cleanup

Cleaned up handling of gdb cleanup

For quite some time now, our --gdb flag on the compiler has not
cleaned up after itself if the program is re-run or terminated
prematurely.  This was due to a combination of a crufty
implementation on our part and seeming bugs/instabilities in
gdb.  A test of this could be done by compiling a program
with --gdb, setting a breakpoint in codegen, typing "run"
every time the breakpoint is hit, and watching
/tmp/chpl-$user-$pid.deleteme directories accumulate.

With gdb 6.6, the instability in gdb is fixed, and so with
this change, I've re-enabled our cleaning up after ourselves
and also cleaned up our approach to doing so.  Now, when
a run or quit command is executed, the Chapel compiler
variable tmpdirname is inspected to see whether it is NULL
or not.  If it is not, gdb hook commands run our normal
cleanup_for_exit() call before running the user's command.

Previously, we were doing a similar check by hacking values
into the internal gdb variable $_exitcode to determine whether
the program was running or had terminated.  This approach
might also start working again in gdb 6.6 (I didn't check),
but isn't as attractive given how hacky it feels.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@14221 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

--- compiler/util/files.cpp
+++ compiler/util/files.cpp
@@ -17,7 +17,15 @@
 char ldflags[256] = "";
 bool ccwarnings = false;

+
+//
+// IF tmpdirname's name CHANGES, IT NEEDS TO CHANGE IN createGDBFile AS WELL
+//
 static const char* tmpdirname = NULL;
+//
+//                 ^^^^^^^^^^
+//
+
 static const char* intDirName = NULL; // directory for intermediates; tmpdir or saveCDir

 static const int MAX_CHARS_PER_PID = 32;
@@ -280,24 +288,22 @@
     }
   }
   fprintf(gdbfile, "\n");
-  fprintf(gdbfile, "set $_exitcode = 's'\n");
-//   fprintf(gdbfile, "define hook-run\n");
-//   fprintf(gdbfile, "  if ($_exitcode == 'r')\n");
-//   fprintf(gdbfile, "    call cleanup_for_exit()\n");
-//   fprintf(gdbfile, "  end\n");
-//   fprintf(gdbfile, "  set $_exitcode = 'r'\n");
-//   fprintf(gdbfile, "end\n");
-  fprintf(gdbfile, "define hook-quit\n");
-  fprintf(gdbfile, "  if ($_exitcode == 'r')\n");
+  fprintf(gdbfile, "define hook-run\n");
+  fprintf(gdbfile, "  if (tmpdirname != 0)\n");
   fprintf(gdbfile, "    call cleanup_for_exit()\n");
   fprintf(gdbfile, "  end\n");
   fprintf(gdbfile, "end\n");
+  fprintf(gdbfile, "define hook-quit\n");
+  fprintf(gdbfile, "  if (tmpdirname != 0)\n");
+  fprintf(gdbfile, "    call cleanup_for_exit()\n");
+  fprintf(gdbfile, "  end\n");
+  fprintf(gdbfile, "end\n");
   fprintf(gdbfile, "define halt\n");
-  fprintf(gdbfile, "  set $_exitcode = 'h'\n");
+  fprintf(gdbfile, "  set tmpdirname = 0\n");
   fprintf(gdbfile, "  quit\n");
   fprintf(gdbfile, "end\n");
   fprintf(gdbfile, "define rerun\n");
-  fprintf(gdbfile, "  set $_exitcode = 'r'\n");
+  fprintf(gdbfile, "  set tmpdirname = 0\n");
   fprintf(gdbfile, "  run\n");
   fprintf(gdbfile, "end\n");
   fprintf(gdbfile, "define view\n");


fixed using backspace after tab expand

fixed using backspace after tab expand

--- extension/src/shell.cpp
+++ extension/src/shell.cpp
@@ -143,8 +143,10 @@
   if (dir.GetFirst(&filename, word + "*"))
   {
     const wxString expansion = filename.Mid(word.length());
-
-    AddText(expansion);
+
+    // We cannot use our AddText, as command start pos
+    // should not be changed.
+    wxExSTC::AddText(expansion);
     m_Command += expansion;
   }
 }


Add space to debug output

Add space to debug output

--- src/3D/FontManager.cxx
+++ src/3D/FontManager.cxx
@@ -156,7 +156,7 @@

 #if debugging
     std::cout << "getGLFont CREATED face:" << face
-	      << " size:" << size << (void*)font
+	      << " size:" << size << " " << (void*)font
 	      << std::endl;
 #endif


More work on x64 Windows C++-UNO bridge

More work on x64 Windows C++-UNO bridge

--- bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
+++ bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
@@ -81,92 +81,164 @@
 ///\note the calling convention should not matter since this has no arguments
 typedef void generic_function_t();

-  struct ptrtomember // _PMD
+struct ptrtomember // _PMD
+{
+  typedef __w64 int32_t  mdiff_t;
+  mdiff_t member_offset;
+  mdiff_t vbtable_offset; // -1 if not a virtual base
+  mdiff_t vdisp_offset;   // offset to the displacement value inside the vbtable
+
+  template<typename T>
+  T * operator()(T * const thisptr) const
   {
-    typedef __w64 int32_t  mdiff_t;
-    mdiff_t member_offset;
-    mdiff_t vbtable_offset; // -1 if not a virtual base
-    mdiff_t vdisp_offset;   // offset to the displacement value inside the vbtable
-
-    template<typename T>
-    T * operator()(T * const thisptr) const
-    {
-      uintptr_t tp = reinterpret_cast<uintptr_t>(thisptr);
-      uintptr_t ptr = tp + member_offset;
-      if ( vbtable_offset != -1 ) // !(vbtable_offset < 0)
-      {
-        ptr += *reinterpret_cast<mdiff_t*>( static_cast<intptr_t>(vdisp_offset + *reinterpret_cast<mdiff_t*>(tp + vbtable_offset)) )
-          + vbtable_offset;
+    uintptr_t tp = reinterpret_cast<uintptr_t>(thisptr);
+    uintptr_t ptr = tp + member_offset;
+    if ( vbtable_offset != -1 ) // !(vbtable_offset < 0)
+    {
+      ptr += *reinterpret_cast<mdiff_t*>( static_cast<intptr_t>(vdisp_offset + *reinterpret_cast<mdiff_t*>(tp + vbtable_offset)) )
+        + vbtable_offset;
+    }
+    return reinterpret_cast<T*>(ptr);
+  }
+};
+
+struct eobject
+{
+  typedef void (* dtor_ptr )(eobject*);
+  typedef void (* ctor_ptr )(eobject*, eobject*);
+  typedef void (* ctor_ptr2)(eobject*, eobject*, int);
+};
+
+struct catchabletype
+{
+  /** is simple type */
+  uint32_t    memmoveable : 1;
+  /** catchable as reference only */
+  uint32_t    refonly     : 1;
+  /** class with virtual base */
+  uint32_t    hasvirtbase : 1;
+  /** offset to the type descriptor */
+  rva_t       typeinfo;
+
+  /** catch type instance location within a thrown object  */
+  ptrtomember thiscast;
+  /** size of the simple type or offset into buffer of \c this pointer for catch object */
+  uint32_t    object_size;
+
+  union
+  {
+    rva_t               copyctor;
+    rva_t               copyctor2;
+  };
+};
+
+#pragma pack(push, 4)
+struct catchabletypearray
+{
+  uint32_t        size;
+  rva_t           type[1];
+};
+#pragma pack(pop)
+
+#pragma pack(push, 4)
+struct throwinfo
+{
+  typedef exception_disposition __cdecl forwardcompathandler_t(...);
+
+  /* 0x00 */  uint32_t  econst    : 1;
+  /* 0x00 */  uint32_t  evolatile : 1;
+  /* 0x00 */  uint32_t            : 1;
+  /* 0x00 */  uint32_t  e8        : 1;
+  /* 0x04 */  rva_t     exception_dtor;
+  /* 0x08 */  rva_t     forwardcompathandler;
+  /* 0x0C */  rva_t     catchabletypearray; ///< types able to catch the exception.
+};
+#pragma pack(pop)
+
+/// This type represents the catch clause
+struct ehandler
+{
+  //  union { uint32_t  adjectives; void * ptr; };
+  uint32_t isconst      : 1;
+  uint32_t isvolatile   : 1;
+  uint32_t isunaligned  : 1;// guess it is not used on x86
+  uint32_t isreference  : 1;
+
+  uint32_t              :27;
+  uint32_t ishz         : 1;
+
+  /** offset to the type descriptor of this catch object */
+  /*0x04*/ rva_t        typeinfo;         // dispType
+  /*0x08*/ int          eobject_bpoffset; // dispCatchObj
+  /** offset to the catch clause funclet */
+  /*0x0C*/ rva_t        handler;          // dispOfHandler
+  /*0x10*/ uint32_t     frame;            // dispFrame
+}
+
+// ___BuildCatchObject
+/// 15.3/16 When the exception-declaration specifies a class type, a copy
+///         constructor is used to initialize either the object declared
+///         in the exception-declaration or,
+///         if the exception-declaration does not specify a name,
+///         a temporary object of that type.
+///\note    This is the question may we optimize out the last case.
+///\warning If the copy constructor throws an exception, std::unexpected would be called
+void
+  constructcatchobject(
+  cxxregistration *             cxxreg,
+  const ehandler *        const catchblock,
+  catchabletype *         const convertable,
+  const dispatcher_context* const dispatch
+  )
+  const
+{
+  _EH_TRACE_ENTER();
+  // build helper
+  __try {
+    struct typeinfo_t { void* vtbl; void* spare; char name[1]; };
+    enum catchable_info { cidefault, cicomplex, civirtual } cinfo = cidefault;
+
+    const typeinfo_t* ti = catchblock->typeinfo ? dispatch->va<typeinfo_t*>(catchblock->typeinfo) : NULL;
+    if(ti && *ti->name && (catchblock->eobject_bpoffset || catchblock->ishz)){
+      eobject** objplace = catchblock->ishz
+        ? reinterpret_cast<eobject**>(cxxreg)
+        : reinterpret_cast<eobject**>(catchblock->eobject_bpoffset + cxxreg->fp.FramePointers);
+      if(catchblock->isreference){
+        // just ref/pointer
+        *objplace = adjust_pointer(get_object(), convertable);
+      }else if(convertable->memmoveable){
+        // POD
+        std::memcpy(objplace, get_object(), convertable->object_size);
+        if(convertable->object_size == sizeof(void*) && *objplace)
+          *objplace = adjust_pointer((void*)*objplace, convertable);
+      }else{
+        // if copy ctor exists, call it; binary copy otherwise
+        if(convertable->copyctor){
+          cinfo = convertable->hasvirtbase ? civirtual : cicomplex;
+        }else{
+          std::memcpy(objplace, (const void*)adjust_pointer(get_object(), convertable), convertable->object_size);
+        }
       }
-      return reinterpret_cast<T*>(ptr);
-    }
-  };
-
-struct catchabletype
-{
-    /** is simple type */
-    uint32_t    memmoveable : 1;
-    /** catchable as reference only */
-    uint32_t    refonly     : 1;
-    /** class with virtual base */
-    uint32_t    hasvirtbase : 1;
-    /** offset to the type descriptor */
-    rva_t       typeinfo;
-
-    /** catch type instance location within a thrown object  */
-    ptrtomember thiscast;
-    /** size of the simple type or offset into buffer of \c this pointer for catch object */
-    uint32_t    object_size;
-
-    union
-    {
-      rva_t               copyctor;
-      rva_t               copyctor2;
-    };
-  };
-
-#pragma pack(push, 4)
-  struct catchabletypearray
+    }
+    // end of build helper
+    if(cinfo != cidefault){
+      eobject* objthis = catchblock->ishz
+        ? reinterpret_cast<eobject*>(cxxreg)
+        : reinterpret_cast<eobject*>(catchblock->eobject_bpoffset + cxxreg->fp.FramePointers);
+      void* copyctor = thrown_va(convertable->copyctor);
+      eobject* copyarg = adjust_pointer(get_object(), convertable);
+      if(cinfo == cicomplex)
+        (eobject::ctor_ptr (copyctor))(objthis, copyarg);
+      else
+        (eobject::ctor_ptr2(copyctor))(objthis, copyarg, 1);
+    }
+  }
+  __except(cxxregistration::unwindfilter(static_cast<nt::ntstatus>(_exception_code())))
   {
-    uint32_t        size;
-    rva_t           type[1];
-  };
-#pragma pack(pop)
-
-#pragma pack(push, 4)
- struct throwinfo
-  {
-    typedef exception_disposition __cdecl forwardcompathandler_t(...);
-
-    /* 0x00 */  uint32_t  econst    : 1;
-    /* 0x00 */  uint32_t  evolatile : 1;
-    /* 0x00 */  uint32_t            : 1;
-    /* 0x00 */  uint32_t  e8        : 1;
-    /* 0x04 */  rva_t     exception_dtor;
-    /* 0x08 */  rva_t     forwardcompathandler;
-    /* 0x0C */  rva_t     catchabletypearray; ///< types able to catch the exception.
-  };
-#pragma pack(pop)
-
-  /// This type represents the catch clause
-  struct ehandler
-  {
-    //  union { uint32_t  adjectives; void * ptr; };
-    uint32_t isconst      : 1;
-    uint32_t isvolatile   : 1;
-    uint32_t isunaligned  : 1;// guess it is not used on x86
-    uint32_t isreference  : 1;
-
-    uint32_t              :27;
-    uint32_t ishz         : 1;
-
-    /** offset to the type descriptor of this catch object */
-    /*0x04*/ rva_t        typeinfo;         // dispType
-    /*0x08*/ int          eobject_bpoffset; // dispCatchObj
-    /** offset to the catch clause funclet */
-    /*0x0C*/ rva_t        handler;          // dispOfHandler
-    /*0x10*/ uint32_t     frame;            // dispFrame
+    nt::exception::inconsistency();
   }
+  _EH_TRACE_LEAVE();
+}

 #endif // 0

@@ -345,29 +417,43 @@
 const int codeSnippetSize = 40;

 void GenerateConstructorTrampoline(
-    sal_uChar * pCode,
+    unsigned char * code,
     typelib_TypeDescription * pTD ) throw ()
 {
-    // push typelib_TypeDescription pTD
-    *pCode++ = 0x68;
-    *(void **)pCode = pTD;
-    pCode += sizeof(void *);
-    // jmp rel64 fpFunc
-    *pCode++ = 0xe9;
-    *(sal_Int64 *)pCode = (sal_uChar *)&copyConstruct - pCode - sizeof(sal_Int64);
+    unsigned char *p = code;
+
+    // mov r8, pTD
+    *p++ = 0x49; *p++ = 0xB8;
+    *((void **)p) = pTD; p += 8;
+
+    // mov r11, copyConstruct
+    *p++ = 0x49; *p++ = 0xBB;
+    *((void **)p) = &copyConstruct; p += 8;
+
+    // jmp r11
+    *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
+
+    OSL_ASSERT( p < code + codeSnippetSize );
 }

 void GenerateDestructorTrampoline(
-    sal_uChar * pCode,
+    unsigned char * code,
     typelib_TypeDescription * pTD ) throw ()
 {
+    unsigned char *p = code;
+
     // mov rdx, pTD
-    *pCode++ = 0x68;
-    *(void **)pCode = pTD;
-    pCode += sizeof(void *);
-    // jmp rel64 fpFunc
-    *pCode++ = 0xe9;
-    *(sal_Int64 *)pCode = (sal_uChar *)destruct - pCode - sizeof(sal_Int64);
+    *p++ = 0x48; *p++ = 0xBA;
+    *((void **)p) = pTD; p += 8;
+
+    // mov r11, destruct
+    *p++ = 0x49; *p++ = 0xBB;
+    *((void **)p) = &destruct; p += 8;
+
+    // jmp r11
+    *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
+
+    OSL_ASSERT( p < code + codeSnippetSize );
 }

 // This looks like it is the struct catchabletype above
@@ -390,6 +476,9 @@
         , _n3( 0 )
         , _n4( pTD->nSize )
         {
+            // As _n0 is always initialized to zero, that means the
+            // hasvirtbase flag (see the ONTL catchabletype struct) is
+            // off, and thus the copyctor is of the ctor_ptr kind.
             _pTypeInfo = (sal_uInt32) ((sal_uInt64) mscx_getRTTI( pTD->pTypeName ) - pCodeBase);
             GenerateConstructorTrampoline( pCode, pTD );
             _pCopyCtor = (sal_uInt32) ((sal_uInt64) pCode - pCodeBase);


Fix wrong version comparison

Fix wrong version comparison

--- src/AOpticsManager.cxx
+++ src/AOpticsManager.cxx
@@ -230,7 +230,8 @@
 {
   TGeoNavigator* nav = GetCurrentNavigator();
   if(!nav){
-#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 9, 2) && ROOT_VERSION_CODE == ROOT_VERSION(6,10, 2)
+#if ROOT_VERSION(6, 9, 2) <= ROOT_VERSION_CODE && \
+    ROOT_VERSION_CODE <= ROOT_VERSION(6,10, 2)
     // This line is missing in TGeoManager::AddNavigator
     if (IsMultiThread()) TGeoManager::ThreadId();
 #endif


Delay notification events to next tick

Delay notification events to next tick

It is possible that the events get emitted when calling Show(), which
would then delete the class before Show() ends, results in using members
of a deleted class.

By delaying the events to next tick we can effectively avoid this.

--- brightray/browser/win/windows_toast_notification.cc
+++ brightray/browser/win/windows_toast_notification.cc
@@ -12,6 +12,7 @@
 #include "browser/win/scoped_hstring.h"
 #include "browser/win/notification_presenter_win.h"
 #include "common/application_info.h"
+#include "content/public/browser/browser_thread.h"

 using namespace ABI::Windows::Data::Xml::Dom;

@@ -384,21 +385,27 @@

 IFACEMETHODIMP ToastEventHandler::Invoke(
     ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args) {
-  notification_->NotificationClicked();
+  content::BrowserThread::PostTask(
+      content::BrowserThread::UI, FROM_HERE,
+      base::Bind(&Notification::NotificationClicked, notification_));
   return S_OK;
 }

 IFACEMETHODIMP ToastEventHandler::Invoke(
     ABI::Windows::UI::Notifications::IToastNotification* sender,
     ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) {
-  notification_->NotificationDismissed();
+  content::BrowserThread::PostTask(
+      content::BrowserThread::UI, FROM_HERE,
+      base::Bind(&Notification::NotificationDismissed, notification_));
   return S_OK;
 }

 IFACEMETHODIMP ToastEventHandler::Invoke(
     ABI::Windows::UI::Notifications::IToastNotification* sender,
     ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
-  notification_->NotificationFailed();
+  content::BrowserThread::PostTask(
+      content::BrowserThread::UI, FROM_HERE,
+      base::Bind(&Notification::NotificationFailed, notification_));
   return S_OK;
 }


BCFKeyValueData: remove unnecessary end coordinate from keys

--- src/BCFKeyValueData.cc
+++ src/BCFKeyValueData.cc
@@ -80,7 +80,7 @@
     BCFBucketRange& operator=(const BCFBucketRange&);

 public:
-    static const size_t PREFIX_LENGTH = 24;
+    static const size_t PREFIX_LENGTH = 14;
     int interval_len;

     // constructor
@@ -95,8 +95,7 @@
         // We add leading zeros to ensure that string lexicographic ordering will sort
         // keys in ascending order.
         ss << setw(4) << setfill('0') << rng.rid
-           << setw(10) << setfill('0') << rng.beg
-           << setw(10) << setfill('0') << rng.end;
+           << setw(10) << setfill('0') << rng.beg;
         std::string ans = ss.str();
         assert(ans.size() == PREFIX_LENGTH);
         return ans;


Changed to stddef.h

Changed to stddef.h

--- test/test_crc.cpp
+++ test/test_crc.cpp
@@ -29,7 +29,7 @@
 #include <iterator>
 #include <string>
 #include <vector>
-#include <cstdint>
+#include <stdint.h>

 #include "../crc8_ccitt.h"
 #include "../crc16.h"


Added freeing benchmark

Added freeing benchmark

--- src/BenchmarkStack.cpp
+++ src/BenchmarkStack.cpp
@@ -29,8 +29,35 @@

 BenchmarkResults BenchmarkStack::freeing() {
-	return buildResults(0, 0, 0, 0);
-}
+	setStartTimer();
+
+	StackAllocator stackAllocator(1e10);
+
+	std::size_t operations = 0;
+	double elapsedTime = 0;
+	while(elapsedTime < (m_runtime * 1e3)){
+		if (operations % 2 == 0){
+			stackAllocator.Allocate(sizeof(int), alignof(int));			// 4  -> 4
+			stackAllocator.Allocate(sizeof(bool), alignof(bool));		// 1  -> 5
+																	// 3  -> 8
+			stackAllocator.Allocate(sizeof(foo), alignof(foo));			// 16 -> 24
+		}else {
+			timespec before_free, after_free;
+			setTimer(before_free);
+			stackAllocator.Free(sizeof(foo));
+			stackAllocator.Free(sizeof(bool));
+			stackAllocator.Free(sizeof(int));
+			setTimer(after_free);
+			elapsedTime += calculateElapsedTime(before_free, after_free);
+		}
+		++operations;
+	}
+
+	BenchmarkResults results = buildResults(operations/2, m_runtime, 0, 0);
+
+	printResults(results);
+	stackAllocator.Reset();
+	return results;}

 BenchmarkResults BenchmarkStack::read() {
 	return buildResults(0, 0, 0, 0);


INTEGRATION: CWS changefileheader (1.2.452); FILE MERGED 2008/03/31 13:58:41 rt 1.2.452.1: #i87441# Change license header to LPGL v3.

--- sd/source/ui/inc/tools/AsynchronousTask.hxx
+++ sd/source/ui/inc/tools/AsynchronousTask.hxx
@@ -1,35 +1,30 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: AsynchronousTask.hxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.2 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: kz $ $Date: 2006-04-26 20:46:22 $
+ * $RCSfile: AsynchronousTask.hxx,v $
+ * $Revision: 1.3 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/


TS-3798: Copy server session sharing pool to local HttpSM configuration.

--- proxy/http/HttpConfig.cc
+++ proxy/http/HttpConfig.cc
@@ -1207,6 +1207,7 @@
   }

   params->oride.server_session_sharing_match = m_master.oride.server_session_sharing_match;
+  params->server_session_sharing_pool = m_master.server_session_sharing_pool;
   params->oride.keep_alive_post_out = m_master.oride.keep_alive_post_out;

   params->oride.keep_alive_no_activity_timeout_in = m_master.oride.keep_alive_no_activity_timeout_in;


midi channel marking (for rencoder compatibility)

--- src/ChartLoaderVOS.cpp
+++ src/ChartLoaderVOS.cpp
@@ -311,6 +311,10 @@
   stream.GetUInt32();     // skip version
   MetaData& md = chart_->GetMetaData();
   char buf[256];
+
+  // common part: 16 channels for midi
+  for (size_t i = 0; i < 16; ++i)
+    md.GetSoundChannel()->fn[i] = "midi";

   // 4 byte: filename length
   int fnamelen = stream.GetInt32();
@@ -364,6 +368,10 @@
   char buf[256];
   stream.SeekSet(4);  // skip version
   MetaData& md = chart_->GetMetaData();
+
+  // common part: 16 channels for midi
+  for (size_t i = 0; i < 16; ++i)
+    md.GetSoundChannel()->fn[i] = "midi";

   int headersize = stream.GetInt32();
   stream.SeekCur(4);  // inf; static flag


Remove an unused function I forgot to remove. Clang complains about it...

BUG=none
TEST=none
TBR=darin

Review URL: http://codereview.chromium.org/3925003

--- proxy/plugin_file_ref.cc
+++ proxy/plugin_file_ref.cc
@@ -12,14 +12,6 @@
 namespace {
 PP_Resource Create(PP_Resource file_system, const char* path) {
   UNREFERENCED_PARAMETER(file_system);
-  UNREFERENCED_PARAMETER(path);
-  return kInvalidResourceId;
-}
-
-
-PP_Resource CreateTemporaryFileRef(PP_Instance instance,
-                                   const char* path) {
-  UNREFERENCED_PARAMETER(instance);
   UNREFERENCED_PARAMETER(path);
   return kInvalidResourceId;
 }


fix test_rss for windows

fix test_rss for windows

--- test/test_rss.cpp
+++ test/test_rss.cpp
@@ -133,11 +133,13 @@

 int test_main()
 {
-	test_feed(combine_path("..", "eztv.xml"), rss_expect(30, "http://torrent.zoink.it/The.Daily.Show.2012.02.16.(HDTV-LMAO)[VTV].torrent", "The Daily Show 2012-02-16 [HDTV - LMAO]", 183442338));
-	test_feed(combine_path("..", "cb.xml"), rss_expect(50, "http://www.clearbits.net/get/1911-norbergfestival-2011.torrent", "Norbergfestival 2011", 1160773632));
-	test_feed(combine_path("..", "kat.xml"), rss_expect(25, "http://kat.ph/torrents/benito-di-paula-1975-benito-di-paula-lp-rip-ogg-at-500-jarax4u-t6194897/", "Benito Di Paula - 1975 - Benito Di Paula (LP Rip OGG at 500) [jarax4u]", 168773863));
-	test_feed(combine_path("..", "mn.xml"), rss_expect(20, "http://www.mininova.org/get/13203100", "Dexcell - January TwentyTwelve Mix", 137311179));
-	test_feed(combine_path("..", "pb.xml"), rss_expect(60, "magnet:?xt=urn:btih:FD4CDDB7BBE722D17A018EFD875EB0695ED7159C&dn=Thompson+Twins+-+1989+-+Big+Trash+%5BMP3%5D", "Thompson Twins - 1989 - Big Trash [MP3]", 100160904));
+	std::string root_dir = parent_path(current_working_directory());
+
+	test_feed(combine_path(root_dir, "eztv.xml"), rss_expect(30, "http://torrent.zoink.it/The.Daily.Show.2012.02.16.(HDTV-LMAO)[VTV].torrent", "The Daily Show 2012-02-16 [HDTV - LMAO]", 183442338));
+	test_feed(combine_path(root_dir, "cb.xml"), rss_expect(50, "http://www.clearbits.net/get/1911-norbergfestival-2011.torrent", "Norbergfestival 2011", 1160773632));
+	test_feed(combine_path(root_dir, "kat.xml"), rss_expect(25, "http://kat.ph/torrents/benito-di-paula-1975-benito-di-paula-lp-rip-ogg-at-500-jarax4u-t6194897/", "Benito Di Paula - 1975 - Benito Di Paula (LP Rip OGG at 500) [jarax4u]", 168773863));
+	test_feed(combine_path(root_dir, "mn.xml"), rss_expect(20, "http://www.mininova.org/get/13203100", "Dexcell - January TwentyTwelve Mix", 137311179));
+	test_feed(combine_path(root_dir, "pb.xml"), rss_expect(60, "magnet:?xt=urn:btih:FD4CDDB7BBE722D17A018EFD875EB0695ED7159C&dn=Thompson+Twins+-+1989+-+Big+Trash+%5BMP3%5D", "Thompson Twins - 1989 - Big Trash [MP3]", 100160904));
 	return 0;
 }


add missing inplace operators to Integer

--- src/Crypto/Integer.hpp
+++ src/Crypto/Integer.hpp
@@ -200,6 +200,36 @@
       }

       /**
+       * Multiplication operator, multiplies with current
+       * @param other the Integer to multiply by
+       */
+      Integer &operator*=(const Integer &other)
+      {
+        m_data = Multiply(other).m_data;
+        return *this;
+      }
+
+      /**
+       * Division operator, divides current
+       * @param other the Integer to divide by
+       */
+      Integer &operator/=(const Integer &other)
+      {
+        m_data = Divide(other).m_data;
+        return *this;
+      }
+
+      /**
+       * Remainder operator, computes the remainder of current
+       * @param other the Integer representing the modulus
+       */
+      Integer &operator%=(const Integer &modulus)
+      {
+        m_data = Modulo(modulus).m_data;
+        return *this;
+      }
+
+      /**
        * Equality operator
        * @param other the Integer to compare
        */


DC gets callback, updates, makes the service calls

--- src/DataController.cpp
+++ src/DataController.cpp
@@ -1,20 +1,29 @@
 #include <ros/ros.h>
+
+#include <nav_msgs/GetMap.h>
 #include <quirkd/Alert.h>
-#include <nav_msgs/GetMap.h>
 #include <sensor_msgs/LaserScan.h>
+#include <tf/transform_listener.h>

 class DataController {
     public:
         DataController() {
             alert_pub_ = n_.advertise<quirkd::Alert>("/quirkd/alert/notification", 1);
             laser_sub_ = n_.subscribe("/base_scan", 1, &DataController::laserScanCB, this);
+            // ros::service::waitForService("static_map");
             static_map_client_ = n_.serviceClient<nav_msgs::GetMap>("static_map");
+            // ros::service::waitForService("dynamic_map");
             dynamic_map_client_ = n_.serviceClient<nav_msgs::GetMap>("dynamic_map");
         }
         void laserScanCB(const sensor_msgs::LaserScan msg) {
             ROS_INFO("Laser Scan Callback");
             updated = true;
             last_data = msg;
+            try {
+                tf_.lookupTransform("/map", "/base_laser_link", ros::Time(0), last_tf);
+            } catch (tf::TransformException &ex) {
+                ROS_WARN("tf fetch failed. %s", ex.what());
+            }
         }
         void update() {
             ROS_INFO("Update Data Processor");
@@ -37,12 +46,14 @@
         }
         bool updated;
         sensor_msgs::LaserScan last_data;
+        tf::StampedTransform last_tf;
     private:
         ros::NodeHandle n_;
         ros::Publisher alert_pub_;
         ros::Subscriber laser_sub_;
         ros::ServiceClient dynamic_map_client_;
         ros::ServiceClient static_map_client_;
+        tf::TransformListener tf_;
 };

 int main(int argc, char** argv) {


Fixed map selector

Fixed map selector

--- src/Dev/Modes/Menu.cpp
+++ src/Dev/Modes/Menu.cpp
@@ -74,6 +74,7 @@
             selectMapButton->setRenderer(
                 baseTheme.getRenderer("MapSelectButton"));
             selectMapButton->setSize("100%", "20%");
+            middlePanel->add(selectMapButton);
             selectMapButton->setPosition("0", i * selectMapButton->getSize().y);
             selectMapButton->connect(
                 "pressed", [&currentMap, filename] { currentMap = filename; });


Patch to fix data strings

Patch to fix data strings

--- Cbor/CborDecoder.cpp
+++ Cbor/CborDecoder.cpp
@@ -1,6 +1,5 @@
 #include "CborDecoder.h"
 #include "Arduino.h"
-#include <stdlib.h>

@@ -343,10 +342,10 @@
 			} else break;
 		} else if(state == STATE_STRING_DATA) {
 			if(input->hasBytes(currentLength)) {
-				unsigned char *data = new unsigned char[currentLength];
+				unsigned char data[currentLength];
 				input->getBytes(data, currentLength);
 				state = STATE_TYPE;
-				String str(*data);
+				String str = (const char *) data;
 				listener->OnString(str);
 			} else break;
 		} else if(state == STATE_ARRAY) {


fix linux build

fix linux build

--- DesktopEditor/raster/Metafile/CXmlOutput.cpp
+++ DesktopEditor/raster/Metafile/CXmlOutput.cpp
@@ -7,6 +7,27 @@

 namespace MetaFile
 {
+    static int GetInteger (const std::wstring& string)
+    {
+        if (string.empty()) return 0;
+
+        try
+        {
+            return _wtoi(string.c_str());
+        }
+        catch(...)
+        {
+        }
+
+        try
+        {
+            return static_cast<int>(_wtoi64(string.c_str()));
+        }
+        catch(...)
+        {
+            return 0;
+        }
+    }
     std::wstring StringNormalization(std::wstring wsString)
     {
         std::wstring wsText;
@@ -1195,7 +1216,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        nValue = (wsValue.empty()) ? 0 : stoi(wsValue);
+        nValue = (wsValue.empty()) ? 0 : GetInteger(wsValue);
     }

     void CXmlOutput::operator>>(double &dValue)
@@ -1204,7 +1225,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        dValue = (wsValue.empty()) ? 0.0 : stod(wsValue);
+        dValue = (wsValue.empty()) ? 0.0 : GetInteger(wsValue);
     }

@@ -1214,7 +1235,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        unValue = (wsValue.empty()) ? 0 : (unsigned int)stoul(wsValue);
+        unValue = (wsValue.empty()) ? 0 : (unsigned int)GetInteger(wsValue);
     }

     void CXmlOutput::operator>>(short &shValue)
@@ -1223,7 +1244,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        shValue = (wsValue.empty()) ? 0 : (short)stoi(wsValue);
+        shValue = (wsValue.empty()) ? 0 : (short)GetInteger(wsValue);
     }

     void CXmlOutput::operator>>(unsigned short &ushValue)
@@ -1232,7 +1253,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        ushValue = (wsValue.empty()) ? 0 : (unsigned short)stoul(wsValue);
+        ushValue = (wsValue.empty()) ? 0 : (unsigned short)GetInteger(wsValue);
     }

     void CXmlOutput::operator>>(unsigned char &ucValue)
@@ -1241,7 +1262,7 @@
             return;

         const std::wstring wsValue = m_pXmlLiteReader->GetText2();
-        ucValue = (wsValue.empty()) ? 0 : (unsigned char)_wtoi(wsValue.c_str());
+        ucValue = (wsValue.empty()) ? 0 : (unsigned char)GetInteger(wsValue);
     }

     void CXmlOutput::operator>>(unsigned short arushValue[])


Fix `lightlastseeninterval` not displayed via REST API

Using the parameter works, but display via GET on `config` resource doesn't display it.

--- rest_configuration.cpp
+++ rest_configuration.cpp
@@ -1057,6 +1057,7 @@
     map["networkopenduration"] = gwNetworkOpenDuration;
     map["timeformat"] = gwTimeFormat;
     map["whitelist"] = whitelist;
+    map["lightlastseeninterval"] = gwLightLastSeenInterval;
     map["linkbutton"] = gwLinkButton;
     map["portalservices"] = false;
     map["websocketport"] = static_cast<double>(gwConfig["websocketport"].toUInt());


Added swupdate2 to Rest API

Added swupdate2 to Rest API

--- rest_configuration.cpp
+++ rest_configuration.cpp
@@ -387,6 +387,9 @@
     bool ok = false;
     QVariantMap whitelist;
     QVariantMap swupdate;
+    QVariantMap swupdate2;
+    QVariantMap autoinstall;
+    QVariantMap bridge;
     QVariantMap devicetypes;
     QVariantMap portalstate;
     QVariantMap internetservices;
@@ -578,6 +581,19 @@
         map["starterkitid"] = QLatin1String("");
     }

+    bridge["state"] = gwSwUpdateState;
+    bridge["lastinstall"] = "";
+    swupdate2["bridge"] = bridge;
+    swupdate2["checkforupdate"] = false;
+    swupdate2["state"] = gwSwUpdateState;
+    swupdate2["install"] = false;
+    autoinstall["updatetime"] = "";
+    autoinstall["on"] = false;
+    swupdate2["autoinstall"] = autoinstall;
+    swupdate2["lastchange"] = "";
+    swupdate2["lastinstall"] = "";
+    map["swupdate2"] = swupdate2;
+
     map["name"] = gwName;
     map["uuid"] = gwUuid;
     if (apsCtrl)
@@ -1915,7 +1931,7 @@
     QVariantMap rspItemState;
     gwSwUpdateState = swUpdateState.installing;
     rspItemState["/config/update"] = gwUpdateVersion;
-    rspItemState["/config/swupdatestate"] = gwSwUpdateState;
+    rspItemState["/config/swupdate2/state"] = gwSwUpdateState;
     rspItem["success"] = rspItemState;
     rsp.list.append(rspItem);


Analysis code update (Matt Steinpreis)

Analysis code update (Matt Steinpreis)

--- PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0Analysis.cxx
+++ PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0Analysis.cxx
@@ -21,7 +21,7 @@
 //  authors: Matthew Steinpreis (matthew.steinpreis@cern.ch)
 //
 //  Major changes:
-//	- TOF mismatch function calls changed (3/28/13)
+//	- TOF mismatch function calls changed (4/18/13)
 //	- added minimum decay length cut (3/28/13)
 //
 //  Minor changes:
@@ -29,6 +29,10 @@
 //	  of k0Count (which included skipped k0s with shared daughters) (3/25/13)
 //	- added hists for 3D mom. in LF and PRF (3/28/13)
 //	- changed calling of PIDResponse (should be same actions) (3/28/13)
+//	- keep "side" K0s for mass plot (4/18)
+//		- tweaked loading and skipping appropriately
+//		- use merit test to skip sides (against good and side K0s)
+//		- a good K0 cant be skipped by a side
 ////////////////////////////////////////////////////////////////////////////////

@@ -255,8 +259,8 @@
   fOutputList->Add(fHistKtK0);

   //invariant mass distributions
-  //TH3F* fHistMassPtK0= new TH3F("fHistMassPtK0", "",kCentBins,.5,kCentBins+.5,40,0.,4.,200,.4,.6);
-  //fOutputList->Add(fHistMassPtK0);
+  TH3F* fHistMass = new TH3F("fHistMass","",kCentBins,.5,kCentBins+.5,50,0.,5.,400,.3,.7);
+  fOutputList->Add(fHistMass);
   //TH3F* fHistMassPtCFK0 = new TH3F("fHistMassPtCFK0","",kCentBins,.5,kCentBins+.5,50,0.,5.,200,.4,.6);
   //fOutputList->Add(fHistMassPtCFK0);
   //TH3F* fHistMassPtCFBkgK0 = new TH3F("fHistMassPtCFBkgK0","",kCentBins,.5,kCentBins+.5,50,0.,5.,200,.4,.6);
@@ -595,43 +599,43 @@
     if(fabs(fPidAOD->NumberOfSigmasTPC(prongTrackNeg,AliPID::kPion)) < kMaxTPCSigmaPion) goodPiMinus = kTRUE;

     //Positive daughter identification TOF
-    //float probMis;
-    //AliPIDResponse::EDetPidStatus statusPosTOF = fPidAOD->CheckPIDStatus(AliPIDResponse::kTOF, prongTrackPos);
+    float probMis;
+    AliPIDResponse::EDetPidStatus statusPosTOF = fPidAOD->CheckPIDStatus(AliPIDResponse::kTOF, prongTrackPos);
     double Ppos = v0->PProng(pos0or1);
     if(Ppos > kTOFLow) //PiPlus
     {
-     if( (statusPos&AliESDtrack::kTOFpid)!=0 && (statusPos&AliESDtrack::kTIME)!=0 && (statusPos&AliESDtrack::kTOFout)!=0 && (statusPos&AliESDtrack::kTOFmismatch)<=0)
-     //if(AliPIDResponse::kDetPidOk == statusPosTOF)
+     //if( (statusPos&AliESDtrack::kTOFpid)!=0 && (statusPos&AliESDtrack::kTIME)!=0 && (statusPos&AliESDtrack::kTOFout)!=0 && (statusPos&AliESDtrack::kTOFmismatch)<=0) (OBSOLETE; NEW CALL BELOW)
+     if(AliPIDResponse::kDetPidOk == statusPosTOF)
      {
-      //probMis = fPidAOD->GetTOFMismatchProbability(prongTrackPos);
-      //if(probMis < 0.01) //avoid TOF-TPC mismatch
-      //{
+      probMis = fPidAOD->GetTOFMismatchProbability(prongTrackPos);
+      if(probMis < 0.01) //avoid TOF-TPC mismatch
+      {
        if(fabs(fPidAOD->NumberOfSigmasTOF(prongTrackPos,AliPID::kPion)) < kMaxTOFSigmaPion) goodPiPlus = kTRUE;
        else goodPiPlus = kFALSE;
-      //}
+      }
      }
     }
     //Negative daughter identification TOF
-    //AliPIDResponse::EDetPidStatus statusNegTOF = fPidAOD->CheckPIDStatus(AliPIDResponse::kTOF, prongTrackNeg);
+    AliPIDResponse::EDetPidStatus statusNegTOF = fPidAOD->CheckPIDStatus(AliPIDResponse::kTOF, prongTrackNeg);
     double Pneg = v0->PProng(neg0or1);
     if(Pneg > kTOFLow) //PiMinus
     {
-     if( (statusNeg&AliESDtrack::kTOFpid)!=0 && (statusNeg&AliESDtrack::kTIME)!=0 && (statusNeg&AliESDtrack::kTOFout)!=0 && (statusNeg&AliESDtrack::kTOFmismatch)<=0)
-     //if(AliPIDResponse::kDetPidOk == statusNegTOF)
+     //if( (statusNeg&AliESDtrack::kTOFpid)!=0 && (statusNeg&AliESDtrack::kTIME)!=0 && (statusNeg&AliESDtrack::kTOFout)!=0 && (statusNeg&AliESDtrack::kTOFmismatch)<=0) (OBSOLETE; NEW CALL BELOW)
+     if(AliPIDResponse::kDetPidOk == statusNegTOF)
      {
-      //probMis = fPidAOD->GetTOFMismatchProbability(prongTrackPos);
-      //if(probMis < 0.01) //avoid TOF-TPC mismatch
-      //{
+      probMis = fPidAOD->GetTOFMismatchProbability(prongTrackPos);
+      if(probMis < 0.01) //avoid TOF-TPC mismatch
+      {
        if(fabs(fPidAOD->NumberOfSigmasTOF(prongTrackNeg,AliPID::kPion)) < kMaxTOFSigmaPion) goodPiMinus = kTRUE;
        else goodPiMinus = kFALSE;
-      //}
+      }
      }
     }

     //K0 cuts
     if(v0->Eta() > kEtaCut)                                continue;
     if(v0->CosPointingAngle(primaryVertex) < kMinCosAngle) continue;
-    if(v0->MassK0Short() < .4 || v0->MassK0Short() > .6)   continue;
+    if(v0->MassK0Short() < .2 || v0->MassK0Short() > .8)   continue;
     if(v0->DcaNegToPrimVertex() < kMinDCAPrimaryPion)      continue;
     if(v0->DcaPosToPrimVertex() < kMinDCAPrimaryPion)      continue;
     if(v0->DecayLength(primaryVertex) > kMaxDLK0)          continue;
@@ -661,39 +665,48 @@
     //}// if kMCCase

     if(v0->MassK0Short() > .48 && v0->MassK0Short() < .515) goodK0 = kTRUE;
-    else continue; //remove if want to do mass plots; would need to amend other stuff
+    //else continue; //removed, Apr 18

     //Check for shared daughters, using v0 DCA to judge
     tempK0[v0Count].fSkipShared = kFALSE;
     if(fMeritCase){
      for(int iID = 0; iID<v0Count; iID++){
-      if(tempK0[iID].fSkipShared == kFALSE){
+      if(tempK0[iID].fSkipShared == kFALSE){		//if old is already skipped, go to next old
        if(tempK0[iID].fDaughterID1 == prongTrackPos->GetID() || tempK0[iID].fDaughterID2 == prongTrackNeg->GetID()){
-         if(tempK0[iID].fV0Dca <= v0Dca){	//if old beats new
-          tempK0[v0Count].fSkipShared = kTRUE;	//skip new
+        if(tempK0[iID].fV0Dca <= v0Dca){		//if old beats new...
+         if(!tempK0[iID].fK0 && goodK0) continue;	//if bad old beats new good, do nothing...
+         else{						//but if bad old beats new bad, or good old beats anything, skip new
+          tempK0[v0Count].fSkipShared = kTRUE;		//skip new
           break;					//no need to keep checking others
          }
-         else{//new beats old
-	  tempK0[iID].fSkipShared = kTRUE;	//skip old
-	  k0Count--;}				//subtract from number of K0s (new one will be added later, if it succeeds)
+        }
+        else{						//if new beats old...
+         if(tempK0[iID].fK0 && !goodK0) continue;	//if bad new beats good old, do nothing...
+         else{						//but if bad new beats bad old, or good new beats anything, skip old
+	  tempK0[iID].fSkipShared = kTRUE;		//skip old
+	  if(tempK0[iID].fK0) k0Count--;		//if good old gets skipped, subtract from number of K0s (new one will be added later, if it succeeds)
+         }
+        }
        }
       }
      }
-    if(tempK0[v0Count].fSkipShared) continue;
+     if(tempK0[v0Count].fSkipShared) continue;		//if new K0 is skipped, don't load; go to next v0
     }//if MeritCase

     //load parameters into temporary class instance
     if(v0Count < kMaxNumK0)
     {
-	tempK0[v0Count].fK0 = kTRUE;
-        //else tempK0[v0Count].fK0 = kFALSE;  //in case I include v0s that arent "good" K0s
-        k0Count++; //same as v0count right now (continue if not in mass range, above)
+	if(goodK0){
+         tempK0[v0Count].fK0 = kTRUE;
+         k0Count++;
+        }
+        else tempK0[v0Count].fK0 = kFALSE;

         //if(v0->MassK0Short() > .45 && v0->MassK0Short() < .48) tempK0[v0Count].fSideLeft = kTRUE;
         //else tempK0[v0Count].fSideLeft = kFALSE;
         //if(v0->MassK0Short() > .515 && v0->MassK0Short() < .545) tempK0[v0Count].fSideRight = kTRUE;
         //else tempK0[v0Count].fSideRight = kFALSE;
-	if(!goodK0) continue; //no sides, speed up analysis (REDUNDANT RIGHT NOW)
+	//if(!goodK0) continue; //no sides, speed up analysis (REDUNDANT RIGHT NOW)

         tempK0[v0Count].fDaughterID1    = prongTrackPos->GetID();
         tempK0[v0Count].fDaughterID2    = prongTrackNeg->GetID();
@@ -748,10 +761,16 @@
   (fEvt) = fEC[zBin][centBin]->fEvt;
   (fEvt)->fFillStatus = 1;
   int unskippedCount = 0;
-  for(int i=0;i<v0Count;i++){
-   if(!tempK0[i].fSkipShared){//don't include skipped v0s (from shared daughters)
-    (fEvt)->fK0Particle[unskippedCount] = tempK0[i];
-    unskippedCount++;
+  for(int i=0;i<v0Count;i++)
+  {
+   if(!tempK0[i].fSkipShared)				//don't include skipped v0s (from shared daughters)
+   {
+    ((TH3F*)fOutputList->FindObject("fHistMass"))->Fill(centBin+1,tempK0[i].fPt,tempK0[i].fMass);
+    if(tempK0[i].fK0)					//make sure particle is good (mass)
+    {
+     (fEvt)->fK0Particle[unskippedCount] = tempK0[i];	//load good, unskipped K0s
+     unskippedCount++;					//count good, unskipped K0s
+    }
    }
   }
   (fEvt)->fNumV0s = unskippedCount;


Support PATCH method for userparameters

Support PATCH method for userparameters

--- rest_userparameter.cpp
+++ rest_userparameter.cpp
@@ -43,7 +43,7 @@
         return addUserParameter(req, rsp);
     }
     // PUT /api/<apikey>/userparameter/<parameter>
-    else if ((req.path.size() == 4) && (req.hdr.method() == "PUT"))
+    else if ((req.path.size() == 4) && (req.hdr.method() == "PUT" || req.hdr.method() == "PATCH"))
     {
         return modifyUserParameter(req, rsp);
     }


PWGGA/GammaConv: Added protection for MC handling in merged cluster task

--- PWGGA/GammaConv/AliAnalysisTaskGammaCaloMerged.cxx
+++ PWGGA/GammaConv/AliAnalysisTaskGammaCaloMerged.cxx
@@ -2423,7 +2423,8 @@
       ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->SplitEnergy(absCellIdList[0], absCellIdList[1],
                                                                      clus, fInputEvent, fIsMC, clusSub1, clusSub2);
     }
-    if(fDoJetAnalysis){
+
+    if(fDoJetAnalysis && fIsMC > 0){
       // Cluster is in Jet but not in true Jet
       if(passedJetCriterium && !passedTrueJetCriterium){
         if(!fDoLightOutput) fHistoClusMergedPtvsM02FakeJet[fiCut]->Fill( PhotonCandidate->Pt(),


Don't ignore the factory test on WIN32

Don't ignore the factory test on WIN32

--- tests/factory.cpp
+++ tests/factory.cpp
@@ -1,5 +1,3 @@
-#ifndef WIN32
-
 #pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"

 #include <string>
@@ -96,5 +94,3 @@

     remove(filename.c_str());
 }
-
-#endif


added upper limit to avoid segfaults

added upper limit to avoid segfaults

--- PWGGA/GammaConv/AliGammaConversionAODBGHandler.cxx
+++ PWGGA/GammaConv/AliGammaConversionAODBGHandler.cxx
@@ -502,7 +502,11 @@
            };
 	for(Int_t z=0;z<fNBinsZ;z++){
 		for(Int_t m=0;m<fNBinsMultiplicity; m++){
-            fBGProbability[z][m] = BGProbabilityLookup[z][m];
+            if((z<7)&&(m<4)){
+                fBGProbability[z][m] = BGProbabilityLookup[z][m];
+            }else{
+                fBGProbability[z][m] = 1;
+            }
 		}
 	}


Fix QOS value check - mask the 2 lease significant bits

Summary: To verify QOS is correctly set on the socket, mask the 2 LSB (lease significant bits) of QOS value that is read from socket options. The 2 LSBs are not used for the QOS value.

Reviewed By: andreazevedo

Differential Revision: D4495271

fbshipit-source-id: acd8cc4dc2fecbc003f462a2c5009f45d0ec8384

--- mcrouter/lib/network/AsyncMcClientImpl.cpp
+++ mcrouter/lib/network/AsyncMcClientImpl.cpp
@@ -340,6 +340,9 @@
   uint64_t val = 0;
   socklen_t len = sizeof(expectedValue);
   int rv = getsockopt(socketFd, optkey.level, optkey.optname, &val, &len);
+  // Zero out last 2 bits as they are not used for the QOS value
+  constexpr uint64_t kMaskTwoLeastSignificantBits = 0xFFFFFFFc;
+  val = val & kMaskTwoLeastSignificantBits;
   if (rv != 0 || val != expectedValue) {
     LOG_FAILURE(
         "AsyncMcClient",


Added a method for retrieving the identifier of a rule (with caching for perfomance)

--HG--
branch : Parse
extra : convert_revision : svn%3A3666fe7e-a552-0410-bc3c-bd4e4c681ee0/trunk/Parse%40876

--- ContextFree/rule.cpp
+++ ContextFree/rule.cpp
@@ -88,3 +88,11 @@

     return *this;
 }
+
+/// \brief Returns the identifier for this rule in the specified grammar
+int rule::identifier(const grammar& gram) const {
+    if (&gram == m_LastGrammar) return m_Identifier;
+
+    m_LastGrammar = &gram;
+    return m_Identifier = gram.identifier_for_rule(*this);
+}


[Fix] Little issue with piwik unique visitor

--- Core/Application.cpp
+++ Core/Application.cpp
@@ -172,10 +172,6 @@
 	m_networkManager(nullptr),
 	m_webProfile(nullptr)
 {
-	// the 3rd parameter is the site id
-	m_piwikTracker = new PiwikTracker(this, QUrl("https://sielo.app/analytics"), 1);
-	m_piwikTracker->sendVisit("launch");
-
 	// Setting up settings environment
 	QCoreApplication::setOrganizationName(QLatin1String("Feldrise"));
 	QCoreApplication::setApplicationName(QLatin1String("Sielo"));
@@ -197,6 +193,10 @@
 	QString family = QFontDatabase::applicationFontFamilies(id).at(0);
 	m_morpheusFont = QFont(family);
 	m_normalFont = font();*/
+
+	// the 3rd parameter is the site id
+	m_piwikTracker = new PiwikTracker(this, QUrl("https://sielo.app/analytics"), 1);
+	m_piwikTracker->sendVisit("launch");

 	// Check command line options with given arguments
 	QUrl startUrl{};


tested basic functionality for save/load jcmess file, will have to port other changes i have carried out from jmess 1.0.2.

--- jcmess.cpp
+++ jcmess.cpp
@@ -141,7 +141,6 @@
       exit(1);
     }

-    //TODO save the file
     file << ss.rdbuf();
     file.close();
     cout << OutFile << " written." << endl;
@@ -231,20 +230,26 @@
   vector<string> OutputInput(2);
   const string delimiter = SEPARATOR ;

+  //TODO add error checking in getline and string operations
   while (!file.eof()) {
     string line;
     getline(file,line);

-    size_t pos = 0;
-    pos = line.find(delimiter);
-    OutputInput[0] = line.substr(0, pos);
-    cout << OutputInput[0] << endl;
-    line.erase(0, pos + delimiter.length());
-    OutputInput[1] = line ;
-    mPortsToConnect.push_back(OutputInput);
+    if (line.length() > 0) {
+      size_t pos = 0;
+      pos = line.find(delimiter);
+      OutputInput[0] = line.substr(0, pos);
+      line.erase(0, pos + delimiter.length());
+      OutputInput[1] = line ;
+      mPortsToConnect.push_back(OutputInput);
+
+      //cout << OutputInput[0] << endl;
+      //cout << OutputInput[1] << endl;
+    }
   }

   file.close();
+  //cout << "vec size = " << mPortsToConnect.size() << endl;

   return 0;

@@ -264,6 +269,8 @@
     for (vector<vector<string> >::iterator it = mPortsToConnect.begin();
 	 it != mPortsToConnect.end(); ++it) {
       OutputInput = *it;
+
+      //cout << "CON: " <<  OutputInput[0] << " <TO> " <<  OutputInput[1] << endl;

       if (jack_connect(mClient, OutputInput[0].c_str(), OutputInput[1].c_str())) {
 	//Display a warining only if the error is not because the ports are already


Fix some leaks on sk_push error.
am: 8eaad4ede1

Change-Id: Ia097679349b5d097be844e6795eb38d7e8f70efe

--- src/main/native/org_conscrypt_NativeCrypto.cpp
+++ src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -7220,11 +7220,12 @@
             return;
         }

-        if (!sk_X509_NAME_push(principalsStack.get(), principalX509Name.release())) {
+        if (!sk_X509_NAME_push(principalsStack.get(), principalX509Name.get())) {
             jniThrowOutOfMemory(env, "Unable to push principal");
             JNI_TRACE("ssl=%p NativeCrypto_SSL_set_client_CA_list => principal push error", ssl);
             return;
         }
+        OWNERSHIP_TRANSFERRED(principalX509Name);
     }

     SSL_set_client_CA_list(ssl, principalsStack.release());
@@ -8202,11 +8203,12 @@
         JNI_TRACE("ssl=%p NativeCrypto_SSL_get_certificate => threw exception", ssl);
         return nullptr;
     }
-    if (!sk_X509_push(chain.get(), X509_dup_nocopy(certificate))) {
+    if (!sk_X509_push(chain.get(), certificate)) {
         jniThrowOutOfMemory(env, "Unable to push local certificate");
         JNI_TRACE("ssl=%p NativeCrypto_SSL_get_certificate => null", ssl);
         return nullptr;
     }
+    X509_up_ref(certificate);

     STACK_OF(X509)* cert_chain = nullptr;
     if (!SSL_get0_chain_certs(ssl, &cert_chain)) {
@@ -8215,12 +8217,14 @@
         return nullptr;
     }

-    for (size_t i=0; i<sk_X509_num(cert_chain); i++) {
-        if (!sk_X509_push(chain.get(), X509_dup_nocopy(sk_X509_value(cert_chain, i)))) {
+    for (size_t i = 0; i < sk_X509_num(cert_chain); i++) {
+        X509* cert = sk_X509_value(cert_chain, i);
+        if (!sk_X509_push(chain.get(), cert)) {
             jniThrowOutOfMemory(env, "Unable to push local certificate chain");
             JNI_TRACE("ssl=%p NativeCrypto_SSL_get_certificate => null", ssl);
             return nullptr;
         }
+        X509_up_ref(cert);
     }

     jlongArray refArray = getCertificateRefs(env, chain.get());
@@ -8252,17 +8256,20 @@
         }
         size_t chain_size = sk_X509_num(chain);
         for (size_t i = 0; i < chain_size; i++) {
-            if (!sk_X509_push(chain_copy.get(), X509_dup_nocopy(sk_X509_value(chain, i)))) {
+            X509* chain_cert = sk_X509_value(chain, i);
+            if (!sk_X509_push(chain_copy.get(), chain_cert)) {
                 jniThrowOutOfMemory(env, "Unable to push server's peer certificate chain");
                 JNI_TRACE("ssl=%p NativeCrypto_SSL_get_peer_cert_chain => certificate chain push error", ssl);
                 return nullptr;
             }
-        }
-        if (!sk_X509_push(chain_copy.get(), X509_dup_nocopy(x509))) {
+            X509_up_ref(chain_cert);
+        }
+        if (!sk_X509_push(chain_copy.get(), x509)) {
             jniThrowOutOfMemory(env, "Unable to push server's peer certificate");
             JNI_TRACE("ssl=%p NativeCrypto_SSL_get_peer_cert_chain => certificate push error", ssl);
             return nullptr;
         }
+        X509_up_ref(x509);
         chain = chain_copy.get();
     }
     jlongArray refArray = getCertificateRefs(env, chain);


Just some more C++.

Just some more C++.

--- distgen.cpp
+++ distgen.cpp
@@ -22,19 +22,20 @@
 #include "distgen_internal.h"
 #include "distgend.h"

-#include <assert.h>
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+
+#include <omp.h>
+
 #include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <omp.h>

 static u64 clockFreq = 0; // assumed frequency for printing cycles
 static u64 iters_perstat = 0;

-static char *clockFreqDef = "2.4G";
-
-static u64 toU64(char *s, int isSize) {
+static const char *clockFreqDef = "2.4G";
+
+static u64 toU64(const char *s, int isSize) {
 	u64 num = 0, denom = 1;
 	u64 f = isSize ? 1024 : 1000;


Ask the user once before importing contacts from the ldap search dialog for
the target resource, and not for each contact. Lock and unlock the resource
properly. Ok'd by Tobias.

svn path=/branches/proko2/kdepim/; revision=354559

--- kaddressbook/kabcore.cpp
+++ kaddressbook/kabcore.cpp
@@ -851,7 +851,7 @@
   }

   if ( !mLdapSearchDialog ) {
-    mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, mWidget );
+    mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this, mWidget );
     connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mSearchManager,
             SLOT( addressBookChanged() ) );
     connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ),


NativeCrypto: simplify references to EVP_MD_CTX am: 2ef5ac0a7c
am: 622dfe1e77

Change-Id: I2d26b57ab5c131c99a0c579a355f2df57dfa8241

--- src/main/native/org_conscrypt_NativeCrypto.cpp
+++ src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -9391,6 +9391,7 @@
 #define REF_EC_GROUP "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EC_GROUP;"
 #define REF_EC_POINT "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EC_POINT;"
 #define REF_EVP_CIPHER_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_CIPHER_CTX;"
+#define REF_EVP_MD_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;"
 #define REF_EVP_PKEY "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_PKEY;"
 #define REF_HMAC_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$HMAC_CTX;"
 static JNINativeMethod sNativeCryptoMethods[] = {
@@ -9442,48 +9443,24 @@
         NATIVE_METHOD(NativeCrypto, EC_KEY_get_public_key, "(" REF_EVP_PKEY ")J"),
         NATIVE_METHOD(NativeCrypto, ECDH_compute_key, "([BI" REF_EVP_PKEY REF_EVP_PKEY ")I"),
         NATIVE_METHOD(NativeCrypto, EVP_MD_CTX_create, "()J"),
-        NATIVE_METHOD(NativeCrypto, EVP_MD_CTX_cleanup,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_MD_CTX_cleanup, "(" REF_EVP_MD_CTX ")V"),
         NATIVE_METHOD(NativeCrypto, EVP_MD_CTX_destroy, "(J)V"),
-        NATIVE_METHOD(
-                NativeCrypto, EVP_MD_CTX_copy_ex,
-                "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;L" TO_STRING(
-                        JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;)I"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestInit_ex,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;J)I"),
-        NATIVE_METHOD(
-                NativeCrypto, EVP_DigestUpdate,
-                "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;[BII)V"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestUpdateDirect,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;JI)V"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestFinal_ex,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;[BI)I"),
+        NATIVE_METHOD(NativeCrypto, EVP_MD_CTX_copy_ex, "(" REF_EVP_MD_CTX "" REF_EVP_MD_CTX ")I"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestInit_ex, "(" REF_EVP_MD_CTX "J)I"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestUpdate, "(" REF_EVP_MD_CTX "[BII)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestUpdateDirect, "(" REF_EVP_MD_CTX "JI)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestFinal_ex, "(" REF_EVP_MD_CTX "[BI)I"),
         NATIVE_METHOD(NativeCrypto, EVP_get_digestbyname, "(Ljava/lang/String;)J"),
         NATIVE_METHOD(NativeCrypto, EVP_MD_block_size, "(J)I"),
         NATIVE_METHOD(NativeCrypto, EVP_MD_size, "(J)I"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestSignInit,
-                      "(L" TO_STRING(
-                              JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;J" REF_EVP_PKEY
-                                                 ")J"),
-        NATIVE_METHOD(
-                NativeCrypto, EVP_DigestSignUpdate,
-                "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;[BII)V"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestSignUpdateDirect,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;JI)V"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestSignFinal,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;)[B"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyInit,
-                      "(L" TO_STRING(
-                              JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;J" REF_EVP_PKEY
-                                                 ")J"),
-        NATIVE_METHOD(
-                NativeCrypto, EVP_DigestVerifyUpdate,
-                "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;[BII)V"),
-        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyUpdateDirect,
-                      "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;JI)V"),
-        NATIVE_METHOD(
-                NativeCrypto, EVP_DigestVerifyFinal,
-                "(L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeRef$EVP_MD_CTX;[BII)Z"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestSignInit, "(" REF_EVP_MD_CTX "J" REF_EVP_PKEY ")J"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestSignUpdate, "(" REF_EVP_MD_CTX "[BII)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestSignUpdateDirect, "(" REF_EVP_MD_CTX "JI)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestSignFinal, "(" REF_EVP_MD_CTX ")[B"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyInit, "(" REF_EVP_MD_CTX "J" REF_EVP_PKEY ")J"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyUpdate, "(" REF_EVP_MD_CTX "[BII)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyUpdateDirect, "(" REF_EVP_MD_CTX "JI)V"),
+        NATIVE_METHOD(NativeCrypto, EVP_DigestVerifyFinal, "(" REF_EVP_MD_CTX "[BII)Z"),
         NATIVE_METHOD(NativeCrypto, EVP_PKEY_CTX_set_rsa_padding, "(JI)V"),
         NATIVE_METHOD(NativeCrypto, EVP_PKEY_CTX_set_rsa_pss_saltlen, "(JI)V"),
         NATIVE_METHOD(NativeCrypto, EVP_PKEY_CTX_set_rsa_mgf1_md, "(JJ)V"),


Display results of the current selection as soon as the tests are finished.

--- src/TestTreeModel.cpp
+++ src/TestTreeModel.cpp
@@ -252,8 +252,10 @@
 	else
 		setData(index, QVariant(QBrush(QColor(0xFF,0x88,0x88,0xFF))), Qt::BackgroundRole);

-    if(m_processCount.deref())
+    if(m_processCount.deref()){
         emit allTestsCompleted();
+        printResult(selectionModel->currentIndex(), QModelIndex());
+    }
 }

 /*! \brief Clear background of the Test Tree before running it.


[Changed] The amount that creatures heal their lair for to be based on
the level of the lair instead of a static amount

Change-Id: I28752bb371d2ebc6bc68b3d4ceece85a2b7ce0af

--- MMOCoreORB/src/server/zone/managers/creature/LairObserverImplementation.cpp
+++ MMOCoreORB/src/server/zone/managers/creature/LairObserverImplementation.cpp
@@ -158,6 +158,7 @@
 		return;

 	int damageToHeal = 0;
+	int lairMaxCondition = lair->getMaxCondition();

 	for (int i = 0; i < spawnedCreatures.size() ; ++i) {
 		CreatureObject* creo = spawnedCreatures.get(i);
@@ -166,7 +167,7 @@
 			continue;

 		//  TODO: Range check
-		damageToHeal += 100;
+		damageToHeal += lairMaxCondition / 100;

 	}


[Fixed] Vehicle repair prices 0002611

[Fixed] Vehicle repair prices 0002611

Change-Id: I8416b4d0152cf095395146892b9c2554eb83695b

--- MMOCoreORB/src/server/zone/objects/creature/VehicleObjectImplementation.cpp
+++ MMOCoreORB/src/server/zone/objects/creature/VehicleObjectImplementation.cpp
@@ -186,7 +186,7 @@
 	if (player->getPlayerObject()->isPrivileged())
 		return 0;

-	return getConditionDamage() * 5;
+	return getConditionDamage() * 4;
 }

 int VehicleObjectImplementation::inflictDamage(TangibleObject* attacker, int damageType, float damage, bool destroy, bool notifyClient) {


commented code that uses deprecated ITK methods

--- Modules/PlanarFigureSegmentation/mitkPlanarFigureSegmentationController.cpp
+++ Modules/PlanarFigureSegmentation/mitkPlanarFigureSegmentationController.cpp
@@ -112,13 +112,16 @@
   if ( !figureFound )
     return;

-  if ( indexOfFigure == m_PlanarFigureList.size()-1 )
+  // TODO: fix this! The following code had to be removed as the method
+  // RemoveInputs() has been removed in ITK 4
+  // The remaining code works correctly but is slower
+  if ( false && indexOfFigure == m_PlanarFigureList.size()-1 )
   {
     // Ff the removed figure was the last one in the list, we can simply
     // remove the last input from each filter.
-    m_DistanceImageCreator->RemoveInputs( m_NormalsFilter->GetOutput( indexOfFigure ) );
-    m_NormalsFilter->RemoveInputs( m_ReduceFilter->GetOutput( indexOfFigure ) );
-    m_ReduceFilter->RemoveInputs( const_cast<mitk::Surface*>(m_ReduceFilter->GetInput(indexOfFigure)) );
+//     m_DistanceImageCreator->RemoveInputs( m_NormalsFilter->GetOutput( indexOfFigure ) );
+//     m_NormalsFilter->RemoveInput( m_ReduceFilter->GetOutput( indexOfFigure ) );
+//     m_ReduceFilter->RemoveInput( const_cast<mitk::Surface*>(m_ReduceFilter->GetInput(indexOfFigure)) );
   }
   else
   {


Add initializer for arrays in helpers

Add initializer for arrays in helpers

--- include/cudarrays/detail/dynarray/helpers.hpp
+++ include/cudarrays/detail/dynarray/helpers.hpp
@@ -45,7 +45,7 @@
 static std::array<unsigned, DimsComp>
 helper_distribution_get_gpu_grid(const cudarrays::compute_conf<DimsComp> &comp)
 {
-    std::array<unsigned, DimsComp> gpuGrid;
+    std::array<unsigned, DimsComp> gpuGrid = {{}};

     // Check if we can map the arrayPartitionGrid on the GPUs
     std::vector<unsigned> factorsGpus = utils::get_factors(comp.procs);
@@ -86,7 +86,7 @@
 helper_distribution_get_array_grid(const std::array<unsigned, DimsComp> &gpuGrid,
                                    const std::array<int, Dims>          &arrayDimToCompDim)
 {
-    std::array<unsigned, Dims> ret;
+    std::array<unsigned, Dims> ret{{}};

     // Compute the array grid and the local sizes
     for (unsigned i : utils::make_range(Dims)) {
@@ -110,7 +110,7 @@
 helper_distribution_get_local_dims(const std::array<array_size_t, Dims> &dims,
                                    const std::array<unsigned, Dims>     &arrayGrid)
 {
-    std::array<array_size_t, Dims> ret;
+    std::array<array_size_t, Dims> ret{{}};

     // Compute the array grid and the local sizes
     for (unsigned i : utils::make_range(Dims)) {
@@ -139,7 +139,7 @@
 static std::array<array_size_t, Dims - 1>
 helper_distribution_get_local_offs(const std::array<array_size_t, Dims> &dims)
 {
-    std::array<array_size_t, Dims - 1> ret;
+    std::array<array_size_t, Dims - 1> ret{{}};

     array_size_t off = 1;
     for (ssize_t dim = ssize_t(Dims) - 2; dim >= 0; --dim) {
@@ -156,7 +156,7 @@
                                       const std::array<unsigned, Dims> &arrayGrid,
                                       const std::array<int, Dims>      &arrayDimToCompDim)
 {
-    std::array<array_size_t, Dims> ret;
+    std::array<array_size_t, Dims> ret{{}};

     array_size_t off = 1;
     for (ssize_t dim = Dims - 1; dim >= 0; --dim) {
@@ -175,7 +175,7 @@
 static std::array<unsigned, DimsComp>
 helper_distribution_gpu_get_offs(const std::array<unsigned, DimsComp> &gpuGrid)
 {
-    std::array<unsigned, DimsComp> ret;
+    std::array<unsigned, DimsComp> ret{{}};

     unsigned gridOff = 1;
     for (ssize_t dim = DimsComp - 1; dim >= 0; --dim) {
@@ -193,7 +193,7 @@
 helper_distribution_get_array_dim_to_gpus(const std::array<unsigned, DimsComp> &gpuGridOffs,
                                           const std::array<int, Dims>          &arrayDimToCompDim)
 {
-    std::array<unsigned, Dims> ret;
+    std::array<unsigned, Dims> ret{{}};

     for (unsigned dim : utils::make_range(Dims)) {
         int compDim = arrayDimToCompDim[dim];


Fixed an ordering issue in the definition of a templatized conceptual hierarchy graphing function, which GCC was complaining about.

--- tenh/conceptual/conceptualinheritancegraph.hpp
+++ tenh/conceptual/conceptualinheritancegraph.hpp
@@ -200,8 +200,18 @@
     return out << ")\n";
 }

+// base case
+template <Uint32 SHORTIFY_DEPTH_, typename Concept_>
+void add_parent_concept_type_list_to_graph_recursive (Concept_ const &, EmptyTypeList const &, Graph &g)
+{
+    // nothing to add
+}
+
 template <Uint32 SHORTIFY_DEPTH_, typename Concept_, typename HeadType_, typename BodyTypeList_>
-void add_parent_concept_type_list_to_graph_recursive (Concept_ const &concept, TypeList_t<HeadType_,BodyTypeList_> const &parent_concept_type_list, Graph &g)
+void add_parent_concept_type_list_to_graph_recursive (
+    Concept_ const &concept,
+    TypeList_t<HeadType_,BodyTypeList_> const &parent_concept_type_list,
+    Graph &g)
 {
     // add the parent nodes and edges connecting concept to them
     Graph::Node concept_node(FORMAT((Pretty<TypeStringOf_t<Concept_>,SHORTIFY_DEPTH_>())),
@@ -218,12 +228,6 @@
 }

 template <Uint32 SHORTIFY_DEPTH_, typename Concept_>
-void add_parent_concept_type_list_to_graph_recursive (Concept_ const &, EmptyTypeList const &, Graph &g)
-{
-    // nothing to add
-}
-
-template <Uint32 SHORTIFY_DEPTH_, typename Concept_>
 void add_concept_hierarchy_to_graph (Concept_ const &root, Graph &g)
 {
     Graph::Node n(FORMAT((Pretty<TypeStringOf_t<Concept_>,SHORTIFY_DEPTH_>())),


Added GPIO drive as enum

Added GPIO drive as enum

--- include/depthai-shared/device/BoardConfig.hpp
+++ include/depthai-shared/device/BoardConfig.hpp
@@ -41,7 +41,8 @@
         enum Pull : std::int8_t { NO_PULL = 0, PULL_UP = 1, PULL_DOWN = 2, BUS_KEEPER = 3 };
         Pull pull = Pull::NO_PULL;
         /// Drive strength in mA (2, 4, 8 and 12mA)
-        std::int8_t drive = 0;
+        enum Drive : std::int8_t { MA_2 = 2, MA_4 = 4, MA_8 = 8, MA_12 = 12 };
+        Drive drive = MA_2;
         bool schmitt = false, slewFast = false;
         GPIO() = default;
         GPIO(Direction direction) : direction(direction) {}


Fixed isWithinLowerBounds and isWithinUpperBounds

--- include/mantella_bits/optimisationProblem.hpp
+++ include/mantella_bits/optimisationProblem.hpp
@@ -185,7 +185,7 @@
       const arma::Col<T>& parameter) {
     verify(parameter.n_elem == numberOfDimensions_, "The number of elements must be equal to the number of dimensions.");

-    return parameter < lowerBounds_;
+    return parameter >= lowerBounds_;
   }

   template <typename T, typename U>
@@ -193,7 +193,7 @@
       const arma::Col<T>& parameter) {
     verify(parameter.n_elem == numberOfDimensions_, "The number of elements must be equal to the number of dimensions.");

-    return  parameter > upperBounds_;
+    return  parameter <= upperBounds_;
   }

   template <typename T, typename U>
@@ -209,7 +209,7 @@
       const arma::Col<T>& parameter) {
     verify(parameter.n_elem == numberOfDimensions_, "The number of elements must be equal to the number of dimensions.");

-    return (!arma::any(isWithinLowerBounds(parameter)) && !arma::any(isWithinUpperBounds(parameter)) && isSatisfyingSoftConstraints(parameter));
+    return (arma::all(isWithinLowerBounds(parameter)) && arma::all(isWithinUpperBounds(parameter)) && isSatisfyingSoftConstraints(parameter));
   }

   template <typename T, typename U>


topojson grammar - add optional bbox element which is omitted


Fix lifted affinities in grid rag

Fix lifted affinities in grid rag

--- include/nifty/graph/undirected_grid_graph.hxx
+++ include/nifty/graph/undirected_grid_graph.hxx
@@ -378,22 +378,21 @@
             axis  = axes[affCoord[0]];
             range = ranges[affCoord[0]];

-            //
             for(size_t d = 0; d < DIM; ++d) {
                 cU[d] = affCoord[d+1];
-                if(d == axis) {
-                    cV[d] = affCoord[d+1] + range;
-                    // range check
-                    if(cV[d] >= shape(d) || cV[d] < 0) {
-                        continue;
-                    }
-                } else {
-                    cV[d] = affCoord[d+1];
-                }
-                auto u = coordianteToNode(cU);
-                auto v = coordianteToNode(cV);
-                edgeMap.emplace(std::make_pair(std::min(u,v), std::max(u,v)), affinities(affCoord.asStdArray()));
-            }
+                cV[d] = affCoord[d+1];
+            }
+            cV[axis] += range;
+            // range check
+            if(cV[axis] >= shape(axis) || cV[axis] < 0) {
+                continue;
+            }
+            auto u = coordianteToNode(cU);
+            auto v = coordianteToNode(cV);
+            edgeMap.emplace(
+                std::make_pair(std::min(u,v), std::max(u,v)),
+                affinities(affCoord.asStdArray())
+            );
         }
     }


added char cast

added char cast

should fix the GCC unittest

--- include/nlohmann/detail/output/serializer.hpp
+++ include/nlohmann/detail/output/serializer.hpp
@@ -415,7 +415,7 @@
         {
             // we finish reading, but do not accept: string was incomplete
             std::string sn(3,'\0');
-            snprintf(&sn[0], sn.size(), "%.2X", s.back());
+            snprintf(&sn[0], sn.size(), "%.2X", static_cast<uint8_t>(s.back()));
             JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn));
         }
     }


Style

Style

--- include/tao/pegtl/contrib/rep_one_min_max.hpp
+++ include/tao/pegtl/contrib/rep_one_min_max.hpp
@@ -58,6 +58,7 @@
          struct rep_one_min_max : internal::rep_one_min_max< Min, Max, C >
          {
          };
+
          struct ellipsis : internal::rep_one_min_max< 3, 3, '.' >
          {
          };


Add missing ABC_TRACE_FN()

Add missing ABC_TRACE_FN()

--- src/abc/file_path.cxx
+++ src/abc/file_path.cxx
@@ -479,6 +479,8 @@

 to_str_backend<file_path>::to_str_backend(char_range const & crFormat /*= char_range()*/) {
+   ABC_TRACE_FN((this, crFormat));
+
    auto it(crFormat.cbegin());

    // TODO: parse the format string.
@@ -493,6 +495,8 @@

 void to_str_backend<file_path>::write(file_path const & fp, ostream * posOut) {
+   ABC_TRACE_FN((this, fp, posOut));
+
    // TODO: apply format options.
    posOut->write(static_cast<istr const &>(fp));
 }


fix bug do not charging action if no know

--- src/actionManager.cpp
+++ src/actionManager.cpp
@@ -95,10 +95,15 @@

 		//Création d'une action a parte de son nom.
 		Action* tmpAct = Action::newAction(actTypeName);
-		//Chargement des préférence de l'action à partir du fichier de configuration.
-		tmpAct->load(fileConfig);
-		//Ajout de l'action.
-		add(ShortcutKey::stringToShortcutKey(stringShortcut), tmpAct);
+
+		//Si la création de l'action a réussie, alor on l'ajoute.
+		if(tmpAct)
+		{
+			//Chargement des préférence de l'action à partir du fichier de configuration.
+			tmpAct->load(fileConfig);
+			//Ajout de l'action.
+			add(ShortcutKey::stringToShortcutKey(stringShortcut), tmpAct);
+		}

 		//On positionne le path
 		fileConfig.SetPath("../");


make halui spindle startup safer

make halui spindle startup safer

Touchy and AXIS both start at 1 rpm.  I don't see why halui shouldn't
do it as well.

--- src/emc/usr_intf/halui.cc
+++ src/emc/usr_intf/halui.cc
@@ -1220,7 +1220,7 @@
     if (emcStatus->task.activeSettings[2] != 0) {
 	emc_spindle_on_msg.speed = fabs(emcStatus->task.activeSettings[2]);
     } else {
-	emc_spindle_on_msg.speed = +500;
+	emc_spindle_on_msg.speed = +1;
     }
     emc_spindle_on_msg.serial_number = ++emcCommandSerialNumber;
     emcCommandBuffer->write(emc_spindle_on_msg);
@@ -1234,7 +1234,7 @@
 	emc_spindle_on_msg.speed =
 	    -1 * fabs(emcStatus->task.activeSettings[2]);
     } else {
-	emc_spindle_on_msg.speed = -500;
+	emc_spindle_on_msg.speed = -1;
     }
     emc_spindle_on_msg.serial_number = ++emcCommandSerialNumber;
     emcCommandBuffer->write(emc_spindle_on_msg);


tell user when setting logpath

tell user when setting logpath

--- backlog.cpp
+++ backlog.cpp
@@ -33,7 +33,6 @@
 	virtual bool OnLoad(const CString& sArgs, CString& sMessage);
 	virtual ~CBacklogMod();
 	virtual void OnModCommand(const CString& sCommand);
-	virtual void SetLogPath(const CString& Path);

 private:
 	CString			LogPath;
@@ -51,6 +50,7 @@
 		}
 	} else {
 		SetNV("LogPath", LogPath);
+		PutModule("LogPath set to: " + LogPath);
 	}
 	return true;
 }
@@ -66,9 +66,9 @@
 		return;
 	}
 	else if (sCommand.Token(0).CaseCmp("logpath") == 0) {
-		CString Args = sCommand.Token(1, true);
-		SetNV("LogPath", Args);
-		PutModule("LogPath set to: " + Args);
+		LogPath = sCommand.Token(1, true);
+		SetNV("LogPath", LogPath);
+		PutModule("LogPath set to: " + LogPath);
 		return;
 	}

@@ -90,10 +90,6 @@
 	LogFile.Close();
 }

-void CBacklogMod::SetLogPath(const CString& Path) {
-	SetNV("LogPath", LogPath);
-}
-
 template<> void TModInfo<CBacklogMod>(CModInfo& Info) {
 	Info.AddType(CModInfo::NetworkModule);
 	Info.AddType(CModInfo::GlobalModule);


clean up usage of HAL_NAME_LEN

clean up usage of HAL_NAME_LEN

declaring an array in a function prototype doesn't make an array, it simply declares a char pointer.
so the size doesn't matter, and specifying a size just muddies the waters

Signed-off-by: John Kasunich <aac362b1c5912e0e365388c90baf62a15cd4eaac@fastmail.fm>

--- src/emc/usr_intf/halui.cc
+++ src/emc/usr_intf/halui.cc
@@ -668,7 +668,7 @@
 #define GRAD_PER_DEG (100.0/90.0)
 #define RAD_PER_DEG TO_RAD	// from posemath.h

-int halui_export_pin_IN_bit(hal_bit_t **pin, char name[HAL_NAME_LEN+2])
+int halui_export_pin_IN_bit(hal_bit_t **pin, char *name)
 {
     int retval;
     retval = hal_pin_bit_new(name, HAL_IN, pin, comp_id);
@@ -680,7 +680,7 @@
     return 0;
 }

-int halui_export_pin_IN_s32(hal_s32_t **pin, char name[HAL_NAME_LEN+2])
+int halui_export_pin_IN_s32(hal_s32_t **pin, char *name)
 {
     int retval;
     retval = hal_pin_s32_new(name, HAL_IN, pin, comp_id);
@@ -692,7 +692,7 @@
     return 0;
 }

-int halui_export_pin_IN_float(hal_float_t **pin, char name[HAL_NAME_LEN+2])
+int halui_export_pin_IN_float(hal_float_t **pin, char *name)
 {
     int retval;
     retval = hal_pin_float_new(name, HAL_IN, pin, comp_id);
@@ -705,7 +705,7 @@
 }

-int halui_export_pin_OUT_bit(hal_bit_t **pin, char name[HAL_NAME_LEN+2])
+int halui_export_pin_OUT_bit(hal_bit_t **pin, char *name)
 {
     int retval;
     retval = hal_pin_bit_new(name, HAL_OUT, pin, comp_id);


Update 03_shared_ptr_example.cpp

Update 03_shared_ptr_example.cpp

--- cpp/boost/smart_ptr/03_shared_ptr_example.cpp
+++ cpp/boost/smart_ptr/03_shared_ptr_example.cpp
@@ -1,5 +1,7 @@
 #include <iostream>
 #include <boost/smart_ptr.hpp>
+#include <boost/make_shared.hpp>
+#include <vector>

 using namespace std;

@@ -13,5 +15,10 @@
     *int_ptr = 20;
     cout << *p2 << endl;
     cout << "Count of p is " << p2.use_count() << endl;
+
+    auto sp = boost::make_shared<string>("make_shared");
+    auto spv= boost::make_shared<vector<int> >(10,2);
+    for(auto i = spv->begin(); i != spv->end(); ++i)
+        cout << *i << endl;
     return 0;
 }


resized temp outputs in MnistForwardModel

--- tensorflow/c/eager/mnist_gradients_testutil.cc
+++ tensorflow/c/eager/mnist_gradients_testutil.cc
@@ -238,8 +238,8 @@
    *     hidden_layer = tf.nn.relu(mm_out_1)
    *     scores = tf.matmul(hidden_layer,W2)
    *     softmax =
-   * tf.nn.sparse_softmax_cross_entropy_with_logits(scores,y_labels) return
-   * scores, softmax
+   *      tf.nn.sparse_softmax_cross_entropy_with_logits(scores,y_labels)
+   *     return scores, softmax
    *
    * Use this convention for inputs:
    *
@@ -271,7 +271,8 @@
                             registry));  // Compute W2*Relu(X*W1)

   AbstractTensorHandle* scores = temp_outputs[0];
-
+
+  temp_outputs.resize(2);
   TF_RETURN_IF_ERROR(SparseSoftmaxCrossEntropyLoss(
       ctx, tape, {scores, y_labels}, absl::MakeSpan(temp_outputs),
       "softmax_loss", registry));  // Compute Softmax(Scores,labels)


[lite] Always run analyze and legalize variables to tflite.

PiperOrigin-RevId: 411849586
Change-Id: Ia0088db3f8bf3a468d4e0ab80bb20c4888f516b5

--- tensorflow/compiler/mlir/lite/tf_tfl_passes.cc
+++ tensorflow/compiler/mlir/lite/tf_tfl_passes.cc
@@ -299,10 +299,8 @@

     pass_manager->addNestedPass<mlir::FuncOp>(
         mlir::TFL::CreateLegalizeTFPass(pass_config.runtime_verification));
-    if (pass_config.enable_tflite_variables) {
-      pass_manager->addPass(mlir::TFL::CreateAnalyzeVariablesPass());
-      pass_manager->addPass(mlir::TFL::CreateLegalizeVariablesPass());
-    }
+    pass_manager->addPass(mlir::TFL::CreateAnalyzeVariablesPass());
+    pass_manager->addPass(mlir::TFL::CreateLegalizeVariablesPass());
     pass_manager->addPass(mlir::TFL::CreateLegalizeHashTablesPass());
     pass_manager->addNestedPass<mlir::FuncOp>(
         mlir::TFL::CreateOptimizePass(/*enable_canonicalization=*/true));


internal change

internal change

PiperOrigin-RevId: 249802439

--- tensorflow/lite/kernels/depthwise_conv_test.cc
+++ tensorflow/lite/kernels/depthwise_conv_test.cc
@@ -1819,9 +1819,6 @@

   // Invoke and verify output.
   m.Invoke();
-  for (int i = 0; i < 72; ++i) {
-    printf("%d,", static_cast<int>(m.GetDequantizedOutput()[i]));
-  }
   EXPECT_THAT(
       m.GetDequantizedOutput(),
       ElementsAreArray(ArrayFloatNear({


Updated code formatting

Updated code formatting

--- src/GeometricShapes.cc
+++ src/GeometricShapes.cc
@@ -38,7 +38,7 @@

   // validate length
   if (length_ <= 0
-    || ((120 < length_) && (is_included_warnings == true))) {
+      || ((120 < length_) && (is_included_warnings == true))) {

     is_valid = false;
     if (messages_error != nullptr) {


Created compute spread skeleton function

--- models/forest/forest.cpp
+++ models/forest/forest.cpp
@@ -9,18 +9,13 @@

 std::vector<std::shared_ptr<warped::Event> > Forest::initializeLP() {

-    // Register random number generator
-    //this->registerRNG<std::default_random_engine>(this->rng_);
-
-    std::default_random_engine rng;
-
-    uniform_int_distribution<int> LPS(0, this->width * this->height);
-
     std::vector<std::shared_ptr<warped::Event> > events;

-    events.emplace_back(new ForestEvent {lp_name(LPS(rng), IGNITION, 1});
-
-
+    for (unsigned int i = 0; i < this->index_; i++){ //For all of the cells in the forest
+        if(this->state.heat_content_ >= this->ignition_threshold){ //If heat content > ignition threshold
+            events.emplace_back(new ForestEvent {this->name_, IGNITION,ts_} // Then start an ignition event
+        }
+    }
     return events;
 }

@@ -40,7 +35,8 @@
         case RADIATION: {
             this->state_.heat_content_=this->state_.heat_content_ + recieved_event.heat_content;
             // if there is enough heat and the vegtation is unburnt Schedule ignition
-            if(this->state_.heat_content_ >= this->ignition_threshold && this->state_burn_status == UNBURNT){
+            if(this->state_.heat_content_ >= this->ignition_threshold &&
+                                                            this->state_burn_status == UNBURNT){
             unsigned int ignition_time = recieved_event.ts+1;
             response_events.emplace_back(new ForestEvent {this->name_, IGNITION, ignition_time });
             }
@@ -61,7 +57,8 @@
             }
             else{
             unsigned int radiation_timer = recieved_event.ts + 5;
-            response_events.emplace_back(new ForestEvent {this->name_, RADIATION_TIMER, radiation_timer });
+            response_events.emplace_back(new ForestEvent {this->name_, RADIATION_TIMER,
+                                                                           radiation_timer });
             }
             break;
         }
@@ -77,20 +74,18 @@
             this->state_.heat_content_=this->state_.heat_content_ + (this->peak_threshold - this->ignition_threshold);
             // Schedule first Radiation Timer
             unsigned int radiation_timer = recieved_event.ts + 5;
-            response_events.emplace_back(new ForestEvent {this->name_, RADIATION_TIMER, radiation_timer });
+            response_events.emplace_back(new ForestEvent {this->name_, RADIATION_TIMER,
+                                                                          radiation_timer });
             break;
         }
     }
     return response_events;
 }

-std::queue<int> ignition_threshold_vector;
-std::queue<int> peak_threshold_vector;
-unsigned int width,height;
-

 unsigned char *read_bmp( std::string img_name, unsigned int heat_rate,
-                         unsigned int radiation_percent, unsigned int burnout_threshold){
+                            unsigned int radiation_percent, unsigned int burnout_threshold
+                                        unsigned int burn_start_x, unsigned int burn_start_y){

     FILE *fp = fopen(img_name.c_str(), "rb");
     if(!fp) throw "Argument Exception";
@@ -123,17 +118,77 @@
             unsigned int ignition_threshold = (int)data[j] + (int)data[j+1] + (int)data[j+2];
             unsigned int peak_threshold = ((int)data[j] + (int)data[j+1] + (int)data[j+2]) * 2;

+
             std::string name = Forest::lp_name(index_num)
             lps.emplace_back(name, width, height,ignition_threshold, heat_rate,
-                             peak_threshold, burnout_threshold, index_num);
-
+                                     peak_threshold, burnout_threshold, index_num);
+
+            /* If the LP being created is the start of the fire then give it intial heat content */
+            if(i == burn_start_x && j == burn_start_y){
+                this->state.heat_content_ = 400
+            }
         }
    }
    fclose(fp);
    return data;
 }

-
+std::string Forest::compute_spread(direction_t direction) {
+
+    unsigned int new_x = 0, new_y = 0;
+    unsigned int current_y = index_ / size_x_;
+    unsigned int current_x = index_ % size_x_;
+
+    switch (direction) {
+
+       case NORTH: {
+           new_x = current_x;
+           new_y = (current_y + 1) % size_y_;
+       } break;
+
+       case NORTH_EAST: {
+           new_x = (current_x + 1) % size_x_;
+           new_y = (current_y + 1) % size_y_;
+       } break;
+
+       case EAST: {
+           new_x = (current_x + 1) % size_x_;
+           new_y = current_y;
+       } break;
+
+       case SOUTH_EAST: {
+           new_x = (current_x + 1) % size_x_;
+           new_y = (current_y + size_y_ - 1) % size_y_;
+       } break;
+
+       case SOUTH: {
+           new_x = current_x;
+           new_y = (current_y + size_y_ - 1) % size_y_;
+       } break;
+
+       case SOUTH_WEST: {
+           new_x = (current_x + size_x_ - 1) % size_x_;
+           new_y = (current_y + size_y_ - 1) % size_y_;
+       } break;
+
+       case WEST: {
+           new_x = (current_x + size_x_ - 1) % size_x_;
+           new_y = current_y;
+       } break;
+
+       case NORTH_WEST: {
+           new_x = (current_x + size_x_ - 1) % size_x_;
+           new_y = (current_y + 1) % size_y_;
+       } break;
+
+       default: {
+           std::cerr << "Invalid move direction " << direction << std::endl;
+           assert(0);
+       }
+       }
+
+       return lp_name(new_x + new_y * size_x_);
+}

 int main(int argc, char *argv[],){
@@ -142,30 +197,43 @@
     unsigned int heat_rate = 100;
     unsigned int radiation_percent = 5;
     unsigned int burnout_threshold = 50;
+    unsigned int burn_start_x = 500;
+    unsigned int burn_start_y = 501;

-    TCLAP::ValueArg<std::string> config_arg("m", "map",
-                        "Forest model vegetation config", false, config_filename, "string");
+    TCLAP::ValueArg<std::string> config_arg("m", "map", "Forest model vegetation config",
+                                                                false, config_filename, "string");
     TCLAP::ValueArg<unsigned int> heat_rate_arg("h", "heat-rate", "Speed of growth of the fire",
                                                                 false, heat_rate, "unsigned int");
     TCLAP::ValueArg<unsigned int> radition_percent_arg("r", "radiation-percent",
-            "Percent of Heat released every timstamp", false, radiation_percent, "unsigned int");
+             "Percent of Heat released every timstamp", false, radiation_percent, "unsigned int");
     TCLAP::ValueArg<unsigned int> burnout_threshold_arg("b", "burnout-threshold",
                                     "Amount of heat needed for a cell to burn out", false,
-                                                            burnout_threshold, "unsigned int");
+                                                               burnout_threshold, "unsigned int");
+    TCLAP::ValueArg<unsigned int> burn_start_x_arg("x", "burn-start-x",
+                                                     "x coordinate of the start of fire", false,
+                                                                    burn_start_x, "unsigned int");
+    TCLAP::ValueArg<unsigned int> burn_start_y_arg("y", "burn-start-y",
+                                                     "y coordinate of the start of fire", false,
+                                                                    burn_start_y, "unsigned int");
+
     std::vector<TCLAP::Arg*> args = {&config_arg, &heat_rate_arg,
-                                     &radiation_percent_arg, &burnout_threshold_arg};
+                                        &radiation_percent_arg, &burnout_threshold_arg,
+                                                    &burn_start_x_arg, &burn_start_y_arg};

     config_filename = config_arg.getValue();
     heat_rate = heat_rate_arg.getValue();
     radiation_percent = radiation_percent_arg.getValue();
     burnout_threshold = burnout_threshold.getValue();
+    burn_start_x = burn_start_x.getValue();
+    burn_start_y = burn_start_y.getValue();

     warped::Simulation forest_sim {"Forest Simulation", argc, argv, args};

     std::vector<Forest> lps;

-    (void) read_bmp(config_filename, heat_rate, radiation_percent, burnout_threshold);
+    (void) read_bmp(config_filename, heat_rate, radiation_percent, burnout_threshold,
+                                                                burn_start_x, burn_start_y);

     std::vector<warped::LogicalProcess*> lp_pointers;
     for (auto& lp : lps) {


Use gpgSmPath() instead of "gpgsm"

Use gpgSmPath() instead of "gpgsm"

svn path=/trunk/KDE/kdepim/kleopatra/; revision=802348

--- kleopatra/commands/refreshx509certscommand.cpp
+++ kleopatra/commands/refreshx509certscommand.cpp
@@ -34,6 +34,8 @@

 #include "refreshx509certscommand.h"

+#include <utils/gnupg-helper.h>
+
 #include <KLocale>
 #include <KMessageBox>

@@ -69,7 +71,7 @@
 }

 QStringList RefreshX509CertsCommand::arguments() const {
-    return QStringList() << "gpgsm" << "-k" << "--with-validation" << "--force-crl-refresh" << "--enable-crl-checks";
+    return QStringList() << gpgSmPath() << "-k" << "--with-validation" << "--force-crl-refresh" << "--enable-crl-checks";
 }

 QString RefreshX509CertsCommand::errorCaption() const {


do not make default suffix lower case

do not make default suffix lower case


remove whitespace

remove whitespace


More efficient way to delete from vector

--- benchmarks/allocators/benchmark_5.cc
+++ benchmarks/allocators/benchmark_5.cc
@@ -8,6 +8,7 @@
 #include <iterator>
 #include <functional>
 #include <ctime>
+#include <algorithm>

 #include <stdio.h>
 #include <stdlib.h>
@@ -73,8 +74,9 @@
 	for (size_t i = 0; i < dealloc_count; i++)
 	{
 		size_t delete_index = subsystem_delete_indicies[i];
-		delete (*vec)[delete_index];
-		vec->erase(vec->begin() + delete_index);
+		std::iter_swap(vec->end(), vec->begin() + delete_index);
+		delete vec->end();
+		vec->pop_back();
 	}

 	// Remaining memory is never deallocated, but this doesn't matter because this


fix a sequence bug that was here for who knows how long

--- src/Hooks/Sequence.cpp
+++ src/Hooks/Sequence.cpp
@@ -167,6 +167,8 @@
 			{
 			case SEQUENCE_DEFAULT_LOOKAT01:
 				return random_sequence(12, 13);
+			default:
+				return sequence;
 			}
 		}
 	case FNV("models/weapons/v_knife_widowmaker.mdl"):
@@ -175,6 +177,8 @@
 			{
 			case SEQUENCE_DEFAULT_LOOKAT01:
 				return random_sequence(14, 15);
+			default:
+				return sequence;
 			}
 		}
 	default:


Exposed getHandle() methods of AtomTable class.

--- opencog/python/atomspace/AtomTable_wrap.cc
+++ opencog/python/atomspace/AtomTable_wrap.cc
@@ -1,6 +1,8 @@
 #include "AtomTable_wrap.h"
 #include <opencog/atomspace/AtomTable.h>
 #include <boost/python/class.hpp>
+#include <boost/python/return_value_policy.hpp>
+#include <boost/python/manage_new_object.hpp>

 using namespace opencog;
 using namespace boost::python;
@@ -10,5 +12,21 @@
     class_<AtomTable, boost::noncopyable>("AtomTable", no_init)
         .def(init<optional<bool> >())
         .def("getSize", &AtomTable::getSize)
+        .def("getHandle",
+            (Handle (AtomTable::*)(const char*, Type) const)
+            &AtomTable::getHandle)
+        .def("getHandle",
+            (Handle (AtomTable::*)(const Node*) const)
+            &AtomTable::getHandle)
+        .def("getHandle",
+            (Handle (AtomTable::*)(Type, const HandleSeq &seq) const)
+            &AtomTable::getHandle)
+        .def("getHandle",
+            (Handle (AtomTable::*)(const Link*) const)
+            &AtomTable::getHandle)
+        .def("getHandleSet",
+            (HandleEntry* (AtomTable::*)(Type, bool) const)
+            &AtomTable::getHandleSet,
+            return_value_policy<manage_new_object>())
     ;
 }


[Code Clean] Removing debug output.

[Code Clean] Removing debug output.

--- src/blackhole/repository/config/parser/rapidjson.hpp
+++ src/blackhole/repository/config/parser/rapidjson.hpp
@@ -18,51 +18,39 @@
     static dynamic_t transform(const value_type& value) {
         switch (value.GetType()) {
         case rapidjson::kNullType:
-            std::cout << "null" << std::endl;
             throw blackhole::error_t("null values are not supported");
         case rapidjson::kFalseType:
         case rapidjson::kTrueType:
             return value.GetBool();
         case rapidjson::kNumberType: {
             if (value.IsInt()) {
-                std::cout << "number: " << value.GetInt() << std::endl;
                 return value.GetInt();
             } else if (value.IsInt64()) {
-                std::cout << "number: " << value.GetInt64() << std::endl;
                 return value.GetInt64();
             } else if (value.IsUint()) {
-                std::cout << "number: " << value.GetUint() << std::endl;
                 return value.GetUint();
             } else if (value.IsUint64()) {
-                std::cout << "number: " << value.GetUint64() << std::endl;
                 return value.GetUint64();
             } else {
-                std::cout << "number: " << value.GetDouble() << std::endl;
                 return value.GetDouble();
             }
         }
         case rapidjson::kStringType:
-            std::cout << "string: " << value.GetString() << std::endl;
             return value.GetString();
         case rapidjson::kArrayType: {
-            std::cout << "begin array" << std::endl;
             dynamic_t::array_t array;
             for (auto it = value.Begin(); it != value.End(); ++it) {
                 array.push_back(transformer_t<value_type>::transform(*it));
             }
-            std::cout << "end array" << std::endl;
             return array;
         }
         case rapidjson::kObjectType: {
-            std::cout << "begin object" << std::endl;
             dynamic_t::object_t object;
             for (auto it = value.MemberBegin(); it != value.MemberEnd(); ++it) {
                 std::string name = it->name.GetString();
                 dynamic_t value = transformer_t<value_type>::transform(it->value);
-                std::cout << "key: " << name << std::endl;
                 object[name] = value;
             }
-            std::cout << "end object" << std::endl;
             return object;
         }
         default:


Added using declaration.

Added using declaration.

git-svn-id: b36ee6b6e70810a25e81bc801db00a83677983fc@340787 13f79535-47bb-0310-9956-ffa450edef68

--- src/PlatformSupport/XalanStdOutputStream.cpp
+++ src/PlatformSupport/XalanStdOutputStream.cpp
@@ -113,6 +113,10 @@

 		if(!m_outputStream)
 		{
+#if defined(XALAN_STRICT_ANSI_HEADERS)
+			using namespace std;
+#endif
+
 			throw XalanStdOutputStreamWriteException(errno);
 		}
 	}
@@ -131,6 +135,10 @@

 	if(!m_outputStream)
 	{
+#if defined(XALAN_STRICT_ANSI_HEADERS)
+		using namespace std;
+#endif
+
 		throw XalanStdOutputStreamWriteException(errno);
 	}
 }


move GetReplicaPolicy out of class ReplicaPolicy

--- src/brpc/policy/consistent_hashing_load_balancer.cpp
+++ src/brpc/policy/consistent_hashing_load_balancer.cpp
@@ -35,25 +35,14 @@
 public:
     ReplicaPolicy() : _hash_func(nullptr) {}
     ReplicaPolicy(HashFunc hash) : _hash_func(hash) {}
-
     virtual ~ReplicaPolicy();
+
     virtual bool Build(ServerId server,
                        size_t num_replicas,
                        std::vector<ConsistentHashingLoadBalancer::Node>* replicas) const = 0;

-    static const ReplicaPolicy* GetReplicaPolicy(const std::string& name) {
-        auto iter = _policy_map.find(name);
-        if (iter != _policy_map.end()) {
-            return iter->second;
-        }
-        return nullptr;
-    }
-
 protected:
-    HashFunc _hash_func = nullptr;
-
-private:
-    static const std::map<std::string, const ReplicaPolicy*> _policy_map;
+    HashFunc _hash_func;
 };

 class DefaultReplicaPolicy : public ReplicaPolicy {
@@ -124,15 +113,27 @@
     return true;
 }

-const std::map<std::string, const ReplicaPolicy*> ReplicaPolicy::_policy_map = {
+namespace {
+
+const std::map<std::string, const ReplicaPolicy*> g_replica_policy_map = {
     {"murmurhash3", new DefaultReplicaPolicy(MurmurHash32)},
     {"md5", new DefaultReplicaPolicy(MD5Hash32)},
     {"ketama", new KetamaReplicaPolicy}
 };

+const ReplicaPolicy* GetReplicaPolicy(const std::string& name) {
+		auto iter = g_replica_policy_map.find(name);
+		if (iter != g_replica_policy_map.end()) {
+				return iter->second;
+		}
+		return nullptr;
+}
+
+} // namespace
+
 ConsistentHashingLoadBalancer::ConsistentHashingLoadBalancer(const char* name)
     : _num_replicas(FLAGS_chash_num_replicas), _name(name) {
-    _replicas_policy = ReplicaPolicy::GetReplicaPolicy(name);
+    _replicas_policy = GetReplicaPolicy(name);
     CHECK(_replicas_policy)
         << "Fail to find replica policy for consistency lb: '" << name << '\'';
 }


Bugfix.

Bugfix.

--- isogeometric_model/src/VolBoundaryCondition.C
+++ isogeometric_model/src/VolBoundaryCondition.C
@@ -273,8 +273,6 @@
       return;    // No update is done if approximation within tolerance has allready occured

     // The domain is described by a polygon in the parameter domain.
-#if 1
-
     assert(domain_.size() > 0);

     // For now we assume that the domain is rectangular and axis-aligned.
@@ -425,7 +423,6 @@
 	else
 	  srf_it_pos -= srf_kdim;
       }
-#endif
   }

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


Ignore jack buffer size callbacks, since svn jack is broken and reports buffer sizes of 0...

git-svn-id: fb6d863945102bebb9fe1d25d24b18a16295c170@2950 a436a847-0d15-0410-975c-d299462d15a1

--- src/engine/JackDriver.cpp
+++ src/engine/JackDriver.cpp
@@ -515,6 +515,8 @@
 int
 JackDriver::_block_length_cb(jack_nframes_t nframes)
 {
+	cout << "FIXME: JACK BLOCK LENGTH CALLBACK: " << nframes << endl;
+	return 0;
 	if (_root_patch) {
 		_block_length = nframes;
 		_root_patch->set_buffer_size(context(), *_engine.buffer_factory(), PortType::AUDIO,


Replace include "TCint.h" by "TInterpreter.h"

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@24103 27541ba8-7e3a-0410-8455-c3a389f83636

--- bindings/pyroot/src/MethodHolder.cxx
+++ bindings/pyroot/src/MethodHolder.cxx
@@ -22,7 +22,7 @@

 // CINT
 #include "Api.h"
-#include "TCint.h"
+#include "TInterpreter.h"

 // Standard
 #include <assert.h>


fix tier and fail_limit to be writeable in the python binding

--- bindings/python/src/torrent_info.cpp
+++ bindings/python/src/torrent_info.cpp
@@ -83,38 +83,25 @@
        return result;
     }

-    bool get_tier(announce_entry const& ae)
-    { return ae.tier; }
-    bool get_fail_limit(announce_entry const& ae)
-    { return ae.fail_limit; }
-    bool get_fails(announce_entry const& ae)
-    { return ae.fails; }
-    bool get_source(announce_entry const& ae)
-    { return ae.source; }
-    bool get_verified(announce_entry const& ae)
-    { return ae.verified; }
-    bool get_updating(announce_entry const& ae)
-    { return ae.updating; }
-    bool get_start_sent(announce_entry const& ae)
-    { return ae.start_sent; }
-    bool get_complete_sent(announce_entry const& ae)
-    { return ae.complete_sent; }
-    bool get_send_stats(announce_entry const& ae)
-    { return ae.send_stats; }
-
-
-    size_type get_size(file_entry const& fe)
-    { return fe.size; }
-    size_type get_offset(file_entry const& fe)
-    { return fe.offset; }
-    bool get_pad_file(file_entry const& fe)
-    { return fe.pad_file; }
-    bool get_executable_attribute(file_entry const& fe)
-    { return fe.executable_attribute; }
-    bool get_hidden_attribute(file_entry const& fe)
-    { return fe.hidden_attribute; }
-    bool get_symlink_attribute(file_entry const& fe)
-    { return fe.symlink_attribute; }
+    bool get_tier(announce_entry const& ae) { return ae.tier; }
+    void set_tier(announce_entry& ae, bool v) { ae.tier = v; }
+    bool get_fail_limit(announce_entry const& ae) { return ae.fail_limit; }
+    void set_fail_limit(announce_entry& ae, int l) { ae.fail_limit = l; }
+    bool get_fails(announce_entry const& ae) { return ae.fails; }
+    bool get_source(announce_entry const& ae) { return ae.source; }
+    bool get_verified(announce_entry const& ae) { return ae.verified; }
+    bool get_updating(announce_entry const& ae) { return ae.updating; }
+    bool get_start_sent(announce_entry const& ae) { return ae.start_sent; }
+    bool get_complete_sent(announce_entry const& ae) { return ae.complete_sent; }
+    bool get_send_stats(announce_entry const& ae) { return ae.send_stats; }
+
+
+    size_type get_size(file_entry const& fe) { return fe.size; }
+    size_type get_offset(file_entry const& fe) { return fe.offset; }
+    bool get_pad_file(file_entry const& fe) { return fe.pad_file; }
+    bool get_executable_attribute(file_entry const& fe) { return fe.executable_attribute; }
+    bool get_hidden_attribute(file_entry const& fe) { return fe.hidden_attribute; }
+    bool get_symlink_attribute(file_entry const& fe) { return fe.symlink_attribute; }

 } // namespace unnamed

@@ -197,8 +184,8 @@

     class_<announce_entry>("announce_entry", init<std::string const&>())
         .def_readwrite("url", &announce_entry::url)
-        .add_property("tier", &get_tier)
-        .add_property("fail_limit", &get_fail_limit)
+        .add_property("tier", &get_tier, &set_tier)
+        .add_property("fail_limit", &get_fail_limit, &set_fail_limit)
         .add_property("fails", &get_fails)
         .add_property("source", &get_source)
         .add_property("verified", &get_verified)