Handle a little bug with empty files.

Handle a little bug with empty files.

When giving a length of 0 to mmap(2) we get an EINVAL so the exception
thrown was not accurate.

--- src/utils/mapped_file.cpp
+++ src/utils/mapped_file.cpp
@@ -1,5 +1,6 @@
 #include "mapped_file.h"

+#include <exception/elf.h>
 #include <exception/os.h>

 #include <fcntl.h>
@@ -26,6 +27,9 @@
   if (fstat(fd, &buf) == -1)
     throw sasm::exception::os("fstat");

+  if (buf.st_size == 0)
+    throw sasm::exception::elf(_path.c_str(), "invalid ELF file");
+
   if ((begin = (char*) mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
     throw sasm::exception::os("mmap");

<|original_code|>
#include "mapped_file.h"

#include <exception/os.h>

#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>

namespace sasm { namespace utils {

mapped_file::~mapped_file()
{
  if (_is_mapped)
    unmap();
}

void mapped_file::map()
{
  int fd;
  struct stat buf;
  char* begin;

  if ((fd = open(get_path(), O_RDONLY)) == -1)
    throw sasm::exception::os("open", get_path());

  if (fstat(fd, &buf) == -1)
    throw sasm::exception::os("fstat");

  if ((begin = (char*) mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
    throw sasm::exception::os("mmap");

  close(fd);

  _is_mapped = true;
  _begin = begin;
  _size = buf.st_size;
}

void mapped_file::unmap()
{
  if (munmap((void*) _begin, _size) == -1)
    throw sasm::exception::os("munmap");

  _is_mapped = false;
}

const char* mapped_file::get_path() const
{
  return _path.c_str();
}

}}

<|edits_diff|>
--- src/utils/mapped_file.cpp
+++ src/utils/mapped_file.cpp
@@ -1,5 +1,6 @@
 #include "mapped_file.h"

+#include <exception/elf.h>
 #include <exception/os.h>

 #include <fcntl.h>
<|current_version|>
#include "mapped_file.h"

#include <exception/elf.h>
#include <exception/os.h>

#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>

namespace sasm { namespace utils {

mapped_file::~mapped_file()
{
  if (_is_mapped)
    unmap();
}

void mapped_file::map()
{
  int fd;
  struct stat buf;
  char* begin;

  if ((fd = open(get_path(), O_RDONLY)) == -1)
    throw sasm::exception::os("open", get_path());

  if (fstat(fd, &buf) == -1)
    throw sasm::exception::os("fstat");

  if ((begin = (char*) mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
    throw sasm::exception::os("mmap");

  close(fd);

  _is_mapped = true;
  _begin = begin;
  _size = buf.st_size;
}

void mapped_file::unmap()
{
  if (munmap((void*) _begin, _size) == -1)
    throw sasm::exception::os("munmap");

  _is_mapped = false;
}

const char* mapped_file::get_path() const
{
  return _path.c_str();
}

}}

<|next_version|>
#include "mapped_file.h"

#include <exception/elf.h>
#include <exception/os.h>

#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>

namespace sasm { namespace utils {

mapped_file::~mapped_file()
{
  if (_is_mapped)
    unmap();
}

void mapped_file::map()
{
  int fd;
  struct stat buf;
  char* begin;

  if ((fd = open(get_path(), O_RDONLY)) == -1)
    throw sasm::exception::os("open", get_path());

  if (fstat(fd, &buf) == -1)
    throw sasm::exception::os("fstat");

  if (buf.st_size == 0)
    throw sasm::exception::elf(_path.c_str(), "invalid ELF file");

  if ((begin = (char*) mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
    throw sasm::exception::os("mmap");

  close(fd);

  _is_mapped = true;
  _begin = begin;
  _size = buf.st_size;
}

void mapped_file::unmap()
{
  if (munmap((void*) _begin, _size) == -1)
    throw sasm::exception::os("munmap");

  _is_mapped = false;
}

const char* mapped_file::get_path() const
{
  return _path.c_str();
}

}}


Add more iterator concept ordering tests.

--- test/iterator_concepts_ordering.cpp
+++ test/iterator_concepts_ordering.cpp
@@ -15,6 +15,10 @@
                     duck::IncrementableIterator,
                     duck::RandomAccessIterator>));

+BOOST_MPL_ASSERT((duck::is_more_specific_than<
+                    duck::ForwardIterator,
+                    duck::RandomAccessIterator>));
+

 BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                         duck::RandomAccessIterator,
@@ -27,3 +31,7 @@
 BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                         duck::ForwardIterator,
                         duck::ForwardIterator>));
+
+BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
+                        duck::RandomAccessIterator,
+                        duck::ForwardIterator>));

<|original_code|>
/**
 * Test suite for the iterator_concepts_ordering.hpp header.
 */

#include <duck/detail/iterator_concepts_ordering.hpp>

#include <boost/mpl/assert.hpp>

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::BidirectionalIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::IncrementableIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::BidirectionalIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::IncrementableIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::ForwardIterator,
                        duck::ForwardIterator>));

<|edits_diff|>
--- test/iterator_concepts_ordering.cpp
+++ test/iterator_concepts_ordering.cpp
@@ -15,6 +15,10 @@
                     duck::IncrementableIterator,
                     duck::RandomAccessIterator>));

+BOOST_MPL_ASSERT((duck::is_more_specific_than<
+                    duck::ForwardIterator,
+                    duck::RandomAccessIterator>));
+

 BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                         duck::RandomAccessIterator,
<|current_version|>
/**
 * Test suite for the iterator_concepts_ordering.hpp header.
 */

#include <duck/detail/iterator_concepts_ordering.hpp>

#include <boost/mpl/assert.hpp>

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::BidirectionalIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::IncrementableIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::ForwardIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::BidirectionalIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::IncrementableIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::ForwardIterator,
                        duck::ForwardIterator>));

<|next_version|>
/**
 * Test suite for the iterator_concepts_ordering.hpp header.
 */

#include <duck/detail/iterator_concepts_ordering.hpp>

#include <boost/mpl/assert.hpp>

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::BidirectionalIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::IncrementableIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT((duck::is_more_specific_than<
                    duck::ForwardIterator,
                    duck::RandomAccessIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::BidirectionalIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::IncrementableIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::ForwardIterator,
                        duck::ForwardIterator>));

BOOST_MPL_ASSERT_NOT((duck::is_more_specific_than<
                        duck::RandomAccessIterator,
                        duck::ForwardIterator>));


Set org name and app name

Set org name and app name

--- main.cpp
+++ main.cpp
@@ -1,8 +1,14 @@
 #include <QApplication>
 #include "mainwindow.h"

