Fix for fgInstrumentMethod

Fix for fgInstrumentMethod

There was a bug creating profiling images using /Tuning
We computed the wrong value for addrOfBlockCount at the end of this method
This would result in method having proper block counts,
but still not getting marked as being executed.

This regressed in PR #14640

--- src/jit/flowgraph.cpp
+++ src/jit/flowgraph.cpp
@@ -261,7 +261,7 @@

     int         countOfBlocks = 0;
     BasicBlock* block;
-    for (block = fgFirstBB; block; block = block->bbNext)
+    for (block = fgFirstBB; (block != nullptr); block = block->bbNext)
     {
         if (!(block->bbFlags & BBF_IMPORTED) || (block->bbFlags & BBF_INTERNAL))
         {
@@ -272,11 +272,9 @@

     // Allocate the profile buffer

-    ICorJitInfo::ProfileBuffer* bbProfileBuffer;
-
-    HRESULT res = info.compCompHnd->allocBBProfileBuffer(countOfBlocks, &bbProfileBuffer);
-
-    ICorJitInfo::ProfileBuffer* bbProfileBufferStart = bbProfileBuffer;
+    ICorJitInfo::ProfileBuffer* bbProfileBufferStart;
+
+    HRESULT res = info.compCompHnd->allocBBProfileBuffer(countOfBlocks, &bbProfileBufferStart);

     GenTree* stmt;

@@ -300,9 +298,16 @@
     }
     else
     {
-        // Assign a buffer entry for each basic block
-
-        for (block = fgFirstBB; block; block = block->bbNext)
+        // For each BasicBlock (non-Internal)
+        //  1. Assign the blocks bbCodeOffs to the ILOffset field of this blocks profile data.
+        //  2. Add an operation that increments the ExecutionCount field at the beginning of the block.
+
+        // Each (non-Internal) block has it own ProfileBuffer tuple [ILOffset, ExecutionCount]
+        // To start we initialize our current one with the first one that we allocated
+        //
+        ICorJitInfo::ProfileBuffer* bbCurrentBlockProfileBuffer = bbProfileBufferStart;
+
+        for (block = fgFirstBB; (block != nullptr); block = block->bbNext)
         {
             if (!(block->bbFlags & BBF_IMPORTED) || (block->bbFlags & BBF_INTERNAL))
             {
@@ -310,25 +315,30 @@
             }

             // Assign the current block's IL offset into the profile data
-            bbProfileBuffer->ILOffset = block->bbCodeOffs;
-
-            size_t addrOfBlockCount = (size_t)&bbProfileBuffer->ExecutionCount;
+            bbCurrentBlockProfileBuffer->ILOffset = block->bbCodeOffs;
+            assert(bbCurrentBlockProfileBuffer->ExecutionCount == 0);   // This value should already be zero-ed out
+
+            size_t addrOfCurrentExecutionCount = (size_t)&bbCurrentBlockProfileBuffer->ExecutionCount;

             // Read Basic-Block count value
-            GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+            GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfCurrentExecutionCount, GTF_ICON_BBC_PTR, false);

             // Increment value by 1
             GenTree* rhsNode = gtNewOperNode(GT_ADD, TYP_INT, valueNode, gtNewIconNode(1));

             // Write new Basic-Block count value
-            GenTree* lhsNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+            GenTree* lhsNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfCurrentExecutionCount, GTF_ICON_BBC_PTR, false);
             GenTree* asgNode = gtNewAssignNode(lhsNode, rhsNode);

-            fgInsertStmtAtBeg(block, asgNode);
-
+            fgInsertStmtAtBeg(block, asgNode);
+
+            // Advance to the next ProfileBuffer tuple [ILOffset, ExecutionCount]
+            bbCurrentBlockProfileBuffer++;
+
+            // One less block
             countOfBlocks--;
-            bbProfileBuffer++;
-        }
+        }
+        // Check that we allocated and initialized the same number of ProfileBuffer tuples
         noway_assert(countOfBlocks == 0);

         // Add the method entry callback node
@@ -359,10 +369,11 @@
         GenTreeArgList* args = gtNewArgList(arg);
         GenTree*        call = gtNewHelperCallNode(CORINFO_HELP_BBT_FCN_ENTER, TYP_VOID, args);

-        size_t addrOfBlockCount = (size_t)&bbProfileBuffer->ExecutionCount;
+        // Get the address of the first blocks ExecutionCount
+        size_t addrOfFirstExecutionCount = (size_t)&bbProfileBufferStart->ExecutionCount;

         // Read Basic-Block count value
-        GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+        GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfFirstExecutionCount, GTF_ICON_BBC_PTR, false);

         // Compare Basic-Block count value against zero
         GenTree* relop = gtNewOperNode(GT_NE, TYP_INT, valueNode, gtNewIconNode(0, TYP_INT));


Call LowerBlockStore TreeNodeInfoInitBlockStore

For arm64 call LowerBlockStore before TreeNodeInfoInitBlockStore
as done on other architectures.

--- src/jit/lsraarm64.cpp
+++ src/jit/lsraarm64.cpp
@@ -504,6 +504,7 @@
         case GT_STORE_BLK:
         case GT_STORE_OBJ:
         case GT_STORE_DYN_BLK:
+            LowerBlockStore(tree->AsBlk());
             TreeNodeInfoInitBlockStore(tree->AsBlk());
             break;

@@ -1256,7 +1257,6 @@
             // The helper follows the regular ABI.
             dstAddr->gtLsraInfo.setSrcCandidates(l, RBM_ARG_0);
             initVal->gtLsraInfo.setSrcCandidates(l, RBM_ARG_1);
-            blkNode->gtBlkOpKind = GenTreeBlk::BlkOpKindHelper;
             if (size != 0)
             {
                 // Reserve a temp register for the block size argument.
@@ -1333,7 +1333,6 @@
                     GenTree* blockSize = blkNode->AsDynBlk()->gtDynamicSize;
                     blockSize->gtLsraInfo.setSrcCandidates(l, RBM_ARG_2);
                 }
-                blkNode->gtBlkOpKind = GenTreeBlk::BlkOpKindHelper;
             }
             if (internalIntCount != 0)
             {


fix dht issue for platforms where char is unsigned. introduce assert

git-svn-id: f73d3a8135a81ac54074f42e0d79c0ba7e35ca85@8545 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/kademlia/node.cpp
+++ src/kademlia/node.cpp
@@ -125,7 +125,7 @@
 	h1.update((char*)info_hash, sha1_hash::size);

 	sha1_hash h = h1.final();
-	if (std::equal(token.begin(), token.end(), (signed char*)&h[0]))
+	if (std::equal(token.begin(), token.end(), (char*)&h[0]))
 		return true;

 	hasher h2;
@@ -133,7 +133,7 @@
 	h2.update((char*)&m_secret[1], sizeof(m_secret[1]));
 	h2.update((char*)info_hash, sha1_hash::size);
 	h = h2.final();
-	if (std::equal(token.begin(), token.end(), (signed char*)&h[0]))
+	if (std::equal(token.begin(), token.end(), (char*)&h[0]))
 		return true;
 	return false;
 }
@@ -151,7 +151,8 @@
 	h.update(info_hash, sha1_hash::size);

 	sha1_hash hash = h.final();
-	std::copy(hash.begin(), hash.begin() + 4, (signed char*)&token[0]);
+	std::copy(hash.begin(), hash.begin() + 4, (char*)&token[0]);
+	TORRENT_ASSERT(std::equal(token.begin(), token.end(), (char*)&hash[0]));
 	return token;
 }


Preserve order of definition of mappings when listing them

Fixes #1479
Closes #1494

--- src/keymap_manager.cc
+++ src/keymap_manager.cc
@@ -16,7 +16,7 @@

 void KeymapManager::unmap_key(Key key, KeymapMode mode)
 {
-    m_mapping.unordered_remove(KeyAndMode{key, mode});
+    m_mapping.remove(KeyAndMode{key, mode});
 }

@@ -43,11 +43,9 @@
         res = m_parent->get_mapped_keys(mode);
     for (auto& map : m_mapping)
     {
-        if (map.key.second == mode)
+        if (map.key.second == mode and not contains(res, map.key.first))
             res.emplace_back(map.key.first);
     }
-    std::sort(res.begin(), res.end());
-    res.erase(std::unique(res.begin(), res.end()), res.end());
     return res;
 }


fdo#63255 ignore guides

fdo#63255 ignore guides

--- src/lib/VSDParser.cpp
+++ src/lib/VSDParser.cpp
@@ -430,8 +430,11 @@
 {
   switch (m_header.chunkType)
   {
+  case VSD_SHAPE_GUIDE:
+    // Ignore guides, because they are not really a part of the drawing.
+    // TODO: Maybe we want to show them if they are marked as printable?
+    break;
   case VSD_SHAPE_GROUP:
-  case VSD_SHAPE_GUIDE:
   case VSD_SHAPE_SHAPE:
   case VSD_SHAPE_FOREIGN:
     readShape(input);


FIXME ;)

FIXME ;)

svn path=/trunk/KDE/kdeedu/marble/; revision=753991

--- src/lib/VectorMap.cpp
+++ src/lib/VectorMap.cpp
@@ -185,6 +185,8 @@
         do {
             m_offset -= 4 * m_radius;
             boundingPolygon.translate( -4 * m_radius, 0 );
+//      FIXME: Get rid of this really fugly code once we will have a proper
+//             LatLonBox check implemented and in place.
         } while( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
                 || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even && ( visibleArea.intersects( QRectF( boundingPolygon.at(1), QPointF( (double)(m_imgwidth)  / 2.0 - m_rad2Pixel * ( m_centerLon - M_PI ) + m_offset + 4 * m_radius, boundingPolygon.at(0).y() ) ) )
                 || visibleArea.intersects( QRectF( QPointF( (double)(m_imgwidth)  / 2.0 - m_rad2Pixel * ( m_centerLon + M_PI )  + m_offset + 4 * m_radius, boundingPolygon.at(1).y() ), boundingPolygon.at(0) ) ) ) )
@@ -192,6 +194,8 @@
         m_offset += 4 * m_radius;
         boundingPolygon.translate( 4 * m_radius, 0 );

