shared memory development

shared memory development

--- include/PSkelStencil.hpp
+++ include/PSkelStencil.hpp
@@ -205,6 +205,88 @@

 /* Shared memory kernel development */
 #ifdef PSKEL_SHARED
+#define TIME_TILE_SIZE 2
+
+extern __shared__ float sh_input[];
+template<typename T1, typename T2, class Args>
+__global__ void stencilTilingCU(Array2D<T1> input,Array2D<T1> output,Mask2D<T2> mask,Args args, size_t maskRange, size_t tilingWidth, size_t tilingHeight, size_t tilingDepth){
+  // Determine our start position
+    int offsetI = blockIdx.y * (blockDim.y-2*(TIME_TILE_SIZE-1)) + threadIdx.y;
+    offsetI -= TIME_TILE_SIZE-1;
+    int offsetJ = blockIdx.x * (blockDim.x-2*(TIME_TILE_SIZE-1)) + threadIdx.x;
+    offsetJ -= TIME_TILE_SIZE-1;
+
+    #ifdef DEBUG
+    printf("STEP 1 - offset %d %d\n",offsetI,offsetJ);
+    #endif
+    //__shared__ T1 sh_input[(BLOCK_SIZE + 2*(TIME_TILE_SIZE-1))*(BLOCK_SIZE + 2*(TIME_TILE_SIZE-1))];
+
+    sh_input[threadIdx.y*blockDim.y+threadIdx.x] = ((offsetI >= 0) && (offsetI <= (tilingHeight-1)) &&
+    (offsetJ >= 0) && (offsetJ <= (tilingWidth-1))) ? input(offsetI,offsetJ) : sh_input[threadIdx.y*blockDim.y+threadIdx.x];
+
+    #ifdef DEBUG
+    printf("STEP 2 - sh_intput[%d] = %f\n",threadIdx.y*blockDim.y+threadIdx.x,sh_input[threadIdx.y*blockDim.y+threadIdx.x]);
+    #endif
+    __syncthreads();
+
+    for(int t = 0; t < TIME_TILE_SIZE-1; ++t) {
+		//stencilComputation
+		//printf("Computing it %d\n",t);
+		/*T1 l = ((offsetI-1 >= 0) && (offsetI-1 <= (blockDim.y-1)) &&
+                 (offsetJ >= 0) && (offsetJ <= (blockDim.x-1)))
+                 ? sh_input[(offsetI-1)*blockDim.y+offsetJ] : 0.0f;
+
+		T1 r = ((offsetI+1 >= 0) && (offsetI+1 <= (blockDim.y-1)) &&
+                 (offsetJ >= 0) && (offsetJ <= (blockDim.x-1)))
+                 ? sh_input[(offsetI+1)*blockDim.y+offsetJ] : 0.0f;
+
+		T1 t = ((offsetI >= 0) && (offsetI <= (blockDim.y-1)) &&
+                 (offsetJ-1 >= 0) && (offsetJ-1 <= (blockDim.x-1)))
+                 ? sh_input[offsetI*blockDim.y+offsetJ-1] : 0.0f;
+
+		T1 b = ((offsetI >= 0) && (offsetI <= (blockDim.y-1)) &&
+                 (offsetJ+1 >= 0) && (offsetJ+1 <= (blockDim.x-1)))
+                 ? sh_input[offsetI*blockDim.y+offsetJ+1] : 0.0f;
+		*/
+		T1 l = (threadIdx.y > 0) ? sh_input[(threadIdx.y-1)*blockDim.y+threadIdx.x] : 0.0f;
+		T1 r = (threadIdx.y < blockDim.y-1) ? sh_input[(threadIdx.y+1)*blockDim.y+threadIdx.x] : 0.0f;
+		T1 t = (threadIdx.x > 0) ? sh_input[threadIdx.y*blockDim.y+threadIdx.x-1] : 0.0f;
+		T1 b = (threadIdx.x < blockDim.x-1) ? sh_input[threadIdx.y*blockDim.y+threadIdx.x+1] : 0.0f;
+
+		T1 val = 0.25f * (l+r+t+b);
+		#ifdef DEBUG
+		printf("STEP 3 - val: %f\n",val);
+		#endif
+		/*T1 val = 0.25f * (sh_input[(threadIdx.y+1)*blockDim.y+(threadIdx.x)] +
+						  sh_input[(threadIdx.y-1)*blockDim.y+(threadIdx.x)] +
+						  sh_input[(threadIdx.y)*blockDim.y+(threadIdx.x+1)] +
+						  sh_input[(threadIdx.y)*blockDim.y+(threadIdx.x-1)] +
+						  - args.h)
+		*/
+		__syncthreads();
+
+		sh_input[threadIdx.y*blockDim.y+threadIdx.x] =
+        ((offsetI >= 0) && (offsetI <= (tilingHeight-1)) &&
+        (offsetJ >= 0) && (offsetJ <= (tilingWidth-1))) ? val : sh_input[threadIdx.y*blockDim.y+threadIdx.x];
+
+		#ifdef DEBUG
+		printf("STEP 4 - sh_intput[%d] = %f\n",threadIdx.y*blockDim.y+threadIdx.x,sh_input[threadIdx.y*blockDim.y+threadIdx.x]);
+        #endif
+        // Sync before re-reading shared
+        __syncthreads();
+	}
+
+	if(threadIdx.x >= (TIME_TILE_SIZE-1) &&
+     threadIdx.x <= (blockDim.x-1-(TIME_TILE_SIZE-1)) &&
+     threadIdx.y >= (TIME_TILE_SIZE-1) &&
+     threadIdx.y <= (blockDim.y-1-(TIME_TILE_SIZE-1))) {
+    output(offsetI,offsetJ) = sh_input[threadIdx.y*blockDim.y+threadIdx.x];
+    #ifdef DEBUG
+    printf("STEP 5 - output(%d,%d) = %f\n",output(offsetI,offsetJ));
+    #endif
+	}
+}
+/* This is not better than naive pskel
 template<typename T1, typename T2, class Args>
 __global__ void stencilTilingCU(Array2D<T1> input,Array2D<T1> output,Mask2D<T2> mask,Args args, size_t maskRange, size_t iteration, size_t tilingWidth, size_t tilingHeight, size_t tilingDepth, size_t border_cols, size_t border_rows){
 	//size_t w = blockIdx.x*blockDim.x+threadIdx.x;
@@ -239,7 +321,7 @@
 	//int index = loadYidx*tilingWidth + loadXidx;

 	if(IN_RANGE(loadYidx, 0, tilingHeight-1) && IN_RANGE(loadXidx, 0, tilingWidth-1)){
-		sh_input[ty][tx] = input(loadYidx,loadXidx);  // Load the temperature data from global memory to shared memory
+		sh_input[ty][tx] = input(loadXidx,loadYidx);  // Load the temperature data from global memory to shared memory
 		//power_on_cuda[ty][tx] = power[index];// Load the power data from global memory to shared memory
 	}
 	__syncthreads();
@@ -252,17 +334,16 @@
 	int validXmin = (blkX < 0) ? -blkX : 0;
 	int validXmax = (blkXmax > tilingWidth-1) ? BLOCK_SIZE-1-(blkXmax-tilingWidth+1) : BLOCK_SIZE-1;

-	/* Offset, need to check how this will be implemented. Get function maybe?
-	int N = ty-1;
-	int S = ty+1;
-	int W = tx-1;
-	int E = tx+1;
-
-	N = (N < validYmin) ? validYmin : N;
-	S = (S > validYmax) ? validYmax : S;
-	W = (W < validXmin) ? validXmin : W;
-	E = (E > validXmax) ? validXmax : E;
-	*/
+	/ Offset, need to check how this will be implemented. Get function maybe?
+	//int N = ty-1;
+	//int S = ty+1;
+	//int W = tx-1;
+	//int E = tx+1;
+
+	//N = (N < validYmin) ? validYmin : N;
+	//S = (S > validYmax) ? validYmax : S;
+	//W = (W < validXmin) ? validXmin : W;
+	//E = (E > validXmax) ? validXmax : E;

 	bool computed;
 	for (int i=0; i<iteration ; i++){
@@ -275,13 +356,6 @@
 			//stencilKernel(sh_input, sh_output, args, ty, tx);
 			//stencilKernel(sh_input, sh_output, args, ty, tx);
 			sh_output[ty][tx] = 0.25f * (sh_input[ty][tx-1] + sh_input[ty][tx+1] + sh_input[ty-1][tx] + sh_input[ty+1][tx] - args.h);
-
-			/* Stencil computation
-			temp_t[ty][tx] =   temp_on_cuda[ty][tx] + step_div_Cap * (power_on_cuda[ty][tx] +
-				 (temp_on_cuda[S][tx] + temp_on_cuda[N][tx] - 2.0*temp_on_cuda[ty][tx]) * Ry_1 +
-				 (temp_on_cuda[ty][E] + temp_on_cuda[ty][W] - 2.0*temp_on_cuda[ty][tx]) * Rx_1 +
-				 (amb_temp - temp_on_cuda[ty][tx]) * Rz_1);
-			*/
 		}
 		__syncthreads();
 		if(i==iteration-1)
