Modified texture mapping.

Modified texture mapping.

--- Source/Texture/BasicTexture.cpp
+++ Source/Texture/BasicTexture.cpp
@@ -16,10 +16,10 @@
                  0, GL_RGBA, GL_UNSIGNED_BYTE, i.getPixelsPtr());

     glGenerateMipmap(GL_TEXTURE_2D);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);

 }


More embed-external-ui example macOS code, but still no window :(

--- examples/EmbedExternalUI/EmbedExternalExampleUI.cpp
+++ examples/EmbedExternalUI/EmbedExternalExampleUI.cpp
@@ -30,6 +30,33 @@
 # define X11Key_Escape 9
 #endif

+#if defined(DISTRHO_OS_MAC)
+@interface NSExternalWindow : NSWindow
+@end
+@implementation NSExternalWindow
+- (id)initWithContentRect:(NSRect)contentRect
+                styleMask:(unsigned long)aStyle
+                  backing:(NSBackingStoreType)bufferingType
+                    defer:(BOOL)flag
+{
+    NSWindow* result = [super initWithContentRect:contentRect
+                                        styleMask:aStyle
+                                          backing:bufferingType
+                                            defer:flag];
+    [result setAcceptsMouseMovedEvents:YES];
+    return (NSExternalWindow*)result;
+}
+- (BOOL)canBecomeKeyWindow
+{
+    return YES;
+}
+- (BOOL)canBecomeMainWindow
+{
+    return NO;
+}
+@end
+#endif
+
 START_NAMESPACE_DISTRHO

 // -----------------------------------------------------------------------------------------------------------
@@ -38,7 +65,7 @@
 {
 #if defined(DISTRHO_OS_MAC)
     NSView* fView;
-    id fWindow;
+    NSExternalWindow* fWindow;
 #elif defined(DISTRHO_OS_WINDOWS)
 #else
     ::Display* fDisplay;
@@ -50,7 +77,7 @@
         : UI(512, 256),
 #if defined(DISTRHO_OS_MAC)
           fView(nullptr),
-          fWindow(nil),
+          fWindow(nullptr),
 #elif defined(DISTRHO_OS_WINDOWS)
 #else
           fDisplay(nullptr),
@@ -59,20 +86,40 @@
           fValue(0.0f)
     {
 #if defined(DISTRHO_OS_MAC)
+        if (isStandalone())
+        {
+            [[NSApplication sharedApplication]new];
+            [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+            [NSApp activateIgnoringOtherApps:YES];
+        }
+
         NSAutoreleasePool* const pool = [[NSAutoreleasePool alloc] init];
         [NSApplication sharedApplication];

+        fView = [NSView new];
+        DISTRHO_SAFE_ASSERT_RETURN(fView != nullptr,);
+
+        [fView initWithFrame:NSMakeRect(0, 0, getWidth(), getHeight())];
+        [fView setAutoresizesSubviews:YES];
+        [fView setFrame:NSMakeRect(0, 0, getWidth(), getHeight())];
+        [fView setHidden:NO];
+        [fView setNeedsDisplay:YES];
+
         if (isEmbed())
         {
-            // [fView retain];
-            // [(NSView*)getParentWindowHandle() fView];
+            [fView retain];
+            [(NSView*)getParentWindowHandle() addSubview:fView];
         }
         else
         {
-            fWindow = [[NSWindow new]retain];
-            DISTRHO_SAFE_ASSERT_RETURN(fWindow != nil,);
-
-            [fWindow setIsVisible:NO];
+            fWindow = [[[NSExternalWindow alloc]
+                         initWithContentRect:[fView frame]
+                                   styleMask:(NSWindowStyleMaskClosable | NSWindowStyleMaskTitled | NSWindowStyleMaskResizable)
+                                     backing:NSBackingStoreBuffered
+                                       defer:NO]retain];
+            DISTRHO_SAFE_ASSERT_RETURN(fWindow != nullptr,);
+
+            // [fWindow setIsVisible:NO];

             if (NSString* const nsTitle = [[NSString alloc]
                                             initWithBytes:getTitle()
@@ -80,9 +127,11 @@
                                                  encoding:NSUTF8StringEncoding])
                 [fWindow setTitle:nsTitle];

-            // [fWindow setContentView:impl->view];
-            // [fWindow makeFirstResponder:impl->view];
+            [fWindow setContentView:fView];
+            [fWindow setContentSize:NSMakeSize(getWidth(), getHeight())];
+            [fWindow makeFirstResponder:fView];
             [fWindow makeKeyAndOrderFront:fWindow];
+            d_stdout("created window with size %u %u", getWidth(), getHeight());
         }

         [pool release];
@@ -134,11 +183,13 @@
     ~EmbedExternalExampleUI()
     {
 #if defined(DISTRHO_OS_MAC)
+        if (fView == nullptr)
+            return;
+
         if (fWindow != nil)
             [fWindow close];

-        if (fView != nullptr)
-            [fView release];
+        [fView release];

         if (fWindow != nil)
             [fWindow release];
@@ -173,6 +224,19 @@
    /* --------------------------------------------------------------------------------------------------------
     * External Window overrides */

+    void focus() override
+    {
+        d_stdout("focus");
+#if defined(DISTRHO_OS_MAC)
+        DISTRHO_SAFE_ASSERT_RETURN(fWindow != nil,);
+        [fWindow orderFrontRegardless];
+#elif defined(DISTRHO_OS_WINDOWS)
+#else
+        DISTRHO_SAFE_ASSERT_RETURN(fWindow != 0,);
+        XRaiseWindow(fDisplay, fWindow);
+#endif
+    }
+
     uintptr_t getNativeWindowHandle() const noexcept override
     {
 #if defined(DISTRHO_OS_MAC)
@@ -186,7 +250,7 @@

     void titleChanged(const char* const title) override
     {
-        d_stdout("visibilityChanged %s", title);
+        d_stdout("titleChanged %s", title);
 #if defined(DISTRHO_OS_MAC)
         if (fWindow != nil)
         {
@@ -196,6 +260,7 @@
                                                 encoding:NSUTF8StringEncoding])
             {
                 [fWindow setTitle:nsTitle];
+                [nsTitle release];
             }
         }
 #elif defined(DISTRHO_OS_WINDOWS)
@@ -220,9 +285,10 @@
     {
         d_stdout("visibilityChanged %d", visible);
 #if defined(DISTRHO_OS_MAC)
+        DISTRHO_SAFE_ASSERT_RETURN(fView != nullptr,);
         if (fWindow != nil)
             [fWindow setIsVisible:(visible ? YES : NO)];
-        else if (fView != nullptr)
+        else
             [fView setHidden:(visible ? NO : YES)];
 #elif defined(DISTRHO_OS_WINDOWS)
 #else
@@ -251,8 +317,9 @@

             if (event == nil)
                 break;
-
-            [NSApp sendEvent: event];
+            d_stdout("uiIdle with event %p", event);
+
+            [NSApp sendEvent:event];
         }

         [pool release];


Fixed MDEV-385: mysqltest running with continue-on-error crashes on a non-SQL command producing an error

client/mysqltest.cc:
  Added missing DBUG_VOID_RETURN

--- client/mysqltest.cc
+++ client/mysqltest.cc
@@ -1285,7 +1285,7 @@
                     "errno: %d",
           command->first_word_len, command->query, error, my_errno,
           sys_errno);
-      return;
+      DBUG_VOID_RETURN;
     }

     i= match_expected_error(command, error, NULL);


Add documentation.

Add documentation.

--- lib/llvmopencl/Kernel.cc
+++ lib/llvmopencl/Kernel.cc
@@ -162,6 +162,11 @@
   return true;
 }

+/**
+ * The main entry to the "parallel region formation", phase which search
+ * for the regions between barriers that can be freely parallelized
+ * across work-items in the work-group.
+ */
 ParallelRegion::ParallelRegionVector *
 Kernel::getParallelRegions(llvm::LoopInfo *LI) {
   ParallelRegion::ParallelRegionVector *parallel_regions =


when loading a scene set the globals last

--- src/io/statereader.cpp
+++ src/io/statereader.cpp
@@ -69,7 +69,6 @@
     bool packAndGo = xml.getHeaderValue( "packAndGo" ).toBool();

     QList<QVariant>globals = xml.getGlobals();
-    dynamic_cast<GlobalPropertyModel*>( Models::g() )->setState( globals );
     m_cameras = xml.getCameras();

     QList< QList<QVariant> >datasets = xml.getDatasets();
@@ -191,6 +190,7 @@
             }
         }
     }
+    dynamic_cast<GlobalPropertyModel*>( Models::g() )->setState( globals );
 }

 QVariant StateReader::getFromStateList( Fn::Property prop, QList<QVariant>& state )


explicitly set using gradient image

explicitly set using gradient image

This may latter be exposed as a parameter

Change-Id: I694de874aaaf22c9428c4fe02b2cfebce3181ddb

--- Code/Registration/src/sitkImageRegistrationMethod.cxx
+++ Code/Registration/src/sitkImageRegistrationMethod.cxx
@@ -404,6 +404,9 @@

   metric->SetMaximumNumberOfThreads(this->GetNumberOfThreads());

+  metric->SetUseMovingImageGradientFilter(true);
+  metric->SetUseFixedImageGradientFilter(true);
+
   typedef itk::InterpolateImageFunction< FixedImageType, double > FixedInterpolatorType;
   typename FixedInterpolatorType::Pointer   fixedInterpolator  = CreateInterpolator(fixed.GetPointer(), m_Interpolator);
   metric->SetFixedInterpolator( fixedInterpolator );


Factor out external distortion file loading code shared between techniques