+const QString APP_ORGNAME = "PepperNote";
+const QString APP_APPNAME = "PepperNote";
+
 int main(int argc, char *argv[])
 {
+    QCoreApplication::setOrganizationName(APP_ORGNAME);
+    QCoreApplication::setApplicationName(APP_APPNAME);
+
     QApplication a(argc, argv);
     MainWindow w;
     w.show();

<|original_code|>
#include <QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

<|edits_diff|>
--- main.cpp
+++ main.cpp
@@ -1,5 +1,8 @@
 #include <QApplication>
 #include "mainwindow.h"
+
+const QString APP_ORGNAME = "PepperNote";
+const QString APP_APPNAME = "PepperNote";

 int main(int argc, char *argv[])
 {
<|current_version|>
#include <QApplication>
#include "mainwindow.h"

const QString APP_ORGNAME = "PepperNote";
const QString APP_APPNAME = "PepperNote";

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

<|next_version|>
#include <QApplication>
#include "mainwindow.h"

const QString APP_ORGNAME = "PepperNote";
const QString APP_APPNAME = "PepperNote";

int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName(APP_ORGNAME);
    QCoreApplication::setApplicationName(APP_APPNAME);

    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}


Fix wrong animation of boss arm

Fix wrong animation of boss arm

Signed-off-by: Matheus Miranda <6faf3a473c1bf7863f2eb74400dd6142ec07131e@gmail.com>

--- engine/src/level.cpp
+++ engine/src/level.cpp
@@ -1,4 +1,5 @@
 #include "level.hpp"
+#include <iostream>

 using namespace engine;

@@ -23,6 +24,10 @@
 void Level::draw(){
   for(auto game_object : objects){
     if(game_object->is_active()){
+      if(game_object->name == "arm_left"){
+        game_object->set_actual_animation(game_object->animations["left_arm"]);
+      }
+
       game_object->draw();
     }
   }

<|original_code|>
#include "level.hpp"

using namespace engine;

void Level::load(){
  for(auto game_object : objects){
    std::cout << "Loading " << game_object->name << std::endl;
    game_object->load();
    for(auto hit : game_object->get_hitboxes()){
      hit->initialize();
    }
  }
}

void Level::free(){
  for(auto game_object : objects){
    std::cout << "Freeing" << game_object->name << std::endl;
    game_object->free();
  }
  EventHandler::listeners.clear();
}

void Level::draw(){
  for(auto game_object : objects){
    if(game_object->is_active()){
      game_object->draw();
    }
  }
}

<|edits_diff|>
--- engine/src/level.cpp
+++ engine/src/level.cpp
@@ -1,4 +1,5 @@
 #include "level.hpp"
+#include <iostream>

 using namespace engine;

<|current_version|>
#include "level.hpp"
#include <iostream>

using namespace engine;

void Level::load(){
  for(auto game_object : objects){
    std::cout << "Loading " << game_object->name << std::endl;
    game_object->load();
    for(auto hit : game_object->get_hitboxes()){
      hit->initialize();
    }
  }
}

void Level::free(){
  for(auto game_object : objects){
    std::cout << "Freeing" << game_object->name << std::endl;
    game_object->free();
  }
  EventHandler::listeners.clear();
}

void Level::draw(){
  for(auto game_object : objects){
    if(game_object->is_active()){
      game_object->draw();
    }
  }
}

<|next_version|>
#include "level.hpp"
#include <iostream>

using namespace engine;

void Level::load(){
  for(auto game_object : objects){
    std::cout << "Loading " << game_object->name << std::endl;
    game_object->load();
    for(auto hit : game_object->get_hitboxes()){
      hit->initialize();
    }
  }
}

void Level::free(){
  for(auto game_object : objects){
    std::cout << "Freeing" << game_object->name << std::endl;
    game_object->free();
  }
  EventHandler::listeners.clear();
}

void Level::draw(){
  for(auto game_object : objects){
    if(game_object->is_active()){
      if(game_object->name == "arm_left"){
        game_object->set_actual_animation(game_object->animations["left_arm"]);
      }

      game_object->draw();
    }
  }
}


Fix build with stub implementation

Fix build with stub implementation

--- stub/src/qtfirebase.cpp
+++ stub/src/qtfirebase.cpp
@@ -3,6 +3,7 @@
 #include "qtfirebaseadmob.h"
 #include "qtfirebaseauth.h"
 #include "qtfirebasedatabase.h"
+#include "qtfirebasemessaging.h"

 #ifdef QTFIREBASE_BUILD_ANALYTICS
 QtFirebaseAnalytics* QtFirebaseAnalytics::self = nullptr;
@@ -23,3 +24,7 @@
 #ifdef QTFIREBASE_BUILD_DATABASE
 QtFirebaseDatabase *QtFirebaseDatabase::self = nullptr;
 #endif
+
+#ifdef QTFIREBASE_BUILD_MESSAGING
+QtFirebaseMessaging *QtFirebaseMessaging::self = nullptr;
+#endif

<|original_code|>
#include "qtfirebaseanalytics.h"
#include "qtfirebaseremoteconfig.h"
#include "qtfirebaseadmob.h"
#include "qtfirebaseauth.h"
#include "qtfirebasedatabase.h"

#ifdef QTFIREBASE_BUILD_ANALYTICS
QtFirebaseAnalytics* QtFirebaseAnalytics::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_REMOTE_CONFIG
QtFirebaseRemoteConfig* QtFirebaseRemoteConfig::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_ADMOB
QtFirebaseAdMob *QtFirebaseAdMob::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_AUTH
QtFirebaseAuth *QtFirebaseAuth::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_DATABASE
QtFirebaseDatabase *QtFirebaseDatabase::self = nullptr;
#endif

<|edits_diff|>
--- stub/src/qtfirebase.cpp
+++ stub/src/qtfirebase.cpp
@@ -3,6 +3,7 @@
 #include "qtfirebaseadmob.h"
 #include "qtfirebaseauth.h"
 #include "qtfirebasedatabase.h"
+#include "qtfirebasemessaging.h"

 #ifdef QTFIREBASE_BUILD_ANALYTICS
 QtFirebaseAnalytics* QtFirebaseAnalytics::self = nullptr;
<|current_version|>
#include "qtfirebaseanalytics.h"
#include "qtfirebaseremoteconfig.h"
#include "qtfirebaseadmob.h"
#include "qtfirebaseauth.h"
#include "qtfirebasedatabase.h"
#include "qtfirebasemessaging.h"

#ifdef QTFIREBASE_BUILD_ANALYTICS
QtFirebaseAnalytics* QtFirebaseAnalytics::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_REMOTE_CONFIG
QtFirebaseRemoteConfig* QtFirebaseRemoteConfig::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_ADMOB
QtFirebaseAdMob *QtFirebaseAdMob::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_AUTH
QtFirebaseAuth *QtFirebaseAuth::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_DATABASE
QtFirebaseDatabase *QtFirebaseDatabase::self = nullptr;
#endif

<|next_version|>
#include "qtfirebaseanalytics.h"
#include "qtfirebaseremoteconfig.h"
#include "qtfirebaseadmob.h"
#include "qtfirebaseauth.h"
#include "qtfirebasedatabase.h"
#include "qtfirebasemessaging.h"

#ifdef QTFIREBASE_BUILD_ANALYTICS
QtFirebaseAnalytics* QtFirebaseAnalytics::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_REMOTE_CONFIG
QtFirebaseRemoteConfig* QtFirebaseRemoteConfig::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_ADMOB
QtFirebaseAdMob *QtFirebaseAdMob::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_AUTH
QtFirebaseAuth *QtFirebaseAuth::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_DATABASE
QtFirebaseDatabase *QtFirebaseDatabase::self = nullptr;
#endif

#ifdef QTFIREBASE_BUILD_MESSAGING
QtFirebaseMessaging *QtFirebaseMessaging::self = nullptr;
#endif


Increase the QImageReader allocation limit.

--- src/main.cpp
+++ src/main.cpp
@@ -6,9 +6,12 @@
 */

 #include "ImageViewerApplication.h"
+#include <QImageReader>

 int main(int argc, char **argv){
 	try{
+		//Set the limit to 1 GiB.
+		QImageReader::setAllocationLimit(1024);
 		initialize_supported_extensions();
 		ImageViewerApplication app(argc, argv, "BorderlessViewer" + get_per_user_unique_id());
 		return app.exec();

<|original_code|>
/*
Copyright (c), Helios
All rights reserved.

Distributed under a permissive license. See COPYING.txt for details.
*/

#include "ImageViewerApplication.h"

int main(int argc, char **argv){
	try{
		initialize_supported_extensions();
		ImageViewerApplication app(argc, argv, "BorderlessViewer" + get_per_user_unique_id());
		return app.exec();
	}catch (ApplicationAlreadyRunningException &){
		return 0;
	}catch (NoWindowsException &){
		return 0;
	}
}

<|edits_diff|>
--- src/main.cpp
+++ src/main.cpp
@@ -6,6 +6,7 @@
 */

 #include "ImageViewerApplication.h"
+#include <QImageReader>

 int main(int argc, char **argv){
 	try{
<|current_version|>
/*
Copyright (c), Helios
All rights reserved.

Distributed under a permissive license. See COPYING.txt for details.
*/

#include "ImageViewerApplication.h"
#include <QImageReader>

int main(int argc, char **argv){
	try{
		initialize_supported_extensions();
		ImageViewerApplication app(argc, argv, "BorderlessViewer" + get_per_user_unique_id());
		return app.exec();
	}catch (ApplicationAlreadyRunningException &){
		return 0;
	}catch (NoWindowsException &){
		return 0;
	}
}

<|next_version|>
/*
Copyright (c), Helios
All rights reserved.

Distributed under a permissive license. See COPYING.txt for details.
*/

#include "ImageViewerApplication.h"
#include <QImageReader>

int main(int argc, char **argv){
	try{
		//Set the limit to 1 GiB.
		QImageReader::setAllocationLimit(1024);
		initialize_supported_extensions();
		ImageViewerApplication app(argc, argv, "BorderlessViewer" + get_per_user_unique_id());
		return app.exec();
	}catch (ApplicationAlreadyRunningException &){
		return 0;
	}catch (NoWindowsException &){
		return 0;
	}
}


Add long types to names.

Add long types to names.

--- JasonType.cpp
+++ JasonType.cpp
@@ -15,7 +15,9 @@
     case JasonType::Double:      return "double";
     case JasonType::String:      return "string";
     case JasonType::Array:       return "array";
+    case JasonType::ArrayLong:   return "array_long";
     case JasonType::Object:      return "object";
+    case JasonType::ObjectLong:  return "object_long";
     case JasonType::External:    return "external";
     case JasonType::ID:          return "id";
     case JasonType::ArangoDB_id: return "arangodb_id";

<|original_code|>

#include "JasonType.h"

using JasonType = triagens::basics::JasonType;

////////////////////////////////////////////////////////////////////////////////
/// @brief get the name for a Jason type
////////////////////////////////////////////////////////////////////////////////

char const* triagens::basics::JasonTypeName (JasonType type) {
  switch (type) {
    case JasonType::None:        return "none";
    case JasonType::Null:        return "null";
    case JasonType::Bool:        return "bool";
    case JasonType::Double:      return "double";
    case JasonType::String:      return "string";
    case JasonType::Array:       return "array";
    case JasonType::Object:      return "object";
    case JasonType::External:    return "external";
    case JasonType::ID:          return "id";
    case JasonType::ArangoDB_id: return "arangodb_id";
    case JasonType::UTCDate:     return "utc-date";
    case JasonType::Int:         return "int";
    case JasonType::UInt:        return "uint";
    case JasonType::Binary:      return "binary";
  }

  return "unknown";
}

<|edits_diff|>
--- JasonType.cpp
+++ JasonType.cpp
@@ -15,6 +15,7 @@
     case JasonType::Double:      return "double";
     case JasonType::String:      return "string";
     case JasonType::Array:       return "array";
+    case JasonType::ArrayLong:   return "array_long";
     case JasonType::Object:      return "object";
     case JasonType::External:    return "external";
     case JasonType::ID:          return "id";
<|current_version|>

#include "JasonType.h"

using JasonType = triagens::basics::JasonType;

////////////////////////////////////////////////////////////////////////////////
/// @brief get the name for a Jason type
////////////////////////////////////////////////////////////////////////////////

char const* triagens::basics::JasonTypeName (JasonType type) {
  switch (type) {
    case JasonType::None:        return "none";
    case JasonType::Null:        return "null";
    case JasonType::Bool:        return "bool";
    case JasonType::Double:      return "double";
    case JasonType::String:      return "string";
    case JasonType::Array:       return "array";
    case JasonType::ArrayLong:   return "array_long";
    case JasonType::Object:      return "object";
    case JasonType::External:    return "external";
    case JasonType::ID:          return "id";
    case JasonType::ArangoDB_id: return "arangodb_id";
    case JasonType::UTCDate:     return "utc-date";
    case JasonType::Int:         return "int";
    case JasonType::UInt:        return "uint";
    case JasonType::Binary:      return "binary";
  }

  return "unknown";
}

<|next_version|>

#include "JasonType.h"

using JasonType = triagens::basics::JasonType;

////////////////////////////////////////////////////////////////////////////////
/// @brief get the name for a Jason type
////////////////////////////////////////////////////////////////////////////////

char const* triagens::basics::JasonTypeName (JasonType type) {
  switch (type) {
    case JasonType::None:        return "none";
    case JasonType::Null:        return "null";
    case JasonType::Bool:        return "bool";
    case JasonType::Double:      return "double";
    case JasonType::String:      return "string";
    case JasonType::Array:       return "array";
    case JasonType::ArrayLong:   return "array_long";
    case JasonType::Object:      return "object";
    case JasonType::ObjectLong:  return "object_long";
    case JasonType::External:    return "external";
    case JasonType::ID:          return "id";
    case JasonType::ArangoDB_id: return "arangodb_id";
    case JasonType::UTCDate:     return "utc-date";
    case JasonType::Int:         return "int";
    case JasonType::UInt:        return "uint";
    case JasonType::Binary:      return "binary";
  }

  return "unknown";
}


Add type checking for boolean link types.

--- opencog/atoms/core/Checkers.cc
+++ opencog/atoms/core/Checkers.cc
@@ -25,8 +25,13 @@

 using namespace opencog;

+/// Check to see if every input atom is of Evaluatable type.
 bool check_evaluatable(const Handle& bool_atom)
 {
+	for (const Handle& h: bool_atom->getOutgoingSet())
+	{
+		if (not h->is_type(EVALUATABLE_LINK)) return false;
+	}
 	return true;
 }

<|original_code|>
/*
 * opencog/atoms/core/Checkers.cc
 *
 * Copyright (C) 2017 Linas Vepstas
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <opencog/atoms/base/Atom.h>
#include <opencog/atoms/base/ClassServer.h>

using namespace opencog;

bool check_evaluatable(const Handle& bool_atom)
{
	return true;
}

/* This runs when the shared lib is loaded. */
static __attribute__ ((constructor)) void init(void)
{
	classserver().addValidator(BOOLEAN_LINK, check_evaluatable);
}

<|edits_diff|>
--- opencog/atoms/core/Checkers.cc
+++ opencog/atoms/core/Checkers.cc
@@ -25,6 +25,7 @@

 using namespace opencog;

+/// Check to see if every input atom is of Evaluatable type.
 bool check_evaluatable(const Handle& bool_atom)
 {
 	return true;
<|current_version|>
/*
 * opencog/atoms/core/Checkers.cc
 *
 * Copyright (C) 2017 Linas Vepstas
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <opencog/atoms/base/Atom.h>
#include <opencog/atoms/base/ClassServer.h>

using namespace opencog;

/// Check to see if every input atom is of Evaluatable type.
bool check_evaluatable(const Handle& bool_atom)
{
	return true;
}

/* This runs when the shared lib is loaded. */
static __attribute__ ((constructor)) void init(void)
{
	classserver().addValidator(BOOLEAN_LINK, check_evaluatable);
}

<|next_version|>
/*
 * opencog/atoms/core/Checkers.cc
 *
 * Copyright (C) 2017 Linas Vepstas
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <opencog/atoms/base/Atom.h>
#include <opencog/atoms/base/ClassServer.h>

using namespace opencog;

/// Check to see if every input atom is of Evaluatable type.
bool check_evaluatable(const Handle& bool_atom)
{
	for (const Handle& h: bool_atom->getOutgoingSet())
	{
		if (not h->is_type(EVALUATABLE_LINK)) return false;
	}
	return true;
}

/* This runs when the shared lib is loaded. */
static __attribute__ ((constructor)) void init(void)
{
	classserver().addValidator(BOOLEAN_LINK, check_evaluatable);
}


Update Windows runner from template

Update Windows runner from template

Picks up the recently add CoInitialize fix.

--- testbed/windows/runner/main.cpp
+++ testbed/windows/runner/main.cpp
@@ -18,6 +18,9 @@
     ::AllocConsole();
   }

+  // Initialize COM, so that it is available for use in the library and/or plugins.
+  ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
+
   RunLoop run_loop;

   flutter::DartProject project(L"data");
@@ -35,5 +38,6 @@

   run_loop.Run();

+  ::CoUninitialize();
   return EXIT_SUCCESS;
 }

<|original_code|>
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>

#include <vector>

#include "flutter_window.h"
#include "run_loop.h"
#include "window_configuration.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance,
                      _In_opt_ HINSTANCE prev,
                      _In_ wchar_t* command_line,
                      _In_ int show_command) {
  // Attach to console when present (e.g., 'flutter run') or create a
  // new console when running with a debugger.
  if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
    ::AllocConsole();
  }

  RunLoop run_loop;

  flutter::DartProject project(L"data");
#ifndef _DEBUG
  project.SetEngineSwitches({"--disable-dart-asserts"});
#endif

  FlutterWindow window(&run_loop, project);
  Win32Window::Point origin(kFlutterWindowOriginX, kFlutterWindowOriginY);
  Win32Window::Size size(kFlutterWindowWidth, kFlutterWindowHeight);
  if (!window.CreateAndShow(kFlutterWindowTitle, origin, size)) {
    return EXIT_FAILURE;
  }
  window.SetQuitOnClose(true);

  run_loop.Run();

  return EXIT_SUCCESS;
}

<|edits_diff|>
--- testbed/windows/runner/main.cpp
+++ testbed/windows/runner/main.cpp
@@ -18,6 +18,9 @@
     ::AllocConsole();
   }

+  // Initialize COM, so that it is available for use in the library and/or plugins.
+  ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
+
   RunLoop run_loop;

   flutter::DartProject project(L"data");
<|current_version|>
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>

#include <vector>

#include "flutter_window.h"
#include "run_loop.h"
#include "window_configuration.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance,
                      _In_opt_ HINSTANCE prev,
                      _In_ wchar_t* command_line,
                      _In_ int show_command) {
  // Attach to console when present (e.g., 'flutter run') or create a
  // new console when running with a debugger.
  if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
    ::AllocConsole();
  }

  // Initialize COM, so that it is available for use in the library and/or plugins.
  ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

  RunLoop run_loop;

  flutter::DartProject project(L"data");
#ifndef _DEBUG
  project.SetEngineSwitches({"--disable-dart-asserts"});
#endif

  FlutterWindow window(&run_loop, project);
  Win32Window::Point origin(kFlutterWindowOriginX, kFlutterWindowOriginY);
  Win32Window::Size size(kFlutterWindowWidth, kFlutterWindowHeight);
  if (!window.CreateAndShow(kFlutterWindowTitle, origin, size)) {
    return EXIT_FAILURE;
  }
  window.SetQuitOnClose(true);

  run_loop.Run();

  return EXIT_SUCCESS;
}