@@ -295,9 +369,10 @@
 	// after the last iteration, only threads coordinated within the
 	// small block perform the calculation and switch on ``computed''
 	if (computed){
-	  output(loadYidx,loadXidx) = sh_output[ty][tx];
-	}
-}
+	  output(loadXidx,loadYidx) = sh_output[ty][tx];
+	}
+}
+*/
 #else
 template<typename T1, typename T2, class Args>
 __global__ void stencilTilingCU(Array2D<T1> input,Array2D<T1> output,Mask2D<T2> mask,Args args, size_t maskRange, size_t tilingWidth, size_t tilingHeight, size_t tilingDepth){
@@ -651,6 +726,8 @@
 	output.deviceAlloc();
 	size_t maskRange = mask.getRange();

+	/* Hotspot method, bad performance */
+	/*
 	#define EXPAND_RATE 2// add one iteration will extend the pyramid base by 2 per each borderline
     size_t borderCols = (pyramidHeight)*EXPAND_RATE/2;
     size_t borderRows = (pyramidHeight)*EXPAND_RATE/2;
@@ -660,12 +737,19 @@
     size_t blockRows = input.getHeight() /smallBlockRow+((input.getHeight()% smallBlockRow==0)?0:1);
     dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE);
     dim3 dimGrid(blockCols, blockRows);
-
-	for(size_t t = 0; t<iterations; t+=pyramidHeight){
-		size_t it = MIN(pyramidHeight, iterations-t);
-		if((it%2)==0)
-			stencilTilingCU<<<dimGrid, dimBlock>>>(this->input, this->output, this->mask, this->args,maskRange,it,input.getWidth(),input.getHeight(),input.getDepth(),borderCols,borderRows);
-		else stencilTilingCU<<<dimGrid, dimBlock>>>(this->output, this->input, this->mask, this->args,maskRange,it,input.getWidth(),input.getHeight(),input.getDepth(),borderCols,borderRows);
+	*/
+
+	/*Howelinsk method */
+	dim3 dimGrid(input.getWidth() / GPUBlockSizeX, input.getHeight() / GPUBlockSizeY);
+	dim3 dimBlock(GPUBlockSizeX + 2*(TIME_TILE_SIZE-1), GPUBlockSizeY + 2*(TIME_TILE_SIZE-1));
+	const int sharedMemSize = dimBlock.x * dimBlock.y * sizeof(float); //need to get this size from somewhere
+
+
+	for(size_t t = 0; t<iterations; t+=TIME_TILE_SIZE){
+		//size_t it = MIN(pyramidHeight, iterations-t);
+		if((t%2)==0)
+			stencilTilingCU<<<dimGrid, dimBlock, sharedMemSize>>>(this->input, this->output, this->mask, this->args,maskRange,input.getWidth(),input.getHeight(),input.getDepth());
+		else stencilTilingCU<<<dimGrid, dimBlock, sharedMemSize>>>(this->output, this->input, this->mask, this->args,maskRange,input.getWidth(),input.getHeight(),input.getDepth());
 	}
 	if((iterations%2)==1)
 		output.copyToHost();


fix(network): Connection state

fix(network): Connection state

Closes jaagr/lemonbuddy#118

--- include/adapters/net.hpp
+++ include/adapters/net.hpp
@@ -174,16 +174,8 @@
     /**
      * Test if the network interface is in a valid state
      */
-    bool test_interface(struct ifreq& request) const {
-      if ((ioctl(m_socketfd, SIOCGIFFLAGS, &request)) == -1)
-        return false;
-      if ((request.ifr_flags & IFF_UP) == 0)
-        return false;
-      if ((request.ifr_flags & IFF_RUNNING) == 0)
-        return false;
-
+    bool test_interface() const {
       auto operstate = file_util::get_contents("/sys/class/net/" + m_interface + "/operstate");
-
       return operstate.compare(0, 2, "up") == 0;
     }

@@ -246,6 +238,9 @@
      * Check current connection state
      */
     bool connected() const override {
+      if (!network::test_interface())
+        return false;
+
       struct ifreq request;
       struct ethtool_value ethernet_data;

@@ -253,9 +248,6 @@
       ethernet_data.cmd = ETHTOOL_GLINK;
       request.ifr_data = reinterpret_cast<caddr_t>(&ethernet_data);

-      if (!network::test_interface(request))
-        return false;
-
       if (ioctl(m_socketfd, SIOCETHTOOL, &request) != -1)
         return ethernet_data.data != 0;

@@ -315,10 +307,13 @@
      * Check current connection state
      */
     bool connected() const override {
+      if (!network::test_interface())
+        return false;
+
       struct ifreq request;
       strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1);

-      if (!network::test_interface(request))
+      if ((ioctl(m_socketfd, SIOCGIFFLAGS, &request)) == -1)
         return false;
       if (m_essid.empty())
         return false;


feat(frontends/lean/elaborator): error recovery for structure instances

--- src/frontends/lean/elaborator.cpp
+++ src/frontends/lean/elaborator.cpp
@@ -2539,13 +2539,15 @@
         expr src_S = get_app_fn(type);
         if (!is_constant(src_S) || !is_structure(m_env, const_name(src_S))) {
             auto pp_fn = mk_pp_ctx();
-            throw elaborator_exception(e,
+            report_or_throw(elaborator_exception(e,
                                        format("invalid structure update { src with ...}, source is not a structure") +
                                        pp_indent(pp_fn, *src) +
                                        line() + format("which has type") +
-                                       pp_indent(pp_fn, type));
-        }
-        src_S_name          = const_name(src_S);
+                                       pp_indent(pp_fn, type)));
+            src = none_expr();
+        } else {
+            src_S_name          = const_name(src_S);
+        }
     }
     if (S_name.is_anonymous()) {
         if (expected_type) {
@@ -2596,10 +2598,10 @@
             expr d = binding_domain(c_type);
             if (i < nparams) {
                 if (is_explicit(binding_info(c_type))) {
-                    throw elaborator_exception(e, sstream() << "invalid structure value {...}, structure parameter '" <<
+                    report_or_throw(elaborator_exception(e, sstream() << "invalid structure value {...}, structure parameter '" <<
                                                             binding_name(c_type)
                                                             << "' is explicit in the structure constructor '" <<
-                                                            c_names[0] << "'");
+                                                            c_names[0] << "'"));
                 }
                 c_arg = mk_metavar(d, ref);
             } else {
@@ -2620,16 +2622,18 @@
                         if (src && !is_subobject_field(m_env, nested_S_name, S_fname)) {
                             optional<name> opt_base_S_name = find_field(m_env, src_S_name, S_fname);
                             if (!opt_base_S_name) {
-                                throw elaborator_exception(ref,
+                                report_or_throw(elaborator_exception(ref,
                                                            sstream() << "invalid structure update { src with ... }, field '"
                                                                      << S_fname << "'"
                                                                      << " was not provided, nor was it found in the source of type '"
-                                                                     << src_S_name << "'.");
+                                                                     << src_S_name << "'."));
+                                c_arg = mk_sorry({d}, ref);
+                            } else {
+                                name base_S_name = *opt_base_S_name;
+                                expr base_src = *mk_base_projections(m_env, src_S_name, base_S_name, *src);
+                                expr f = mk_proj_app(m_env, base_S_name, S_fname, base_src);
+                                c_arg = visit(f, none_expr());
                             }
-                            name base_S_name = *opt_base_S_name;
-                            expr base_src = *mk_base_projections(m_env, src_S_name, base_S_name, *src);
-                            expr f = mk_proj_app(m_env, base_S_name, S_fname, base_src);
-                            c_arg = visit(f, none_expr());
                             expr c_arg_type = infer_type(c_arg);
                             if (!is_def_eq(c_arg_type, d)) {
                                 auto pp_data = pp_until_different(c_arg_type, d);
@@ -2641,7 +2645,8 @@
                                 msg += std::get<1>(pp_data);
                                 msg += line() + format("but is expected to have type");
                                 msg += std::get<2>(pp_data);
-                                throw elaborator_exception(ref, msg);
+                                report_or_throw(elaborator_exception(ref, msg));
+                                c_arg = mk_sorry({d}, ref);
                             }
                             field2value.insert(S_fname, c_arg);
                         } else {
@@ -2658,16 +2663,20 @@
                                     field2value.insert(S_fname, nested);
                                 }
                             } else {
-                                throw elaborator_exception(e, sstream() << "invalid structure value { ... }, field '" <<
-                                                                        S_fname << "' was not provided");
+                                report_or_throw(elaborator_exception(e, sstream() << "invalid structure value { ... }, field '" <<
+                                                                        S_fname << "' was not provided"));
+                                c_arg = mk_sorry({d}, ref);
+                                field2value.insert(S_fname, c_arg);
                             }
                         }
                     }
                 } else {
                     /* Implicit field */
-                    if (std::find(fnames.begin(), fnames.end(), S_fname) != fnames.end()) {
-                        throw elaborator_exception(e, sstream() << "invalid structure value {...}, field '"
-                                                                << S_fname << "' is implicit and must not be provided");
+                    auto i = std::find(fnames.begin(), fnames.end(), S_fname);
+                    if (i != fnames.end()) {
+                        used[i - fnames.begin()] = true;
+                        report_or_throw(elaborator_exception(e, sstream() << "invalid structure value {...}, field '"
+                                                                << S_fname << "' is implicit and must not be provided"));
                     }
                     c_arg = mk_metavar(d, ref);
                 }
@@ -2684,20 +2693,13 @@
     /* Check if there are alien fields. */
     for (unsigned i = 0; i < fnames.size(); i++) {
         if (!used[i]) {
-            throw elaborator_exception(e, sstream() << "invalid structure value { ... }, '" << fnames[i] << "'" <<
-                                                    " is not a field of structure '" << S_name << "'");
-        }
-    }
-
-    /* Check expected type */
-    if (expected_type && !is_def_eq(*expected_type, c_type)) {
-        auto pp_data = pp_until_different(c_type, *expected_type);
-        auto pp_fn = std::get<0>(pp_data);
-        throw elaborator_exception(ref, format("type mismatch as structure instance ") + pp_indent(pp_fn, e2) +
-                                        line() + format("has type") + std::get<1>(pp_data) +
-                                        line() + format("but is expected to have type") +
-                                        std::get<2>(pp_data));
-    }
+            report_or_throw(elaborator_exception(e, sstream() << "invalid structure value { ... }, '" << fnames[i] << "'" <<
+                                                    " is not a field of structure '" << S_name << "'"));
+        }
+    }
+
+    /* Make sure to unify first to propagate the expected type, we'll report any errors later on. */
+    bool type_def_eq = !expected_type || is_def_eq(*expected_type, c_type);

     /* Now repeatedly try to elaborate fields whose dependencies have been elaborated.
      * If we have not made any progress in a round, do a last one collecting any errors. */
@@ -2819,6 +2821,16 @@
         if (!last_progress && !progress)
             throw elaborator_exception(ref, error);
         last_progress = progress;
+    }
+
+    /* Check expected type */
+    if (!type_def_eq) {
+        auto pp_data = pp_until_different(c_type, *expected_type);
+        auto pp_fn = std::get<0>(pp_data);
+        throw elaborator_exception(ref, format("type mismatch as structure instance ") + pp_indent(pp_fn, e2) +
+                                        line() + format("has type") + std::get<1>(pp_data) +
+                                        line() + format("but is expected to have type") +
+                                        std::get<2>(pp_data));
     }

     return e2;


Assertion to ensure game state order

Assertion to ensure game state order

--- src/game/states/skirmishstate.cpp
+++ src/game/states/skirmishstate.cpp
@@ -63,8 +63,7 @@
 {
     SceneState::init(previousState);

-    if(previousState->getId() != EGameStateId::EGSID_DEPLOY_STATE)
-        return;
+	assert(previousState->getId() == EGameStateId::EGSID_DEPLOY_STATE);

     DeployState* deployState = static_cast<DeployState*>(previousState);


Fixed: GPU write out of bounds

Fixed: GPU write out of bounds

--- src/gpu/cusim/kernel-distance.inl
+++ src/gpu/cusim/kernel-distance.inl
@@ -163,7 +163,7 @@
 		// zero out the histogram for the next invocation
 		for( auto row = warp; row < aN; row += blockDim.y )
 		{
-			for( auto col = wtid; col < m32; col += 32 )
+			for( auto col = wtid; col < aM; col += 32 )
 			{
 				aCur[row*aM+col] = 0;
 			}


Ensures no out-of-bounds access for unlabelled keys.

--- OSBindings/Qt/mainwindow.cpp
+++ OSBindings/Qt/mainwindow.cpp
@@ -104,8 +104,7 @@
 	other->show();
 }

-void MainWindow::tile(const QMainWindow *previous)
-{
+void MainWindow::tile(const QMainWindow *previous) {
 	// This entire function is essentially verbatim from the Qt SDI example.
 	if (!previous)
 		return;
@@ -457,7 +456,7 @@
 	}

 	std::unique_lock lock(machineMutex);
-	keyboardMachine->get_keyboard().set_key_pressed(key, event->text()[0].toLatin1(), event->type() == QEvent::KeyPress);
+	keyboardMachine->get_keyboard().set_key_pressed(key, event->text().size() ? event->text()[0].toLatin1() : '\0', event->type() == QEvent::KeyPress);

 	return false;
 }


Ensures newly-hidden widgets aren't still in focus.

--- OSBindings/Qt/mainwindow.cpp
+++ OSBindings/Qt/mainwindow.cpp
@@ -329,6 +329,12 @@
 	ui->machineSelectionTabs->setVisible(set == WidgetSet::MachinePicker);
 	ui->startMachineButton->setVisible(set == WidgetSet::MachinePicker);
 	ui->topTipLabel->setVisible(set == WidgetSet::MachinePicker);
+
+	// Set appropriate focus if necessary; e.g. this ensures that machine-picker
+	// widgets aren't still selectable after a machine starts.
+	if(set != WidgetSet::MachinePicker) {
+		ui->openGLWidget->setFocus();
+	}
 }

 // MARK: - Event Processing
@@ -397,7 +403,7 @@
 	std::unique_lock lock(machineMutex);
 	keyboardMachine->get_keyboard().set_key_pressed(key, event->text()[0].toLatin1(), event->type() == QEvent::KeyPress);

-	return true;
+	return false;
 }

 // MARK: - New Machine Creation


added missing include guard in rotations.hpp

--- sm_kinematics/include/sm/kinematics/rotations.hpp
+++ sm_kinematics/include/sm/kinematics/rotations.hpp
@@ -8,6 +8,8 @@
  *
  */

+#ifndef SM_ROTATIONS_HPP
+#define SM_ROTATIONS_HPP

 #define SM_2_PI 		0.6366197723675814 // 2/pi
 #define SM_PI 		3.141592653589793  // pi
@@ -65,3 +67,5 @@
   double rad2deg(double radians);

 }} // namespace sm::kinematics
+
+#endif // ndef SM_ROTATIONS_HPP


Changed analytic planner to use new state setup

git-svn-id: d977b54c81d31216b83c26b524c5ec2d906079f8@1078 7ccbd594-6f30-0410-bcae-e071bb1c4cdc

--- soccer/gameplay/optimizer/AnalyticPassPlanner.cpp
+++ soccer/gameplay/optimizer/AnalyticPassPlanner.cpp
@@ -50,11 +50,13 @@
 			// add initial state with no robots having the ball
 			passConfig->addPassState(
 					PassState(r1, r2, r1->pos(), r2->pos(), r1->angle(), r2->angle(),
-							ballPos, PassState::INTERMEDIATE, 0));
+							ballPos, PassState::INITIAL, 0));

 			// add state with robot1 at a position to pass to robot2
 			Point state2Robot1Pos = ballPos - passVec * (float)(Constants::Robot::Radius + Constants::Ball::Radius);
 			float state2Robot1Rot = passAngle;
+			Point state2Robot2Pos = r2->pos();
+			float state2Robot2Rot = (passVec * -1.0f).angle();

 			// calculate time
 			og = r1->obstacles();
@@ -77,10 +79,10 @@
 			double state2Time = pathTime + TIME_TO_AIM_APPROX;
 			//double state2Time = r1->pos().distTo(state2Robot1Pos) / APPROXROBOTVELTRANS;
 			passConfig->addPassState(
-					PassState(r1, r2, state2Robot1Pos, r2->pos(), state2Robot1Rot, r2->angle(),
+					PassState(r1, r2, state2Robot1Pos, state2Robot2Pos, state2Robot1Rot, state2Robot2Rot,
 							ballPos, PassState::KICKPASS, state2Time));
 			// add state with robot2 receiving ball
-			Point state3BallPos = r2->pos();
+			Point state3BallPos = state2Robot2Pos;
 			Point state3Robot2Pos = state3BallPos + passVec * (float)(Constants::Robot::Radius + Constants::Ball::Radius);
 			float state3Robot2Rot = (passVec * -1.0f).angle();
 			double state3Time = state2Time + r2->pos().distTo(state3Robot2Pos) / BALL_KICK_AVG_VEL;
@@ -102,7 +104,7 @@
 			//double state5Time = state4Time + state3BallPos.distTo(goalBallPos) / APPROXBALLVEL;
 			passConfig->addPassState(
 					PassState(r1, r2, state2Robot1Pos, state4Robot2Pos, state2Robot1Rot, state4Robot2Rot,
-							goalBallPos, PassState::INTERMEDIATE, state5Time));
+							goalBallPos, PassState::GOAL, state5Time));

 			passConfigResult.push_back(passConfig);
 		}


Texture projection plus custom view matrix now working

--- OgreMain/src/OgreFrustum.cpp
+++ OgreMain/src/OgreFrustum.cpp
@@ -774,15 +774,9 @@
 	//---------------------------------------------------------------------
 	void Frustum::calcViewMatrixRelative(const Vector3& relPos, Matrix4& matToUpdate) const
 	{
-		if (!mCustomViewMatrix)
-		{
-			const Quaternion& orientation = getOrientationForViewUpdate();
-			const Vector3& position = getPositionForViewUpdate();
-
-			// Make position relative
-			matToUpdate = Math::makeViewMatrix(position - relPos,
-				orientation, mReflect? &mReflectMatrix : 0);
-		}
+		Matrix4 matTrans = Matrix4::IDENTITY;
+		matTrans.setTrans(relPos);
+		matToUpdate = getViewMatrix() * matTrans;

 	}
 	//-----------------------------------------------------------------------


wc 18

wc 18

