Documented and code edited native stencil

--- include/native/stencil.h
+++ include/native/stencil.h
@@ -25,101 +25,141 @@
 #include "../common/iterator.h"

 namespace grppi{
-template <typename InputIt, typename OutputIt, typename Operation, typename NFunc>
-void stencil(parallel_execution_native &p, InputIt first, InputIt last, OutputIt firstOut, Operation && op, NFunc && neighbor ) {

-    std::vector<std::thread> tasks;
-    int numElements = last - first;
-    int elemperthr = numElements/p.concurrency_degree();
+/**
+\addtogroup stencil_pattern
+@{
+*/
+
+/**
+\addtogroup stencil_pattern_native Native parallel stencil pattern
+\brief Native parallel implementation of the \ref md_stencil pattern.
+@{
+*/
+
+/**
+\brief Invoke [stencil pattern](\ref md_stencil) on a data sequence with
+native parallel execution.
+\tparam InputIt Iterator type used for the input sequence.
+\tparam OutputIt Iterator type used for the output sequence
+\tparam Neighbourhood Callable type for obtaining the neighbourhood.
+\tparam StencilTransformer Callable type for performing the stencil transformation.
+\param ex Native parallel execution policy object.
+\param first Iterator to the first element in the input sequence.
+\param last Iterator to one past the end of the input sequence.
+\param out Iterator to the first element in the output sequence.
+\param transform_op Stencil transformation operation.
+\param neighbour_op Neighbourhood operation.
+*/
+template <typename InputIt, typename OutputIt, typename StencilTransformer,
+          typename Neighbourhood>
+void stencil(parallel_execution_native & ex,
+             InputIt first, InputIt last, OutputIt first_out,
+             StencilTransformer transform_op, Neighbourhood neighbour_op)
+{
+  using namespace std;
+
+  vector<thread> tasks;
+  int size = distance(first,last);
+  int elements_per_thread = size/ex.concurrency_degree();

-    for(int i=1;i<p.concurrency_degree();i++){
-       auto begin = first + (elemperthr * i);
-       auto end = first + (elemperthr * (i+1));
-
-       if( i == p.concurrency_degree()-1) end = last;
+  for (int i=1; i<ex.concurrency_degree(); ++i) {
+    auto begin = first + (elements_per_thread * i);
+    auto end = (i==ex.concurrency_degree()-1)?
+        last :
+        next(first, elements_per_thread * (i+1));

-       auto out = firstOut + (elemperthr * i);
+    auto out = first_out + (elements_per_thread * i);

-       tasks.emplace_back([&](InputIt begin, InputIt end, OutputIt out) {
-         auto manager = p.thread_manager();
+    tasks.emplace_back([&](InputIt begin, InputIt end, OutputIt out) {
+      auto manager = ex.thread_manager();

-         while (begin!=end) {
-           auto neighbors = neighbor(begin);
-           *out = op(begin, neighbors);
-           begin++;
-           out++;
-         }
-       }, begin, end, out);
-    }
-   //MAIN
-   auto end = first + elemperthr;
-   while(first!=end){
-      auto neighbors = neighbor(first);
-      *firstOut = op(first, neighbors);
-      first++;
-      firstOut++;
-   }
+      while (begin!=end) {
+        *out = transform_op(begin, neighbour_op(begin));
+        begin++;
+        out++;
+      }
+    },
+    begin, end, out);
+  }

-   //Join threads
-   for(int i=0;i<p.concurrency_degree()-1;i++){
-      tasks[i].join();
-   }
-
+  auto end = first + elements_per_thread;
+  while(first!=end){
+    *first_out = transform_op(first, neighbour_op(first));
+    first++;
+    first_out++;
+  }
+
+  for (auto && t : tasks) { t.join(); }
 }

+/**
+\brief Invoke [stencil pattern](\ref md_stencil) on multiple data sequences with
+native parallel execution.
+\tparam InputIt Iterator type used for the input sequence.
+\tparam OutputIt Iterator type used for the output sequence
+\tparam Neighbourhood Callable type for obtaining the neighbourhood.
+\tparam StencilTransformer Callable type for performing the stencil transformation.
+\tparam OtherInputIts Iterator types for additional input sequences.
+\param ex Native parallel execution policy object.
+\param first Iterator to the first element in the input sequence.
+\param last Iterator to one past the end of the input sequence.
+\param out Iterator to the first element in the output sequence.
+\param transform_op Stencil transformation operation.
+\param neighbour_op Neighbourhood operation.
+\param other_firsts Iterators to the first element of additional input sequences.
+*/
+template <typename InputIt, typename OutputIt, typename StencilTransformer,
+          typename Neighbourhood, typename ... OtherInputIts>
+void stencil(parallel_execution_native & ex,
+             InputIt first, InputIt last, OutputIt first_out,
+             StencilTransformer transform_op, Neighbourhood neighbour_op,
+             OtherInputIts ... other_firsts ) {
+  using namespace std;

-template <typename InputIt, typename OutputIt, typename ... MoreIn, typename Operation, typename NFunc>
-void stencil(parallel_execution_native &p, InputIt first, InputIt last, OutputIt firstOut, Operation && op, NFunc && neighbor, MoreIn ... inputs ) {
+  vector<thread> tasks;
+  int size = last - first;
+  int elements_per_thread = size/ex.concurrency_degree();

-     std::vector<std::thread> tasks;
-     int numElements = last - first;
-     int elemperthr = numElements/p.concurrency_degree();
+  for (int i=1; i<ex.concurrency_degree(); i++){
+  auto begin = first + (elements_per_thread * i);
+  auto end = (i==ex.concurrency_degree()-1)?
+      last :
+      first + elements_per_thread * (i+1);

-     for(int i=1;i<p.concurrency_degree();i++){
+  auto out = first_out + (elements_per_thread * i);
+
+  tasks.emplace_back(
+    [&](InputIt begin, InputIt end, OutputIt out, int i, int n, OtherInputIts ... other_firsts){
+      auto manager = ex.thread_manager();

-        auto begin = first + (elemperthr * i);
-        auto end = first + (elemperthr * (i+1));
+      advance_iterators(n*i, other_firsts ...);
+      while (begin!=end) {
+        *out = transform_op(begin, neighbour_op(begin,other_firsts...));
+        begin++;
+        advance_iterators(other_firsts ... );
+        out++;
+      }
+    },
+    begin, end, out, i, elements_per_thread,other_firsts ...);
+  }

-	if(i==p.concurrency_degree()-1) end = last;
-
-        auto out = firstOut + (elemperthr * i);
-
-        tasks.push_back(
-            std::thread( [&](InputIt begin, InputIt end, OutputIt out, int i, int n, MoreIn ... inputs){
-               auto manager = p.thread_manager();
-
-               advance_iterators((n*i), inputs ...);
-               while(begin!=end){
-                 auto neighbors = neighbor(begin,inputs...);
-                 *out = op(begin, neighbors);
-                 begin++;
-                 advance_iterators( inputs ... );
-                 out++;
-               }
-            },
-            begin, end, out, i, elemperthr,inputs ...)
-       );
-    }
-
-   //MAIN
-   auto end = first + elemperthr;
-   while(first!=end){
-      auto neighbors = neighbor(first,inputs...);
-      *firstOut = op(*first, neighbors);
-      first++;
-      advance_iterators( inputs ... );
-      firstOut++;
-   }
+  auto end = first + elements_per_thread;
+  while (first!=end) {
+    *first_out = transform_op(*first, neighbour_op(first,other_firsts...));
+    first++;
+    advance_iterators( other_firsts ... );
+    first_out++;
+  }

-   //Join threads
-   for(int i=0;i<p.concurrency_degree()-1;i++){
-      tasks[i].join();
-   }
-
+  for (auto && t : tasks) { t.join(); }
 }

-
+/**
+@}
+@}
+*/

 }
 #endif


Removing some old commented lines from when I was figuring out the fortran interfacing.

--- include/openmc/surface.h
+++ include/openmc/surface.h
@@ -415,10 +415,6 @@
   int surface_bc(Surface* surf);
   bool surface_sense(Surface* surf, double xyz[3], double uvw[3]);
   void surface_reflect(Surface* surf, double xyz[3], double uvw[3]);
-  /* double surface_distance(Surface* surf, double xyz[3], double uvw[3], */
-  /*                         bool coincident); */
-  /* void surface_normal(Surface* surf, double xyz[3], double uvw[3]); */
-  /* void surface_to_hdf5(CSGSurface* surf, hid_t group); */
   int surface_i_periodic(PeriodicSurface* surf);
   bool surface_periodic(PeriodicSurface* surf, PeriodicSurface* other,
                         double xyz[3], double uvw[3]);


Finished fixing mouse not clicking on timeout until you move your finger.

--- project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
+++ project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
@@ -142,8 +142,9 @@

 static pthread_t mouseClickTimeoutThreadId = 0;
 static sem_t mouseClickTimeoutSemaphore;
+static void *mouseClickTimeoutThread (void *);
 static int mouseClickTimeout = 100000;
-static void *mouseClickTimeoutThread (void *);
+static int mouseClickTimeoutInitialized = 0;

 static inline int InsideRect( const SDL_Rect * r, int x, int y )
 {
@@ -573,6 +574,9 @@
 		mouseInitialX = x;
 		mouseInitialY = y;
 		mouseInitialTime = SDL_GetTicks();
+		mouseClickTimeout = (rightClickMethod == RIGHT_CLICK_WITH_TIMEOUT) ? rightClickTimeout + 10 : leftClickTimeout + 10;
+		if(mouseClickTimeoutInitialized)
+			sem_post(&mouseClickTimeoutSemaphore);
 	}
 	if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
 		UpdateScreenUnderFingerRect(x, y);
@@ -1126,12 +1130,13 @@
 	moveMouseWithGyroscope = MoveMouseWithGyroscope;
 	moveMouseWithGyroscopeSpeed = 0.0625f * MoveMouseWithGyroscopeSpeed * MoveMouseWithGyroscopeSpeed + 0.125f * MoveMouseWithGyroscopeSpeed + 0.5f; // Scale value from 0.5 to 2, with 1 at the middle
 	moveMouseWithGyroscopeSpeed *= 5.0f;
-	__android_log_print(ANDROID_LOG_INFO, "libSDL", "moveMouseWithGyroscopeSpeed %d = %f", MoveMouseWithGyroscopeSpeed, moveMouseWithGyroscopeSpeed);
-	if( mouseClickTimeoutThreadId == 0 && (
+	//__android_log_print(ANDROID_LOG_INFO, "libSDL", "moveMouseWithGyroscopeSpeed %d = %f", MoveMouseWithGyroscopeSpeed, moveMouseWithGyroscopeSpeed);
+	if( !mouseClickTimeoutInitialized && (
 		leftClickMethod == LEFT_CLICK_WITH_TIMEOUT ||
 		leftClickMethod == LEFT_CLICK_WITH_TAP_OR_TIMEOUT ||
 		rightClickMethod == RIGHT_CLICK_WITH_TIMEOUT ) )
 	{
+		mouseClickTimeoutInitialized = 1;
 		sem_init(&mouseClickTimeoutSemaphore, 0, 0);
 		pthread_attr_t attr;
 		pthread_attr_init(&attr);
@@ -1717,7 +1722,7 @@
 void *mouseClickTimeoutThread (void * unused)
 {
 	struct timespec ts;
-	while(1)
+	while( 1 )
 	{
 		clock_gettime(CLOCK_REALTIME, &ts);
 		ts.tv_sec += mouseClickTimeout / 1000;
@@ -1727,8 +1732,13 @@
 			ts.tv_sec++;
 			ts.tv_nsec %= 1000000000;
 		}
-		sem_timedwait(&mouseClickTimeoutSemaphore, &ts);
-		ProcessMouseMove_Timeouts(SDL_ANDROID_currentMouseX, SDL_ANDROID_currentMouseY);
+		mouseClickTimeout = 100000;
+		if( sem_timedwait(&mouseClickTimeoutSemaphore, &ts) != 0 ) // Only call when timeout occurs
+		{
+			//__android_log_print(ANDROID_LOG_INFO, "libSDL", "mouseClickTimeoutThread: move %d %d", SDL_ANDROID_currentMouseX, SDL_ANDROID_currentMouseY);
+			ProcessMouseMove_Timeouts(SDL_ANDROID_currentMouseX, SDL_ANDROID_currentMouseY);
+		}
+		//__android_log_print(ANDROID_LOG_INFO, "libSDL", "mouseClickTimeoutThread: tick");
 	}
 	return NULL;
 }


changed delay for 'tap or timeout' left mouse click

--- project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
+++ project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
@@ -528,7 +528,7 @@
 			SDL_ANDROID_MainThreadPushMouseMotion( mouseInitialX - 1, mouseInitialY );
 		mouseInitialX = -1;
 		mouseInitialY = -1;
-		deferredMouseTap = 5;
+		deferredMouseTap = 2;
 		mouseClickTimeout = 200;
 		if( mouseClickTimeoutInitialized )
 			sem_post(&mouseClickTimeoutSemaphore);


Follow up to r69305

Follow up to r69305

Addressing last comment by willchan.

BUG=63867
TEST=Navigate to an HTTPS page with Snap Start running and no network connection.

http://codereview.chromium.org/5826001

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

Former-commit-id: 0c02371eaebbfec9751d92d6fd8564b0937e6c1c


fixed auto replace problem

fixed auto replace problem

--- networkit/cpp/numerics/test/BenchGraphs.h
+++ networkit/cpp/numerics/test/BenchGraphs.h
@@ -90,11 +90,11 @@
 };

 const vector<Instance> DIMACS_CITATION {
-	{"instances/dimacs_citation_NETWORK, trues/citationCiteseer.graph", NETWORK, true},
-	{"instances/dimacs_citation_NETWORK, trues/coAuthorsCiteseer.graph", NETWORK, true},
-	{"instances/dimacs_citation_NETWORK, trues/coAuthorsDBLP.graph", NETWORK, true},
-	{"instances/dimacs_citation_NETWORK, trues/coPapersCiteseer.graph", NETWORK, true},
-	{"instances/dimacs_citation_NETWORK, trues/coPapersDBLP.graph", NETWORK, true},
+	{"instances/dimacs_citation_networks/citationCiteseer.graph", NETWORK, true},
+	{"instances/dimacs_citation_networks/coAuthorsCiteseer.graph", NETWORK, true},
+	{"instances/dimacs_citation_networks/coAuthorsDBLP.graph", NETWORK, true},
+	{"instances/dimacs_citation_networks/coPapersCiteseer.graph", NETWORK, true},
+	{"instances/dimacs_citation_networks/coPapersDBLP.graph", NETWORK, true},
 };

 const vector<Instance> DIMACS_CLUSTERING { // http://www.cc.gatech.edu/dimacs10/archive/clustering.shtml
@@ -110,13 +110,13 @@
 };

 const vector<Instance> DIMACS_STREET_NETWORKS { // http://www.cc.gatech.edu/dimacs10/archive/streets.shtml
-	{"instances/dimacs_street_NETWORK, trues/asia.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/belgium.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/europe.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/germany.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/great-britain.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/luxembourg.osm.graph", NETWORK, true},
-	{"instances/dimacs_street_NETWORK, trues/netherlands.osm.graph", NETWORK, true}
+	{"instances/dimacs_street_networks/asia.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/belgium.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/europe.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/germany.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/great-britain.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/luxembourg.osm.graph", NETWORK, true},
+	{"instances/dimacs_street_networks/netherlands.osm.graph", NETWORK, true}
 };

 const vector<Instance> FACEBOOK100 {
@@ -229,34 +229,34 @@
 	{"instances/walshaw/598a.graph", NETWORK, true},
 	{"instances/walshaw/add20.graph", NETWORK, true},
 	{"instances/walshaw/add32.graph", NETWORK, true},
-//	{"instances/walshaw/auto.graph", NETWORK, true},
-////	{"instances/walshaw/bcsstk29.graph", NETWORK, true},
-////	{"instances/walshaw/bcsstk30.graph", NETWORK, true},
-////	{"instances/walshaw/bcsstk31.graph", NETWORK, true},
-//	{"instances/walshaw/bcsstk32.graph", NETWORK, true},
-//	{"instances/walshaw/bcsstk33.graph", NETWORK, true},
-//	{"instances/walshaw/brack2.graph", NETWORK, true},
-//	{"instances/walshaw/crack.graph", NETWORK, true},
-//	{"instances/walshaw/cs4.graph", NETWORK, true},
-//	{"instances/walshaw/cti.graph", NETWORK, true},
-//	{"instances/walshaw/data.graph", NETWORK, true},
-//	{"instances/walshaw/fe_4elt2.graph", NETWORK, true},
-////	{"instances/walshaw/fe_body.graph", NETWORK, true},
-//	{"instances/walshaw/fe_ocean.graph", NETWORK, true},
-////	{"instances/walshaw/fe_pwt.graph", NETWORK, true},
-//	{"instances/walshaw/fe_rotor.graph", NETWORK, true},
-//	{"instances/walshaw/fe_sphere.graph", NETWORK, true},
-//	{"instances/walshaw/fe_tooth.graph", NETWORK, true},
-//	{"instances/walshaw/finan512.graph", NETWORK, true},
-//	{"instances/walshaw/m14b.graph", NETWORK, true},
-//	{"instances/walshaw/memplus.graph", NETWORK, true},
-//	{"instances/walshaw/t60k.graph", NETWORK, true},
-//	{"instances/walshaw/uk.graph", NETWORK, true},
-//	{"instances/walshaw/vibrobox.graph", NETWORK, true},
-//	{"instances/walshaw/wave.graph", NETWORK, true},
-//	{"instances/walshaw/whitaker3.graph", NETWORK, true},
-//	{"instances/walshaw/wing_nodal.graph", NETWORK, true},
-//	{"instances/walshaw/wing.graph", NETWORK, true}
+	{"instances/walshaw/auto.graph", NETWORK, true},
+	{"instances/walshaw/bcsstk29.graph", NETWORK, false},
+	{"instances/walshaw/bcsstk30.graph", NETWORK, false},
+	{"instances/walshaw/bcsstk31.graph", NETWORK, false},
+	{"instances/walshaw/bcsstk32.graph", NETWORK, true},
+	{"instances/walshaw/bcsstk33.graph", NETWORK, true},
+	{"instances/walshaw/brack2.graph", NETWORK, true},
+	{"instances/walshaw/crack.graph", NETWORK, true},
+	{"instances/walshaw/cs4.graph", NETWORK, true},
+	{"instances/walshaw/cti.graph", NETWORK, true},
+	{"instances/walshaw/data.graph", NETWORK, true},
+	{"instances/walshaw/fe_4elt2.graph", NETWORK, true},
+	{"instances/walshaw/fe_body.graph", NETWORK, false},
+	{"instances/walshaw/fe_ocean.graph", NETWORK, true},
+	{"instances/walshaw/fe_pwt.graph", NETWORK, false},
+	{"instances/walshaw/fe_rotor.graph", NETWORK, true},
+	{"instances/walshaw/fe_sphere.graph", NETWORK, true},
+	{"instances/walshaw/fe_tooth.graph", NETWORK, true},
+	{"instances/walshaw/finan512.graph", NETWORK, true},
+	{"instances/walshaw/m14b.graph", NETWORK, true},
+	{"instances/walshaw/memplus.graph", NETWORK, true},
+	{"instances/walshaw/t60k.graph", NETWORK, true},
+	{"instances/walshaw/uk.graph", NETWORK, true},
+	{"instances/walshaw/vibrobox.graph", NETWORK, true},
+	{"instances/walshaw/wave.graph", NETWORK, true},
+	{"instances/walshaw/whitaker3.graph", NETWORK, true},
+	{"instances/walshaw/wing_nodal.graph", NETWORK, true},
+	{"instances/walshaw/wing.graph", NETWORK, true}
 };

 const vector<Instance> SNAP {


Convert line endings to unix format

Convert line endings to unix format

Convert the line endings for nina_b1.c to unix format. This matches
the rest of the codebase. This also fixes strange git behavior which
cause this file to show up as modified even when no changes have
been made.

--- source/board/nina_b1.c
+++ source/board/nina_b1.c
@@ -1,31 +1,31 @@
-/**
- * @file    nina_b1.c
- * @brief   board ID for the u-blox NINA-B1 EVA maker board
- *
- * DAPLink Interface Firmware
- * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "target_config.h"
-
-const char *board_id = "1238";
-
-void prerun_board_config(void)
-{
-	// NINA-B1 is based on nrf52
-	extern target_cfg_t target_device_nrf52;
-	target_device = target_device_nrf52;
-}
+/**
+ * @file    nina_b1.c
+ * @brief   board ID for the u-blox NINA-B1 EVA maker board
+ *
+ * DAPLink Interface Firmware
+ * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "target_config.h"
+
+const char *board_id = "1238";
+
+void prerun_board_config(void)
+{
+	// NINA-B1 is based on nrf52
+	extern target_cfg_t target_device_nrf52;
+	target_device = target_device_nrf52;
+}


Change update reach and unreach counters to uint64_t

Change-Id: I09c7516c5d99674de512dffcbe74e748a88e55ee
Closes-Bug: #1645875

--- src/bgp/message_builder.h
+++ src/bgp/message_builder.h
@@ -27,12 +27,12 @@
     virtual void Finish() = 0;
     virtual const uint8_t *GetData(IPeerUpdate *peer_update, size_t *lenp,
         const std::string **msg_str) = 0;
-    uint32_t num_reach_routes() const { return num_reach_route_; }
-    uint32_t num_unreach_routes() const { return num_unreach_route_; }
+    uint64_t num_reach_routes() const { return num_reach_route_; }
+    uint64_t num_unreach_routes() const { return num_unreach_route_; }

 protected:
-    uint32_t num_reach_route_;
-    uint32_t num_unreach_route_;
+    uint64_t num_reach_route_;
+    uint64_t num_unreach_route_;

     virtual void Reset() {
         num_reach_route_ =  0;


Fix missing else logic with ssl enabled.

If gpfdist is built with ssl and does not use --ssl
it will now print the correct message.

Authors: Marbin Tan & Larry Hamel

--- src/bin/gpfdist/gpfdist.c
+++ src/bin/gpfdist/gpfdist.c
@@ -3472,8 +3472,9 @@
 	if (opt.ssl)
 		printf("Serving HTTPS on port %d, directory %s\n", opt.p, opt.d);
 	else
+		printf("Serving HTTP on port %d, directory %s\n", opt.p, opt.d);
 #else
-		printf("Serving HTTP on port %d, directory %s\n", opt.p, opt.d);
+	printf("Serving HTTP on port %d, directory %s\n", opt.p, opt.d);
 #endif

 	fflush(stdout);


Fix help output for open url command.

Fix help output for open url command.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@2793 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/command/cmiss.c
+++ source/command/cmiss.c
@@ -22089,10 +22089,19 @@
 		{
 			if (state->current_token)
 			{
-				do_help(state->current_token,
-					/*help_examples_directory*/(char *)NULL,
-					command_data->execute_command,
-					command_data->user_interface);
+				if (strcmp(PARSER_HELP_STRING,state->current_token)&&
+					strcmp(PARSER_RECURSIVE_HELP_STRING,state->current_token))
+				{
+					do_help(state->current_token,
+						/*help_examples_directory*/(char *)NULL,
+						command_data->execute_command,
+						command_data->user_interface);
+				}
+				else
+				{
+					display_message(INFORMATION_MESSAGE," URL");
+					return_code=1;
+				}
 			}
 			else
 			{


Teach pg_dump to dump comments attached to the columns of a composite type.

Taro Minowa (Higepon)

--- src/bin/pg_dump/pg_dump.c
+++ src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
  *	by PostgreSQL
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.541 2009/07/20 20:53:40 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.542 2009/07/23 22:59:40 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -134,6 +134,7 @@
 static void dumpEnumType(Archive *fout, TypeInfo *tinfo);
 static void dumpDomain(Archive *fout, TypeInfo *tinfo);
 static void dumpCompositeType(Archive *fout, TypeInfo *tinfo);
+static void dumpCompositeTypeColComments(Archive *fout, TypeInfo *tinfo);
 static void dumpShellType(Archive *fout, ShellTypeInfo *stinfo);
 static void dumpProcLang(Archive *fout, ProcLangInfo *plang);
 static void dumpFunc(Archive *fout, FuncInfo *finfo);
@@ -6755,6 +6756,119 @@
 	destroyPQExpBuffer(q);
 	destroyPQExpBuffer(delq);
 	destroyPQExpBuffer(query);
+
+	/* Dump any per-column comments */
+	dumpCompositeTypeColComments(fout, tinfo);
+}
+
+/*
+ * dumpCompositeTypeColComments
+ *	  writes out to fout the queries to recreate comments on the columns of
+ *	  a user-defined stand-alone composite type
+ */
+static void
+dumpCompositeTypeColComments(Archive *fout, TypeInfo *tinfo)
+{
+	CommentItem *comments;
+	int ncomments;
+	PGresult *res;
+	PQExpBuffer query;
+	PQExpBuffer target;
+	Oid pgClassOid;
+	int i;
+	int ntups;
+	int i_attname;
+	int i_attnum;
+
+	query = createPQExpBuffer();
+
+	/* We assume here that remoteVersion must be at least 70300 */
+	appendPQExpBuffer(query,
+					  "SELECT c.tableoid, a.attname, a.attnum "
+					  "FROM pg_catalog.pg_class c, pg_catalog.pg_attribute a "
+					  "WHERE c.oid = '%u' AND c.oid = a.attrelid "
+					  "  AND NOT a.attisdropped "
+					  "ORDER BY a.attnum ",
+					  tinfo->typrelid);
+
+	/* Fetch column attnames */
+	res = PQexec(g_conn, query->data);
+	check_sql_result(res, g_conn, query->data, PGRES_TUPLES_OK);
+
+	/* Expecting at least a single result */
+	ntups = PQntuples(res);
+	if (ntups < 1)
+	{
+		write_msg(NULL, "query returned no rows: %s\n", query->data);
+		exit_nicely();
+	}
+
+	pgClassOid = atooid(PQgetvalue(res, 0, PQfnumber(res, "tableoid")));
+
+	/* Search for comments associated with type's pg_class OID */
+	ncomments = findComments(fout,
+							 pgClassOid,
+							 tinfo->typrelid,
+							 &comments);
+
+	/* If no comments exist, we're done */
+	if (ncomments <= 0)
+	{
+		PQclear(res);
+		destroyPQExpBuffer(query);
+		return;
+	}
+
+	/* Build COMMENT ON statements */
+	target = createPQExpBuffer();
+
+	i_attnum = PQfnumber(res, "attnum");
+	i_attname = PQfnumber(res, "attname");
+	while (ncomments > 0)
+	{
+		const char *attname;
+
+		attname = NULL;
+		for (i = 0; i < ntups; i++)
+		{
+			if (atoi(PQgetvalue(res, i, i_attnum)) == comments->objsubid)
+			{
+				attname = PQgetvalue(res, i, i_attname);
+				break;
+			}
+		}
+		if (attname)			/* just in case we don't find it */
+		{
+			const char *descr = comments->descr;
+
+			resetPQExpBuffer(target);
+			appendPQExpBuffer(target, "COLUMN %s.",
+							  fmtId(tinfo->dobj.name));
+			appendPQExpBuffer(target, "%s",
+							  fmtId(attname));
+
+			resetPQExpBuffer(query);
+			appendPQExpBuffer(query, "COMMENT ON %s IS ", target->data);
+			appendStringLiteralAH(query, descr, fout);
+			appendPQExpBuffer(query, ";\n");
+
+			ArchiveEntry(fout, nilCatalogId, createDumpId(),
+						 target->data,
+						 tinfo->dobj.namespace->dobj.name,
+						 NULL, tinfo->rolname,
+						 false, "COMMENT", SECTION_NONE,
+						 query->data, "", NULL,
+						 &(tinfo->dobj.dumpId), 1,
+						 NULL, NULL);
+		}
+
+		comments++;
+		ncomments--;
+	}
+
+	PQclear(res);
+	destroyPQExpBuffer(query);
+	destroyPQExpBuffer(target);
 }

 /*


compositor-wayland: Synchronise keyboard state with parent

Use the wl_keyboard::modifiers events our parent helpfully sends us to
make sure our views of the keyboard state are always identical, rather
than relying on key press events to do the right thing.

Signed-off-by: Daniel Stone <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@fooishbar.org>

--- src/compositor-wayland.c
+++ src/compositor-wayland.c
@@ -92,6 +92,7 @@
 	struct wl_keyboard *keyboard;
 	struct wl_touch *touch;
 	struct wl_list link;
+	uint32_t key_serial;
 };

@@ -533,6 +534,8 @@
 	struct wayland_output *output;
 	struct wayland_compositor *c = input->compositor;

+	/* XXX: If we get a modifier event immediately before the focus,
+	 *      we should try to keep the same serial. */
 	output = wl_surface_get_user_data(surface);
 	notify_pointer_focus(&c->base.seat->seat, &output->base, x, y);
 	wl_pointer_set_cursor(input->pointer, serial, NULL, 0, 0);
@@ -640,7 +643,8 @@
 	struct wayland_input *input = data;
 	struct wayland_compositor *c = input->compositor;

-	/* XXX: Need to wait for modifier event and send with state then. */
+	/* XXX: If we get a modifier event immediately before the focus,
+	 *      we should try to keep the same serial. */
 	notify_keyboard_focus_in(&c->base.seat->seat, keys,
 				 STATE_UPDATE_AUTOMATIC);
 }
@@ -664,19 +668,35 @@
 	struct wayland_input *input = data;
 	struct wayland_compositor *c = input->compositor;

+	input->key_serial = serial;
 	notify_key(&c->base.seat->seat, time, key,
 		   state ? WL_KEYBOARD_KEY_STATE_PRESSED :
 			   WL_KEYBOARD_KEY_STATE_RELEASED,
-		   STATE_UPDATE_AUTOMATIC);
+		   STATE_UPDATE_NONE);
 }

 static void
 input_handle_modifiers(void *data, struct wl_keyboard *keyboard,
-		       uint32_t serial, uint32_t mods_depressed,
+		       uint32_t serial_in, uint32_t mods_depressed,
 		       uint32_t mods_latched, uint32_t mods_locked,
 		       uint32_t group)
 {
-	/* XXX notify_modifiers(); */
+	struct wayland_input *input = data;
+	struct wayland_compositor *c = input->compositor;
+	uint32_t serial_out;
+
+	/* If we get a key event followed by a modifier event with the
+	 * same serial number, then we try to preserve those semantics by
+	 * reusing the same serial number on the way out too. */
+	if (serial_in == input->key_serial)
+		serial_out = wl_display_get_serial(c->base.wl_display);
+	else
+		serial_out = wl_display_next_serial(c->base.wl_display);
+
+	xkb_state_update_mask(c->base.seat->xkb_state.state,
+			      mods_depressed, mods_latched,
+			      mods_locked, 0, 0, group);
+	notify_modifiers(&c->base.seat->seat, serial_out);
 }

 static const struct wl_keyboard_listener keyboard_listener = {


async: Changed lambda capture to respect object lifetime

The lambda was capturing the entire object being passed, rather then
only the needed resource. On edge cases where the captured object
would fall out of scope (deallocated) before the promise completion,
it would try to use deallocated members, which would cause a segmentation
fault.

--- include/pistache/async.h
+++ include/pistache/async.h
@@ -570,15 +570,18 @@
                 template<typename P>
                 void finishResolve(P& promise) {
                     auto chainer = makeChainer(promise);
-                    promise.then(std::move(chainer), [=](std::exception_ptr exc) {
-                        auto core = this->chain_;
-                        core->exc = std::move(exc);
-                        core->state = State::Rejected;
-
-                        for (const auto& req: core->requests) {
-                            req->reject(core);
+                    std::weak_ptr<Core> weakPtr = this->chain_;
+                    promise.then(std::move(chainer), [weakPtr](std::exception_ptr exc) {
+                        if (auto core = weakPtr.lock()) {
+                            core->exc = std::move(exc);
+                            core->state = State::Rejected;
+
+                            for (const auto& req: core->requests) {
+                                req->reject(core);
+                            }
                         }
                     });
+
                 }

                 Resolve resolve_;


Fixed defining fields with derivatives in "gfx modify nodes".

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@1800 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/command/cmiss.c
+++ source/command/cmiss.c
@@ -16472,34 +16472,35 @@
 							{
 								component_derivatives_data->components_number_of_derivatives[i]
 									= number_of_derivatives;
-								if (ALLOCATE(nodal_value_types, enum FE_nodal_value_type,
-									1 + number_of_derivatives))
+								if (0 < number_of_derivatives)
 								{
-									component_derivatives_data->components_nodal_value_types[i] =
-										nodal_value_types;
-									/* first FE_NODAL_VALUE, then derivatives */
-									nodal_value_types[0] = FE_NODAL_VALUE;
-									for (j = 0; return_code && (j < number_of_derivatives); j++)
+									if (ALLOCATE(nodal_value_types,
+										enum FE_nodal_value_type, number_of_derivatives))
 									{
-										if (!((current_token = state->current_token) &&
-											STRING_TO_ENUMERATOR(FE_nodal_value_type)(current_token,
-												&(nodal_value_types[j+1])) &&
-											shift_Parse_state(state, 1)))
+										component_derivatives_data->components_nodal_value_types[i]
+											= nodal_value_types;
+										for (j = 0; return_code && (j < number_of_derivatives); j++)
 										{
-											display_message(ERROR_MESSAGE,
-												"Missing or invalid nodal value type: %s",
-												current_token);
-											display_parse_state_location(state);
-											return_code = 0;
+											if (!((current_token = state->current_token) &&
+												STRING_TO_ENUMERATOR(FE_nodal_value_type)(current_token,
+													&(nodal_value_types[j])) &&
+												shift_Parse_state(state, 1)))
+											{
+												display_message(ERROR_MESSAGE,
+													"Missing or invalid nodal value type: %s",
+													current_token);
+												display_parse_state_location(state);
+												return_code = 0;
+											}
 										}
 									}
-								}
-								else
-								{
-									display_message(ERROR_MESSAGE,
-										"set_FE_node_field_component_derivatives.  "
-										"Not enough memory for nodal_value_types");
-									return_code = 0;
+									else
+									{
+										display_message(ERROR_MESSAGE,
+											"set_FE_node_field_component_derivatives.  "
+											"Not enough memory for nodal_value_types");
+										return_code = 0;
+									}
 								}
 							}
 							else
@@ -16850,7 +16851,7 @@
 							}
 							/* else leave the default */

-							if (component_versions_data.number_of_components)
+							if (component_derivatives_data.number_of_components)
 							{
 								if (number_of_components ==
 									component_derivatives_data.number_of_components)


Fix pg_dump bug in the database-level collation patch. "datcollate" and "datctype" columns were misspelled. Per report from Chris Browne.

--- src/bin/pg_dump/pg_dump.c
+++ src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
  *	by PostgreSQL
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.501 2008/09/23 09:20:37 heikki Exp $
+ *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.502 2008/09/24 19:33:15 heikki Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1653,8 +1653,8 @@
 	i_oid = PQfnumber(res, "oid");
 	i_dba = PQfnumber(res, "dba");
 	i_encoding = PQfnumber(res, "encoding");
-	i_collate = PQfnumber(res, "collate");
-	i_ctype = PQfnumber(res, "ctype");
+	i_collate = PQfnumber(res, "datcollate");
+	i_ctype = PQfnumber(res, "datctype");
 	i_tablespace = PQfnumber(res, "tablespace");

 	dbCatId.tableoid = atooid(PQgetvalue(res, 0, i_tableoid));


[include][platform][timer] enable platform_stop_timer for non-dynamic timers

--- include/platform/timer.h
+++ include/platform/timer.h
@@ -28,10 +28,10 @@
 typedef enum handler_return (*platform_timer_callback)(void *arg, lk_time_t now);

 status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval);
+void     platform_stop_timer(void);

 #if PLATFORM_HAS_DYNAMIC_TIMER
 status_t platform_set_oneshot_timer (platform_timer_callback callback, void *arg, lk_time_t interval);
-void     platform_stop_timer(void);
 #endif

 #endif


call condor_free in cfree() instead of default free

--- src/condor_ckpt/malloc.c
+++ src/condor_ckpt/malloc.c
@@ -823,6 +823,7 @@
 #define pvALLOc		condor_pvalloc
 #define mALLINFo	condor_mallinfo
 #define mALLOPt		condor_mallopt
+#define free		condor_free
 #define cfree		condor_cfree
 #define malloc_trim	condor_malloc_trim
 #define malloc_usable_size	condor_malloc_usable_size


add sdr-receiver-udp

add sdr-receiver-udp

error: pathspec 'projects/sdr_receiver_nodma/server/sdr-receiver-udp.c' did not match any file(s) known to git

--- projects/sdr_receiver_nodma/server/sdr-receiver-udp.c
+++ projects/sdr_receiver_nodma/server/sdr-receiver-udp.c
@@ -0,0 +1,204 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#define TCP_PORT 1001
+#define UDP_PORT 1002
+
+int interrupted = 0;
+
+void signal_handler(int sig)
+{
+  interrupted = 1;
+}
+
+int main(int argc, char *argv[])
+{
+  int file, sockServer, sockClient;
+  int pos, limit, start;
+  pid_t pid;
+  void *cfg, *sts, *ram;
+  char *name = "/dev/mem";
+  unsigned long size = 0;
+  struct sockaddr_in addrServer, addrClient;
+  socklen_t lenClient;
+  uint32_t command = 600000;
+  uint32_t freqMin = 100000;
+  uint32_t freqMax = 50000000;
+  int yes = 1;
+
+  if((file = open(name, O_RDWR)) < 0)
+  {
+    perror("open");
+    return 1;
+  }
+
+  cfg = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, file, 0x40000000);
+  sts = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, file, 0x40001000);
+  ram = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, file, 0x40002000);
+
+  if((sockServer = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+  {
+    perror("socket");
+    return 1;
+  }
+
+  setsockopt(sockServer, SOL_SOCKET, SO_REUSEADDR, (void *)&yes , sizeof(yes));
+
+  /* set up server address */
+  memset(&addrServer, 0, sizeof(addrServer));
+  addrServer.sin_family = AF_INET;
+  addrServer.sin_addr.s_addr = htonl(INADDR_ANY);
+  addrServer.sin_port=htons(TCP_PORT);
+
+  if(bind(sockServer, (struct sockaddr *)&addrServer, sizeof(addrServer)) < 0)
+  {
+    perror("bind");
+    return 1;
+  }
+
+  listen(sockServer, 1024);
+
+  lenClient = sizeof(addrClient);
+
+  limit = 128;
+
+  while(!interrupted)
+  {
+    /* enter reset mode */
+    *((uint32_t *)(cfg + 0)) &= ~15;
+    /* set default phase increment */
+    *((uint32_t *)(cfg + 4)) = (uint32_t)floor(600000/125.0e6*(1<<30)+0.5);
+    /* set default sample rate */
+    *((uint32_t *)(cfg + 8)) = 625;
+
+    if((sockClient = accept(sockServer, (struct sockaddr *)&addrClient, &lenClient)) < 0)
+    {
+      perror("accept");
+      return 1;
+    }
+
+    pid = fork();
+    if(pid == 0)
+    {
+      /* child process */
+
+      int sockData;
+      struct sockaddr_in addrData;
+      int pos, limit, start;
+
+      if((sockData = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+      {
+        perror("socket");
+        return 1;
+      }
+
+      /* set up destination address */
+      memset(&addrData, 0, sizeof(addrData));
+      addrData.sin_family = AF_INET;
+      addrData.sin_addr = addrClient.sin_addr;
+      addrData.sin_port = htons(UDP_PORT);
+
+      connect(sockData, (struct sockaddr *)&addrData, sizeof(addrData));
+
+      signal(SIGINT, signal_handler);
+
+      limit = 128;
+
+      while(!interrupted)
+      {
+        /* read ram writer position */
+        pos = *((uint32_t *)(sts + 0));
+
+        /* send 1024 bytes if ready, otherwise sleep 0.5 ms */
+        if((limit > 0 && pos > limit) || (limit == 0 && pos < 384))
+        {
+          start = limit > 0 ? limit*8 - 1024 : 3072;
+          send(sockData, ram + start, 1024, 0);
+          limit += 128;
+          if(limit == 512) limit = 0;
+        }
+        else
+        {
+          usleep(100);
+        }
+      }
+
+      close(sockData);
+
+      return 0;
+    }
+    else if(pid > 0)
+    {
+      /* parent process */
+
+      /* enter normal operating mode */
+      *((uint32_t *)(cfg + 0)) |= 15;
+
+      while(!interrupted)
+      {
+        if(recv(sockClient, (char *)&command, 4, 0) == 0) break;
+        switch(command >> 31)
+        {
+          case 0:
+            /* set phase increment */
+            if(command < freqMin || command > freqMax) continue;
+            *((uint32_t *)(cfg + 4)) = (uint32_t)floor(command/125.0e6*(1<<30)+0.5);
+            break;
+          case 1:
+            /* set bandwidth */
+            switch(command & 3)
+            {
+              case 0:
+                freqMin = 75000;
+                *((uint32_t *)(cfg + 0)) &= ~8;
+                *((uint32_t *)(cfg + 8)) = 1250;
+                *((uint32_t *)(cfg + 0)) |= 8;
+                break;
+              case 1:
+                freqMin = 100000;
+                *((uint32_t *)(cfg + 0)) &= ~8;
+                *((uint32_t *)(cfg + 8)) = 625;
+                *((uint32_t *)(cfg + 0)) |= 8;
+                break;
+              case 2:
+                freqMin = 175000;
+                *((uint32_t *)(cfg + 0)) &= ~8;
+                *((uint32_t *)(cfg + 8)) = 250;
+                *((uint32_t *)(cfg + 0)) |= 8;
+                break;
+              case 3:
+                freqMin = 300000;
+                *((uint32_t *)(cfg + 0)) &= ~8;
+                *((uint32_t *)(cfg + 8)) = 125;
+                *((uint32_t *)(cfg + 0)) |= 8;
+                break;
+            }
+            break;
+        }
+      }
+
+      kill(pid, SIGTERM);
+      waitpid(pid, NULL, 0);
+
+      close(sockClient);
+    }
+  }
+
+  close(sockServer);
+
+  /* enter reset mode */
+  *((uint32_t *)(cfg + 0)) &= ~15;
+
+  return 0;
+}


Bug Fix

Bug Fix

--- reference-realtime/linux/libraries/SDPlibC/observation.c
+++ reference-realtime/linux/libraries/SDPlibC/observation.c
@@ -11,7 +11,7 @@
         char *buffer=malloc(30*sizeof(char));
         time(&curtime);
         timeTF = localtime( &curtime );
-        strftime(buffer,30,"%Y/%m/%dT%XZ",timeTF);
+        strftime(buffer,30,"%Y-%m-%dT%XZ",timeTF);
         return buffer;
 }


Clarify doc

Clarify doc

--- include/antoniocoratelli/statemachine/StateMachine.h
+++ include/antoniocoratelli/statemachine/StateMachine.h
@@ -13,8 +13,8 @@
  * StateMachine implements the logic to check the type of the current state,
  * handles state changes for ControllableEvents, and delegates the handling of
  * NonControllableEvents to the current State object.
- * There is no need in theory to subclass this class, but in practice it's
- * better to override the name() and info() methods to display more
+ * There is no need in theory to subclass StateMachine, but in practice it's
+ * nice to override the name() and info() methods to display more
  * meaningful and descriptive information.
  */
 class StateMachine {


tifflike: Convert value data on read, not on use

--- src/openslide-decode-tifflike.c
+++ src/openslide-decode-tifflike.c
@@ -42,6 +42,8 @@
 #define TIFF_IFD8 18
 #endif

+#define NO_OFFSET UINT64_MAX
+

 struct _openslide_tifflike {
   char *filename;
@@ -53,7 +55,12 @@
   uint16_t type;
   int64_t count;
   uint64_t offset;
-  void *value;
+
+  // data format variants
+  uint64_t *uints;
+  int64_t *sints;
+  double *floats;
+  void *buffer;
 };

@@ -160,10 +167,149 @@
   }
 }

+#define ALLOC_VALUES_OR_FAIL(OUT, TYPE, COUNT) do {			\
+    OUT = g_try_new(TYPE, COUNT);					\
+    if (!OUT) {								\
+      g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,	\
+                  "Cannot allocate TIFF value array");			\
+      goto FAIL;							\
+    }									\
+  } while (0)
+
+#define CONVERT_VALUES_EXTEND(TO, FROM_TYPE, FROM, COUNT) do {		\
+    const FROM_TYPE *from = (const FROM_TYPE *) FROM;			\
+    for (uint64_t i = 0; i < COUNT; i++) {				\
+      TO[i] = from[i];							\
+    }									\
+  } while (0)
+
+#define CONVERT_VALUES_RATIONAL(TO, FROM_TYPE, FROM, COUNT) do {	\
+    const FROM_TYPE *from = (const FROM_TYPE *) FROM;			\
+    for (uint64_t i = 0; i < COUNT; i++) {				\
+      TO[i] = (double) from[i * 2] / (double) from[i * 2 + 1];		\
+    }									\
+  } while (0)
+
+static bool set_item_values(struct tiff_item *item,
+                            const void *buf,
+                            GError **err) {
+  //g_debug("setting values for item type %d", item->type);
+
+  uint64_t count = item->count;
+  uint32_t value_size = get_value_size(item->type, &count);
+  g_assert(value_size);
+
+  switch (item->type) {
+  // uints
+  case TIFF_BYTE:
+    if (!item->uints) {
+      ALLOC_VALUES_OR_FAIL(item->uints, uint64_t, count);
+      CONVERT_VALUES_EXTEND(item->uints, uint8_t, buf, count);
+    }
+    break;
+  case TIFF_SHORT:
+    if (!item->uints) {
+      ALLOC_VALUES_OR_FAIL(item->uints, uint64_t, count);
+      CONVERT_VALUES_EXTEND(item->uints, uint16_t, buf, count);
+    }
+    break;
+  case TIFF_LONG:
+  case TIFF_IFD:
+    if (!item->uints) {
+      ALLOC_VALUES_OR_FAIL(item->uints, uint64_t, count);
+      CONVERT_VALUES_EXTEND(item->uints, uint32_t, buf, count);
+    }
+    break;
+  case TIFF_LONG8:
+  case TIFF_IFD8:
+    if (!item->uints) {
+      ALLOC_VALUES_OR_FAIL(item->uints, uint64_t, count);
+      memcpy(item->uints, buf, sizeof(uint64_t) * count);
+    }
+    break;
+
+  // sints
+  case TIFF_SBYTE:
+    if (!item->sints) {
+      ALLOC_VALUES_OR_FAIL(item->sints, int64_t, count);
+      CONVERT_VALUES_EXTEND(item->sints, int8_t, buf, count);
+    }
+    break;
+  case TIFF_SSHORT:
+    if (!item->sints) {
+      ALLOC_VALUES_OR_FAIL(item->sints, int64_t, count);
+      CONVERT_VALUES_EXTEND(item->sints, int16_t, buf, count);
+    }
+    break;
+  case TIFF_SLONG:
+    if (!item->sints) {
+      ALLOC_VALUES_OR_FAIL(item->sints, int64_t, count);
+      CONVERT_VALUES_EXTEND(item->sints, int32_t, buf, count);
+    }
+    break;
+  case TIFF_SLONG8:
+    if (!item->sints) {
+      ALLOC_VALUES_OR_FAIL(item->sints, int64_t, count);
+      memcpy(item->sints, buf, sizeof(int64_t) * count);
+    }
+    break;
+
+  // floats
+  case TIFF_FLOAT:
+    if (!item->floats) {
+      ALLOC_VALUES_OR_FAIL(item->floats, double, count);
+      CONVERT_VALUES_EXTEND(item->floats, float, buf, count);
+    }
+    break;
+  case TIFF_DOUBLE:
+    if (!item->floats) {
+      ALLOC_VALUES_OR_FAIL(item->floats, double, count);
+      memcpy(item->floats, buf, sizeof(double) * count);
+    }
+    break;
+  case TIFF_RATIONAL:
+    // convert 2 longs into rational
+    if (!item->floats) {
+      ALLOC_VALUES_OR_FAIL(item->floats, double, count);
+      CONVERT_VALUES_RATIONAL(item->floats, uint32_t, buf, count);
+    }
+    break;
+  case TIFF_SRATIONAL:
+    // convert 2 slongs into rational
+    if (!item->floats) {
+      ALLOC_VALUES_OR_FAIL(item->floats, double, count);
+      CONVERT_VALUES_RATIONAL(item->floats, int32_t, buf, count);
+    }
+    break;
+
+  // buffer
+  case TIFF_ASCII:
+  case TIFF_UNDEFINED:
+    if (!item->buffer) {
+      ALLOC_VALUES_OR_FAIL(item->buffer, char, count);
+      memcpy(item->buffer, buf, count);
+    }
+    break;
+
+  // default
+  default:
+    g_assert_not_reached();
+  }
+
+  // record that we've set all values
+  item->offset = NO_OFFSET;
+  return true;
+
+FAIL:
+  return false;
+}
+
 static bool populate_item(struct _openslide_tifflike *tl,
                           struct tiff_item *item,
                           GError **err) {
-  if (item->value) {
+  bool success = false;
+
+  if (item->offset == NO_OFFSET) {
     return true;
   }

@@ -177,8 +323,8 @@
   g_assert(value_size);
   ssize_t len = value_size * count;

-  void *result = g_try_malloc(len);
-  if (result == NULL) {
+  void *buf = g_try_malloc(len);
+  if (buf == NULL) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Cannot allocate TIFF value");
     goto FAIL;
@@ -189,28 +335,32 @@
     _openslide_io_error(err, "Couldn't seek to read TIFF value");
     goto FAIL;
   }
-  if (fread(result, len, 1, f) != 1) {
+  if (fread(buf, len, 1, f) != 1) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Couldn't read TIFF value");
     goto FAIL;
   }

-  fix_byte_order(result, value_size, count, tl->big_endian);
-  item->value = result;
-
+  fix_byte_order(buf, value_size, count, tl->big_endian);
+  if (!set_item_values(item, buf, err)) {
+    goto FAIL;
+  }
+
+  success = true;
+
+FAIL:
+  g_free(buf);
   fclose(f);
-  return true;
-
-FAIL:
-  g_free(result);
-  fclose(f);
-  return false;
+  return success;
 }

 static void tiff_item_destroy(gpointer data) {
   struct tiff_item *item = data;

-  g_free(item->value);
+  g_free(item->uints);
+  g_free(item->sints);
+  g_free(item->floats);
+  g_free(item->buffer);
   g_slice_free(struct tiff_item, item);
 }

@@ -310,8 +460,10 @@
     // does value/offset contain the value?
     if (value_size * count <= sizeof(value)) {
       // yes
-      item->value = g_memdup(value, value_size * count);
-      fix_byte_order(item->value, value_size, count, big_endian);
+      fix_byte_order(value, value_size, count, big_endian);
+      if (!set_item_values(item, value, err)) {
+        goto FAIL;
+      }

     } else {
       // no; store offset
@@ -607,23 +759,13 @@
   if (item == NULL || !populate_item(tl, item, err)) {
     return 0;
   }
-  switch (item->type) {
-  case TIFF_BYTE:
-    return ((uint8_t *) item->value)[i];
-  case TIFF_SHORT:
-    return ((uint16_t *) item->value)[i];
-  case TIFF_LONG:
-  case TIFF_IFD:
-    return ((uint32_t *) item->value)[i];
-  case TIFF_LONG8:
-  case TIFF_IFD8:
-    return ((uint64_t *) item->value)[i];
-  default:
+  if (!item->uints) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Unexpected value type: directory %"G_GINT64_FORMAT", "
                 "tag %d, type %d", dir, tag, item->type);
     return 0;
   }
+  return item->uints[i];
 }

 int64_t _openslide_tifflike_get_sint(struct _openslide_tifflike *tl,
@@ -633,21 +775,13 @@
   if (item == NULL || !populate_item(tl, item, err)) {
     return 0;
   }
-  switch (item->type) {
-  case TIFF_SBYTE:
-    return ((int8_t *) item->value)[i];
-  case TIFF_SSHORT:
-    return ((int16_t *) item->value)[i];
-  case TIFF_SLONG:
-    return ((int32_t *) item->value)[i];
-  case TIFF_SLONG8:
-    return ((int64_t *) item->value)[i];
-  default:
+  if (!item->sints) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Unexpected value type: directory %"G_GINT64_FORMAT", "
                 "tag %d, type %d", dir, tag, item->type);
     return 0;
   }