+//      FIXME: Get rid of this really fugly code once we will have a proper
+//             LatLonBox check implemented and in place.
         while( ( (*itPolyLine)->getDateLine() != GeoPolygon::Even && visibleArea.intersects( (QRectF)( boundingPolygon.boundingRect() ) ) )
                 || ( (*itPolyLine)->getDateLine() == GeoPolygon::Even && ( visibleArea.intersects( QRectF( boundingPolygon.at(1), QPointF( (double)(m_imgwidth)  / 2.0 - m_rad2Pixel * ( m_centerLon - M_PI ) + m_offset + 4 * m_radius, boundingPolygon.at(0).y() ) ) )
                 || visibleArea.intersects( QRectF( QPointF( (double)(m_imgwidth)  / 2.0 - m_rad2Pixel * ( m_centerLon + M_PI )  + m_offset + 4 * m_radius, boundingPolygon.at(1).y() ), boundingPolygon.at(0) ) ) ) )


avoid use of uninitialized value in comparison

... to keep the code valgrind-clean.

--- src/lib/WPSHeader.cpp
+++ src/lib/WPSHeader.cpp
@@ -123,9 +123,10 @@
 		document_contents->seek(0, librevenge::RVNG_SEEK_SET);

 		char fileMagic[8];
-		for (int i=0; i<7 && !document_contents->isEnd(); i++)
+		int i = 0;
+		for (; i<7 && !document_contents->isEnd(); i++)
 			fileMagic[i] = char(libwps::readU8(document_contents.get()));
-		fileMagic[7] = '\0';
+		fileMagic[i] = '\0';

 		/* Works 7/8 */
 		if (0 == strcmp(fileMagic, "CHNKWKS"))


Drop the fips140 example, doesn't build after recent changes and it's more or less useless in any case.

--- doc/examples/fips140.cpp
+++ doc/examples/fips140.cpp
@@ -1,59 +0,0 @@
-/*
-  A minimal FIPS-140 application.
-
-  Written by Jack Lloyd (lloyd@randombit.net), on December 16-19, 2003
-
-  This file is in the public domain
-*/
-
-#include <botan/botan.h>
-#include <botan/fips140.h>
-using namespace Botan;
-
-#include <iostream>
-#include <fstream>
-
-int main(int, char* argv[])
-   {
-   const std::string EDC_SUFFIX = ".edc";
-
-   try {
-      LibraryInitializer init; /* automatically does startup self tests */
-
-      // you can also do self tests on demand, like this:
-      if(!FIPS140::passes_self_tests())
-         throw Self_Test_Failure("FIPS-140 startup tests");
-
-      /*
-        Here, we just check argv[0] and assume that it works. You can use
-        various extremely nonportable APIs on some Unices (dladdr, to name one)
-        to find out the real name (I presume there are similiarly hairy ways of
-        doing it on Windows). We then assume the EDC (Error Detection Code, aka
-        a hash) is stored in argv[0].edc
-
-        Remember: argv[0] can be easily spoofed. Don't trust it for real.
-
-        You can also do various nasty things and find out the path of the
-        shared library you are linked with, and check that hash.
-      */
-      std::string exe_path = argv[0];
-      std::string edc_path = exe_path + EDC_SUFFIX;
-      std::ifstream edc_file(edc_path.c_str());
-      std::string edc;
-      std::getline(edc_file, edc);
-
-      std::cout << "Our EDC is " << edc << std::endl;
-
-      bool good = FIPS140::good_edc(exe_path, edc);
-
-      if(good)
-         std::cout << "Our EDC matches" << std::endl;
-      else
-         std::cout << "Our EDC is bad" << std::endl;
-   }
-   catch(std::exception& e)
-      {
-      std::cout << "Exception caught: " << e.what() << std::endl;
-      }
-   return 0;
-   }


Added possibility of setting ip and port in clariusStreaming example

--- source/FAST/Examples/DataImport/clariusStreaming.cpp
+++ source/FAST/Examples/DataImport/clariusStreaming.cpp
@@ -10,9 +10,11 @@

 int main(int argc, char**argv) {
     CommandLineParser parser("Clarius streaming example");
+    parser.addVariable("port", "5858", "Port to use for clarius connection");
+    parser.addVariable("ip", "192.168.1.1", "Address to use for clarius connection");
     parser.parse(argc, argv);

-    auto streamer = ClariusStreamer::create();
+    auto streamer = ClariusStreamer::create(parser.get("ip"), parser.get<int>("port"));

     auto renderer = ImageRenderer::create()
             ->connect(streamer);


Renamed rebucket_final to rebucket

Renamed rebucket_final to rebucket

The rebucket array can be computed in one go. Hence, there is no need for more than one name.

--- benchmarks/prefix_doubling/prefix_doubling.cpp
+++ benchmarks/prefix_doubling/prefix_doubling.cpp
@@ -47,7 +47,7 @@
 //! A pair (index, t=T[index]).
 template <typename AlphabetType>
 struct IndexOneMer {
-    size_t       index;
+    size_t index;
     AlphabetType t;

     friend std::ostream& operator << (std::ostream& os, const IndexOneMer& iom) {
@@ -106,8 +106,7 @@
     if (debug_print)
         sa.Print("sa");

-    DIA<size_t> rebucket;
-    DIA<size_t> rebucket_final =
+    DIA<size_t> rebucket =
         one_mers_sorted
         .template FlatWindow<size_t>(
             2,
@@ -125,7 +124,7 @@
         });

     if (debug_print)
-        rebucket_final.Print("rebucket_final");
+        rebucket.Print("rebucket");

     uint8_t shifted_exp = 1;

@@ -134,7 +133,7 @@
         DIA<RankIndex> isa =
             sa
             .Zip(
-                rebucket_final,
+                rebucket,
                 [](size_t sa, size_t rb) {
                     return RankIndex {sa, rb};
             })
@@ -192,7 +191,7 @@
         if (non_singletons == 0)
             return sa;

-        rebucket_final =
+        rebucket =
             triple_sorted
             .template FlatWindow<size_t>(
                 2,
@@ -214,7 +213,7 @@
             });

         if (debug_print)
-            rebucket_final.Print("rebucket_final");
+            rebucket.Print("rebucket");
         LOG << "Rebucket the partial SA";
     }


Clean up no longer used enum and inclusion for collecting Blob histogram.

Review URL: https://chromiumcodereview.appspot.com/14984008

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

--- Source/core/fileapi/Blob.cpp
+++ Source/core/fileapi/Blob.cpp
@@ -36,20 +36,8 @@
 #include "core/fileapi/File.h"
 #include "core/fileapi/ThreadableBlobRegistry.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/platform/HistogramSupport.h"

 namespace WebCore {
-
-namespace {
-
-// Used in histograms to see when we can actually deprecate the prefixed slice.
-enum SliceHistogramEnum {
-    SliceWithoutPrefix,
-    SliceWithPrefix,
-    SliceHistogramEnumMax,
-};
-
-} // namespace

 Blob::Blob()
     : m_size(0)


Update Console - Fix search card keyword input bug (initialize opt index)

--- Sources/Programs/Console.cpp
+++ Sources/Programs/Console.cpp
@@ -547,6 +547,9 @@
 			{ nullptr,		0,                 nullptr,  0 }
 		};

+		// Initialize opt index
+		optind = 1;
+
 		while ((opt = getopt_long(argc, argv, "r:c:t:e:n:s:a:h:m:p:x", longOptions, &longIndex)) != -1)
 		{
 			switch (opt)


Fixes #516 (__has_builtin not present in pre-5.0 g++ versions) (Christian Sachs)

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@16308 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- DeviceAdapters/IIDC/MMIIDCCamera.cpp
+++ DeviceAdapters/IIDC/MMIIDCCamera.cpp
@@ -20,6 +20,10 @@
 // Prevent windows.h from defining the min and max macros, so that std::min
 // and std::max work
 #define NOMINMAX
+#endif
+
+#ifndef __has_builtin         // fix older g++ versions
+  #define __has_builtin(x) 0  // compatibility with non-clang compilers.
 #endif

 #include "MMIIDCCamera.h"


Moving loop_element to visitor.

Moving loop_element to visitor.

--- mu/llvmc/generator.cpp
+++ mu/llvmc/generator.cpp
@@ -549,6 +549,118 @@
                 }
                 predicate = function_m.process_predicates (predicate, element->source->arguments, position);
             }
+            void loop_element (mu::llvmc::skeleton::loop_element * loop_element) override
+            {
+                auto & context (function_m.module.target.module->getContext ());
+                llvm::Value * predicate (llvm::ConstantInt::getTrue (context));
+                std::vector <llvm::PHINode *> parameters;
+                auto loop_entry (llvm::BasicBlock::Create (context));
+                function_m.function_m->getBasicBlockList ().push_back (loop_entry);
+                {
+                    size_t position (0);
+                    auto end (loop_element->source->argument_predicate_offset);
+                    assert (loop_element->source->arguments.size () >= loop_element->source->argument_predicate_offset);
+                    for (auto i (loop_element->source->arguments.begin ()); position < end; ++i, ++position)
+                    {
+                        assert (i != loop_element->source->arguments.end ());
+                        auto value (mu::cast <mu::llvmc::skeleton::value> (*i));
+                        function_m.retrieve_value (value);
+                        predicate = function_m.and_predicates (predicate, value->predicate);
+                        auto loop_parameter (llvm::PHINode::Create (value->generated->getType (), 2));
+                        loop_parameter->addIncoming (value->generated, function_m.last);
+                        loop_entry->getInstList ().push_back (loop_parameter);
+                        assert (position < loop_element->source->parameters.size ());
+                        loop_element->source->parameters [position]->generated = loop_parameter;
+                        loop_element->source->parameters [position]->predicate = predicate;
+                        parameters.push_back (loop_parameter);
+                    }
+                    assert (position == loop_element->source->parameters.size ());
+                }
+                auto entry (function_m.last);
+                auto successor (llvm::BasicBlock::Create (context));
+                function_m.function_m->getBasicBlockList ().push_back (successor);
+                entry->getInstList ().push_back (llvm::BranchInst::Create (loop_entry, successor, predicate));
+                function_m.last = loop_entry;
+                auto feedback_branch (true);
+                auto branch_predicate (predicate);
+                llvm::Value * feedback_predicate;
+                size_t parameter_position (0);
+                size_t element_position (0);
+                auto empty (true);
+                loop_element->source->for_each_results (
+                                                        [&]
+                                                        (mu::llvmc::skeleton::node * node_a, size_t)
+                                                        {
+                                                            empty = false;
+                                                            auto value (mu::cast <mu::llvmc::skeleton::value> (node_a));
+                                                            function_m.retrieve_value (value);
+                                                            branch_predicate = function_m.and_predicates (branch_predicate, value->predicate);
+                                                            if (feedback_branch)
+                                                            {
+                                                                assert (parameter_position < parameters.size ());
+                                                                parameters [parameter_position]->addIncoming (value->generated, function_m.last);
+                                                                ++parameter_position;
+                                                            }
+                                                            else
+                                                            {
+                                                                auto real_value (llvm::PHINode::Create (value->generated->getType (), 2));
+                                                                real_value->addIncoming (llvm::UndefValue::get (value->generated->getType ()), function_m.last);
+                                                                real_value->addIncoming (value->generated, function_m.last);
+                                                                successor->getInstList ().push_back (real_value);
+                                                                parameters.push_back (real_value);
+                                                                auto real_predicate (llvm::PHINode::Create (value->predicate->getType (), 2));
+                                                                real_predicate->addIncoming (llvm::UndefValue::get (value->predicate->getType ()), function_m.last);
+                                                                real_predicate->addIncoming (value->predicate, function_m.last);
+                                                                successor->getInstList ().push_back (real_predicate);
+                                                                parameters.push_back (real_predicate);
+                                                                assert (element_position < loop_element->source->elements.size ());
+                                                                loop_element->source->elements [element_position]->generated = real_value;
+                                                                loop_element->source->elements [element_position]->predicate = real_predicate;
+                                                                ++element_position;
+                                                            }
+                                                        },
+                                                        [&]
+                                                        (mu::llvmc::skeleton::node * node_a, size_t)
+                                                        {
+                                                            assert (dynamic_cast <mu::llvmc::skeleton::value *> (node_a));
+                                                            auto value (static_cast <mu::llvmc::skeleton::value *> (node_a));
+                                                            function_m.retrieve_value (value);
+                                                            branch_predicate = function_m.and_predicates (branch_predicate, value->predicate);
+                                                        },
+                                                        mu::llvmc::skeleton::loop::empty_node,
+                                                        [&]
+                                                        (mu::llvmc::skeleton::node * node_a, size_t)
+                                                        {
+                                                            if (feedback_branch)
+                                                            {
+                                                                feedback_predicate = branch_predicate;
+                                                                feedback_branch = false;
+                                                            }
+                                                            if (empty)
+                                                            {
+                                                                auto real_predicate (llvm::PHINode::Create (branch_predicate->getType (), 2));
+                                                                real_predicate->addIncoming (llvm::UndefValue::get (branch_predicate->getType ()), function_m.last);
+                                                                real_predicate->addIncoming (branch_predicate, function_m.last);
+                                                                successor->getInstList ().push_back (real_predicate);
+                                                                parameters.push_back (real_predicate);
+                                                                assert (element_position < loop_element->source->elements.size ());
+                                                                loop_element->source->elements [element_position]->generated = nullptr;
+                                                                loop_element->source->elements [element_position]->predicate = real_predicate;
+                                                                ++element_position;
+                                                            }
+                                                            empty = true;
+                                                            branch_predicate = predicate;
+                                                        }
+                                                        );
+                for (auto i: parameters)
+                {
+                    i->setIncomingBlock (0, entry);
+                    i->setIncomingBlock (1, function_m.last);
+                }
+                auto feedback (llvm::BranchInst::Create (loop_entry, successor, feedback_predicate));
+                function_m.last->getInstList ().push_back (feedback);
+                function_m.last = successor;
+            }
         };
     }
 }
