Primer turno + Fix Love

Primer turno + Fix Love

Soft_reset en 2P arreglado (creo, no logro reproducir el fallo)
Ahora el primer turno se considera de manera separada.
Varios arreglos de estilo.

--- Pasa_la_calculadora.cpp
+++ Pasa_la_calculadora.cpp
@@ -75,9 +75,11 @@

 int digitoEntre(int a, int b);

+int digitoPersona();
 int digitoPersona(int ultimo);

 char mNumero(int ultimo, int n);
+void mostrarCalculadora();
 void mostrarCalculadora(int ultimo);

 //FUNCIONES DE ARCHIVO
@@ -108,10 +110,11 @@
 	tJugador ganador;
 	int opcion, modo;
 	bool cheats = false;
+	string usuario1, usuario2;

 	cout << "Bienvenido a Pasa la calculadora!" << endl;

-	string usuario1 = iniciar_sesion1();
+	usuario1 = iniciar_sesion1();
 	registrar_nueva_ejecucion();

 	//Bucle Menu
@@ -160,7 +163,7 @@

 		else if(modo == Double)
 		{
-			string usuario2 = iniciar_sesion2(usuario1);
+			usuario2 = iniciar_sesion2(usuario1);
 			do
 			{
 				opcion = menu();
@@ -258,8 +261,36 @@
 	srand(time(NULL));//Semilla
 	turno = quienEmpieza(dificultad, cheats);

+	//Primer turno
+	if (turno == Jugador)
+	{
+		ultimoDigito = digitoPersona();
+		turno = Automata;
+	}
+	else /*if (turno == Automata)*/
+	{
+		if (dificultad == Facil)
+		{
+			ultimoDigito = digitoAleatorio();
+		}
+		else if (dificultad == Dificil)
+		{
+			ultimoDigito = botDificil(total, ultimoDigito);
+		}
+		else /*if dificultad == Imposible*/
+		{
+			ultimoDigito = botImposible(ultimoDigito, total);
+		}
+
+		cout << "Elijo el numero " << ultimoDigito << endl;
+
+		turno = Jugador;
+	}
+	total += ultimoDigito;
+	cout << "Total = " << total << endl << endl;
+
 	//Bucle de juego
-	do
+	while ((total < META) && (ultimoDigito != 0))
 	{
 		//Turno jugador
 		if (turno == Jugador)
@@ -290,12 +321,11 @@
 		total += ultimoDigito;
 		cout << "Total = " << total << endl << endl;
 	}
-	while ((total < META) && (ultimoDigito != 0));

 	if (ultimoDigito == 0) turno = Nadie;
 	//Si el jugador abandona, no gana nadie

-	return turno;
+return turno;
 }
 tJugador pasaCalculadora2(bool cheats, string usuario1, string usuario2)
 {
@@ -304,11 +334,27 @@
 	int total = 0, ultimoDigito = 0;

 	srand(time(NULL));//Semilla
-
+
 	turno = quienEmpiezaDoble(cheats, usuario1, usuario2);
-
+
+	//Primer turno
+	if (turno == Jugador1)
+	{
+		cout << "Te toca, " << usuario1 << ":" << endl;
+		ultimoDigito = digitoPersona();
+		turno = Jugador2;
+	}
+	else /*if (turno == Jugador2)*/
+	{
+		cout << "Te toca, " << usuario2 << ":" << endl;
+		ultimoDigito = digitoPersona();
+		turno = Jugador1;
+	}
+	total += ultimoDigito;
+	cout << "Total = " << total << endl << endl;
+
 	//Bucle de juego
-	do
+	while ((total < META) && (ultimoDigito != 0))
 	{
 		//Turno jugador
 		if (turno == Jugador1)
@@ -327,12 +373,12 @@
 		total += ultimoDigito;
 		cout << "Total = " << total << endl << endl;
 	}
-	while ((total < META) && (ultimoDigito != 0));
+

 	if (ultimoDigito == 0) turno = Nadie;
 	//Si un jugador abandona, no gana nadie

-	return turno;
+return turno;
 }
 //Decide aleatoriamente quien empieza la partida, si el automata o el jugador
 tJugador quienEmpieza(tDificultad dificultad, bool cheats)
@@ -355,7 +401,7 @@
 		jugador = Automata;
 	}

-	return jugador;
+return jugador;
 }

 //Decide aleatoriamente quien empieza la partida, si el jugador 1 o el jugador 2
@@ -378,7 +424,7 @@
 		jugador = Jugador2;
 	}

-	return jugador;
+return jugador;
 }

 //Define que numeros se encuentran en la misma fila que el ultimo pulsado
@@ -387,7 +433,7 @@
 	int filaUltimo, filaNuevo;
 	filaUltimo = ((ultimo - 1)/3);
 	filaNuevo = ((nuevo - 1)/3);
-	return (filaUltimo) == (filaNuevo);
+return (filaUltimo) == (filaNuevo);
 }

 //Define que numeros se encuentran en la misma columna que el ultimo
@@ -396,14 +442,12 @@
 	int columnaUltimo, columnaNuevo;
 	columnaUltimo = (ultimo % 3);
 	columnaNuevo = (nuevo % 3);
-	return columnaUltimo == columnaNuevo;
+return columnaUltimo == columnaNuevo;
 }

 //Determina que digitos se pueden pulsar en funcion de las reglas del juego
 bool digitoValido(int ultimo, int nuevo)
 {
-	if (ultimo == 0) return true;//Si es el primer turno, todos los numeros valen
-
 	return ((mismaFila(ultimo, nuevo))||(mismaColumna(ultimo, nuevo)))&&(ultimo!=nuevo);
 }

@@ -423,7 +467,7 @@

 	int seleccionar = digitoEntre(0,6);

-	return seleccionar;
+return seleccionar;
 }

 //Permite al jugador seleccionar la dificultad del juego
@@ -437,10 +481,13 @@
 	     << setfill(' ');

 	int opcion = digitoEntre(1,3);
-
-	if        (opcion == 1)   return Facil;
-	else if   (opcion == 2)   return Dificil;
-	else /*if (opcion == 3)*/ return Imposible;
+	tDificultad dificultad;
+
+	if        (opcion == 1)   dificultad = Facil;
+	else if   (opcion == 2)   dificultad = Dificil;
+	else /*if (opcion == 3)*/ dificultad = Imposible;
+
+return dificultad;
 }

 //Permite selecionar al jugador si quiere jugar
@@ -456,7 +503,7 @@

 	int modo = digitoEntre(0,2);

-	return modo;
+return modo;
 }

 //FUNCIONES DE IA
@@ -477,12 +524,12 @@
 	}
 	while (!digitoValido(ultimo, digito));

-	return digito;
+return digito;
 }

 int botDificil(int total, int ultimo)
 {
-	int ganamos = 0, menos_da_una_piedra = 0;
+	int ganamos = 0, menos_da_una_piedra = 0, movimiento;

 	//Empezamos a jugar en serio cuando la partida esta a punto de acabarse
 	if (total > 20)
@@ -507,27 +554,37 @@
 	//Si la busqueda tiene exito, devolvemos el resultado.
 	//En otro caso, jugamos aleatoriamente.
 	if (ganamos)
-		return ganamos;
+		movimiento = ganamos;
 	else if (menos_da_una_piedra)
-		return menos_da_una_piedra;
+		movimiento = menos_da_una_piedra;
 	else
-		return digitoAutomata(ultimo);
+		movimiento = digitoAutomata(ultimo);
+
+return movimiento;
 }

 int botImposible(int ultimoDigito, int total)
 {
-	//if (total == 0) return 9;
-	for (int digito=1; digito<10; digito++)
-	{
-		if (digitoValido(ultimoDigito, digito))
-		{
-			//cout << "Empezando minimax para " << digito << endl;
-			if (minimax(digito, total+digito, false))
-				return digito;
-			//cout << "Minimax acabado. Movimiento no optimo" << endl;
-		}
-	}
-	return digitoAutomata(ultimoDigito);
+	int movimiento=-1;
+	if (total == 0) movimiento=9;
+	else
+	{
+		//Buscamos un movimiento optimo
+		for (int digito=1; digito<10 && movimiento == -1; digito++)
+		{
+			if (digitoValido(ultimoDigito, digito))
+			{
+				//cout << "Empezando minimax para " << digito << endl;
+				if (minimax(digito, total+digito, false))
+					movimiento = digito;
+				//cout << "Minimax acabado. Movimiento no optimo" << endl;
+			}
+		}
+	}
+	//Si no encontramos un movimiento optimo, devolvemos uno de botDificil
+	if (movimiento == -1) movimiento = botDificil(total, ultimoDigito);
+
+return movimiento;
 }

 //Lets start the backtracking party.
@@ -598,7 +655,20 @@
 	}
 	while (digito == -1);

-	return digito;
+return digito;
+}
+
+int digitoPersona()
+{
+	mostrarCalculadora();
+
+	cout << "Escoge un numero (0 para abandonar)" << endl;
+
+	int digito = digitoEntre(0,9);
+
+	cout << "Has elegido el " << digito << endl;
+
+return digito;
 }

 //Pide un digito al jugador mostrando el teclado. Solo devolvera un valor
@@ -624,19 +694,30 @@

 	cout << "Has elegido el " << digito << endl;

-	return digito;
+return digito;
 }

 //Determina si el numero de la calculadora se muestra o no, en funcion de si es valido
 char mNumero(int ultimo, int n)
 {
+	char c;
 	if(digitoValido(ultimo, n))
-	{
-		return char (n+int('0'));
-	}
+		c = char (n+int('0'));
 	else
-	{
-		return ' ';
+		c = ' ';
+
+return c;
+}
+
+void mostrarCalculadora()
+{
+	for (int j=2; j>=0; j--)
+	{
+		for (int i = 1; i<4; i++)
+		{
+			cout << setw(3) << 3*j+i;
+		}
+		cout << endl;
 	}
 }

@@ -690,7 +771,7 @@
 		ok = false;
 		cout << "Error, el archivo 'acerca.txt' no existe" << endl;
 	}
-	return ok;
+return ok;
 }

 void registrar_nueva_ejecucion()
@@ -787,7 +868,7 @@

 	fcopy("backup.txt", "stats.txt");

-	return usuario1;
+return usuario1;
 }

 //Devuelve el nombre de usuario, y crea su perfil
@@ -866,7 +947,7 @@

 	fcopy("backup.txt", "stats.txt");

-	return usuario2;
+return usuario2;
 }

 void cambio_sesion(string &usuario1, string &usuario2)
@@ -876,6 +957,7 @@
 		 << "2- " << usuario2               << endl
 		 << "0- Volver al menu"                      << endl
 		 << setfill(' ');
+
 	int sesion = digitoEntre(0,2);

 	if     (sesion == 1) usuario1 = iniciar_sesion1();
@@ -962,7 +1044,7 @@
 	//Ahora copiamos la informacion actualizada en el archivo original
 	fcopy("backup.txt", "stats.txt");

-	return ok;
+return ok;
 }

 void actualizar_stats_doble(tJugador ganador, string usuario1, string usuario2)
@@ -1029,7 +1111,7 @@

 	int muestra = digitoEntre(0,2);

-	if(muestra == 1) stats(usuario1);
+	if     (muestra == 1) stats(usuario1);
 	else if(muestra == 2) stats(usuario2);
 }

@@ -1074,7 +1156,7 @@
 		cout << "El backup no ha sido encontrado" << endl;
 		ok = false;
 	}
-	return ok;
+return ok;
 }

 string reset(string usuario)
@@ -1094,7 +1176,7 @@
 		hard_reset();
 		usuario = iniciar_sesion1();
 	}
-	return usuario;
+return usuario;
 }

 void reset2(string &usuario1, string &usuario2)