--- src/gstkaldinnet2onlinedecoder.cc
+++ src/gstkaldinnet2onlinedecoder.cc
@@ -1048,19 +1048,15 @@
       json_object_set_new(nbest_result_json_object, "transcript",
                           json_string(gst_kaldinnet2onlinedecoder_words_in_hyp_to_string(filter, nbest_result.words).c_str()));
       json_object_set_new(nbest_result_json_object, "likelihood",  json_real(nbest_result.likelihood));
-	  //double test;
-	  //try {
-		//  if (nbest_result.likelihoods.empty()) {
-		//	  test = 0.0;
-		//  }
-		//  else {
-		//	  test = 1.0;
-		//  }
-	  //}
-	  //catch(...) {
-		//  test = 99;
-	  //}
-	  json_object_set_new(nbest_result_json_object, "likelihoods", json_real(nbest_result.likelihoods[1].Value1()));
+	  std::ostringstream ss;
+	  std::string s;
+	  for (int i = 0; i < nbest_result.likelihoods.size(); i++) {
+		  ss << nbest_result.likelihoods[i].Value1();
+		  ss << " ";
+	  }
+	  s = ss.str();
+	  json_object_set_new(nbest_result_json_object, "wgw", json_string(s.c_str()));
+	  //json_object_set_new(nbest_result_json_object, "waw", );
       json_array_append( nbest_json_arr, nbest_result_json_object );
       if (nbest_result.phone_alignment.size() > 0) {
         if (strcmp(filter->phone_syms_filename, "") == 0) {


Fix implicit conversion of NULL constant to 'bool'.

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

--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1056,7 +1056,7 @@
                                                      &signo,
                                                      &command_output,
                                                      2,                                     // short timeout
-                                                     NULL);                                 // don't run in a shell
+                                                     false);                                // don't run in a shell
                 if (error.Success() && exit_status == 0 && !command_output.empty())
                 {
                     const char *cmd_output_ptr = command_output.c_str();


Fix a few default label in switch which covers all
enumeration values [-Werror,-Wcovered-switch-default]
warnings.

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

--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1250,8 +1250,6 @@
 {
     switch (sdk_type)
     {
-        default:
-            return false;
         case SDKType::MacOSX:
             if (major > 10 || (major == 10 && minor >= 10))
                 return true;
@@ -1366,8 +1364,6 @@
 {
     switch (sdk_type)
     {
-        default:
-            return FileSpec();
         case SDKType::MacOSX:
         case SDKType::iPhoneSimulator:
         case SDKType::iPhoneOS:
@@ -1380,8 +1376,6 @@

     switch (sdk_type)
     {
-        default:
-            return FileSpec();
         case SDKType::MacOSX:
             sdks_spec.AppendPathComponent("MacOSX.platform");
             break;


http://www.salome-platform.org/forum/forum_10/450300019

Pb: entangled prisms are created on a face shared by solids where
VL have different thickness due to different size of solids

Test SALOME_TESTS/Grids/smesh/viscous_layers_00/A5

--- src/StdMeshers/StdMeshers_ViscousLayers.cxx
+++ src/StdMeshers/StdMeshers_ViscousLayers.cxx
@@ -326,7 +326,7 @@

     gp_XYZ              _normal; // to solid surface
     vector<gp_XYZ>      _pos; // points computed during inflation
-    double              _len; // length achived with the last step
+    double              _len; // length achived with the last inflation step
     double              _cosin; // of angle (_normal ^ surface)
     double              _lenFactor; // to compute _len taking _cosin into account

@@ -365,7 +365,7 @@
                        const double&        epsilon) const;
     gp_Ax1 LastSegment(double& segLen) const;
     bool IsOnEdge() const { return _2neibors; }
-    void Copy( _LayerEdge& other, SMESH_MesherHelper& helper );
+    gp_XYZ Copy( _LayerEdge& other, SMESH_MesherHelper& helper );
     void SetCosin( double cosin );
   };
   struct _LayerEdgeCmp
@@ -397,6 +397,8 @@
     const SMDS_MeshNode*            _stepSizeNodes[2];

     TNode2Edge                      _n2eMap;
+    // map to find _n2eMap of another _SolidData by a shrink shape shared by two _SolidData's
+    map< TGeomID, TNode2Edge* >     _s2neMap;
     // edges of _n2eMap. We keep same data in two containers because
     // iteration over the map is 5 time longer than over the vector
     vector< _LayerEdge* >           _edges;
@@ -1445,7 +1447,6 @@
     }

   // make a map to find new nodes on sub-shapes shared with other SOLID
-  map< TGeomID, TNode2Edge* > s2neMap;
   map< TGeomID, TNode2Edge* >::iterator s2ne;
   map< TGeomID, TopoDS_Shape >::iterator s2s = data._shrinkShape2Shape.begin();
   for (; s2s != data._shrinkShape2Shape.end(); ++s2s )
@@ -1458,7 +1459,7 @@
       if ( s2s2 != _sdVec[i]._shrinkShape2Shape.end() &&
            *s2s == *s2s2 && !_sdVec[i]._n2eMap.empty() )
       {
-        s2neMap.insert( make_pair( shapeInd, &_sdVec[i]._n2eMap ));
+        data._s2neMap.insert( make_pair( shapeInd, &_sdVec[i]._n2eMap ));
         break;
       }
     }
@@ -1510,21 +1511,23 @@
           const int shapeID = n->getshapeId();
           edgesByGeom[ shapeID ].push_back( edge );

+          SMESH_TNodeXYZ xyz( n );
+
           // set edge data or find already refined _LayerEdge and get data from it
           if ( n->GetPosition()->GetTypeOfPosition() != SMDS_TOP_FACE &&
-               ( s2ne = s2neMap.find( shapeID )) != s2neMap.end() &&
+               ( s2ne = data._s2neMap.find( shapeID )) != data._s2neMap.end() &&
                ( n2e2 = (*s2ne).second->find( n )) != s2ne->second->end())
           {
             _LayerEdge* foundEdge = (*n2e2).second;
-            edge->Copy( *foundEdge, helper );
-            // location of the last node is modified but we can restore
-            // it by node position on _sWOL stored by the node
+            gp_XYZ        lastPos = edge->Copy( *foundEdge, helper );
+            foundEdge->_pos.push_back( lastPos );
+            // location of the last node is modified and we restore it by foundEdge->_pos.back()
             const_cast< SMDS_MeshNode* >
-              ( edge->_nodes.back() )->setXYZ( n->X(), n->Y(), n->Z() );
+              ( edge->_nodes.back() )->setXYZ( xyz.X(), xyz.Y(), xyz.Z() );
           }
           else
           {
-            edge->_nodes.push_back( helper.AddNode( n->X(), n->Y(), n->Z() ));
+            edge->_nodes.push_back( helper.AddNode( xyz.X(), xyz.Y(), xyz.Z() ));
             if ( !setEdgeData( *edge, subIds, helper, data ))
               return false;
           }
@@ -2266,7 +2269,7 @@
  */
 //================================================================================

-void _LayerEdge::Copy( _LayerEdge& other, SMESH_MesherHelper& helper )
+gp_XYZ _LayerEdge::Copy( _LayerEdge& other, SMESH_MesherHelper& helper )
 {
   _nodes     = other._nodes;
   _normal    = other._normal;
@@ -2278,16 +2281,25 @@
   _curvature = 0; std::swap( _curvature, other._curvature );
   _2neibors  = 0; std::swap( _2neibors,  other._2neibors );

+  gp_XYZ lastPos( 0,0,0 );
   if ( _sWOL.ShapeType() == TopAbs_EDGE )
   {
     double u = helper.GetNodeU( TopoDS::Edge( _sWOL ), _nodes[0] );
     _pos.push_back( gp_XYZ( u, 0, 0));
+
+    u = helper.GetNodeU( TopoDS::Edge( _sWOL ), _nodes.back() );
+    lastPos.SetX( u );
   }
   else // TopAbs_FACE
   {
     gp_XY uv = helper.GetNodeUV( TopoDS::Face( _sWOL ), _nodes[0]);
     _pos.push_back( gp_XYZ( uv.X(), uv.Y(), 0));
-  }
+
+    uv = helper.GetNodeUV( TopoDS::Face( _sWOL ), _nodes.back() );
+    lastPos.SetX( uv.X() );
+    lastPos.SetY( uv.Y() );
+  }
+  return lastPos;
 }

 //================================================================================
@@ -3663,10 +3675,14 @@
   Handle(Geom_Surface) surface;
   TopoDS_Edge geomEdge;
   TopoDS_Face geomFace;
+  TopoDS_Shape prevSWOL;
   TopLoc_Location loc;
-  double f,l, u/*, distXYZ[4]*/;
+  double f,l, u;
   gp_XY uv;
   bool isOnEdge;
+  TGeomID prevBaseId = -1;
+  TNode2Edge* n2eMap = 0;
+  TNode2Edge::iterator n2e;

   for ( size_t i = 0; i < data._edges.size(); ++i )
   {
@@ -3686,27 +3702,46 @@
       edge._nodes[1] = 0;
       edge._nodes.back() = tgtNode;
     }
-    if ( !edge._sWOL.IsNull() )
+    // get data of a shrink shape
+    if ( !edge._sWOL.IsNull() && edge._sWOL != prevSWOL )
     {
       isOnEdge = ( edge._sWOL.ShapeType() == TopAbs_EDGE );
-      // restore position of the last node
-//       gp_Pnt p;
       if ( isOnEdge )
       {
         geomEdge = TopoDS::Edge( edge._sWOL );
-        curve = BRep_Tool::Curve( geomEdge, loc, f,l);
-//         double u = helper.GetNodeU( tgtNode );
-//         p = curve->Value( u );
+        curve    = BRep_Tool::Curve( geomEdge, loc, f,l);
       }
       else
       {
         geomFace = TopoDS::Face( edge._sWOL );
-        surface = BRep_Tool::Surface( geomFace, loc );
-//         gp_XY uv = helper.GetNodeUV( tgtNode );
-//         p = surface->Value( uv.X(), uv.Y() );
-      }
-//       p.Transform( loc );
-//       const_cast< SMDS_MeshNode* >( tgtNode )->setXYZ( p.X(), p.Y(), p.Z() );
+        surface  = BRep_Tool::Surface( geomFace, loc );
+      }
+      prevSWOL = edge._sWOL;
+    }
+    // restore shapePos of the last node by already treated _LayerEdge of another _SolidData
+    const TGeomID baseShapeId = edge._nodes[0]->getshapeId();
+    if ( baseShapeId != prevBaseId )
+    {
+      map< TGeomID, TNode2Edge* >::iterator s2ne = data._s2neMap.find( baseShapeId );
+      n2eMap = ( s2ne == data._s2neMap.end() ) ? 0 : n2eMap = s2ne->second;
+      prevBaseId = baseShapeId;
+    }
+    if ( n2eMap && (( n2e = n2eMap->find( edge._nodes[0] )) != n2eMap->end() ))
+    {
+      _LayerEdge*  foundEdge = n2e->second;
+      const gp_XYZ& foundPos = foundEdge->_pos.back();
+      SMDS_PositionPtr lastPos = tgtNode->GetPosition();
+      if ( isOnEdge )
+      {
+        SMDS_EdgePosition* epos = static_cast<SMDS_EdgePosition*>( lastPos );
+        epos->SetUParameter( foundPos.X() );
+      }
+      else
+      {
+        SMDS_FacePosition* fpos = static_cast<SMDS_FacePosition*>( lastPos );
+        fpos->SetUParameter( foundPos.X() );
+        fpos->SetVParameter( foundPos.Y() );
+      }
     }
     // calculate height of the first layer
     double h0;
@@ -3744,12 +3779,14 @@
         if ( isOnEdge )
         {
           u = pos.X();
-          pos = curve->Value( u ).Transformed(loc);
+          if ( !node )
+            pos = curve->Value( u ).Transformed(loc);
         }
         else
         {
           uv.SetCoord( pos.X(), pos.Y() );
-          pos = surface->Value( pos.X(), pos.Y() ).Transformed(loc);
+          if ( !node )
+            pos = surface->Value( pos.X(), pos.Y() ).Transformed(loc);
         }
       }
       // create or update the node
@@ -3777,11 +3814,18 @@
           {
             u = 0.5 * ( u + helper.GetNodeU( geomEdge, node ));
             pos = curve->Value( u ).Transformed(loc);
+
+            SMDS_EdgePosition* epos = static_cast<SMDS_EdgePosition*>( node->GetPosition() );
+            epos->SetUParameter( u );
           }
           else
           {
             uv = 0.5 * ( uv + helper.GetNodeUV( geomFace, node ));
             pos = surface->Value( uv.X(), uv.Y()).Transformed(loc);
+
+            SMDS_FacePosition* fpos = static_cast<SMDS_FacePosition*>( node->GetPosition() );
+            fpos->SetUParameter( uv.X() );
+            fpos->SetVParameter( uv.Y() );
           }
         }
         node->setXYZ( pos.X(), pos.Y(), pos.Z() );


main: Use automatic recovery in case of receiving signal.

Ctrl+c still terminates the whole program, just safely stopping elevator.

--- project/tools/main.cpp
+++ project/tools/main.cpp
@@ -4,15 +4,31 @@
 #include <thread>
 #include <chrono>
 #include <set>
-
+#include <signal.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 #include <wibble/commandline/parser.h>
-
+#include <string.h>
+#include <elevator/driver.h>
+#include <elevator/test.h>
 #include <elevator/elevator.h>
 #include <elevator/scheduler.h>
 #include <elevator/udptools.h>
 #include <elevator/udpqueue.h>
 #include <elevator/sessionmanager.h>

+void handler( int sig, siginfo_t *info, void * ) {
+    elevator::Driver driver;
+    driver.stopElevator();
+    std::cerr << "elevator stopped" << std::endl;
+    if ( sig != SIGCHLD ) {
+        exit( sig );
+    } else {
+        int pid = info->si_pid;
+        waitpid( pid, nullptr, WNOHANG );
+    }
+}

 namespace elevator {

@@ -69,12 +85,51 @@
             exit( 0 );
     }