<|next_version|>
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>

#include <vector>

#include "flutter_window.h"
#include "run_loop.h"
#include "window_configuration.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance,
                      _In_opt_ HINSTANCE prev,
                      _In_ wchar_t* command_line,
                      _In_ int show_command) {
  // Attach to console when present (e.g., 'flutter run') or create a
  // new console when running with a debugger.
  if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
    ::AllocConsole();
  }

  // Initialize COM, so that it is available for use in the library and/or plugins.
  ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

  RunLoop run_loop;

  flutter::DartProject project(L"data");
#ifndef _DEBUG
  project.SetEngineSwitches({"--disable-dart-asserts"});
#endif

  FlutterWindow window(&run_loop, project);
  Win32Window::Point origin(kFlutterWindowOriginX, kFlutterWindowOriginY);
  Win32Window::Size size(kFlutterWindowWidth, kFlutterWindowHeight);
  if (!window.CreateAndShow(kFlutterWindowTitle, origin, size)) {
    return EXIT_FAILURE;
  }
  window.SetQuitOnClose(true);

  run_loop.Run();

  ::CoUninitialize();
  return EXIT_SUCCESS;
}


Edit ``contents.is_inserting`` in insert modes

--- src/insert_mode.cc
+++ src/insert_mode.cc
@@ -6,6 +6,7 @@

 void enter_insert_mode(contents& contents, boost::optional<int>) {
     char ch;
+    contents.is_inserting = true;
     while((ch = getch()) != _escape) {
         contents.cont[contents.y].insert(contents.x, 1, ch);
         mvf(contents);
@@ -13,10 +14,12 @@
             print_contents(get_contents());
         }
     }
+    contents.is_inserting = false;
 }

 void enter_replace_mode(contents& contents, boost::optional<int>) {
     char ch;
+    contents.is_inserting = true;
     while((ch = getch()) != _escape) {
         if(contents.x >= contents.cont[contents.y].size()) {
             contents.cont[contents.y].push_back(ch);
@@ -27,4 +30,5 @@
             print_contents(get_contents());
         }
     }
+    contents.is_inserting = false;
 }

<|original_code|>
#include <ncurses.h>

#include "../../../src/contents.hh"
#include "../../../src/key_aliases.hh"
#include "../../vick-move/src/move.hh"