fix hangs in LangBindHelper_ImplicitTransactions_InterProcess (#5342)

* fix hangs in LangBindHelper_ImplicitTransactions_InterProcess

* more verbose debugging

* try to find the crash

* understood source of crash

* fix a warning

--- test/test_lang_bind_helper.cpp
+++ test/test_lang_bind_helper.cpp
@@ -21,6 +21,7 @@
 #include <mutex>
 #include <condition_variable>
 #include <atomic>
+#include <csignal>
 #include <thread>
 #include "testsettings.hpp"
 #ifdef TEST_LANG_BIND_HELPER
@@ -3082,13 +3083,32 @@

 #ifndef _WIN32

-#if !REALM_ENABLE_ENCRYPTION
-// Interprocess communication does not work with encryption enabled
+#if !(REALM_ENABLE_ENCRYPTION && REALM_PLATFORM_APPLE)
+// Interprocess communication does not work with encryption enabled on Apple.
+// This is because fork() does not play well with Apple primitives such as
+// dispatch_queue_t in ReclaimerThreadStopper. This could possibly be fixed if
+// we need more tests like this.

 #if !REALM_ANDROID && !REALM_IOS
+
+std::stringstream ss;
+void signal_handler(int signal)
+{
+    std::cout << "signal handler: " << signal << std::endl;
+    util::Backtrace::capture().print(ss);
+    std::cout << "trace: " << ss.str() << std::endl;
+    exit(signal);
+}
+
 // fork should not be used on android or ios.
-
-TEST(LangBindHelper_ImplicitTransactions_InterProcess)
+// Interprocess communication does not work with encryption turned on.
+// This test must be non-concurrant due to fork. If a child process
+// is created while a static mutex is locked (eg. util::GlobalRandom::m_mutex)
+// then any attempt to use the mutex would hang infinitely and the child would
+// crash upon exit(0) when attempting to destroy a locked mutex.
+// This is not run with ASAN because children intentionally call exit(0) which does not
+// invoke destructors.
+NONCONCURRENT_TEST_IF(LangBindHelper_ImplicitTransactions_InterProcess, !running_with_asan && !running_with_tsan)
 {
     const int write_process_count = 7;
     const int read_process_count = 3;
@@ -3097,19 +3117,19 @@
         do {
             ret = waitpid(pid, status, options);
         } while (ret == -1 && errno == EINTR);
-        REALM_ASSERT_EX(ret != -1, errno, pid, info);
+        REALM_ASSERT_RELEASE_EX(ret != -1, errno, pid, info);

         bool signaled_to_stop = WIFSIGNALED(*status);
-        REALM_ASSERT_EX(!signaled_to_stop, WTERMSIG(*status), WCOREDUMP(*status), pid, info);
+        REALM_ASSERT_RELEASE_EX(!signaled_to_stop, WTERMSIG(*status), WCOREDUMP(*status), pid, info);

         bool stopped = WIFSTOPPED(*status);
-        REALM_ASSERT_EX(!stopped, WSTOPSIG(*status), pid, info);
+        REALM_ASSERT_RELEASE_EX(!stopped, WSTOPSIG(*status), pid, info);

         bool exited_normally = WIFEXITED(*status);
-        REALM_ASSERT_EX(exited_normally, pid, info);
+        REALM_ASSERT_RELEASE_EX(exited_normally, pid, info);

         auto exit_status = WEXITSTATUS(*status);
-        REALM_ASSERT_EX(exit_status == 0, pid, info);
+        REALM_ASSERT_RELEASE_EX(exit_status == 0, exit_status, pid, info);
     };

     int readpids[read_process_count];
@@ -3119,7 +3139,8 @@
     int pid = fork();
     REALM_ASSERT(pid >= 0);
     if (pid == 0) {
-        {
+        std::signal(SIGSEGV, signal_handler);
+        try {
             std::unique_ptr<Replication> hist(make_in_realm_history());
             DBRef sg = DB::create(*hist, path);
             // initialize table with 200 entries holding 0..200
@@ -3134,6 +3155,9 @@
             table_b->create_object().set_all(99);
             wt.add_table("C");
             wt.commit();
+        }
+        catch (const std::exception& e) {
+            REALM_ASSERT_EX(false, e.what());
         }
         exit(0);
     }


Add MAV_AUTOPILOT_GENERIC only once.

Add MAV_AUTOPILOT_GENERIC only once.

--- src/FirmwarePlugin/FirmwarePluginManager.cc
+++ src/FirmwarePlugin/FirmwarePluginManager.cc
@@ -30,14 +30,11 @@
 {
     if (_knownFirmwareTypes.isEmpty()) {
         QList<FirmwarePluginFactory*> factoryList = FirmwarePluginFactoryRegister::instance()->pluginFactories();
-
-        for (int i=0; i<factoryList.count(); i++) {
+        for (int i = 0; i < factoryList.count(); i++) {
             _knownFirmwareTypes.append(factoryList[i]->knownFirmwareTypes());
         }
+        _knownFirmwareTypes.append(MAV_AUTOPILOT_GENERIC);
     }
-
-    _knownFirmwareTypes.append(MAV_AUTOPILOT_GENERIC);
-
     return _knownFirmwareTypes;
 }


Skip pal::realpath() error logging while probing directories

Both paths calling pal::realpath() and check its return value to see if
the probed paths actually exist in the filesystem; they do have logic
to handle those paths not existing, and printing error messages while
doing so isn't helpful for the user.

This happens when an application is published with one user but is
executed with another user -- for instance, when using containers (see
issue #4038 for details).

Fixes #4038.

--- src/corehost/cli/fxr/fx_muxer.cpp
+++ src/corehost/cli/fxr/fx_muxer.cpp
@@ -216,7 +216,7 @@
 {
     pal::string_t probe_path = path;

-    if (pal::realpath(&probe_path))
+    if (pal::realpath(&probe_path, true))
     {
         realpaths->push_back(probe_path);
     }
@@ -239,7 +239,7 @@
             segment.append(tfm);
             probe_path.replace(pos_placeholder, placeholder.length(), segment);

-            if (pal::realpath(&probe_path))
+            if (pal::realpath(&probe_path, true))
             {
                 realpaths->push_back(probe_path);
             }


#150175 Fix crash in  ICalConverter::toLocal

--- src/ICalConverter.cpp
+++ src/ICalConverter.cpp
@@ -5875,21 +5875,17 @@
      * for task*/
      if ( pEvent->getRecurrence() && pEvent->getAlarm())
      {
-
-    time_t trigger = (pEvent->getAlarm())->getTrigger();
-    int alarmFlag = (pEvent->getAlarm())->getDuration();
-    time_t dateStart = pEvent->getDateStart();
-    vector<string>  rrule = (pEvent->getRecurrence())->getRrule();
-    CAL_DEBUG_LOG(" Event recurrence rule is %s", rrule[ZERO].c_str());
-
-    CAL_DEBUG_LOG("Alarm Trigger date before : %s", ctime(&trigger));
-    this->getImpendingAlarm(rrule[ZERO], trigger, dateStart, alarmFlag);
-    CAL_DEBUG_LOG("Alarm Trigger date: %s", ctime(&trigger));
-    (pEvent->getAlarm())->setTrigger(trigger);
-
-     }
-
-    }
+        if (pEvent->updateAlarmTriggerTime(0))
+        {
+            time_t trigger = (pEvent->getAlarm())->getTrigger();
+            CAL_DEBUG_LOG("Trigger time for '%s' is updated: %s", pEvent->getSummary().c_str(), ctime(&trigger));
+        }
+        else
+        {
+            CAL_ERROR_LOG("Failed to update trigger time for '%s'", pEvent->getSummary().c_str());
+        }
+    }
+    }

     else if (kind == ICAL_VTODO_COMPONENT) {
     	pTodo = new CTodo();


Made dump.getar.writeJSON work even when MPI is disabled

--- hoomd/GetarDumpWriter.cc
+++ hoomd/GetarDumpWriter.cc
@@ -895,8 +895,8 @@
 #ifdef ENABLE_MPI
         // only write on root rank
         if (m_exec_conf->isRoot())
-            m_archive->writeString(rec.getPath(), contents, gtar::FastCompress);
 #endif
+        m_archive->writeString(rec.getPath(), contents, gtar::FastCompress);
         }

     void export_GetarDumpWriter(py::module& m)


post-merge fix

post-merge fix

--- test/test_upgrade_database.cpp
+++ test/test_upgrade_database.cpp
@@ -235,7 +235,7 @@
     {
         CHECK_OR_RETURN(File::copy(path, temp_copy));

-        std::unique_ptr<Replication> hist = make_client_history(temp_copy);
+        std::unique_ptr<Replication> hist = make_in_realm_history(temp_copy);
         SharedGroup sg(*hist);
         ReadTransaction rt(sg);
         ConstTableRef t = rt.get_table("table");


fix is_joy_mapped return value

fix is_joy_mapped return value


Move deadlock detector to WB stage

Move deadlock detector to WB stage

--- perf_sim/perf_sim.cpp
+++ perf_sim/perf_sim.cpp
@@ -59,8 +59,6 @@
         clock_memory( cycle);
         ++cycle;

-        if ( cycle - last_writeback_cycle >= 1000)
-            serr << "Deadlock was detected. The process will be aborted.\n\n" << critical;
         sout << "Executed instructions: " << executed_instrs << std::endl << std::endl;

         check_ports( cycle);
@@ -217,6 +215,11 @@
     if ( !rp_memory_2_writeback->read( &instr, cycle))
     {
         sout << "bubble\n";
+        if ( cycle - last_writeback_cycle >= 1000)
+        {
+            serr << "Deadlock was detected. The process will be aborted."
+                 << std::endl << std::endl << critical;
+        }
         return;
     }


ssl/Unique: add overload for GENERAL_NAMES

--- src/ssl/Unique.hxx
+++ src/ssl/Unique.hxx
@@ -8,6 +8,7 @@
 #define BENG_PROXY_SSL_UNIQUE_HXX

 #include <openssl/ssl.h>
+#include <openssl/x509v3.h>

 #include <memory>

@@ -32,6 +33,10 @@
         X509_EXTENSION_free(ext);
     }

+    void operator()(GENERAL_NAMES *gn) {
+        GENERAL_NAMES_free(gn);
+    }
+
     void operator()(EC_KEY *key) {
         EC_KEY_free(key);
     }
@@ -54,6 +59,7 @@
 using UniqueX509 = std::unique_ptr<X509, OpenSslDelete>;
 using UniqueX509_NAME = std::unique_ptr<X509_NAME, OpenSslDelete>;
 using UniqueX509_EXTENSION = std::unique_ptr<X509_EXTENSION, OpenSslDelete>;
+using UniqueGENERAL_NAMES = std::unique_ptr<GENERAL_NAMES, OpenSslDelete>;
 using UniqueEC_KEY = std::unique_ptr<EC_KEY, OpenSslDelete>;
 using UniqueEVP_PKEY = std::unique_ptr<EVP_PKEY, OpenSslDelete>;
 using UniqueEVP_PKEY_CTX = std::unique_ptr<EVP_PKEY_CTX, OpenSslDelete>;


[ELF][ARM] Fix -Werror buildbots NFC.

[ELF][ARM] Fix -Werror buildbots NFC.

Provide a missing initializer to get rid of warning provoking buildbot
failures.

error: missing field 'rel' initializer
[-Werror,-Wmissing-field-initializers]

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

--- ELF/ARMErrataFix.cpp
+++ ELF/ARMErrataFix.cpp
@@ -250,7 +250,7 @@
   if (off >= limit || limit - off < 8) {
     // Need at least 2 4-byte sized instructions to trigger erratum.
     off = limit;
-    return {0, 0};
+    return {0, 0, nullptr};
   }

   ScanResult scanRes = {0, 0, nullptr};


Changing some comments and naming based on Elliot's suggestions

--- compiler/AST/build.cpp
+++ compiler/AST/build.cpp
@@ -399,23 +399,18 @@
 //
 // Given a string literal argument from a 'use' statement, process
 // that argument.  We assume it's either a "-llib" flag,
-// or a filename like "foo.h", "foo.c", "foo.o", etc.
+// or a source filename like "foo.h", "foo.c", "foo.o", etc.
 //
 // - For the former, pass to addLibInfo(), the same function that
 //   handles command line -l flags.
 //
-// - Otherwise, assume it's the latter and pass it to our input file
+// - Otherwise, assume it's the latter and pass it to our source file
 //   handler (which itself handles cases it doesn't recognize).
 //
-static void processUseOfString(const char* str) {
-  // If the string starts with -l, treat it as a library specifier
-  //
+static void processStringInUseStmt(const char* str) {
   if (strncmp(str, "-l", 2) == 0) {
     addLibInfo(str);
   } else {
-    //
-    // otherwise, treat it as an input file
-    //
     addSourceFile(str);
   }
 }
@@ -428,7 +423,7 @@
   BlockStmt* list = NULL;

   //
-  // Iterate over the expressions being used, processing them
+  // Iterate over the expressions being 'use'd, processing them
   //
   for_actuals(expr, args) {
     Expr* useArg = expr->remove();
@@ -437,7 +432,7 @@
     // if this is a string argument to 'use', process it
     //
     if (const char* str = toImmediateString(useArg)) {
-      processUseOfString(str);
+      processStringInUseStmt(str);
     } else {
       //
       // Otherwise, handle it in the traditional way


Add const to read-only variables.

Add const to read-only variables.

Change-Id: Ie5782e6f450db91e1a66693163fba2b83441e9ae


Removed info message for using default weight

--- src/JumpCondition.cpp
+++ src/JumpCondition.cpp
@@ -311,8 +311,8 @@

 	void JumpCondition::setJumpCriterion(JumpCriterion jump_criterion, ::Eigen::MatrixXd weights)
 	{
-		if(weights.rows() == 0)
-			HA_INFO("JumpCondition::setJumpCriterion", "No value given for weights. Using default weights of 1.");
+//		if(weights.rows() == 0)
+//			HA_WARN("JumpCondition::setJumpCriterion", "No value given for weights. Using default weights of 1.");
 		_jump_criterion = jump_criterion;
 		_norm_weights = weights;
 	}


Code cleanup: avoid warning for unused variable

git-svn-id: d205177852b6c40195f1a49c5cf38f92c98dca5b@1034 3966be30-755a-0410-815e-dd79f492ac3c

--- src/cpp/common/spds/spdsutils.cpp
+++ src/cpp/common/spds/spdsutils.cpp
@@ -240,7 +240,6 @@

     // Terminate the string
     ret[dlen]=0;
-    int ll = strlen(res);
     return res;
 }


start database in proper mode

start database in proper mode

--- src/stack_impl.cpp
+++ src/stack_impl.cpp
@@ -1313,7 +1313,9 @@
             if (m_configuration.network_udp_enable() == true)
             {
                 m_database_stack->start(
-                    tcp_port, globals::instance().is_client()
+                    tcp_port,
+                    globals::instance().operation_mode() ==
+                    protocol::operation_mode_client
                 );
             }


of course, any settings will be happily ignored if i won't readSettings() at startup...

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

--- src/KdeMainWindow.cpp
+++ src/KdeMainWindow.cpp
@@ -94,6 +94,8 @@
     connect( m_fullScreenAct, SIGNAL( triggered( bool ) ), this, SLOT( showFullScreen( bool ) ) );

     setupGUI();
+
+    readSettings();
 }


fixed bug for requestRate calculation

fixed bug for requestRate calculation

--- src/dashplayer/filedownloader.cpp
+++ src/dashplayer/filedownloader.cpp
@@ -2,7 +2,7 @@

 using namespace player;

-#define BITRATE 800.0 //kbits
+#define BITRATE 1200.0 //kbits
 #define DATA_SIZE 4096.0 //byte

 FileDownloader::FileDownloader(int interest_lifetime) : m_face(m_ioService)
@@ -14,7 +14,7 @@
   this->buffer.clear();
   this->buffer.resize (20,chunk());
   this->state = process_state::running;
-  this->requestRate = 1000000/(BITRATE*1000/DATA_SIZE*8); //microseconds
+  this->requestRate = 1000000/((BITRATE*1000)/(DATA_SIZE*8.0)); //microseconds
   this->file = shared_ptr<itec::Buffer>(new itec::Buffer());
   this->file_name = name;

@@ -36,7 +36,7 @@
   }
   if(downloadDuration.total_milliseconds () > 0)
   {
-    dwrate = (dwrate * 8) / downloadDuration.total_milliseconds (); //bits/ms
+    dwrate = (dwrate * 8.0) / downloadDuration.total_milliseconds (); //bits/ms
     dwrate *= 1000; //bits/s
   }
   else


Fixed manipulator child link logic.

Fixed manipulator child link logic.

--- src/KinBodyMarker.cpp
+++ src/KinBodyMarker.cpp
@@ -226,22 +226,24 @@
                 base_link->GetIndex(), tip_link->GetIndex(), chain_links);
         BOOST_ASSERT(success);

-        auto const it = std::find(chain_links.begin(), chain_links.end(), link);
-        if (it != chain_links.end()) {
+        auto const chain_it = std::find(chain_links.begin(), chain_links.end(), link);
+        if (chain_it != chain_links.end()) {
             manipulators->push_back(manipulator);
             continue;
         }

-#if 0
-        // Check if this link is a child (i.e. part of the end-effector)..
-        if (manipulator->IsChildLink(link)) {
+        // Check if this link is a child (i.e. part of the end-effector).
+        // TODO: This is necessary because IsChildLink is broken.
+        std::vector<LinkPtr> child_links;
+        manipulator->GetChildLinks(child_links);
+
+        auto const child_it = std::find(child_links.begin(), child_links.end(), link);
+        if (child_it != child_links.end()) {
             manipulators->push_back(manipulator);
             continue;
         }
-#endif
-    }
-}
-
+    }
+}

 void KinBodyMarker::CreateGhost()
 {


Noted TODO in PersistentObject<...> re. fixing exists() function, which can give a misleading result in the present of inheritance hierarchies in the database.

git-svn-id: 06866f393b1a6e84a5b11d510e7aba86f09962a7@1177 ac3cbfda-f6ac-4daa-b570-d46c5f00fc98

--- persistent_object.hpp
+++ persistent_object.hpp
@@ -230,10 +230,30 @@
 	 * of the database table in which instances of Derived are stored
 	 * by primary key.
 	 *
-	 * CAUTION This ONLY checks in the table named by
+	 * @todo HIGH PRIORIY
+	 * This ONLY checks in the table named by
 	 * Derived::primary_table_name(). If the given ID exists in that
 	 * table in the column named by Derived::primary_key_name(), then
-	 * this function returns true; otherwise it returns false.
+	 * this function returns true; otherwise it returns false. This may
+	 * give misleading results in cases where Derived has as its
+	 * "primary table" a table that is shared with other classes
+	 * (which will generally be the case where Derived shares a base class
+	 * with other classes that are persisted in the database). Suppose
+	 * that in such a case, one of Derived's "sibling" classes has
+	 * an id of 53, stored in the primary table. Since this is also
+	 * Derived's "primary table" (and must be named by
+	 * Derived::primary_table() given an autoincrementing primary key
+	 * in this table), a call to
+	 * PersistentObject<Derived, ...>::exists(..., 53) will return
+	 * \e true, even though no Derived object with an id of 53 exists!
+	 * Thus the \e exists() function can return a highly
+	 * misleading result. To get around this, we need to require
+	 * Derived to define a function "exclusive_table_name()", and
+	 * have this be passed to the PersistentObject base class,
+	 * for this particular function, instead of "primary_table_name()".
+	 * (Though note primary_table_name() is still required elsewhere.)
+	 * We need to document clearly the difference between
+	 * primary_table_name() and exclusive_table_name().
 	 *
 	 * @returns true if and only if an object with p_id as its
 	 * primary key exists in