+    void setupChild() {
+        struct sigaction act;
+        memset( &act, 0, sizeof( struct sigaction ) );
+        act.sa_handler = SIG_DFL;
+        sigaction( SIGCHLD, &act, nullptr );
+        sigaction( SIGINT, &act, nullptr );
+
+        runElevator();
+    }
+
+    void watchChild( int childPid ) {
+        while ( true ) {
+            pause(); // wait for signal
+            initRecovery();
+        }
+    }
+
+    void setupSignals() {
+        struct sigaction act;
+        memset( &act, 0, sizeof( struct sigaction ) );
+        act.sa_sigaction = handler;
+        act.sa_flags = SA_SIGINFO;
+        sigaction( SIGCHLD, &act, nullptr ); // child died
+        sigaction( SIGINT, &act, nullptr ); // ctrl+c
+    }
+
+    void initRecovery() {
+        setupSignals();
+        int pid = fork();
+        if ( pid == 0 ) { // child
+            setupChild();
+        } else if ( pid > 0 ) { // parent
+            watchChild( pid );
+        } else {
+            std::cerr << "Fatal error: fork failed" << std::endl;
+            exit( 1 );
+        }
+    }
+
     void main() {

         if ( avoidRecovery->boolValue() ) {
             runElevator();
         } else {
-            assert_unimplemented();
+            initRecovery();
         }
     }


fix access to protected glbinding::Version member

--- source/gloperate/source/painter/ContextFormat.cpp
+++ source/gloperate/source/painter/ContextFormat.cpp
@@ -74,12 +74,12 @@

 int ContextFormat::majorVersion() const
 {
-    return m_version.m_major;
+    return m_version.majorVersion();
 }

 int ContextFormat::minorVersion() const
 {
-    return m_version.m_minor;
+    return m_version.minorVersion();
 }

 const glbinding::Version & ContextFormat::version() const


[decode] Add task if DecodeFrameCheck() not aborted operation

Accepatble values include MFX_ERR_MORE_(DATA|SURFACE).

Issue: MDP-63939

--- _studio/mfx_lib/shared/src/libmfxsw_decode.cpp
+++ _studio/mfx_lib/shared/src/libmfxsw_decode.cpp
@@ -533,7 +533,9 @@

         memset(&task, 0, sizeof(MFX_TASK));
         mfxRes = session->m_pDECODE->DecodeFrameCheck(bs, surface_work, surface_out, &task.entryPoint);
-        MFX_CHECK(mfxRes >= 0 || MFX_ERR_MORE_DATA_SUBMIT_TASK == static_cast<int>(mfxRes), mfxRes);
+        MFX_CHECK(mfxRes >= 0 || MFX_ERR_MORE_DATA_SUBMIT_TASK == static_cast<int>(mfxRes)
+                  || MFX_ERR_MORE_DATA == static_cast<int>(mfxRes)
+                  || MFX_ERR_MORE_SURFACE == static_cast<int>(mfxRes), mfxRes);

         // source data is OK, go forward
         if (task.entryPoint.pRoutine)


Include type of the ouput when printing to console.

--- OpenSim/Common/Component.cpp
+++ OpenSim/Common/Component.cpp
@@ -1509,14 +1509,26 @@
 }

 void Component::printOutputInfo(const bool includeDescendants) const {
+    using ValueType = std::pair<std::string, SimTK::ClonePtr<AbstractOutput>>;
+
     // Do not display header for Components with no outputs.
     if (getNumOutputs() > 0) {
         const std::string msg = "Outputs from " + getAbsolutePathName();
         std::cout << msg << "\n" << std::string(msg.size(), '=') << std::endl;

-        std::vector<std::string> outputNames = getOutputNames();
-        for (auto thisName : outputNames)
-            std::cout << "  " << thisName << std::endl;
+        const auto& outputs = getOutputs();
+        auto maxlen =
+            std::max_element(outputs.begin(), outputs.end(),
+                             [](const ValueType& a, const ValueType& b) {
+                                 return a.second->getTypeName().length() <
+                                        b.second->getTypeName().length();
+                             })->second->getTypeName().length() + 2;
+        for(const auto& output : outputs) {
+            const auto& name = output.second->getTypeName();
+            std::cout << std::string(maxlen - name.length(), ' ')
+                      << "[" << name << "]  "
+                      << output.first << std::endl;
+        }
         std::cout << std::endl;
     }


New dispatch function

New dispatch function

--- include/etl/parallel.hpp
+++ include/etl/parallel.hpp
@@ -112,6 +112,37 @@
 }

 /*!
+ * \brief Dispatch the elements of a range to a functor in a parallel manner.
+ *
+ * The dispatching will be done in batch. That is to say that the
+ * functor will be called with a range of data.
+ *
+ * This will only be dispatched in parallel if etl is running in
+ * parallel mode and if the range is bigger than the treshold.
+ *
+ * \param functor The functor to execute
+ * \param first The beginning of the range
+ * \param last The end of the range. Must be bigger or equal to first.
+ * \param threshold The threshold for parallelization
+ */
+template <typename Functor>
+inline void smart_dispatch_1d_any(Functor&& functor, size_t first, size_t last, size_t threshold) {
+    if (etl::is_parallel) {
+        auto n = last - first;
+
+        if (select_parallel(n, threshold)) {
+            size_t T = std::min(n, threads);
+            thread_local cpp::default_thread_pool<> pool(threads - 1);
+            dispatch_1d(pool, true, std::forward<Functor>(functor), T, first, last);
+        } else {
+            functor(first, last);
+        }
+    } else {
+        functor(first, last);
+    }
+}
+
+/*!
  * \brief Dispatch the elements of a range to a functor in a parallel manner and use an accumulator functor to accumulate the results
  * \param p Boolean tag to indicate if parallel dispatching must be done
  * \param functor The functor to execute


Add missing header

Add missing header

--- src/Werk/Application/ApplicationContext.cpp
+++ src/Werk/Application/ApplicationContext.cpp
@@ -3,6 +3,7 @@

 #include <boost/algorithm/string.hpp>
 #include <cstdio>
+#include <signal.h>

 #include "Werk/Config/ReloadConfigCommand.hpp"
 #include "Werk/OS/Signals.hpp"


Typo fix [ci skip]

Typo fix [ci skip]

--- OpenSim/Common/Component.cpp
+++ OpenSim/Common/Component.cpp
@@ -906,7 +906,7 @@
     // 4. The System associated with the StateVariables is the current System
     // TODO: Enable the isObjectUpToDateWithProperties() check when computing
     // the path of the GeomtryPath does not involve updating its PathPointSet.
-    // This change dirties the GeometryPath which is aproperty of a Muscle which
+    // This change dirties the GeometryPath which is a property of a Muscle which
     // is property of the Model. Therefore, during integration the Model is not
     // up-to-date and this causes a rebuilding of the cached StateVariables list.
     // See GeometryPath::computePath() for the corresponding TODO that must be


don't define BLAS_FOUND

don't define BLAS_FOUND

--- src/data/shortlist.cpp
+++ src/data/shortlist.cpp
@@ -113,8 +113,6 @@
 Expr LSHShortlist::getIndicesExpr() const {
   return indicesExpr_;
 }
-
-#define BLAS_FOUND 1

 void LSHShortlist::filter(Expr input, Expr weights, bool isLegacyUntransposedW, Expr b, Expr lemmaEt) {
 #if BLAS_FOUND


release memory for request queue of LogServer

--- source/process/log-server/LogServerWorkThread.cpp
+++ source/process/log-server/LogServerWorkThread.cpp
@@ -44,9 +44,13 @@
         DrumRequestData drumReqData;
         while (true)
         {
-            // process requests
             drumRequestQueue_.pop(drumReqData);
             process(drumReqData);
+
+            if (drumRequestQueue_.empty())
+            {
+                drumRequestQueue_.clear();
+            }

             // terminate execution if interrupted
             boost::this_thread::interruption_point();


Schema: Do copy/move of ignored fields

Schema: Do copy/move of ignored fields

--- src/database/schema.cc
+++ src/database/schema.cc
@@ -2028,6 +2028,7 @@
 	  flags(std::move(o.flags)),
 	  accuracy(std::move(o.accuracy)),
 	  acc_prefix(std::move(o.acc_prefix)),
+	  ignored(std::move(o.ignored)),
 	  language(std::move(o.language)),
 	  stop_strategy(std::move(o.stop_strategy)),
 	  stem_strategy(std::move(o.stem_strategy)),
@@ -2048,6 +2049,7 @@
 	flags = std::move(o.flags);
 	accuracy = std::move(o.accuracy);
 	acc_prefix = std::move(o.acc_prefix);
+	ignored = std::move(o.ignored);
 	language = std::move(o.language);
 	stop_strategy = std::move(o.stop_strategy);
 	stem_strategy = std::move(o.stem_strategy);
@@ -2140,19 +2142,19 @@
 	obj_flags["cjk_ngram"] = flags.cjk_ngram;
 	obj_flags["cjk_words"] = flags.cjk_words;

+	auto& obj_accuracy = obj["accuracy"] = MsgPack::ARRAY();
+	for (const auto& a : accuracy) {
+		obj_accuracy.append(a);
+	}
+
+	auto& obj_acc_prefix = obj["acc_prefix"] = MsgPack::ARRAY();
+	for (const auto& a : acc_prefix) {
+		obj_acc_prefix.append(a);
+	}
+
 	auto& obj_ignore = obj["ignored"] = MsgPack::ARRAY();
 	for (const auto& a : ignored) {
 		obj_ignore.append(a);
-	}
-
-	auto& obj_accuracy = obj["accuracy"] = MsgPack::ARRAY();
-	for (const auto& a : accuracy) {
-		obj_accuracy.append(a);
-	}
-
-	auto& obj_acc_prefix = obj["acc_prefix"] = MsgPack::ARRAY();
-	for (const auto& a : acc_prefix) {
-		obj_acc_prefix.append(a);
 	}

 	obj["language"] = language;
@@ -2677,6 +2679,8 @@
 	specification.acc_prefix                 = default_spc.acc_prefix;
 	specification.aux_stem_language          = default_spc.aux_stem_language;
 	specification.aux_language               = default_spc.aux_language;
+
+	specification.ignored                    = default_spc.ignored;

 	specification.partial_index_spcs         = default_spc.partial_index_spcs;
 }


to_cif: when calculating alignment ignore text fields

--- include/gemmi/to_cif.hpp
+++ include/gemmi/to_cif.hpp
@@ -72,7 +72,8 @@
     col_width.resize(ncol, 1);
     size_t col = 0;
     for (const std::string& val : loop.values) {
-      col_width[col] = std::max(col_width[col], val.size());
+      if (!is_text_field(val))
+        col_width[col] = std::max(col_width[col], val.size());
       if (++col == ncol)
         col = 0;
     }


Schema: Global keywords are saved as text

--- src/database/schema.cc
+++ src/database/schema.cc
@@ -2359,11 +2359,8 @@
 			static const specification_t spc(DB_SLOT_UUID, FieldType::uuid, default_spc.accuracy, default_spc.acc_prefix);
 			return spc;
 		}
-		case FieldType::keyword: {
-			static const specification_t spc(DB_SLOT_STRING, FieldType::keyword, default_spc.accuracy, default_spc.acc_prefix);
-			return spc;
-		}
 		case FieldType::string:
+		case FieldType::keyword:
 		case FieldType::text: {
 			static const specification_t spc(DB_SLOT_STRING, FieldType::text, default_spc.accuracy, default_spc.acc_prefix);
 			return spc;
@@ -5630,11 +5627,14 @@
 			if (value.is_string()) {
 				auto ser_value = value.str();
 				if (global_terms) {
-					if (g_specification.flags.bool_term) {
-						index_term(doc, prefixed(ser_value, g_specification.prefix.field, g_specification.get_ctype()), g_specification, pos);
-					} else {
-						index_term(doc, prefixed(strings::lower(ser_value), g_specification.prefix.field, g_specification.get_ctype()), g_specification, pos);
-					}
+					GenerateTerms::text(doc,
+						g_specification.prefix.field + g_specification.get_ctype(), ser_value,
+						g_specification.positions[getPos(pos, g_specification.positions.size())],
+						g_specification.flags.bool_term ? 0 : g_specification.weight[getPos(pos, g_specification.weight.size())],
+						g_specification.flags.cjk_ngram, g_specification.flags.cjk_words,
+						g_specification.language, g_specification.stem_language,
+						getGeneratorStopStrategy(g_specification.stop_strategy),
+						getGeneratorStemStrategy(g_specification.stem_strategy));
 				}
 				if (field_terms) {
 					if (specification.flags.bool_term) {


Fix copy paste bug

Fix copy paste bug

--- include/generate_phi.hpp
+++ include/generate_phi.hpp
@@ -162,6 +162,7 @@

     // phi(xp, i - 1) = 1 for i in [i, a]
     sum += (a + 1 - i) * -SIGN;
+    return sum;
   }

 private:


syntax error

syntax error

--- src/darksend.cpp
+++ src/darksend.cpp
@@ -1439,10 +1439,9 @@
     // if the balance is more the pool max, take the pool max
     if(balanceNeedsAnonymized > nValueMax) {
         balanceNeedsAnonymized = nValueMax;
-    } else if (nValueIn < balanceNeedsAnonymized*0.9 && balanceNeedsAnonymized > 10*COIN) {
-        if(!fDryRun()){
-            SplitUpMoney(); return true;
-        }
+    } else if (nValueIn < balanceNeedsAnonymized*0.9 && balanceNeedsAnonymized > 10*COIN) {
+        if(!fDryRun) SplitUpMoney();
+        return true;
     }

     // select coins that should be given to the pool


+ to_utf8 function to convert from icu::UnicodeString to utf-8 std::string

git-svn-id: 5adfda8227e14e59fd47d5bd9925a30df16fed74@759 d397654b-2ff0-0310-9e29-ba003691a0f9

--- include/mapnik/value.hpp
+++ include/mapnik/value.hpp
@@ -29,6 +29,7 @@
 #include <mapnik/config_error.hpp>
 // boost
 #include <boost/variant.hpp>
+#include <boost/scoped_array.hpp>
 // stl
 #include <iostream>
 #include <string>
@@ -36,8 +37,33 @@
 #include <iomanip>
 // uci
 #include <unicode/unistr.h>
+#include <unicode/ustring.h>
+

 namespace mapnik  {
+
+   inline void to_utf8(UnicodeString const& input, std::string & target)
+   {
+      if (input.length() == 0) return;
+
+      const int BUF_SIZE = 256;
+      char  buf [BUF_SIZE];
+      int len;
+
+      UErrorCode err = U_ZERO_ERROR;
+      u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
+      if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING )
+      {
+         boost::scoped_array<char> buf_ptr(new char [len+1]);
+         err = U_ZERO_ERROR;
+         u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err);
+         target.assign(buf_ptr.get() , len);
+      }
+      else
+      {
+         target.assign(buf, len);
+      }
+   }

    struct value_null
    {
@@ -505,28 +531,9 @@
       {
             std::string operator() (UnicodeString const& val) const
 	    {
-               /*
-               std::stringstream ss;
-               UnicodeString::const_iterator pos = val.begin();
-               ss << std::hex ;
-               for (;pos!=val.end();++pos)
-               {
-                  wchar_t c = *pos;
-                  if (c < 0x80)
-                  {
-                     ss << char(c);
-                  }
-                  else
-                  {
-                     ss << "\\x";
-                     unsigned c0 = (c >> 8) & 0xff;
-                     if (c0) ss << c0;
-                     ss << (c & 0xff);
-                  }
-               }
-	       return "\'" + ss.str() + "\'";
-               */
-               return "TODO";
+               std::string utf8;
+               to_utf8(val,utf8);
+               return "'" + utf8 + "'";
 	    }

             template <typename T>