void enter_insert_mode(contents& contents, boost::optional<int>) {
    char ch;
    while((ch = getch()) != _escape) {
        contents.cont[contents.y].insert(contents.x, 1, ch);
        mvf(contents);
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
}

void enter_replace_mode(contents& contents, boost::optional<int>) {
    char ch;
    while((ch = getch()) != _escape) {
        if(contents.x >= contents.cont[contents.y].size()) {
            contents.cont[contents.y].push_back(ch);
        } else {
            contents.cont[contents.y][contents.x] = ch;
        }
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
}

<|edits_diff|>
--- src/insert_mode.cc
+++ src/insert_mode.cc
@@ -6,6 +6,7 @@

 void enter_insert_mode(contents& contents, boost::optional<int>) {
     char ch;
+    contents.is_inserting = true;
     while((ch = getch()) != _escape) {
         contents.cont[contents.y].insert(contents.x, 1, ch);
         mvf(contents);
@@ -13,10 +14,12 @@
             print_contents(get_contents());
         }
     }
+    contents.is_inserting = false;
 }

 void enter_replace_mode(contents& contents, boost::optional<int>) {
     char ch;
+    contents.is_inserting = true;
     while((ch = getch()) != _escape) {
         if(contents.x >= contents.cont[contents.y].size()) {
             contents.cont[contents.y].push_back(ch);
<|current_version|>
#include <ncurses.h>

#include "../../../src/contents.hh"
#include "../../../src/key_aliases.hh"
#include "../../vick-move/src/move.hh"

void enter_insert_mode(contents& contents, boost::optional<int>) {
    char ch;
    contents.is_inserting = true;
    while((ch = getch()) != _escape) {
        contents.cont[contents.y].insert(contents.x, 1, ch);
        mvf(contents);
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
    contents.is_inserting = false;
}

void enter_replace_mode(contents& contents, boost::optional<int>) {
    char ch;
    contents.is_inserting = true;
    while((ch = getch()) != _escape) {
        if(contents.x >= contents.cont[contents.y].size()) {
            contents.cont[contents.y].push_back(ch);
        } else {
            contents.cont[contents.y][contents.x] = ch;
        }
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
}

<|next_version|>
#include <ncurses.h>

#include "../../../src/contents.hh"
#include "../../../src/key_aliases.hh"
#include "../../vick-move/src/move.hh"

void enter_insert_mode(contents& contents, boost::optional<int>) {
    char ch;
    contents.is_inserting = true;
    while((ch = getch()) != _escape) {
        contents.cont[contents.y].insert(contents.x, 1, ch);
        mvf(contents);
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
    contents.is_inserting = false;
}

void enter_replace_mode(contents& contents, boost::optional<int>) {
    char ch;
    contents.is_inserting = true;
    while((ch = getch()) != _escape) {
        if(contents.x >= contents.cont[contents.y].size()) {
            contents.cont[contents.y].push_back(ch);
        } else {
            contents.cont[contents.y][contents.x] = ch;
        }
        if(get_contents().refresh) {
            print_contents(get_contents());
        }
    }
    contents.is_inserting = false;
}


Add identifying block number in rotation test

--- logicTest.cpp
+++ logicTest.cpp
@@ -27,6 +27,8 @@
     {
       auto b1 = new block( i );

+      std::cout << i << " {" << std::endl;
+
       printCoords( b1 );
       b1->rotate();
       printCoords( b1 );
@@ -37,6 +39,8 @@
       b1->rotate();
       printCoords( b1 );

+      std::cout << "}" << std::endl;
+
       delete b1;
     }

<|original_code|>
#include "logic.cpp"
#include <iostream>
#include <cstdlib>

int main( void );
void printCoords( block* b );
int rotationTest( void );

int main( void )
{
  std::cout << "Rotation Test : " << (rotationTest())? "PASSED\n" : "FAILED\n";
  exit( EXIT_SUCCESS );
}

void printCoords( block *b )
{
  for( int i = 0; i < 4; ++i )
    {
      std::cout << i << "(" << b->coord[i].x << "," << b->coord[i].y << ")" << std::endl;
    }
  std::cout << std::endl;
}

int rotationTest( void )
{
  for( int i = 0; i < 5; ++i )
    {
      auto b1 = new block( i );

      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );

      delete b1;
    }

  return 1;
}

<|edits_diff|>
--- logicTest.cpp
+++ logicTest.cpp
@@ -27,6 +27,8 @@
     {
       auto b1 = new block( i );

+      std::cout << i << " {" << std::endl;
+
       printCoords( b1 );
       b1->rotate();
       printCoords( b1 );
<|current_version|>
#include "logic.cpp"
#include <iostream>
#include <cstdlib>

int main( void );
void printCoords( block* b );
int rotationTest( void );

int main( void )
{
  std::cout << "Rotation Test : " << (rotationTest())? "PASSED\n" : "FAILED\n";
  exit( EXIT_SUCCESS );
}

void printCoords( block *b )
{
  for( int i = 0; i < 4; ++i )
    {
      std::cout << i << "(" << b->coord[i].x << "," << b->coord[i].y << ")" << std::endl;
    }
  std::cout << std::endl;
}

int rotationTest( void )
{
  for( int i = 0; i < 5; ++i )
    {
      auto b1 = new block( i );

      std::cout << i << " {" << std::endl;

      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );

      delete b1;
    }

  return 1;
}

<|next_version|>
#include "logic.cpp"
#include <iostream>
#include <cstdlib>

int main( void );
void printCoords( block* b );
int rotationTest( void );

int main( void )
{
  std::cout << "Rotation Test : " << (rotationTest())? "PASSED\n" : "FAILED\n";
  exit( EXIT_SUCCESS );
}

void printCoords( block *b )
{
  for( int i = 0; i < 4; ++i )
    {
      std::cout << i << "(" << b->coord[i].x << "," << b->coord[i].y << ")" << std::endl;
    }
  std::cout << std::endl;
}

int rotationTest( void )
{
  for( int i = 0; i < 5; ++i )
    {
      auto b1 = new block( i );

      std::cout << i << " {" << std::endl;

      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );
      b1->rotate();
      printCoords( b1 );

      std::cout << "}" << std::endl;

      delete b1;
    }

  return 1;
}


Add small explanation to the filter dialog.

svn path=/trunk/playground/base/strigi/; revision=609264

--- src/searchclient/dlgfilters.cpp
+++ src/searchclient/dlgfilters.cpp
@@ -4,11 +4,14 @@
 #include <QHBoxLayout>
 #include <QVBoxLayout>
 #include <QPushButton>
+#include <QLabel>

 DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters,
             QWidget *parent)
         : QDialog(parent, Qt::Dialog) {
     setWindowTitle(tr("strigiclient - Edit filters"));
+    QLabel* explanation = new QLabel(tr("Define filters that determine which files will be included and which will be excluded from the index, e.g. '*.html' or '.svn/' (do not index directories called '.svn')."));
+    explanation->setWordWrap(true);
     filterwidget = new FilterWidget();
     filterwidget->setFilters(filters);
     QPushButton* ok = new QPushButton(tr("&Ok"));
@@ -17,6 +20,7 @@

     QVBoxLayout* layout = new QVBoxLayout();
     setLayout(layout);
+    layout->addWidget(explanation);
     layout->addWidget(filterwidget);
     QHBoxLayout* hl = new QHBoxLayout();
     layout->addLayout(hl);

<|original_code|>
#include "dlgfilters.h"
#include "filterwidget.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>

DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters,
            QWidget *parent)
        : QDialog(parent, Qt::Dialog) {
    setWindowTitle(tr("strigiclient - Edit filters"));
    filterwidget = new FilterWidget();
    filterwidget->setFilters(filters);
    QPushButton* ok = new QPushButton(tr("&Ok"));
    ok->setDefault(true);
    QPushButton* cancel = new QPushButton(tr("&Cancel"));

    QVBoxLayout* layout = new QVBoxLayout();
    setLayout(layout);
    layout->addWidget(filterwidget);
    QHBoxLayout* hl = new QHBoxLayout();
    layout->addLayout(hl);
    hl->addStretch();
    hl->addWidget(ok);
    hl->addWidget(cancel);
    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
const QList<QPair<bool,QString> >&
DlgFilters::getFilters() const {
    return filterwidget->getFilters();
}

<|edits_diff|>
--- src/searchclient/dlgfilters.cpp
+++ src/searchclient/dlgfilters.cpp
@@ -4,11 +4,14 @@
 #include <QHBoxLayout>
 #include <QVBoxLayout>
 #include <QPushButton>
+#include <QLabel>

 DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters,
             QWidget *parent)
         : QDialog(parent, Qt::Dialog) {
     setWindowTitle(tr("strigiclient - Edit filters"));
+    QLabel* explanation = new QLabel(tr("Define filters that determine which files will be included and which will be excluded from the index, e.g. '*.html' or '.svn/' (do not index directories called '.svn')."));
+    explanation->setWordWrap(true);
     filterwidget = new FilterWidget();
     filterwidget->setFilters(filters);
     QPushButton* ok = new QPushButton(tr("&Ok"));
<|current_version|>
#include "dlgfilters.h"
#include "filterwidget.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>

DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters,
            QWidget *parent)
        : QDialog(parent, Qt::Dialog) {
    setWindowTitle(tr("strigiclient - Edit filters"));
    QLabel* explanation = new QLabel(tr("Define filters that determine which files will be included and which will be excluded from the index, e.g. '*.html' or '.svn/' (do not index directories called '.svn')."));
    explanation->setWordWrap(true);
    filterwidget = new FilterWidget();
    filterwidget->setFilters(filters);
    QPushButton* ok = new QPushButton(tr("&Ok"));
    ok->setDefault(true);
    QPushButton* cancel = new QPushButton(tr("&Cancel"));

    QVBoxLayout* layout = new QVBoxLayout();
    setLayout(layout);
    layout->addWidget(filterwidget);
    QHBoxLayout* hl = new QHBoxLayout();
    layout->addLayout(hl);
    hl->addStretch();
    hl->addWidget(ok);
    hl->addWidget(cancel);
    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
const QList<QPair<bool,QString> >&
DlgFilters::getFilters() const {
    return filterwidget->getFilters();
}

<|next_version|>
#include "dlgfilters.h"
#include "filterwidget.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>

DlgFilters::DlgFilters(const QList<QPair<bool,QString> >& filters,
            QWidget *parent)
        : QDialog(parent, Qt::Dialog) {
    setWindowTitle(tr("strigiclient - Edit filters"));
    QLabel* explanation = new QLabel(tr("Define filters that determine which files will be included and which will be excluded from the index, e.g. '*.html' or '.svn/' (do not index directories called '.svn')."));
    explanation->setWordWrap(true);
    filterwidget = new FilterWidget();
    filterwidget->setFilters(filters);
    QPushButton* ok = new QPushButton(tr("&Ok"));
    ok->setDefault(true);
    QPushButton* cancel = new QPushButton(tr("&Cancel"));

    QVBoxLayout* layout = new QVBoxLayout();
    setLayout(layout);
    layout->addWidget(explanation);
    layout->addWidget(filterwidget);
    QHBoxLayout* hl = new QHBoxLayout();
    layout->addLayout(hl);
    hl->addStretch();
    hl->addWidget(ok);
    hl->addWidget(cancel);
    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
const QList<QPair<bool,QString> >&
DlgFilters::getFilters() const {
    return filterwidget->getFilters();
}


Fix building for pre-C++14 standards

Fix building for pre-C++14 standards

Skip `floaxie` test in this case, as it requires at least C++14.

--- src/floaxietest.cpp
+++ src/floaxietest.cpp
@@ -1,3 +1,5 @@
+#if __cplusplus >= 201402L
+
 #include "test.h"
 #include "floaxie/ftoa.h"

@@ -7,3 +9,5 @@
 }

 REGISTER_TEST(floaxie);
+
+#endif

<|original_code|>
#include "test.h"
#include "floaxie/ftoa.h"

void dtoa_floaxie(double v, char* buffer)
{
	floaxie::ftoa(v, buffer);
}

REGISTER_TEST(floaxie);

<|edits_diff|>
--- src/floaxietest.cpp
+++ src/floaxietest.cpp
@@ -1,3 +1,5 @@
+#if __cplusplus >= 201402L
+
 #include "test.h"
 #include "floaxie/ftoa.h"

<|current_version|>
#if __cplusplus >= 201402L

#include "test.h"
#include "floaxie/ftoa.h"

void dtoa_floaxie(double v, char* buffer)
{
	floaxie::ftoa(v, buffer);
}

REGISTER_TEST(floaxie);

<|next_version|>
#if __cplusplus >= 201402L

#include "test.h"
#include "floaxie/ftoa.h"

void dtoa_floaxie(double v, char* buffer)
{
	floaxie::ftoa(v, buffer);
}

REGISTER_TEST(floaxie);

#endif


Remove header from notebook tree

Remove header from notebook tree

--- notebooktree.cpp
+++ notebooktree.cpp
@@ -3,10 +3,13 @@
 #include "treenotebookpageitem.h"
 #include "notebookexception.h"

+#include <QHeaderView>
+
 NotebookTree::NotebookTree(QWidget* parent) :
     QTreeWidget(parent)
 {
     this->setColumnCount(1);
+    this->header()->hide();
 }

 void NotebookTree::addNotebook(Notebook& notebook)

<|original_code|>
#include "notebooktree.h"
#include "treenotebookitem.h"
#include "treenotebookpageitem.h"
#include "notebookexception.h"

NotebookTree::NotebookTree(QWidget* parent) :
    QTreeWidget(parent)
{
    this->setColumnCount(1);
}

void NotebookTree::addNotebook(Notebook& notebook)
{
    TreeNotebookItem* treeItem = new TreeNotebookItem(notebook);
    if (this->notebookTrees.find(&notebook) == this->notebookTrees.end())
    {
        this->notebookTrees[&notebook] = treeItem;
        this->addTopLevelItem(treeItem);
    }
    else
    {
        delete treeItem;
        throw NotebookException("Cannot add a notebook multiple times to the tree");
    }
}

void NotebookTree::selectPage(Notebook* notebook, NotebookPage* page)
{
    auto notebookTreeIter = this->notebookTrees.find(notebook);
    if (notebookTreeIter == this->notebookTrees.end())
        throw NotebookException("Could not find tree node for the page to select");

    TreeNotebookItem* notebookTree = *notebookTreeIter;
    QTreeWidgetItem* sectionTree = 0;
    TreeNotebookPageItem* pageNode = 0;
    notebookTree->getPathToPage(page, sectionTree, pageNode);
    if (!sectionTree)
        throw NotebookException("Result from getPathToPage; sectionTree is null");
    if (!pageNode)
        throw NotebookException("Result from getPathToPage; pageNode is null");

    notebookTree->setExpanded(true);
    sectionTree->setExpanded(true);
    pageNode->setSelected(true);
}

<|edits_diff|>
--- notebooktree.cpp
+++ notebooktree.cpp
@@ -2,6 +2,8 @@
 #include "treenotebookitem.h"
 #include "treenotebookpageitem.h"
 #include "notebookexception.h"
+
+#include <QHeaderView>

 NotebookTree::NotebookTree(QWidget* parent) :
     QTreeWidget(parent)
<|current_version|>
#include "notebooktree.h"
#include "treenotebookitem.h"
#include "treenotebookpageitem.h"
#include "notebookexception.h"

#include <QHeaderView>

NotebookTree::NotebookTree(QWidget* parent) :
    QTreeWidget(parent)
{
    this->setColumnCount(1);
}

void NotebookTree::addNotebook(Notebook& notebook)
{
    TreeNotebookItem* treeItem = new TreeNotebookItem(notebook);
    if (this->notebookTrees.find(&notebook) == this->notebookTrees.end())
    {
        this->notebookTrees[&notebook] = treeItem;
        this->addTopLevelItem(treeItem);
    }
    else
    {
        delete treeItem;
        throw NotebookException("Cannot add a notebook multiple times to the tree");
    }
}

void NotebookTree::selectPage(Notebook* notebook, NotebookPage* page)
{
    auto notebookTreeIter = this->notebookTrees.find(notebook);
    if (notebookTreeIter == this->notebookTrees.end())
        throw NotebookException("Could not find tree node for the page to select");

    TreeNotebookItem* notebookTree = *notebookTreeIter;
    QTreeWidgetItem* sectionTree = 0;
    TreeNotebookPageItem* pageNode = 0;
    notebookTree->getPathToPage(page, sectionTree, pageNode);
    if (!sectionTree)
        throw NotebookException("Result from getPathToPage; sectionTree is null");
    if (!pageNode)
        throw NotebookException("Result from getPathToPage; pageNode is null");

    notebookTree->setExpanded(true);
    sectionTree->setExpanded(true);
    pageNode->setSelected(true);
}

<|next_version|>
#include "notebooktree.h"
#include "treenotebookitem.h"
#include "treenotebookpageitem.h"
#include "notebookexception.h"

#include <QHeaderView>

NotebookTree::NotebookTree(QWidget* parent) :
    QTreeWidget(parent)
{
    this->setColumnCount(1);
    this->header()->hide();
}

void NotebookTree::addNotebook(Notebook& notebook)
{
    TreeNotebookItem* treeItem = new TreeNotebookItem(notebook);
    if (this->notebookTrees.find(&notebook) == this->notebookTrees.end())
    {
        this->notebookTrees[&notebook] = treeItem;
        this->addTopLevelItem(treeItem);
    }
    else
    {
        delete treeItem;
        throw NotebookException("Cannot add a notebook multiple times to the tree");
    }
}

void NotebookTree::selectPage(Notebook* notebook, NotebookPage* page)
{
    auto notebookTreeIter = this->notebookTrees.find(notebook);
    if (notebookTreeIter == this->notebookTrees.end())
        throw NotebookException("Could not find tree node for the page to select");

    TreeNotebookItem* notebookTree = *notebookTreeIter;
    QTreeWidgetItem* sectionTree = 0;
    TreeNotebookPageItem* pageNode = 0;
    notebookTree->getPathToPage(page, sectionTree, pageNode);
    if (!sectionTree)
        throw NotebookException("Result from getPathToPage; sectionTree is null");
    if (!pageNode)
        throw NotebookException("Result from getPathToPage; pageNode is null");

    notebookTree->setExpanded(true);
    sectionTree->setExpanded(true);
    pageNode->setSelected(true);
}


Add system command for holding command console

--- Podrios.cpp
+++ Podrios.cpp
@@ -6,6 +6,8 @@
  */

 #include <iostream>
+#include <stdlib.h>
+

 using namespace std;

@@ -14,5 +16,6 @@
 {
 	cout << "Show Message." << endl;

+	system("pause");
 	return 0;
 }

<|original_code|>
/*
 * Podrios.cpp
 *
 *  Created on: 2014年10月23日
 *      Author: nemo
 */

#include <iostream>

using namespace std;

int main()
{
	cout << "Show Message." << endl;

	return 0;
}

<|edits_diff|>
--- Podrios.cpp
+++ Podrios.cpp
@@ -6,6 +6,8 @@
  */

 #include <iostream>
+#include <stdlib.h>
+

 using namespace std;

<|current_version|>
/*
 * Podrios.cpp
 *
 *  Created on: 2014年10月23日
 *      Author: nemo
 */

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
	cout << "Show Message." << endl;

	return 0;
}
<|next_version|>
/*
 * Podrios.cpp
 *
 *  Created on: 2014年10月23日
 *      Author: nemo
 */

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
	cout << "Show Message." << endl;

	system("pause");
	return 0;
}


Use strerror_r instead of strerror_s for GCC/Linux

--- libeve-api-proxy/source/Error.cpp
+++ libeve-api-proxy/source/Error.cpp
@@ -6,8 +6,12 @@
 std::string errno_string(int err)
 {
     char buffer[1024];
+#ifdef _WIN32
     if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed");
     return buffer;
+#else
+    return strerror_r(err, buffer, sizeof(buffer));
+#endif
 }

 #ifdef _WIN32

<|original_code|>
#include "Precompiled.hpp"
#include "Error.hpp"
#include "SmartPtr.hpp"
#include "String.hpp"

std::string errno_string(int err)
{
    char buffer[1024];
    if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed");
    return buffer;
}

#ifdef _WIN32

std::string win_error_string(int err)
{
    std::unique_ptr<wchar_t[], LocalFreeDeleter> buffer;
    FormatMessageW(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
        nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPWSTR)(wchar_t**)unique_out_ptr(buffer), 0, nullptr);
    return utf16_to_utf8(buffer.get());
}

#endif

<|edits_diff|>
--- libeve-api-proxy/source/Error.cpp
+++ libeve-api-proxy/source/Error.cpp
@@ -6,6 +6,7 @@
 std::string errno_string(int err)
 {
     char buffer[1024];
+#ifdef _WIN32
     if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed");
     return buffer;
 }
<|current_version|>
#include "Precompiled.hpp"
#include "Error.hpp"
#include "SmartPtr.hpp"
#include "String.hpp"

std::string errno_string(int err)
{
    char buffer[1024];
#ifdef _WIN32
    if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed");
    return buffer;
}

#ifdef _WIN32

std::string win_error_string(int err)
{
    std::unique_ptr<wchar_t[], LocalFreeDeleter> buffer;
    FormatMessageW(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
        nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPWSTR)(wchar_t**)unique_out_ptr(buffer), 0, nullptr);
    return utf16_to_utf8(buffer.get());
}

#endif

<|next_version|>
#include "Precompiled.hpp"
#include "Error.hpp"
#include "SmartPtr.hpp"
#include "String.hpp"

std::string errno_string(int err)
{
    char buffer[1024];
#ifdef _WIN32
    if (!strerror_s(buffer, sizeof(buffer), err)) throw std::runtime_error("strerror_s failed");
    return buffer;
#else
    return strerror_r(err, buffer, sizeof(buffer));
#endif
}

#ifdef _WIN32

std::string win_error_string(int err)
{
    std::unique_ptr<wchar_t[], LocalFreeDeleter> buffer;
    FormatMessageW(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
        nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPWSTR)(wchar_t**)unique_out_ptr(buffer), 0, nullptr);
    return utf16_to_utf8(buffer.get());
}