+  return item->sints[i];
 }

 double _openslide_tifflike_get_float(struct _openslide_tifflike *tl,
@@ -657,33 +791,13 @@
   if (item == NULL || !populate_item(tl, item, err)) {
     return NAN;
   }
-  switch (item->type) {
-  case TIFF_FLOAT: {
-    float val;
-    memcpy(&val, ((uint32_t *) item->value) + i, sizeof(val));
-    return val;
-  }
-  case TIFF_DOUBLE: {
-    double val;
-    memcpy(&val, ((uint64_t *) item->value) + i, sizeof(val));
-    return val;
-  }
-  case TIFF_RATIONAL: {
-    // convert 2 longs into rational
-    uint32_t *val = item->value;
-    return (double) val[i * 2] / (double) val[i * 2 + 1];
-  }
-  case TIFF_SRATIONAL: {
-    // convert 2 slongs into rational
-    int32_t *val = item->value;
-    return (double) val[i * 2] / (double) val[i * 2 + 1];
-  }
-  default:
+  if (!item->floats) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Unexpected value type: directory %"G_GINT64_FORMAT", "
                 "tag %d, type %d", dir, tag, item->type);
     return NAN;
   }
+  return item->floats[i];
 }

 const void *_openslide_tifflike_get_buffer(struct _openslide_tifflike *tl,
@@ -699,16 +813,13 @@
   if (!populate_item(tl, item, err)) {
     return NULL;
   }
-  switch (item->type) {
-  case TIFF_ASCII:
-  case TIFF_UNDEFINED:
-    return item->value;
-  default:
+  if (!item->buffer) {
     g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_BAD_DATA,
                 "Unexpected value type: directory %"G_GINT64_FORMAT", "
                 "tag %d, type %d", dir, tag, item->type);
     return NULL;
   }
+  return item->buffer;
 }

 static const char *store_string_property(struct _openslide_tifflike *tl,


Allow the pointer for graphics_buffer_package to always be visible even if it isn't defined on that build.

--- source/command/cmiss.c
+++ source/command/cmiss.c
@@ -266,8 +266,10 @@
 	struct MANAGER(Environment_map) *environment_map_manager;
 	struct MANAGER(FE_basis) *basis_manager;
 	struct LIST(FE_element_shape) *element_shape_list;
+	/* Always want the entry for graphics_buffer_package even if it will
+		not be available on this implementation */
+	struct Graphics_buffer_package *graphics_buffer_package;
 #if defined (MOTIF) || defined (GTK_USER_INTERFACE)
-	struct Graphics_buffer_package *graphics_buffer_package;
 	struct MANAGER(Graphics_window) *graphics_window_manager;
 #endif /* defined (MOTIF) || defined (GTK_USER_INTERFACE) */
 	struct MANAGER(Interactive_tool) *interactive_tool_manager;
@@ -23633,8 +23635,8 @@
 		command_data->volume_texture_manager=(struct MANAGER(VT_volume_texture) *)NULL;
 		command_data->default_spectrum=(struct Spectrum *)NULL;
 		command_data->spectrum_manager=(struct MANAGER(Spectrum) *)NULL;
+		command_data->graphics_buffer_package=(struct Graphics_buffer_package *)NULL;
 #if defined (MOTIF) || defined (GTK_USER_INTERFACE)
-		command_data->graphics_buffer_package=(struct Graphics_buffer_package *)NULL;
 		command_data->graphics_window_manager=(struct MANAGER(Graphics_window) *)NULL;
 #endif /* defined (MOTIF) || defined (GTK_USER_INTERFACE) */
 		command_data->root_region = (struct Cmiss_region *)NULL;
@@ -24786,11 +24788,11 @@
 		DESTROY(MANAGER(Graphics_window))(
 			&command_data->graphics_window_manager);
 		/* Must destroy the graphics_buffer_package after the windows which use it */
+#endif /* defined (MOTIF)|| defined (GTK_USER_INTERFACE) */
 		if (command_data->graphics_buffer_package)
 		{
 			DESTROY(Graphics_buffer_package)(&command_data->graphics_buffer_package);
 		}
-#endif /* defined (MOTIF)|| defined (GTK_USER_INTERFACE) */

 		if (command_data->computed_field_finite_element_package)
 		{


Fix calculation of latency of pgbench backslash commands.

When we loop back to the top of doCustom after processing a backslash
command, we must reset the "now" timestamp, because that's used to
calculate the time spent executing the previous command.

Report and fix by Fabien Coelho. Backpatch to 9.5, where this was broken.

--- src/bin/pgbench/pgbench.c
+++ src/bin/pgbench/pgbench.c
@@ -1135,11 +1135,12 @@
 	 * first time it's needed, and reuse the same value throughout this
 	 * function after that. This also ensures that e.g. the calculated latency
 	 * reported in the log file and in the totals are the same. Zero means
-	 * "not set yet".
+	 * "not set yet". Reset "now" when we step to the next command with "goto
+	 * top", though.
 	 */
+top:
 	INSTR_TIME_SET_ZERO(now);

-top:
 	commands = sql_files[st->use_file];

 	/*


Cleanup comments

Cleanup comments

Swift SVN r8183

--- include/swift/AST/Expr.h
+++ include/swift/AST/Expr.h
@@ -1639,13 +1639,12 @@
   ArrayRef<ValueDecl*> getCaptures() const { return Captures; }
   void setCaptures(ArrayRef<ValueDecl*> C) { Captures = C; }

-  /// getLocalCaptures - Return a filtered list of the captures for this
-  /// function, filtering out global variables.  This list returns the list that
+  /// \brief Return a filtered list of the captures for this function,
+  /// filtering out global variables.  This function returns the list that
   /// actually needs to be closed over.
-  std::vector<ValueDecl*> getLocalCaptures() const;
-
-  /// hasLocalCaptures - Return true if getLocalCaptures() will return a
-  /// non-empty list.
+  std::vector<ValueDecl *> getLocalCaptures() const;
+
+  /// \returns true if getLocalCaptures() will return a non-empty list.
   bool hasLocalCaptures() const;

   /// Returns the parameter patterns of the function, using


Make some function arguments 'const'.

Make some function arguments 'const'.

--- include/deal.II/grid/grid_tools_cache_update_flags.h
+++ include/deal.II/grid/grid_tools_cache_update_flags.h
@@ -70,7 +70,8 @@
    */
   template <class StreamType>
   inline
-  StreamType &operator << (StreamType &s, CacheUpdateFlags u)
+  StreamType &operator << (StreamType &s,
+                           const CacheUpdateFlags u)
   {
     s << " CacheUpdateFlags";
     if (u & update_vertex_to_cell_map)                 s << "|vertex_to_cell_map";
@@ -93,7 +94,8 @@
    */
   inline
   CacheUpdateFlags
-  operator | (CacheUpdateFlags f1, CacheUpdateFlags f2)
+  operator | (const CacheUpdateFlags f1,
+              const CacheUpdateFlags f2)
   {
     return static_cast<CacheUpdateFlags> (
              static_cast<unsigned int> (f1) |
@@ -111,7 +113,7 @@
    */
   inline
   CacheUpdateFlags
-  operator ~ (CacheUpdateFlags f1)
+  operator ~ (const CacheUpdateFlags f1)
   {
     return static_cast<CacheUpdateFlags> (
              ~static_cast<unsigned int> (f1)
@@ -128,7 +130,8 @@
    */
   inline
   CacheUpdateFlags &
-  operator |= (CacheUpdateFlags &f1, CacheUpdateFlags f2)
+  operator |= (CacheUpdateFlags &f1,
+               const CacheUpdateFlags f2)
   {
     f1 = f1 | f2;
     return f1;
@@ -146,7 +149,8 @@
    */
   inline
   CacheUpdateFlags
-  operator & (CacheUpdateFlags f1, CacheUpdateFlags f2)
+  operator & (const CacheUpdateFlags f1,
+              const CacheUpdateFlags f2)
   {
     return static_cast<CacheUpdateFlags> (
              static_cast<unsigned int> (f1) &
@@ -162,7 +166,8 @@
    */
   inline
   CacheUpdateFlags &
-  operator &= (CacheUpdateFlags &f1, CacheUpdateFlags f2)
+  operator &= (CacheUpdateFlags &f1,
+               const CacheUpdateFlags f2)
   {
     f1 = f1 & f2;
     return f1;


Fixed SVACE error in BridgeBase

Fixed SVACE error in BridgeBase

Change-Id: I1a6bdbaf6b6c3c2e080f1767533f5471f4b4395f

--- dali/internal/accessibility/bridge/bridge-base.h
+++ dali/internal/accessibility/bridge/bridge-base.h
@@ -301,7 +301,7 @@
   DBusWrapper::ConnectionPtr con;
   int                        id = 0;
   DBus::DBusClient           registry;
-  bool                       allowObjectBoundsChangedEvent;
+  bool                       allowObjectBoundsChangedEvent{false};
 };

 #endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_BASE_H


[AST] NFC: Repack misc CollectionExpr bits

--- include/swift/AST/Expr.h
+++ include/swift/AST/Expr.h
@@ -138,6 +138,12 @@
     /// Whether the Expr represents something directly written in source or
     /// it was implicitly generated by the type-checker.
     Implicit : 1
+  );
+
+  SWIFT_INLINE_BITFIELD(CollectionExpr, Expr, 1,
+    /// True if the type of this collection expr was inferred by the collection
+    /// fallback type, like [Any].
+    IsTypeDefaulted : 1
   );

   SWIFT_INLINE_BITFIELD_EMPTY(LiteralExpr, Expr);
@@ -359,6 +365,7 @@
     SWIFT_INLINE_BITS(KeyPathExpr);
     SWIFT_INLINE_BITS(ParenExpr);
     SWIFT_INLINE_BITS(SequenceExpr);
+    SWIFT_INLINE_BITS(CollectionExpr);
   } Bits;

 private:
@@ -2059,17 +2066,14 @@

   Expr *SemanticExpr = nullptr;

-  /// True if the type of this collection expr was inferred by the collection
-  /// fallback type, like [Any].
-  bool IsTypeDefaulted = false;
-
 protected:
   CollectionExpr(ExprKind Kind, SourceLoc LBracketLoc,
                  MutableArrayRef<Expr*> Elements,
                  SourceLoc RBracketLoc, Type Ty)
     : Expr(Kind, /*Implicit=*/false, Ty),
-      LBracketLoc(LBracketLoc), RBracketLoc(RBracketLoc),
-      Elements(Elements) { }
+      LBracketLoc(LBracketLoc), RBracketLoc(RBracketLoc), Elements(Elements) {
+    Bits.CollectionExpr.IsTypeDefaulted = false;
+  }

 public:

@@ -2080,8 +2084,10 @@
   void setElement(unsigned i, Expr *E) { Elements[i] = E; }
   unsigned getNumElements() const { return Elements.size(); }

-  bool isTypeDefaulted() const { return IsTypeDefaulted; }
-  void setIsTypeDefaulted(bool value = true) { IsTypeDefaulted = value; }
+  bool isTypeDefaulted() const { return Bits.CollectionExpr.IsTypeDefaulted; }
+  void setIsTypeDefaulted(bool value = true) {
+    Bits.CollectionExpr.IsTypeDefaulted = value;
+  }

   SourceLoc getLBracketLoc() const { return LBracketLoc; }
   SourceLoc getRBracketLoc() const { return RBracketLoc; }


Adding a method to determine command type

--- src/bloomd/conn_handler.c
+++ src/bloomd/conn_handler.c
@@ -2,6 +2,25 @@
 #include <stdio.h>
 #include <string.h>
 #include "conn_handler.h"
+
+enum conn_cmd_type {
+    ERR = -1,       // Error determining type
+    UNKNOWN = 0,    // Unrecognized command
+    CHECK,          // Check a single key
+    CHECK_MULTI,    // Check multiple space-seperated keys
+    SET,            // Set a single key
+    SET_MULTI,      // Set multiple space-seperated keys
+    LIST,           // List filters
+    INFO,           // Info about a fileter
+    CREATE,         // Creates a filter
+    DROP,           // Drop a filter
+    CLOSE,          // Close a filter
+    FLUSH,          // Force flush a filter
+    CONF            // Configuration dump
+};
+
+/* Static method declarations */
+static enum conn_cmd_type determine_client_command(char *cmd_buf, int buf_len, char **arg_buf, int *arg_len);

 /**
  * Invoked by the networking layer when there is new
@@ -26,3 +45,54 @@
     return 0;
 }

+/**
+ * Determines the client command.
+ * @arg cmd_buf A command buffer
+ * @arg buf_len The length of the buffer
+ * @arg arg_buf Output. Sets the start address of the command arguments.
+ * @arg arg_len Output. Sets the length of arg_buf.
+ * @return The conn_cmd_type enum value. Could be ERR if a command is not found,
+ * UNKNOWN if it doesn't match anything supported, or a proper command.
+ */
+static enum conn_cmd_type determine_client_command(char *cmd_buf, int buf_len, char **arg_buf, int *arg_len) {
+    // Scan for a space
+    char *term_addr = memchr(cmd_buf, ' ', buf_len);
+    if (!term_addr) return ERR;
+
+    // Convert the space to a null-seperator
+    *term_addr = '\0';
+
+    // Provide the arg buffer, and arg_len
+    *arg_buf = term_addr+1;
+    *arg_len = buf_len - (term_addr - cmd_buf + 1);
+
+    // Search for the command
+    enum conn_cmd_type type = UNKNOWN;
+    #define CMD_MATCH(name) (strcmp(name, cmd_buf) == 0)
+    if (CMD_MATCH("c") || CMD_MATCH("check")) {
+        type = CHECK;
+    } else if (CMD_MATCH("m") || CMD_MATCH("multi")) {
+        type = CHECK_MULTI;
+    } else if (CMD_MATCH("s") || CMD_MATCH("set")) {
+        type = SET;
+    } else if (CMD_MATCH("b") || CMD_MATCH("bulk")) {
+        type = SET_MULTI;
+    } else if (CMD_MATCH("list")) {
+        type = LIST;
+    } else if (CMD_MATCH("info")) {
+        type = INFO;
+    } else if (CMD_MATCH("create")) {
+        type = CREATE;
+    } else if (CMD_MATCH("drop")) {
+        type = DROP;
+    } else if (CMD_MATCH("close")) {
+        type = CLOSE;
+    } else if (CMD_MATCH("flush")) {
+        type = FLUSH;
+    } else if (CMD_MATCH("conf")) {
+        type = CONF;
+    }
+
+    return type;
+}
+


Add missing #include for STLExtras

Add missing #include for STLExtras

Looks like earlier I was relying on #include ordering in files that
used ScalarEvolutionNormalization.h.

Found thanks to the selfhost modules buildbot!

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

--- include/llvm/Analysis/ScalarEvolutionNormalization.h
+++ include/llvm/Analysis/ScalarEvolutionNormalization.h
@@ -37,6 +37,7 @@
 #define LLVM_ANALYSIS_SCALAREVOLUTIONNORMALIZATION_H

 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/STLExtras.h"

 namespace llvm {


Fix DebugGProof builds on windows.

Fix DebugGProof builds on windows.

GSDLLCALL was not being set.

--- source/gprf/gprf-doc.c
+++ source/gprf/gprf-doc.c
@@ -16,7 +16,6 @@

 /* We are assumed to be using the DLL here */
 #define GSDLLEXPORT
-#define GSDLLCALL
 #ifdef _MSC_VER
 #define GSDLLAPI __stdcall
 #else
@@ -39,6 +38,10 @@
 extern GSDLLEXPORT int GSDLLAPI gsapi_set_stdio(void *, int (GSDLLCALL *)(void *, char *, int), int (GSDLLCALL *)(void *, const char *, int), int (GSDLLCALL *)(void *, const char *, int));
 #endif /* HAVE_IAPI_H */
 #endif /* USE_GS_API */
+
+#ifndef GSDLLCALL
+#define GSDLLCALL
+#endif

 typedef struct gprf_document_s gprf_document;
 typedef struct gprf_chapter_s gprf_chapter;


Doc fixes.

Doc fixes.

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@4023 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/lac/include/lac/block_sparsity_pattern.h
+++ deal.II/lac/include/lac/block_sparsity_pattern.h
@@ -43,18 +43,6 @@
  * that all sub-matrices in a column have to have the same number of
  * columns.
  *
- *
- * @sect2{On template instantiations}
- *
- * Member functions of this class are either implemented in this file
- * or in a file of the same name with suffix ``.templates.h''. For the
- * most common combinations of the template parameters, instantiations
- * of this class are provided in a file with suffix ``.cc'' in the
- * ``source'' directory. If you need an instantiation that is not
- * listed there, you have to include this file along with the
- * corresponding ``.templates.h'' file and instantiate the respective
- * class yourself.
- *
  * @author Wolfgang Bangerth, 2000
  */
 class BlockSparsityPattern : public Subscriptor
@@ -126,7 +114,7 @@
 				      * @p{reinit} functions of the
 				      * blocks themselves. Do not
 				      * forget to call
-				      * @p{collect_size} after that on
+				      * @p{collect_sizes} after that on
 				      * this object.
 				      *
 				      * The reason that you have to


Use the same hashword2 function for both uint16_t and uint64_t types.

The original uint16_t version of hashword2 was not very good at all.

--- include/utils/hashword.h
+++ include/utils/hashword.h
@@ -145,19 +145,13 @@
 inline
 uint64_t hashword2(const uint64_t first, const uint64_t second)
 {
-  // big prime number
-  const unsigned int bp = 65449;
-
-  return (first%bp + (second<<5)%bp);
+  return (first%65449 + (second<<5)%65449);
 }

 inline
 uint16_t hashword2(const uint16_t first, const uint16_t second)
 {
-  // "big" prime number
-  const uint16_t bp = 257;
-
-  return static_cast<uint16_t>(first%bp + (second<<3)%bp);
+  return (first%65449 + (second<<5)%65449);
 }

 // Another homegrown implementation for 64-bit unsigned ints


adds hessenberg decomposition with householder transformations

error: pathspec 'include/math_tools/factorizations/hessenberg_house.h' did not match any file(s) known to git

--- include/math_tools/factorizations/hessenberg_house.h
+++ include/math_tools/factorizations/hessenberg_house.h
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ *
+ * Copyright (c) 2013, Diego Assêncio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************/
+
+
+#ifndef _freeAML_hessenberg_house_h_
+#define _freeAML_hessenberg_house_h_
+
+
+#include "data_structures/vec.h"
+#include "data_structures/mat.h"
+
+
+namespace aml
+{
+
+
+template < class T >
+class hessenberg_house
+{
+
+public:
+
+	/***********************************************************************
+	 *
+	 *	FACTORIZE FUNCTIONS
+	 *
+	 **********************************************************************/
+	/**
+	 * @brief computes the Hessenberg decomposition of an input matrix
+	 * @param A the input matrix which must be factorized
+	 * @param Q at the end, an orthogonal matrix
+	 * @param H at the end, an upper Hessenberg matrix with nonnegative
+	 *        values on its first subdiagonal
+	 * @return true (this function always succeeds)
+	 * @note the Hessenberg decomposition is given by A = QHQ^t; in most
+	 *       cases H is a dense matrix
+	 */
+	template < class _mat1, class _mat2, class _mat3 >
+	bool factorize (const _mat1& A, _mat2& Q, _mat3& H) const;
+
+	/**
+	 * @brief computes the Hessenberg decomposition of an input matrix
+	 * @param A the input matrix which must be factorized
+	 * @param H at the end, an upper Hessenberg matrix with nonnegative
+	 *        values on its first subdiagonal
+	 * @return true (this function always succeeds)
+	 * @note the Hessenberg decomposition is given by A = QHQ^t, but this
+	 *       function computes only H (Q is not computed); in most cases
+	 *       H is a dense matrix
+	 */
+	template < class _mat1, class _mat2 >
+	bool factorize (const _mat1& A, _mat2& H) const;
+
+}; /* end of class hessenberg_house */
+
+
+/*******************************************************************************
+ *
+ *	DEFINITIONS OF CLASS MEMBER FUNCTIONS
+ *
+ ******************************************************************************/
+
+template < class T >
+template < class _mat1, class _mat2, class _mat3 >
+bool hessenberg_house< T >::factorize (const _mat1& A, _mat2& Q, _mat3& H) const
+{
+	FREEAML_ASSERT(A.is_square());
+
+	size_t m = A.num_rows();
+
+	/* P will be the product of Householder transformations */
+	mat< T > P = dense_identity_matrix< T >(m);
+
+	/* assign the correct dimensions to Q and H */
+	Q.resize(m,m);
+	H.resize(m,m);
+
+	/* H <-- A */
+	for (size_t i = 0; i < A.num_rows(); i++)
+	{
+		for (size_t j = 0; j < A.num_cols(); j++)
+		{
+			H(i,j) = A(i,j);
+		}
+	}
+
+	/* for each column p of H which must have the portion below
+	 * its subdiagonal zeroed out */
+	for (size_t p = 0; p < m-1; p++)
+	{
+		size_t M = m-p-1;
+
+		/* let u := H(p+1:m-1,p) */
+		vec< T > u(M, (T) 0);
+
+		for (size_t i = 0; i < M; i++)
+		{
+			u[i] = H(i+p+1,p);
+		}
+
+		/* define the Householder transformation for u which
+		 * projects it onto e_0 = (1,0,...0) */
+		vec< T > v;
+
+		T b,c = 0;
+
+		householder(u,v,b,c,0);
+
+		/* If b = 0, no Householder transformation is necessary */
+		if (b != (T) 0)
+		{
+			mat< T > B(M, M+1, (T) 0);
+			mat< T > C(M, m, (T) 0);
+
+			for (size_t i = 0; i < M; i++)
+			{
+				/* B <-- (I - bvv^*)H(p+1:m-1,p:m-1) */
+				for (size_t j = 0; j <= M; j++)
+				{
+					B(i,j) = H(i+p+1,j+p);
+
+					for (size_t k = 0; k < M; k++)
+					{
+						B(i,j) -= b * v[i] * v[k] * H(k+p+1,j+p);
+					}
+				}
+
+				/* C <-- (I - bvv^*)P(p+1:m-1,0:m-1) */
+				for (size_t j = 0; j < m; j++)
+				{
+					C(i,j) = P(i+p+1,j);
+
+					for (size_t k = 0; k < M; k++)
+					{
+						C(i,j) -= b * v[i] * v[k] * P(k+p+1,j);
+					}
+				}
+			}
+
+			for (size_t i = 0; i < M; i++)
+			{
+				/* H(p+1:m-1,p:m-1) <--- -c*B */
+				for (size_t j = 0; j <= M; j++)
+				{
+					H(i+p+1,j+p) = -c * B(i,j);
+				}
+
+				/* P(p+1:m-1,0:m-1) <--- -c*C */
+				for (size_t j = 0; j < m; j++)
+				{
+					P(i+p+1,j) = -c * C(i,j);
+				}
+			}
+
+			mat< T > D(m, M, (T) 0);
+
+			/* D <-- H(0:m-1,p+1:m-1)(I - b^*vv^*) */
+			for (size_t i = 0; i < m; i++)
+			{
+				for (size_t j = 0; j < M; j++)
+				{
+					D(i,j) = H(i,j+p+1);
+
+					for (size_t k = 0; k < M; k++)
+					{
+						D(i,j) -= b * H(i,k+p+1) * v[k] * v[j];
+					}
+				}
+			}
+
+			/* H(0:m-1,p+1:m-1) <--- -c*D */
+			for (size_t i = 0; i < m; i++)
+			{
+				for (size_t j = 0; j < M; j++)
+				{
+					H(i,j+p+1) = -c*D(i,j);
+				}
+			}
+		}
+	}
+
+	/* Q <-- P^t */
+	for (size_t i = 0; i < Q.num_rows(); i++)
+	{
+		for (size_t j = 0; j < Q.num_cols(); j++)
+		{
+			Q(i,j) = P(j,i);
+		}
+	}
+
+	return true;
+}
+
+
+template < class T >
+template < class _mat1, class _mat2 >
+bool hessenberg_house< T >::factorize (const _mat1& A, _mat2& H) const
+{
+	FREEAML_ASSERT(A.is_square());
+
+	size_t m = A.num_rows();
+
+	/* assign the correct dimensions to H */
+	H.resize(m,m);
+
+	/* H <-- A */
+	for (size_t i = 0; i < A.num_rows(); i++)
+	{
+		for (size_t j = 0; j < A.num_cols(); j++)
+		{
+			H(i,j) = A(i,j);
+		}
+	}
+
+	/* for each column p of H which must have the portion below
+	 * its subdiagonal zeroed out */
+	for (size_t p = 0; p < m-1; p++)
+	{
+		size_t M = m-p-1;
+
+		/* let u := H(p+1:m-1,p) */
+		vec< T > u(M, (T) 0);
+
+		for (size_t i = 0; i < M; i++)
+		{
+			u[i] = H(i+p+1,p);
+		}
+
+		/* define the Householder transformation for u which
+		 * projects it onto e_0 = (1,0,...0) */
+		vec< T > v;
+
+		T b,c = 0;
+
+		householder(u,v,b,c,0);
+
+		/* If b = 0, no Householder transformation is necessary */
+		if (b != (T) 0)
+		{
+			mat< T > B(M, M+1, (T) 0);
+
+			for (size_t i = 0; i < M; i++)
+			{
+				/* B <-- (I - bvv^*)H(p+1:m-1,p:m-1) */
+				for (size_t j = 0; j <= M; j++)
+				{
+					B(i,j) = H(i+p+1,j+p);
+
+					for (size_t k = 0; k < M; k++)
+					{
+						B(i,j) -= b * v[i] * v[k] * H(k+p+1,j+p);
+					}
+				}
+			}
+
+			for (size_t i = 0; i < M; i++)
+			{
+				/* H(p+1:m-1,p:m-1) <--- -c*B */
+				for (size_t j = 0; j <= M; j++)
+				{
+					H(i+p+1,j+p) = -c * B(i,j);
+				}
+			}
+
+			mat< T > D(m, M, (T) 0);
+
+			/* D <-- H(0:m-1,p+1:m-1)(I - b^*vv^*) */
+			for (size_t i = 0; i < m; i++)
+			{
+				for (size_t j = 0; j < M; j++)
+				{
+					D(i,j) = H(i,j+p+1);
+
+					for (size_t k = 0; k < M; k++)
+					{
+						D(i,j) -= b * H(i,k+p+1) * v[k] * v[j];
+					}
+				}
+			}
+
+			/* H(0:m-1,p+1:m-1) <--- -c*D */
+			for (size_t i = 0; i < m; i++)
+			{
+				for (size_t j = 0; j < M; j++)
+				{
+					H(i,j+p+1) = -c*D(i,j);
+				}
+			}
+		}
+	}
+
+	return true;
+}
+
+
+} /* end of namespace aml */
+
+#endif /* _freeAML_hessenberg_house_h_ */


Corrected an error when adding/setting a FullMatrix to the Trilinos sparse matrix.

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@17712 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/lac/include/lac/trilinos_sparse_matrix.h
+++ deal.II/lac/include/lac/trilinos_sparse_matrix.h
@@ -1073,7 +1073,7 @@
 		const unsigned int    n_cols,
 		const unsigned int   *col_indices,
 		const TrilinosScalar *values,
-		const bool            elide_zero_values = false);
+		const bool            elide_zero_values = true);

                                        /**
                                         * Multiply the entire matrix
@@ -2046,7 +2046,7 @@
 	    ExcDimensionMismatch(col_indices.size(), values.n()));

     for (unsigned int i=0; i<row_indices.size(); ++i)
-      set (row_indices[i], col_indices.size(), &col_indices[0], &values(0,0),
+      set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
 	   elide_zero_values);
   }

@@ -2246,7 +2246,7 @@
 	    ExcDimensionMismatch(col_indices.size(), values.n()));

     for (unsigned int i=0; i<row_indices.size(); ++i)
-      add (row_indices[i], col_indices.size(), &col_indices[0], &values(0,0),
+      add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
 	   elide_zero_values);
   }

@@ -2294,7 +2294,7 @@
 				   // are already available...
     if (elide_zero_values == false)
       {
-	col_index_ptr = (int*)&col_indices[0];
+	col_index_ptr = (int*)col_indices;
 	col_value_ptr = values;
       }
     else


Make offset_t unsigned

Make offset_t unsigned

No need for it to be signed, we use it for file and device offsets which
cannot be negative.

--- source/include/types.h
+++ source/include/types.h
@@ -1,7 +1,7 @@
 /**
  * The MIT License (MIT)
  *
- * Copyright (c) 2014 <author>
+ * Copyright (c) 2014 Gil Mendes
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -74,7 +74,7 @@
 typedef signed __INT_64 int64_t;	// Signed 64-bit.

 // Extra integer types.
-typedef int64_t offset_t;		// Type used to store an offset into a object.
+typedef uint64_t offset_t;		// Type used to store an offset into a file/device.
 typedef int64_t mstime_t;		// Type used to store a time value in milliseconds.

 // Type limit macros.


Use initializer list and remove default ctor

Otherwise, when re-initializing the vector wrapper, the raw
pointer somehow becomes invalid

--- include/visionaray/bvh.h
+++ include/visionaray/bvh.h
@@ -175,10 +175,10 @@

     device_bvh(bvh<P> const& host_bvh)
         : primitives_(host_bvh.num_prims)
+        , nodes_(host_bvh.nodes_vector())
+        , prim_indices_(host_bvh.prim_indices_vector())
     {
         thrust::copy(host_bvh.primitives(), host_bvh.primitives() + host_bvh.num_prims, primitives_.begin());
-        nodes_ = host_bvh.nodes_vector();
-        prim_indices_ = host_bvh.prim_indices_vector();
     }

     VSNRAY_GPU_FUNC P const*        primitives() const      { return primitives_.data(); }


add missing include

add missing include

--- source/threadingzeug/include/threadingzeug/parallelfor.h
+++ source/threadingzeug/include/threadingzeug/parallelfor.h
@@ -2,6 +2,7 @@

 #include <functional>
 #include <vector>
+#include <cstddef>

 #include <threadingzeug/threadingzeug_api.h>


Fix fz_try typo in openssl code.

Fix fz_try typo in openssl code.

--- source/pdf/pdf-pkcs7.c
+++ source/pdf/pdf-pkcs7.c
@@ -681,7 +681,7 @@

 	fz_var(byte_range);
 	fz_var(res);
-	fz_try(ctx);
+	fz_try(ctx)
 	{
 		byte_range_len = pdf_signature_widget_byte_range(ctx, doc, widget, NULL);
 		if (byte_range_len)


Remove extra linefeed.

Remove extra linefeed.


Update guard to use PERFETTO_BUILDFLAG

Update guard to use PERFETTO_BUILDFLAG

Fix a left over use of defined(PERFETTO_OS_ANDROID) to use
PERFETTO_BUILDFLAG instead. Also update the ifs to test
PERFETTO_ANDROID_BUILD instead of PERFETTO_OS_ANDROID, the former
seems more correct since the code is about which task runner to use
and we only want to use the Android task runner when building
with Dropbox support.

Change-Id: Ic5804dee2db0e07295f4b7c1519136c365438f60

--- src/perfetto_cmd/perfetto_cmd.h
+++ src/perfetto_cmd/perfetto_cmd.h
@@ -32,10 +32,9 @@

 #include "src/perfetto_cmd/perfetto_cmd_state.pb.h"

-#if defined(PERFETTO_OS_ANDROID)
+#if PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)
 #include "perfetto/base/android_task_runner.h"
-#endif  // defined(PERFETTO_OS_ANDROID)
-
+#endif  // PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)

 namespace perfetto {

@@ -43,7 +42,7 @@
 // created by the system by setting setprop persist.traced.enable=1.
 extern const char* kTempDropBoxTraceDir;

-#if defined(PERFETTO_OS_ANDROID)
+#if PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)
 using PlatformTaskRunner = base::AndroidTaskRunner;
 #else
 using PlatformTaskRunner = base::UnixTaskRunner;


Update: rename guardian to PCL_STANFORD_GICP_H_

git-svn-id: 1af002208e930b4d920e7c2b948d1e98a012c795@1627 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- registration/include/pcl/registration/stanford_gicp.h
+++ registration/include/pcl/registration/stanford_gicp.h
@@ -33,8 +33,8 @@
  *
  */

-#ifndef PCL_GICP_H_
-#define PCL_GICP_H_
+#ifndef PCL_STANFORD_GICP_H_
+#define PCL_STANFORD_GICP_H_

 #include <pcl/io/pcd_io.h>
 // PCL includes


missing docblock

missing docblock

--- src/Domino/Exception/BoardPositionOutOfBoundsException.h
+++ src/Domino/Exception/BoardPositionOutOfBoundsException.h
@@ -11,6 +11,9 @@
     class BoardPositionOutOfBoundsException : public BoardPositionException
     {
         public:
+            /**
+             * @param BoardPosition* position
+             */
             BoardPositionOutOfBoundsException(BoardPosition* position);
     };
 }


net/mlx4_core: Fix wrong order of flow steering resources removal

On the resource tracker cleanup flow, the DMFS rules must be deleted before we
destroy the QPs, else the HW may attempt doing packet steering to non existent QPs.

Signed-off-by: Hadar Hen Zion <f123de60578eb6d9cbd4864e6cb3528037b018df@mellanox.com>
Signed-off-by: Or Gerlitz <de1b678a59344538ef9f2ddb34a5f9486544e2f9@mellanox.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -3806,6 +3806,7 @@
 	mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex);
 	/*VLAN*/
 	rem_slave_macs(dev, slave);
+	rem_slave_fs_rule(dev, slave);
 	rem_slave_qps(dev, slave);
 	rem_slave_srqs(dev, slave);
 	rem_slave_cqs(dev, slave);
@@ -3814,6 +3815,5 @@
 	rem_slave_mtts(dev, slave);
 	rem_slave_counters(dev, slave);
 	rem_slave_xrcdns(dev, slave);
-	rem_slave_fs_rule(dev, slave);
 	mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex);
 }


baseband/turbo_sw: fix exposed LLR decimals assumption

The actual LLR representation was incorrectly assumed to be 2
instead of 4. This would impact wireless performance but is not
critical to be back ported on LTS branches.

Fixes: c769c711757a ("baseband/turbo_sw: extend for 5G")
Cc: stable@dpdk.org

Signed-off-by: Nicolas Chautru <5844138a49a7cd19205c4efe0c7b4bd431c6ad19@intel.com>
Acked-by: Dave Burley <205b3b6406f9e3db434bb67e2555ff7049ca66fd@accelercomm.com>
Acked-by: Akhil Goyal <74d7c4c993a22c1d4f60c46ff3d95c969a24a25c@nxp.com>

--- drivers/baseband/turbo_sw/bbdev_turbo_software.c
+++ drivers/baseband/turbo_sw/bbdev_turbo_software.c
@@ -218,7 +218,7 @@
 					RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE |
 					RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE,
 			.llr_size = 8,
-			.llr_decimals = 2,
+			.llr_decimals = 4,
 			.num_buffers_src =
 					RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 			.num_buffers_hard_out =


Added a public constructor, and a method to bring in line with JTS 1.9.  Changed namespace to geos::algorithm::locate

git-svn-id: 6c2b1bd10c324c49ea9d9e6e31006a80e70507cb@2051 5242fede-7e19-0410-aef8-94bd7d2200fb

--- source/headers/geos/algorithm/SimplePointInAreaLocator.h
+++ source/headers/geos/algorithm/SimplePointInAreaLocator.h
@@ -14,9 +14,10 @@
  *
  **********************************************************************/

-#ifndef GEOS_ALGORITHM_SIMPLEPOINTINAREALOCATOR_H
-#define GEOS_ALGORITHM_SIMPLEPOINTINAREALOCATOR_H
+#ifndef GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H
+#define GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H

+#include <geos/algorithm/locate/PointOnGeometryLocator.h> // inherited

 // Forward declarations
 namespace geos {
@@ -29,8 +30,10 @@

 namespace geos {
 namespace algorithm { // geos::algorithm
+namespace locate { // geos::algorithm::locate

-class SimplePointInAreaLocator {
+class SimplePointInAreaLocator : public PointOnGeometryLocator
+{

 public:

@@ -40,17 +43,30 @@
 	static bool containsPointInPolygon(const geom::Coordinate& p,
 			const geom::Polygon *poly);

+	SimplePointInAreaLocator( const geom::Geometry * g)
+	:	g( g)
+	{ }
+
+	int locate( const geom::Coordinate * p)
+	{
+		return locate( *p, g);
+	}
+
 private:

 	static bool containsPoint(const geom::Coordinate& p,
 			const geom::Geometry *geom);
+
+	const geom::Geometry * g;
+
 };

-} // namespace geos::algorithm
-} // namespace geos
+} // geos::algorithm::locate
+} // geos::algorithm
+} // geos

-#endif // GEOS_ALGORITHM_SIMPLEPOINTINAREALOCATOR_H
+#endif // GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H

 /**********************************************************************
  * $Log$


Changed for deleting unused variables

Changed for deleting unused variables

--- source/image_processing/computed_field_cube_plugin_all.c
+++ source/image_processing/computed_field_cube_plugin_all.c
@@ -439,8 +439,6 @@
 	FE_value x3, y3, z3;

 	FE_value 	pixsize;		/* size of one side of voxel		*/
-
-        FE_value	tline_sp;		/* spacing between test lines in mm	*/
         FE_value	tline_ln;		/* length of all test lines in mm	*/
         int	num_tlines;		/* number of test lines in grid		*/
         int	tintrsctn;		/* total # of intersections		*/
@@ -576,8 +574,6 @@
 			{
 			        iline_sp = 1;
 			}
-                	tline_sp = (FE_value)(iline_sp * pixsize);
-
 		        dradius = (FE_value)radius;
 		        xsize = image->sizes[0];
 		        ysize = image->sizes[1];
@@ -604,7 +600,6 @@
 			tpd = vf / tb;		/* Tb.N, [mm^-1] */
 			tps = (1.0/tpd) - tb;	/* Tb.Sp, [mm] */
 			SMI = 2.025 * 12.0 * mean_curvature *vf / (sd * sd) ;
-			num_tlines /= number_of_dirs;	/* # of test lines for a single rotation */
                 	tintrsctn = 0;
 			num_tlines = 0;

@@ -653,7 +648,7 @@
 			x3 = eigvecs[2];
 			y3 = eigvecs[5];
 			z3 = eigvecs[8];
-
+                        vf *= 100.0;
 			fp = fopen(filename,"wa");
 			fprintf(fp, "Bone Image Analysis Results (3D)\n");
 			fprintf(fp,"\n");
@@ -665,7 +660,7 @@
 			fprintf(fp,"BV(mm^3)         : %.8f\n",bv);
 			fprintf(fp,"TV(mm^3)         : %.8f\n",tv);
 			fprintf(fp,"BS(mm^2)         : %.8f\n",bs);
-			fprintf(fp,"BV/TV(%)         : %.8f\n", bvtv * 100.0);
+			fprintf(fp,"BV/TV(%)         : %.8f\n", vf);
 			fprintf(fp,"BS/BV(mm^2 mm^-3): %.8f\n", sv);
 			fprintf(fp,"Tb.Th(mm)        : %.8f\n", tb);
 			fprintf(fp,"Tb.N(mm^-1)      : %.8f\n", tpd);


Try to fix a valgrind error on 32 bit platforms: use %zu instead of %llu to format a size_t.

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

--- lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
+++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
@@ -1355,8 +1355,8 @@

   insn->length = insn->readerCursor - insn->startLocation;

-  dbgprintf(insn, "Read from 0x%llx to 0x%llx: length %llu",
-          startLoc, insn->readerCursor, insn->length);
+  dbgprintf(insn, "Read from 0x%llx to 0x%llx: length %zu",
+            startLoc, insn->readerCursor, insn->length);

   if (insn->length > 15)
     dbgprintf(insn, "Instruction exceeds 15-byte limit");


Create q5: energy bill

Create q5: energy bill

error: pathspec 'src/ufrn_bti_itp/ponteiros_funcoes_strings_arquivos/q5_energy.c' did not match any file(s) known to git

--- src/ufrn_bti_itp/ponteiros_funcoes_strings_arquivos/q5_energy.c
+++ src/ufrn_bti_itp/ponteiros_funcoes_strings_arquivos/q5_energy.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+
+#define MIN_TAX_KHW 45
+#define MIN_TAX_PRICE 20.00
+#define TAX_PRICE_PER_KHW 0.50
+
+double energyConsumptionBill(double kwh){
+    double bill = MIN_TAX_PRICE;
+    kwh -= MIN_TAX_KHW;
+
+    if (kwh > 0)
+        bill += TAX_PRICE_PER_KHW * kwh;
+
+    return bill;
+}
+
+int main(){
+    double kwh;
+
+    printf("Consumo mensal (em Kwh): ");
+    scanf(" %lf", &kwh);
+
+    printf("Conta: R$ %.2lf\n", energyConsumptionBill(kwh));
+
+    return 0;
+}


Correctly load settings and cookies with --config in app mode

--- midori/main.c
+++ midori/main.c
@@ -1698,19 +1698,21 @@
         midori_startup_timer ("Browser: \t%f");
         if (config)
         {
-            gchar* random_name;
-            gchar* app_name;
-
-            random_name = g_strdup_printf ("app%u", g_random_int ());
-            app_name = g_strconcat ("midori", "_", random_name, NULL);
-            app = g_object_new (MIDORI_TYPE_APP, "name", app_name, NULL);
-            g_free (random_name);
-            g_free (app_name);
-
-            config_file = build_config_filename ("config");
+            SoupSession* session;
+            SoupCookieJar* jar;
+
+            config_file = g_build_filename (config, "config", NULL);
             settings = settings_new_from_file (config_file, &extensions);
             g_free (config_file);
             g_strfreev (extensions);
+
+            session = webkit_get_default_session ();
+            config_file = g_build_filename (config, "cookies.txt", NULL);
+            jar = soup_cookie_jar_text_new (config_file, TRUE);
+            g_free (config_file);
+            soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar));
+            g_object_unref (jar);
+
         }
         else
             settings = katze_object_get_object (browser, "settings");


Parsing a comma as an operator now - unless noop is true

--- lexer.c
+++ lexer.c
@@ -464,8 +464,6 @@
 		case '[':
 		case ']':

-		case ',':
-
 		case '#':

 			return (lex->tok->ttype = ch);
@@ -491,10 +489,20 @@
 			case '|':
 			case '^':
 			case '~':
+			case ',':
 				return ch;
 			default:
 				break;
 		}