remove hps and disconnected part fixing

remove hps and disconnected part fixing

in the cases ran so far diffusion reduces the imbalance to the target level without needing to call the helpers

--- phasta/phPartition.cc
+++ phasta/phPartition.cc
@@ -101,18 +101,9 @@
     const double vtxImbTol = 1.03;
     const double step = 0.3;
     const int verbose = 1;  // set to 2 for per iteration stats
-    const double ignored = 42.42;
-
-    Parma_ProcessDisconnectedParts(m);
-    Parma_PrintPtnStats(m, "post ProcessDisconnectedParts", fineStats);
-
-    apf::Balancer* balancer = Parma_MakeHpsBalancer(m,verbose);
-    balancer->balance(weights, ignored);
-    delete balancer;
-    Parma_PrintPtnStats(m, "post HPS", fineStats);

     for(int i=0; i<3; i++) {
-      balancer = Parma_MakeVtxElmBalancer(m, step, verbose);
+      apf::Balancer* balancer = Parma_MakeVtxElmBalancer(m, step, verbose);
       balancer->balance(weights, vtxImbTol);
       Parma_PrintPtnStats(m, "post Parma_MakeVtxElmBalancer", fineStats);
       delete balancer;


Cycles/Optix: Add CYCLES_OPTIX_TEST override

This works similarly to the CYCLES_OPENCL_TEST
environment variable to allow testing on unsupported
hardware.

Note: like the OPENCL test override, this is
for *testing* only and bug reports on unsupported
hardware will *not* be accepted at this point in
time.

--- src/device/device_optix.cpp
+++ src/device/device_optix.cpp
@@ -1558,7 +1558,7 @@
     }

     // Only add devices with RTX support
-    if (rtcore_version == 0)
+    if (rtcore_version == 0 && !getenv("CYCLES_OPTIX_TEST"))
       it = cuda_devices.erase(it);
     else
       ++it;


Actually remove the properties using ingredient+unit combination, if a unit is ddisabled (removed) from that ingredient. The query execution was missing.

svn path=/trunk/kdeextragear-3/krecipes/; revision=233928

--- src/dialogs/ingredientsdialog.cpp
+++ src/dialogs/ingredientsdialog.cpp
@@ -253,7 +253,7 @@
   else database->removeUnitFromIngredient(ingredientID,unitID); //must warn!

 reloadUnitList(); // Reload the list from database
-
+reloadPropertyList(); // Properties could have been removed if a unit is removed, so we need to reload.
 }
 }


control/Server: throw instead of invoking OnControlError()

--- src/control/Server.cxx
+++ src/control/Server.cxx
@@ -68,28 +68,22 @@

 	const uint32_t *magic = (const uint32_t *)data;

-	if (length < sizeof(*magic) || FromBE32(*magic) != BengProxy::control_magic) {
-		handler.OnControlError(std::make_exception_ptr(std::runtime_error("wrong magic")));
-		return;
-	}
+	if (length < sizeof(*magic) || FromBE32(*magic) != BengProxy::control_magic)
+		throw std::runtime_error("wrong magic");

 	data = magic + 1;
 	length -= sizeof(*magic);

-	if (length % 4 != 0) {
-		handler.OnControlError(std::make_exception_ptr(FormatRuntimeError("odd control packet (length=%zu)", length)));
-		return;
-	}
+	if (length % 4 != 0)
+		throw FormatRuntimeError("odd control packet (length=%zu)", length);

 	/* now decode all commands */

 	while (length > 0) {
 		const auto *header = (const BengProxy::ControlHeader *)data;
-		if (length < sizeof(*header)) {
-			handler.OnControlError(std::make_exception_ptr(FormatRuntimeError("partial header (length=%zu)",
-											  length)));
-			return;
-		}
+		if (length < sizeof(*header))
+			throw FormatRuntimeError("partial header (length=%zu)",
+						 length);

 		size_t payload_length = FromBE16(header->length);
 		const auto command = (BengProxy::ControlCommand)
@@ -99,11 +93,9 @@
 		length -= sizeof(*header);

 		const char *payload = (const char *)data;
-		if (length < payload_length) {
-			handler.OnControlError(std::make_exception_ptr(FormatRuntimeError("partial payload (length=%zu, expected=%zu)",
-											  length, payload_length)));
-			return;
-		}
+		if (length < payload_length)
+			throw FormatRuntimeError("partial payload (length=%zu, expected=%zu)",
+						 length, payload_length);

 		/* this command is ok, pass it to the callback */


types: join tag types

types: join tag types

--- src/c4/types.hpp
+++ src/c4/types.hpp
@@ -40,6 +40,11 @@
 /** @see with_capacity_t */
 constexpr const with_capacity_t with_capacity{};

+/** a tag type which can be used to disambiguate in variadic template overloads */
+struct varargs_t {};
+/** a tag variable which can be used to disambiguate in variadic template overloads */
+constexpr const varargs_t varargs{};
+
 //--------------------------------------------------

 /** whether a value should be used in place of a const-reference in argument passing. */
@@ -66,10 +71,6 @@
 using fastcref = typename std::conditional< c4::cref_uses_val< T >::value, T, T const& >::type;

 //--------------------------------------------------
-/** a tag type which can be used to disambiguate in variadic template overloads */
-struct varargs_t {};
-/** a tag variable which can be used to disambiguate in variadic template overloads */
-constexpr const varargs_t varargs{};

 /** Just what its name says. Useful sometimes as a default empty policy class. */
 struct EmptyStruct


comments for what to do to get POST working in POCO

--- poco_test/http_get.cpp
+++ poco_test/http_get.cpp
@@ -23,12 +23,16 @@
 		URI uri(argv[1]);
 		HTTPClientSession session(uri.getHost(), uri.getPort());

+		// http://bsecure/api/v0/session
 		string path(uri.getPathAndQuery());
 		if (path.empty()) path = "/";

+		// USE POST
+		// {"email":"x@src.bz","code":"591acbb20a20d8115f7cfd39b218948e"}
 		HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
 		session.sendRequest(req);

+		// expect 200 response
 		HTTPResponse res;
 		cout << res.getStatus() << " " << res.getReason() << endl;


remove warning

remove warning

--- QtLab/Widget/widget.cpp
+++ QtLab/Widget/widget.cpp
@@ -14,7 +14,7 @@

 }

-void Widget::paintEvent(QPaintEvent *event)
+void Widget::paintEvent(QPaintEvent *)
 {
 	QPainter painter(this);


Fixed:   For FEA#4419, remove wrong comment and whitespace cleanup

Signed-off-by: Shane Bryan <bb9fedbb0bee6c6c53f32da7fce5f936ef59aaaa@linux.intel.com>

--- src/callitem.cpp
+++ src/callitem.cpp
@@ -237,9 +237,6 @@

 void CallItem::callDataChanged()
 {
-    // For now we only handle lineid because
-    // a) that's the only case where the signal is emitted
-    // b) I haven't read anything about callerid name changing in-call
     populatePeopleItem();
 }

@@ -314,7 +311,7 @@
         //% "Unavailable"
         pi_lineid = qtTrId("xx_unavailable");
     }
-
+
     if (m_peopleItem != NULL)
         delete m_peopleItem;
     m_peopleItem = new PeopleItem();


Polardrift: restore guiding on close

Polardrift: restore guiding on close