@@ -567,115 +679,6 @@
         auto loop_element (dynamic_cast <mu::llvmc::skeleton::loop_element *> (value_a));
         if (loop_element != nullptr)
         {
-            auto & context (module.target.module->getContext ());
-            llvm::Value * predicate (llvm::ConstantInt::getTrue (context));
-            std::vector <llvm::PHINode *> parameters;
-            auto loop_entry (llvm::BasicBlock::Create (context));
-            function_m->getBasicBlockList ().push_back (loop_entry);
-            {
-                size_t position (0);
-                auto end (loop_element->source->argument_predicate_offset);
-                assert (loop_element->source->arguments.size () >= loop_element->source->argument_predicate_offset);
-                for (auto i (loop_element->source->arguments.begin ()); position < end; ++i, ++position)
-                {
-                    assert (i != loop_element->source->arguments.end ());
-                    auto value (mu::cast <mu::llvmc::skeleton::value> (*i));
-                    retrieve_value (value);
-                    predicate = and_predicates (predicate, value->predicate);
-                    auto loop_parameter (llvm::PHINode::Create (value->generated->getType (), 2));
-                    loop_parameter->addIncoming (value->generated, last);
-                    loop_entry->getInstList ().push_back (loop_parameter);
-                    assert (position < loop_element->source->parameters.size ());
-                    loop_element->source->parameters [position]->generated = loop_parameter;
-                    loop_element->source->parameters [position]->predicate = predicate;
-                    parameters.push_back (loop_parameter);
-                }
-                assert (position == loop_element->source->parameters.size ());
-            }
-            auto entry (last);
-            auto successor (llvm::BasicBlock::Create (context));
-            function_m->getBasicBlockList ().push_back (successor);
-            entry->getInstList ().push_back (llvm::BranchInst::Create (loop_entry, successor, predicate));
-            last = loop_entry;
-            auto feedback_branch (true);
-            auto branch_predicate (predicate);
-            llvm::Value * feedback_predicate;
-            size_t parameter_position (0);
-            size_t element_position (0);
-            auto empty (true);
-            loop_element->source->for_each_results (
-                [&]
-                (mu::llvmc::skeleton::node * node_a, size_t)
-                {
-                    empty = false;
-                    auto value (mu::cast <mu::llvmc::skeleton::value> (node_a));
-                    retrieve_value (value);
-                    branch_predicate = and_predicates (branch_predicate, value->predicate);
-                    if (feedback_branch)
-                    {
-                        assert (parameter_position < parameters.size ());
-                        parameters [parameter_position]->addIncoming (value->generated, last);
-                        ++parameter_position;
-                    }
-                    else
-                    {
-                        auto real_value (llvm::PHINode::Create (value->generated->getType (), 2));
-                        real_value->addIncoming (llvm::UndefValue::get (value->generated->getType ()), last);
-                        real_value->addIncoming (value->generated, last);
-                        successor->getInstList ().push_back (real_value);
-                        parameters.push_back (real_value);
-                        auto real_predicate (llvm::PHINode::Create (value->predicate->getType (), 2));
-                        real_predicate->addIncoming (llvm::UndefValue::get (value->predicate->getType ()), last);
-                        real_predicate->addIncoming (value->predicate, last);
-                        successor->getInstList ().push_back (real_predicate);
-                        parameters.push_back (real_predicate);
-                        assert (element_position < loop_element->source->elements.size ());
-                        loop_element->source->elements [element_position]->generated = real_value;
-                        loop_element->source->elements [element_position]->predicate = real_predicate;
-                        ++element_position;
-                    }
-                },
-                [&]
-                (mu::llvmc::skeleton::node * node_a, size_t)
-                {
-                    assert (dynamic_cast <mu::llvmc::skeleton::value *> (node_a));
-                    auto value (static_cast <mu::llvmc::skeleton::value *> (node_a));
-                    retrieve_value (value);
-                    branch_predicate = and_predicates (branch_predicate, value->predicate);
-                },
-                mu::llvmc::skeleton::loop::empty_node,
-                [&]
-                (mu::llvmc::skeleton::node * node_a, size_t)
-                {
-                    if (feedback_branch)
-                    {
-                        feedback_predicate = branch_predicate;
-                        feedback_branch = false;
-                    }
-                    if (empty)
-                    {
-                        auto real_predicate (llvm::PHINode::Create (branch_predicate->getType (), 2));
-                        real_predicate->addIncoming (llvm::UndefValue::get (branch_predicate->getType ()), last);
-                        real_predicate->addIncoming (branch_predicate, last);
-                        successor->getInstList ().push_back (real_predicate);
-                        parameters.push_back (real_predicate);
-                        assert (element_position < loop_element->source->elements.size ());
-                        loop_element->source->elements [element_position]->generated = nullptr;
-                        loop_element->source->elements [element_position]->predicate = real_predicate;
-                        ++element_position;
-                    }
-                    empty = true;
-                    branch_predicate = predicate;
-                }
-            );
-            for (auto i: parameters)
-            {
-                i->setIncomingBlock (0, entry);
-                i->setIncomingBlock (1, last);
-            }
-            auto feedback (llvm::BranchInst::Create (loop_entry, successor, feedback_predicate));
-            last->getInstList ().push_back (feedback);
-            last = successor;
         }
         else
         {


Lint.

Lint.

--- base/arena_allocator_test.cpp
+++ base/arena_allocator_test.cpp
@@ -2,6 +2,7 @@
 #include "base/arena_allocator.hpp"

 #include <string>
+#include <vector>

 #include "gmock/gmock.h"
 #include "gtest/gtest.h"


[Test Boost] Good output message after parsing a schedule file with Classic version

git-svn-id: 543967457c07248534c6537446d108cd8c20cdb5@158 e67a024f-d144-4c12-b96e-b057add9d369

--- dsim/test/boost/spirit/schedule_parser.cpp
+++ dsim/test/boost/spirit/schedule_parser.cpp
@@ -886,17 +886,27 @@
                             boost::spirit::classic::space_p);

     // DEBUG
-    std::cout << "Flight Period:" << std::endl;
-    lFlightPeriod.display();
-
-    std::cout << "-------------------------" << std::endl;
+    //std::cout << "Flight Period:" << std::endl;
+    //lFlightPeriod.display();
+
+    const std::string hasBeenFullyReadStr = (info.full == true)?"":"not ";
+
     if (info.hit) {
-      std::cout << "Parsing succeeded" << std::endl;
+      std::cout << "Parsing of fare input file: " << lFilename
+                << " succeeded: read " << info.length
+                << " characters. \nThe input file has "
+                << hasBeenFullyReadStr
+                << "been fully read. Stop point: " << info.stop
+                << std::endl;

     } else {
-      std::cout << "Parsing failed" << std::endl;
-    }
-    std::cout << "-------------------------" << std::endl;
+      std::cout << "Parsing of fare input file: " << lFilename
+                << " failed: read " << info.length
+                << " characters. The input file has "
+                << hasBeenFullyReadStr
+                << "been fully read. Stop point: " << info.stop
+                << std::endl;
+    }

   } catch (const std::exception& stde) {
     std::cerr << "Standard exception: " << stde.what() << std::endl;


Killed logic_extents_per_physical, since I don't know how to handle it, and instituted tracks, to allow a decision about short versus long allocation units.

--- Storage/Disk/Parsers/CPM.hpp
+++ Storage/Disk/Parsers/CPM.hpp
@@ -22,9 +22,9 @@

 struct ParameterBlock {
 	int sectors_per_track;
+	int tracks;
 	int block_size;
 	int first_sector;
-	int logic_extents_per_physical;
 	uint16_t catalogue_allocation_bitmap;
 	int reserved_tracks;
 };


Add a sanity test that crashes under ASan. This should be used to check that the tests are built correctly.
Review URL: http://codereview.chromium.org/8240010

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

--- base/tools_sanity_unittest.cc
+++ base/tools_sanity_unittest.cc
@@ -121,6 +121,14 @@
   delete [] foo;
 }

+#ifdef ADDRESS_SANITIZER
+TEST(ToolsSanityTest, DISABLED_AddressSanitizerCrashTest) {
+  // Intentionally crash to make sure AddressSanitizer is running.
+  // This test should not be ran on bots.
+  int* volatile zero = NULL;
+  *zero = 0;
+}
+#endif

 namespace {


INTEGRATION: CWS warnings01 (1.11.4); FILE MERGED 2006/03/09 20:31:57 pl 1.11.4.1: #i55991# removed warnings for windows platform

--- dtrans/source/win32/dtobj/XTDataObject.hxx
+++ dtrans/source/win32/dtobj/XTDataObject.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: XTDataObject.hxx,v $
  *
- *  $Revision: 1.11 $
+ *  $Revision: 1.12 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-08 18:26:38 $
+ *  last change: $Author: hr $ $Date: 2006-06-20 06:06:42 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -58,9 +58,15 @@
 #include "FEtcList.hxx"
 #endif

+#if defined _MSC_VER
+#pragma warning(push,1)
+#endif
 #include <windows.h>
 #include <ole2.h>
 #include <objidl.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif

 /*--------------------------------------------------------------------------
     - the function principle of the windows clipboard:
@@ -89,6 +95,7 @@
 public:
     CXTDataObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& aXTransferable );
+    virtual ~CXTDataObject() {}

     //-----------------------------------------------------------------
     // ole interface implementation
@@ -159,6 +166,7 @@
 {
 public:
     CEnumFormatEtc( LPUNKNOWN lpUnkOuter, const CFormatEtcContainer& aFormatEtcContainer );
+    virtual ~CEnumFormatEtc() {}

     // IUnknown
     STDMETHODIMP           QueryInterface( REFIID iid, LPVOID* ppvObject );


Quick-fix the compliation error on Windows
TBR=phajdan.jr,glider
Review URL: http://codereview.chromium.org/3413032

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

--- base/tools_sanity_unittest.cc
+++ base/tools_sanity_unittest.cc
@@ -36,7 +36,7 @@
 }

 void ReadUninitializedValue(char *ptr) {
-  if (*ptr == true) {
+  if (*ptr == '\0') {
     (*ptr)++;
   } else {
     (*ptr)--;


r4171/sofa-dev : CHANGE: minor changes in the API of the SofaPluginManager

--- applications/sofa/gui/qt/SofaPluginManager.cpp
+++ applications/sofa/gui/qt/SofaPluginManager.cpp
@@ -81,7 +81,7 @@

     listPlugins->clear();
     typedef void (*componentLoader)();
-    typedef char* (*componentStr)();
+    typedef const char* (*componentStr)();

     for (int i=1 ; i<=size; i++)
     {
@@ -128,7 +128,7 @@

     //get the functions
     typedef void (*componentLoader)();
-    typedef char* (*componentStr)();
+    typedef const char* (*componentStr)();
     componentLoader componentLoaderFunc = (componentLoader) lib.resolve("initExternalModule");
     componentStr componentNameFunc = (componentStr) lib.resolve("getModuleName");

@@ -199,7 +199,7 @@
     listComponents->clear();
     QString location = curItem->text(1); //get the location value
     QLibrary lib(location);
-    typedef char* (*componentStr)();
+    typedef const char* (*componentStr)();
     componentStr componentListFunc = (componentStr) lib.resolve("getModuleComponentList");
     if(componentListFunc)
     {
@@ -216,7 +216,7 @@
     description->clear();
     QString location = curItem->text(1); //get the location value
     QLibrary lib(location);
-    typedef char* (*componentStr)();
+    typedef const char* (*componentStr)();
     componentStr componentDescFunc = (componentStr) lib.resolve("getModuleDescription");
     if(componentDescFunc)
     {


[playground.mapper.finitevolume] use UNUSED_UNLESS_DEBUG

--- dune/gdt/playground/mapper/finitevolume.hh
+++ dune/gdt/playground/mapper/finitevolume.hh
@@ -10,6 +10,8 @@

 #include <dune/common/dynvector.hh>
 #include <dune/common/typetraits.hh>
+
+#include <dune/stuff/common/debug.hh>

 #include "../../mapper/interface.hh"

@@ -82,13 +84,7 @@

   using InterfaceType::globalIndices;

-  size_t mapToGlobal(const EntityType& entity, const size_t&
-#ifndef NDEBUG
-                                                   localIndex
-#else
-/*localIndex*/
-#endif
-                     ) const
+  size_t mapToGlobal(const EntityType& entity, const size_t& UNUSED_UNLESS_DEBUG(localIndex)) const
   {
     assert(localIndex == 0);
     return backend_.index(entity);


fixed deletion of DSP factory

fixed deletion of DSP factory

--- Opcodes/faustgen.cpp
+++ Opcodes/faustgen.cpp
@@ -359,7 +359,6 @@
     prv = fobj;
     fobj = fobj->nxt;
   }
-
     if(fobj != NULL) {
       if(*pfobj == fobj) *pfobj = fobj->nxt;
       csound->Free(csound, fobj);
@@ -368,7 +367,8 @@
     } else
    csound->Warning(csound,
                       Str("could not find DSP %p for deletion"), pp->engine);
-  if(pp->factory) delete pp->factory;
+    if(pp->factory) deleteDSPFactory(pp->factory);
+
   return OK;
 }


INTEGRATION: CWS vgbugs07 (1.8.8); FILE MERGED 2007/06/04 13:22:19 vg 1.8.8.1: #i76605# Remove -I .../inc/module hack introduced by hedaburemove01

--- basic/source/uno/namecont.cxx
+++ basic/source/uno/namecont.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: namecont.cxx,v $
  *
- *  $Revision: 1.9 $
+ *  $Revision: 1.10 $
  *
- *  last change: $Author: ihi $ $Date: 2007-06-05 15:11:49 $
+ *  last change: $Author: hr $ $Date: 2007-06-27 14:33:56 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -76,7 +76,7 @@
 #endif

 #include "namecont.hxx"
-#include "basicmanagerrepository.hxx"
+#include <basic/basicmanagerrepository.hxx>

 #ifndef TOOLS_DIAGNOSE_EX_H
 #include <tools/diagnose_ex.h>