add set to Fp6T and Fp2T

add set to Fp6T and Fp2T

--- include/mcl/fp_tower.hpp
+++ include/mcl/fp_tower.hpp
@@ -118,6 +118,11 @@
 	{
 		a.clear();
 		b.clear();
+	}
+	void set(const Fp &a_, const Fp &b_)
+	{
+		a = a_;
+		b = b_;
 	}
 	static void add(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_add(z.a.v_, x.a.v_, y.a.v_); }
 	static void sub(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_sub(z.a.v_, x.a.v_, y.a.v_); }
@@ -575,6 +580,12 @@
 	const Fp* getFp0() const { return a.getFp0(); }
 	Fp2* getFp2() { return &a; }
 	const Fp2* getFp2() const { return &a; }
+	void set(const Fp2 &a_, const Fp2 &b_, const Fp2 &c_)
+	{
+		a = a_;
+		b = b_;
+		c = c_;
+	}
 	bool isZero() const
 	{
 		return a.isZero() && b.isZero() && c.isZero();


Initial bits for specialised less-than comparison. Still to be fully tested.

--- include/mp++/integer.hpp
+++ include/mp++/integer.hpp
@@ -8403,10 +8403,67 @@
 }

 // Less-than operator.
-template <std::size_t SSize>
-inline bool dispatch_less_than(const integer<SSize> &a, const integer<SSize> &b)
-{
-    return cmp(a, b) < 0;
+
+// 1-limb specialisation.
+inline bool static_less_than(const static_int<1> &op1, const static_int<1> &op2)
+{
+    const auto size1 = op1._mp_size, size2 = op2._mp_size;
+
+    // Compare sizes.
+    if (size1 < size2) {
+        return true;
+    }
+    if (size1 > size2) {
+        return false;
+    }
+
+    // Sizes are equal, compare the only limb.
+    const auto l1 = op1.m_limbs[0] & GMP_NUMB_MASK;
+    const auto l2 = op2.m_limbs[0] & GMP_NUMB_MASK;
+
+    const auto lt = l1 < l2;
+    const auto gt = l1 > l2;
+
+    // NOTE: as usual, this branchless formulation is slightly
+    // better for signed ints, slightly worse for unsigned
+    // (wrt an if statement).
+    return (size1 >= 0 && lt) || (size1 < 0 && gt);
+}
+
+// mpn implementation.
+template <std::size_t SSize>
+inline bool static_less_than(const static_int<SSize> &n1, const static_int<SSize> &n2)
+{
+    const auto size1 = n1._mp_size, size2 = n2._mp_size;
+
+    // Compare sizes.
+    if (size1 < size2) {
+        return true;
+    }
+    if (size1 > size2) {
+        return false;
+    }
+
+    // The two sizes are equal, compare the absolute values.
+    if (size1) {
+        const int cmp_abs = ::mpn_cmp(n1.m_limbs.data(), n2.m_limbs.data(), static_cast<::mp_size_t>(std::abs(size1)));
+        return (size1 >= 0 && cmp_abs < 0) || (size1 < 0 && cmp_abs > 0);
+    }
+    // Both operands are zero.
+    // NOTE: we do this special casing in order to avoid calling mpn_cmp() on zero operands. It seems to
+    // work, but the official GMP docs say one is not supposed to call mpn functions on zero operands.
+    return false;
+}
+
+template <std::size_t SSize>
+inline bool dispatch_less_than(const integer<SSize> &op1, const integer<SSize> &op2)
+{
+    const bool s1 = op1.is_static(), s2 = op2.is_static();
+    if (mppp_likely(s1 && s2)) {
+        return static_less_than(op1._get_union().g_st(), op2._get_union().g_st());
+    }
+
+    return ::mpz_cmp(op1.get_mpz_view(), op2.get_mpz_view()) < 0;
 }

 template <typename T, std::size_t SSize, enable_if_t<is_cpp_integral_interoperable<T>::value, int> = 0>


Fixed data pattern

Fixed data pattern

--- RunGrid.C
+++ RunGrid.C
@@ -135,7 +135,7 @@
   // plugin->SetDataPattern("pass2/*AliAOD.root"); // sim

   plugin->SetGridDataDir("/alice/data/2011/LHC11h_2/"); //sim
-  plugin->SetDataPattern("/pass2/ESDs/*AliESD.root"); // sim
+  plugin->SetDataPattern("*/pass2/*AliESDs.root"); // sim
   plugin->SetRunPrefix("000");   // real data

   Int_t runlist[1]={167693};


Refactor getOSString() with better #ifdef structure. Fix whitespace.

--- src/date/buildDate.cxx
+++ src/date/buildDate.cxx
@@ -12,25 +12,26 @@

 #include "common.h"

-#include "TextUtils.h"
-
 /* system headers */
 #include <sstream>
 #include <string>
 #include <stdio.h>
 #include <string.h>

+#ifdef _WIN32
+#include <windows.h>
+#else
 #ifdef __APPLE__
 #include <sstream>
 #include <CoreServices/CoreServices.h>
 #include <sys/sysctl.h>
-#endif
-
-#ifdef _WIN32
-#include <windows.h>
 #else
 #include <sys/utsname.h>
-#endif
+#endif // __APPLE__
+#endif // _WIN32
+
+// common headers
+#include "TextUtils.h"

 // opaque version number increments on protocol incompatibility
@@ -166,8 +167,25 @@
   return appVersion.c_str();
 }

-std::string getOSString()
-{
+std::string		getOSString()
+{
+  std::string versionString = "unknown";
+#ifdef _WIN32
+  // build up version string
+  OSVERSIONINFOEX versionInfo;
+  SYSTEM_INFO systemInfo;
+
+  versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+  GetVersionEx((LPOSVERSIONINFO)&versionInfo);
+  GetNativeSystemInfo(&systemInfo);
+
+  std::string platform = "Win32";
+  if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+    platform = "Win64";
+  if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
+    platform = "WinIA64";
+  versionString = TextUtils::format("%s%d.%d.%d sp%d.$d",platform.c_str(),versionInfo.dwMajorVersion,versionInfo.dwMinorVersion,versionInfo.dwBuildNumber, versionInfo.wServicePackMajor,versionInfo.wServicePackMinor);
+#else
 #ifdef __APPLE__
   OSErr err = noErr;

@@ -200,7 +218,7 @@
       case gestaltPowerPC: {reply << " PPC"; break;}
       case gestaltIntel: {reply << " x86"; break;}
       default: {reply << " unknown CPU architecture (Gestalt reply is ";
-      reply << systemArchitecture; reply << ")";}
+	reply << systemArchitecture; reply << ")";}
     }
   } else {
     reply << " unknown CPU architecture (Gestalt error)";
@@ -214,28 +232,8 @@
     }
   }

-  return std::string(reply.str());
-#else
-	#ifdef _WIN32
-	  // build up version string
-	  OSVERSIONINFOEX versionInfo;
-	  SYSTEM_INFO systemInfo;
-
-	  versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-	  GetVersionEx((LPOSVERSIONINFO)&versionInfo);
-	  GetNativeSystemInfo(&systemInfo);
-
-	  std::string versionString;
-	  std::string platform = "Win32";
-	  if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
-		platform = "Win64";
-	  if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
-		platform = "WinIA64";
-	  versionString = TextUtils::format("%s%d.%d.%d sp%d.$d",platform.c_str(),versionInfo.dwMajorVersion,versionInfo.dwMinorVersion,versionInfo.dwBuildNumber, versionInfo.wServicePackMajor,versionInfo.wServicePackMinor);
-
-	  return versionString;
-	#else
-  std::string versionString;
+  versionString = reply.str();
+#else
   struct utsname buf;
   if (uname(&buf) == 0) {
     std::vector<std::string> rtok = TextUtils::tokenize(buf.release, ".", 4);
@@ -254,9 +252,9 @@
     perror("uname");
     versionString = "unix unknown";
   }
+#endif // __APPLE__
+#endif // _WIN32
   return versionString;
-	#endif
-#endif
 }


- simplify davix Uri PathAndString memory management

--- src/davixuri.cpp
+++ src/davixuri.cpp
@@ -59,7 +59,6 @@
         query_and_path(NULL){ }

     ~UriPrivate() {
-        delete query_and_path;
     }

     void parsing(const std::string & uri_string){
@@ -87,7 +86,7 @@
     std::string proto, userinfo, path, host, query, fragment;
     unsigned int port;
     std::string _uri_string;
-    std::string* query_and_path;
+    boost::scoped_ptr<std::string> query_and_path;

 };

@@ -136,11 +135,11 @@
 }

 const std::string & Uri::getPathAndQuery() const {
-    if(d_ptr->query_and_path == NULL){
+    if(d_ptr->query_and_path.get() == NULL){
         if(d_ptr->query.size() > 0){
-            d_ptr->query_and_path = new std::string(d_ptr->path + "?" + d_ptr->query);
+            d_ptr->query_and_path.reset(new std::string(d_ptr->path + "?" + d_ptr->query));
         }else{
-            d_ptr->query_and_path = new std::string(d_ptr->path);
+            d_ptr->query_and_path.reset(new std::string(d_ptr->path));
         }
     }
     return *(d_ptr->query_and_path);


[win] only typedef ssize_t if not yet defined

--- include/nix/Platform.hpp
+++ include/nix/Platform.hpp
@@ -17,8 +17,10 @@
 #pragma warning(disable: 4250 4251)

  //workaround for missing ssize_t on windows
- #include <BaseTsd.h>
- typedef SSIZE_T ssize_t;
+ #ifndef ssize_t
+   #include <BaseTsd.h>
+   typedef SSIZE_T ssize_t;
+ #endif
 #else
  #define NIXAPI
 #endif


use noskiws for Scene.ccp:content

use noskiws for Scene.ccp:content

--- Scene.cpp
+++ Scene.cpp
@@ -54,8 +54,7 @@

 	istringstream iss(reinterpret_cast<const char *>(cur->xmlChildrenNode->content));
 	Result result;
-	// iss >> result;
-	result = iss.str()
+	iss >> noskipws >> result;
 	return result;
 }

@@ -150,7 +149,6 @@
 				if (!xmlStrcmp(cur2->name, reinterpret_cast<const xmlChar *>("name"))) {
 					const string * iter =
 						find(Names, Names + 80, content<string>(cur2));
-					std::cout << "XML NAME: " << content<string>(cur2) << std::endl;

 					if (iter != Names + 80)
 						objects_.back().setName(static_cast<Object::Name>(iter - Names));


noskipws

noskipws

--- Scene.cpp
+++ Scene.cpp
@@ -54,7 +54,7 @@

 	istringstream iss(reinterpret_cast<const char *>(cur->xmlChildrenNode->content));
 	Result result;
-	iss >> result;
+	iss >> noskipws >> result;
 	return result;
 }


done with vartypes

done with vartypes

--- State.cpp
+++ State.cpp
@@ -252,7 +252,7 @@

 State * OpenMap::advanceState()
 {
-  return new OpenMap();
+  return new OpenVarTypes();
 }

 bool OpenMap::process(Context & ctx)
@@ -260,7 +260,6 @@
     #define MAP_COUNT 14
     char * ctxbuf = (char *)ctx.advance();
     int i, j;
-    cout << "here" << endl;

     string map_names[] = {
         "stata_data_start",
@@ -280,11 +279,43 @@
     };

     for (i = 0; i < MAP_COUNT; i++, ctxbuf += 8)
-    {
         ctx.map.stata_map[map_names[i].c_str()] = GetLSF<uint64_t>(ctxbuf, 8);
-        cout << map_names[i].c_str() << " " << ctx.map.stata_map[map_names[i].c_str()] << endl;
-    }

+    ctx.advance();
+
     return true;

+}
+
+
+State * OpenVarTypes::advanceState()
+{
+  cout << "done vartypes" << endl;
+  return NULL; //new OpenMap();
+}
+
+bool OpenVarTypes::process(Context & ctx)
+{
+  char * ctxbuf = (char *) ctx.advance();
+  int curr = 0;
+
+  if (ctx.hdr.fileByteorder == LSF) {
+
+     while (*ctxbuf != '<') {
+          StataVariables * sta = new StataVariables();
+          sta->type = GetLSF<unsigned int>(ctxbuf, 2);
+          cout << "type: " << sta->type << endl;
+          ctx.vList.push_back(sta);
+          ctxbuf += 2;
+          curr++;
+      }
+
+  } else {
+      // not implemented yet
+  }
+
+
+  ctx.advance();
+
+  return true;
 }