--- polardrift_toolwin.cpp
+++ polardrift_toolwin.cpp
@@ -309,6 +309,11 @@

 void PolarDriftToolWin::OnClose(wxCloseEvent& evt)
 {
+    if (m_drifting) // STOP drifting before closing
+    {
+        wxCommandEvent dummy;
+        OnStart(dummy);
+    }
     // save the window position
     int x, y;
     GetPosition(&x, &y);


auth: cauthtool now identifies itself properly to common_init

--- src/cauthtool.cc
+++ src/cauthtool.cc
@@ -34,7 +34,7 @@
   argv_to_vec(argc, argv, args);
   env_to_vec(args);
   DEFINE_CONF_VARS(usage);
-  common_init(args, "osdmaptool", false, false);
+  common_init(args, "cauthtool", false, false);

   const char *me = argv[0];


Remove the stl string of Exception from the public API, fix *nix build break, part II

--- src/core/Exception.cpp
+++ src/core/Exception.cpp
@@ -64,6 +64,9 @@
 namespace OCIO = OCIO_NAMESPACE;
 #include "UnitTest.h"

+#include <string.h>
+
+
 OIIO_ADD_TEST(Exception, Basic)
 {
     static const char* dummyErrorStr = "Dummy error";


fix crash on fmv size change

fix crash on fmv size change

--- src/fmv.cpp
+++ src/fmv.cpp
@@ -12,6 +12,8 @@
 #  include <GL/gl.h>
 #endif/*__APPLE__*/

+std::vector<Uint32> pixels;
+
 class FmvUi
 {
 private:
@@ -25,7 +27,7 @@
 #ifdef _WIN32
         strcpy(buf, "C:\\Program Files (x86)\\Steam\\SteamApps\\common\\Oddworld Abes Oddysee\\");
 #else
-        strcpy(buf, "/home/paul/ae_test/");
+        strcpy(buf, "/media/paul/FF7DISC3/Program Files (x86)/Steam/SteamApps/common/Oddworld Abes Oddysee/");
 #endif
     }

@@ -57,6 +59,7 @@

         if (ImGui::Button("Play", ImVec2(ImGui::GetWindowWidth(), 20)))
         {
+            pixels.clear(); // In case next FMV has a diff resolution
             std::string fullPath = std::string(buf) + listbox_items[listbox_item_current];
             std::cout << "Play " << listbox_items[listbox_item_current] << std::endl;
             try
@@ -182,7 +185,6 @@

 };

-std::vector<Uint32> pixels;

 #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))


Misc methods

Misc methods

--- opencog/rule-engine/forwardchainer/ForwardChainer.cc
+++ opencog/rule-engine/forwardchainer/ForwardChainer.cc
@@ -425,6 +425,56 @@

     return result;
 }
+
+/**
+ * Checks whether an atom can be used to generate a bindLink or not.
+ *
+ * @param h  The atom handle to be validated.
+ *
+ * @return   A boolean result of the check.
+ */
+bool ForwardChainer::is_valid_implicant(const Handle& h)
+{
+    FindAtoms fv(VARIABLE_NODE);
+            fv.search_set(h);
+
+    bool is_valid = (h->getType() != NOT_LINK)   and
+                    (not classserver().isA(h->getType(),
+                                          VIRTUAL_LINK))
+                    and
+                    (not fv.varset.empty());
+
+    return is_valid;
+}
+
+void ForwardChainer::validate(Handle hsource, HandleSeq hfocus_set)
+{
+    if (hsource == Handle::UNDEFINED)
+        throw RuntimeException(TRACE_INFO, "ForwardChainer - Invalid source.");
+   //Any other validation here
+}
+
+/**
+ * Gets all unique atoms of in the implicant list of @param r.
+ *
+ * @param r  A rule object
+ *
+ * @return   An unoderedHandleSet of of all unique atoms in the implicant.
+ */
+UnorderedHandleSet ForwardChainer::get_subatoms(Rule *rule)
+{
+    UnorderedHandleSet output_expanded;
+
+    HandleSeq impl_members = rule->get_implicant_seq();
+    for (Handle h : impl_members) {
+        UnorderedHandleSet hs = get_all_unique_atoms(h);
+        hs.erase(h); //Already tried to unify this.
+        output_expanded.insert(hs.begin(), hs.end());
+    }
+
+    return output_expanded;
+}
+
 /**
  * Derives new rules from @param hrule by replacing variables
  * with their groundings.


TechDraw: [skip ci] fix 'copy-constructor' of CenterLine

--- src/Mod/TechDraw/App/Cosmetic.cpp
+++ src/Mod/TechDraw/App/Cosmetic.cpp
@@ -606,7 +606,7 @@
     m_rotate = cl->m_rotate;
     m_extendBy = cl->m_extendBy;
     m_type = cl->m_type;
-    m_flip2Line = m_flip2Line;
+    m_flip2Line = cl->m_flip2Line;

     m_geometry = cl->m_geometry;    //new BaseGeom(cl->m_geometry);??


Fixed recursion analysis

Fixed recursion analysis

Recursion analysis was broken, because assigning
the error value UINT_MAX was then automatically
increased by 1 at the caller site, resulting in
a 0, and recursions would go undetected.

Change-Id: I8ab9990c12d827d8eac2d6084f9170096ad2aef2
Reviewed-on: https://swiftshader-review.googlesource.com/3552
Tested-by: Alexis Hétu <1c7141772178a7e80858c3db5052b328076f08f4@google.com>
Reviewed-by: Nicolas Capens <0612353e1fcebbfd4b302d9337447ca0cdfa9122@google.com>

--- src/OpenGL/compiler/AnalyzeCallDepth.cpp
+++ src/OpenGL/compiler/AnalyzeCallDepth.cpp
@@ -40,21 +40,24 @@

     for(size_t i = 0; i < callees.size(); i++)
 	{
+		unsigned int calleeDepth = 0;
         switch(callees[i]->visit)
 		{
         case InVisit:
             // Cycle detected (recursion)
             return UINT_MAX;
         case PostVisit:
-			callDepth = std::max(callDepth, 1 + callees[i]->getLastDepth());
+			calleeDepth = callees[i]->getLastDepth();
             break;
         case PreVisit:
-			callDepth = std::max(callDepth, 1 + callees[i]->analyzeCallDepth(analyzeCallDepth));
+			calleeDepth = callees[i]->analyzeCallDepth(analyzeCallDepth);
 			break;
         default:
             UNREACHABLE(callees[i]->visit);
             break;
         }
+		if(calleeDepth != UINT_MAX) ++calleeDepth;
+		callDepth = std::max(callDepth, calleeDepth);
     }

     visit = PostVisit;
@@ -156,11 +159,13 @@
 		return 0;
 	}

-    unsigned int depth = 1 + main->analyzeCallDepth(this);
+    unsigned int depth = main->analyzeCallDepth(this);
+	if(depth != UINT_MAX) ++depth;

 	for(FunctionSet::iterator globalCall = globalFunctionCalls.begin(); globalCall != globalFunctionCalls.end(); globalCall++)
 	{
-		unsigned int globalDepth = 1 + (*globalCall)->analyzeCallDepth(this);
+		unsigned int globalDepth = (*globalCall)->analyzeCallDepth(this);
+		if(globalDepth != UINT_MAX) ++globalDepth;

 		if(globalDepth > depth)
 		{


add stdev filtering to region searching

add stdev filtering to region searching

--- search/src/KBMOSearch.cpp
+++ search/src/KBMOSearch.cpp
@@ -370,7 +370,7 @@
 			// repooled after object removal
 			removeObjectFromImages(t);
 			repoolArea(t);
-
+			if (debugInfo) std::cout << "\nFound Candidate at x: " << t.ix << " y: " << t.iy << "\n";
 			fResults.push_back(t);
 			if (fResults.size() >= maxResultCount) break;
 		} else {
@@ -575,49 +575,76 @@

 trajRegion& KBMOSearch::calculateLH(trajRegion& t)
 {
-	/*
-	std::vector<float> psiObs = observeTrajectory(t, pooledPsi, POOL_MAX);
-	std::vector<float> phiObs = observeTrajectory(t, pooledPhi, POOL_MIN);
-	// filter outliers here ??
-	float psiSum = std::accumulate(psiObs.begin(), psiObs.end(), 0.0);
-	float phiSum = std::accumulate(phiObs.begin(), phiObs.end(), 0.0);
-	*/
-
-	float psiSum = 0.0;
-	float phiSum = 0.0;
-	t.obs_count = 0;
+
 	std::vector<float> times = stack.getTimes();
 	float endTime = times.back();
 	float xv = (t.fx-t.ix)/endTime;
 	float yv = (t.fy-t.iy)/endTime;
+	// For region depths
+	float fractionalComp = std::pow(2.0, static_cast<float>(t.depth));
+	int d = std::max(static_cast<int>(t.depth), 0);
+	int size = 1 << static_cast<int>(t.depth);
+	//
+
+	// First pass to compute standard deviation
+	float sum = 0.0;
+	float sumsq = 0.0;
 	for (int i=0; i<stack.imgCount(); ++i)
 	{
+		// Read from region rather than single pixel
+		float tempPsi = 0.0;
+		if (t.depth > 0) {
+			searchRegionsBounded++;
+			float x = t.ix+0.5 + times[i] * xv;
+			float y = t.iy+0.5 + times[i] * yv;
+			tempPsi = findExtremeInRegion(x, y, size, pooledPsi[i], POOL_MAX);
+
+		} else {
+			individualEval++;
+			// Allow for fractional pixel coordinates
+			float xp = fractionalComp*(t.ix + times[i] * xv); // +0.5;
+			float yp = fractionalComp*(t.iy + times[i] * yv); // +0.5;
+			tempPsi = pooledPsi[i][d].getPixelInterp(xp,yp);
+		}
+
+		if (tempPsi == NO_DATA) continue;
+		sum += tempPsi;
+		sumsq += tempPsi*tempPsi;
+	}
+
+	float mean = sum / static_cast<float>(stack.imgCount());
+	float stdDevInv = 1.0 / sqrt(sumsq / static_cast<float>(stack.imgCount()) - mean*mean );
+
+	float psiSum = 0.0;
+	float phiSum = 0.0;
+	t.obs_count = 0;
+
+	// Second pass removes outliers
+	for (int i=0; i<stack.imgCount(); ++i)
+	{
+		float tempPsi = 0.0;
+		float tempPhi = 0.0;
 		// Read from region rather than single pixel
 		if (t.depth > 0) {
 			searchRegionsBounded++;
 			float x = t.ix+0.5 + times[i] * xv;
 			float y = t.iy+0.5 + times[i] * yv;
 			int size = 1 << static_cast<int>(t.depth);
-			float tempPsi = findExtremeInRegion(x, y, size, pooledPsi[i], POOL_MAX);
-			if (tempPsi == NO_DATA) continue;
-			float tempPhi = findExtremeInRegion(x, y, size, pooledPhi[i], POOL_MIN);
-			psiSum += tempPsi;
-			phiSum += tempPhi;
-			t.obs_count++;
+			tempPsi = findExtremeInRegion(x, y, size, pooledPsi[i], POOL_MAX);
+			if (tempPsi == NO_DATA || std::abs(mean-tempPsi)*stdDevInv > psiSigmaCutoff) continue;
+			tempPhi = findExtremeInRegion(x, y, size, pooledPhi[i], POOL_MIN);
 		} else {
 			individualEval++;
 			// Allow for fractional pixel coordinates
-			float fractionalComp = std::pow(2.0, static_cast<float>(t.depth));
 			float xp = fractionalComp*(t.ix + times[i] * xv); // +0.5;
 			float yp = fractionalComp*(t.iy + times[i] * yv); // +0.5;
-			int d = std::max(static_cast<int>(t.depth), 0);
-			float tempPsi = pooledPsi[i][d].getPixelInterp(xp,yp);
-			if (tempPsi == NO_DATA) continue;
-			float tempPhi = pooledPhi[i][d].getPixelInterp(xp,yp);
-			psiSum += tempPsi;
-			phiSum += tempPhi;
-			t.obs_count++;
-		}
+			tempPsi = pooledPsi[i][d].getPixelInterp(xp,yp);
+			if (tempPsi == NO_DATA || std::abs(mean-tempPsi)*stdDevInv > psiSigmaCutoff) continue;
+			tempPhi = pooledPhi[i][d].getPixelInterp(xp,yp);
+		}
+		psiSum += tempPsi;
+		phiSum += tempPhi;
+		t.obs_count++;
 	}

 	//assert(phiSum>0.0);


Move the NOTREACHED/DCHECK check into GetMixFormat and remove it from HardwareSampleRate and HardwareChannelCount.
The reason is that we could hit the NOTREACHED in unit tests when an end point
device was missing and we would unnecessarily DCHECK instead of just log a warning.

TEST=run content_unittests with no mic.

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

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

--- media/audio/win/audio_low_latency_input_win.cc
+++ media/audio/win/audio_low_latency_input_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

@@ -186,10 +186,8 @@
 double WASAPIAudioInputStream::HardwareSampleRate(ERole device_role) {
   base::win::ScopedCoMem<WAVEFORMATEX> audio_engine_mix_format;
   HRESULT hr = GetMixFormat(device_role, &audio_engine_mix_format);
-  if (FAILED(hr)) {
-    NOTREACHED() << "error code: " << hr;
+  if (FAILED(hr))
     return 0.0;
-  }

   return static_cast<double>(audio_engine_mix_format->nSamplesPerSec);
 }
@@ -198,10 +196,8 @@
 uint32 WASAPIAudioInputStream::HardwareChannelCount(ERole device_role) {
   base::win::ScopedCoMem<WAVEFORMATEX> audio_engine_mix_format;
   HRESULT hr = GetMixFormat(device_role, &audio_engine_mix_format);
-  if (FAILED(hr)) {
-    NOTREACHED() << "error code: " << hr;
+  if (FAILED(hr))
     return 0;
-  }

   return static_cast<uint32>(audio_engine_mix_format->nChannels);
 }
@@ -237,8 +233,11 @@
                                  CLSCTX_INPROC_SERVER,
                                  NULL,
                                  audio_client.ReceiveVoid());
-  if (SUCCEEDED(hr))
+  DCHECK(SUCCEEDED(hr)) << "Failed to activate device: " << std::hex << hr;
+  if (SUCCEEDED(hr)) {
     hr = audio_client->GetMixFormat(device_format);
+    DCHECK(SUCCEEDED(hr)) << "GetMixFormat: " << std::hex << hr;
+  }

   return hr;
 }


fix for geosearch

fix for geosearch

--- src/geo.cpp
+++ src/geo.cpp
@@ -171,13 +171,17 @@
             while (sit != options.submembers.end())
             {
                 ZSetCaheElement ele;
-                ele.value = *sit;
+
                 ValueData score, attr;
-                if (0 == ZGetNodeValue(db, key, ele.value, score, attr))
+                if (0 == ZGetNodeValue(db, key, *sit, score, attr))
                 {
                     ele.score = score.NumberValue();
-                    Buffer buf2;
+                    Buffer buf1, buf2;
+                    ValueData vv;
+                    vv.SetValue(*sit, true);
+                    vv.Encode(buf1);
                     attr.Encode(buf2);
+                    ele.value.assign(buf1.GetRawReadBuffer(), buf1.ReadableBytes());
                     ele.attr.assign(buf2.GetRawReadBuffer(), buf2.ReadableBytes());
                     subset.insert(ele);
                 }


Convert proofs to authz (rfc 5878)

Convert proofs to authz (rfc 5878)

--- src/client/ct.cc
+++ src/client/ct.cc
@@ -1060,6 +1060,56 @@
   EVP_PKEY_free(ca_key);
 }