#endif


Break if task file don`t exists

Break if task file don`t exists

--- main.cpp
+++ main.cpp
@@ -3,6 +3,7 @@
 #include "on_tick_simple.h"

 #include <fstream>
+#include <iostream>

 using namespace std;

@@ -12,6 +13,11 @@
     const size_t concurrency = 2;

     ifstream task_stream{task_fname};
+    if ( !task_stream.is_open() )
+    {
+        cout << "Can`t open <" << task_fname << ">, break." << endl;
+        return 1;
+    }
     TaskListSimple task_list{task_stream, "./"};
     JobList job_list;

<|original_code|>
#include "task_simple.h"
#include "factory_simple.h"
#include "on_tick_simple.h"

#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
    const string task_fname = "task_list.txt";
    const size_t concurrency = 2;

    ifstream task_stream{task_fname};
    TaskListSimple task_list{task_stream, "./"};
    JobList job_list;

    auto loop = AIO_UVW::Loop::getDefault();
    auto factory = make_shared<FactorySimple>(loop);
    auto on_tick = make_shared< OnTickSimple<JobList> >(job_list, factory, task_list);
    factory->set_OnTick(on_tick);

    for (size_t i = 1; i <= concurrency; i++)
    {
        auto task = task_list.get();
        if (!task)
            break;

        auto downloader = factory->create(*task);
        if (!downloader)
            continue;

        job_list.emplace_back(task, downloader);
    }

    loop->run();

    return 0;
}

<|edits_diff|>
--- main.cpp
+++ main.cpp
@@ -3,6 +3,7 @@
 #include "on_tick_simple.h"

 #include <fstream>
+#include <iostream>

 using namespace std;

<|current_version|>
#include "task_simple.h"
#include "factory_simple.h"
#include "on_tick_simple.h"

#include <fstream>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    const string task_fname = "task_list.txt";
    const size_t concurrency = 2;

    ifstream task_stream{task_fname};
    TaskListSimple task_list{task_stream, "./"};
    JobList job_list;

    auto loop = AIO_UVW::Loop::getDefault();
    auto factory = make_shared<FactorySimple>(loop);
    auto on_tick = make_shared< OnTickSimple<JobList> >(job_list, factory, task_list);
    factory->set_OnTick(on_tick);

    for (size_t i = 1; i <= concurrency; i++)
    {
        auto task = task_list.get();
        if (!task)
            break;

        auto downloader = factory->create(*task);
        if (!downloader)
            continue;

        job_list.emplace_back(task, downloader);
    }

    loop->run();

    return 0;
}

<|next_version|>
#include "task_simple.h"
#include "factory_simple.h"
#include "on_tick_simple.h"

#include <fstream>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    const string task_fname = "task_list.txt";
    const size_t concurrency = 2;

    ifstream task_stream{task_fname};
    if ( !task_stream.is_open() )
    {
        cout << "Can`t open <" << task_fname << ">, break." << endl;
        return 1;
    }
    TaskListSimple task_list{task_stream, "./"};
    JobList job_list;

    auto loop = AIO_UVW::Loop::getDefault();
    auto factory = make_shared<FactorySimple>(loop);
    auto on_tick = make_shared< OnTickSimple<JobList> >(job_list, factory, task_list);
    factory->set_OnTick(on_tick);

    for (size_t i = 1; i <= concurrency; i++)
    {
        auto task = task_list.get();
        if (!task)
            break;

        auto downloader = factory->create(*task);
        if (!downloader)
            continue;

        job_list.emplace_back(task, downloader);
    }

    loop->run();

    return 0;
}


Set OpenGL ES version to 2 on Android

Set OpenGL ES version to 2 on Android

--- ouzel/android/WindowAndroid.cpp
+++ ouzel/android/WindowAndroid.cpp
@@ -2,6 +2,8 @@
 // This file is part of the Ouzel engine.

 #include "WindowAndroid.h"
+#include "Engine.h"
+#include "opengl/RendererOGL.h"

 namespace ouzel
 {
@@ -18,6 +20,10 @@

     bool WindowAndroid::init()
     {
+        std::shared_ptr<graphics::RendererOGL> rendererOGL = std::static_pointer_cast<graphics::RendererOGL>(sharedEngine->getRenderer());
+
+        rendererOGL->setAPIVersion(2);
+
         return Window::init();
     }
 }

<|original_code|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "WindowAndroid.h"

namespace ouzel
{
    WindowAndroid::WindowAndroid(const Size2& pSize, bool pResizable, bool pFullscreen, uint32_t pSampleCount, const std::string& pTitle):
        Window(pSize, pResizable, pFullscreen, pSampleCount, pTitle)
    {

    }

    WindowAndroid::~WindowAndroid()
    {

    }

    bool WindowAndroid::init()
    {
        return Window::init();
    }
}

<|edits_diff|>
--- ouzel/android/WindowAndroid.cpp
+++ ouzel/android/WindowAndroid.cpp
@@ -2,6 +2,8 @@
 // This file is part of the Ouzel engine.

 #include "WindowAndroid.h"