RealView: Fix the 24 and 100MHz clocks which were providing incorrect values.

--- src/dev/arm/rv_ctrl.cc
+++ src/dev/arm/rv_ctrl.cc
@@ -62,12 +62,12 @@
         break;
       case Clock24:
         Tick clk;
-        clk = (Tick)(curTick() / (24 * SimClock::Float::MHz));
+        clk = (Tick)(curTick() / (24 * SimClock::Int::us));
         pkt->set((uint32_t)(clk));
         break;
       case Clock100:
         Tick clk100;
-        clk100 = (Tick)(curTick() / (100 * SimClock::Float::MHz));
+        clk100 = (Tick)(curTick() / (100 * SimClock::Int::us));
         pkt->set((uint32_t)(clk100));
         break;
       case Flash:


Silence compiler warning

Silence compiler warning

--- include/tos_counters.hpp
+++ include/tos_counters.hpp
@@ -38,10 +38,10 @@
                       int64_t low,
                       int64_t segment_size)
 {
-  for (T2 i = 0; i < segment_size; i++)
+  for (int64_t i = 0; i < segment_size; i++)
   {
     cnt[i] = (low + i) * sieve[i];
-    for (T2 k = (i + 1) & ~i, j = i; k >>= 1; j &= j - 1)
+    for (int64_t k = (i + 1) & ~i, j = i; k >>= 1; j &= j - 1)
       cnt[i] += cnt[j - 1];
   }
 }


doc fix

doc fix

--- include/vsmc/rng/aes.hpp
+++ include/vsmc/rng/aes.hpp
@@ -45,7 +45,7 @@

 } // namespace traits

-/// \brief Default AESEngine key sequence generator
+/// \brief AESEngine key sequence generator
 /// \ingroup R123RNG
 template <std::size_t R>
 class AESKeySeq


fixed file checking bug introduced by fancy disk IO optimizations

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@4160 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/disk_io_thread.cpp
+++ src/disk_io_thread.cpp
@@ -1278,7 +1278,6 @@
 		, boost::function<void(int, disk_io_job const&)> const& f)
 	{
 		TORRENT_ASSERT(!m_abort);
-		TORRENT_ASSERT(!j.callback);
 		TORRENT_ASSERT(j.storage
 			|| j.action == disk_io_job::abort_thread
 			|| j.action == disk_io_job::update_settings);
@@ -1448,6 +1447,7 @@
 					}
 				}