+// The number currently assigned in OpenSSL for
+// TLSEXT_AUTHDATAFORMAT_audit_proof.
+static const unsigned char kAuditProofFormat = 182;
+
+// Wrap the proof in a server_authz format, so that we can feed it to OpenSSL.
+static void ProofToAuthz(int argc, const char **argv) {
+  if (argc != 3) {
+    std::cerr << argv[0] << " <input proof> <output authz>\n";
+    exit(1);
+  }
+  const char *proof_in_file = argv[1];
+  const char *authz_out_file = argv[2];
+
+  std::ifstream proof_in(proof_in_file, std::ios::in|std::ios::binary);
+  if (!proof_in.good()) {
+    perror(proof_in_file);
+    exit(1);
+  }
+
+  std::ofstream authz_out(authz_out_file, std::ios::out|std::ios::binary);
+  if (!authz_out.good()) {
+    perror(authz_out_file);
+    exit(1);
+  }
+
+  // TLSEXT_AUTHDATAFORMAT_audit_proof
+  authz_out << kAuditProofFormat;
+
+  // Count proof length.
+  proof_in.seekg(0, std::ios::end);
+  int proof_length = proof_in.tellg();
+  // Rewind.
+  proof_in.seekg(0, std::ios::beg);
+
+  // Write the length.
+  authz_out << static_cast<unsigned char>(proof_length >> 8)
+            << static_cast<unsigned char>(proof_length);
+
+  // Now write the proof.
+  char *buf = new char[proof_length];
+  proof_in.read(buf, proof_length);
+  assert(proof_in.gcount() == proof_length);
+  authz_out.write(buf, proof_length);
+  assert(!authz_out.bad());
+
+  delete[] buf;
+  proof_in.close();
+  authz_out.close();
+}
+
 static void ConnectHelp() {
   std::cerr << "connect <server> <port> [-log_server_key key_file] "
             << "[-cache cache_dir] [-ca_file ca_file]" << std::endl;
@@ -1217,6 +1267,8 @@
     MakeProtoCert(argc, argv);
   } else if (cmd == "sign") {
     ProtoCertToCert(argc, argv);
+  } else if (cmd == "authz") {
+    ProofToAuthz(argc, argv);
   } else {
     UnknownCommand(cmd);
     UsageHelp(main_command);


EULA screen enabling/disabling crash/metrics reporting renovated.

BUG=chromium-os:2884
TEST=none

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

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

Former-commit-id: bfb33eccf5df77835068ed988e0951f9078f89fd

--- chrome/browser/chromeos/login/eula_view.cc
+++ chrome/browser/chromeos/login/eula_view.cc
@@ -17,6 +17,8 @@
 #include "chrome/browser/chromeos/login/network_screen_delegate.h"
 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
 #include "chrome/browser/chromeos/login/wizard_controller.h"
+#include "chrome/browser/options_util.h"
+#include "chrome/browser/pref_service.h"
 #include "chrome/browser/profile_manager.h"
 #include "chrome/browser/renderer_host/site_instance.h"
 #include "chrome/browser/tab_contents/tab_contents.h"
@@ -32,6 +34,10 @@
 #include "views/grid_layout.h"
 #include "views/layout_manager.h"
 #include "views/standard_layout.h"
+
+#if defined(USE_LINUX_BREAKPAD)
+#include "chrome/app/breakpad_linux.h"
+#endif

 namespace {

@@ -181,7 +187,8 @@
   usage_statistics_checkbox_ = new views::Checkbox();
   usage_statistics_checkbox_->SetMultiLine(true);
   usage_statistics_checkbox_->SetChecked(
-      GoogleUpdateSettings::GetCollectStatsConsent());
+      g_browser_process->local_state()->GetBoolean(
+          prefs::kMetricsReportingEnabled));
   layout->AddView(usage_statistics_checkbox_);

   layout->StartRow(0, SINGLE_LINK_WITH_SHIFT_ROW);
@@ -270,8 +277,18 @@
 void EulaView::ButtonPressed(views::Button* sender, const views::Event& event) {
   if (sender == continue_button_) {
     if (usage_statistics_checkbox_) {
-      GoogleUpdateSettings::SetCollectStatsConsent(
-        usage_statistics_checkbox_->checked());
+      const bool enable_reporting = usage_statistics_checkbox_->checked();
+      PrefService* prefs = g_browser_process->local_state();
+      if (prefs->GetBoolean(prefs::kMetricsReportingEnabled) !=
+          enable_reporting) {
+        prefs->SetBoolean(prefs::kMetricsReportingEnabled, enable_reporting);
+        prefs->SavePersistentPrefs();
+        OptionsUtil::ResolveMetricsReportingEnabled(enable_reporting);
+#if defined(USE_LINUX_BREAKPAD)
+        if (enable_reporting)
+          InitCrashReporter();
+#endif
+      }
     }
     observer_->OnExit(ScreenObserver::EULA_ACCEPTED);
   }


modify walk character directly

modify walk character directly

--- NaoTHSoccer/Source/Core/Cognition/Modules/BehaviorControl/SimpleMotionBehaviorControl/SimpleMotionBehaviorControl.cpp
+++ NaoTHSoccer/Source/Core/Cognition/Modules/BehaviorControl/SimpleMotionBehaviorControl/SimpleMotionBehaviorControl.cpp
@@ -210,7 +210,6 @@
     getMotionRequest().walkRequest.stepControl.target = Pose2D(0, 100, 0);
     getMotionRequest().walkRequest.stepControl.time = stepTime;
     getMotionRequest().walkRequest.stepControl.speedDirection = Math::fromDegrees(speedDirection);
-    getMotionRequest().walkRequest.character = 1;
   }
     );

@@ -219,6 +218,7 @@
   getMotionRequest().walkRequest.offset.rotation = Math::fromDegrees(offsetR);
   MODIFY("walk.offset.x", getMotionRequest().walkRequest.offset.translation.x);
   MODIFY("walk.offset.y", getMotionRequest().walkRequest.offset.translation.y);
+  MODIFY("walk.character", getMotionRequest().walkRequest.character);

   DEBUG_REQUEST("SimpleMotionBehaviorControl:motion:stand_up_from_front",
     getMotionRequest().id = motion::stand_up_from_front;


Calling MisalignGeometry in case of old Root versions (Andrei)

--- STEER/AliSimulation.cxx
+++ STEER/AliSimulation.cxx
@@ -642,7 +642,9 @@
   SetGAliceFile(runLoader->GetFileName());

   // Misalign geometry
-//  MisalignGeometry(runLoader);
+#if ROOT_VERSION_CODE < 331527
+  MisalignGeometry(runLoader);
+#endif

   // Export (mis)aligned geometry
   if (gGeoManager) gGeoManager->Export("misaligned_geometry.root");


PX4IO driver: better feedback

PX4IO driver: better feedback

--- src/drivers/px4io/px4io.cpp
+++ src/drivers/px4io/px4io.cpp
@@ -2856,10 +2856,10 @@
 	}

 	if (ret != OK) {
-		printf("[PX4IO::checkcrc] check CRC failed - %d\n", ret);
+		warn("check CRC failed - %d", ret);
 		exit(1);
 	}
-	printf("[PX4IO::checkcrc] CRCs match\n");
+	warnx("CRCs match\n");
 	exit(0);
 }


Fixes + PIDforTracking output

Fixes + PIDforTracking output

--- STEER/macros/CheckESD.C
+++ STEER/macros/CheckESD.C
@@ -24,6 +24,10 @@
 #include "AliPID.h"
 #include "AliPIDResponse.h"
 #include "AliPIDCombined.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliTPCParam.h"
+#include "TVectorD.h"
 #endif

 TH1F* CreateHisto(const char* name, const char* title,
@@ -171,7 +175,7 @@
   // PID

   AliPIDResponse pidResponse(kTRUE); // kTRUE means Monte-Carlo
-  pidResponse.SetOADBPath("$ALICE_ROOT/OADB");
+  pidResponse.SetOADBPath("$ALICE_PHYSICS/OADB");

   AliPIDCombined pidCombined;
   Int_t maskPID =
@@ -185,6 +189,15 @@
     ;
   pidCombined.SetDetectorMask(maskPID);

+  //set correct BB parameters. Assume the ones from the ALIROOT OCDB were used for simulation
+  AliCDBManager *man=AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE_ROOT/../src/OCDB");
+  man->SetRun(0);
+  const AliCDBEntry *eParam   = man->Get("TPC/Calib/Parameters");
+  AliTPCParam *params   = (AliTPCParam*)eParam->GetObject();
+  TVectorD    &bbParams = *params->GetBetheBlochParametersMC();
+  pidResponse.GetTPCResponse().SetBetheBlochParameters(bbParams(0), bbParams(1), bbParams(2), bbParams(3), bbParams(4));
+
   // efficiency and resolution histograms
   Int_t nBinsPt = 15;
   Float_t minPt = 0.1;
@@ -212,12 +225,15 @@
   Double_t partFrac[AliPID::kSPECIES] =
     {0.01, 0.01, 0.83, 0.10, 0.05};
   Int_t identified[AliPID::kSPECIES+1][AliPID::kSPECIES];
+  Int_t identifiedTPCtr[AliPID::kSPECIES+1][AliPID::kSPECIES];
   for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) {
     for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {
       identified[iGen][iRec] = 0;
+      identifiedTPCtr[iGen][iRec] = 0;
     }
   }
   Int_t nIdentified = 0;
+  Int_t nIdentifiedTPCtr = 0;

   // dE/dx and TOF
   TH2F* hDEdxRight = new TH2F("hDEdxRight", "", 300, 0, 3, 100, 0, 400);
@@ -370,8 +386,15 @@
 	  iRec = i;
 	}
       }
+
+      // PID for tracking
+      Int_t iRecTPCtr = track->GetPIDForTracking();
+
+
       identified[iGen][iRec]++;
+      identifiedTPCtr[iGen][iRecTPCtr]++;
       if (iGen == iRec) nIdentified++;
+      if (iGen == iRecTPCtr) nIdentifiedTPCtr++;

       // dE/dx and TOF
       Double_t time[AliPID::kSPECIESC];
@@ -526,13 +549,13 @@

     // PID
     if (nRec > 0) {
-      Double_t eff = nIdentified*1./nRec;
-      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nRec);
+      Double_t effPID = nIdentified*1./nRec;
+      Double_t effPIDError = TMath::Sqrt(effPID*(1.-effPID) / nRec);
       Info("CheckESD", "PID eff = (%.1f +- %.1f) %%",
-	   100.*eff, 100.*effError);
-      if (eff < checkPIDEffLow - checkPIDEffSigma*effError) {
+	   100.*effPID, 100.*effPIDError);
+      if (effPID < checkPIDEffLow - checkPIDEffSigma*effPIDError) {
 	Warning("CheckESD", "low PID efficiency: (%.1f +- %.1f) %%",
-		100.*eff, 100.*effError);
+		100.*effPID, 100.*effPIDError);
       }
     }

@@ -556,6 +579,33 @@
 		res, resError);
       }
     }
+
+    // PID for tracking
+    if (nRec > 0) {
+      Info("CheckESD: TPC PID for Tracking:", " ");
+      Double_t effPID = nIdentifiedTPCtr*1./nRec;
+      Double_t effPIDError = TMath::Sqrt(effPID*(1.-effPID) / nRec);
+      Info("CheckESD", "PID eff = (%.1f +- %.1f) %%",
+	   100.*effPID, 100.*effPIDError);
+      if (effPID < checkPIDEffLow - checkPIDEffSigma*effPIDError) {
+	Warning("CheckESD", "low PID efficiency: (%.1f +- %.1f) %%",
+		100.*effPID, 100.*effPIDError);
+      }
+    }
+
+    printf("%9s:", "gen\\rec");
+    for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {
+      printf("%9s", partName[iRec]);
+    }
+    printf("\n");
+    for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) {
+      printf("%9s:", partName[iGen]);
+      for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {
+	printf("%9d", identifiedTPCtr[iGen][iRec]);
+      }
+      printf("\n");
+    }
+

     // calorimeters
     if (hEPHOS->Integral() < checkPHOSNLow) {
@@ -597,28 +647,28 @@

     // V0s
     if (nGenV0s > 0) {
-      Double_t eff = nRecV0s*1./nGenV0s;
-      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenV0s);
-      if (effError == 0) effError = checkV0EffLow / TMath::Sqrt(1.*nGenV0s);
+      Double_t effV0 = nRecV0s*1./nGenV0s;
+      Double_t effV0Error = TMath::Sqrt(effV0*(1.-effV0) / nGenV0s);
+      if (effV0Error == 0) effV0Error = checkV0EffLow / TMath::Sqrt(1.*nGenV0s);
       Info("CheckESD", "V0 eff = (%.1f +- %.1f) %%",
-	   100.*eff, 100.*effError);
-      if (eff < checkV0EffLow - checkV0EffSigma*effError) {
+	   100.*effV0, 100.*effV0Error);
+      if (effV0 < checkV0EffLow - checkV0EffSigma*effV0Error) {
 	Warning("CheckESD", "low V0 efficiency: (%.1f +- %.1f) %%",
-		100.*eff, 100.*effError);
+		100.*effV0, 100.*effV0Error);
       }
     }

     // Cascades
     if (nGenCascades > 0) {
-      Double_t eff = nRecCascades*1./nGenCascades;
-      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenCascades);
-      if (effError == 0) effError = checkV0EffLow /
+      Double_t effCsc = nRecCascades*1./nGenCascades;
+      Double_t effCscError = TMath::Sqrt(effCsc*(1.-effCsc) / nGenCascades);
+      if (effCscError == 0) effCscError = checkV0EffLow /
 			   TMath::Sqrt(1.*nGenCascades);
       Info("CheckESD", "Cascade eff = (%.1f +- %.1f) %%",
-	   100.*eff, 100.*effError);
-      if (eff < checkCascadeEffLow - checkCascadeEffSigma*effError) {
+	   100.*effCsc, 100.*effCscError);
+      if (effCsc < checkCascadeEffLow - checkCascadeEffSigma*effCscError) {
 	Warning("CheckESD", "low Cascade efficiency: (%.1f +- %.1f) %%",
-		100.*eff, 100.*effError);
+		100.*effCsc, 100.*effCscError);
       }
     }
   }


Plotting: better support for no-PDF plotting

--- src/doofit/plotting/Plot/Plot.cpp
+++ src/doofit/plotting/Plot/Plot.cpp
@@ -84,9 +84,9 @@
   datasets_.push_back(&dataset);
   pdf_ = &pdf;