+#include "Engine.h"
+#include "opengl/RendererOGL.h"

 namespace ouzel
 {
<|current_version|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "WindowAndroid.h"
#include "Engine.h"
#include "opengl/RendererOGL.h"

namespace ouzel
{
    WindowAndroid::WindowAndroid(const Size2& pSize, bool pResizable, bool pFullscreen, uint32_t pSampleCount, const std::string& pTitle):
        Window(pSize, pResizable, pFullscreen, pSampleCount, pTitle)
    {

    }

    WindowAndroid::~WindowAndroid()
    {

    }

    bool WindowAndroid::init()
    {
        return Window::init();
    }
}

<|next_version|>
// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#include "WindowAndroid.h"
#include "Engine.h"
#include "opengl/RendererOGL.h"

namespace ouzel
{
    WindowAndroid::WindowAndroid(const Size2& pSize, bool pResizable, bool pFullscreen, uint32_t pSampleCount, const std::string& pTitle):
        Window(pSize, pResizable, pFullscreen, pSampleCount, pTitle)
    {

    }

    WindowAndroid::~WindowAndroid()
    {

    }

    bool WindowAndroid::init()
    {
        std::shared_ptr<graphics::RendererOGL> rendererOGL = std::static_pointer_cast<graphics::RendererOGL>(sharedEngine->getRenderer());

        rendererOGL->setAPIVersion(2);

        return Window::init();
    }
}


Fix missing write call in SubWorldMsg

Fix missing write call in SubWorldMsg

--- PlasMOUL/Messages/SimulationMsg.cpp
+++ PlasMOUL/Messages/SimulationMsg.cpp
@@ -19,10 +19,12 @@

 void MOUL::SubWorldMsg::read(DS::Stream* stream)
 {
+    MOUL::Message::read(stream);
     m_world.read(stream);
 }

 void MOUL::SubWorldMsg::write(DS::Stream* stream) const
 {
+    MOUL::Message::write(stream);
     m_world.write(stream);
 }

<|original_code|>
/******************************************************************************
 * This file is part of dirtsand.                                             *
 *                                                                            *
 * dirtsand is free software: you can redistribute it and/or modify           *
 * it under the terms of the GNU Affero General Public License as             *
 * published by the Free Software Foundation, either version 3 of the         *
 * License, or (at your option) any later version.                            *
 *                                                                            *
 * dirtsand is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Affero General Public License for more details.                        *
 *                                                                            *
 * You should have received a copy of the GNU Affero General Public License   *
 * along with dirtsand.  If not, see <http://www.gnu.org/licenses/>.          *
 ******************************************************************************/

#include "SimulationMsg.h"

void MOUL::SubWorldMsg::read(DS::Stream* stream)
{
    m_world.read(stream);
}

void MOUL::SubWorldMsg::write(DS::Stream* stream) const
{
    m_world.write(stream);
}

<|edits_diff|>
--- PlasMOUL/Messages/SimulationMsg.cpp
+++ PlasMOUL/Messages/SimulationMsg.cpp
@@ -19,6 +19,7 @@

 void MOUL::SubWorldMsg::read(DS::Stream* stream)
 {
+    MOUL::Message::read(stream);
     m_world.read(stream);
 }

<|current_version|>
/******************************************************************************
 * This file is part of dirtsand.                                             *
 *                                                                            *
 * dirtsand is free software: you can redistribute it and/or modify           *
 * it under the terms of the GNU Affero General Public License as             *
 * published by the Free Software Foundation, either version 3 of the         *
 * License, or (at your option) any later version.                            *
 *                                                                            *
 * dirtsand is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Affero General Public License for more details.                        *
 *                                                                            *
 * You should have received a copy of the GNU Affero General Public License   *
 * along with dirtsand.  If not, see <http://www.gnu.org/licenses/>.          *
 ******************************************************************************/

#include "SimulationMsg.h"

void MOUL::SubWorldMsg::read(DS::Stream* stream)
{
    MOUL::Message::read(stream);
    m_world.read(stream);
}

void MOUL::SubWorldMsg::write(DS::Stream* stream) const
{
    m_world.write(stream);
}

<|next_version|>
/******************************************************************************
 * This file is part of dirtsand.                                             *
 *                                                                            *
 * dirtsand is free software: you can redistribute it and/or modify           *
 * it under the terms of the GNU Affero General Public License as             *
 * published by the Free Software Foundation, either version 3 of the         *
 * License, or (at your option) any later version.                            *
 *                                                                            *
 * dirtsand is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Affero General Public License for more details.                        *
 *                                                                            *
 * You should have received a copy of the GNU Affero General Public License   *
 * along with dirtsand.  If not, see <http://www.gnu.org/licenses/>.          *
 ******************************************************************************/

#include "SimulationMsg.h"

void MOUL::SubWorldMsg::read(DS::Stream* stream)
{
    MOUL::Message::read(stream);
    m_world.read(stream);
}

void MOUL::SubWorldMsg::write(DS::Stream* stream) const
{
    MOUL::Message::write(stream);
    m_world.write(stream);
}


Add logging to analysis for profiling

Add logging to analysis for profiling

--- server/analyzer.cpp
+++ server/analyzer.cpp
@@ -9,7 +9,10 @@

 kj::Promise<bool> Analyzer::run(DAL *dal) {
   std::vector<Holmes::Fact::Reader> searchedFacts;
+  DLOG(INFO) << "Starting analysis " << name;
+  DLOG(INFO) << "Getting facts for " << name;
   auto ctxs = dal->getFacts(premises);
+  DLOG(INFO) << "Got facts for " << name;
   kj::Array<kj::Promise<bool>> analResults =
     KJ_MAP(ctx, ctxs) {
       if (cache.miss(ctx)) {
@@ -36,6 +39,7 @@
     for (auto v : x) {
       dirty |= v;
     }
+    DLOG(INFO) << "Finished analysis " << name;
     return dirty;
   });
 }

<|original_code|>
#include "analyzer.h"

#include "dal.h"

#include "glog.h"
#include <iostream>

namespace holmes {

kj::Promise<bool> Analyzer::run(DAL *dal) {
  std::vector<Holmes::Fact::Reader> searchedFacts;
  auto ctxs = dal->getFacts(premises);
  kj::Array<kj::Promise<bool>> analResults =
    KJ_MAP(ctx, ctxs) {
      if (cache.miss(ctx)) {
        auto req = analysis.analyzeRequest();
        auto ctxBuilder = req.initContext(ctx.size());
        auto dex = 0;
        for (auto&& val : ctx) {
          ctxBuilder.setWithCaveats(dex++, val);
        }
        return req.send().then([this, dal, ctx = kj::mv(ctx)](Holmes::Analysis::AnalyzeResults::Reader res){
          auto dfs = res.getDerived();
          bool dirty = false;
          if (dal->setFacts(dfs) != 0) {
            dirty = true;
          }
          cache.add(ctx);
          return dirty;
        });
      }
      return kj::Promise<bool>(false);
    };
  return kj::joinPromises(kj::mv(analResults)).then([this](kj::Array<bool> x){
    bool dirty = false;
    for (auto v : x) {
      dirty |= v;
    }
    return dirty;
  });
}

}

<|edits_diff|>
--- server/analyzer.cpp
+++ server/analyzer.cpp
@@ -9,7 +9,10 @@

 kj::Promise<bool> Analyzer::run(DAL *dal) {
   std::vector<Holmes::Fact::Reader> searchedFacts;
+  DLOG(INFO) << "Starting analysis " << name;
+  DLOG(INFO) << "Getting facts for " << name;
   auto ctxs = dal->getFacts(premises);
+  DLOG(INFO) << "Got facts for " << name;
   kj::Array<kj::Promise<bool>> analResults =
     KJ_MAP(ctx, ctxs) {
       if (cache.miss(ctx)) {
<|current_version|>
#include "analyzer.h"

#include "dal.h"

#include "glog.h"
#include <iostream>

namespace holmes {

kj::Promise<bool> Analyzer::run(DAL *dal) {
  std::vector<Holmes::Fact::Reader> searchedFacts;
  DLOG(INFO) << "Starting analysis " << name;
  DLOG(INFO) << "Getting facts for " << name;
  auto ctxs = dal->getFacts(premises);
  DLOG(INFO) << "Got facts for " << name;
  kj::Array<kj::Promise<bool>> analResults =
    KJ_MAP(ctx, ctxs) {
      if (cache.miss(ctx)) {
        auto req = analysis.analyzeRequest();
        auto ctxBuilder = req.initContext(ctx.size());
        auto dex = 0;
        for (auto&& val : ctx) {
          ctxBuilder.setWithCaveats(dex++, val);
        }
        return req.send().then([this, dal, ctx = kj::mv(ctx)](Holmes::Analysis::AnalyzeResults::Reader res){
          auto dfs = res.getDerived();
          bool dirty = false;
          if (dal->setFacts(dfs) != 0) {
            dirty = true;
          }
          cache.add(ctx);
          return dirty;
        });
      }
      return kj::Promise<bool>(false);
    };
  return kj::joinPromises(kj::mv(analResults)).then([this](kj::Array<bool> x){
    bool dirty = false;
    for (auto v : x) {
      dirty |= v;
    }
    return dirty;
  });
}

}

<|next_version|>
#include "analyzer.h"

#include "dal.h"

#include "glog.h"
#include <iostream>

namespace holmes {

kj::Promise<bool> Analyzer::run(DAL *dal) {
  std::vector<Holmes::Fact::Reader> searchedFacts;
  DLOG(INFO) << "Starting analysis " << name;
  DLOG(INFO) << "Getting facts for " << name;
  auto ctxs = dal->getFacts(premises);
  DLOG(INFO) << "Got facts for " << name;
  kj::Array<kj::Promise<bool>> analResults =
    KJ_MAP(ctx, ctxs) {
      if (cache.miss(ctx)) {
        auto req = analysis.analyzeRequest();
        auto ctxBuilder = req.initContext(ctx.size());
        auto dex = 0;
        for (auto&& val : ctx) {
          ctxBuilder.setWithCaveats(dex++, val);
        }
        return req.send().then([this, dal, ctx = kj::mv(ctx)](Holmes::Analysis::AnalyzeResults::Reader res){
          auto dfs = res.getDerived();
          bool dirty = false;
          if (dal->setFacts(dfs) != 0) {
            dirty = true;
          }
          cache.add(ctx);
          return dirty;
        });
      }
      return kj::Promise<bool>(false);
    };
  return kj::joinPromises(kj::mv(analResults)).then([this](kj::Array<bool> x){
    bool dirty = false;
    for (auto v : x) {
      dirty |= v;
    }
    DLOG(INFO) << "Finished analysis " << name;
    return dirty;
  });
}

}


Initialize libsodium in the gtest suite.

--- src/gtest/main.cpp
+++ src/gtest/main.cpp
@@ -1,6 +1,8 @@
 #include "gtest/gtest.h"
+#include "sodium.h"

 int main(int argc, char **argv) {
+  assert(sodium_init() != -1);
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }

<|original_code|>
#include "gtest/gtest.h"

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

<|edits_diff|>
--- src/gtest/main.cpp
+++ src/gtest/main.cpp
@@ -1,4 +1,5 @@
 #include "gtest/gtest.h"
+#include "sodium.h"

 int main(int argc, char **argv) {
   testing::InitGoogleTest(&argc, argv);
<|current_version|>
#include "gtest/gtest.h"
#include "sodium.h"

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

<|next_version|>
#include "gtest/gtest.h"
#include "sodium.h"

int main(int argc, char **argv) {
  assert(sodium_init() != -1);
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}


Fix for missing Hovercards in Windows. Buddy: Mark

--- windows/src/InitialExperience/SdkModel/WindowsInitialExperienceModule.cpp
+++ windows/src/InitialExperience/SdkModel/WindowsInitialExperienceModule.cpp
@@ -4,6 +4,7 @@
 #include "WindowsInitialExperiencePreLoadModel.h"
 #include "InitialExperienceIntroStep.h"
 //#include "InitialExperienceSearchResultAttractModeModel.h"
+#include "WorldPinVisibility.h"

 namespace ExampleApp
 {
@@ -35,6 +36,8 @@

 				// TODO: Recreate MEA initial experience steps for windows...

+				m_messageBus.Publish(WorldPins::WorldPinsVisibilityMessage(WorldPins::SdkModel::WorldPinVisibility::All));
+
                 return steps;
             }
         }

<|original_code|>
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include "WindowsInitialExperienceModule.h"
#include "WindowsInitialExperiencePreLoadModel.h"
#include "InitialExperienceIntroStep.h"
//#include "InitialExperienceSearchResultAttractModeModel.h"

namespace ExampleApp
{
    namespace InitialExperience
    {
        namespace SdkModel
        {
            WindowsInitialExperienceModule::WindowsInitialExperienceModule(
                WindowsNativeState& nativeState,
                PersistentSettings::IPersistentSettingsModel& persistentSettings,
                ExampleAppMessaging::TMessageBus& messageBus
            )
                : InitialExperienceModuleBase(persistentSettings)
                , m_nativeState(nativeState)
                , m_messageBus(messageBus)
                //, m_pInitialExperienceSearchResultAttractModeModule(NULL)
            {

            }

            WindowsInitialExperienceModule::~WindowsInitialExperienceModule()
            {
                //Eegeo_DELETE m_pInitialExperienceSearchResultAttractModeModule;
            }

            std::vector<IInitialExperienceStep*> WindowsInitialExperienceModule::CreateSteps(WorldAreaLoader::SdkModel::IWorldAreaLoaderModel &worldAreaLoaderModel)
            {
                std::vector<IInitialExperienceStep*> steps;

				// TODO: Recreate MEA initial experience steps for windows...

                return steps;
            }
        }
    }
}

<|edits_diff|>
--- windows/src/InitialExperience/SdkModel/WindowsInitialExperienceModule.cpp
+++ windows/src/InitialExperience/SdkModel/WindowsInitialExperienceModule.cpp
@@ -4,6 +4,7 @@
 #include "WindowsInitialExperiencePreLoadModel.h"
 #include "InitialExperienceIntroStep.h"
 //#include "InitialExperienceSearchResultAttractModeModel.h"
+#include "WorldPinVisibility.h"

 namespace ExampleApp
 {
<|current_version|>
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include "WindowsInitialExperienceModule.h"
#include "WindowsInitialExperiencePreLoadModel.h"
#include "InitialExperienceIntroStep.h"
//#include "InitialExperienceSearchResultAttractModeModel.h"
#include "WorldPinVisibility.h"

namespace ExampleApp
{
    namespace InitialExperience
    {
        namespace SdkModel
        {
            WindowsInitialExperienceModule::WindowsInitialExperienceModule(
                WindowsNativeState& nativeState,
                PersistentSettings::IPersistentSettingsModel& persistentSettings,
                ExampleAppMessaging::TMessageBus& messageBus
            )
                : InitialExperienceModuleBase(persistentSettings)
                , m_nativeState(nativeState)
                , m_messageBus(messageBus)
                //, m_pInitialExperienceSearchResultAttractModeModule(NULL)
            {

            }

            WindowsInitialExperienceModule::~WindowsInitialExperienceModule()
            {
                //Eegeo_DELETE m_pInitialExperienceSearchResultAttractModeModule;
            }

            std::vector<IInitialExperienceStep*> WindowsInitialExperienceModule::CreateSteps(WorldAreaLoader::SdkModel::IWorldAreaLoaderModel &worldAreaLoaderModel)
            {
                std::vector<IInitialExperienceStep*> steps;

				// TODO: Recreate MEA initial experience steps for windows...

                return steps;
            }
        }
    }
}

<|next_version|>
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include "WindowsInitialExperienceModule.h"
#include "WindowsInitialExperiencePreLoadModel.h"
#include "InitialExperienceIntroStep.h"
//#include "InitialExperienceSearchResultAttractModeModel.h"
#include "WorldPinVisibility.h"

namespace ExampleApp
{
    namespace InitialExperience
    {
        namespace SdkModel
        {
            WindowsInitialExperienceModule::WindowsInitialExperienceModule(
                WindowsNativeState& nativeState,
                PersistentSettings::IPersistentSettingsModel& persistentSettings,
                ExampleAppMessaging::TMessageBus& messageBus
            )
                : InitialExperienceModuleBase(persistentSettings)
                , m_nativeState(nativeState)
                , m_messageBus(messageBus)
                //, m_pInitialExperienceSearchResultAttractModeModule(NULL)
            {

            }

            WindowsInitialExperienceModule::~WindowsInitialExperienceModule()
            {
                //Eegeo_DELETE m_pInitialExperienceSearchResultAttractModeModule;
            }

            std::vector<IInitialExperienceStep*> WindowsInitialExperienceModule::CreateSteps(WorldAreaLoader::SdkModel::IWorldAreaLoaderModel &worldAreaLoaderModel)
            {
                std::vector<IInitialExperienceStep*> steps;

				// TODO: Recreate MEA initial experience steps for windows...

				m_messageBus.Publish(WorldPins::WorldPinsVisibilityMessage(WorldPins::SdkModel::WorldPinVisibility::All));

                return steps;
            }
        }
    }
}


Add MainHook to media unittests.

Add MainHook to media unittests.

MainHooks are in particular used on iOS to prevent the system from killing the
test application at startup.

See https://chromiumcodereview.appspot.com/10690161/ for more context.

BUG=b/6754065

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

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

--- media/base/run_all_unittests.cc
+++ media/base/run_all_unittests.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

+#include "base/test/main_hook.h"
 #include "base/test/test_suite.h"
 #include "media/base/media.h"

@@ -22,5 +23,6 @@
 }

 int main(int argc, char** argv) {
+  MainHook hook(main, argc, argv);
   return TestSuiteNoAtExit(argc, argv).Run();
 }

<|original_code|>
// 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.

#include "base/test/test_suite.h"
#include "media/base/media.h"

class TestSuiteNoAtExit : public base::TestSuite {
 public:
  TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
  virtual ~TestSuiteNoAtExit() {}
 protected:
  virtual void Initialize();
};

void TestSuiteNoAtExit::Initialize() {
  // Run TestSuite::Initialize first so that logging is initialized.
  base::TestSuite::Initialize();
  // Run this here instead of main() to ensure an AtExitManager is already
  // present.
  media::InitializeMediaLibraryForTesting();
}

int main(int argc, char** argv) {
  return TestSuiteNoAtExit(argc, argv).Run();
}

<|edits_diff|>
--- media/base/run_all_unittests.cc
+++ media/base/run_all_unittests.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

+#include "base/test/main_hook.h"
 #include "base/test/test_suite.h"
 #include "media/base/media.h"

<|current_version|>
// 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.

#include "base/test/main_hook.h"
#include "base/test/test_suite.h"
#include "media/base/media.h"

class TestSuiteNoAtExit : public base::TestSuite {
 public:
  TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
  virtual ~TestSuiteNoAtExit() {}
 protected:
  virtual void Initialize();
};

void TestSuiteNoAtExit::Initialize() {
  // Run TestSuite::Initialize first so that logging is initialized.
  base::TestSuite::Initialize();
  // Run this here instead of main() to ensure an AtExitManager is already
  // present.
  media::InitializeMediaLibraryForTesting();
}

int main(int argc, char** argv) {
  return TestSuiteNoAtExit(argc, argv).Run();
}

<|next_version|>
// 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.

#include "base/test/main_hook.h"
#include "base/test/test_suite.h"
#include "media/base/media.h"

class TestSuiteNoAtExit : public base::TestSuite {
 public:
  TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
  virtual ~TestSuiteNoAtExit() {}
 protected:
  virtual void Initialize();
};

void TestSuiteNoAtExit::Initialize() {
  // Run TestSuite::Initialize first so that logging is initialized.
  base::TestSuite::Initialize();
  // Run this here instead of main() to ensure an AtExitManager is already
  // present.
  media::InitializeMediaLibraryForTesting();
}

int main(int argc, char** argv) {
  MainHook hook(main, argc, argv);
  return TestSuiteNoAtExit(argc, argv).Run();
}


Add solution for Day 2 part two

Add solution for Day 2 part two

--- Day2/Day2.cpp
+++ Day2/Day2.cpp
@@ -15,6 +15,7 @@

 	std::string Line;
 	uint64_t WrappingPaper = 0;
+	uint64_t Ribbon = 0;

 	while (std::getline(Input, Line))
 	{
@@ -35,13 +36,16 @@
 		uint32_t Side3 = l * h;

 		uint32_t SmallestSide = std::min({ Side1, Side2, Side3 });
+		uint32_t LargestDimension = std::max({ l, w, h });

 		WrappingPaper += SmallestSide + 2 * Side1 + 2 * Side2 + 2 * Side3;
+		Ribbon += l * w * h + 2 * l + 2 * w + 2 * h - 2 * LargestDimension;
 	}

 	Input.close();

 	std::cout << "Wrapping Paper: " << WrappingPaper << std::endl;
+	std::cout << "Ribbon: " << Ribbon << std::endl;

 	system("pause");

<|original_code|>
// Day2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main()
{
	std::ifstream Input("Input.txt");

	if (!Input.is_open())
	{
		std::cout << "Error opening File!" << std::endl;
		return 0;
	}

	std::string Line;
	uint64_t WrappingPaper = 0;

	while (std::getline(Input, Line))
	{
		std::stringstream LineStream(Line);

		uint32_t l;
		uint32_t h;
		uint32_t w;

		LineStream >> l;
		LineStream.get();
		LineStream >> h;
		LineStream.get();
		LineStream >> w;

		uint32_t Side1 = l * w;
		uint32_t Side2 = h * w;
		uint32_t Side3 = l * h;

		uint32_t SmallestSide = std::min({ Side1, Side2, Side3 });

		WrappingPaper += SmallestSide + 2 * Side1 + 2 * Side2 + 2 * Side3;
	}

	Input.close();

	std::cout << "Wrapping Paper: " << WrappingPaper << std::endl;

	system("pause");

    return 0;
}

<|edits_diff|>
--- Day2/Day2.cpp
+++ Day2/Day2.cpp
@@ -15,6 +15,7 @@

 	std::string Line;
 	uint64_t WrappingPaper = 0;
+	uint64_t Ribbon = 0;

 	while (std::getline(Input, Line))
 	{
@@ -35,8 +36,10 @@
 		uint32_t Side3 = l * h;

 		uint32_t SmallestSide = std::min({ Side1, Side2, Side3 });
+		uint32_t LargestDimension = std::max({ l, w, h });

 		WrappingPaper += SmallestSide + 2 * Side1 + 2 * Side2 + 2 * Side3;
+		Ribbon += l * w * h + 2 * l + 2 * w + 2 * h - 2 * LargestDimension;
 	}

 	Input.close();
<|current_version|>
// Day2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main()
{
	std::ifstream Input("Input.txt");

	if (!Input.is_open())
	{
		std::cout << "Error opening File!" << std::endl;
		return 0;
	}

	std::string Line;
	uint64_t WrappingPaper = 0;
	uint64_t Ribbon = 0;

	while (std::getline(Input, Line))
	{
		std::stringstream LineStream(Line);

		uint32_t l;
		uint32_t h;
		uint32_t w;

		LineStream >> l;
		LineStream.get();
		LineStream >> h;
		LineStream.get();
		LineStream >> w;

		uint32_t Side1 = l * w;
		uint32_t Side2 = h * w;
		uint32_t Side3 = l * h;

		uint32_t SmallestSide = std::min({ Side1, Side2, Side3 });
		uint32_t LargestDimension = std::max({ l, w, h });

		WrappingPaper += SmallestSide + 2 * Side1 + 2 * Side2 + 2 * Side3;
		Ribbon += l * w * h + 2 * l + 2 * w + 2 * h - 2 * LargestDimension;
	}

	Input.close();

	std::cout << "Wrapping Paper: " << WrappingPaper << std::endl;

	system("pause");

    return 0;
}

<|next_version|>
// Day2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main()
{
	std::ifstream Input("Input.txt");

	if (!Input.is_open())
	{
		std::cout << "Error opening File!" << std::endl;
		return 0;
	}

	std::string Line;
	uint64_t WrappingPaper = 0;
	uint64_t Ribbon = 0;

	while (std::getline(Input, Line))
	{
		std::stringstream LineStream(Line);

		uint32_t l;
		uint32_t h;
		uint32_t w;

		LineStream >> l;
		LineStream.get();
		LineStream >> h;
		LineStream.get();
		LineStream >> w;

		uint32_t Side1 = l * w;
		uint32_t Side2 = h * w;
		uint32_t Side3 = l * h;

		uint32_t SmallestSide = std::min({ Side1, Side2, Side3 });
		uint32_t LargestDimension = std::max({ l, w, h });

		WrappingPaper += SmallestSide + 2 * Side1 + 2 * Side2 + 2 * Side3;
		Ribbon += l * w * h + 2 * l + 2 * w + 2 * h - 2 * LargestDimension;
	}

	Input.close();

	std::cout << "Wrapping Paper: " << WrappingPaper << std::endl;
	std::cout << "Ribbon: " << Ribbon << std::endl;

	system("pause");

    return 0;
}


Validate the executor as part of the test

--- testing/test_single_agent_async_execute.cpp
+++ testing/test_single_agent_async_execute.cpp
@@ -24,6 +24,7 @@
     f.wait();

     assert(set_me_to_thirteen == 13);
+    assert(exec.valid());
   }

   {
@@ -37,6 +38,7 @@
     });

     assert(f.get() == 13);
+    assert(exec.valid());
   }
 }