@@ -97,7 +97,7 @@
 #include <svtools/ehdl.hxx>
 #endif
 #ifndef _BASMGR_HXX
-#include "basmgr.hxx"
+#include <basic/basmgr.hxx>
 #endif

 #ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_
@@ -137,7 +137,7 @@
 #ifndef _CPPUHELPER_EXC_HLP_HXX_
 #include <cppuhelper/exc_hlp.hxx>
 #endif
-#include "sbmod.hxx"
+#include <basic/sbmod.hxx>

 namespace basic


remove unnecessary code

remove unnecessary code

--- muduo/net/TcpServer.cc
+++ muduo/net/TcpServer.cc
@@ -121,9 +121,5 @@
   EventLoop* ioLoop = conn->getLoop();
   ioLoop->queueInLoop(
       boost::bind(&TcpConnection::connectDestroyed, conn));
-  if (!ioLoop->isInLoopThread())
-  {
-    ioLoop->wakeup();
-  }
 }


Make error message more meaningful, not just 'nya kawaii'

--- branches/ultimate-repo/repo/realrepoclient.cpp
+++ branches/ultimate-repo/repo/realrepoclient.cpp
@@ -19,7 +19,7 @@
 	socket->connectToHost("127.0.0.1", 6666);
         if (!socket->waitForConnected(5*1000)) {
 //		emit socket->error(socket->error(), socket->errorString());
-		qDebug() << "nya kawaii" << endl;
+		qDebug() << "cannot connect to the server" << endl;
             return;
         }
 	m_error = socket->error();


[lldb] Insert break to avoid unannotated fall-through

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@374545 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
+++ source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
@@ -425,6 +425,7 @@
     case EHInstruction::Type::PUSH_REGISTER:
     case EHInstruction::Type::ALLOCATE:
       result += it->frame_offset;
+      break;
     default:
       break;
     }


[CDH5] IMPALA-748: Update IoMgr to use commented out HDFS API.

Change-Id: Ib42b6d01aed747c7decd2005ee3202e22a0acd49
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1765
Reviewed-by: Marcel Kornacker <44592b4eea36663c86b994bb0ea99d15309c1c7d@cloudera.com>
Tested-by: jenkins

--- be/src/runtime/disk-io-mgr.cc
+++ be/src/runtime/disk-io-mgr.cc
@@ -300,12 +300,9 @@
   // Disable checksumming for cached reads.
   int ret = hadoopRzOptionsSetSkipChecksum(cached_read_options_, true);
   DCHECK_EQ(ret, 0);
-#if 0
-  IMPALA-748
   // Disable automatic fallback for cached reads.
-  //ret = hadoopRzOptionsSetByteBufferPool(cached_read_options_, NULL);
-  //DCHECK_EQ(ret, 0);
-#endif
+  ret = hadoopRzOptionsSetByteBufferPool(cached_read_options_, NULL);
+  DCHECK_EQ(ret, 0);

   return Status::OK;
 }


debug

debug

--- benchmark/bench_inference.cpp
+++ benchmark/bench_inference.cpp
@@ -33,18 +33,18 @@
     //         vj_good_infer, vdj_good_prob,
     //         vdj_good_meta, vdj_good_infer;

-    std::string BENCH_DATA_FOLDER = argv[1];
+    // std::string BENCH_DATA_FOLDER = argv[1];

-    std::cout << "Data folder:\t[" << BENCH_DATA_FOLDER << "]" << endl;
+    // std::cout << "Data folder:\t[" << BENCH_DATA_FOLDER << "]" << endl;

     //
     // TCR alpha chain repertoire - VJ recombination
     //
     VDJRecombinationGenes vj_single_genes("Vgene",
-                                          BENCH_DATA_FOLDER + "trav.txt",
+                                          "/home/vadim/ymir/benchmark/data/trav.txt",
                                           "Jgene",
-                                          BENCH_DATA_FOLDER + "traj.txt");
+                                          "/home/vadim/ymir/benchmark/data/traj.txt");

     VDJRecombinationGenes vj_single_genes2(vj_single_genes);


bugfix change password check old password before calling service

- Credential.cpp
- GetSerialization
- case CPUS_CHANGE_PASSWORD
- make sure the old password is correct before calling pgina service

--- pGina/src/CredentialProvider/Credential.cpp
+++ pGina/src/CredentialProvider/Credential.cpp
@@ -325,6 +325,27 @@
 						BlockInput(false);
 					}
 					return S_FALSE;
+				}
+
+				HANDLE hToken;
+				if (!LogonUser(username, domain, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &hToken))
+				{
+					SHStrDupW(L"Your old password does not match", ppwszOptionalStatusText);
+					*pcpgsr = CPGSR_NO_CREDENTIAL_FINISHED;
+					*pcpsiOptionalStatusIcon = CPSI_ERROR;
+					if (hdialog != NULL)
+					{
+						DestroyWindow(hdialog);
+					}
+					else
+					{
+						BlockInput(false);
+					}
+					return S_FALSE;
+				}
+				else
+				{
+					CloseHandle(hToken);
 				}

 				DWORD mySession = pGina::Helpers::GetCurrentSessionId();


cppcheck: use prefix variant

cppcheck: use prefix variant

--- package/source/zippackage/zipfileaccess.cxx
+++ package/source/zippackage/zipfileaccess.cxx
@@ -277,7 +277,7 @@
     uno::Sequence< ::rtl::OUString > aNames( m_pZipFile->GetEntryHash().size() );
     sal_Int32 nLen = 0;