+				TORRENT_ASSERT(j.offset >= 0);
 				if (m_settings.allow_reordered_disk_operations && defer)
 				{
 #ifdef TORRENT_DISK_STATS
@@ -2023,6 +2023,9 @@
 					// if the check is not done, add it at the end of the job queue
 					if (ret == piece_manager::need_full_check)
 					{
+						// offset needs to be reset to 0 so that the disk
+						// job sorting can be done correctly
+						j.offset = 0;
 						add_job(j, j.callback);
 						continue;
 					}


volatile cache tuning

volatile cache tuning

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@4229 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/disk_io_thread.cpp
+++ src/disk_io_thread.cpp
@@ -496,16 +496,22 @@

 			while (num_blocks)
 			{
-				while (i->blocks[start].buf == 0 && start <= end) ++start;
-				if (start > end) break;
-				free_buffer(i->blocks[start].buf);
-				i->blocks[start].buf = 0;
-				++blocks;
-				--const_cast<cached_piece_entry&>(*i).num_blocks;
-				--m_cache_stats.cache_size;
-				--m_cache_stats.read_cache_size;
-				--num_blocks;
-				if (!num_blocks) break;
+				// if we have a volatile read cache, only clear
+				// from the end, since we're already clearing
+				// from the start as blocks are read
+				if (!m_settings.volatile_read_cache)
+				{
+					while (i->blocks[start].buf == 0 && start <= end) ++start;
+					if (start > end) break;
+					free_buffer(i->blocks[start].buf);
+					i->blocks[start].buf = 0;
+					++blocks;
+					--const_cast<cached_piece_entry&>(*i).num_blocks;
+					--m_cache_stats.cache_size;
+					--m_cache_stats.read_cache_size;
+					--num_blocks;
+					if (!num_blocks) break;
+				}

 				while (i->blocks[end].buf == 0 && start <= end) --end;
 				if (start > end) break;


fixed disk cache bug

fixed disk cache bug

--- src/disk_io_thread.cpp
+++ src/disk_io_thread.cpp
@@ -600,7 +600,7 @@

 		if (m_settings.disk_cache_algorithm == session_settings::lru)
 		{
-			cache_lru_index_t& idx = m_read_pieces.get<1>();
+			cache_lru_index_t& idx = m_pieces.get<1>();
 			while (blocks > 0)
 			{
 				cache_lru_index_t::iterator i = idx.begin();
@@ -613,7 +613,7 @@
 		}
 		else if (m_settings.disk_cache_algorithm == session_settings::largest_contiguous)
 		{
-			cache_lru_index_t& idx = m_read_pieces.get<1>();
+			cache_lru_index_t& idx = m_pieces.get<1>();
 			while (blocks > 0)
 			{
 				cache_lru_index_t::iterator i =


one more shutdown hang fix

one more shutdown hang fix

git-svn-id: 51f496e7cf1b55ee487494d18ee2d308bae7fe77@8840 f43f7eb3-cfe1-5f9d-1b5f-e45aa6702bda

--- src/disk_io_thread.cpp
+++ src/disk_io_thread.cpp
@@ -2962,6 +2962,7 @@

 			l.lock();
 		}
+		l.unlock();

 		// do cleanup in the last running thread
 		if (--m_num_running_threads > 0)


uncaught_exception function is added

uncaught_exception function is added

--- src/exception.cc
+++ src/exception.cc
@@ -6,6 +6,11 @@
 #include <exception>
 #include "typeinfo.h"
 #include "dwarf_eh.h"
+
+
+namespace std {
+    void unexpected();
+}

 /**
  * Class of exceptions to distinguish between this and other exception types.
@@ -877,5 +882,9 @@
 		}
 		terminate();
 	}
-
-}
+    bool uncaught_exception() throw() {
+        __cxa_thread_info *info = thread_info();
+        return info->globals.uncaughtExceptions != 0;
+    }
+
+}


CID-69

CID-69

Checker: FORWARD_NULL
Function: LLFace::switchTexture(LLViewerTexture *)
File: /indra/newview/llface.cpp

not a bug.

--- indra/newview/llface.cpp
+++ indra/newview/llface.cpp
@@ -301,7 +301,8 @@

 	if(!new_texture)
 	{
-		llerrs << "Can not switch to a null texture." << llendl ;
+		llerrs << "Can not switch to a null texture." << llendl;
+		return;
 	}
 	new_texture->addTextureStats(mTexture->getMaxVirtualSize()) ;


Fix off-by-1 error in feature removal

Fix off-by-1 error in feature removal

--- src/features.hpp
+++ src/features.hpp
@@ -203,7 +203,7 @@
         if (item->feature(i).type() == feature) {
             // We need to remove it
             // So swap it last
-            item->mutable_feature()->SwapElements(i, item->feature_size());
+            item->mutable_feature()->SwapElements(i, item->feature_size() - 1);
             // And remove the last element
             item->mutable_feature()->RemoveLast();


*** empty log message ***

*** empty log message ***

git-svn-id: 6ed3528c1be4534134272ad6dd050eeaa1f628d3@471 f43f7eb3-cfe1-5f9d-1b5f-e45aa6702bda

--- src/file_win.cpp
+++ src/file_win.cpp
@@ -88,7 +88,7 @@
 			std::string ret;
 			ret.resize(size);
 			size = wcstombs(&ret[0], ws.c_str(), size + 1);
-			ret.resize(size-1);
+			ret.resize(size);
 			return ret;
 		}
 		catch(std::exception)


Better conditional for call to MPI_Type_free (thanks Cliff Dugal)

--- src/finalize.cpp
+++ src/finalize.cpp
@@ -127,9 +127,7 @@

   // Free all MPI types
 #ifdef OPENMC_MPI
-  int init_called;
-  MPI_Initialized(&init_called);
-  if (init_called) MPI_Type_free(&mpi::bank);
+  if (mpi::bank != MPI_DATATYPE_NULL) MPI_Type_free(&mpi::bank);
 #endif

   return 0;


Rearrange the bootstrapping code in chrome frame net tests to ensure that it works correctly
in debug builds without firing any DCHECKs. Registered the proxy dictionary pref which tripped up
a recent change to add a system level URLRequestContext.

BUG=none
TEST=chrome frame net tests should run in debug builds without firing DCHECKs

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

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

--- chrome_frame/test/net/fake_external_tab.cc
+++ chrome_frame/test/net/fake_external_tab.cc
@@ -25,6 +25,7 @@
 #include "chrome/browser/chrome_content_browser_client.h"
 #include "chrome/browser/prefs/browser_prefs.h"
 #include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prefs/proxy_config_dictionary.h"
 #include "chrome/browser/process_singleton.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/renderer_host/web_cache_manager.h"
@@ -214,11 +215,7 @@
   browser_process_.reset(new BrowserProcessImpl(*cmd));
   // BrowserProcessImpl's constructor should set g_browser_process.
   DCHECK(g_browser_process);
-  // Set the app locale and create the child threads.
   g_browser_process->SetApplicationLocale("en-US");
-  g_browser_process->db_thread();
-  g_browser_process->file_thread();
-  g_browser_process->io_thread();

   RenderProcessHost::set_run_renderer_in_process(true);

@@ -234,14 +231,16 @@
   PrefService* prefs = profile->GetPrefs();
   DCHECK(prefs != NULL);
   WebCacheManager::RegisterPrefs(prefs);
-
   // Override some settings to avoid hitting some preferences that have not
   // been registered.
   prefs->SetBoolean(prefs::kPasswordManagerEnabled, false);
   prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false);
   prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false);
-
-  profile->InitExtensions();
+  prefs->Set(prefs::kProxy, *ProxyConfigDictionary::CreateDirect());
+  // Create the child threads.
+  g_browser_process->db_thread();
+  g_browser_process->file_thread();
+  g_browser_process->io_thread();
 }

 void FakeExternalTab::Shutdown() {


add LOG entry when opening feed in browser

Signed-off-by: Jim Pryor <b16fc8032c62c78b71c32827550f0de1fcbdf807@jimpryor.net>

--- src/feedlist_formaction.cpp
+++ src/feedlist_formaction.cpp
@@ -153,6 +153,7 @@
 		case OP_OPENINBROWSER: {
 				std::tr1::shared_ptr<rss_feed> feed = v->get_ctrl()->get_feed(pos);
 				if (feed) {
+					LOG(LOG_INFO, "feedlist_formaction: opening feed at position `%s': %s", feedpos.c_str(), feed->link().c_str());
 					v->open_in_browser(feed->link());
 				}
 			}


fixed: reading tiled and stripped TIFFs

fixed: reading tiled and stripped TIFFs

--- src/tiff_reader.cc
+++ src/tiff_reader.cc
@@ -157,7 +157,7 @@
 	TIFF* tif = TIFFOpen(file_name_.c_str(), "r");
 	if (tif)
 	{
-	    //todo
+	    std::cerr<<"TODO:tiff is not stripped or tiled\n";
 	    TIFFClose(tif);
 	}
     }
@@ -165,7 +165,6 @@

     void TiffReader::read_tiled(unsigned x0,unsigned y0,ImageData32& image)
     {
-
 	TIFF* tif=TIFFOpen(file_name_.c_str(), "r");
 	if (tif)
 	{
@@ -175,28 +174,33 @@

 	    int start_y=(y0/tile_height_)*tile_height_;
 	    int end_y=((y0+height)/tile_height_+1)*tile_height_;
+	    bool bottomtiles=((unsigned)end_y > height_)?true:false;

 	    int start_x=(x0/tile_width_)*tile_width_;
 	    int end_x=((x0+width)/tile_width_+1)*tile_width_;

-	    int row=0;
-	    int tx0,tx1,ty0,ty1;
+
+	    int row,tx0,tx1,ty0,ty1;
 	    for (int y=start_y;y<end_y;y+=tile_height_)
 	    {
 		ty0=std::max(y0,(unsigned)y)-y;
 		ty1=std::min(height+y0,(unsigned)(y+tile_height_))-y;
+
+		int n0=bottomtiles ? 0:(tile_height_-ty1);
+		int n1=bottomtiles ? (ty1-ty0-1):(tile_height_-ty0-1);
+
 		for (int x=start_x;x<end_x;x+=tile_width_)
 		{

 		    if (!TIFFReadRGBATile(tif,x,y,buf)) break;

-		    tx0=std::max(x0,(unsigned)x)-x;
-		    tx1=std::min(width+x0,(unsigned)(x+tile_width_))-x;
+		    tx0=std::max(x0,(unsigned)x);
+		    tx1=std::min(width+x0,(unsigned)(x+tile_width_));

 		    row=y+ty0-y0;
-		    for (int n=tile_height_-ty0-1;n>=tile_height_-ty1;--n)
+		    for (int n=n1;n>=n0;--n)
 		    {
-			image.setRow(row,x+tx0-x0,x+tx1-x0,(const unsigned*)&buf[n*tile_width_+tx0]);
+			image.setRow(row,tx0-x0,tx1-x0,(const unsigned*)&buf[n*tile_width_+tx0-x]);
 			++row;
 		    }
 		}
@@ -207,31 +211,39 @@
     }

-    void TiffReader::read_stripped(unsigned x,unsigned  y,ImageData32& image)
+    void TiffReader::read_stripped(unsigned x0,unsigned y0,ImageData32& image)
     {
 	TIFF* tif = TIFFOpen(file_name_.c_str(), "r");
 	if (tif)
 	{
 	    uint32* buf = (uint32*)_TIFFmalloc(width_*rows_per_strip_*sizeof(uint32));
+
 	    int width=image.width();
 	    int height=image.height();
-
-	    int start=(y/rows_per_strip_)*rows_per_strip_;
-	    int end=((y+height)/rows_per_strip_+1)*rows_per_strip_;
-	    int extra=y%rows_per_strip_;
-	    int j=-extra;
-	    int w=std::min(width_,(unsigned)width);//todo should be unsigned
-	    for (int row=start; row < end; row+=rows_per_strip_)
-	    {
-		if (!TIFFReadRGBAStrip(tif,row,buf)) break;
-		for (int i=rows_per_strip_-1;i>=0;--i)
+
+	    int start_y=(y0/rows_per_strip_)*rows_per_strip_;
+	    int end_y=((y0+height)/rows_per_strip_+1)*rows_per_strip_;
+	    bool laststrip=((unsigned)end_y > height_)?true:false;
+	    int row,tx0,tx1,ty0,ty1;
+
+	    tx0=x0;
+	    tx1=std::min(width+x0,(unsigned)width_);
+
+	    for (unsigned y=start_y; y < end_y; y+=rows_per_strip_)
+	    {
+		ty0=std::max(y0,y)-y;
+		ty1=std::min(height+y0,y+rows_per_strip_)-y;
+		memset(buf,0xff,width_*rows_per_strip_*sizeof(uint32));
+		if (!TIFFReadRGBAStrip(tif,y,buf)) break;
+
+		row=y+ty0-y0;
+
+		int n0=laststrip ? 0:(rows_per_strip_-ty1);
+		int n1=laststrip ? (ty1-ty0-1):(rows_per_strip_-ty0-1);
+		for (int n=n1;n>=n0;--n)
 		{
-		    if (j>=0 && j<height)
-		    {
-			image.setRow(j,(const unsigned*)&buf[i*width_+x],
-				     w*sizeof(uint32));
-		    }
-		    ++j;
+		    image.setRow(row,tx0-x0,tx1-x0,(const unsigned*)&buf[n*width_+tx0]);
+		    ++row;
 		}
 	    }
 	    _TIFFfree(buf);


Set icons on buttons, fill in values for type and subtype menus

--- src/image_annotator/mainwindow.cc
+++ src/image_annotator/mainwindow.cc
@@ -35,10 +35,8 @@
 	  "QPushButton:pressed{background-color: rgb(190, 190, 190); "
     "border-style: outset; border-radius: 5px;"
 	  "border-width: 2px; border-color: grey; padding: 6px;}");
-  ui_->next->setEnabled(false);
-  ui_->prev->setEnabled(false);
-  ui_->saveAnnotations->setEnabled(false);
-  ui_->imageSlider->setEnabled(false);
+  ui_->next->setIcon(":/icons/image_controls/next.svg");
+  ui_->prev->setIcon(":/icons/image_controls/prev.svg");
   ui_->sideBarLayout->addWidget(species_controls_.get());
   QObject::connect(species_controls_.get(),
       SIGNAL(individualAdded(std::string, std::string)),
@@ -59,7 +57,7 @@
   }
 }

-void MainWindow::on_loadImageDir_clicked() {
+void MainWindow::on_loadImageDir_triggered() {
   QString image_dir = QFileDialog::getExistingDirectory(this,
     "Select an image directory.");
   if(!image_dir.isEmpty()) {
@@ -67,7 +65,7 @@
   }
 }

-void MainWindow::on_saveAnnotations_clicked() {
+void MainWindow::on_saveAnnotations_triggered() {
   if(image_files_.size() > 0) {
     annotations_->write(image_files_);
   }
@@ -76,8 +74,6 @@
 void MainWindow::on_imageSlider_valueChanged() {
   scene_->clear();
   ui_->idSelection->clear();
-  ui_->speciesValue->setText("");
-  ui_->subspeciesValue->setText("");
 #ifdef _WIN32
   QString filename(image_files_[ui_->imageSlider->value()].string().c_str());
 #else
@@ -128,8 +124,50 @@
       annotations_->getImageAnnotations(current_image);
     for(auto annotation : annotations) {
       if(annotation->id_ == id.toInt()) {
-        ui_->speciesValue->setText(annotation->species_.c_str());
-        ui_->subspeciesValue->setText(annotation->subspecies_.c_str());
+        ui_->typeMenu->clear();
+        ui_->subTypeMenu->clear();
+        auto species = species_controls_->getSpecies();
+        for(auto &s : species) {
+          ui_->typeMenu->addItem(s.getName().c_str());
+          if(s.getName() == annotation->species_) {
+            ui_->typeMenu->setCurrentText(s.getName().c_str());
+            auto subspecies = s.getSubspecies();
+            for(auto &sub : subspecies) {
+              ui_->subTypeMenu->addItem(sub.c_str());
+              if(sub == annotation->subspecies_) {
+                ui_->subTypeMenu->setCurrentText(sub.c_str());
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+void on_typeMenu_activated(const QString &text) {
+  if(image_files_.size() > 0 && ui_->imageSlider->isEnabled()) {
+    auto current_image = image_files_[ui_->imageSlider->value()];
+    auto annotations =
+      annotations_->getImageAnnotations(current_image);
+    for(auto annotation : annotations) {
+      if(annotation->id_ == id.toInt()) {
+        ui_->subTypeMenu->clear();
+        auto species = species_controls_->getSpecies();
+        annotation->species_ = ui_->typeMenu->text().toStdString();
+      }
+    }
+  }
+}
+
+void on_subTypeMenu_activated(const QString &text) {
+  if(image_files_.size() > 0 && ui_->imageSlider->isEnabled()) {
+    auto current_image = image_files_[ui_->imageSlider->value()];
+    auto annotations =
+      annotations_->getImageAnnotations(current_image);
+    for(auto annotation : annotations) {
+      if(annotation->id_ == id.toInt()) {
+        annotation->subspecies_ = ui_->subTypeMenu->text().toStdString();
       }
     }
   }
@@ -170,6 +208,15 @@
   }
   std::sort(image_files_.begin(), image_files_.end());
   if(image_files_.size() > 0) {
+    ui_->idLabel->setEnabled(true);
+    ui_->speciesLabel->setEnabled(true);
+    ui_->subspeciesLabel->setEnabled(true);
+    ui_->idSelection->setEnabled(true);
+    ui_->typeMenu->setEnabled(true);
+    ui_->subTypeMenu->setEnabled(true);
+    ui_->removeAnnotation->setEnabled(true);
+    ui_->showAnnotations->setEnabled(true);
+    ui_->setMetadata->setEnabled(true);
     ui_->next->setEnabled(true);
     ui_->prev->setEnabled(true);
     ui_->saveAnnotations->setEnabled(true);


OK -> ok

OK -> ok

--- Dpa/DpaHandler2.cpp
+++ Dpa/DpaHandler2.cpp
@@ -97,7 +97,7 @@
     case TRN_ERROR_TIMEOUT:
       return "ERROR_TIMEOUT";
     case TRN_OK:
-      return "OK";
+      return "ok";
     case TRN_ERROR_FAIL:
       return "ERROR_FAIL";
     case TRN_ERROR_PCMD:


Remove redundant local variables.

Remove redundant local variables.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@298789 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -700,8 +700,6 @@
   typedef typename ELFT::uint uintX_t;

   const elf::ObjectFile<ELFT> *File = Sec.getFile<ELFT>();
-  ArrayRef<uint8_t> SectionData = Sec.Data;
-  const uint8_t *Buf = SectionData.begin();
   OffsetGetter GetOffset(Sec);

   for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) {
@@ -735,8 +733,8 @@
       continue;

     bool Preemptible = isPreemptible(Body, Type);
-    Expr = adjustExpr(*File, Body, Expr, Type, Buf + Rel.r_offset, Sec,
-                      Rel.r_offset);
+    Expr = adjustExpr(*File, Body, Expr, Type, Sec.Data.data() + Rel.r_offset,
+                      Sec, Rel.r_offset);
     if (ErrorCount)
       continue;

@@ -746,7 +744,7 @@
                        R_GOTREL_FROM_END, R_PPC_TOC>(Expr))
       In<ELFT>::Got->HasGotOffRel = true;

-    int64_t Addend = computeAddend(*File, Buf, E, Rel, Expr, Body);
+    int64_t Addend = computeAddend(*File, Sec.Data.data(), E, Rel, Expr, Body);

     if (unsigned Processed =
             handleTlsRelocation<ELFT>(Type, Body, Sec, Offset, Addend, Expr)) {


Rename C -> Sec and RI -> Rel.

Rename C -> Sec and RI -> Rel.

C is short for Chunk, but we are no longer using that term.
RI is probably short for relocation iterator, but this is not an interator.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@298786 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -574,14 +574,14 @@
 template <class ELFT, class RelTy>
 static int64_t computeAddend(const elf::ObjectFile<ELFT> &File,
                              const uint8_t *SectionData, const RelTy *End,
-                             const RelTy &RI, RelExpr Expr, SymbolBody &Body) {
-  uint32_t Type = RI.getType(Config->IsMips64EL);
-  int64_t Addend = getAddend<ELFT>(RI);
-  const uint8_t *BufLoc = SectionData + RI.r_offset;
+                             const RelTy &Rel, RelExpr Expr, SymbolBody &Body) {
+  uint32_t Type = Rel.getType(Config->IsMips64EL);
+  int64_t Addend = getAddend<ELFT>(Rel);
+  const uint8_t *BufLoc = SectionData + Rel.r_offset;
   if (!RelTy::IsRela)
     Addend += Target->getImplicitAddend(BufLoc, Type);
   if (Config->EMachine == EM_MIPS) {
-    Addend += findMipsPairedAddend<ELFT>(SectionData, BufLoc, Body, &RI, End);
+    Addend += findMipsPairedAddend<ELFT>(SectionData, BufLoc, Body, &Rel, End);
     if (Expr == R_MIPS_GOTREL && Body.isLocal())
       Addend += File.MipsGp0;
   }
@@ -680,7 +680,7 @@
   size_t I = 0;
   size_t Size;
 };
-}
+} // namespace

 // The reason we have to do this early scan is as follows
 // * To mmap the output file, we need to know the size
@@ -696,10 +696,10 @@
 // complicates things for the dynamic linker and means we would have to reserve
 // space for the extra PT_LOAD even if we end up not using it.
 template <class ELFT, class RelTy>
-static void scanRelocs(InputSectionBase &C, ArrayRef<RelTy> Rels) {
+static void scanRelocs(InputSectionBase &Sec, ArrayRef<RelTy> Rels) {
   typedef typename ELFT::uint uintX_t;

-  bool IsWrite = C.Flags & SHF_WRITE;
+  bool IsWrite = Sec.Flags & SHF_WRITE;
   if (!Config->ZText)
     IsWrite = true;

@@ -707,25 +707,25 @@
     In<ELFT>::RelaDyn->addReloc(Reloc);
   };

-  const elf::ObjectFile<ELFT> *File = C.getFile<ELFT>();
-  ArrayRef<uint8_t> SectionData = C.Data;
+  const elf::ObjectFile<ELFT> *File = Sec.getFile<ELFT>();
+  ArrayRef<uint8_t> SectionData = Sec.Data;
   const uint8_t *Buf = SectionData.begin();
-  OffsetGetter GetOffset(C);
+  OffsetGetter GetOffset(Sec);

   for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) {
-    const RelTy &RI = *I;
-    SymbolBody &Body = File->getRelocTargetSym(RI);
-    uint32_t Type = RI.getType(Config->IsMips64EL);
+    const RelTy &Rel = *I;
+    SymbolBody &Body = File->getRelocTargetSym(Rel);
+    uint32_t Type = Rel.getType(Config->IsMips64EL);

     if (Config->MipsN32Abi) {
       uint32_t Processed;
       std::tie(Type, Processed) =
-          mergeMipsN32RelTypes(Type, RI.r_offset, I + 1, E);
+          mergeMipsN32RelTypes(Type, Rel.r_offset, I + 1, E);
       I += Processed;
     }

     // Compute the offset of this section in the output section.
-    uintX_t Offset = GetOffset.get(RI.r_offset);
+    uintX_t Offset = GetOffset.get(Rel.r_offset);
     if (Offset == uintX_t(-1))
       continue;

@@ -734,7 +734,7 @@
     // they have relocations pointing to them. We don't care about
     // undefined symbols that are in dead-stripped sections.
     if (!Body.isLocal() && Body.isUndefined() && !Body.symbol()->isWeak())
-      reportUndefined<ELFT>(Body, C, RI.r_offset);
+      reportUndefined<ELFT>(Body, Sec, Rel.r_offset);

     RelExpr Expr = Target->getRelExpr(Type, Body);

@@ -743,8 +743,8 @@
       continue;

     bool Preemptible = isPreemptible(Body, Type);
-    Expr = adjustExpr(*File, Body, IsWrite, Expr, Type, Buf + RI.r_offset, C,
-                      RI.r_offset);
+    Expr = adjustExpr(*File, Body, IsWrite, Expr, Type, Buf + Rel.r_offset, Sec,
+                      Rel.r_offset);
     if (ErrorCount)
       continue;

@@ -754,10 +754,10 @@
                        R_GOTREL_FROM_END, R_PPC_TOC>(Expr))
       In<ELFT>::Got->HasGotOffRel = true;

-    int64_t Addend = computeAddend(*File, Buf, E, RI, Expr, Body);
+    int64_t Addend = computeAddend(*File, Buf, E, Rel, Expr, Body);

     if (unsigned Processed =
-            handleTlsRelocation<ELFT>(Type, Body, C, Offset, Addend, Expr)) {
+            handleTlsRelocation<ELFT>(Type, Body, Sec, Offset, Addend, Expr)) {
       I += (Processed - 1);
       continue;
     }
@@ -770,9 +770,9 @@
       // We don't know anything about the finaly symbol. Just ask the dynamic
       // linker to handle the relocation for us.
       if (!Target->isPicRel(Type))
-        error(C.getLocation<ELFT>(Offset) + ": relocation " + toString(Type) +
+        error(Sec.getLocation<ELFT>(Offset) + ": relocation " + toString(Type) +
               " cannot be used against shared object; recompile with -fPIC.");
-      AddDyn({Target->getDynRel(Type), &C, Offset, false, &Body, Addend});
+      AddDyn({Target->getDynRel(Type), &Sec, Offset, false, &Body, Addend});

       // MIPS ABI turns using of GOT and dynamic relocations inside out.
       // While regular ABI uses dynamic relocations to fill up GOT entries
@@ -796,7 +796,7 @@

     // If the relocation points to something in the file, we can process it.
     bool Constant =
-        isStaticLinkTimeConstant<ELFT>(Expr, Type, Body, C, RI.r_offset);
+        isStaticLinkTimeConstant<ELFT>(Expr, Type, Body, Sec, Rel.r_offset);

     // If the output being produced is position independent, the final value
     // is still not known. In that case we still need some help from the
@@ -804,13 +804,13 @@
     // relocation. We can process some of it and and just ask the dynamic
     // linker to add the load address.
     if (!Constant)
-      AddDyn({Target->RelativeRel, &C, Offset, true, &Body, Addend});
+      AddDyn({Target->RelativeRel, &Sec, Offset, true, &Body, Addend});

     // If the produced value is a constant, we just remember to write it
     // when outputting this section. We also have to do it if the format
     // uses Elf_Rel, since in that case the written value is the addend.
     if (Constant || !RelTy::IsRela)
-      C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
+      Sec.Relocations.push_back({Expr, Type, Offset, Addend, &Body});

     // At this point we are done with the relocated position. Some relocations
     // also require us to create a got or plt entry.


Inline a small lambda.

Inline a small lambda.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@298787 91177308-0d34-0410-b5e6-96231b3b80d8

--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -703,10 +703,6 @@
   if (!Config->ZText)
     IsWrite = true;

-  auto AddDyn = [=](const DynamicReloc &Reloc) {
-    In<ELFT>::RelaDyn->addReloc(Reloc);
-  };
-
   const elf::ObjectFile<ELFT> *File = Sec.getFile<ELFT>();
   ArrayRef<uint8_t> SectionData = Sec.Data;
   const uint8_t *Buf = SectionData.begin();
@@ -772,7 +768,8 @@
       if (!Target->isPicRel(Type))
         error(Sec.getLocation<ELFT>(Offset) + ": relocation " + toString(Type) +
               " cannot be used against shared object; recompile with -fPIC.");
-      AddDyn({Target->getDynRel(Type), &Sec, Offset, false, &Body, Addend});
+      In<ELFT>::RelaDyn->addReloc(
+          {Target->getDynRel(Type), &Sec, Offset, false, &Body, Addend});

       // MIPS ABI turns using of GOT and dynamic relocations inside out.
       // While regular ABI uses dynamic relocations to fill up GOT entries
@@ -804,7 +801,8 @@
     // relocation. We can process some of it and and just ask the dynamic
     // linker to add the load address.
     if (!Constant)
-      AddDyn({Target->RelativeRel, &Sec, Offset, true, &Body, Addend});
+      In<ELFT>::RelaDyn->addReloc(
+          {Target->RelativeRel, &Sec, Offset, true, &Body, Addend});

     // If the produced value is a constant, we just remember to write it
     // when outputting this section. We also have to do it if the format
@@ -847,8 +845,8 @@
         // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
         In<ELFT>::MipsGot->addEntry(Body, Addend, Expr);
         if (Body.isTls() && Body.isPreemptible())
-          AddDyn({Target->TlsGotRel, In<ELFT>::MipsGot, Body.getGotOffset(),
-                  false, &Body, 0});
+          In<ELFT>::RelaDyn->addReloc({Target->TlsGotRel, In<ELFT>::MipsGot,
+                                       Body.getGotOffset(), false, &Body, 0});
         continue;
       }

@@ -870,7 +868,8 @@
       // FIXME: this logic is almost duplicated above.
       bool Constant = !Preemptible && !(Config->Pic && !isAbsolute<ELFT>(Body));
       if (!Constant)
-        AddDyn({DynType, In<ELFT>::Got, Off, !Preemptible, &Body, 0});
+        In<ELFT>::RelaDyn->addReloc(
+            {DynType, In<ELFT>::Got, Off, !Preemptible, &Body, 0});
       if (Constant || (!RelTy::IsRela && !Preemptible))
         In<ELFT>::Got->Relocations.push_back({GotRE, DynType, Off, 0, &Body});
       continue;


Adds support to section "E" in the auditlogs

--- src/transaction.cc
+++ src/transaction.cc
@@ -1410,10 +1410,14 @@
         audit_log << std::endl;
         /** TODO: write audit_log D part. */
     }
-    if (parts & audit_log::AuditLog::EAuditLogPart) {
+    if (parts & audit_log::AuditLog::EAuditLogPart
+        && m_responseBody.tellp() > 0) {
+        std::string body = m_responseBody.str();
         audit_log << "--" << trailer << "-" << "E--" << std::endl;
+        if (body.size() > 0) {
+            audit_log << body << std::endl;
+        }
         audit_log << std::endl;
-        /** TODO: write audit_log E part. */
     }
     if (parts & audit_log::AuditLog::FAuditLogPart) {
         std::vector<const collection::Variable *> l;
@@ -1504,6 +1508,7 @@
     LOGFY_ADD("uri", this->m_uri);

     if (parts & audit_log::AuditLog::CAuditLogPart) {
+        // FIXME: check for the binary content size.
         LOGFY_ADD("body", this->m_requestBody.str().c_str());
     }


Sofa BaseMechanics: apply the new text draw function into MechanicalObject

Former-commit-id: 0f110d331464f78698810660d8448515bca26fd8

--- modules/SofaBaseMechanics/MechanicalObject.inl
+++ modules/SofaBaseMechanics/MechanicalObject.inl
@@ -95,7 +95,7 @@
     , showObject(initData(&showObject, (bool) false, "showObject", "Show objects"))
     , showObjectScale(initData(&showObjectScale, (float) 0.1, "showObjectScale", "Scale for object display"))
     , showIndices(initData(&showIndices, (bool) false, "showIndices", "Show indices"))
-    , showIndicesScale(initData(&showIndicesScale, (float) 0.0001, "showIndicesScale", "Scale for indices display"))
+    , showIndicesScale(initData(&showIndicesScale, (float) 0.02, "showIndicesScale", "Scale for indices display"))
     , showVectors(initData(&showVectors, (bool) false, "showVectors", "Show velocity"))
     , showVectorsScale(initData(&showVectorsScale, (float) 0.0001, "showVectorsScale", "Scale for vectors display"))
     , drawMode(initData(&drawMode,0,"drawMode","The way vectors will be drawn:\n- 0: Line\n- 1:Cylinder\n- 2: Arrow.\n\nThe DOFS will be drawn:\n- 0: point\n- >1: sphere"))
@@ -2707,17 +2707,14 @@
 		Vector4 color(1.0, 1.0, 1.0,1.0);

 		float scale = (float)( ( vparams->sceneBBox().maxBBox() - vparams->sceneBBox().minBBox() ).norm() * showIndicesScale.getValue() );
-
-		for (size_t i = 0; i < vsize; i++)
-		{
-			std::ostringstream oss;
-			oss << i;
-			std::string tmp = oss.str();
-			const char* s = tmp.c_str();
-			Vector3 pos(this->getPX(i), this->getPY(i), this->getPZ(i));
-			vparams->drawTool()->draw3DText(pos, scale, color, s);
-		}
-    }
+
+        helper::vector<Vector3> positions;
+        for (size_t i = 0; i < vsize; ++i)
+            positions.push_back(Vector3(getPX(i), getPY(i), getPZ(i)));
+
+        vparams->drawTool()->draw3DText_Indices(positions, scale, color);
+    }
+
     if (showVectors.getValue())
     {
 //        Vec<3, SReal> sceneMinBBox, sceneMaxBBox;


Upper cut of prim. pT distribution set to 5. GeV

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

 /*
 $Log$
+Revision 1.9  2000/09/18 10:41:35  morsch
+Add possibility to use nuclear structure functions from PDF library V8.
+
 Revision 1.8  2000/09/06 14:26:24  morsch
 Decayer functionality of AliPythia has been moved to AliDecayerPythia.
 Class is now a singleton.
@@ -80,8 +83,8 @@
 //
 //    primordial pT
 	SetMSTP(91,1);
-	SetPARP(91,1);
-	SetPARP(93,3);
+	SetPARP(91,1.);
+	SetPARP(93,5.);
 //
 	break;
     case beauty:


ESA,EDL設定後にメモリが壊れる対策

ESA,EDL設定後にメモリが壊れる対策

--- C700DSP.cpp
+++ C700DSP.cpp
@@ -179,7 +179,7 @@
         mDsp.WriteDsp(DSP_EVOLR, 0, false);
         mDsp.WriteDsp(DSP_EFB, 0, false);
         mDsp.WriteDsp(DSP_FLG, 0x20, false);
-        //mDsp.WriteDsp(DSP_EDL, 0, false);
+        mDsp.WriteDsp(DSP_EDL, 0, false);

         // エコー領域のメモリをクリア(ノイズ対策)
         /*


Use OIIO by default

Use OIIO by default

--- Engine/Settings.cpp
+++ Engine/Settings.cpp
@@ -492,8 +492,8 @@
         k->turnOffAnimation();
         k->populate(it->second);
         for (U32 i = 0; i < it->second.size(); ++i) {
-            ///do not make ReadQt appear as default when there is other options as it is deprecated.
-            if (it->second[i] != "ReadQt") {
+            ///promote ReadOIIO !
+            if (QString(it->second[i].c_str()).contains("ReadOIIOOFX")) {
                 k->setValue<int>(i);
                 break;
             }
@@ -509,8 +509,8 @@
         k->turnOffAnimation();
         k->populate(it->second);
         for (U32 i = 0; i < it->second.size(); ++i) {
-            ///do not make WriteQt appear as default when there is other options as it is deprecated.
-            if (it->second[i] != "WriteQt") {
+            ///promote WriteOIIOOFX !
+            if (QString(it->second[i].c_str()).contains("WriteOIIOOFX")) {
                 k->setValue<int>(i);
                 break;
             }


don't require BOOST_ASIO_ENABLE_CANCELIO on non-windows platforms

git-svn-id: 6df6a9299d9fe08e1e18eb0c01ae615f7df02338@6534 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/udp_socket.cpp
+++ src/udp_socket.cpp
@@ -518,7 +518,7 @@
 	m_callback(e, sender, p, size - (p - buf));
 }

-#ifndef BOOST_ASIO_ENABLE_CANCELIO
+#if !defined BOOST_ASIO_ENABLE_CANCELIO && defined TORRENT_WINDOWS
 #error BOOST_ASIO_ENABLE_CANCELIO needs to be defined when building libtorrent to enable cancel() in asio on windows
 #endif


refactor: Rework asmap Interpret to avoid ptrdiff_t

Former-commit-id: 119b2a3c1d3a6650d830b0337dae0fcac9e09bce

--- src/util/asmap.cpp
+++ src/util/asmap.cpp
@@ -93,7 +93,8 @@
             jump = DecodeJump(pos, endpos);
             if (jump == INVALID) break; // Jump offset straddles EOF
             if (bits == 0) break; // No input bits left
-            if (jump >= endpos - pos) break; // Jumping past EOF
+            if (pos + jump < pos) break; // overflow
+            if (pos + jump >= endpos) break; // Jumping past EOF
             if (ip[ip.size() - bits]) {
                 pos += jump;
             }
@@ -155,7 +156,8 @@
         } else if (opcode == Instruction::JUMP) {
             uint32_t jump = DecodeJump(pos, endpos);
             if (jump == INVALID) return false; // Jump offset straddles EOF
-            if (jump > endpos - pos) return false; // Jump out of range
+            if (pos + jump < pos) return false; // overflow
+            if (pos + jump > endpos) return false; // Jump out of range
             if (bits == 0) return false; // Consuming bits past the end of the input
             --bits;
             uint32_t jump_offset = pos - begin + jump;


Fix memory leak in Tilemaps

Fix memory leak in Tilemaps

--- editor/plugins/tile_set_editor_plugin.cpp
+++ editor/plugins/tile_set_editor_plugin.cpp
@@ -974,6 +974,7 @@
 			workspace->draw_rect(region, c, false);
 		}
 	}
+	delete tiles;

 	if (edit_mode == EDITMODE_REGION) {
 		if (workspace_mode != WORKSPACE_EDIT) {
@@ -1068,6 +1069,7 @@
 			c = Color(0.1, 0.1, 0.1);
 			workspace_overlay->draw_string(font, region.position, tile_id_name, c);
 		}
+		delete tiles;
 	}

 	int t_id = get_current_tile();
@@ -1115,10 +1117,12 @@
 							set_current_tile(t_id);
 							workspace->update();
 							workspace_overlay->update();
+							delete tiles;
 							return;
 						}
 					}
 				}
+				delete tiles;
 			}
 		}

@@ -3118,6 +3122,7 @@
 				workspace_min_size.y = region.position.y + region.size.y;
 		}
 	}
+	delete tiles;

 	workspace->set_custom_minimum_size(workspace_min_size + WORKSPACE_MARGIN * 2);
 	workspace_container->set_custom_minimum_size(workspace_min_size + WORKSPACE_MARGIN * 2);