<|original_code|>
#include <agency/new_executor_traits.hpp>
#include <cassert>
#include <iostream>

#include "test_executors.hpp"

template<class Executor>
void test()
{
  using executor_type = Executor;

  {
    // returning void

    executor_type exec;

    int set_me_to_thirteen = 0;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, [&]
    {
      set_me_to_thirteen = 13;
    });

    f.wait();

    assert(set_me_to_thirteen == 13);
  }

  {
    // returning int

    executor_type exec;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, []
    {
      return 13;
    });

    assert(f.get() == 13);
  }
}

int main()
{
  using namespace test_executors;

  test<empty_executor>();
  test<single_agent_when_all_execute_and_select_executor>();
  test<multi_agent_when_all_execute_and_select_executor>();
  test<single_agent_then_execute_executor>();
  test<multi_agent_execute_returning_user_defined_container_executor>();
  test<multi_agent_execute_returning_default_container_executor>();
  test<multi_agent_execute_returning_void_executor>();

  std::cout << "OK" << std::endl;

  return 0;
}

<|edits_diff|>
--- testing/test_single_agent_async_execute.cpp
+++ testing/test_single_agent_async_execute.cpp
@@ -24,6 +24,7 @@
     f.wait();

     assert(set_me_to_thirteen == 13);