--- osvr/RenderKit/osvr_display_configuration.cpp
+++ osvr/RenderKit/osvr_display_configuration.cpp
@@ -46,6 +46,46 @@
 OSVRDisplayConfiguration::OSVRDisplayConfiguration(
     const std::string& display_description) {
     parse(display_description);
+}
+
+inline Json::Value
+getExternalDistortionFile(const char* distortionTypeName, Json::Reader& reader,
+                          Json::Value const& distortionObject,
+                          const char* externalFileKey) {
+    Json::Value const& externalFile = distortionObject[externalFileKey];
+    if ((!externalFile.isNull()) && (externalFile.isString())) {
+        // Read a Json value from the external file, then replace the distortion
+        // mesh with that from the file.
+
+        Json::Value externalData;
+        const std::string fn = externalFile.asString();
+        std::ifstream fs{fn};
+        if (!fs) {
+            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
+                         "open external "
+                      << distortionTypeName << " file " << fn << "!\n";
+            throw DisplayConfigurationParseException(
+                "Couldn't open external " + std::string(distortionTypeName) +
+                " file.");
+            /// @todo should we just return a null value here, instead of
+            /// crashing the app?
+            // return Json::Value(Json::nullValue);
+        }
+        if (!reader.parse(fs, externalData, false)) {
+            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
+                         "parse external "
+                      << distortionTypeName << " file " << fn << "!\n";
+            std::cerr << "Errors: " << reader.getFormattedErrorMessages();
+            throw DisplayConfigurationParseException(
+                "Couldn't parse external " + std::string(distortionTypeName) +
+                " file.");
+            /// @todo should we just return a null value here, instead of
+            /// crashing the app?
+            // return Json::Value(Json::nullValue);
+        }
+        return externalData["display"]["hmd"]["distortion"];
+    }
+    return Json::Value(Json::nullValue);
 }

 inline void parseDistortionMonoPointMeshes(
@@ -93,31 +133,11 @@
     // See if we have the name of an external file to parse.  If so, we open it
     // and grab its values to parse, replacing the ones that they sent
     // in.
-    const Json::Value externalFile =
-        distortion["mono_point_samples_external_file"];
-    if ((!externalFile.isNull()) && (externalFile.isString())) {
-        // Read a Json value from the external file, then replace the distortion
-        // mesh with that from the file.
-        Json::Value externalData;
-        std::ifstream fs;
-        fs.open(externalFile.asString().c_str(), std::fstream::in);
-        if (!fs.is_open()) {
-            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
-                         "open file "
-                      << externalFile.asString() << "!\n";
-            throw DisplayConfigurationParseException(
-                "Couldn't open external mono point file.");
-        }
-        if (!reader.parse(fs, externalData)) {
-            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
-                         "parse file "
-                      << externalFile.asString() << "!\n";
-            std::cerr << "Errors: " << reader.getFormattedErrorMessages();
-            throw DisplayConfigurationParseException(
-                "Couldn't parse external mono point file.");
-        }
-        myDistortion = externalData["display"]["hmd"]["distortion"];
-        fs.close();
+    Json::Value externalDistortion = getExternalDistortionFile(
+        "mono point", reader, distortion, "mono_point_samples_external_file");
+    if (!externalDistortion.isNull()) {
+        /// Successfully loaded external distortion
+        myDistortion = externalDistortion;
     }

     const Json::Value eyeArray = myDistortion["mono_point_samples"];
@@ -174,31 +194,11 @@
     // See if we have the name of an external file to parse.  If so, we open it
     // and grab its values to parse.  Otherwise, we parse the ones that they
     // sent in.
-    const Json::Value externalFile =
-        distortion["rgb_point_samples_external_file"];
-    if ((!externalFile.isNull()) && (externalFile.isString())) {
-        // Read a Json value from the external file, then replace the distortion
-        // mesh with that from the file.
-        Json::Value externalData;
-        std::ifstream fs;
-        fs.open(externalFile.asString().c_str(), std::fstream::in);
-        if (!fs.is_open()) {
-            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
-                         "open file "
-                      << externalFile.asString() << "!\n";
-            throw DisplayConfigurationParseException(
-                "Couldn't open external rgb point file.");
-        }
-        if (!reader.parse(fs, externalData)) {
-            std::cerr << "OSVRDisplayConfiguration::parse(): ERROR: Couldn't "
-                         "parse file "
-                      << externalFile.asString() << "!\n";
-            std::cerr << "Errors: " << reader.getFormattedErrorMessages();
-            throw DisplayConfigurationParseException(
-                "Couldn't parse external rgb point file.");
-        }
-        myDistortion = externalData["display"]["hmd"]["distortion"];
-        fs.close();
+    Json::Value externalDistortion =
+        getExternalDistortionFile("RGB point samples", reader, distortion,
+                                  "rgb_point_samples_external_file");
+    if (!externalDistortion.isNull()) {
+        myDistortion = externalDistortion;
     }

     std::array<std::string, 3> names = {


Pointer initialized

Pointer initialized


- убрал лишнее

 - убрал лишнее

git-svn-id: 41bd7e47c31e4d43f97241d7529f6785d233c6d8@4288 23f926e6-80f1-49ca-85a0-60d4a27bb3ac

--- rdo/rdo_studio/branches/dev_triangular/123.cpp
+++ rdo/rdo_studio/branches/dev_triangular/123.cpp
@@ -36,18 +36,13 @@
 	{
 		double result;
 		double u01 = generate01();
-		double h = 2/(m_max-m_min);
-		double a1 = h/(m_mean-m_min);
-		double b1 = h;
-		double a2 = -h/(m_max-m_mean);
-		double b2 = h;
 		if ( u01 >= (m_mean-m_min)/(m_max-m_min))
 		{
-			result = -(m_max-m_mean)*(sqrt(generate01()) - 1);
+			result = -(m_max-m_mean)*(sqrt(u01) - 1);
 		}
 		else
 		{
-			result = (m_mean-m_min)*(sqrt(generate01()) - 1);
+			result = (m_mean-m_min)*(sqrt(u01) - 1);
 		}
 		return result + m_mean;
 	}
@@ -61,7 +56,7 @@

 void main()
 {
-	Triang				triang			(4, 0, 5, 2345236);
+	Triang				triang			(3, 0, 5, 2345236);

 	double step = 0.1;
 	typedef std::map<int, ruint> Histogram;


Removing old autosizing FIXME

Removing old autosizing FIXME

TBR=pdr@chromium.org
BUG=256657

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

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@190450 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/core/frame/FrameView.cpp
+++ Source/core/frame/FrameView.cpp
@@ -858,7 +858,6 @@

     forceLayoutParentViewIfNeeded();

-    // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
     rootForThisLayout->layout();
     gatherDebugLayoutRects(rootForThisLayout);


Fixed bug when building without any webserver

--- src/iotsaWebServer.cpp
+++ src/iotsaWebServer.cpp
@@ -34,11 +34,11 @@
 #endif // defined(IOTSA_WITH_HTTPS) && defined(IOTSA_WITH_HTTP)

 IotsaWebServerMixin::IotsaWebServerMixin(IotsaApplication* _app)
+#ifdef IOTSA_WITH_HTTP_OR_HTTPS
 :
-#ifdef IOTSA_WITH_HTTP_OR_HTTPS
-    server(new IotsaWebServer(IOTSA_WEBSERVER_PORT)),
+  server(new IotsaWebServer(IOTSA_WEBSERVER_PORT)),
+  app(_app)
 #endif
-  app(_app)
 {
 }


[Genome]: Tweaked Genome to use vectors

[Genome]: Tweaked Genome to use vectors

--- include/core/Genome.hpp
+++ include/core/Genome.hpp
@@ -1,27 +1,22 @@
 #pragma once
-#include "GeneNode.hpp"
-
-/*
-* This simple class encapsulates all of an Individual's genetic information,
-* including the gene pools it uses, with the goal of easing the sharing of
-* this information between classes.
-*/
+#include "Locus.hpp"
+#include <vector>

 class Genome {
 	private:

 	protected:
-	int * gene;
-	int genomeLength;
-	GeneNode ** genePools;
+	std::vector<int> genes;
+	std::vector<Locus*> loci;

 	public:
-	Genome(int * newGene, int newGenomeLength, GeneNode ** newGeneNodes);
+	Genome(std::vector<Locus*> loci);
+	Genome(std::vector<int> genes, std::vector<Locus*> loci);

 	~Genome();

-	int * getGenome();
+	std::vector<int> getGenome();
 	int getGenomeLength();
-	GeneNode ** getGeneNodes();
+	std::vector<Locus*> getLoci();
 	int getDifference(Genome * otherGenome);
 };


Fixed the use of a wrong tangent

Fixed the use of a wrong tangent

--- plugin/hdCycles/mesh.cpp
+++ plugin/hdCycles/mesh.cpp
@@ -222,7 +222,7 @@

                 for (size_t i = 0; i < m_cyclesMesh->triangles.size(); ++i) {
                     auto vertex_index = m_cyclesMesh->triangles[i];
-                    tangent_data[i] = ccl::normalize(m_limit_vs[vertex_index]);
+                    tangent_data[i] = ccl::normalize(m_limit_us[vertex_index]);
                 }
             }


Cast bsize as int to print a meaninful debug info

cout helpfully decides to print the bsize value as non-printable char
otherwise.

Change-Id: Id91b52d6475ae9f869365468d1d56d94b2e10ecb


Default for fRadiation is 3.

Default for fRadiation is 3.

--- EVGEN/AliGenHijing.cxx
+++ EVGEN/AliGenHijing.cxx
@@ -15,6 +15,9 @@

 /*
 $Log$
+Revision 1.44  2002/10/14 14:55:35  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
 Revision 1.42.4.1  2002/08/28 15:06:50  alibrary
 Updating to v3-09-01

@@ -222,7 +225,7 @@
     fDsigmaDb   =  0;
     fDnDb       =  0;
     fPtMinJet   = -2.5;
-    fRadiation  =  1;
+    fRadiation  =  3;
     fEventVertex.Set(3);
 //
     SetSimpleJets();
@@ -310,8 +313,6 @@
 //
     if (fEvaluate) EvaluateCrossSections();
 //
-//
-//  Initialize random generator
 }

 void AliGenHijing::Generate()


specify type

specify type


fix: correct null pointer checks in autoresizing browser views (#25951)

* Correction null pointer checks

* fix: correct null pointer checks in autoresizing browser views

Co-authored-by: mlaurencin <55c17038310e060971f89ff8e09948880e3859a8@microsoft.com>

--- shell/browser/native_browser_view_views.cc
+++ shell/browser/native_browser_view_views.cc
@@ -27,7 +27,7 @@
   if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeHorizontal) &&
       !auto_horizontal_proportion_set_) {
     auto* iwc_view = GetInspectableWebContentsView();
-    if (iwc_view)
+    if (!iwc_view)
       return;
     auto* view = iwc_view->GetView();
     auto view_bounds = view->bounds();
@@ -41,7 +41,7 @@
   if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeVertical) &&
       !auto_vertical_proportion_set_) {
     auto* iwc_view = GetInspectableWebContentsView();
-    if (iwc_view)
+    if (!iwc_view)
       return;
     auto* view = iwc_view->GetView();
     auto view_bounds = view->bounds();
@@ -58,7 +58,7 @@
                                         int width_delta,
                                         int height_delta) {
   auto* iwc_view = GetInspectableWebContentsView();
-  if (iwc_view)
+  if (!iwc_view)
     return;
   auto* view = iwc_view->GetView();
   const auto flags = GetAutoResizeFlags();


Coverity fix.

Coverity fix.

--- THerwig/THerwig6.cxx
+++ THerwig/THerwig6.cxx
@@ -251,7 +251,7 @@
       printf("WARNING! In THerwig6:Initialize():\n");
       printf(" specified beam=%s is unrecognized .\n",beam);
       printf(" resetting to \"P\" .");
-      sprintf(cbeam,"P");
+      snprintf(cbeam, 8, "P");
    }

    if ( (!strncmp(target, "E+"    ,2)) &&
@@ -274,7 +274,7 @@
       printf("WARNING! In THerwig6:Initialize():\n");
       printf(" specified target=%s is unrecognized .\n",target);
       printf(" resetting to \"P\" .");
-      sprintf(ctarget,"P");
+      snprintf(ctarget, 8, "P");
    }

    // initialization:


Strip constness of a functor in the analysis to allow for non-const wrapped functors.

--- include/d2/analysis.hpp
+++ include/d2/analysis.hpp
@@ -65,9 +65,11 @@
      *
      * @note The conditions are those that make a cycle a potential deadlock
      *       in the lock graph.
+     * @internal This must not be const in order to allow non-const functors
+     *           to be called.
      */
     template <typename EdgePath>
-    void cycle(EdgePath const& edge_path, LockGraph const& graph) const {
+    void cycle(EdgePath const& edge_path, LockGraph const& graph) {
         // These are the conditions for a cycle to be a valid
         // potential deadlock:


Add VAD configuration options to audioproc.

Review URL: https://webrtc-codereview.appspot.com/855014

git-svn-id: 9b397c5dfe384c04b1b200d5305b653241000171@2923 4adac7df-926f-26a2-2b94-8c16560cd09d

--- modules/audio_processing/test/process_test.cc
+++ modules/audio_processing/test/process_test.cc
@@ -35,6 +35,7 @@
 using webrtc::scoped_array;
 using webrtc::TickInterval;
 using webrtc::TickTime;
+using webrtc::VoiceDetection;

 using webrtc::audioproc::Event;
 using webrtc::audioproc::Init;
@@ -346,6 +347,30 @@
     } else if (strcmp(argv[i], "-vad") == 0) {
       ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));

+    } else if (strcmp(argv[i], "--vad_very_low") == 0) {
+      ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
+      ASSERT_EQ(apm->kNoError,
+          apm->voice_detection()->set_likelihood(
+              VoiceDetection::kVeryLowLikelihood));
+
+    } else if (strcmp(argv[i], "--vad_low") == 0) {
+      ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
+      ASSERT_EQ(apm->kNoError,
+          apm->voice_detection()->set_likelihood(
+              VoiceDetection::kLowLikelihood));
+
+    } else if (strcmp(argv[i], "--vad_moderate") == 0) {
+      ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
+      ASSERT_EQ(apm->kNoError,
+          apm->voice_detection()->set_likelihood(
+              VoiceDetection::kModerateLikelihood));
+
+    } else if (strcmp(argv[i], "--vad_high") == 0) {
+      ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
+      ASSERT_EQ(apm->kNoError,
+          apm->voice_detection()->set_likelihood(
+              VoiceDetection::kHighLikelihood));
+
     } else if (strcmp(argv[i], "--vad_out_file") == 0) {
       i++;
       ASSERT_LT(i, argc) << "Specify filename after --vad_out_file";


Base: SurfaceExtraction minor update

Base: SurfaceExtraction minor update

--- modules/base/processors/surfaceextraction.cpp
+++ modules/base/processors/surfaceextraction.cpp
@@ -32,6 +32,7 @@
 #include <inviwo/core/properties/propertysemantics.h>
 #include <modules/base/algorithm/volume/marchingtetrahedron.h>
 #include <inviwo/core/common/inviwoapplication.h>
+#include <inviwo/core/util/stdextensions.h>
 #include <numeric>

 #define TETRA 1
@@ -90,9 +91,7 @@

         switch (method_.get()) {
             case TETRA: {
-                if (result_[i].result.valid() &&
-                    result_[i].result.wait_for(std::chrono::duration<int, std::milli>(0)) ==
-                        std::future_status::ready) {
+                if (util::is_future_ready(result_[i].result)) {
                     (*meshes_)[i] = std::move(result_[i].result.get());
                     result_[i].status = 1.0f;
                     dirty_ = false;
@@ -118,7 +117,6 @@
                                         if (status < 1.0f) pb.show();
                                         else pb.hide();
                                     }, std::ref(this->getProgressBar()));
-
                                 }));

                             dispatchFront([this]() {


Use Mersenne Twister method

Use Mersenne Twister method

--- include/etl/fast_op.hpp
+++ include/etl/fast_op.hpp
@@ -16,6 +16,8 @@

 namespace etl {

+using random_engine = std::mt19937_64;
+
 template<typename T>
 struct scalar {
     const T value;
@@ -313,7 +315,7 @@
 template<typename T>
 struct bernoulli_unary_op {
     static T apply(const T& x){
-        static std::default_random_engine rand_engine(std::time(nullptr));
+        static random_engine rand_engine(std::time(nullptr));
         static std::uniform_real_distribution<double> normal_distribution(0.0, 1.0);
         static auto normal_generator = std::bind(normal_distribution, rand_engine);

@@ -324,7 +326,7 @@
 template<typename T>
 struct uniform_noise_unary_op {
     static T apply(const T& x){
-        static std::default_random_engine rand_engine(std::time(nullptr));
+        static random_engine rand_engine(std::time(nullptr));
         static std::uniform_real_distribution<double> real_distribution(0.0, 1.0);
         static auto noise = std::bind(real_distribution, rand_engine);

@@ -335,7 +337,7 @@
 template<typename T>
 struct normal_noise_unary_op {
     static T apply(const T& x){
-        static std::default_random_engine rand_engine(std::time(nullptr));
+        static random_engine rand_engine(std::time(nullptr));
         static std::normal_distribution<double> normal_distribution(0.0, 1.0);
         static auto noise = std::bind(normal_distribution, rand_engine);

@@ -346,7 +348,7 @@
 template<typename T>
 struct logistic_noise_unary_op {
     static T apply(const T& x){
-        static std::default_random_engine rand_engine(std::time(nullptr));
+        static random_engine rand_engine(std::time(nullptr));

         std::normal_distribution<double> noise_distribution(0.0, logistic_sigmoid(x));
         auto noise = std::bind(noise_distribution, rand_engine);
@@ -358,7 +360,7 @@
 template<typename T, typename E>
 struct ranged_noise_binary_op {
     static T apply(const T& x, E value){
-        static std::default_random_engine rand_engine(std::time(nullptr));
+        static random_engine rand_engine(std::time(nullptr));
         static std::normal_distribution<double> normal_distribution(0.0, 1.0);
         static auto noise = std::bind(normal_distribution, rand_engine);


security: fix security report problem.

security: fix security report problem.

--- modules/common/monitor/monitor_buffer_test.cc
+++ modules/common/monitor/monitor_buffer_test.cc
@@ -113,9 +113,9 @@
   buffer_->INFO() << 3 << "pieces";
   EXPECT_EQ(MonitorMessageItem::INFO, buffer_->level_);
   ASSERT_EQ(2, buffer_->monitor_msg_items_.size());
-  item = buffer_->monitor_msg_items_.back();
-  EXPECT_EQ(MonitorMessageItem::INFO, item.first);
-  EXPECT_EQ("3pieces", item.second);
+  auto item2 = buffer_->monitor_msg_items_.back();
+  EXPECT_EQ(MonitorMessageItem::INFO, item2.first);
+  EXPECT_EQ("3pieces", item2.second);

   const char *fake_input = nullptr;
   EXPECT_TRUE(&(buffer_->INFO() << fake_input) == buffer_);


release: OpenCV 4.4.0

release: OpenCV 4.4.0

--- modules/core/include/opencv2/core/version.hpp
+++ modules/core/include/opencv2/core/version.hpp
@@ -8,7 +8,7 @@
 #define CV_VERSION_MAJOR    4
 #define CV_VERSION_MINOR    4
 #define CV_VERSION_REVISION 0
-#define CV_VERSION_STATUS   "-pre"
+#define CV_VERSION_STATUS   ""

 #define CVAUX_STR_EXP(__A)  #__A
 #define CVAUX_STR(__A)      CVAUX_STR_EXP(__A)


Remove obsolete ifdef in login browsertests.

BUG=none
TEST=LoginUserTest.UserPassed, LoginProfileTest.UserNotPassed will pass on aura

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@111775 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/chromeos/login/login_browsertest.cc
+++ chrome/browser/chromeos/login/login_browsertest.cc
@@ -52,15 +52,12 @@
  protected:
   virtual void SetUpInProcessBrowserTestFixture() {
     LoginTestBase::SetUpInProcessBrowserTestFixture();
-    // TODO(nkostylev): Remove this once Aura build includes ScreenLocker.
-#if !defined(USE_AURA)
     EXPECT_CALL(*mock_screen_lock_library_, AddObserver(_))
        .Times(AtLeast(1))
        .WillRepeatedly(Return());
     EXPECT_CALL(*mock_screen_lock_library_, RemoveObserver(_))
        .Times(AtLeast(1))
        .WillRepeatedly(Return());
-#endif
   }

   virtual void SetUpCommandLine(CommandLine* command_line) {


Log in stub user only if not showing login screen.
On running ChromeOS_Chrome on Linux, we log in a stub user; this is however only necessary if we aren't doing a command line login or showing the login screen to the user. On arbitarily logging in the stub user, Chrome thinks that a user is logged in even if the login screen is showing, causing all sorts of issues.

R=nkostylev@chromium.org,pastarmovj@chromium.org
BUG=None
TEST=Tested on Linux with a regular login using the login manager, a stub-login (default when not using the login manager) and a kiosk-mode login.

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@128251 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/chromeos/login/user_manager_impl.cc
+++ chrome/browser/chromeos/login/user_manager_impl.cc
@@ -292,9 +292,15 @@
       observed_sync_service_(NULL),
       last_image_set_async_(false),
       downloaded_profile_image_data_url_(chrome::kAboutBlankURL) {
-  // Use stub as the logged-in user for test paths without login.
-  if (!base::chromeos::IsRunningOnChromeOS())
+  // If we're not running on ChromeOS, and are not showing the login manager
+  // or attempting a command line login? Then login the stub user.
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  if (!base::chromeos::IsRunningOnChromeOS() &&
+      !command_line->HasSwitch(switches::kLoginManager) &&
+      !command_line->HasSwitch(switches::kLoginPassword)) {
     StubUserLoggedIn();
+  }
+
   registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED,
       content::NotificationService::AllSources());
   registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED,


INTEGRATION: CWS warnings01 (1.7.42); FILE MERGED 2005/09/22 15:38:58 sb 1.7.42.2: RESYNC: (1.7-1.8); FILE MERGED 2005/09/07 11:05:30 sb 1.7.42.1: #i53898# Made code warning-free.

--- cppuhelper/source/macro_expander.cxx
+++ cppuhelper/source/macro_expander.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: macro_expander.cxx,v $
  *
- *  $Revision: 1.8 $
- *
- *  last change: $Author: rt $ $Date: 2005-09-08 09:27:49 $
+ *  $Revision: 1.9 $
+ *
+ *  last change: $Author: hr $ $Date: 2006-06-19 10:34:22 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -124,20 +124,20 @@
 //__________________________________________________________________________________________________
 void Bootstrap_MacroExpander::disposing()
 {
-    if (m_bstrap)
-    {
-        rtl_bootstrap_args_close( m_bstrap );
+    rtlBootstrapHandle h;
+    {
+        osl::MutexGuard g(m_mutex);
+        h = m_bstrap;
         m_bstrap = 0;
     }
+    if (h) {
+        rtl_bootstrap_args_close(h);
+    }
 }
 //__________________________________________________________________________________________________
 Bootstrap_MacroExpander::~Bootstrap_MacroExpander() SAL_THROW( () )
 {
-    if (m_bstrap)
-    {
-        rtl_bootstrap_args_close( m_bstrap );
-        m_bstrap = 0;
-    }
+    disposing();
 }

 // XServiceInfo impl
@@ -199,35 +199,18 @@
 OUString Bootstrap_MacroExpander::expandMacros( OUString const & exp )
     throw (lang::IllegalArgumentException)
 {
-    // determine bootstrap handle
-    rtlBootstrapHandle bstrap;
-    if (m_rc_path.getLength())
-    {
-        // late init
-        if (! m_bstrap)
-        {
-            rtlBootstrapHandle bstrap = rtl_bootstrap_args_open( m_rc_path.pData );
-            ClearableMutexGuard guard( Mutex::getGlobalMutex() );
-            if (m_bstrap)
-            {
-                guard.clear();
-                rtl_bootstrap_args_close( bstrap );
-            }
-            else
-            {
-                m_bstrap = bstrap;
-            }
+    rtlBootstrapHandle h;
+    if (m_rc_path.getLength() != 0) {
+        osl::MutexGuard g(m_mutex);
+        if (!m_bstrap) {
+            m_bstrap = rtl_bootstrap_args_open(m_rc_path.pData);
         }
-        bstrap = m_bstrap;
-    }
-    else
-    {
-        bstrap = ::cppu::get_unorc().getHandle();
-    }
-
-    // expand
+        h = m_bstrap;
+    } else {
+        h = cppu::get_unorc().getHandle();
+    }
     OUString ret( exp );
-    rtl_bootstrap_expandMacros_from_handle( bstrap, &ret.pData );
+    rtl_bootstrap_expandMacros_from_handle( h, &ret.pData );
     return ret;
 }


Add some more logging. Still trying to figure out flakey test.

TBR=mpcomplete

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@20126 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/extensions/extension_browsertest.cc
+++ chrome/browser/extensions/extension_browsertest.cc
@@ -9,6 +9,7 @@
 #include "chrome/browser/profile.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/chrome_paths.h"
+#include "chrome/common/extensions/extension_error_reporter.h"
 #include "chrome/common/notification_registrar.h"
 #include "chrome/common/notification_service.h"
 #include "chrome/common/notification_type.h"
@@ -69,11 +70,21 @@
                     NotificationService::AllSources());
   size_t num_after = service->extensions()->size();
   if (num_after != (num_before + 1)) {
-    std::cout << "Num extensions before: " << IntToString(num_before)
-              << "num after: " << IntToString(num_after)
-              << "Installed extensions are:\n";
+    std::cout << "Num extensions before: " << IntToString(num_before) << " "
+              << "num after: " << IntToString(num_after) << " "
+              << "Installed extensions follow:\n";
+
     for (size_t i = 0; i < service->extensions()->size(); ++i)
       std::cout << "  " << service->extensions()->at(i)->id() << "\n";
+
+    std::cout << "Errors follow:\n";
+    const std::vector<std::string>* errors =
+        ExtensionErrorReporter::GetInstance()->GetErrors();
+    for (std::vector<std::string>::const_iterator iter = errors->begin();
+         iter != errors->end(); ++iter) {
+      std::cout << *iter << "\n";
+    }
+
     return false;
   }

@@ -115,9 +126,15 @@
                      const NotificationDetails& details) {
   switch (type.value) {
     case NotificationType::EXTENSION_INSTALLED:
-    case NotificationType::EXTENSIONS_LOADED:
+      std::cout << "Got EXTENSION_INSTALLED notification.\n";
       MessageLoopForUI::current()->Quit();
       break;
+
+    case NotificationType::EXTENSIONS_LOADED:
+      std::cout << "Got EXTENSION_LOADED notification.\n";
+      MessageLoopForUI::current()->Quit();
+      break;
+
     default:
       NOTREACHED();
       break;


cppcheck: Iterator i used after element has been erased

Change-Id: Id8eb6a475dafcaddc98ddc48627fa8090e91cf4f

--- cppuhelper/source/servicemanager.cxx
+++ cppuhelper/source/servicemanager.cxx
@@ -1567,6 +1567,9 @@
         }
         assert(i->second.get() != 0);
         clear = i->second;
+        if (removeListener) {
+            comp = i->second->component;
+        }
         //TODO: The below leaves data_ in an inconsistent state upon exceptions:
         removeFromImplementationMap(
             &data_.services, i->second->info->services, i->second);
@@ -1576,9 +1579,6 @@
             data_.namedImplementations.erase(i->second->info->name);
         }
         data_.dynamicImplementations.erase(i);
-        if (removeListener) {
-            comp = i->second->component;
-        }
     }
     if (comp.is()) {
         removeEventListenerFromComponent(comp);


Have extension call windows.getLastFocused include incognito windows if the
extension is enabled for incognito.

BUG=39113

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@46076 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/extensions/extension_tabs_module.cc
+++ chrome/browser/extensions/extension_tabs_module.cc
@@ -263,7 +263,8 @@
 }

 bool GetLastFocusedWindowFunction::RunImpl() {
-  Browser* browser = BrowserList::GetLastActiveWithProfile(profile());
+  Browser* browser = BrowserList::FindBrowserWithType(
+      profile(), Browser::TYPE_ANY, include_incognito());
   if (!browser) {
     error_ = keys::kNoLastFocusedWindowError;
     return false;


Removed sdlimage.hpp added sdlimageloader.hpp

--- include/guichan/sdl.hpp
+++ include/guichan/sdl.hpp
@@ -2,7 +2,7 @@
 #define GCN_SDL_HPP

 #include <guichan/sdl/sdlgraphics.hpp>
-#include <guichan/sdl/sdlimage.hpp>
+#include <guichan/sdl/sdlimageloader.hpp>
 #include <guichan/sdl/sdlinput.hpp>

 #endif // end GCN_SDL_HPP


fixed missing reference on return type

fixed missing reference on return type

--- src/items/ItemBase.hpp
+++ src/items/ItemBase.hpp
@@ -77,7 +77,7 @@
         * Returns the unique identifier of the item
         *
         */
-        const boost::uuids::uuid getID() const { return this->uuid; }
+        const boost::uuids::uuid& getID() const { return this->uuid; }
         const std::string getIDString() const { return boost::uuids::to_string(this->uuid); }

         /**@brief setFrame


Fix some issues with bookmark bar folder menu.

Without this patch, you have to click repeatedly on a folder to get the context menu to pop up, because the first few clicks dismiss whatever submenus you may have open. This patch fixes that.

There is another problem present with and without this patch where a bookmark bar folder menu that has shown a context menu will not regain the application/X grabs. This makes it possible to use the rest of the browser while the menu is showing, and clicking away from the menu won't dismiss the menu. In the interests of keeping this patch easy to review I will look into that issue separately.

BUG=18275

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@22743 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


Ensure EXDOS card is completely disabled if no FDC is present.

--- Machines/Enterprise/Enterprise.cpp
+++ Machines/Enterprise/Enterprise.cpp
@@ -329,11 +329,19 @@

 						case 0x10:	case 0x11:	case 0x12:	case 0x13:
 						case 0x14:	case 0x15:	case 0x16:	case 0x17:
-							*cycle.value = exdos_.read(address);
+							if constexpr (has_disk_controller) {
+								*cycle.value = exdos_.read(address);
+							} else {
+								*cycle.value = 0xff;
+							}
 						break;
 						case 0x18:	case 0x19:	case 0x1a:	case 0x1b:
 						case 0x1c:	case 0x1d:	case 0x1e:	case 0x1f:
-							*cycle.value = exdos_.get_control_register();
+							if constexpr (has_disk_controller) {
+								*cycle.value = exdos_.get_control_register();
+							} else {
+								*cycle.value = 0xff;
+							}
 						break;

 						case 0xb0:	*cycle.value = pages_[0];	break;
@@ -367,11 +375,15 @@

 						case 0x10:	case 0x11:	case 0x12:	case 0x13:
 						case 0x14:	case 0x15:	case 0x16:	case 0x17:
-							exdos_.write(address, *cycle.value);
+							if constexpr(has_disk_controller) {
+								exdos_.write(address, *cycle.value);
+							}
 						break;
 						case 0x18:	case 0x19:	case 0x1a:	case 0x1b:
 						case 0x1c:	case 0x1d:	case 0x1e:	case 0x1f:
-							 exdos_.set_control_register(*cycle.value);
+							if constexpr(has_disk_controller) {
+								exdos_.set_control_register(*cycle.value);
+							}
 						break;

 						case 0x80:	case 0x81:	case 0x82:	case 0x83:


Revised guess; there's a jump to C02E almost immediately.

--- Machines/Enterprise/Enterprise.cpp
+++ Machines/Enterprise/Enterprise.cpp
@@ -28,17 +28,21 @@
 			// Request a clock of 4Mhz; this'll be mapped upwards for Nick and Dave elsewhere.
 			set_clock_rate(4'000'000);

-			const auto request = ROM::Request(ROM::Name::EnterpriseEXOS);
+			constexpr ROM::Name exos_name = ROM::Name::EnterpriseEXOS;
+			const auto request = ROM::Request(exos_name);
 			auto roms = rom_fetcher(request);
 			if(!request.validate(roms)) {
 				throw ROMMachine::Error::MissingROMs;
 			}

+			const auto &exos = roms.find(exos_name)->second;
+			memcpy(exos_.data(), exos.data(), std::min(exos_.size(), exos.size()));
+
 			// Take a reasonable guess at the initial memory configuration.
 			page<0>(0x00);
-			page<1>(0x01);
-			page<2>(0xfe);
-			page<3>(0xff);
+			page<1>(0x00);
+			page<2>(0x00);
+			page<3>(0x00);
 		}

 		// MARK: - Z80::BusHandler.
@@ -52,7 +56,12 @@
 				default: break;

 				case CPU::Z80::PartialMachineCycle::Input:
+					printf("Unhandled input: %04x\n", address);
+					assert(false);
+				break;
+
 				case CPU::Z80::PartialMachineCycle::Output:
+					printf("Unhandled output: %04x\n", address);
 					assert(false);
 				break;


BUG: in logic for timeseriestomatrix

BUG: in logic for timeseriestomatrix

--- Examples/ImageMath.cxx
+++ Examples/ImageMath.cxx
@@ -3403,7 +3403,7 @@
   int               argct = 2;
   const std::string outname = std::string(argv[argct]); argct++;
   std::string       ext = itksys::SystemTools::GetFilenameExtension( outname );
-  if( ( strcmp(ext.c_str(), ".csv") != 0 ) || (  strcmp(ext.c_str(), ".mha") != 0 )  )
+  if( ( strcmp(ext.c_str(), ".csv") != 0 ) && (  strcmp(ext.c_str(), ".mha") != 0 )  )
     {
     std::cout << " must use .csv or .mha as output file extension " << std::endl;
     return EXIT_FAILURE;


This fixes an InvalidRead error that valgrind found.

TEST=ran valgrind on chromeos version of chrome.
BUG=none
Review URL: http://codereview.chromium.org/1807006

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@45867 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/tab_contents/thumbnail_generator.cc
+++ chrome/browser/tab_contents/thumbnail_generator.cc
@@ -393,7 +393,10 @@
   RenderWidgetHost* renderer = contents->render_view_host();
   while (iterator != callback_map_.end()) {
     if (iterator->second->renderer == renderer) {
-      callback_map_.erase(iterator);
+      ThumbnailCallbackMap::iterator nuked = iterator;
+      ++iterator;
+      callback_map_.erase(nuked);
+      continue;
     }
     ++iterator;
   }


RTF_FCHARSET: fix typo

RTF_FCHARSET: fix typo

--- writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -547,7 +547,7 @@
                 if (i == nRTFEncodings)
                     // not found
                     return 0;
-                m_aFontEncodings[m_aStates.top().nCurrentFontIndex] = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].charset);
+                m_aFontEncodings[m_aStates.top().nCurrentFontIndex] = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
             }
             break;
         case RTF_CF:


BUG: small bug in last commit -- allocation line was out of place for cimage.

--- Examples/ImageMath.cxx
+++ Examples/ImageMath.cxx
@@ -2354,8 +2354,8 @@
       typename TensorImageType::Pointer cimage = TensorImageType::New();
       cimage->SetLargestPossibleRegion( tensorregion );
       cimage->SetBufferedRegion( tensorregion );
+      cimage->SetLargestPossibleRegion( tensorregion );
       cimage->Allocate();
-      cimage->SetLargestPossibleRegion( tensorregion );
       cimage->SetSpacing(spacing);
       cimage->SetOrigin(origin);
       cimage->SetDirection(direction);


implement RTF_HIGHLIGHT

implement RTF_HIGHLIGHT

Change-Id: I9d695f9b544250017bea69167e3133c4e9ee37a4

--- writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2392,6 +2392,12 @@
                 m_aStates.top().aCharacterSprms.set(0x6877, pValue);
             }
             break;
+        case RTF_HIGHLIGHT:
+            {
+                RTFValue::Pointer_t pValue(new RTFValue(nParam));
+                m_aStates.top().aCharacterSprms.set(NS_sprm::LN_CHighlight, pValue);
+            }
+            break;
         case RTF_UP:
         case RTF_DN:
             {


Constructor fix.

Constructor fix.

--- include/mos/gfx/box.hpp
+++ include/mos/gfx/box.hpp
@@ -8,7 +8,7 @@
 /** Visual bounding box. */
 class Box final {
 public:
-  Box() = default;
+  Box();
   Box(const glm::mat4 &transform,
       const glm::vec3 &extent);
   glm::mat4 transform;


Fixes data race in WebRTCAudioDeviceTest.Construct reported by ThreadSanitizer

BUG=159112

Review URL: https://webrtc-codereview.appspot.com/1201007

Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 4ff956f428a651da64279b138a2aa5f98cba505e

--- modules/utility/source/process_thread_impl.cc
+++ modules/utility/source/process_thread_impl.cc
@@ -164,6 +164,7 @@
         {
             return true;
         }
+        CriticalSectionScoped lock(_critSectModules);
         if(!_thread)
         {
             return false;


INTEGRATION: CWS vcl21 (1.45.10); FILE MERGED 2004/03/25 17:54:43 pl 1.45.10.4: #i23601# merge from CWS vclpp3bugs 2004/03/23 13:14:40 pl 1.45.10.3: solver merge conflict 2004/03/23 10:45:37 pl 1.45.10.2: RESYNC: (1.45-1.47); FILE MERGED 2004/03/18 13:44:00 pl 1.45.10.1: #i23601# #i24286# #i26147# join from CWS vclpp3bugs

--- psprint/source/fontmanager/fontmanager.cxx
+++ psprint/source/fontmanager/fontmanager.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: fontmanager.cxx,v $
  *
- *  $Revision: 1.47 $
+ *  $Revision: 1.48 $
  *
- *  last change: $Author: obo $ $Date: 2004-03-17 10:49:06 $
+ *  last change: $Author: kz $ $Date: 2004-05-18 10:45:28 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -249,6 +249,137 @@
 }

 // -------------------------------------------------------------------------
+bool PrintFontManager::XLFDEntry::operator<(const PrintFontManager::XLFDEntry& rRight) const
+{
+    sal_Int32 nCmp = 0;
+    if( (nMask & MaskFamily) && (rRight.nMask & MaskFamily) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aFamily.pData->buffer,
+                                                           aFamily.pData->length,
+                                                           rRight.aFamily.pData->buffer,
+                                                           rRight.aFamily.pData->length );
+        if( nCmp != 0 )
+            return nCmp < 0;
+    }
+
+    if( (nMask & MaskFoundry) && (rRight.nMask & MaskFoundry) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aFoundry.pData->buffer,
+                                                           aFoundry.pData->length,
+                                                           rRight.aFoundry.pData->buffer,
+                                                           rRight.aFoundry.pData->length );
+        if( nCmp != 0 )
+            return nCmp < 0;
+    }
+
+    if( (nMask & MaskItalic) && (rRight.nMask & MaskItalic) )
+    {
+        if( eItalic != rRight.eItalic )
+            return (int)eItalic < (int)rRight.eItalic;
+    }
+
+    if( (nMask & MaskWeight) && (rRight.nMask & MaskWeight) )
+    {
+        if( eWeight != rRight.eWeight )
+            return (int)eWeight < (int)rRight.eWeight;
+    }
+
+    if( (nMask & MaskWidth) && (rRight.nMask & MaskWidth) )
+    {
+        if( eWidth != rRight.eWidth )
+            return (int)eWidth < (int)rRight.eWidth;
+    }
+
+    if( (nMask & MaskPitch) && (rRight.nMask & MaskPitch) )
+    {
+        if( ePitch != rRight.ePitch )
+            return (int)ePitch < (int)rRight.ePitch;
+    }
+
+    if( (nMask & MaskAddStyle) && (rRight.nMask & MaskAddStyle) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aAddStyle.pData->buffer,
+                                                           aAddStyle.pData->length,
+                                                           rRight.aAddStyle.pData->buffer,
+                                                           rRight.aAddStyle.pData->length );
+        if( nCmp != 0 )
+            return nCmp < 0;
+    }
+
+    if( (nMask & MaskEncoding) && (rRight.nMask & MaskEncoding) )
+    {
+        if( aEncoding != rRight.aEncoding )
+            return aEncoding < rRight.aEncoding;
+    }
+
+    return false;
+}
+
+bool PrintFontManager::XLFDEntry::operator==(const PrintFontManager::XLFDEntry& rRight) const
+{
+    sal_Int32 nCmp = 0;
+    if( (nMask & MaskFamily) && (rRight.nMask & MaskFamily) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aFamily.pData->buffer,
+                                                           aFamily.pData->length,
+                                                           rRight.aFamily.pData->buffer,
+                                                           rRight.aFamily.pData->length );
+        if( nCmp != 0 )
+            return false;
+    }
+
+    if( (nMask & MaskFoundry) && (rRight.nMask & MaskFoundry) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aFoundry.pData->buffer,
+                                                           aFoundry.pData->length,
+                                                           rRight.aFoundry.pData->buffer,
+                                                           rRight.aFoundry.pData->length );
+        if( nCmp != 0 )
+            return false;
+    }
+
+    if( (nMask & MaskItalic) && (rRight.nMask & MaskItalic) )
+    {
+        if( eItalic != rRight.eItalic )
+            return false;
+    }
+
+    if( (nMask & MaskWeight) && (rRight.nMask & MaskWeight) )
+    {
+        if( eWeight != rRight.eWeight )
+            return false;
+    }
+
+    if( (nMask & MaskWidth) && (rRight.nMask & MaskWidth) )
+    {
+        if( eWidth != rRight.eWidth )
+            return false;
+    }
+
+    if( (nMask & MaskPitch) && (rRight.nMask & MaskPitch) )
+    {
+        if( ePitch != rRight.ePitch )
+            return false;
+    }
+
+    if( (nMask & MaskAddStyle) && (rRight.nMask & MaskAddStyle) )
+    {
+        nCmp =  rtl_str_compareIgnoreAsciiCase_WithLength( aAddStyle.pData->buffer,
+                                                           aAddStyle.pData->length,
+                                                           rRight.aAddStyle.pData->buffer,
+                                                           rRight.aAddStyle.pData->length );
+        if( nCmp != 0 )
+            return false;
+    }
+
+    if( (nMask & MaskEncoding) && (rRight.nMask & MaskEncoding) )
+    {
+        if( aEncoding != rRight.aEncoding )
+            return false;
+    }
+
+    return true;
+}

 /*
  *  PrintFont implementations
@@ -1143,7 +1274,7 @@
                 pFont->m_aMetricFile    = aAfmFile;

                 if( rXLFDs.size() )
-                    getFontAttributesFromXLFD( pFont, rXLFDs.front() );
+                    getFontAttributesFromXLFD( pFont, rXLFDs );
                 else if( ! pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms ) )
                 {
                     delete pFont;
@@ -1177,8 +1308,8 @@
         pFont->m_nCollectionEntry   = -1;

         if( rXLFDs.size() )
-            getFontAttributesFromXLFD( pFont, rXLFDs.front() );
-        // need to read the font anyway to get aliases
+            getFontAttributesFromXLFD( pFont, rXLFDs );
+        // need to read the font anyway to get aliases inside the font file
         if( ! analyzeTrueTypeFile( pFont ) )
         {
             delete pFont;
@@ -1196,24 +1327,14 @@
 #if OSL_DEBUG_LEVEL > 1
             fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength );
 #endif
-            ::std::list<OString>::const_iterator xlfd_it = rXLFDs.begin();
             for( int i = 0; i < nLength; i++ )
             {
-                OString aXLFD;
-                if( xlfd_it != rXLFDs.end() )
-                {
-                    aXLFD = *xlfd_it;
-                    ++xlfd_it;
-                }
-#if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "   XLFD=\"%s\"\n", aXLFD.getStr() );
-#endif
                 TrueTypeFontFile* pFont     = new TrueTypeFontFile();
                 pFont->m_nDirectory         = nDirID;
                 pFont->m_aFontFile          = rFontFile;
                 pFont->m_nCollectionEntry   = i;
-                if( aXLFD.getLength() )
-                    getFontAttributesFromXLFD( pFont, aXLFD );
+                if( nLength == 1 )
+                    getFontAttributesFromXLFD( pFont, rXLFDs );
                 if( ! analyzeTrueTypeFile( pFont ) )
                 {
                     delete pFont;
@@ -1294,82 +1415,187 @@

 // -------------------------------------------------------------------------

-void PrintFontManager::getFontAttributesFromXLFD( PrintFont* pFont, const ByteString& rXLFD ) const
-{
-    if( rXLFD.GetTokenCount( '-' ) != 15 )
-        return;
-
-    ByteString aFamilyXLFD( WhitespaceToSpace( rXLFD.GetToken( 2, '-' ) ) );
-    int nTokens = aFamilyXLFD.GetTokenCount( ' ' );
-    ByteString aFamilyName;
-    for( int nToken = 0; nToken < nTokens; nToken++ )
-    {
-        ByteString aToken( aFamilyXLFD.GetToken( nToken, ' ' ) );
-        ByteString aNewToken( aToken.GetChar( 0 ) );
-        aNewToken.ToUpperAscii();
-        aNewToken += aToken.Copy( 1 );
-        if( nToken > 0 )
-            aFamilyName.Append( ' ' );
-        aFamilyName += aNewToken;
-    }
-
-    ByteString aAddStyle( rXLFD.GetToken( 6, '-' ) );
-    pFont->m_nFamilyName =
-        m_pAtoms->getAtom( ATOM_FAMILYNAME,
-                           String( aFamilyName, aAddStyle.Search( "utf8" ) != STRING_NOTFOUND ? RTL_TEXTENCODING_UTF8 : RTL_TEXTENCODING_ISO_8859_1 ),
-                           sal_True );
-    ByteString aToken;
-
+bool PrintFontManager::parseXLFD( const OString& rXLFD, XLFDEntry& rEntry )
+{
+    sal_Int32 nIndex = 0;
+    OString aFoundry        = WhitespaceToSpace( rXLFD.getToken( 1, '-', nIndex ) );
+    if( nIndex < 0 ) return false;
+    OString aFamilyXLFD     = WhitespaceToSpace( rXLFD.getToken( 0, '-', nIndex ) );
+    if( nIndex < 0 ) return false;
+    OString aWeight         = rXLFD.getToken( 0, '-', nIndex ).toAsciiLowerCase();
+    if( nIndex < 0 ) return false;
+    OString aSlant          = rXLFD.getToken( 0, '-', nIndex ).toAsciiLowerCase();
+    if( nIndex < 0 ) return false;
+    OString aWidth          = rXLFD.getToken( 0, '-', nIndex ).toAsciiLowerCase();
+    if( nIndex < 0 ) return false;
+    OString aAddStyle       = rXLFD.getToken( 0, '-', nIndex ).toAsciiLowerCase();
+    if( nIndex < 0 ) return false;
+    OString aPitch          = rXLFD.getToken( 4, '-', nIndex ).toAsciiLowerCase();
+    if( nIndex < 0 ) return false;
+    OString aRegEnc         = WhitespaceToSpace( rXLFD.getToken( 1, '-', nIndex ).toAsciiLowerCase() );
+    if( nIndex < 0 ) return false;
+    OString aEnc            = WhitespaceToSpace( rXLFD.getToken( 0, '-', nIndex ).toAsciiLowerCase() );
+
+    // capitalize words
+    sal_Int32 nFamIndex = 0;
+    OStringBuffer aFamilyName;
+    while( nFamIndex >= 0 )
+    {
+        OString aToken = aFamilyXLFD.getToken( 0, ' ', nFamIndex );
+        sal_Char aFirst = aToken.toChar();
+        if( aFirst >= 'a' && aFirst <= 'z' )
+            aFirst = aFirst - 'a' + 'A';
+        OStringBuffer aNewToken( aToken.getLength() );
+        aNewToken.append( aToken );
+        aNewToken.setCharAt( 0, aFirst );
+        if( aFamilyName.getLength() > 0 )
+            aFamilyName.append( ' ' );
+        aFamilyName.append( aNewToken.makeStringAndClear() );
+    }
+
+    rEntry.aFoundry     = aFoundry;
+    rEntry.aFamily      = aFamilyName.makeStringAndClear();
+    rEntry.aAddStyle    = aAddStyle;
     // evaluate weight
-    aToken = rXLFD.GetToken( 3,  '-' ).ToLowerAscii();
-    pFont->m_eWeight = parseWeight( aToken );
-
+    rEntry.eWeight = parseWeight( aWeight );
     // evaluate slant
-    aToken = rXLFD.GetToken( 4, '-' );
-    pFont->m_eItalic = parseItalic( aToken );
-
+    rEntry.eItalic = parseItalic( aSlant );
     // evaluate width
-    aToken = rXLFD.GetToken( 5,  '-' ).ToLowerAscii();
-    pFont->m_eWidth = parseWidth( aToken );
+    rEntry.eWidth = parseWidth( aWidth );

     // evaluate pitch
-    aToken = rXLFD.GetToken( 11,  '-' ).ToLowerAscii();
-    if( aToken.Equals( "c" ) || aToken.Equals( "m" ) )
-        pFont->m_ePitch = pitch::Fixed;
+    if( aPitch.toChar() == 'c' || aPitch.toChar() == 'm' )
+        rEntry.ePitch = pitch::Fixed;
     else
-        pFont->m_ePitch = pitch::Variable;
-
+        rEntry.ePitch = pitch::Variable;
+
+    OString aToken = aEnc.toAsciiLowerCase();
     // get encoding
-    aToken = rXLFD.GetToken( 6, '-' ).ToLowerAscii();
-    if( aToken.Search( "symbol" ) != STRING_NOTFOUND )
-        pFont->m_aEncoding = RTL_TEXTENCODING_SYMBOL;
+    if( aAddStyle.indexOf( "symbol" ) != -1 )
+        rEntry.aEncoding = RTL_TEXTENCODING_SYMBOL;
     else
     {
-        aToken =WhitespaceToSpace(  rXLFD.GetToken( 14 ) );
-        if( aToken.EqualsIgnoreCaseAscii( "symbol" ) )
-            pFont->m_aEncoding = RTL_TEXTENCODING_SYMBOL;
+        if( aToken.equals( "symbol" ) )
+            rEntry.aEncoding = RTL_TEXTENCODING_SYMBOL;
         else
         {
-            aToken = rXLFD.GetToken( 13, '-' );
-            aToken += '-';
-            aToken += WhitespaceToSpace( rXLFD.GetToken( 14, '-' ) );
-            pFont->m_aEncoding = rtl_getTextEncodingFromUnixCharset( aToken.GetBuffer() );
-        }
+            OStringBuffer aCharset( aRegEnc.getLength() + aEnc.getLength() + 1 );
+            aCharset.append( aRegEnc );
+            aCharset.append( '-' );
+            aCharset.append( aEnc );
+            rEntry.aEncoding = rtl_getTextEncodingFromUnixCharset( aCharset.getStr() );
+        }
+    }
+
+    // set correct mask flags
+    rEntry.nMask = 0;
+    if( rEntry.aFoundry != "*" )        rEntry.nMask |= XLFDEntry::MaskFoundry;
+    if( rEntry.aFamily != "*" )         rEntry.nMask |= XLFDEntry::MaskFamily;
+    if( rEntry.aAddStyle != "*" )       rEntry.nMask |= XLFDEntry::MaskAddStyle;
+    if( aWeight != "*" )                rEntry.nMask |= XLFDEntry::MaskWeight;
+    if( aSlant != "*" )                 rEntry.nMask |= XLFDEntry::MaskItalic;
+    if( aWidth != "*" )                 rEntry.nMask |= XLFDEntry::MaskWidth;
+    if( aPitch != "*" )                 rEntry.nMask |= XLFDEntry::MaskPitch;
+    if( aRegEnc != "*" && aEnc != "*" ) rEntry.nMask |= XLFDEntry::MaskEncoding;
+
+    return true;
+}
+
+// -------------------------------------------------------------------------
+
+void PrintFontManager::parseXLFD_appendAliases( const std::list< OString >& rXLFDs, std::list< XLFDEntry >& rEntries ) const
+{
+    for( std::list< OString >::const_iterator it = rXLFDs.begin(); it != rXLFDs.end(); ++it )
+    {
+        XLFDEntry aEntry;
+        if( ! parseXLFD(*it, aEntry) )
+            continue;
+        rEntries.push_back( aEntry );
+        std::map< XLFDEntry, std::list< XLFDEntry > >::const_iterator alias_it =
+            m_aXLFD_Aliases.find( aEntry );
+        if( alias_it != m_aXLFD_Aliases.end() )
+        {
+            rEntries.insert( rEntries.end(), alias_it->second.begin(), alias_it->second.end() );
+        }
+    }
+}
+
+// -------------------------------------------------------------------------
+
+void PrintFontManager::getFontAttributesFromXLFD( PrintFont* pFont, const std::list< OString >& rXLFDs ) const
+{
+    bool bFamilyName = false;
+
+    std::list< XLFDEntry > aXLFDs;
+
+    parseXLFD_appendAliases( rXLFDs, aXLFDs );
+
+    for( std::list< XLFDEntry >::const_iterator it = aXLFDs.begin();
+         it != aXLFDs.end(); ++it )
+    {
+        // set family name or alias
+        int nFam =
+            m_pAtoms->getAtom( ATOM_FAMILYNAME,
+                               OStringToOUString( it->aFamily, it->aAddStyle.indexOf( "utf8" ) != -1 ? RTL_TEXTENCODING_UTF8 : RTL_TEXTENCODING_ISO_8859_1 ),
+                               sal_True );
+        if( ! bFamilyName )
+        {
+            bFamilyName = true;
+            pFont->m_nFamilyName = nFam;
+            switch( pFont->m_eType )
+            {
+                case fonttype::Type1:
+                    static_cast<Type1FontFile*>(pFont)->m_aXLFD = rXLFDs.front();
+                    break;
+                case fonttype::TrueType:
+                    static_cast<TrueTypeFontFile*>(pFont)->m_aXLFD = rXLFDs.front();
+                    break;
+            }
+        }
+        else
+        {
+            // make sure that aliases are unique
+            if( nFam != pFont->m_nFamilyName )
+            {
+                std::list< int >::const_iterator al_it;
+                for( al_it = pFont->m_aAliases.begin(); al_it != pFont->m_aAliases.end() && *al_it != nFam; ++al_it )
+                    ;
+                if( al_it == pFont->m_aAliases.end() )
+                    pFont->m_aAliases.push_back( nFam );
+
+            }
+            // for the rest of the attributes there can only be one value;
+            // we'll trust the first one
+            continue;
+        }
+
+        // fill in weight
+        pFont->m_eWeight    = it->eWeight;
+        // fill in slant
+        pFont->m_eItalic    = it->eItalic;
+        // fill in width
+        pFont->m_eWidth     = it->eWidth;
+        // fill in pitch
+        pFont->m_ePitch     = it->ePitch;
+        // fill in encoding
+        pFont->m_aEncoding  = it->aEncoding;
     }

     // handle iso8859-1 as ms1252 to fill the "gap" starting at 0x80
     if( pFont->m_aEncoding == RTL_TEXTENCODING_ISO_8859_1 )
         pFont->m_aEncoding = RTL_TEXTENCODING_MS_1252;
-
-    switch( pFont->m_eType )
-    {
-        case fonttype::Type1:
-            static_cast<Type1FontFile*>(pFont)->m_aXLFD = rXLFD;
-            break;
-        case fonttype::TrueType:
-            static_cast<TrueTypeFontFile*>(pFont)->m_aXLFD = rXLFD;
-            break;
-        default: break;
+    if( rXLFDs.begin() != rXLFDs.end() )
+    {
+        switch( pFont->m_eType )
+        {
+            case fonttype::Type1:
+                static_cast<Type1FontFile*>(pFont)->m_aXLFD = rXLFDs.front();
+                break;
+            case fonttype::TrueType:
+                static_cast<TrueTypeFontFile*>(pFont)->m_aXLFD = rXLFDs.front();
+                break;
+            default: break;
+        }
     }
 }

@@ -1596,14 +1822,19 @@
                  pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, OStringToOUString( pTTFontFile->m_aFontFile.copy( 0, dotIndex ), aEncoding ), sal_True );
             }
         }
-        pFont->m_aAliases.clear();
         for( ::std::list< OUString >::iterator it = aNames.begin(); it != aNames.end(); ++it )
         {
             if( it->getLength() )
             {
                 int nAlias = m_pAtoms->getAtom( ATOM_FAMILYNAME, *it, sal_True );
                 if( nAlias != pFont->m_nFamilyName )
-                    pFont->m_aAliases.push_back( nAlias );
+                {
+                    std::list< int >::const_iterator al_it;
+                    for( al_it = pFont->m_aAliases.begin(); al_it != pFont->m_aAliases.end() && *al_it != nAlias; ++al_it )
+                        ;
+                    if( al_it == pFont->m_aAliases.end() )
+                        pFont->m_aAliases.push_back( nAlias );
+                }
             }
         }

@@ -1750,6 +1981,45 @@
         }
     }
 #endif
+}
+
+void PrintFontManager::initFontsAlias()
+{
+    m_aXLFD_Aliases.clear();
+    rtl_TextEncoding aEnc = osl_getThreadTextEncoding();
+    for( std::list< OString >::const_iterator dir_it = m_aFontDirectories.begin();
+         dir_it != m_aFontDirectories.end(); ++dir_it )
+    {
+        OStringBuffer aDirName(512);
+        aDirName.append( *dir_it );
+        aDirName.append( "/fonts.alias" );
+        SvFileStream aStream( OStringToOUString( aDirName.makeStringAndClear(), aEnc ), STREAM_READ );
+        if( ! aStream.IsOpen() )
+            continue;
+
+        do
+        {
+            ByteString aLine;
+            aStream.ReadLine( aLine );
+
+            // get the alias and the pattern it gets translated to
+            ByteString aAlias   = GetCommandLineToken( 0, aLine );
+            ByteString aMap     = GetCommandLineToken( 1, aLine );
+
+            // remove eventual quotes
+            aAlias.EraseLeadingChars( '"' );
+            aAlias.EraseTrailingChars( '"' );
+            aMap.EraseLeadingChars( '"' );
+            aMap.EraseTrailingChars( '"' );
+
+            XLFDEntry aAliasEntry, aMapEntry;
+            parseXLFD( aAlias, aAliasEntry );
+            parseXLFD( aMap, aMapEntry );
+
+            if( aAliasEntry.nMask && aMapEntry.nMask )
+                m_aXLFD_Aliases[ aMapEntry ].push_back( aAliasEntry );
+        } while( ! aStream.IsEof() );
+    }
 }

 void PrintFontManager::initialize( void* pInitDisplay )
@@ -1857,8 +2127,10 @@
         }

         // insert some standard directories
+        m_aFontDirectories.push_back( "/usr/openwin/lib/X11/fonts/TrueType" );
         m_aFontDirectories.push_back( "/usr/openwin/lib/X11/fonts/Type1" );
         m_aFontDirectories.push_back( "/usr/openwin/lib/X11/fonts/Type1/sun" );
+        m_aFontDirectories.push_back( "/usr/X11R6/lib/X11/fonts/truetype" );
         m_aFontDirectories.push_back( "/usr/X11R6/lib/X11/fonts/Type1" );

 #ifdef SOLARIS
@@ -1895,11 +2167,21 @@
 #endif /* SOLARIS */
     } // ! bFontconfigSuccess

+    // fill XLFD aliases from fonts.alias files
+    initFontsAlias();
+
     // search for font files in each path
-    ::std::list< OString >::iterator dir_it;
+    std::list< OString >::iterator dir_it;
+    // protect against duplicate paths
+    std::hash_map< OString, int, OStringHash > visited_dirs;
     for( dir_it = m_aFontDirectories.begin(); dir_it != m_aFontDirectories.end(); ++dir_it )
     {
         OString aPath( *dir_it );
+        // see if we were here already
+        if( visited_dirs.find( aPath ) != visited_dirs.end() )
+            continue;
+        visited_dirs[ aPath ] = 1;
+
         // there may be ":unscaled" directories (see XFree86)
         // it should be safe to ignore them since they should not
         // contain any of our recognizeable fonts
@@ -2767,9 +3049,6 @@
 static bool createPath( const ByteString& rPath )
 {
     bool bSuccess = false;
-#if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "createPath( %s )\n", rPath.GetBuffer() );
-#endif

     if( access( rPath.GetBuffer(), F_OK ) )
     {
@@ -2780,13 +3059,7 @@

         if( nPos != STRING_NOTFOUND && nPos != 0 && createPath( rPath.Copy( 0, nPos+1 ) ) )
         {
-#if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "mkdir ", rPath.GetBuffer() );
-#endif
             bSuccess = mkdir( rPath.GetBuffer(), 0777 ) ? false : true;
-#if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "%s\n", bSuccess ? "succeeded" : "failed" );
-#endif
         }
     }
     else
@@ -3172,7 +3445,9 @@
             aFontsDir.WriteLine( aLines.front() );
             aLines.pop_front();
         }
-        getFontAttributesFromXLFD( pFont, aXLFD );
+        std::list< OString > aDummyList;
+        aDummyList.push_back( aXLFD );
+        getFontAttributesFromXLFD( pFont, aDummyList );
         m_pFontCache->updateFontCacheEntry( pFont, true );
     }
     return bSuccess;


ENH: adding column headers to ConvertImageSetToMatrix s.t. it can be used with R and sccan more easily

--- Examples/ImageMath.cxx
+++ Examples/ImageMath.cxx
@@ -7400,6 +7400,15 @@
   return 0;
 }

+template <class T>
+inline std::string ants_to_string(const T& t)
+{
+  std::stringstream ss;
+
+  ss << t;
+  return ss.str();
+}
+
 template <unsigned int ImageDimension>
 int ConvertImageSetToMatrix(unsigned int argc, char *argv[])
 {
@@ -7480,7 +7489,8 @@
   if( strcmp(ext.c_str(), ".csv") == 0 )
     {
     typedef itk::Array2D<double> MatrixType;
-    MatrixType matrix(xsize, ysize);
+    std::vector<std::string> ColumnHeaders;
+    MatrixType               matrix(xsize, ysize);
     matrix.Fill(0);
     unsigned int imagecount = 0;
     for( unsigned int j = argct; j < argc; j++ )
@@ -7510,6 +7520,8 @@
             yy = tvoxct;
             }
           matrix[xx][yy] = image2->GetPixel(mIter.GetIndex() );
+          std::string colname = std::string("V") + ants_to_string<unsigned int>(tvoxct);
+          ColumnHeaders.push_back( colname );
           tvoxct++;
           }
         }
@@ -7521,6 +7533,7 @@
     WriterType::Pointer writer = WriterType::New();
     writer->SetFileName( outname );
     writer->SetInput( &matrix );
+    writer->SetColumnHeaders( ColumnHeaders );
     try
       {
       writer->Write();


Use 20MB blocks (MLDB-1507)

Use 20MB blocks (MLDB-1507)

--- plugins/for_each_line.cc
+++ plugins/for_each_line.cc
@@ -250,7 +250,7 @@
                       std::function<bool (int64_t blockNumber, int64_t lineNumber)> endBlock)
 {
     //static constexpr int64_t BLOCK_SIZE = 100000000;  // 100MB blocks
-    static constexpr int64_t BLOCK_SIZE = 10000000;  // 10MB blocks
+    static constexpr int64_t BLOCK_SIZE = 20000000;  // 20MB blocks
     static constexpr int64_t READ_SIZE = 200000;  // read&scan 200kb to fit in cache

     std::atomic<int64_t> doneLines(0); //number of lines processed but not yet returned


fixed warning

fixed warning

--- include/qasm/parser.hpp
+++ include/qasm/parser.hpp
@@ -50,7 +50,7 @@
     Token current_token_ = Token(); ///< current token
     int bits_ = 0;                  ///< number of bits
     int qubits_ = 0;                ///< number of qubits
-    std::string error_context_;     ///< parsing error context
+    std::string error_context_{};   ///< parsing error context

   public:
     /**


ScriptCore::UIT_EvaluateScript: use CefV8Context::Eval()

--- CefSharp/ScriptCore.cpp
+++ CefSharp/ScriptCore.cpp
@@ -36,25 +36,13 @@

             if (context.get() && context->Enter())
             {
-                CefRefPtr<CefV8Value> global = context->GetGlobal();
-                CefRefPtr<CefV8Value> eval = global->GetValue("eval");
-                CefRefPtr<CefV8Value> arg = CefV8Value::CreateString(script);
                 CefRefPtr<CefV8Value> result;
                 CefRefPtr<CefV8Exception> exception;

-                CefV8ValueList args;
-                args.push_back(arg);
-
-                result = eval->ExecuteFunctionWithContext(context, global, args);
-
-                if (result == nullptr)
+                bool success = context->Eval(script, result, exception);
+                if (success)
                 {
-                    // XXX
-                    _exceptionMessage = "Error";
-                }
-                else
-                {
-                    try
+                   try
                     {
                         _result = convertFromCef(result);
                     }
@@ -62,6 +50,14 @@
                     {
                         _exceptionMessage = ex->Message;
                     }
+                }
+                else if (exception.get())
+                {
+                    _exceptionMessage = toClr(exception->GetMessage());
+                }
+                else
+                {
+                    _exceptionMessage = "Failed to evaluate script";
                 }

                 context->Exit();


-: Fixed: Bug in Test_ConnectDisconnect.ConnectFromDelegate

--- tests/unit/Test_ConnectDisconnect/Tests.cpp
+++ tests/unit/Test_ConnectDisconnect/Tests.cpp
@@ -26,52 +26,63 @@
 class SenderEx : public Sender
 {
 public:
-	SenderEx() : stage_() {}
-
-	int stage() const { return stage_; }
+	SenderEx()
+	{
+		stageNo_ = 0; // 1 2 3 4 ...
+		stageStep_ = 1; // 2 4 8 16 ...
+	}
+
+	int stageNo() const { return stageNo_; }
+	int stageStep() const { return stageStep_; }

 	void runStage()
 	{
-		if(!stage_) stage_ = 1;
-		else stage_ *= 2;
 		fire();
-	}
-private:
-	int stage_;
-};
-
-class RecieverEx
+		++stageNo_;
+		stageStep_ *= 2;
+	}
+private:
+	int stageNo_;
+	int stageStep_;
+};
+
+template<int ArraySize> class RecieverEx
 {
 public:
 	RecieverEx()
 		: sender_()
 		, scope_()
+		, index_(-1)
 		, val_()
 	{}

+	int index() const { return index_; }
 	int value() const { return val_; }

-	void connect(SenderEx * sender, Cpp::ConnectionScope * scope)
-	{
+	void connect(int ind, SenderEx * sender, Cpp::ConnectionScope * scope)
+	{
+		index_ = ind;
 		sender_ = sender;
 		scope_ = scope;
-		scope->connect(sender->somethingHappened(), this, &RecieverEx::work);
+		scope->connect(sender->somethingHappened(), this, &RecieverEx<ArraySize>::work);
 	}

 	void work()
 	{
 		++val_;

-		int stage = sender_->stage();
-		if(stage < 4)
+		int step = sender_->stageStep();
+		int nextIndex = index_ + step;
+		if(nextIndex < ArraySize)
 		{
-			RecieverEx * next = this + stage;
-			next->connect(sender_, scope_);
+			RecieverEx<ArraySize> * next = this + step;
+			next->connect(nextIndex, sender_, scope_);
 		}
 	}
 private:
 	SenderEx * sender_;
 	Cpp::ConnectionScope * scope_;
+	int index_;
 	int val_;
 };

@@ -187,11 +198,11 @@
 // This test ensures that adding connections inside delegate works fine.
 TEST(Test_ConnectDisconnect, ConnectFromDelegate)
 {
-	RecieverEx rcv[8];
+	RecieverEx<8> rcv[8];
 	Cpp::ConnectionScope scope;
 	SenderEx sender;

-	rcv[0].connect(&sender, &scope);
+	rcv[0].connect(0, &sender, &scope);

 	ASSERT_EQ(0, rcv[0].value());
 	ASSERT_EQ(0, rcv[1].value());


v0.1.2 リリース準備

v0.1.2 リリース準備

--- Siv3D-Test/Main.cpp
+++ Siv3D-Test/Main.cpp
@@ -1,11 +1,27 @@
-# include <Siv3D.hpp>
+
+# include <Siv3D.hpp>

 void Main()
 {
-	//const Texture texture(L"example/siv3d-kun.png");
+	Graphics::SetBackground(Palette::White);
+
+	double t = 0.0;

 	while (System::Update())
 	{
-		Texture texture(L"example/siv3d-kun.png");
+		Window::SetTitle(Profiler::FPS(), L"FPS");
+
+		t += System::DeltaTime();
+
+		for (auto i : step(36))
+		{
+			const double angle = i * 10_deg + t * 30_deg;
+
+			const Vec2 pos = Circular(200, angle) + Window::Center();
+
+			RectF(25).setCenter(pos).rotated(angle).draw(HSV(i * 10));
+		}
+
+		Circle(Cursor::Pos(), 40).draw(ColorF(1.0, 0.0, 0.0, 0.5));
 	}
 }


make function generic

make function generic

--- em.cc
+++ em.cc
@@ -11,7 +11,7 @@
 	}
 }

-std::vector EM::start(long double stop){
+std::tuple<T...> EM::start(long double stop){
 	do{
 		long double currentlike = q_function(theta);
 		std::clog << "Theta: " << theta << "likelihood: " << currentlike << std::endl;


Bug 2562 - Eject item from non-active vbucket when over low water mark

This will eject items from non-active vbuckets when the memory usage
is growing beyond low water mark.

Change-Id: I81fdadeaad35668863dcb3f1c472c93518a40bca
Reviewed-on: http://review.northscale.com/2863
Reviewed-by: Dustin Sallings <1c08efb9b3965701be9d700d9a6f481f1ffec3ea@spy.net>
Tested-by: Dustin Sallings <1c08efb9b3965701be9d700d9a6f481f1ffec3ea@spy.net>

--- ep.cc
+++ ep.cc
@@ -855,9 +855,23 @@
     // can succeed *without* receiving a new ID (which is how we'd
     // distinguish an insert from an update if we cared).
     void callback(std::pair<bool, int64_t> &value) {
-        if (value.first && value.second > 0) {
-            ++stats->newItems;
-            setId(value.second);
+        if (value.first) {
+            if (value.second > 0) {
+                ++stats->newItems;
+                setId(value.second);
+            }
+            RCPtr<VBucket> vb = store->getVBucket(queuedItem.getVBucketId());
+            if (vb && vb->getState() != active) {
+                int bucket_num = vb->ht.bucket(queuedItem.getKey());
+                LockHolder lh(vb->ht.getMutex(bucket_num));
+                StoredValue *v = store->fetchValidValue(vb, queuedItem.getKey(),
+                                                        bucket_num, true);
+                double current = static_cast<double>(StoredValue::getCurrentSize(*stats));
+                double lower = static_cast<double>(stats->mem_low_wat);
+                if (v && current > lower) {
+                    v->ejectValue(*stats);
+                }
+            }
         } else if (!value.first) {
             redirty();
         }


Exposed options to set coarse solve max iters, precision.

--- multigrid/aa_mg/aa_mg_square_staggered_u1.cpp
+++ multigrid/aa_mg/aa_mg_square_staggered_u1.cpp
@@ -127,6 +127,8 @@
     cout << "--nvec [nvec]                                 (default 4)\n";
     cout << "--nrefine [number coarse]                     (default 1)\n";
     cout << "--multi-strategy [smooth, recursive]          (default smooth)\n";
+    cout << "--coarse-precision [coarse precision]         (default 1e-3)\n";
+    cout << "--coarse-max-iter [coarse maximum iterations] (default 1024)\n";
     cout << "--gauge [unit, load, random]                  (default load)\n";
     cout << "--gauge-transform [yes, no]                   (default no)\n";
     cout << "--beta [3.0, 6.0, 10.0, 10000.0]              (default 6.0)\n";
@@ -240,7 +242,7 @@
     inner_solver in_solve = GCR; //CR; //GCR;
     double inner_precision = 1e-3;
     int inner_restart = 64;
-    int inner_max = 1000;
+    int inner_max = 1024;
     if (my_test == SMOOTHER_ONLY)
     {
         in_solve = NONE;
@@ -441,6 +443,16 @@
                 {
                     mlevel_type = MLEVEL_RECURSIVE;
                 }
+                i++;
+            }
+            else if (strcmp(argv[i], "--coarse-precision") == 0)
+            {
+                inner_precision = atof(argv[i+1]);
+                i++;
+            }
+            else if (strcmp(argv[i], "--coarse-max-iter") == 0)
+            {
+                inner_max = atoi(argv[i+1]);
                 i++;
             }
             else if (strcmp(argv[i], "--gauge") == 0)
@@ -741,6 +753,9 @@
     mgstruct.n_refine = n_refine;
     mgstruct.blocksize_x = new int[n_refine];
     mgstruct.blocksize_y = new int[n_refine];
+    //mgstruct.blocksize_x[0] = 8;
+    //mgstruct.blocksize_y[0] = 8;
+    //for (i = 1; i < n_refine; i++)
     for (i = 0; i < n_refine; i++)
     {
         mgstruct.blocksize_x[i] = X_BLOCKSIZE;


Attempt to fix crash in issue 31082

Attempt to fix crash in issue 31082

Crash in issue 31082 is inside Windows ICM (Image Color Management)
code. I suspect it is caused by invalid bV5Intent value in the
BITMAPV5HEADER we passed in.

BUG=31082
TEST=Crashes in issue 31082 should be gone.

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

git-svn-id: http://src.chromium.org/svn/trunk/src@35734 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 5e4ad50a40bb7b0f4e2dfb38798ce72c1e9ecb18

--- app/gfx/icon_util.cc
+++ app/gfx/icon_util.cc
@@ -312,6 +312,10 @@
   // <http://msdn.microsoft.com/en-us/library/ms536531(VS.85).aspx> and
   // <http://b/1283121>.
   header->bV5CSType = LCS_WINDOWS_COLOR_SPACE;
+
+  // Use a valid value for bV5Intent as 0 is not a valid one.
+  // <http://msdn.microsoft.com/en-us/library/dd183381(VS.85).aspx>
+  header->bV5Intent = LCS_GM_IMAGES;
 }

 void IconUtil::SetSingleIconImageInformation(const SkBitmap& bitmap,


Incremented delay in "nssleep".

Incremented delay in "nssleep".

--- include/tsxx/system.hpp
+++ include/tsxx/system.hpp
@@ -57,7 +57,6 @@
 };
 typedef boost::shared_ptr<memory_region> memory_region_ptr;

-// CopyableMemoryRegion
 class
 memory_region_window
 {
@@ -101,7 +100,7 @@
 inline void
 nssleep(unsigned int ns)
 {
-	volatile unsigned int loop = ns * 3;
+	volatile unsigned int loop = ns * 5;
 	asm volatile (
 		"1:\n"
 		"subs %1, %1, #1;\n"


Add fill method

Add fill method

--- include/utxx/bitmap.hpp
+++ include/utxx/bitmap.hpp
@@ -64,8 +64,9 @@
     bool            empty()  const { return m_data == 0; }
     void            clear()        { m_data = 0; }

-    void set(unsigned int i)   { valid(i); m_data |= 1ul << i; }
-    void clear(unsigned int i) { valid(i); m_data ^= m_data & (1ul << i); }
+    void fill()                    { m_data = uint64_t(-1); }
+    void set(unsigned int i)       { valid(i); m_data |= 1ul << i; }
+    void clear(unsigned int i)     { valid(i); m_data ^= m_data & (1ul << i); }
     bool is_set(unsigned int i) const { valid(i); return m_data & (1ul << i); }
     int  first() const { return m_data ? atomic::bit_scan_forward(m_data) : end(); }
     int  last()  const { return m_data ? atomic::bit_scan_reverse(m_data) : end(); }
@@ -124,6 +125,11 @@
     unsigned int                end()   const { return max+1; }
     bool                        empty() const { return base::value() == 0; }

+    void fill() {
+        for (int i=0; i < s_hi_dim; ++i) m_data[i].fill();
+        base::fill();
+    }
+
     void clear() {
         for (int i=0; i < s_hi_dim; ++i) m_data[i].clear();
         base::clear();
@@ -135,7 +141,7 @@
         m_data[hi].set(lo);
         base::set(m_data[hi].value() ? hi : 0);
     }
-
+
     void clear(unsigned int i) {
         valid(i);
         unsigned int hi = i>>s_hi_sft, lo = i&s_lo_mask;


- read out new calib words at each reset on the pressure controller
- ui fix

git-svn-id: a6b1f342adda8e857528e759c3404af7b76d6bed@179 8f13a6d9-6203-4c43-9b9f-a3039379152f

--- Hanse/Module_PressureSensor/module_pressuresensor.cpp
+++ Hanse/Module_PressureSensor/module_pressuresensor.cpp
@@ -151,6 +151,15 @@

 void Module_PressureSensor::readCalibWords()
 {
+    unsigned char address = getSettings().value("i2cAddress").toInt();
+    unsigned char cmd[] = { 0x12 };
+    if (!uid->I2C_Write(address, cmd, 1)) {
+        setHealthToSick("could not reread calib  words.");
+        sleep(100);
+        return;
+    }
+    sleep(100);
+
     unsigned char readBuffer[8];
     if (!readRegister(0, 8, readBuffer)) {
         setHealthToSick("UID reported error.");
@@ -161,9 +170,9 @@
     for(int i=0;i<4;i++) {

         // this is the temperature in 10/degree celsius
-        uint16_t c = (int)readBuffer[i] << 8 | (int)readBuffer[i+1];
-
-        data["calib"+i] = c;
+        uint16_t c = (int)readBuffer[2*i] << 8 | (int)readBuffer[2*i+1];
+
+        data["calib "+QString::number(i)] = "0x"+QString::number(c,16);
         pressure_CalibrationWords[i]=c;
     }


COMP: Fixed warnings.

COMP: Fixed warnings.

--- Hybrid/vtkExodusIIReader.cxx
+++ Hybrid/vtkExodusIIReader.cxx
@@ -723,7 +723,7 @@
 };

 vtkStandardNewMacro(vtkExodusIIXMLParser);
-vtkCxxRevisionMacro(vtkExodusIIXMLParser,"1.48");
+vtkCxxRevisionMacro(vtkExodusIIXMLParser,"1.49");

@@ -1677,7 +1677,7 @@
 }

 // ------------------------------------------------------- PRIVATE CLASS MEMBERS
-vtkCxxRevisionMacro(vtkExodusIIReaderPrivate,"1.48");
+vtkCxxRevisionMacro(vtkExodusIIReaderPrivate,"1.49");
 vtkStandardNewMacro(vtkExodusIIReaderPrivate);
 vtkCxxSetObjectMacro(vtkExodusIIReaderPrivate,
                      CachedConnectivity,
@@ -2974,8 +2974,6 @@
     return;
     }

-  vtkIdType cellId;
-
   if ( this->SqueezePoints )
     {
     vtkstd::vector<vtkIdType> cellIds;
@@ -2991,7 +2989,7 @@
         }
       //cout << "\n";
       //cout << " " <<
-      cellId = output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, &cellIds[0] );
+      output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, &cellIds[0] );
       srcIds += binfo->PointsPerCell;
       }
       //cout << "\n";
@@ -3011,7 +3009,7 @@
         //cout << " " << srcIds[p];
         }
       //cout << "\n";
-      cellId = output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, &cellIds[0] );
+      output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, &cellIds[0] );
       srcIds += binfo->PointsPerCell;
       }
 #else // VTK_USE_64BIT_IDS
@@ -3019,7 +3017,7 @@

     for ( int i = 0; i < binfo->Size; ++i )
       {
-      cellId = output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, srcIds );
+      output->InsertNextCell( binfo->CellType, binfo->PointsPerCell, srcIds );
       srcIds += binfo->PointsPerCell;
       //for ( int k = 0; k < binfo->PointsPerCell; ++k )
         //cout << " " << srcIds[k];
@@ -3027,7 +3025,6 @@
       }
 #endif // VTK_USE_64BIT_IDS
     }
-  (void)cellId; // Eliminate IRIX CC warning.
 }

 void vtkExodusIIReaderPrivate::InsertSetCells( int otyp, int obj, int conn_type, int timeStep, vtkUnstructuredGrid* output )
@@ -5997,7 +5994,7 @@

 // -------------------------------------------------------- PUBLIC CLASS MEMBERS

-vtkCxxRevisionMacro(vtkExodusIIReader,"1.48");
+vtkCxxRevisionMacro(vtkExodusIIReader,"1.49");
 vtkStandardNewMacro(vtkExodusIIReader);
 vtkCxxSetObjectMacro(vtkExodusIIReader,Metadata,vtkExodusIIReaderPrivate);
 vtkCxxSetObjectMacro(vtkExodusIIReader,ExodusModel,vtkExodusModel);
@@ -7188,11 +7185,8 @@
     if ( ! this->GetHasModeShapes() )
       {
       int nTimes = (int) this->Metadata->Times.size();
-      double timeRange[2];
       if ( nTimes )
         {
-        timeRange[0] = this->Metadata->Times[0];
-        timeRange[1] = this->Metadata->Times[nTimes - 1];
         this->TimeStepRange[0] = 0;
         this->TimeStepRange[1] = nTimes - 1;
         }


Editor server now uploads property index with property info

--- Systems/EditorServerSystem/source/EditorOps.cpp
+++ Systems/EditorServerSystem/source/EditorOps.cpp
@@ -43,6 +43,7 @@
 					writer.push_object_member(propName);

 					// Write property information
+					writer.object_member("index", propInfo.index());
 					writer.object_member("type", propInfo.type().name());
 					writer.object_member("category", propInfo.category());
 					writer.object_member("description", propInfo.description());


STYLE:  Changed N3 portion to accommodate recent (small) change to itkN3BiasFieldCorrectionImageFilter

git-svn-id: 471e042b35a12bde91bbe895b1188443e6ce8888@20 fd2da0a4-d968-48df-9cb5-d8c496287cbf

--- Examples/N3BiasFieldCorrection.cxx
+++ Examples/N3BiasFieldCorrection.cxx
@@ -106,7 +106,7 @@
     CorrecterType::BiasFieldControlPointLatticeType, typename
     CorrecterType::ScalarImageType> BSplinerType;
   typename BSplinerType::Pointer bspliner = BSplinerType::New();
-  bspliner->SetInput( correcter->GetBiasFieldControlPointLattice() );
+  bspliner->SetInput( correcter->GetLogBiasFieldControlPointLattice() );
   bspliner->SetSplineOrder( correcter->GetSplineOrder() );
   bspliner->SetSize(
     reader->GetOutput()->GetLargestPossibleRegion().GetSize() );


Stop crashing in chroot, call setAttribute via viewport()

--- src/launcherwindow.cpp
+++ src/launcherwindow.cpp
@@ -78,8 +78,8 @@
 {
     LauncherApp *app = static_cast<LauncherApp *>(qApp);

-    setAttribute(Qt::WA_OpaquePaintEvent);
-    setAttribute(Qt::WA_NoSystemBackground);
+    viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+    viewport()->setAttribute(Qt::WA_NoSystemBackground);

     engine()->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory);
     connect(engine(), SIGNAL(quit()), qApp, SLOT(closeAllWindows()));


INTEGRATION: CWS pchfix02 (1.7.8); FILE MERGED 2006/09/01 17:39:34 kaib 1.7.8.1: #i68856# Added header markers and pch files

--- slideshow/source/engine/usereventqueue.cxx
+++ slideshow/source/engine/usereventqueue.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: usereventqueue.cxx,v $
  *
- *  $Revision: 1.7 $
- *
- *  last change: $Author: rt $ $Date: 2006-07-26 07:27:41 $
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: obo $ $Date: 2006-09-17 08:29:59 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,6 +32,9 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"

 // must be first
 #include "canvas/debug.hxx"


gender lagað í add person

gender lagað í add person

--- classui.cpp
+++ classui.cpp
@@ -485,3 +485,21 @@
     #endif
 }
 */
+/*
+void ClassUI::editComputer()
+{
+    string cmpname;
+    cout << "Enter the full name of the computer that you want to edit: ";
+    cin.ignore();
+    std::getline(std::cin,cmpname);
+    if(list.removePersonFound(cmpname))
+    {
+        list.removePerson(cmpname);
+        addPerson();
+    }
+    else
+    {
+        cout << "Computer not found!" << endl;
+    }
+}
+*/


Fixes: crash ut_minputcontext

Fixes: crash ut_minputcontext

RevBy: TrustMe
Details: Skip ut_minputcontext due to the contextsubscrible
crash until we find out other way to fix it.

--- tests/ut_minputcontext/ut_minputcontext.cpp
+++ tests/ut_minputcontext/ut_minputcontext.cpp
@@ -431,6 +431,13 @@

 void Ut_MInputContext::init()
 {
+    // see NB#198630
+    // ut_minputcontext now is using a stub QDBusConnection, while we have
+    // implicit dependency to contextsubscrible, and contenxtsubscrible also
+    // try to use QDBusConnect. Our stub QDbusConnection will lead to the
+    // contenxtsubscrible crash.
+    QSKIP("Stubbed QtDBus makes ut_minputcontext can not really work", SkipAll);
+
     m_stub->resetCallCounts();
 }


Improved SMBIOS v2.8 support for Chassis (type 3)

--- chassis.cpp
+++ chassis.cpp
@@ -2,7 +2,8 @@
 #include "sysinv.h"
 #include "smbios.h"

-LPTSTR CHASSIS_TYPE_STRINGS[] = {
+// 7.4.1 System Enclosure or Chassis Types
+LPTSTR CHASSIS_TYPES[] = {
 	_T("Unknown"),					// 0x00 Invalid
 	_T("Other"),					// 0x01
 	_T("Unknown"),					// 0x02
@@ -35,6 +36,28 @@
 	_T("Blade Enclosure")			// 0x1D
 };

+// 7.4.2 System Enclosure or Chassis States
+LPCTSTR CHASSIS_STATES[] = {
+	_T("Unknown"),							// 0x00 Invalid
+	_T("Other"),							// 0x01 Other
+	_T("Unknown"),							// 0x02 Unknown
+	_T("Safe"),								// 0x03 Safe
+	_T("Warning"),							// 0x04 Warning
+	_T("Critical"),							// 0x05 Critical
+	_T("Non-recoverable")					// 0x06 Non-recoverable
+};
+
+// 7.4.3 System Enclosure or Chassis Security Status
+LPCTSTR CHASSIS_SECURITY_STATUS[] = {
+	_T("Unknown"),							// 0x00 Invalid
+	_T("Other"),							// 0x01 Other
+	_T("Unknown"),							// 0x02 Unknown
+	_T("None"),								// 0x03 None
+	_T("External interface locked out"),	// 0x04 External interface locked out
+	_T("External interface enabled")		// 0x05 External interface enabled
+};
+
+// 7.4 System Enclosure or Chassis (Type 3)
 PNODE EnumChassis()
 {
 	PNODE parentNode = node_alloc(_T("Chassis"), 0);
@@ -42,40 +65,79 @@

 	PRAW_SMBIOS_DATA smbios = GetSmbiosData();
 	PSMBIOS_STRUCT_HEADER header = NULL;
-	PBYTE cursor = NULL;

 	LPTSTR unicode = NULL;
 	TCHAR buffer[MAX_PATH + 1];

 	while (NULL != (header = GetNextStructureOfType(header, SMB_TABLE_CHASSIS))) {
-		cursor = (PBYTE)header;
-
 		// v2.0+
 		if (2 <= smbios->SMBIOSMajorVersion) {
 			node = node_append_new(parentNode, _T("Chassis"), 0);

 			// 0x04 Manufacturer
-			unicode = GetSmbiosString(header, *(cursor + 0x04));
+			unicode = GetSmbiosString(header, BYTE_AT_OFFSET(header, 0x04));
 			node_att_set(node, _T("Manufacturer"), unicode, 0);
 			LocalFree(unicode);

 			// 0x05 Chassis Type
-			node_att_set(node, _T("Type"), SAFE_INDEX(CHASSIS_TYPE_STRINGS, *(cursor + 0x05)), 0);
+			node_att_set(node, _T("Type"), SAFE_INDEX(CHASSIS_TYPES, BYTE_AT_OFFSET(header, 0x05)), 0);

 			// 0x06 Version String
-			unicode = GetSmbiosString(header, *(cursor + 0x06));
+			unicode = GetSmbiosString(header, BYTE_AT_OFFSET(header, 0x06));
 			node_att_set(node, _T("Version"), unicode, 0);
 			LocalFree(unicode);

 			// 0x07 Serial Number
-			unicode = GetSmbiosString(header, *(cursor + 0x06));
+			unicode = GetSmbiosString(header, BYTE_AT_OFFSET(header, 0x06));
 			node_att_set(node, _T("SerialNumber"), unicode, 0);
 			LocalFree(unicode);

 			// 0x08 Asset Tag
-			unicode = GetSmbiosString(header, *(cursor + 0x08));
+			unicode = GetSmbiosString(header, BYTE_AT_OFFSET(header, 0x08));
 			node_att_set(node, _T("AssetTag"), unicode, 0);
 			LocalFree(unicode);
+
+			// v2.1+
+			if (2 < smbios->SMBIOSMajorVersion || (2 == smbios->SMBIOSMajorVersion && 1 <= smbios->SMBIOSMinorVersion)) {
+				// 0x09 Boot-up state
+				node_att_set(node, _T("BootupState"), SAFE_INDEX(CHASSIS_STATES, BYTE_AT_OFFSET(header, 0x09)), 0);
+
+				// 0x0A Power supply state
+				node_att_set(node, _T("PowerSupplyState"), SAFE_INDEX(CHASSIS_STATES, BYTE_AT_OFFSET(header, 0x0A)), 0);
+
+				// 0x0B Thermal State
+				node_att_set(node, _T("ThermalState"), SAFE_INDEX(CHASSIS_STATES, BYTE_AT_OFFSET(header, 0x0B)), 0);
+
+				// 0x0C Security State
+				node_att_set(node, _T("SecurityState"), SAFE_INDEX(CHASSIS_SECURITY_STATUS, BYTE_AT_OFFSET(header, 0x0C)), 0);
+			}
+
+			// v2.3+
+			if (2 < smbios->SMBIOSMajorVersion || (2 == smbios->SMBIOSMajorVersion && 3 <= smbios->SMBIOSMinorVersion)) {
+				// 0x0D OEM Defined
+				swprintf(buffer, _T("0x%X"), DWORD_AT_OFFSET(header, 0x0D));
+				node_att_set(node, _T("OemInfo"), buffer, 0);
+
+				// 0x11 Height (U|1.75"|4.445cm)
+				if (0 != BYTE_AT_OFFSET(header, 0x11)) {
+					swprintf(buffer, _T("%u"), BYTE_AT_OFFSET(header, 0x11));
+					node_att_set(node, _T("HeightU"), buffer, 0);
+				}
+
+				// 0x12 Number of power cords
+				if (0 != BYTE_AT_OFFSET(header, 0x12)) {
+					swprintf(buffer, _T("%u"), BYTE_AT_OFFSET(header, 0x12));
+					node_att_set(node, _T("PowerCordCount"), buffer, 0);
+				}
+			}
+
+			// v2.7+
+			if (2 < smbios->SMBIOSMajorVersion || (2 == smbios->SMBIOSMajorVersion && 7 <= smbios->SMBIOSMinorVersion)) {
+				// 0x15 + n*m SKU Number
+				unicode = GetSmbiosString(header, BYTE_AT_OFFSET(header, 0x15 + BYTE_AT_OFFSET(header, 0x15)));
+				node_att_set(node, _T("SkuNumber"), unicode, 0);
+				LocalFree(unicode);
+			}
 		}
 	}


Add TODOs for remaining requested changes

--- tftrt/examples-cpp/benchmark_runner/main.cc
+++ tftrt/examples-cpp/benchmark_runner/main.cc
@@ -185,7 +185,10 @@
   TFTRT_ENSURE_OK(
       LoadModel(model_path, signature_key, &bundle, &input_info, &output_info));

+  // TODO: Convert model w/ TRT and add flag for this behavior
+
   // Create inputs and move to device
+  // TODO: Measure H2D times over repeated calls and report metrics
   const string device_name = GetDeviceName(bundle.session);
   std::vector<Tensor> inputs_device;
   TFTRT_ENSURE_OK(


Do not get main runloader from gAlice

Do not get main runloader from gAlice

--- ITS/AliITSreconstruction.cxx
+++ ITS/AliITSreconstruction.cxx
@@ -167,7 +167,6 @@
     fDet[0] = fDet[1] = fDet[2] = kTRUE;
     fEnt0 = 0;

-    //fEnt  = gAlice->GetEventsPerRun();
     fEnt = Int_t(fRunLoader->GetNumberOfEvents());

     fLoader->LoadDigits("read");


Scale zoom values in the SpriteFrames editor for hiDPI displays

This closes #46836.

--- editor/plugins/sprite_frames_editor_plugin.cpp
+++ editor/plugins/sprite_frames_editor_plugin.cpp
@@ -219,7 +219,8 @@
 }

 void SpriteFramesEditor::_sheet_zoom_reset() {
-	sheet_zoom = 1.f;
+	// Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad.
+	sheet_zoom = MAX(1.0, EDSCALE);
 	Size2 texture_size = split_sheet_preview->get_texture()->get_size();
 	split_sheet_preview->set_custom_minimum_size(texture_size * sheet_zoom);
 }
@@ -732,7 +733,7 @@
 }

 void SpriteFramesEditor::_zoom_reset() {
-	thumbnail_zoom = 1.0f;
+	thumbnail_zoom = MAX(1.0, EDSCALE);
 	tree->set_fixed_column_width(thumbnail_default_size * 3 / 2);
 	tree->set_fixed_icon_size(Size2(thumbnail_default_size, thumbnail_default_size));
 }
@@ -1229,13 +1230,14 @@

 	// Config scale.
 	scale_ratio = 1.2f;
-	thumbnail_default_size = 96;
-	thumbnail_zoom = 1.0f;
-	max_thumbnail_zoom = 8.0f;
-	min_thumbnail_zoom = 0.1f;
-	sheet_zoom = 1.0f;
-	max_sheet_zoom = 16.0f;
-	min_sheet_zoom = 0.01f;
+	thumbnail_default_size = 96 * MAX(1.0, EDSCALE);
+	thumbnail_zoom = MAX(1.0, EDSCALE);
+	max_thumbnail_zoom = 8.0f * MAX(1.0, EDSCALE);
+	min_thumbnail_zoom = 0.1f * MAX(1.0, EDSCALE);
+	// Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad.
+	sheet_zoom = MAX(1.0, EDSCALE);
+	max_sheet_zoom = 16.0f * MAX(1.0, EDSCALE);
+	min_sheet_zoom = 0.01f * MAX(1.0, EDSCALE);
 	_zoom_reset();
 }


簡易版カードシャッフル機能の追加

簡易版カードシャッフル機能の追加

--- Classes/GameManager.cpp
+++ Classes/GameManager.cpp
@@ -132,6 +132,9 @@

 // カードを配置する関数
 void GameManager::arrangeCards() {
+  // カードのシャッフル(簡易版)
+  std::shuffle(cards.begin(), cards.end(), std::mt19937());
+
   const Size windowSize = Director::getInstance()->getWinSize();
   const Size cardSize = cards.back()->getCardSize(); // カードサイズは全て同じ
   const Size margin((windowSize.width - cardSize.width * MAX_CARD_ROWS) / (MAX_CARD_ROWS + 1),


Bug fix

Bug fix

--- ITS/AliITSv11GeometrySDD.cxx
+++ ITS/AliITSv11GeometrySDD.cxx
@@ -5589,7 +5589,6 @@
   Double_t drMax = pcon1all->GetRmax(0)- pcon1all->GetRmin(0);
   pcon1container->DefineSection(1, sddCableZ2, pcon1all->GetRmax(1)-drMax,
 					       pcon1all->GetRmax(1));
-  delete pcon1all;

   TGeoVolume *vpcon1container = new TGeoVolume("vpcon1container",
 					       pcon1container, airSDD);
@@ -5645,7 +5644,6 @@
   pcon2container->DefineSection(1, sddCableZ3, pcon2all->GetRmax(1)-drMax,
 					       pcon2all->GetRmax(1));

-  delete pcon2all;

   TGeoVolume *vpcon2container = new TGeoVolume("vpcon2container",
 					       pcon2container, airSDD);
@@ -5765,7 +5763,6 @@
   pcon3container->DefineSection(1, fgkSDDCableZ5, pcon3all->GetRmax(1)-drMax,
 					       pcon3all->GetRmax(1));

-  delete pcon3all;

   TGeoVolume *vpcon3container = new TGeoVolume("vpcon3container",
 					       pcon3container, airSDD);


Fix collapse visual shader tree

Fix collapse visual shader tree

--- editor/plugins/visual_shader_editor_plugin.cpp
+++ editor/plugins/visual_shader_editor_plugin.cpp
@@ -58,9 +58,15 @@

 void VisualShaderEditor::edit(VisualShader *p_visual_shader) {

-	bool first_init = false;
+	bool changed = false;
 	if (p_visual_shader) {
-		first_init = true;
+		if (visual_shader.is_null()) {
+			changed = true;
+		} else {
+			if (visual_shader.ptr() != p_visual_shader) {
+				changed = true;
+			}
+		}
 		visual_shader = Ref<VisualShader>(p_visual_shader);
 	} else {
 		visual_shader.unref();
@@ -69,7 +75,7 @@
 	if (visual_shader.is_null()) {
 		hide();
 	} else {
-		if (first_init) { // to avoid tree collapse
+		if (changed) { // to avoid tree collapse
 			_update_options_menu();
 		}
 		_update_graph();