+	}
+
+	if (ch == ',') {
+	    if (!lex_tokench(lex, ch) ||
+	        !lex_endtoken(lex))
+	    {
+	        return (lex->tok->ttype = TOKEN_FATAL);
+	    }
+	    return (lex->tok->ttype = TOKEN_OPERATOR);
 	}

 	if (ch == '+' || ch == '-' || /* ++, --, +=, -=  and -> as well! */


changed char to unsigned char

changed char to unsigned char

--- huffman/Node.h
+++ huffman/Node.h
@@ -11,10 +11,10 @@
 public:
   Node_type type;
   int frequency;
-  char data;
+  unsigned char data;
   Node* left;
   Node* right;
-  Node(char d, int s, Node_type = LEAF); // Construct a list
+  Node(unsigned char d, int s, Node_type = LEAF); // Construct a list
   Node(Node* l, Node* r, Node_type = BIND); // Construct a bind node
   ~Node();
   int getFrequency();


we should not log error in preprocess if attached partition is missing. (#6131)

--- src/backend/distributed/commands/table.c
+++ src/backend/distributed/commands/table.c
@@ -439,9 +439,18 @@
 			Oid parentRelationId = AlterTableLookupRelation(alterTableStatement,
 															lockmode);
 			PartitionCmd *partitionCommand = (PartitionCmd *) alterTableCommand->def;
-			bool partitionMissingOk = false;
+			bool partitionMissingOk = true;
 			Oid partitionRelationId = RangeVarGetRelid(partitionCommand->name, lockmode,
 													   partitionMissingOk);
+			if (!OidIsValid(partitionRelationId))
+			{
+				/*
+				 * We can stop propagation here instead of logging error. Pg will complain
+				 * in standard_utility, so we are safe to stop here. We pass missing_ok
+				 * as true to not diverge from pg output.
+				 */
+				return NIL;
+			}

 			if (!IsCitusTable(parentRelationId))
 			{


added non-blocking usb transmit if connection is down

Former-commit-id: ada70acb82b1239cb83e3424f15834ffdbe35cbd

--- hardware/pic32/cores/pic32/HardwareSerial_cdcacm.c
+++ hardware/pic32/cores/pic32/HardwareSerial_cdcacm.c
@@ -15,6 +15,7 @@
 //*	Jun 23,	2011	<MLS> Got code from Rich, started on Serial support for Arduino/chipkit
 //*	Jun 24,	2011	<MLS> USBSerial working completely
 //*	Jul  2,	2011	<MLS/RT> Got the fast transmit buffering working (thanks Rich)
+//*	Aug  2,	2011	<MKS/RT> added code to discard if not attached.
 //************************************************************************

@@ -212,13 +213,13 @@

 	ASSERT(length);

-	if (! gCdcacm_attached || gDiscard)
+	if (! gCdcacm_attached || gDiscard || (length <= 0))
 	{
 		return;
 	}

 	// figure out how many buffers we need
-	buffersNeeded	=	(length+sizeof(gRXbuffer[0])-1)/sizeof(gRXbuffer[0])+1;
+	buffersNeeded	=	(length + sizeof(gRXbuffer[0]) - 1) / sizeof(gRXbuffer[0]) + 1;

 	previousInterrutLevel	=	SPLX(7);

@@ -227,7 +228,7 @@
 	for (;;)
 	{
 		// compute the number of available buffers
-		availableBuffers	=	(gRX_out+NRX-gRX_in)%NRX;
+		availableBuffers	=	(gRX_out + NRX-gRX_in) % NRX;
 		if (! availableBuffers)
 		{
 			availableBuffers	=	NRX;
@@ -239,17 +240,18 @@
 			// we're ready to go
 			break;
 		}
-#ifndef _USE_USB_IRQ_
+#ifdef _USE_USB_IRQ_
+		SPLX(previousInterrutLevel);
+
+		delay(1);
+		if (m++ > 1000)
+		{
+			gDiscard	=	true;
+			return;
+		}
+		previousInterrutLevel	=	SPLX(7);
+#else
 		usb_isr();
-#else
-		SPLX(previousInterrutLevel);
-		//delay(1);
-		//if (m++ > 1000)
-		//{
-		//	gDiscard	=	true;
-		//	return;
-		//}
-		previousInterrutLevel	=	SPLX(7);
 #endif
 	}


update

update

--- src/platform_dependent/nix_platform.c
+++ src/platform_dependent/nix_platform.c
@@ -1256,7 +1256,7 @@
 	f64 start_time = nix_get_time();

 	// http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#getaddrinfo
-	struct addrinfo hints;
+	struct addrinfo hints = { 0 };
 	hints.ai_family   = AF_UNSPEC;   // don't care IPV4 or IPV6
 	hints.ai_socktype = SOCK_STREAM; // TCP stream socket
 	hints.ai_flags    = AI_PASSIVE;  // fill in my IP for me
@@ -1268,6 +1268,7 @@
 	int status = getaddrinfo(task->client.hostname, port_string, &hints, &servinfo);
 	if (status != 0) {
 		printf("[nix_tcp_Engine_consume_client_task] Error: getaddrinfo()\n");
+		printf("     %s\n", gai_strerror(status));
 		goto error;
 	}
 	s32 option = 0;


Added upstream bug link.

Added upstream bug link.

--- vcl/unx/kde4/warning_guard_qhash.h
+++ vcl/unx/kde4/warning_guard_qhash.h
@@ -37,6 +37,8 @@
     Silence down this WaE:
     /usr/include/qt4/QtCore/qscopedpointer.h:83:47: error: declaration of ‘pointer’
     shadows a global declaration [-Werror=shadow]
+
+    Reported upstream as <https://bugreports.qt.nokia.com/browse/QTBUG-22908>.
 */

 #ifdef _MSC_VER


allocate memory for counters from kernel

--- iptables.c
+++ iptables.c
@@ -1,3 +1,4 @@
+/* iptables lowlevel */
 #include "Python.h"
 /* user headers common */
 #include <stdio.h>
@@ -708,7 +709,7 @@
 	unsigned match_offset = 0;
 	struct xt_entry_match *base = NULL;
 	if (!(context && rule_dict && this_entry)) {
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/*copy ipt_entry */
 	this_entry->ip.src.s_addr = DICT_GET_ULONG(rule_dict, "srcip");
@@ -737,7 +738,7 @@
 		Py_XDECREF(matches_dict_next);
 		if (!ret) {
 			Py_XDECREF(matches_dict_iter);
-			goto CLEAR;
+			goto SET_ERROR;
 		}
 		matches_dict_next = PyIter_Next(matches_dict_iter);
 	}
@@ -750,7 +751,7 @@
 	*offset += use_align - (*offset % use_align);
 	this_entry->next_offset = *offset;
 	return 1;
-CLEAR:
+SET_ERROR:
 	return 0;
 }

@@ -763,7 +764,7 @@
 	struct chain_head *header = NULL;

 	if (!(context && chain_name && rule_list)) {
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/*add chain header */
 	/*collect chain_offsets*/
@@ -792,7 +793,7 @@

 	PyObject *rule_list_iter = PyObject_GetIter(rule_list);
 	if (!rule_list_iter) {
-		goto CLEAR;
+		goto SET_ERROR;
 	}

 	PyObject *rule_list_next = PyIter_Next(rule_list_iter);
@@ -801,13 +802,13 @@
 		struct ipt_entry *this_entry = context->memory;
 		if(!this_entry) {
 			Py_XDECREF(rule_list_iter);
-			goto CLEAR;
+			goto SET_ERROR;
 		}
 		int rule_ret = compile_rule(context, rule_list_next, this_entry, &offset);
 		Py_XDECREF(rule_list_next);
 		if(!rule_ret) {
 			Py_XDECREF(rule_list_iter);
-			goto CLEAR;
+			goto SET_ERROR;
 		}
 		/* move forward */
 		context->memory += offset;
@@ -818,8 +819,10 @@
 		/* add underflow */
 		context->replace->underflow[hooknum] = (unsigned long)context->memory;
 	}
+	/* update blob size */
+	context->replace->size += offset;
 	return 1;
-CLEAR:
+SET_ERROR:
 	if (!PyErr_Occurred()) {
 		PyErr_SetString(PyExc_OSError, "iptables runtime error");
 	}
@@ -827,6 +830,7 @@
 }

 PyDoc_STRVAR(iptables_replace_table_doc, "replace this table in kernel");
+

 static PyObject *
 iptables_replace_table(PyObject *object, PyObject *args)
@@ -838,7 +842,6 @@
 	PyObject *chains_keys = NULL;
 	PyObject *tablename = NULL;

-	//struct xt_counters_info *counter_info = NULL;
 	struct ipt_getinfo *info = NULL;
 	struct ipt_replace *replace = NULL;
 	struct chain_error *error = NULL;
@@ -852,32 +855,32 @@
 	tablename = PyDict_GetItemString(table_dict, "name");
 	if (!tablename) {
 		PyErr_SetString(PyExc_KeyError, "no table name in this table dict");
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	if (strlen(PyString_AsString(tablename)) >= XT_TABLE_MAXNAMELEN) {
 		PyErr_SetString(PyExc_ValueError, "table name too big");
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/* get chains */
 	chains_dict = PyDict_GetItemString(table_dict, "chains");
 	if (!chains_dict) {
 		PyErr_SetString(PyExc_KeyError, "no chains in table");
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/* init socket */
 	sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 	if (sockfd < 0) {
 		PyErr_SetFromErrno(PyExc_OSError);
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) {
 		PyErr_SetFromErrno(PyExc_OSError);
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/* set ipt_info */
 	info = PyMem_Malloc(sizeof(struct ipt_getinfo));
 	if (!info)
-		goto CLEAR;
+		goto SET_ERROR;
 	info_size = sizeof(struct ipt_getinfo);
 	memset(info, 0, info_size);
 	strcpy(info->name, PyString_AsString(tablename));
@@ -885,17 +888,20 @@
 				info, &info_size) < 0) {
 		PyErr_SetFromErrno(PyExc_OSError);
 		PyMem_Free(info);
-		goto CLEAR;
+		goto SET_ERROR;
 	}
 	/* initialize context */
 	replace = PyMem_Malloc(sizeof(struct ipt_replace));
 	if(!replace) {
 		PyMem_Free(info);
-		goto CLEAR;
+		goto SET_ERROR;
 	}

 	memset(&context, 0, sizeof(struct replace_context));
 	memcpy(replace->name, PyString_AsString(tablename), PyString_Size(tablename));
+	/* for old counters from kernel */
+	replace->num_counters = info->num_entries;
+	replace->counters = PyMem_Malloc(info->num_entries * sizeof(struct xt_counters));
 	context.replace = replace;
 	context.info = info;
 	context.offset = 0;
@@ -904,9 +910,10 @@
 	context.jumps = PyList_New(0);

 	chains_keys = PyDict_Keys(chains_dict);
+	/* how many entires */
 	replace->num_entries = PyList_Size(chains_keys);
-	/* allocate buffer*/
-	context.memory_size = 50 * (replace->num_entries *
+	/* lazy, allocate buffer once*/
+	context.memory_size = 20 * (replace->num_entries *
 		(sizeof(struct ipt_entry) +
 		 sizeof(struct xt_entry_target) +
 		 sizeof(struct xt_entry_match)));
@@ -960,13 +967,26 @@
 		xet->verdict = PyLong_AsUnsignedLong(jump_to);
 		jumps_next = PyIter_Next(jumps_iter);
 	}
+	Py_XDECREF(jumps_iter);
+	/* table blob size */
+	replace->size = context->offset;
+	/* finally, send table blob to kernel */
+	int ret = setsockopt(sockfd, IPPROTO_IP, IPT_SO_SET_REPLACE, replace, sizeof(struct ipt_replace) + replace->size);
+	if (ret < 0) {
+		PyErr_SetFromErrno(PyExc_OSError);
+		goto FREE_MEMORY;
+	}
+	/* put counter back */
+
 	Py_RETURN_NONE;
 FREE_MEMORY:
 	PyMem_Free(context.memory);
 FREE_CONTEXT:
+	/* free counters */
+	PyMem_Free(replace->counters);
 	PyMem_Free(info);
 	PyMem_Free(replace);
-CLEAR:
+SET_ERROR:
 	if (!PyErr_Occurred()) {
 		PyErr_SetString(PyExc_OSError, "iptables runtime error");
 	}


Free temporary index array in pinv

Free temporary index array in pinv

--- c/harmonic/lapack_wrapper.c
+++ c/harmonic/lapack_wrapper.c
@@ -188,6 +188,9 @@
     }
   }

+  free(l);
+  l = NULL;
+
 #pragma omp parallel for private(i)
   for (j = 0; j < size - 1; j++) {
     for (i = j + 1; i < size; i++) {