+    assert(exec.valid());
   }

   {
<|current_version|>
#include <agency/new_executor_traits.hpp>
#include <cassert>
#include <iostream>

#include "test_executors.hpp"

template<class Executor>
void test()
{
  using executor_type = Executor;

  {
    // returning void

    executor_type exec;

    int set_me_to_thirteen = 0;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, [&]
    {
      set_me_to_thirteen = 13;
    });

    f.wait();

    assert(set_me_to_thirteen == 13);
    assert(exec.valid());
  }

  {
    // returning int

    executor_type exec;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, []
    {
      return 13;
    });

    assert(f.get() == 13);
  }
}

int main()
{
  using namespace test_executors;

  test<empty_executor>();
  test<single_agent_when_all_execute_and_select_executor>();
  test<multi_agent_when_all_execute_and_select_executor>();
  test<single_agent_then_execute_executor>();
  test<multi_agent_execute_returning_user_defined_container_executor>();
  test<multi_agent_execute_returning_default_container_executor>();
  test<multi_agent_execute_returning_void_executor>();

  std::cout << "OK" << std::endl;

  return 0;
}

<|next_version|>
#include <agency/new_executor_traits.hpp>
#include <cassert>
#include <iostream>

#include "test_executors.hpp"

template<class Executor>
void test()
{
  using executor_type = Executor;

  {
    // returning void

    executor_type exec;

    int set_me_to_thirteen = 0;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, [&]
    {
      set_me_to_thirteen = 13;
    });

    f.wait();

    assert(set_me_to_thirteen == 13);
    assert(exec.valid());
  }

  {
    // returning int

    executor_type exec;

    auto f = agency::new_executor_traits<executor_type>::async_execute(exec, []
    {
      return 13;
    });

    assert(f.get() == 13);
    assert(exec.valid());
  }
}

int main()
{
  using namespace test_executors;

  test<empty_executor>();
  test<single_agent_when_all_execute_and_select_executor>();
  test<multi_agent_when_all_execute_and_select_executor>();
  test<single_agent_then_execute_executor>();
  test<multi_agent_execute_returning_user_defined_container_executor>();
  test<multi_agent_execute_returning_default_container_executor>();
  test<multi_agent_execute_returning_void_executor>();

  std::cout << "OK" << std::endl;

  return 0;
}


Update the sensord config test

Update the sensord config test

Pulse seems to have an old version so it's breaking. Update the test
to use the same code the plugin uses so that this isn't allowed.

--- config.tests/sensord/main.cpp
+++ config.tests/sensord/main.cpp
@@ -1,10 +1,13 @@
 #include <sensormanagerinterface.h>
 #include <datatypes/magneticfield.h>
+#include <abstractsensor.h>
+#include <abstractsensor_i.h>

 int main()
 {
     SensorManagerInterface* m_remoteSensorManager;
     m_remoteSensorManager = &SensorManagerInterface::instance();
+    QList<DataRange> (AbstractSensorChannelInterface::*func)() = &AbstractSensorChannelInterface::getAvailableIntervals;
     return 0;
 }

<|original_code|>
#include <sensormanagerinterface.h>
#include <datatypes/magneticfield.h>

int main()
{
    SensorManagerInterface* m_remoteSensorManager;
    m_remoteSensorManager = &SensorManagerInterface::instance();
    return 0;
}

<|edits_diff|>
--- config.tests/sensord/main.cpp
+++ config.tests/sensord/main.cpp
@@ -1,5 +1,7 @@
 #include <sensormanagerinterface.h>
 #include <datatypes/magneticfield.h>
+#include <abstractsensor.h>
+#include <abstractsensor_i.h>

 int main()
 {
<|current_version|>
#include <sensormanagerinterface.h>
#include <datatypes/magneticfield.h>
#include <abstractsensor.h>
#include <abstractsensor_i.h>

int main()
{
    SensorManagerInterface* m_remoteSensorManager;
    m_remoteSensorManager = &SensorManagerInterface::instance();
    return 0;
}

<|next_version|>
#include <sensormanagerinterface.h>
#include <datatypes/magneticfield.h>
#include <abstractsensor.h>
#include <abstractsensor_i.h>

int main()
{
    SensorManagerInterface* m_remoteSensorManager;
    m_remoteSensorManager = &SensorManagerInterface::instance();
    QList<DataRange> (AbstractSensorChannelInterface::*func)() = &AbstractSensorChannelInterface::getAvailableIntervals;
    return 0;
}


tests: Add fuzzing coverage for JSONRPCTransactionError(...) and RPCErrorFromTransactionError(...)

--- src/test/fuzz/kitchen_sink.cpp
+++ src/test/fuzz/kitchen_sink.cpp
@@ -2,6 +2,7 @@
 // Distributed under the MIT software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.

+#include <rpc/util.h>
 #include <test/fuzz/FuzzedDataProvider.h>
 #include <test/fuzz/fuzz.h>
 #include <test/fuzz/util.h>
@@ -18,5 +19,7 @@
     FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());

     const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray<TransactionError>({TransactionError::OK, TransactionError::MISSING_INPUTS, TransactionError::ALREADY_IN_CHAIN, TransactionError::P2P_DISABLED, TransactionError::MEMPOOL_REJECTED, TransactionError::MEMPOOL_ERROR, TransactionError::INVALID_PSBT, TransactionError::PSBT_MISMATCH, TransactionError::SIGHASH_MISMATCH, TransactionError::MAX_FEE_EXCEEDED});
+    (void)JSONRPCTransactionError(transaction_error);
+    (void)RPCErrorFromTransactionError(transaction_error);
     (void)TransactionErrorString(transaction_error);
 }

<|original_code|>
// Copyright (c) 2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <util/error.h>

#include <cstdint>
#include <vector>

// The fuzzing kitchen sink: Fuzzing harness for functions that need to be
// fuzzed but a.) don't belong in any existing fuzzing harness file, and
// b.) are not important enough to warrant their own fuzzing harness file.
void test_one_input(const std::vector<uint8_t>& buffer)
{
    FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());

    const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray<TransactionError>({TransactionError::OK, TransactionError::MISSING_INPUTS, TransactionError::ALREADY_IN_CHAIN, TransactionError::P2P_DISABLED, TransactionError::MEMPOOL_REJECTED, TransactionError::MEMPOOL_ERROR, TransactionError::INVALID_PSBT, TransactionError::PSBT_MISMATCH, TransactionError::SIGHASH_MISMATCH, TransactionError::MAX_FEE_EXCEEDED});
    (void)TransactionErrorString(transaction_error);
}

<|edits_diff|>
--- src/test/fuzz/kitchen_sink.cpp
+++ src/test/fuzz/kitchen_sink.cpp
@@ -2,6 +2,7 @@
 // Distributed under the MIT software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.

+#include <rpc/util.h>
 #include <test/fuzz/FuzzedDataProvider.h>
 #include <test/fuzz/fuzz.h>
 #include <test/fuzz/util.h>
<|current_version|>
// Copyright (c) 2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <rpc/util.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <util/error.h>

#include <cstdint>
#include <vector>

// The fuzzing kitchen sink: Fuzzing harness for functions that need to be
// fuzzed but a.) don't belong in any existing fuzzing harness file, and
// b.) are not important enough to warrant their own fuzzing harness file.
void test_one_input(const std::vector<uint8_t>& buffer)
{
    FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());

    const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray<TransactionError>({TransactionError::OK, TransactionError::MISSING_INPUTS, TransactionError::ALREADY_IN_CHAIN, TransactionError::P2P_DISABLED, TransactionError::MEMPOOL_REJECTED, TransactionError::MEMPOOL_ERROR, TransactionError::INVALID_PSBT, TransactionError::PSBT_MISMATCH, TransactionError::SIGHASH_MISMATCH, TransactionError::MAX_FEE_EXCEEDED});
    (void)TransactionErrorString(transaction_error);
}

<|next_version|>
// Copyright (c) 2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <rpc/util.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <util/error.h>

#include <cstdint>
#include <vector>

// The fuzzing kitchen sink: Fuzzing harness for functions that need to be
// fuzzed but a.) don't belong in any existing fuzzing harness file, and
// b.) are not important enough to warrant their own fuzzing harness file.
void test_one_input(const std::vector<uint8_t>& buffer)
{
    FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());

    const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray<TransactionError>({TransactionError::OK, TransactionError::MISSING_INPUTS, TransactionError::ALREADY_IN_CHAIN, TransactionError::P2P_DISABLED, TransactionError::MEMPOOL_REJECTED, TransactionError::MEMPOOL_ERROR, TransactionError::INVALID_PSBT, TransactionError::PSBT_MISMATCH, TransactionError::SIGHASH_MISMATCH, TransactionError::MAX_FEE_EXCEEDED});
    (void)JSONRPCTransactionError(transaction_error);
    (void)RPCErrorFromTransactionError(transaction_error);
    (void)TransactionErrorString(transaction_error);
}