-  if (pdf_ == NULL) {
-    serr << "Plot::Plot(): Main PDF is invalid." << endmsg;
-    throw 1;
+  if (pdf_ == nullptr) {
+    swarn << "Plot::Plot(): Main PDF is invalid. Trying to plot anyway." << endmsg;
+    // throw 1;
   }
   if (&dimension_ == NULL) {
     serr << "Plot::Plot(): Dimension is invalid." << endmsg;
@@ -101,29 +101,31 @@
   }

   // iterate over sub PDFs and match supplied regular expressions
-  RooArgSet nodes;
-  pdf.branchNodeServerList(&nodes);
-
-  for (std::vector<std::string>::const_iterator it = components.begin();
-       it != components.end(); ++it) {
-    boost::regex r(*it);
-    components_.push_back(RooArgSet());
-
-    TIterator* it_nodes = nodes.createIterator();
-    RooAbsArg* node = NULL;
-
-    while ((node = dynamic_cast<RooAbsArg*>(it_nodes->Next()))) {
-      RooAbsPdf* pdf_node = dynamic_cast<RooAbsPdf*>(node);
-      if (pdf_node != NULL) {
-        std::string pdf_name = pdf_node->GetName();
-
-        // exclude resolution models generated by RooFit and match the rest
-        if (pdf_name.find("_conv_") == std::string::npos && regex_match(pdf_name,r)) {
-          components_.back().add(*pdf_node);
+  if (pdf_ != nullptr) {
+    RooArgSet nodes;
+    pdf.branchNodeServerList(&nodes);
+
+    for (std::vector<std::string>::const_iterator it = components.begin();
+         it != components.end(); ++it) {
+      boost::regex r(*it);
+      components_.push_back(RooArgSet());
+
+      TIterator* it_nodes = nodes.createIterator();
+      RooAbsArg* node = NULL;
+
+      while ((node = dynamic_cast<RooAbsArg*>(it_nodes->Next()))) {
+        RooAbsPdf* pdf_node = dynamic_cast<RooAbsPdf*>(node);
+        if (pdf_node != NULL) {
+          std::string pdf_name = pdf_node->GetName();
+
+          // exclude resolution models generated by RooFit and match the rest
+          if (pdf_name.find("_conv_") == std::string::npos && regex_match(pdf_name,r)) {
+            components_.back().add(*pdf_node);
+          }
         }
       }
-    }
-    delete it_nodes;
+      delete it_nodes;
+    }
   }
 }


Make sure theme loading bubble is cancelled when extension install is cancelled.

BUG= http://crbug.com/21096
TEST= Install theme. Cancel install at dialog box. Note disappearance of "loading" bubble.

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

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

--- chrome/browser/extensions/crx_installer.cc
+++ chrome/browser/extensions/crx_installer.cc
@@ -198,6 +198,11 @@
 }

 void CrxInstaller::AbortInstall() {
+  // Kill the theme loading bubble.
+  NotificationService* service = NotificationService::current();
+  service->Notify(NotificationType::NO_THEME_DETECTED,
+                  Source<CrxInstaller>(this),
+                  NotificationService::NoDetails());
   Release();  // balanced in ConfirmInstall().

   // We're done. Since we don't post any more tasks to ourself, our ref count


Plotting: fixing other bugs in automated y range estimator

--- src/doofit/plotting/Plot/Plot.cpp
+++ src/doofit/plotting/Plot/Plot.cpp
@@ -168,7 +168,8 @@
   data->GetPoint(0,x,y);
   double min_data_entry = y;
   for (unsigned int i = 1; i < data->GetN(); ++i) {
-    data->GetPoint(0,x,y);
+    data->GetPoint(i,x,y);
+    sdebug << y << endmsg;
     if (min_data_entry > y) min_data_entry = y;
   }
   double min_plot = TMath::Power(10.0,TMath::Log10(min_data_entry)-0.7);


Added const qualifier

Added const qualifier

--- storage/country.cpp
+++ storage/country.cpp
@@ -145,7 +145,7 @@
             TTilesContainer::const_iterator const first = sortedTiles.begin();
             TTilesContainer::const_iterator const last = sortedTiles.end();
             string const nameWithExt = *tokIt + DATA_FILE_EXTENSION;
-            TTilesContainer::const_iterator found = lower_bound(
+            TTilesContainer::const_iterator const found = lower_bound(
                 first, last, TTile(nameWithExt, 0));
             if (found != last && !(nameWithExt < found->first))
               currentCountry->AddTile(*found);


DevTools: Network requests are timed with 1.6 days.

BUG=65506

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

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

--- chrome/browser/net/load_timing_observer.cc
+++ chrome/browser/net/load_timing_observer.cc
@@ -21,17 +21,21 @@

 namespace {

+const int64 kSyncPeriodMicroseconds = 1000 * 1000 * 10;
+
 // We know that this conversion is not solid and suffers from world clock
-// changes, but it should be good enough for the load timing info.
+// changes, but given that we sync clock every 10 seconds, it should be good
+// enough for the load timing info.
 static Time TimeTicksToTime(const TimeTicks& time_ticks) {
   static int64 tick_to_time_offset;
-  static bool tick_to_time_offset_available = false;
-  if (!tick_to_time_offset_available) {
+  static int64 last_sync_ticks = 0;
+  if (time_ticks.ToInternalValue() - last_sync_ticks >
+          kSyncPeriodMicroseconds) {
     int64 cur_time = (Time::Now() - Time()).InMicroseconds();
     int64 cur_time_ticks = (TimeTicks::Now() - TimeTicks()).InMicroseconds();
     // If we add this number to a time tick value, it gives the timestamp.
     tick_to_time_offset = cur_time - cur_time_ticks;
-    tick_to_time_offset_available = true;
+    last_sync_ticks = time_ticks.ToInternalValue();
   }
   return Time::FromInternalValue(time_ticks.ToInternalValue() +
                                  tick_to_time_offset);


Fixed bug in WalkaST_VisitDeclSubExprs where we failed to properly check if
the StmtIterator referring to the initializers of a chain of Decls was equal
to the "end" iterator. The particular bug manifested when an iterator was
created on a chain of decls with no initializers.

Thanks to Nuno Lopes for reporting this bug and providing a patch.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@44220 91177308-0d34-0410-b5e6-96231b3b80d8

--- AST/CFG.cpp
+++ AST/CFG.cpp
@@ -332,11 +332,12 @@
 ///  we must linearize declarations to handle arbitrary control-flow induced by
 /// those expressions.
 CFGBlock* CFGBuilder::WalkAST_VisitDeclSubExprs(StmtIterator& I) {
+  if (I == StmtIterator())
+    return Block;
+
   Stmt* S = *I;
   ++I;
-
-  if (I != StmtIterator())
-    WalkAST_VisitDeclSubExprs(I);
+  WalkAST_VisitDeclSubExprs(I);

   Block = addStmt(S);
   return Block;


Add the kernel to the dictionary

Add the kernel to the dictionary

--- src/swganh/main.cc
+++ src/swganh/main.cc
@@ -23,6 +23,7 @@
 #include <string>

 #include <boost/thread.hpp>
+#include <boost/python.hpp>

 #include "anh/logger.h"

@@ -62,12 +63,18 @@

                 break;
             } else if(cmd.compare("console") == 0) {
+                swganh::scripting::ScopedGilLock lock;
                 anh::Logger::getInstance().DisableConsoleLogging();

                 std::system("cls");
                 std::cout << "swgpy console " << VERSION_MAJOR << "." << VERSION_MINOR << "." << VERSION_PATCH << std::endl;

-                swganh::scripting::ScopedGilLock lock;
+                boost::python::object main = boost::python::object (boost::python::handle<>(boost::python::borrowed(
+                    PyImport_AddModule("__main__")
+                )));
+                auto global_dict = main.attr("__dict__");
+                global_dict["kernel"] = boost::python::ptr(app.GetAppKernel());
+
                 PyRun_InteractiveLoop(stdin, "<stdin>");

                 anh::Logger::getInstance().EnableConsoleLogging();


Fixed World activation from resources

Fixed World activation from resources

--- storage/storage.cpp
+++ storage/storage.cpp
@@ -69,6 +69,19 @@
       {
         FileWriter::DeleteFileX(dataPath + *it);
         LOG(LWARNING, (e.what(), "while adding file", *it, "so this file is deleted"));
+      }
+    }
+    // separate code to activate world data file from resources
+    // if it's not found in writable data dir
+    Platform::FilesList::iterator found = std::find(filesList.begin(), filesList.end(),
+                                                    string(WORLD_FILE_NAME DATA_FILE_EXTENSION));
+    if (found == filesList.end())
+    {
+      try {
+        m_addMap(p.ReadPathForFile(WORLD_FILE_NAME DATA_FILE_EXTENSION));
+      } catch (std::exception const & e)
+      {
+        LOG(LWARNING, (e.what(), "while adding world data file"));
       }
     }
   }


Revert 51494 - Set default sync notification method to "server".

BUG=34647
TEST=manual

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

TBR=akalin@chromium.org
Review URL: http://codereview.chromium.org/2871035

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

Former-commit-id: 8b962829c026ece18793e5205b325698ca007128

--- chrome/browser/sync/notification_method.cc
+++ chrome/browser/sync/notification_method.cc
@@ -8,8 +8,9 @@

 namespace browser_sync {

+// TODO(akalin): Eventually change this to NOTIFICATION_NEW.
 const NotificationMethod kDefaultNotificationMethod =
-    NOTIFICATION_SERVER;
+    NOTIFICATION_TRANSITIONAL;

 std::string NotificationMethodToString(
     NotificationMethod notification_method) {


fixed: stuck in orbit camera when universe is reloaded while orbit camera is active

--- src/editor/world_editor.cpp
+++ src/editor/world_editor.cpp
@@ -2832,6 +2832,7 @@
 		universe->entityDestroyed().bind<WorldEditorImpl, &WorldEditorImpl::onEntityDestroyed>(
 			this);

+		m_is_orbit = false;
 		m_selected_entities.clear();
 		m_universe_created.invoke();
 		m_entity_groups.setUniverse(universe);


Fix formatting error in simulation metadata output

--- src/core/simulation.cc
+++ src/core/simulation.cc
@@ -159,7 +159,7 @@
      << std::endl;
   os << "Number of iterations executed\t: "
      << sim.scheduler_->GetSimulatedSteps() << std::endl;
-  os << "Number of agents\t: " << sim.rm_->GetNumAgents() << std::endl;
+  os << "Number of agents\t\t: " << sim.rm_->GetNumAgents() << std::endl;

   if (dg_names.size() != 0) {
     os << "Diffusion grids" << std::endl;


Turn off verbose

Turn off verbose

--- lib/k2.cpp
+++ lib/k2.cpp
@@ -11,7 +11,7 @@
 #include "matrix.hpp"
 #include "rand.hpp"

-#define VERBOSE 1
+#define VERBOSE 0
 #define SAVE_NETWORKS 0

 double dirichlet_score_family(SMatrix counts, SCPD cpd) {


Replace SysctlValue with Once and Sync

Replace SysctlValue with Once and Sync

--- src/sys/sysctl.hpp
+++ src/sys/sysctl.hpp
@@ -182,41 +182,55 @@

 };

-template <typename... MibTs>
-constexpr Sysctl<sizeof...(MibTs)> make_Sysctl(MibTs const... mib) {
-	return {mib...};
-}
-
-template <size_t MibDepth, typename T>
-class SysctlValue {
+template <typename T, class SysctlT>
+class Sync {
+	private:
+	SysctlT sysctl;
+
+	public:
+	constexpr Sync(SysctlT const & sysctl) noexcept : sysctl{sysctl} {}
+
+	Sync & operator =(T const & value) {
+		this->sysctl.set(value);
+		return *this;
+	}
+
+	operator T () const {
+		T value;
+		this->sysctl.update(value);
+		return value;
+	}
+};
+
+template <typename T, size_t MibDepth>
+using SysctlSync = Sync<T, Sysctl<MibDepth>>;
+
+template <typename T, class SysctlT>
+class Once {
 	private:
 	T value;
-	Sysctl<MibDepth> sysctl;

 	public:
-	template <typename... SysctlArgs>
-	constexpr SysctlValue(T const & value, SysctlArgs const &... args) :
-		value{value}, sysctl{args...} {};
-
-	SysctlValue & operator =(T const & value) {
-		this->value = value;
-		this->sysctl.set(this->value);
-		return *this;
+	Once(T const & value, SysctlT const & sysctl) noexcept {
+		try {
+			sysctl.update(this->value);
+		} catch (sc_error) {
+			this->value = value;
+		}
 	}

 	operator T const &() const {
 		return this->value;
 	}
-
-	void update() {
-		this->sysctl.update(this->value);
-	}
 };

-template <typename T, typename... MibTs>
-constexpr SysctlValue<sizeof...(MibTs), T>
-make_SysctlValue(T const & value, MibTs const... addr) {
-	return {value, addr...};
+template <typename T, size_t MibDepth>
+using SysctlOnce = Once<T, Sysctl<MibDepth>>;
+
+template <typename T, class SysctlT>
+constexpr Once<T, SysctlT> once(T const & value, SysctlT const & sysctl)
+    noexcept {
+	return {value, sysctl};
 }

 } /* namespace ctl */


Mostly fixes black flashing that happens during popup resize.

BUG=25459
TEST=none
TBR=amit

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

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

--- chrome/browser/views/browser_bubble_win.cc
+++ chrome/browser/views/browser_bubble_win.cc
@@ -14,6 +14,8 @@
  public:
   explicit BubbleWidget(BrowserBubble* bubble)
       : bubble_(bubble), closed_(false) {
+    set_window_style(WS_POPUP | WS_CLIPCHILDREN);
+    set_window_ex_style(WS_EX_TOOLWINDOW);
   }

   void Show(bool activate) {
@@ -70,7 +72,6 @@
   // popup_ is a Widget, but we need to do some WidgetWin stuff first, then
   // we'll assign it into popup_.
   views::WidgetWin* pop = new BubbleWidget(this);
-  pop->set_window_style(WS_POPUP);
   pop->Init(frame_native_view_, bounds_);
   pop->SetContentsView(view_);

@@ -81,7 +82,7 @@

 void BrowserBubble::MovePopup(int x, int y, int w, int h) {
   views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_);
-  pop->MoveWindow(x, y, w, h);
+  pop->SetBounds(gfx::Rect(x, y, w, h));
 }

 void BrowserBubble::Show(bool activate) {


WIP: add [RS274NGC]RESUME_STARTUP_CODE for startup motions while RESUME

--- src/emc/task/emctaskmain.cc
+++ src/emc/task/emctaskmain.cc
@@ -125,6 +125,9 @@

 // delay counter
 static double taskExecDelayTimeout = 0.0;
+
+static char resume_startup_code[LINELEN];
+static bool resume_startup_en;

 // emcTaskIssueCommand issues command immediately
 static int emcTaskIssueCommand(NMLmsg * cmd);
@@ -676,10 +679,32 @@
 				    }
 	                            assert(interp_list.len() == 0);

-				    history_queue.move_tail();
+	                            /**
+                                     * if inserted [RS247NGC]RESUME_STARTUP_CODE is given, execute it here
+                                     */
+	                            if ((strlen(resume_startup_code) > 0) && (resume_startup_en == true)) {
+	                                double x, y, z, a, b, c, u, v, w;
+//	                                rcs_print ("%s (%s:%d) resume_startup_code(%s)\n", __FILE__, __FUNCTION__, __LINE__,
+//	                                        resume_startup_code);
+                                        /**
+                                         * Only support non-motion G/M code for RESUME_STARTUP_CODE
+                                         */
+                                        emcTaskPlanGetCurPos(&x, &y, &z, &a, &b, &c, &u, &v, &w);        //!< save Interpreter's internal positions
+	                                emcTaskPlanSynch();
+	                                emcTaskPlanExecute(resume_startup_code, toplevel_line_number);
+//                                        rcs_print ("%s (%s:%d) back to xy(%f, %f)\n", __FILE__, __FUNCTION__, __LINE__,
+//                                                x, y);
+	                                emcTaskPlanSetCurPos(&x, &y, NULL, NULL, NULL, NULL, NULL, NULL, NULL);     //!< restore Interpreter's internal positions from saved ones
+                                        resume_startup_en = false;
+
+	                            }
+
+                                    history_queue.move_tail();
                                     // reset programStartLine so we don't fall into our stepping routines
                                     // if we happen to execute lines before the current point later (due to subroutines).
                                     programStartLine = 0;
+
+
                                 } else {
                                     if (emcStatus->motion.traj.next_tp_reversed == TP_REVERSE) {
                                         /**
@@ -2420,7 +2445,7 @@

                 }
                 emcTaskCommand = 0;     //!< cleanup emcTaskCommand
-
+                resume_startup_en = true;
             }
             assert(emcTaskCommand == NULL);
         }
@@ -3372,6 +3397,15 @@
 	// not found, use default
 	}
     }
+
+    if (NULL != (inistring = inifile.Find("RESUME_STARTUP_CODE", "RS274NGC"))) {
+        assert(strlen(inistring) < LINELEN);
+        strcpy(resume_startup_code, inistring);
+    } else {
+        strcpy(resume_startup_code, "\0");
+    }
+    resume_startup_en = false;
+
     saveDouble = emc_task_cycle_time;
     EMC_TASK_CYCLE_TIME_ORIG = emc_task_cycle_time;
     emcTaskNoDelay = 0;


Fix random reset

Fix random reset

--- src/coverage_market.hh
+++ src/coverage_market.hh
@@ -643,6 +643,11 @@

     Random* r;
     int random_pos;
+
+    virtual void reset() {
+      unit_manyleaf::reset();
+      random_pos=-1;
+    }

     virtual void execute(const std::vector<int>& prev,int action,const std::vector<int>& next) {
       if (unit::value.first==unit::value.second) {


Use a computed mask to mask out the fetch address and not a hard coded one.

--- src/cpu/simple/base.cc
+++ src/cpu/simple/base.cc
@@ -335,7 +335,11 @@
             thread->readNextPC());
 #endif

-    req->setVirt(0, thread->readPC() & ~3, sizeof(MachInst), 0,
+    // This will generate a mask which aligns the pc on MachInst size
+    // boundaries. It won't work for non-power-of-two sized MachInsts, but
+    // it will work better than a hard coded mask.
+    const Addr PCMask = ~(sizeof(MachInst) - 1);
+    req->setVirt(0, thread->readPC() & PCMask, sizeof(MachInst), 0,
             thread->readPC());

     Fault fault = thread->translateInstReq(req);


The vdbPrimsToRemove in MergeOp is shared across threads,
so calling push_back resulted in race conditions and the prims
occasionally not being deleted or the std::dequeue becoming
corrupt and crashing.

Made the simplest change of just switching to a UT_ConcurrentVector
that wraps the tbb structure.

A more correct change would be to return vdbPrimsToRemove like we
do the outputgrids so we could explicitly gather them without locking,
this would also avoid this unseen action at distance.

Signed-off-by: jlait <81974a1ed0c0d66870f9fb02ff829ce3f8e53fdd@andorra.sidefx.com>

--- openvdb_houdini/openvdb_houdini/SOP_OpenVDB_Merge.cc
+++ openvdb_houdini/openvdb_houdini/SOP_OpenVDB_Merge.cc
@@ -20,6 +20,7 @@

 #include <UT/UT_Interrupt.h>
 #include <UT/UT_Version.h>
+#include <UT/UT_ConcurrentVector.h>
 #include <stdexcept>
 #include <string>
 #include <vector>
@@ -297,7 +298,7 @@
     StringRemapType opRemap;
     std::deque<GU_PrimVDB*> vdbPrims;
     std::deque<const GU_PrimVDB*> constVdbPrims;
-    std::deque<GU_PrimVDB*> vdbPrimsToRemove;
+    UT_ConcurrentVector<GU_PrimVDB *> vdbPrimsToRemove;
     PrimitiveNumberMap primNumbers;

     explicit MergeOp(openvdb::util::NullInterrupter& _interrupt): self(nullptr), interrupt(_interrupt) { }


Don't set a tag for the command to get media codecs because tags are only for the intermediate layer and that command is internal

--- src/commands.cpp
+++ src/commands.cpp
@@ -5570,7 +5570,8 @@
 {
     cmd("mc");

-    tag = c->reqtag;
+    // This command is for internal usage only
+    tag = 0;

     client = c;
     callback = cb;


Fix warning.

Fix warning.

--- map/compass_filter.cpp
+++ map/compass_filter.cpp
@@ -24,7 +24,6 @@
 void CompassFilter::OnCompassUpdate(location::CompassInfo const & info)
 {
   double const newHeadingRad = ((info.m_trueHeading >= 0.0) ? info.m_trueHeading : info.m_magneticHeading);
-  double const newHeadingDelta = fabs(newHeadingRad - m_headingRad);

 #ifdef OMIM_OS_IPHONE

@@ -33,6 +32,9 @@
   m_headingRad = newHeadingRad;

 #else
+
+  double const newHeadingDelta = fabs(newHeadingRad - m_headingRad);
+
   // if new heading lies outside the twice treshold radius we immediately accept it
   if (newHeadingDelta > 2.0 * m_smoothingThreshold)
   {


Hide invalid datalist suggestions

Hide invalid datalist suggestions

BUG=126620
TEST=

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

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

--- chrome/renderer/autofill/autofill_agent.cc
+++ chrome/renderer/autofill/autofill_agent.cc
@@ -61,7 +61,8 @@

   for (WebOptionElement option = options.firstItem().to<WebOptionElement>();
       !option.isNull(); option = options.nextItem().to<WebOptionElement>()) {
-    if (!StartsWith(option.value(), element.value(), false))
+    if (!StartsWith(option.value(), element.value(), false) ||
+        !element.isValidValue(option.value()))
       continue;

     values->push_back(option.value());


Autofill crasher Chrome:+Crash+Report+-+Stack+Signature:+WebCore::Node::renderBoxModelObject()

Attempt at fix for new crasher specific to 11.0.680.0.  The Autofill code on the
renderer side has not changed in a couple weeks.  Upon inspection of
WebCore::Node::renderBoxModelObject() it would seem that the |this| pointer is
NULL.  This change adds an isNull() check on the node in question, but this
doesn't address the source of the issue.  Will follow-up with QE to bisect and
isolate if possible.

BUG=73895
TEST=observe crash reports on canary

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

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

--- chrome/renderer/autofill/autofill_agent.cc
+++ chrome/renderer/autofill/autofill_agent.cc
@@ -258,7 +258,8 @@
   }

   // Send to WebKit for display.
-  if (!v.empty() && autofill_query_node_.hasNonEmptyBoundingBox()) {
+  if (!v.empty() && !autofill_query_node_.isNull() &&
+      autofill_query_node_.hasNonEmptyBoundingBox()) {
     web_view->applyAutoFillSuggestions(
         autofill_query_node_, v, l, i, ids, separator_index);
   }


Fix Mac buildbreak

Fix Mac buildbreak

TBR=estade
Review URL: http://codereview.chromium.org/2047013

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

--- chrome/renderer/pepper_scrollbar_widget.cc
+++ chrome/renderer/pepper_scrollbar_widget.cc
@@ -265,6 +265,9 @@
           granularity, multiplier);
       break;
     }
+    default:
+      NOTREACHED();
+      break;
   }
 }


Fix MSVC error about parenthesized explicit type conversion

--- Alc/alu.cpp
+++ Alc/alu.cpp
@@ -601,7 +601,7 @@

             ALfloat coeffs[MAX_AMBI_CHANNELS];
             if(Device->mRenderMode != StereoPair)
-                CalcDirectionCoeffs((float[3]){xpos, ypos, zpos}, Spread, coeffs);
+                CalcDirectionCoeffs({xpos, ypos, zpos}, Spread, coeffs);
             else
             {
                 /* Clamp Y, in case rounding errors caused it to end up outside
@@ -834,7 +834,7 @@
              */
             ALfloat coeffs[MAX_AMBI_CHANNELS];
             if(Device->mRenderMode != StereoPair)
-                CalcDirectionCoeffs((float[3]){xpos, ypos, zpos}, Spread, coeffs);
+                CalcDirectionCoeffs({xpos, ypos, zpos}, Spread, coeffs);
             else
             {
                 const ALfloat ev{std::asin(clampf(ypos, -1.0f, 1.0f))};


Construct a WebString explicitly and pass to a WebKit method.
This is to prevent build errors when https://bugs.webkit.org/show_bug.cgi?id=48068 lands.

BUG=none
TEST=none

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

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

--- chrome/renderer/speech_input_dispatcher.cc
+++ chrome/renderer/speech_input_dispatcher.cc
@@ -68,7 +68,8 @@
 void SpeechInputDispatcher::OnSpeechRecognitionResult(
     int request_id, const string16& result) {
   VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult enter";
-  listener_->setRecognitionResult(request_id, result);
+  WebKit::WebString webkit_result(result);
+  listener_->setRecognitionResult(request_id, webkit_result);
   VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult exit";
 }


ENG-4536 Fixed missing EOL at EOF.

ENG-4536 Fixed missing EOL at EOF.

--- src/ee/storage/ElasticScanner.cpp
+++ src/ee/storage/ElasticScanner.cpp
@@ -134,4 +134,4 @@
 }

 } // namespace elastic
-} // namespace voltdb+} // namespace voltdb


Improve grid computes

Improve grid computes

--- src/engine/universe/room.cc
+++ src/engine/universe/room.cc
@@ -134,15 +134,11 @@
 {
     std::vector<std::unique_ptr<Model3D>> ret;

-    cilk_for (auto i = 0; i < kGRID_Y; i++) {
-        cilk_for (auto j = 0; j < kGRID_X; j++) {
-            cilk_for (auto k = 0; k < kGRID_Z; k++) {
-                grid_[i][j][k].clear();
-            }
-        }
-    }
-
     for (auto o = 0; o < objects_.size();) {
+        if (!objects_[o]->IsMoved() && objects_[o]->get_placements().size() > 0) {
+            ++o;
+            continue;
+        }
         /* check grid collision */
         engine::geometry::Box border = objects_[o]->border();
         std::vector<glm::vec3> coords = border.ComputeCoords();
@@ -153,8 +149,19 @@
         auto w1 = coords.at(1)[0] - x1;
         auto d1 = coords.at(4)[2] - z1;

+        for (auto &p : objects_[o]->get_placements()) {
+            tbb::mutex::scoped_lock lock(grid_mutex_);
+
+            auto pi = p[0];
+            auto pj = p[1];
+            auto pk = p[2];
+
+            auto it = std::find(grid_[pi][pj][pk].begin(), grid_[pi][pj][pk].end(), objects_[o].get());
+            if(it != grid_[pi][pj][pk].end())
+                grid_[pi][pj][pk].erase(it);
+        }
+
         objects_[o]->clear_placements();
-
         auto grid_0 = location_ - glm::vec4(kGRID_X*kGRID_UNIT/2, kGRID_Y*kGRID_UNIT/2, kGRID_Z*kGRID_UNIT/2, 0.0f);

         cilk_for (auto i = 0; i < kGRID_Y; i++) {
@@ -187,7 +194,6 @@
             o++;
         }
     }
-

     return ret;
 }
@@ -263,10 +269,10 @@
     auto k = t;
     auto cnt = 0;
     /* Generate and place randomly object into room grid */
-    while (cnt++ < kGRID_Y * kGRID_X * kGRID_Z) {
-        auto l = r % kGRID_Y;
-        auto m = s % kGRID_X;
-        auto n = t % kGRID_Z;
+    while (cnt++ < (kGRID_Y-1) * (kGRID_X-1) * (kGRID_Z-1)) {
+        auto l = r % (kGRID_Y-1);
+        auto m = s % (kGRID_X-1);
+        auto n = t % (kGRID_Z-1);

         auto y2 = grid_0[1] + l * kGRID_UNIT + kGRID_UNIT/2;
         auto x2 = grid_0[0] + m * kGRID_UNIT + kGRID_UNIT/2;
@@ -279,7 +285,6 @@
             obj->add_placement(l, m, n);

             /* Lock room for ensure only one change at same time on grid_ array */
-            //room_mutex_.lock();
             grid_[l][m][n].push_back(obj);
             --nbobjects_;
             grid_mutex_.unlock();


Implement checkModelMethodForThrow <TwoArgsMethod>

--- src/test/model.cpp
+++ src/test/model.cpp
@@ -48,6 +48,19 @@
     Abstract::Point coordinates(arg1, arg2);
     BOOST_REQUIRE_THROW(
         ((*model).*model_method)(coordinates), Exception
+    );
+}
+
+template<>
+void checkModelMethodForThrow<TwoArgsMethod>(
+    Implementation::Model* model,
+    TwoArgsMethod model_method,
+    int arg1,
+    int arg2
+) {
+    Abstract::Point coordinates(arg1, arg2);
+    BOOST_REQUIRE_THROW(
+        ((*model).*model_method)(coordinates, 0), Exception
     );
 }


ActivityIndicator: don't show spinner initially

--- src/customcontrols.cpp
+++ src/customcontrols.cpp
@@ -362,6 +362,7 @@
     SetSizer(sizer);

     m_spinner = new wxActivityIndicator(this, wxID_ANY);
+    m_spinner->Hide();
     m_spinner->SetWindowVariant(wxWINDOW_VARIANT_SMALL);
     m_label = new wxStaticText(this, wxID_ANY, "");
 #ifdef __WXOSX__


colored paper

colored paper

--- AmsFont.cpp
+++ AmsFont.cpp
@@ -48,6 +48,7 @@
 		// clear character background
 		_clearPos.x = destX;
 		_clearPos.y = destY;
+		SDL_FillRect(_clearRect, NULL, SDL_MapRGB(ctx->getContext()->format, 255, 5, 5));
 		SDL_BlitSurface(_clearRect, NULL, ctx->getContext(), &_clearPos);
 		ctx->drawImage(font, sourceX, sourceY, CHAR_SIZE, CHAR_SIZE, destX, destY);


remove unecessary code from resolveSourceSites and resolveTargetSites

--- src/compiler.cpp
+++ src/compiler.cpp
@@ -5294,10 +5294,6 @@

       Site* s = pickSourceSite
         (c, r, 0, 0, &mask, true, false, true, acceptForResolve);
-      if (s == 0) {
-        s = pickSourceSite
-          (c, r, 0, 0, &mask, false, false, true, acceptForResolve);
-      }

       if (s) {
         if (DebugControl) {
@@ -5332,12 +5328,9 @@

       Site* s = pickSourceSite
         (c, r, 0, 0, &mask, true, true, true, acceptForResolve);
+
       if (s == 0) {
-        s = pickSourceSite
-          (c, r, 0, 0, &mask, false, true, true, acceptForResolve);
-        if (s == 0) {
-          s = maybeMove(c, v, mask, false, true, ResolveRegisterReserveCount);
-        }
+        s = maybeMove(c, v, mask, false, true, ResolveRegisterReserveCount);
       }

       freeze(c, frozen, s, v);


PDN: Fix Pipe claimChildren to only grab sketches

--- src/Mod/PartDesign/Gui/ViewProviderPipe.cpp
+++ src/Mod/PartDesign/Gui/ViewProviderPipe.cpp
@@ -64,11 +64,11 @@
         temp.push_back(sketch);

     App::DocumentObject* spine = pcPipe->Spine.getValue();
-    if (spine != NULL)
+    if (spine != NULL && spine->isDerivedFrom(Part::Part2DObject::getClassTypeId()))
         temp.push_back(spine);

     App::DocumentObject* auxspine = pcPipe->AuxillerySpine.getValue();
-    if (auxspine != NULL)
+    if (auxspine != NULL && auxspine->isDerivedFrom(Part::Part2DObject::getClassTypeId()))
         temp.push_back(auxspine);

     return temp;


turn off debug logging

turn off debug logging

--- src/compiler.cpp
+++ src/compiler.cpp
@@ -15,14 +15,14 @@

 namespace {

-const bool DebugAppend = true;
-const bool DebugCompile = true;
-const bool DebugResources = true;
-const bool DebugFrame = true;
-const bool DebugControl = true;
-const bool DebugReads = true;
+const bool DebugAppend = false;
+const bool DebugCompile = false;
+const bool DebugResources = false;
+const bool DebugFrame = false;
+const bool DebugControl = false;
+const bool DebugReads = false;
 const bool DebugSites = false;
-const bool DebugMoves = true;
+const bool DebugMoves = false;
 const bool DebugBuddies = false;

 const int AnyFrameIndex = -2;
@@ -2798,7 +2798,6 @@

       if (live(result)) {
         addSite(c, result, low);
-        fprintf(stderr, "result %p high %p\n", result, result->high);
         if (resultSize > BytesPerWord and live(result->high)) {
           addSite(c, result->high, high);
         }


tr_shader: workaround relief not applied on alpha mask by disabling relief, ref #334

--- src/engine/renderer/tr_shader.cpp
+++ src/engine/renderer/tr_shader.cpp
@@ -4843,6 +4843,16 @@
 		stage->enableSpecularMapping = r_specularMapping->integer && stage->hasMaterialMap && !stage->isMaterialPhysical;
 		stage->enableGlowMapping = r_glowMapping->integer && stage->hasGlowMap;

+		// FIXME: Workaround for textures having both an alpha mask (like gratings) with an height map,
+		// The engine does not displace the depth test map yet so we disable relief mapping to prevent garbage
+		// to appears between the displaced diffuse map and the non-displaced alpha mask.
+		// See https://github.com/DaemonEngine/Daemon/issues/334
+		if ( stage->enableReliefMapping && stage->stateBits & ~GLS_DEPTHMASK_TRUE )
+		{
+			Log::Debug( "Workaround: disabling relief mapping for stage %d in shader '%s' because of alpha mask", s, shader.name );
+			stage->enableReliefMapping = false;
+		}
+
 		// Finally disable useless heightMapInNormalMap if both normal and relief mapping are disabled.
 		// see https://github.com/DaemonEngine/Daemon/issues/376
 		stage->isHeightMapInNormalMap = stage->isHeightMapInNormalMap && ( stage->enableNormalMapping || stage->enableReliefMapping );


Fix for issue #5.

Fix for issue #5.

--- src/NTriplesWriter.cc
+++ src/NTriplesWriter.cc
@@ -31,8 +31,12 @@

 			std::unique_ptr<BlankNode> nestedList;
 			if (const RDFList *rl = dynamic_cast<const RDFList *>(node)) {
-				nestedList = triples(*rl);
-				node = nestedList.get();
+				if (rl->empty()) {
+					node = &RDF::nil;
+				} else {
+					nestedList = triples(*rl);
+					node = nestedList.get();
+				}
 			}

 			rawTriple(*head, RDF::first, *node);


fixed ntohl missing

fixed ntohl missing

--- src/Net/nuiSocket.cpp
+++ src/Net/nuiSocket.cpp
@@ -62,7 +62,7 @@
   if (res != 0)
     return false;

-  nuiNetworkHost h(addr.sin_addr.s_addr, addr.sin_port, rHost.mProtocol);
+  nuiNetworkHost h(ntohl(addr.sin_addr.s_addr), addr.sin_port, rHost.mProtocol);
   rHost = h;
   return true;
 }


fixing bug exporting rgrids to vtk.

fixing bug exporting rgrids to vtk.

--- src/exporters/eavlVTKExporter.cpp
+++ src/exporters/eavlVTKExporter.cpp
@@ -122,8 +122,8 @@
     for (int i = 0; i < npts; i++)
     {
         out<<(float)data->GetPoint(i, 0)<<" ";
-        out<<(dim >=2 ? (float)data->GetPoint(i, 1) : 0.0)<<" ";
-        out<<(dim >=3 ? (float)data->GetPoint(i, 2) : 0.0)<<endl;
+        out<<(float)data->GetPoint(i, 1)<<" ";
+        out<<(float)data->GetPoint(i, 2)<<endl;
     }
 }


computeDimKind fixed.

computeDimKind fixed.

--- inc/result_benchmark.hpp
+++ inc/result_benchmark.hpp
@@ -37,7 +37,7 @@
     /**
      * @retval 1 arbitrary extents
      * @retval 2 power-of-two extents
-     * @retval 3 last dim: combination of powers of (3,5,7) {3^r * 5^s * 7^t}
+     * @retval 3 combination of powers of (3,5,7) {3^r * 5^s * 7^t}
      */
     size_t computeDimkind() {
       bool p2=true;
@@ -45,19 +45,19 @@
         p2 &= powerOf(extents_[k], 2.0);
       if(p2)
         return 2;
-      unsigned e = extents_[dim_-1];
-      unsigned sqr = static_cast<unsigned>(sqrt(e));
-      for( unsigned k=2; k<=sqr; k+=1 ) {
-        while( e%k == 0 ) {
-          e /= k;
+      for(unsigned k=0; k<dim_; ++k) {
+        unsigned e = extents_[k];
+        unsigned sqr = static_cast<unsigned>(sqrt(e));
+        for( unsigned k=2; k<=sqr; k+=1 ) {
+          while( e%k == 0 ) {
+            e /= k;
+          }
         }
+        if(e>7)
+          return 1;
       }
-      if(e>7)
-        return 1;
-      else
-        return 3;
+      return 3;
     }
-
     /* setters */

     void setRun(int run) {


unicode env errors.

unicode env errors.

--- inc/simple-win32/res.cpp
+++ inc/simple-win32/res.cpp
@@ -56,7 +56,7 @@
     WORD i(0);

     //打开图标文件
-    hIconFile = CreateFile(lpIconFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+    hIconFile = CreateFileA(lpIconFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if (hIconFile == INVALID_HANDLE_VALUE) {
         return	false;
     }
@@ -99,10 +99,10 @@
         pGrpIconDir->idEntries[i].nID=i+1; //id == 0 是 RT_GROUP_ICON 的id，我这里替换的时候出现问题，所以就 + 1 了。
     }
     //开始更新EXE中的图标资源，ID定为最小０，如果原来存在０ID的图标信息则被替换为新的。
-    hUpdate = BeginUpdateResource(lpExeName, false);
+    hUpdate = BeginUpdateResourceA(lpExeName, false);
     if (hUpdate!=NULL) {
         //首先更新RT_GROUP_ICON信息
-        ret = UpdateResource(hUpdate, RT_GROUP_ICON, sResID, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), (LPVOID)pGrpIconDir, nGSize);
+        ret = UpdateResourceA(hUpdate, (LPSTR)RT_GROUP_ICON, sResID, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), (LPVOID)pGrpIconDir, nGSize);
         if (!ret) {
             delete[] pIconDirEntry;
             delete[] pGrpIconDir;
@@ -158,7 +158,7 @@
     string_ansi_to_utf16(pszText,	wText);

     int SourceId	= nResID;
-    HINSTANCE hInst = ::LoadLibrary(pszApp);
+    HINSTANCE hInst = ::LoadLibraryA(pszApp);
     if(hInst == NULL) return false;

     std::vector<WCHAR> vStrTable;  // 资源数据
@@ -173,7 +173,7 @@
     }
     ::FreeLibrary(hInst);

-    HANDLE hUpdateRes=BeginUpdateResource(pszApp,false);
+    HANDLE hUpdateRes=BeginUpdateResourceA(pszApp,false);
     if(hUpdateRes == NULL) return false;  // 不能更新,浪费表情

     int nIndex = (SourceId-1)%16; // 字符串表中的位置


Add missing doxygen brief descriptions

Add missing doxygen brief descriptions

--- include/AnnAudioFile.hpp
+++ include/AnnAudioFile.hpp
@@ -10,6 +10,7 @@

 namespace Annwvyn
 {
+	///Ogre resource that contain the data from a binary file for the audio engine importing
 	class AnnDllExport AnnAudioFile : public Ogre::Resource
 	{
 		///Where the data is actually stored, as bytes.
@@ -80,6 +81,7 @@

 	using AnnAudioFilePtr = Ogre::SharedPtr<AnnAudioFile>;

+	///Audio file ResourceManager
 	class AnnAudioFileManager : public Ogre::ResourceManager, public Ogre::Singleton<AnnAudioFileManager>
 	{
 	protected:


Finished BaseResource Header

Finished BaseResource Header

Please feel free to amend should you feel that it needs it


Simplifying another expression.

Simplifying another expression.

--- include/Dedispersion.hpp
+++ include/Dedispersion.hpp
@@ -97,7 +97,7 @@
       "}";
     unrolled_sTemplate = "minShift = shifts[((get_group_id(1) * " + nrTotalDMsPerBlock_s + ") * " + nrPaddedChannels_s + ") + channel + <%UNROLL%>];\n"
       "<%SHIFTS%>"
-      "maxShift = shifts[(((get_group_id(1) * " + nrTotalDMsPerBlock_s + ") + " + nrTotalDMsPerBlock_s + " - 1) * " + nrPaddedChannels_s + ") + channel + <%UNROLL%>];\n"
+      "maxShift = shifts[(((get_group_id(1) * " + nrTotalDMsPerBlock_s + ") + " + isa::utils::toString((nrDMsPerBlock * nrDMsPerThread) - 1) + ") * " + nrPaddedChannels_s + ") + channel + <%UNROLL%>];\n"
       "\n"
       "inShMem = (get_local_id(1) * " + isa::utils::toString(nrSamplesPerBlock) + ") + get_local_id(0);\n"
       "inGlMem = ((get_group_id(0) * " + nrTotalSamplesPerBlock_s + ") + inShMem) + minShift;\n"


Typo.

Typo.

--- include/Dedispersion.hpp
+++ include/Dedispersion.hpp
@@ -24,7 +24,7 @@

 namespace PulsarSearch {

-public DedispersionConf {
+class DedispersionConf {
 public:
   DedispersionConf();
   ~DedispersionConf();