-    for ( EntryHash::iterator aIter = m_pZipFile->GetEntryHash().begin(); aIter != m_pZipFile->GetEntryHash().end(); aIter++ )
+    for ( EntryHash::iterator aIter = m_pZipFile->GetEntryHash().begin(); aIter != m_pZipFile->GetEntryHash().end(); ++aIter )
     {
         if ( aNames.getLength() < ++nLen )
         {
@@ -362,7 +362,7 @@
     // Code to compare strings by patterns
     uno::Sequence< ::rtl::OUString > aPattern = GetPatternsFromString_Impl( aPatternString );

-    for ( EntryHash::iterator aIter = m_pZipFile->GetEntryHash().begin(); aIter != m_pZipFile->GetEntryHash().end(); aIter++ )
+    for ( EntryHash::iterator aIter = m_pZipFile->GetEntryHash().begin(); aIter != m_pZipFile->GetEntryHash().end(); ++aIter )
     {
         if ( StringGoodForPattern_Impl( (*aIter).second.sPath, aPattern ) )
         {


Update CloseIdleSockets to close out FLIP connections as
well as HTTP connections.  This is used for benchmarking.

BUG=none
TEST=none

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

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


Bug:#1380771 Adding the load balancer session persistence parameters fro Service Instance's Virtual ip. The session persistense type and name are written to haproxy configuration file in the backend section

Change-Id: I44a2b5c750f2ab62221d5bd43925df3de2dc85cd

--- src/vnsw/agent/oper/loadbalancer_haproxy.cc
+++ src/vnsw/agent/oper/loadbalancer_haproxy.cc
@@ -158,6 +158,21 @@
                  << hm.expected_codes << endl;
         }
     }
+    const autogen::VirtualIpType &vip = props.vip_properties();
+    if (vip.persistence_type == "HTTP_COOKIE") {
+        *out << string(4, ' ') << "cookie SRV insert indirect nocache"
+             << endl;
+    }
+    if (vip.persistence_type == "SOURCE_IP") {
+        *out << string(4, ' ') << "stick-table type ip size 10k"
+             << endl;
+        *out << string(4, ' ') << "stick on src" << endl;
+    }
+    if (vip.persistence_type == "APP_COOKIE" &&
+            !vip.persistence_cookie_name.empty()) {
+        *out << string(4, ' ') << "appsession " <<
+            vip.persistence_cookie_name << " len 56 timeout 3h" << endl;
+    }

     for (LoadbalancerProperties::MemberMap::const_iterator iter =
                  props.members().begin();


Fixed XInputGetKeystroke.

Fixed XInputGetKeystroke.

--- src/xenia/hid/xinput/xinput_input_driver.cc
+++ src/xenia/hid/xinput/xinput_input_driver.cc
@@ -86,13 +86,11 @@
   // flags is reserved on desktop.
   XINPUT_KEYSTROKE native_keystroke;
   DWORD result = XInputGetKeystroke(user_index, flags, &native_keystroke);
-  if (result == ERROR_SUCCESS) {
-    out_keystroke->virtual_key = native_keystroke.VirtualKey;
-    out_keystroke->unicode = native_keystroke.Unicode;
-    out_keystroke->flags = native_keystroke.Flags;
-    out_keystroke->user_index = native_keystroke.UserIndex;
-    out_keystroke->hid_code = native_keystroke.HidCode;
-  }
+  out_keystroke->virtual_key = native_keystroke.VirtualKey;
+  out_keystroke->unicode = native_keystroke.Unicode;
+  out_keystroke->flags = native_keystroke.Flags;
+  out_keystroke->user_index = native_keystroke.UserIndex;
+  out_keystroke->hid_code = native_keystroke.HidCode;
   // X_ERROR_EMPTY if no new keys
   // X_ERROR_DEVICE_NOT_CONNECTED if no device
   // X_ERROR_SUCCESS if key


Corrected minor bug

Corrected minor bug

--- src/xerus/indexedTensor_tensor_evaluate.cpp
+++ src/xerus/indexedTensor_tensor_evaluate.cpp
@@ -238,19 +238,12 @@
 		_base.assign_indices();
 		_out.assign_indices();

-		// If there is no index reshuffling, the evalutation is trivial (NOTE must be after index assignment so span zero indices are erased. Otherwise empty index arrays may occur)
-		if(_base.indices == _out.indices) {
-			*_out.tensorObject = *_base.tensorObjectReadOnly;
-			return; // We are finished here
-		}
+

 		// Assign the dimensions
 		_base.assign_index_dimensions();
 		_out.assign_index_dimensions();

-		// Extract base index dimensions and stepSizes
-		const std::vector<size_t> baseIndexStepSizes(get_step_sizes(_base.indices));
-		const std::vector<size_t> baseIndexDimensions(get_dimension_vector(_base.indices));

 		#ifndef DISABLE_RUNTIME_CHECKS_ // Performe complete check whether the input is valid
 			// Check base indices
@@ -286,6 +279,16 @@
 				REQUIRE(misc::count(_base.indices, _out.indices[i]) == 1, "Every index of the target must appear exactly once in the base of evaluation. Base: " << _base.indices << " Out: " << _out.indices);
 			}
 		#endif
+
+		// If there is no index reshuffling, the evalutation is trivial (NOTE must be after index assignment so span zero indices are erased. Otherwise empty index arrays may occur)
+		if(_base.indices == _out.indices) {
+			*_out.tensorObject = *_base.tensorObjectReadOnly;
+			return; // We are finished here
+		} // TODO in front of dimension assignment
+
+		// Extract base index dimensions and stepSizes
+		const std::vector<size_t> baseIndexStepSizes(get_step_sizes(_base.indices));
+		const std::vector<size_t> baseIndexDimensions(get_dimension_vector(_base.indices));

 		//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Full => Full   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 		if(_base.tensorObjectReadOnly->is_dense()) {


[m_bancila-modern_cpp_progr_cookbook-2_ed][ch 01] slightly rewrite the 1-st example

--- books/tech/cpp/std-20/m_bancila-modern_cpp_progr_cookbook-2_ed/ch_01-core_features/01-using_auto_whenever_possible/main.cpp
+++ books/tech/cpp/std-20/m_bancila-modern_cpp_progr_cookbook-2_ed/ch_01-core_features/01-using_auto_whenever_possible/main.cpp
@@ -1,12 +1,16 @@
-#include <iostream>
-#include <map>
+#include <initializer_list>
 #include <memory>
 #include <string>
 #include <vector>
 #include <cctype>
-namespace workspace {
+namespace example_01 { // -> the "how to do it..." section

-void example_01() { // -> the "how to do it" section
+template <typename F, typename T>
+auto apply(F&& f, T value) {
+    return f(value);
+}
+
+void run() {
     {
         auto i = 42;
         auto d = 42.5;
@@ -15,10 +19,10 @@
     }

     {
-        auto b = new char[10]{0};
+        auto b  = new char[10]{ 0 };
         auto s1 = std::string{"text"};
         auto v1 = std::vector<int>{ 1, 2, 3 };
-        auto p = std::make_shared<int>(42);
+        auto p  = std::make_shared<int>(42);
     }

     {
@@ -28,35 +32,53 @@
     {
         auto add = [](auto const a, auto const b) { return a + b; };
     }
+
+    {
+        const auto func = [](const int value) { return value + 1; };
+        apply(func, 10);
+    }
 }
+} // example_01 -> the "how to do it..." section

-void example_02() { // -> the "how it works" section
+
+#include <iostream>
+#include <map>
+#include <string>
+#include <vector>
+namespace example_02 { // -> the "how it works..." section
+
+struct {
+    template <typename T, typename U>
+    auto operator()(T const a, U const b) const { return a + b; }
+} lstruct;
+
+void run() {
     {
-        auto v = std::vector<int>{ 1, 2, 3 };
+        const auto v = std::vector<int>{ 1, 2, 3 };
+        int size1 = v.size(); // possible loss of data
         auto size2 = v.size();
+        // auto size3 = int{ v.size() }; // error
     }

     {
-        std::map<int, std::string> m;
+        std::map<int, std::string> m{};
         for (std::map<int, std::string>::const_iterator it = m.cbegin();
             it != m.cend();
             ++it)
-        { /* ... */ }
+        { /* ... */}

         for (auto it = m.cbegin(); it != m.cend(); ++it)
-        { /* ... */ }
+        { /* ... */ }
     }

     {
         class foo {
             int x_;
         public:
-            foo(int const x = 0) : x_{x} {}
+            foo(int const x = 0) : x_{ x } {}
             int& get() { return x_; }
         };
-
-        foo f(42);
-
+        foo f{42};
         auto x = f.get();
         x = 100;
         std::cout << f.get() << '\n';
@@ -83,35 +105,52 @@
         class foo {
             int x_;
         public:
-            foo(int const x = 0) : x_{ x } {}
+            foo(int const x = 0) : x_{x} {}
+            int& get() { return x_; }
+
+            static auto proxy_get(foo& f) { return f.get(); }
+        };
+
+        auto f = foo{42};
+        // auto& x = foo::proxy_get(f); // error
+    }
+
+    {
+        class foo {
+            int x_;
+        public:
+            foo(int const x = 0) : x_{x} {}
             int& get() { return x_; }

             static decltype(auto) proxy_get(foo& f) { return f.get(); }
         };

-        auto f = foo{ 42 };
+        auto f = foo{42};
         decltype(auto) x = foo::proxy_get(f);
     }

     {
         using namespace std::string_literals;
-
-        auto ladd = [] (auto const a, auto const b) { return a + b; };
+
+        auto ladd = [](auto const a, auto const b) { return a + b; };
         auto i = ladd(40, 2);
         auto s = ladd("forty"s, "two"s);
     }
+
+    {
+        using namespace std::string_literals;
+
+        auto i = lstruct(40, 2);
+        auto s = lstruct("forty"s, "two"s);
+    }
 }
-
-void run() {
-    std::cout << "how to do it =>" << std::endl; example_01(); std::cout << std::endl;
-    std::cout << "how it works =>" << std::endl; example_02(); std::cout << std::endl;
-}
-
-} // workspace
+} // example_02 -> the "how it works..." section

+#include <iostream>
 int main() {
-    workspace::run();
-
+    std::cout << "example_01 =>" << std::endl; example_01::run(); std::cout << std::endl;
+    std::cout << "example_02 =>" << std::endl; example_02::run(); std::cout << std::endl;
+
     return 0;
 }


Add return value check for read/write syscalls

The returned result from those syscalls are from untrusted side and can
not be trusted. It could cause security issues if users use them without
checking.

Fixes #67

PiperOrigin-RevId: 359382470
Change-Id: I9e72808c023aaee1778a4a8e457c3018f80c2ec8

--- asylo/platform/host_call/trusted/host_calls.cc
+++ asylo/platform/host_call/trusted/host_calls.cc
@@ -236,8 +236,13 @@
 }

 ssize_t enc_untrusted_write(int fd, const void *buf, size_t count) {
-  return static_cast<ssize_t>(EnsureInitializedAndDispatchSyscall(
+  ssize_t ret = static_cast<ssize_t>(EnsureInitializedAndDispatchSyscall(
       asylo::system_call::kSYS_write, fd, buf, count));
+  if (ret != -1 && ret > count) {
+    ::asylo::primitives::TrustedPrimitives::BestEffortAbort(
+        "enc_untrusted_read: read result exceeds requested");
+  }
+  return ret;
 }

 int enc_untrusted_symlink(const char *target, const char *linkpath) {
@@ -246,8 +251,13 @@
 }

 ssize_t enc_untrusted_readlink(const char *pathname, char *buf, size_t bufsiz) {
-  return static_cast<ssize_t>(EnsureInitializedAndDispatchSyscall(
+  ssize_t ret = static_cast<ssize_t>(EnsureInitializedAndDispatchSyscall(
       asylo::system_call::kSYS_readlink, pathname, buf, bufsiz));
+  if (ret != -1 && ret > bufsiz) {
+    ::asylo::primitives::TrustedPrimitives::BestEffortAbort(
+        "enc_untrusted_read: read result exceeds requested");
+  }
+  return ret;
 }

 int enc_untrusted_truncate(const char *path, off_t length) {
@@ -446,14 +456,24 @@
 }

 int enc_untrusted_pread64(int fd, void *buf, size_t count, off_t offset) {
-  return EnsureInitializedAndDispatchSyscall(asylo::system_call::kSYS_pread64,
-                                             fd, buf, count, offset);
+  int ret = EnsureInitializedAndDispatchSyscall(
+      asylo::system_call::kSYS_pread64, fd, buf, count, offset);
+  if (ret != -1 && ret > count) {
+    ::asylo::primitives::TrustedPrimitives::BestEffortAbort(
+        "enc_untrusted_read: read result exceeds requested");
+  }
+  return ret;
 }

 int enc_untrusted_pwrite64(int fd, const void *buf, size_t count,
                            off_t offset) {
-  return EnsureInitializedAndDispatchSyscall(asylo::system_call::kSYS_pwrite64,
-                                             fd, buf, count, offset);
+  int ret = EnsureInitializedAndDispatchSyscall(
+      asylo::system_call::kSYS_pwrite64, fd, buf, count, offset);
+  if (ret != -1 && ret > count) {
+    ::asylo::primitives::TrustedPrimitives::BestEffortAbort(
+        "enc_untrusted_read: read result exceeds requested");
+  }
+  return ret;
 }

 int enc_untrusted_isatty(int fd) {


gp4par: Changed congestion metrics for better avoidance of congestion

--- src/gp4par/Greenpak4PAREngine.cpp
+++ src/gp4par/Greenpak4PAREngine.cpp
@@ -200,7 +200,7 @@

 	//Squaring each half makes minimizing the larger one more important
 	//vs if we just summed. Also add in a fixed penalty if we are using >100% resources
-	uint32_t cost = sqrt(costs[0]*costs[0] + costs[1]*costs[1]);
+	uint32_t cost = costs[0]*costs[0] + costs[1]*costs[1];
 	if( (costs[0] > 10) || (costs[1] > 10) )
 		cost += 20;
 	return cost;


Add f suffix to 0.5 to fix mac 10.6 warning

BUG=skia:2195

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

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@13500 2bbb7eff-a529-9590-31e7-b0007b416f81

--- src/gpu/effects/GrRRectEffect.cpp
+++ src/gpu/effects/GrRRectEffect.cpp
@@ -15,7 +15,7 @@

 // This effect only supports circular corner rrects where all corners have the same radius
 // which must be <= kRadiusMin.
-static const SkScalar kRadiusMin = 0.5;
+static const SkScalar kRadiusMin = 0.5f;

 //////////////////////////////////////////////////////////////////////////////
 class GrGLRRectEffect : public GrGLEffect {


Added __errno_location

Added __errno_location

--- src/syscalls.cpp
+++ src/syscalls.cpp
@@ -163,3 +163,9 @@
   printf("\tHeap end: %p \n",heap_end);
   kill(1, 1);
 }
+
+static int __errno__;
+
+extern "C" {
+  int * __errno_location(void){ return &__errno__; }
+}


BUG#16155: Workaround AIX 5.2 64-bit compiler bug.

--- sql/sql_delete.cc
+++ sql/sql_delete.cc
@@ -890,7 +890,9 @@
   }

   // Remove the .frm extension
-  *(path + path_length - reg_ext_length)= '\0';
+  // AIX 5.2 64-bit compiler bug (BUG#16155): this crashes, replacement works.
+  //   *(path + path_length - reg_ext_length)= '\0';
+  path[path_length - reg_ext_length] = 0;
   error= ha_create_table(thd, path, table_list->db, table_list->table_name,
                          &create_info, 1);
   query_cache_invalidate3(thd, table_list, 0);


Fix incorrect merge

Fix incorrect merge

--- sql/sql_select.cc
+++ sql/sql_select.cc
@@ -14587,6 +14587,7 @@
                         &tmpname, (uint) strlen(path)+1,
                         &group_buff, (!using_unique_constraint ?
                                       uniq_tuple_length_arg : 0),
+                        &bitmaps, bitmap_buffer_size(1)*3,
                         NullS))
   {
     if (temp_pool_slot != MY_BIT_NONE)
@@ -16086,45 +16087,6 @@
     rc= NESTED_LOOP_OK;
   DBUG_RETURN(rc);
 }
-
-
-/*
-  SemiJoinDuplicateElimination: Weed out duplicate row combinations
-
-  SYNPOSIS
-    do_sj_dups_weedout()
-      thd    Thread handle
-      sjtbl  Duplicate weedout table
-
-  DESCRIPTION
-    Try storing current record combination of outer tables (i.e. their
-    rowids) in the temporary table. This records the fact that we've seen
-    this record combination and also tells us if we've seen it before.
-
-  RETURN
-    -1  Error
-    1   The row combination is a duplicate (discard it)
-    0   The row combination is not a duplicate (continue)
-*/
-
-int do_sj_dups_weedout(THD *thd, SJ_TMP_TABLE *sjtbl)
-{
-  int error;
-  SJ_TMP_TABLE::TAB *tab= sjtbl->tabs;
-  SJ_TMP_TABLE::TAB *tab_end= sjtbl->tabs_end;
-
-  DBUG_ENTER("do_sj_dups_weedout");
-
-  if (sjtbl->is_confluent)
-  {
-    if (sjtbl->have_confluent_row)
-      DBUG_RETURN(1);
-    else
-    {
-      sjtbl->have_confluent_row= TRUE;
-      DBUG_RETURN(0);
-    }
-  }

 /*


Changes from code review #5280

Changes from code review #5280

--- src/condor_starter.V6.1/vanilla_proc.cpp
+++ src/condor_starter.V6.1/vanilla_proc.cpp
@@ -640,17 +640,17 @@
 				// Note that ATTR_VIRTUAL_MEMORY on Linux
 				// is sum of memory and swap, in Kilobytes

-				if (MachineAd->LookupInteger(ATTR_VIRTUAL_MEMORY, MemMb)) {
-					uint64_t VMemkb_big = MemMb;
-
-					uint64_t memsw_limit = 1024 * VMemkb_big;
-					if (MemMb > 0) {
+				int VMemKb;
+				if (MachineAd->LookupInteger(ATTR_VIRTUAL_MEMORY, VMemKb)) {
+
+					uint64_t memsw_limit = 1024 * VMemKb;
+					if (VMemKb > 0) {
 						// we're not allowed to set memsw limit <
 						// the hard memory limit.  If we haven't set the hard
 						// memory limit, the default may be infinity.
-						// So, if we've set soft, set hard limit to memsw
+						// So, if we've set soft, set hard limit to memsw - one page
 						if (mem_is_soft) {
-							uint64_t hard_limit = 1024 * VMemkb_big;
+							uint64_t hard_limit = memsw_limit - 4096;
 							climits.set_memory_limit_bytes(hard_limit, false);
 						}
 						climits.set_memsw_limit_bytes(memsw_limit);


fixed restart of the rover-cv

fixed restart of the rover-cv

--- trikControl/src/cameraLineDetectorSensorWorker.cpp
+++ trikControl/src/cameraLineDetectorSensorWorker.cpp
@@ -36,19 +36,7 @@
 	, mOutputFile(outputFile)
 	, mReady(false)
 {
-	qDebug() << "CameraLineDetectorSensorWorker::CameraLineDetectorSensorWorker";
-
 	qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
-}
-
-CameraLineDetectorSensorWorker::~CameraLineDetectorSensorWorker()
-{
-	deinitialize();
-}
-
-void CameraLineDetectorSensorWorker::moveChildrenToCorrectThread()
-{
-	mRoverCvProcess.moveToThread(this->thread());

 	connect(&mRoverCvProcess, SIGNAL(error(QProcess::ProcessError))
 			, this, SLOT(onRoverCvError(QProcess::ProcessError)), Qt::QueuedConnection);
@@ -60,18 +48,26 @@
 			, this, SLOT(onRoverCvReadyReadStandardOutput()), Qt::QueuedConnection);
 }

+CameraLineDetectorSensorWorker::~CameraLineDetectorSensorWorker()
+{
+	deinitialize();
+}
+
+void CameraLineDetectorSensorWorker::moveChildrenToCorrectThread()
+{
+	mRoverCvProcess.moveToThread(this->thread());
+}
+
 void CameraLineDetectorSensorWorker::init()
 {
-	qDebug() << "CameraLineDetectorSensorWorker::init()";
-	if (!mReady) {
+	if (!mReady || !mInputFile.exists() || !mOutputFile.exists()) {
 		initDetector();
 	}
 }

 void CameraLineDetectorSensorWorker::detect()
 {
-	qDebug() << "CameraLineDetectorSensorWorker::detect()";
-	if (!mReady) {
+	if (!mReady || !mInputFile.exists() || !mOutputFile.exists()) {
 		init();
 	}

@@ -86,8 +82,6 @@

 void CameraLineDetectorSensorWorker::initDetector()
 {
-	qDebug() << "initDetector()";
-
 	if (!mInputFile.exists() || !mOutputFile.exists()) {
 		startRoverCv();
 	} else {
@@ -105,14 +99,16 @@

 void CameraLineDetectorSensorWorker::onRoverCvReadyReadStandardOutput()
 {
-	qDebug() << "onRoverCvReadyReadStandardOutput";
-
 	QString const data = mRoverCvProcess.readAllStandardOutput();
 	QStringList const lines = data.split("\n");
 	foreach (QString const line, lines) {
 		qDebug() << "From rover-cv:" << line;
 		if (line == "Entering video thread loop") {
 			openFifos();
+		}
+		if (line == "Terminating") {
+			mReady = false;
+			deinitialize();
 		}
 	}
 }
@@ -188,8 +184,12 @@

 	qDebug() << "Starting rover-cv";

+	if (mRoverCvProcess.state() == QProcess::Running) {
+		mRoverCvProcess.close();
+	}
+
 	mRoverCvProcess.setWorkingDirectory(roverCvBinaryFileInfo.absolutePath());
-	mRoverCvProcess.start(roverCvBinaryFileInfo.filePath());
+	mRoverCvProcess.start(roverCvBinaryFileInfo.filePath(), QIODevice::ReadOnly | QIODevice::Unbuffered);

 	mRoverCvProcess.waitForStarted();

@@ -228,7 +228,7 @@
 	mSocketNotifier.reset(new QSocketNotifier(mOutputFileDescriptor, QSocketNotifier::Read));

 	connect(mSocketNotifier.data(), SIGNAL(activated(int)), this, SLOT(readFile()));
-	mSocketNotifier->setEnabled(true);
+	mSocketNotifier->setEnabled(false);

 	qDebug() << "opening" << mInputFile.fileName();

@@ -260,7 +260,7 @@

 void CameraLineDetectorSensorWorker::deinitialize()
 {
-	disconnect(mSocketNotifier.data(), SIGNAL(activated(int)), this, SLOT(readFifo()));
+	disconnect(mSocketNotifier.data(), SIGNAL(activated(int)), this, SLOT(readFile()));
 	mSocketNotifier->setEnabled(false);
 	if (::close(mOutputFileDescriptor) != 0) {
 		qDebug() << mOutputFile.fileName() << ": fifo close failed: " << errno;


Correctly handle upgrades from 3.0 registration.xml files, which do not have
instance_id or gruu columns.

git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@5631 a612230a-c5fa-0310-af8b-88eea846685b

--- sipXcommserverLib/src/sipdb/RegistrationDB.cpp
+++ sipXcommserverLib/src/sipdb/RegistrationDB.cpp
@@ -333,19 +333,29 @@
     UtlString cseqStr = *((UtlString*)nvPairs.findValue(&gCseqKey));
     int cseq = (int) atoi( cseqStr );

-    // If the IMDB does not specify a Q-Value % will be found here (represengint a null IMDB column)
+    // If the IMDB does not specify a Q-Value % will be found here
+    // (represengint a null IMDB column)
     UtlString qvalue = *((UtlString*)nvPairs.findValue(&gQvalueKey));
+
+    // Get the remaining fields so that we can substitute the null string
+    // if the fetched value is 0 (the null pointer) because the field
+    // is not present in the disk file.
+    static UtlString nullString("");
+    UtlString* contact = (UtlString*) nvPairs.findValue(&gContactKey);
+    UtlString* callId = (UtlString*) nvPairs.findValue(&gCallidKey);
+    UtlString* instanceId = (UtlString*) nvPairs.findValue(&gInstanceIdKey);
+    UtlString* gruu = (UtlString*) nvPairs.findValue(&gGruuKey);

     // Note: identity inferred from the uri
     updateBinding (
         Url(*((UtlString*)nvPairs.findValue(&gUriKey))),
-        *((UtlString*)nvPairs.findValue(&gContactKey)),
+        *(contact ? contact : &nullString),
         qvalue,
-        *((UtlString*)nvPairs.findValue(&gCallidKey)),
+        *(callId ? callId : &nullString),
         cseq,
         expires,
-        *((UtlString*)nvPairs.findValue(&gInstanceIdKey)),
-        *((UtlString*)nvPairs.findValue(&gGruuKey))
+        *(instanceId ? instanceId : &nullString),
+        *(gruu ? gruu : &nullString)
                    );
 }


pw_kvs: Fix sectors test

pw_kvs: Fix sectors test

Add sectors_ reset as part of the fixture, since reset is required
before using sectors_. This prevents using uninitialized members, which
sometimes passes tests.

Change-Id: I293b3fe927eca1ec187f31b25087e8b2db3168d5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13842
Commit-Queue: David Rogers <82b08570d73cda922b440ccc756abc5b3ef4c372@google.com>
Reviewed-by: Wyatt Hepler <cca3bedb37979eacd157a9bceb473582df8aea1e@google.com>

--- pw_kvs/sectors_test.cc
+++ pw_kvs/sectors_test.cc
@@ -24,7 +24,10 @@
  protected:
   SectorsTest()
       : partition_(&flash_),
-        sectors_(sector_descriptors_, partition_, nullptr) {}
+        sectors_(sector_descriptors_, partition_, nullptr) {
+    EXPECT_EQ(0u, sectors_.size());
+    sectors_.Reset();
+  }

   FakeFlashMemoryBuffer<128, 16> flash_;
   FlashPartition partition_;
@@ -33,10 +36,7 @@
 };

 TEST_F(SectorsTest, Reset) {
-  EXPECT_EQ(0u, sectors_.size());
-
-  sectors_.Reset();
-
+  // Reset is done by the fixture.
   EXPECT_EQ(partition_.sector_count(), sectors_.size());
   EXPECT_EQ(32u, sectors_.max_size());
   EXPECT_EQ(sectors_.begin(), sectors_.last_new());


INTEGRATION: CWS bitcount01 (1.14.60); FILE MERGED 2006/04/13 23:33:49 thb 1.14.60.2: RESYNC: (1.14-1.15); FILE MERGED 2006/04/11 09:42:08 thb 1.14.60.1: #i63959# Discretizing bitcount for tiff, ras and pict export

--- goodies/source/filter.vcl/epict/epict.cxx
+++ goodies/source/filter.vcl/epict/epict.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: epict.cxx,v $
  *
- *  $Revision: 1.16 $
+ *  $Revision: 1.17 $
  *
- *  last change: $Author: hr $ $Date: 2006-06-19 21:42:21 $
+ *  last change: $Author: obo $ $Date: 2006-07-10 14:19:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -955,6 +955,11 @@
         return;

     nBitsPerPixel = aBitmap.GetBitCount();
+
+    // export code below only handles four discrete cases
+    nBitsPerPixel =
+        nBitsPerPixel <= 1 ? 1 : nBitsPerPixel <= 4 ? 4 : nBitsPerPixel <= 8 ? 8 : 24;
+
     nWidth = pAcc->Width();
     nHeight = pAcc->Height();


リファクタリング ： コピーコンストラクタ = default; など

リファクタリング ： コピーコンストラクタ = default; など

--- vbSort.cpp
+++ vbSort.cpp
@@ -11,6 +11,9 @@
 public:
     compareByVBAfunc(VARIANT* pA, VARIANT* f) : begin(pA), comp(std::make_shared<functionExpr>(f))
     {    }
+    compareByVBAfunc(compareByVBAfunc const&) = default;
+    compareByVBAfunc(compareByVBAfunc&&) = delete;
+    ~compareByVBAfunc() = default;
     bool valid() const  { return static_cast<bool>(comp);  }
     bool operator ()(__int32 i, __int32 j) const
     {
@@ -22,7 +25,10 @@
 class compFunctor  {
     VARIANT*    begin;
 public:
-    compFunctor(VARIANT* pA) : begin(pA) { }
+    explicit compFunctor(VARIANT* pA) : begin(pA) { }
+    compFunctor(compFunctor const&) = default;
+    compFunctor(compFunctor&&) = delete;
+    ~compFunctor() = default;
     bool operator ()(__int32 i, __int32 j) const
     {
         return VARCMP_LT == VarCmp(begin + i, begin + j, LANG_JAPANESE, 0);
@@ -33,7 +39,10 @@
 class compDictionaryFunctor  {
     VARIANT*    begin;
 public:
-    compDictionaryFunctor(VARIANT* pA) : begin(pA) { }
+    explicit compDictionaryFunctor(VARIANT* pA) : begin(pA) { }
+    compDictionaryFunctor(compDictionaryFunctor const&) = default;
+    compDictionaryFunctor(compDictionaryFunctor&&) = delete;
+    ~compDictionaryFunctor() = default;
     bool operator ()(__int32 i, __int32 j) const
     {
         safearrayRef arr1(begin + i);


Fixing segfault when referencing iterator

--- symtable.cc
+++ symtable.cc
@@ -128,7 +128,7 @@
 		std::deque<AbstractSymbol*>::iterator it;
 		for(it = b.begin(); it != b.end(); ++it) {\
 			std::size_t index = it - b.begin();
-			ss << (*(b[i]))->to_string(depth) << std::endl;
+			ss << (*(b[i])).to_string(depth) << std::endl;
 			//ss << (*it)->to_string(depth) << std::endl;
 		}
 	}


a fix (bug #10303: Misleading Last_query_cost value).

--- sql/sql_select.cc
+++ sql/sql_select.cc
@@ -540,6 +540,9 @@
   if (optimized)
     DBUG_RETURN(0);
   optimized= 1;
+
+  if (thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS)
+    thd->status_var.last_query_cost= 0.0;

   row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
 	      unit->select_limit_cnt);


exceptions

exceptions

--- vtrc-common/vtrc-exception.cpp
+++ vtrc-common/vtrc-exception.cpp
@@ -11,6 +11,7 @@
     namespace {

         const std::string unknown_error("Unknown error");
+        const unsigned default_category = vtrc_errors::CATEGORY_INTERNAL;

         const std::string &get_internal_error( unsigned code )
         {
@@ -41,7 +42,7 @@

         std::string get_error_code_string( unsigned code )
         {
-            return get_error_code_string(code, vtrc_errors::CATEGORY_INTERNAL);
+            return get_error_code_string( code, default_category );
         }

     }
@@ -61,20 +62,18 @@
         ,code_(code)
         ,category_(code_category)
         ,additional_(additional)
-    {
-
-    }
+    { }

     exception::exception( unsigned code )
         :std::runtime_error(get_error_code_string(code))
         ,code_(code)
-        ,category_(vtrc_errors::CATEGORY_INTERNAL)
+        ,category_(default_category)
     { }

     exception::exception( unsigned code, const std::string &additional )
         :std::runtime_error(get_error_code_string(code))
         ,code_(code)
-        ,category_(vtrc_errors::CATEGORY_INTERNAL)
+        ,category_(default_category)
         ,additional_(additional)
     { }


bug fix 2

bug fix 2

--- src/tokenizer.cc
+++ src/tokenizer.cc
@@ -27,8 +27,8 @@

     for (const auto& pattern : root) {
         const Pattern& pat = (pattern.include != nullptr)? *pattern.include : pattern;
-        if (pattern.begin.empty()) {
-            for_all_subrules(root, callback, max_depth - 1);
+        if (pat.begin.empty()) {
+            for_all_subrules(pat.patterns, callback, max_depth - 1);
         } else {
             callback(pat);
         }
@@ -64,9 +64,7 @@
     bool is_close = false;

     // first find pattern or end pattern, whichever comes first
-    for_all_subrules(pattern.patterns, [&found_pattern, &first_match, pos, &text](const Pattern& pattern) {
-        const Pattern& sub_pattern = (pattern.include == nullptr)? pattern : *pattern.include;
-
+    for_all_subrules(pattern.patterns, [&found_pattern, &first_match, pos, &text](const Pattern& sub_pattern) {
         Match tmp = sub_pattern.begin.match(text, pos);
         if (tmp != Match::NOT_MATCHED) {
             if( found_pattern == nullptr || tmp[0].position < first_match[0].position) {
@@ -163,7 +161,7 @@
             Match end_match = tokenize(text, *found_pattern, match, stack, child_tokens);

             Range name_range = Range(match[0].position, end_match[0].end() - match[0].position);
-            add_scope(tokens, name_range, stack, "");
+            add_scope(tokens, name_range, stack, found_pattern->name);
             process_capture(tokens, match, stack, found_pattern->begin_captures);

             Range content_range = Range(match[0].end(), end_match[0].position - match[0].end());


Minor change

Minor change

--- src/connected_component_segmentation.cpp
+++ src/connected_component_segmentation.cpp
@@ -52,7 +52,7 @@
     min_segment_size_ = min_segment_size;
     max_segment_size_ = max_segment_size;

-    std::vector<bool> has_been_assigned(points_->size(), 0);
+    std::vector<bool> has_been_assigned(points_->size(), false);

     std::vector<size_t> neighbors;
     std::vector<float> distances;


Clarify floating point vs. integer arithmetic

git-svn-id: e88a1e38e13faf406e05cc89eca8dd613216f6c4@915 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf


tweaks to debugging code for water coupling delegate... this may need revisited

--- src/pks/mpc/mpc_delegate_water.cc
+++ src/pks/mpc/mpc_delegate_water.cc
@@ -92,6 +92,8 @@
       if ((p_new > patm + cap_size_) && (p_old < patm)) {
         double my_damp = ((patm + cap_size_) - p_old) / (p_new - p_old);
         damp = std::min(damp, my_damp);
+	if (vo_->os_OK(Teuchos::VERB_EXTREME))
+	  std::cout << "   DAMPING THE SPURT (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl;
       }
     }

@@ -133,7 +135,7 @@
         domain_Pu_f[0][f] = p_old - (patm + cap_size_);
         n_modified++;
         if (vo_->os_OK(Teuchos::VERB_HIGH))
-          *vo_->os() << "  CAPPING THE SPURT (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << p_old - domain_Pu_f[0][f] << std::endl;
+	  std::cout << "  CAPPING THE SPURT (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << p_old - domain_Pu_f[0][f] << std::endl;
       }
     }
   }
@@ -226,10 +228,14 @@
         // first over
         double my_damp = ((patm + cap_size_) - p_old) / (p_new - p_old);
         damp = std::min(damp, my_damp);
+	if (vo_->os_OK(Teuchos::VERB_EXTREME))
+	  std::cout << "   DAMPING THE SPURT (1st over) (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl;
       } else if ((p_old > patm) && (p_new - p_old > p_old - patm)) {
         // second over
         double my_damp = ((patm + 2*(p_old - patm)) - p_old) / (p_new - p_old);
         damp = std::min(damp, my_damp);
+	if (vo_->os_OK(Teuchos::VERB_EXTREME))
+	  std::cout << "   DAMPING THE SPURT (2nd over) (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl;
       }
     }

@@ -254,10 +260,14 @@
           // first over
           domain_pnew_f[0][f] = patm + cap_size_;
           surf_pnew_c[0][cs] = domain_pnew_f[0][f];
+	  if (vo_->os_OK(Teuchos::VERB_HIGH))
+	    std::cout << "  CAPPING THE SPURT (1st over) (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << domain_pnew_f[0][f] << std::endl;
         } else if ((p_old > patm) && (p_new - p_old > p_old - patm)) {
           // second over
           domain_pnew_f[0][f] = patm + 2*(p_old - patm);
           surf_pnew_c[0][cs] = domain_pnew_f[0][f];
+	  if (vo_->os_OK(Teuchos::VERB_HIGH))
+	    std::cout << "  CAPPING THE SPURT (2nd over) (sc=" << cs << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << domain_pnew_f[0][f] << std::endl;
         } else {
           surf_pnew_c[0][cs] = domain_pnew_f[0][f];
         }


Now uses GeoPainter instead of ClipPainter

svn path=/trunk/KDE/kdeedu/marble/; revision=806927

--- src/plasmoid/worldclock.cpp
+++ src/plasmoid/worldclock.cpp
@@ -34,9 +34,10 @@

 //Marble
-#include <marble/MarbleMap.h>
-#include <marble/SunLocator.h>
-#include <marble/ClipPainter.h>
+#include "../lib/MarbleMap.h"
+#include "../lib/SunLocator.h"
+#include "../lib/ViewParams.h"
+#include "../lib/GeoPainter.h"

@@ -47,7 +48,6 @@
     m_sun(0)
 {
     setHasConfigurationInterface(true);
-    setDrawStandardBackground(true);
     //The applet needs a 2:1 ratio
     //so that the map fits properly
     resize(QSize(400, 200));
@@ -141,8 +141,8 @@
     //we avoid an issue where the map is offset
     //from the border of the plasmoid and it looks ugly
     QPixmap pixmap( rect.size() );
-    ClipPainter cp( &pixmap , false );
-    m_map->paint(cp, rect);
+    GeoPainter gp( &pixmap, m_map->viewParams()->viewport(), false );
+    m_map->paint(gp, rect);
     p->drawPixmap( 0, 0, pixmap );
 }


Allow both left and right preconditioning in lgmres

--- amgcl/solver/lgmres.hpp
+++ amgcl/solver/lgmres.hpp
@@ -79,6 +79,41 @@
 #include <amgcl/util.hpp>

 namespace amgcl {
+
+namespace precond {
+
+enum type {
+    left,
+    right
+};
+
+inline std::ostream& operator<<(std::ostream &os, type p) {
+    switch (p) {
+        case left:
+            return os << "left";
+        case right:
+            return os << "right";
+        default:
+            return os << "???";
+    }
+}
+
+inline std::istream& operator>>(std::istream &in, type &p) {
+    std::string val;
+    in >> val;
+
+    if (val == "left")
+        p = left;
+    else if (val == "right")
+        p = right;
+    else
+        throw std::invalid_argument("Invalid preconditioning kind");
+
+    return in;
+}
+
+} // precond
+
 namespace solver {

 /** "Loose" GMRES.
@@ -106,6 +141,9 @@

         /// Solver parameters.
         struct params {
+            /// Preconditioning kind (left/right).
+            precond::type pside;
+
             /// Number of inner GMRES iterations per each outer iteration.
             int M;

@@ -128,20 +166,22 @@
             scalar_type tol;

             params()
-                : M(30), K(3), store_Av(true), maxiter(100), tol(1e-8)
+                : pside(precond::left), M(30), K(3), store_Av(true), maxiter(100), tol(1e-8)
             { }

             params(const boost::property_tree::ptree &p)
-                : AMGCL_PARAMS_IMPORT_VALUE(p, M),
+                : AMGCL_PARAMS_IMPORT_VALUE(p, pside),
+                  AMGCL_PARAMS_IMPORT_VALUE(p, M),
                   AMGCL_PARAMS_IMPORT_VALUE(p, K),
                   AMGCL_PARAMS_IMPORT_VALUE(p, store_Av),
                   AMGCL_PARAMS_IMPORT_VALUE(p, maxiter),
                   AMGCL_PARAMS_IMPORT_VALUE(p, tol)
             {
-                AMGCL_PARAMS_CHECK(p, (M)(K)(store_Av)(maxiter)(tol));
+                AMGCL_PARAMS_CHECK(p, (pside)(M)(K)(store_Av)(maxiter)(tol));
             }

             void get(boost::property_tree::ptree &p, const std::string &path) const {
+                AMGCL_PARAMS_EXPORT_VALUE(p, path, pside);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, M);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, K);
                 AMGCL_PARAMS_EXPORT_VALUE(p, path, store_Av);
@@ -165,7 +205,8 @@
               r(Backend::create_vector(n, bprm)),
               ws(prm.M + prm.K)
         {
-            r = Backend::create_vector(n, bprm);
+            if (prm.pside == precond::right)
+                t = Backend::create_vector(n, bprm);

             outer_v_data.reserve(prm.K);
             for(int i = 0; i < prm.K; ++i)
@@ -202,37 +243,42 @@
                 Vec2          &x
                 ) const
         {
-            scalar_type rhs_norm = norm(rhs);
-            if (rhs_norm < amgcl::detail::eps<scalar_type>(n)) {
+            scalar_type norm_rhs = norm(rhs);
+            if (norm_rhs < amgcl::detail::eps<scalar_type>(n)) {
                 backend::clear(x);
-                return boost::make_tuple(0, rhs_norm);
+                return boost::make_tuple(0, norm_rhs);
             }

-            scalar_type r_norm = math::zero<scalar_type>(), inner_res_0;
+            scalar_type norm_r = math::zero<scalar_type>(), norm_v0;
             boost::circular_buffer< boost::shared_ptr<vector> > outer_v(prm.K);
             boost::circular_buffer< boost::shared_ptr<vector> > outer_Av(prm.K);

             int H_cols = prm.M + prm.K;
-            size_t iter = 0, n_outer = 0;
-            for(; iter < prm.maxiter; ) {
+            unsigned iter = 0, n_outer = 0;
+            while(true) {
                 backend::residual(rhs, A, x, *r);

-                // Check stopping condition
-                r_norm = norm(*r);
-                if (r_norm < prm.tol * rhs_norm) break;
-
-                // Inner LGMRES iteration
-                P.apply(*r, *vs[0]);
-                inner_res_0 = norm(*vs[0]);
-
-                precondition(!math::is_zero(inner_res_0),
-                        "Preconditioner returned a zero vector");
-
-                backend::axpby(math::inverse(inner_res_0), *vs[0],
-                        math::zero<scalar_type>(), *vs[0]);
+                // -- Check stopping condition
+                if ((norm_r = norm(*r)) < prm.tol * norm_rhs || iter >= prm.maxiter)
+                    break;
+
+                // -- Inner LGMRES iteration
+                if (prm.pside == precond::left) {
+                    P.apply(*r, *vs[0]);
+                    norm_v0 = norm(*vs[0]);
+
+                    precondition(!math::is_zero(norm_v0),
+                            "Preconditioner returned a zero vector");
+
+                    backend::axpby(math::inverse(norm_v0), *vs[0],
+                            math::zero<scalar_type>(), *vs[0]);
+                } else {
+                    norm_v0 = norm_r;
+                    backend::axpby(math::inverse(norm_r), *r,
+                            math::zero<scalar_type>(), *vs[0]);
+                }

                 // H is stored in QR factorized form
-                amgcl::detail::QR<coef_type, amgcl::detail::col_major> qr;
                 for(int j = 0; j <= H_cols; ++j)
                     for(int i = 0; i <= H_cols; ++i)
                         H[i][j] = math::zero<coef_type>();
@@ -242,7 +288,7 @@
                 const scalar_type eps = std::numeric_limits<scalar_type>::epsilon();
                 bool breakdown = false;

-                size_t j = 0;
+                unsigned j = 0;
                 while(true) {
                     // -- Arnoldi process:
                     //
@@ -288,14 +334,21 @@
                     if (j < outer_Av.size()) {
                         backend::copy(*outer_Av[j], *v_new);
                     } else {
-                        backend::spmv(math::identity<scalar_type>(), A, *z, math::zero<scalar_type>(), *r);
-                        P.apply(*r, *v_new);
+                        if (prm.pside == precond::left) {
+                            backend::spmv(math::identity<scalar_type>(), A, *z,
+                                    math::zero<scalar_type>(), *r);
+                            P.apply(*r, *v_new);
+                        } else {
+                            P.apply(*z, *r);
+                            backend::spmv(math::identity<scalar_type>(), A, *r,
+                                    math::zero<scalar_type>(), *v_new);
+                        }
                     }

                     scalar_type v_new_norm = norm(*v_new);
                     coef_type   alpha = math::zero<coef_type>();

-                    for(size_t i = 0; i <= j; ++i) {
+                    for(unsigned i = 0; i <= j; ++i) {
                         H[i][j] = alpha = inner_product(*vs[i], *v_new);
                         backend::axpby(-alpha, *vs[i], math::identity<coef_type>(), *v_new);
                     }
@@ -322,85 +375,86 @@
                     qr.append_cols(1);

                     // Transformed least squares problem
-                    // || Q R y - inner_res_0 * e_1 ||_2 = min!
-                    // Since R = [R'; 0], solution is y = inner_res_0 (R')^{-1} (Q^H)[:j,0]
+                    // || Q R y - norm_v0 * e_1 ||_2 = min!
+                    // Since R = [R'; 0], solution is y = norm_v0 (R')^{-1} (Q^H)[:j,0]
                     //
                     // Residual is immediately known
                     qr.compute_q(j+2);
-                    scalar_type inner_res = std::abs(qr.Q(0,j+1)) * inner_res_0;
+                    scalar_type inner_res = std::abs(qr.Q(0,j+1)) * norm_v0;

                     // Check for termination
                     ++j, ++iter;
                     if (iter >= prm.maxiter || j >= prm.M + outer_v.size())
                         break;

-                    if (inner_res <= prm.tol * inner_res_0 || breakdown)
+                    if (inner_res <= prm.tol * norm_v0 || breakdown)
                         break;
                 }

                 precondition(boost::math::isfinite(qr.R(j-1,j-1)), "NaNs encountered in LGMRES");

-                // The problem is triangular, but the condition number may be
-                // bad (or in case of breakdown the last diagonal entry may be
-                // zero), so use lstsq instead of triangular solve.
-                //
-                // TODO: This is triangular solve for now.
-                for(size_t i = 0; i < j; ++i) y[i] = math::adjoint(qr.Q(0, i));
-                for(size_t i = j; i --> 0; ) {
+                // TODO: The problem is triangular, but the condition number
+                // may be bad (or in case of breakdown the last diagonal entry
+                // may be zero), so use lstsq instead of triangular solve.
+                for(unsigned i = 0; i < j; ++i) y[i] = math::adjoint(qr.Q(0, i));
+                for(unsigned i = j; i --> 0; ) {
                     coef_type rii = qr.R(i,i);
                     if (math::is_zero(rii)) continue;
                     y[i] = math::inverse(rii) * y[i];
-                    for(size_t k = 0; k < i; ++k)
+                    for(unsigned k = 0; k < i; ++k)
                         y[k] -= qr.R(k, i) * y[i];

-                    y[i] *= inner_res_0;
+                    y[i] *= norm_v0;
                     precondition(boost::math::isfinite(y[i]), "NaNs encountered in LGMRES");
                 }

                 // -- GMRES terminated: eval solution
-                boost::shared_ptr<vector> dx = r;
-                sum(j, y, ws, *dx);
+                vector &dx = *r;
+                sum(j, y, ws, dx);

                 // -- Apply step
-                backend::axpby(math::identity<scalar_type>(), *dx, math::identity<scalar_type>(), x);
+                if (prm.pside == precond::left) {
+                    backend::axpby(math::identity<scalar_type>(), dx, math::identity<scalar_type>(), x);
+                } else {
+                    P.apply(dx, *t);
+                    backend::axpby(math::identity<scalar_type>(), *t, math::identity<scalar_type>(), x);
+                }

                 // -- Store LGMRES augmented vectors
-                scalar_type nx = norm(*dx);
-
-                if(prm.K > 0 && !math::is_zero(nx)) {
-                    size_t outer_slot = n_outer % prm.K;
+                scalar_type norm_dx = norm(dx);
+
+                if(prm.K > 0 && !math::is_zero(norm_dx)) {
+                    unsigned outer_slot = n_outer % prm.K;
                     ++n_outer;

-                    nx = math::inverse(nx);
-                    backend::axpby(nx, *dx, math::zero<scalar_type>(), *outer_v_data[outer_slot]);
+                    norm_dx = math::inverse(norm_dx);
+                    backend::axpby(norm_dx, dx, math::zero<scalar_type>(), *outer_v_data[outer_slot]);
                     outer_v.push_back(outer_v_data[outer_slot]);

                     if (prm.store_Av) {
-                        // q = Q * R * y
-                        for(size_t k = 0; k < j; ++k) {
+                        // q = H * y = Q * R * y
+                        for(unsigned k = 0; k < j; ++k) {
                             coef_type sum = math::zero<coef_type>();
-                            for(size_t i = k; i < j; ++i)
+                            for(unsigned i = k; i < j; ++i)
                                 sum += qr.R(k,i) * y[i];
                             Ry[k] = sum;
                         }

-                        for(size_t k = 0; k <= j; ++k) {
+                        for(unsigned k = 0; k <= j; ++k) {
                             coef_type sum = math::zero<coef_type>();
-                            for(size_t i = 0; i < j; ++i)
+                            for(unsigned i = 0; i < j; ++i)
                                 sum += qr.Q(k,i) * Ry[i];
-                            q[k] = sum;
+                            q[k] = sum * norm_dx;
                         }

                         boost::shared_ptr<vector> ax = outer_Av_data[outer_slot];
                         sum(j+1, q, vs, *ax);
-
-                        backend::axpby(nx, *ax, math::zero<scalar_type>(), *ax);
                         outer_Av.push_back(ax);
                     }
                 }
             }

-            return boost::make_tuple(iter, r_norm / rhs_norm);
+            return boost::make_tuple(iter, norm_r / norm_rhs);
         }

         /* Computes the solution for the given right-hand side \p rhs. The
@@ -425,8 +479,9 @@
         InnerProduct inner_product;

         mutable boost::multi_array<coef_type, 2> H;
+        mutable amgcl::detail::QR<coef_type, amgcl::detail::col_major> qr;
         mutable std::vector<coef_type> y, Ry, q;
-        mutable boost::shared_ptr<vector> r;
+        mutable boost::shared_ptr<vector> r, t;
         mutable std::vector< boost::shared_ptr<vector> > outer_v_data, outer_Av_data;
         mutable std::vector< boost::shared_ptr<vector> > vs, ws;

@@ -439,7 +494,7 @@

         // x = sum(c[i] * v[i])
         static void sum(
-                size_t n,
+                unsigned n,
                 const std::vector<coef_type> &c,
                 const std::vector< boost::shared_ptr<vector> > &v,
                 vector &x
@@ -447,7 +502,7 @@
         {
             backend::axpby(c[0], *v[0], math::zero<coef_type>(), x);

-            size_t i = 1;
+            unsigned i = 1;
             for(; i + 1 < n; i += 2)
                 backend::axpbypcz(c[i], *v[i], c[i+1], *v[i+1],
                         math::identity<coef_type>(), x);


INTEGRATION: CWS sj14 (1.9.22); FILE MERGED 2005/01/13 14:59:44 sj 1.9.22.1: #i25876# fixed a mapping problem

--- goodies/source/filter.vcl/ipict/ipict.cxx
+++ goodies/source/filter.vcl/ipict/ipict.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ipict.cxx,v $
  *
- *  $Revision: 1.9 $
+ *  $Revision: 1.10 $
  *
- *  last change: $Author: hr $ $Date: 2004-09-09 11:33:51 $
+ *  last change: $Author: rt $ $Date: 2005-01-27 16:14:22 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -270,8 +270,8 @@

     *pPict >> ny >> nx;

-   return Point( (long) ( Fraction( (long) nx ) * aHRes ) - aBoundingRect.Left(),
-                 (long) ( Fraction( (long) ny ) * aVRes ) - aBoundingRect.Top() );
+   return Point( (long)nx - aBoundingRect.Left(),
+                 (long)ny - aBoundingRect.Top() );
 }

 Point PictReader::ReadDeltaH(Point aBase)
@@ -280,8 +280,7 @@

     *pPict >> ((char&)ndh);

-    return Point( aBase.X() + (long) ( Fraction( (long) ndh ) * aHRes ),
-                  aBase.Y() );
+    return Point( aBase.X() + (long)ndh, aBase.Y() );
 }

 Point PictReader::ReadDeltaV(Point aBase)
@@ -290,7 +289,7 @@

     *pPict >> ((char&)ndv);

-    return Point( aBase.X(), aBase.Y() + (long) ( Fraction( (long) ndv ) * aVRes ) );
+    return Point( aBase.X(), aBase.Y() + (long)ndv );
 }

 Point PictReader::ReadUnsignedDeltaH(Point aBase)
@@ -299,7 +298,7 @@

     *pPict >> ndh;

-    return Point(aBase.X() + (long) ( Fraction( (long)ndh ) * aHRes ), aBase.Y() );
+    return Point( aBase.X() + (long)ndh, aBase.Y() );
 }

 Point PictReader::ReadUnsignedDeltaV(Point aBase)
@@ -308,7 +307,7 @@

     *pPict >> ndv;

-    return Point( aBase.X(), aBase.Y() + (long) ( Fraction( (long)ndv ) * aVRes ) );
+    return Point( aBase.X(), aBase.Y() + (long)ndv );
 }

 Size PictReader::ReadSize()
@@ -317,8 +316,7 @@

     *pPict >> ny >> nx;

-    return Size( (long) ( Fraction( (long) nx ) * aHRes ),
-                 (long) ( Fraction( (long) ny ) * aVRes ) );
+    return Size( (long)nx, (long)ny );
 }

 Color PictReader::ReadColor()
@@ -1050,9 +1048,6 @@
         else                            // Version 2 oder hoeher
         {
             short   nExtVer;
-            ULONG   nTempX;
-            ULONG   nTempY;
-
             // 3 Bytes ueberspringen, um auf
             // ExtVersion2 oder Version2 zu kommen
             pPict->SeekRel( 3 );
@@ -1063,29 +1058,23 @@
             // dementsprechend Aufloesung einlesen oder nicht
             if ( nExtVer == -2 )
             {
-                // Horizontale Skalierung als Bruch ( bzgl. 72 DPI )
-                *pPict >> nTempX;
-                nTempX &= 0x0000ffff;
-
-                // Vertikale Skalierung als Bruch ( bzgl. 72 DPI )
-                *pPict >> nTempY;
-                nTempY &= 0x0000ffff;
-
-                // nachfolgender Code soll nicht beeinflusst werden
-                pPict->SeekRel( -12 );
+                sal_Int16 nReserved;
+                sal_Int32 nHResFixed, nVResFixed;
+                *pPict >> nReserved >> nHResFixed >> nVResFixed;
+                double fHRes = nHResFixed;
+                fHRes /= 65536;
+                double fVRes = nVResFixed;
+                fVRes /= 65536;
+                aHRes /= fHRes;
+                aVRes /= fVRes;
+                *pPict >> y1 >> x1 >> y2 >> x2;     // reading the optimal bounding rect
+                aBoundingRect=Rectangle( x1,y1, --x2, --y2 );
+                pPict->SeekRel( -22 );
             }
             else
             {
-                nTempX = nTempY = 72;
-
-                // nachfolgender Code soll nicht beeinflusst werden
                 pPict->SeekRel( -4 );
             }
-
-            // gefundene Aufloesung setzen
-            aHRes = Fraction( 72, nTempX );
-            aVRes = Fraction( 72, nTempY );
-
             IsVersion2=TRUE;
         }
     }
@@ -1245,7 +1234,7 @@
     case 0x000d:   // TxSize
     {
         *pPict >> nUSHORT;
-        aActFont.SetSize( Size( 0, (long) ( Fraction( (long) nUSHORT ) * aVRes ) ) );
+        aActFont.SetSize( Size( 0, (long)nUSHORT ) );
         eActMethod=PDM_UNDEFINED;
         nDataSize=2;
     }
@@ -1832,8 +1821,6 @@

 void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile, PFilterCallback pcallback, void * pcallerdata)
 {
-    const Fraction  aFrac72( 1, 72 );
-    const MapMode   aMap72( MAP_INCH, Point(), aFrac72, aFrac72 );
     USHORT          nOpcode;
     BYTE            nOneByteOpcode;
     ULONG           nSize, nPos, nStartPos, nEndPos, nPercent, nLastPercent;
@@ -1925,7 +1912,7 @@
     rGDIMetaFile.Stop();
     delete pVirDev;

-    rGDIMetaFile.SetPrefMapMode( aMap72 );
+    rGDIMetaFile.SetPrefMapMode( MapMode( MAP_INCH, Point(), aHRes, aVRes ) );
     rGDIMetaFile.SetPrefSize( aBoundingRect.GetSize() );

     pPict->SetNumberFormatInt(nOrigNumberFormat);


INTEGRATION: CWS tl55 (1.7.50); FILE MERGED 2008/06/26 14:19:58 os 1.7.50.1: i85999 interactive grammar checking

--- sw/inc/splargs.hxx
+++ sw/inc/splargs.hxx
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: splargs.hxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -115,12 +115,16 @@
     ::com::sun::star::uno::Reference<
         ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt;

+    bool bIsGrammarCheck;
+
     SwSpellArgs(::com::sun::star::uno::Reference<
             ::com::sun::star::linguistic2::XSpellChecker1 > &rxSplChk,
             SwTxtNode* pStart, SwIndex& rStart,
-            SwTxtNode* pEnd, SwIndex& rEnd )
+            SwTxtNode* pEnd, SwIndex& rEnd,
+            bool bGrammar )
         :   SwArgsBase( pStart, rStart, pEnd, rEnd ),
-            xSpeller( rxSplChk )
+            xSpeller( rxSplChk ),
+            bIsGrammarCheck( bGrammar )
         {}
 };