#include "Game.hpp"

namespace arduino_pong
{

void Game::run()
{
    while(true)
    {
        gameField_.update();
        gameField_.render();
    }
}

}  // namespace arduino_pong

#include "Game.hpp"

#include <Arduino.h>

namespace
{

constexpr uint32_t MsPerUpdate = 16;

}  // namespace

namespace arduino_pong
{

void Game::run()
{

    uint32_t previous = millis();
    uint32_t lag = 0;

    while(true)
    {
        uint32_t current = millis();
        uint32_t elapsed = current - previous;
        previous = current;
        lag += elapsed;

        while(lag >= MsPerUpdate)
        {
            gameField_.update();
			lag -= MsPerUpdate;
        }

        gameField_.render();
    }
}

}  // namespace arduino_pong

Add implementation of a basic game loop.


// Copyright (c) 2008-2009 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 "chrome/browser/history/history_publisher.h"

#include "base/utf_string_conversions.h"

namespace history {

const char* const HistoryPublisher::kThumbnailImageFormat = "image/jpeg";

void HistoryPublisher::PublishPageThumbnail(
    const std::vector<unsigned char>& thumbnail, const GURL& url,
    const base::Time& time) const {
  PageData page_data = {
    time,
    url,
    NULL,
    NULL,
    kThumbnailImageFormat,
    &thumbnail,
  };

  PublishDataToIndexers(page_data);
}

void HistoryPublisher::PublishPageContent(const base::Time& time,
                                          const GURL& url,
                                          const std::wstring& title,
                                          const string16& contents) const {
  PageData page_data = {
    time,
    url,
    UTF16ToWide(contents).c_str(),
    title.c_str(),
    NULL,
    NULL,
  };

  PublishDataToIndexers(page_data);
}

}  // namespace history

// Copyright (c) 2008-2009 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 "chrome/browser/history/history_publisher.h"

#include "base/utf_string_conversions.h"

namespace history {

const char* const HistoryPublisher::kThumbnailImageFormat = "image/jpeg";

void HistoryPublisher::PublishPageThumbnail(
    const std::vector<unsigned char>& thumbnail, const GURL& url,
    const base::Time& time) const {
  PageData page_data = {
    time,
    url,
    NULL,
    NULL,
    kThumbnailImageFormat,
    &thumbnail,
  };

  PublishDataToIndexers(page_data);
}

void HistoryPublisher::PublishPageContent(const base::Time& time,
                                          const GURL& url,
                                          const std::wstring& title,
                                          const string16& contents) const {
  std::wstring wide_contents = UTF16ToWide(contents);
  PageData page_data = {
    time,
    url,
    wide_contents.c_str(),
    title.c_str(),
    NULL,
    NULL,
  };

  PublishDataToIndexers(page_data);
}

}  // namespace history

Make sure the pointer in PageData::html remains valid while PageData is called.


#include "client.h"
#include "tests/test.h"

#include <QGuiApplication>
#include <QQuickView>
#include <QQmlContext>
#include <QtQml>
#include <QUrl>

int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);

    qmlRegisterUncreatableType<AbstractTest>("mplane", 1, 0, "AbstractTest", "abstract class");
    qmlRegisterUncreatableType<Client>("mplane", 1, 0, "Client", "This is a singleton");
    qmlRegisterUncreatableType<TestScheduler>("mplane", 1, 0, "TestScheduler", "uncreatable type");

    QQuickView view;

    QQmlContext* rootContext = view.rootContext();
    rootContext->setContextProperty("client", Client::instance());

    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource( QUrl("qrc:/qml/main.qml") );
    view.show();

    return app.exec();
}

#include "client.h"
#include "tests/test.h"

#include <QGuiApplication>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>
#include <QtQml>
#include <QUrl>

int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);

    qmlRegisterUncreatableType<AbstractTest>("mplane", 1, 0, "AbstractTest", "abstract class");
    qmlRegisterUncreatableType<Client>("mplane", 1, 0, "Client", "This is a singleton");
    qmlRegisterUncreatableType<TestScheduler>("mplane", 1, 0, "TestScheduler", "uncreatable type");

    QQuickView view;

    QQmlEngine* engine = view.engine();
    QObject::connect(engine, SIGNAL(quit()), &app, SLOT(quit()));

    QQmlContext* rootContext = view.rootContext();
    rootContext->setContextProperty("client", Client::instance());

    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource( QUrl("qrc:/qml/main.qml") );
    view.show();

    return app.exec();
}

Quit the application when qml engine wants to.


//=======================================================================
// Copyright Baptiste Wicht 2011-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

#include <iostream>

#include "timing.hpp"

using namespace eddic;

timing_timer::timing_timer(timing_system& system, const std::string& name) : system(system), name(name) {
    //Nothing
}

timing_timer::~timing_timer(){
    system.register_timing(name, timer.elapsed());
}

timing_system::timing_system(std::shared_ptr<Configuration> configuration) : configuration(configuration) {
    //Nothing
}

timing_system::~timing_system(){
    if(configuration->option_defined("timing")){
        for(auto& timing : timings){
            std::cout << timing.first << ":" << timing.second << "ms" << std::endl;
        }
    }
}

void timing_system::register_timing(std::string name, double time){
    timings[name] += time;
}

//=======================================================================
// Copyright Baptiste Wicht 2011-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

#include <iostream>

#include "timing.hpp"

using namespace eddic;

timing_timer::timing_timer(timing_system& system, const std::string& name) : system(system), name(name) {
    //Nothing
}

timing_timer::~timing_timer(){
    system.register_timing(name, timer.elapsed());
}

timing_system::timing_system(std::shared_ptr<Configuration> configuration) : configuration(configuration) {
    //Nothing
}

timing_system::~timing_system(){
    if(configuration->option_defined("time")){
        for(auto& timing : timings){
            std::cout << timing.first << ":" << timing.second << "ms" << std::endl;
        }
    }
}

void timing_system::register_timing(std::string name, double time){
    timings[name] += time;
}

Fix the name of the option


// Copyright 2014 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 "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // WebKit now expects NaN as uninitialized/null Date.
  if (file_info.last_modified.is_null()) {
    web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
    web_file_info->modificationTimeMS =
        std::numeric_limits<double>::quiet_NaN();
  } else {
    web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
    web_file_info->modificationTimeMS = file_info.last_modified.ToJsTime();
  }
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

// Copyright 2014 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 "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // Blink now expects NaN as uninitialized/null Date.
  if (file_info.last_modified.is_null()) {
    web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
    web_file_info->modificationTimeMS =
        std::numeric_limits<double>::quiet_NaN();
  } else {
    web_file_info->modificationTime = file_info.last_modified.ToJsTime();
    web_file_info->modificationTimeMS = file_info.last_modified.ToJsTime();
  }
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

Upgrade Blink to milliseconds-based last modified filetimes, part 4.


// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 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 <util/validation.h>

#include <consensus/validation.h>
#include <tinyformat.h>

/** Convert ValidationState to a human-readable message for logging */
std::string FormatStateMessage(const ValidationState &state)
{
    return strprintf("%s%s",
        state.GetRejectReason(),
        state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage());
}

const std::string strMessageMagic = "Peercoin Signed Message:\n";

// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 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 <util/validation.h>

#include <consensus/validation.h>
#include <tinyformat.h>

/** Convert ValidationState to a human-readable message for logging */
std::string FormatStateMessage(const ValidationState &state)
{
    if (state.IsValid()) {
        return "Valid";
    }

    return strprintf("%s%s",
        state.GetRejectReason(),
        state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage());
}

const std::string strMessageMagic = "Peercoin Signed Message:\n";

Format CValidationState properly in all cases


#include <glbinding/GetProcAddress.h>
#include <cassert>

#ifdef WIN32
    #include <string>
    #include <windows.h>
#elif __APPLE__
    #include <string>
    #include <dlfcn.h>
#else
    #include <GL/glx.h>
#endif

namespace gl {

ProcAddress GetProcAddress(const char * name)
{
#ifdef WIN32

    typedef void (__stdcall * PROCADDRESS)();
    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(wglGetProcAddress(name));

    if (procAddress == nullptr)
    {
        static HMODULE module = LoadLibrary(L"OPENGL32.DLL");
        procAddress = reinterpret_cast<PROCADDRESS>(::GetProcAddress(module, name));
    }

#elif __APPLE__

    typedef void * PROCADDRESS;

    void * library = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
    assert(library != nullptr);

    void * symbol = dlsym(library, name);

    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(symbol);

#else

    typedef void (* PROCADDRESS)();
    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(glXGetProcAddress(reinterpret_cast<const unsigned char*>(name)));

#endif

    return reinterpret_cast<ProcAddress>(procAddress);
}

} // namespace gl

#include <glbinding/GetProcAddress.h>

#ifdef WIN32
    #include <string>
    #include <windows.h>
#elif __APPLE__
    #include <cassert>
    #include <string>
    #include <dlfcn.h>
#else
    #include <GL/glx.h>
#endif

namespace gl {

ProcAddress GetProcAddress(const char * name)
{
#ifdef WIN32

    typedef void (__stdcall * PROCADDRESS)();
    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(wglGetProcAddress(name));

    if (procAddress == nullptr)
    {
        static HMODULE module = LoadLibrary(L"OPENGL32.DLL");
        procAddress = reinterpret_cast<PROCADDRESS>(::GetProcAddress(module, name));
    }

#elif __APPLE__

    typedef void * PROCADDRESS;

    void * library = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
    assert(library != nullptr);

    void * symbol = dlsym(library, name);

    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(symbol);

#else

    typedef void (* PROCADDRESS)();
    PROCADDRESS procAddress = reinterpret_cast<PROCADDRESS>(glXGetProcAddress(reinterpret_cast<const unsigned char*>(name)));

#endif

    return reinterpret_cast<ProcAddress>(procAddress);
}

} // namespace gl

Move cassert include to OS X specific code


#include<ros/ros.h>
#include<ics3/ics>
#include<servo_msgs/IdBased.h>

ics::ICS3* driver {nullptr};

void move(const servo_msgs::IdBased::ConstPtr& msg) {
  auto degree = ics::Angle::newDegree(msg->angle);
  auto nowpos = driver->move(msg->id, degree);
  // TODO: publish now pos
}

int main(int argc, char** argv) {
  ros::init(argc, argv, "servo_krs_node");
  ros::NodeHandle n {};
  ros::NodeHandle pn {"~"};
  std::string path {"/dev/ttyUSB0"};
  pn.param<std::string>("path", path, path);
  try {
    ics::ICS3 ics {path.c_str()};
    driver = &ics;
  } catch (std::runtime_error e) {
    ROS_INFO("Error: Cannot make ICS3 instance [%s]", e.what());
    ROS_INFO("I tried open [%s]", path.c_str());
    return -1;
  }
  ros::Subscriber sub = n.subscribe("krs", 100, move);
  ros::spin();
  return 0;
}

#include<ros/ros.h>
#include<ics3/ics>
#include<servo_msgs/IdBased.h>

ics::ICS3* driver {nullptr};

void move(const servo_msgs::IdBased::ConstPtr& msg) {
  auto degree = ics::Angle::newDegree(msg->angle);
  auto nowpos = driver->move(msg->id, degree);
  // TODO: publish now pos
}

int main(int argc, char** argv) {
  ros::init(argc, argv, "servo_krs_node");
  ros::NodeHandle n {};
  ros::NodeHandle pn {"~"};
  std::string path {"/dev/ttyUSB0"};
  pn.param<std::string>("path", path, path);
  try {
    ics::ICS3 ics {path.c_str()};
    driver = &ics;
  } catch (std::runtime_error e) {
    ROS_INFO("Error: Cannot make ICS3 instance [%s]", e.what());
    ROS_INFO("I tried open [%s]", path.c_str());
    return -1;
  }
  ros::Subscriber sub = n.subscribe("cmd_krs", 100, move);
  ros::spin();
  return 0;
}

Update subscribe topic for add pub topic


#include<ros/ros.h>
#include<ics3/ics>
#include<servo_msgs/IdBased.h>

std::string path;

void move(const servo_msgs::IdBased::ConstPtr& msg) {
  static ics::ICS3 ics {path.c_str(), ics::Baudrate::RATE115200()};
  auto degree = ics::Angle::newDegree(msg->angle);
  auto nowpos = ics.move(msg->id, degree);
  // TODO: publish now pos
}

int main(int argc, char** argv) {
  ros::init(argc, argv, "servo_krs_node");
  ros::NodeHandle n;
  ros::NodeHandle pn {"~"};
  pn.param<std::string>("path", path, "ttyUSB0");
  ros::Subscriber sub = n.subscribe("krs", 100, move);
  ros::spin();
  return 0;
}

#include<ros/ros.h>
#include<ics3/ics>
#include<servo_msgs/IdBased.h>

ics::ICS3* driver;

void move(const servo_msgs::IdBased::ConstPtr& msg) {
  auto degree = ics::Angle::newDegree(msg->angle);
  auto nowpos = driver->move(msg->id, degree);
  // TODO: publish now pos
}

int main(int argc, char** argv) {
  ros::init(argc, argv, "servo_krs_node");
  ros::NodeHandle n {};
  ros::NodeHandle pn {"~"};
  std::string path {"ttyUSB0"};
  pn.param<std::string>("path", path, path);
  ics::ICS3 ics {path.c_str()};
  driver = &ics;
  ros::Subscriber sub = n.subscribe("krs", 100, move);
  ros::spin();
  return 0;
}

Update timing of make ics instance


#include <google/protobuf/compiler/command_line_interface.h>
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/perlxs/perlxs_generator.h>

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  google::protobuf::compiler::CommandLineInterface cli;

  // Proto2 C++ (for convenience, so the user doesn't need to call
  // protoc separately)

  google::protobuf::compiler::cpp::CppGenerator cpp_generator;
  cli.RegisterGenerator("--cpp_out", &cpp_generator,
                        "Generate C++ header and source.");

  // Proto2 Perl/XS
  google::protobuf::compiler::perlxs::PerlXSGenerator perlxs_generator;
  cli.RegisterGenerator("--out", &perlxs_generator,
                        "Generate Perl/XS source files.");

  cli.SetVersionInfo(perlxs_generator.GetVersionInfo());

  // process Perl/XS command line options first, and filter them out
  // of the argument list.  we really need to be able to register
  // options with the CLI instead of doing this stupid hack here.

  int j = 1;
  for (int i = 1; i < argc; i++) {
    if (perlxs_generator.ProcessOption(argv[i]) == false) {
      argv[j++] = argv[i];
    }
  }

  return cli.Run(j, argv);
}

#include <google/protobuf/compiler/command_line_interface.h>
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/perlxs/perlxs_generator.h>

#include <iostream>
#include <string>

int main(int argc, char* argv[]) {
  google::protobuf::compiler::CommandLineInterface cli;

  // Proto2 C++ (for convenience, so the user doesn't need to call
  // protoc separately)

  google::protobuf::compiler::cpp::CppGenerator cpp_generator;
  cli.RegisterGenerator("--cpp_out", &cpp_generator,
                        "Generate C++ header and source.");

  // Proto2 Perl/XS
  google::protobuf::compiler::perlxs::PerlXSGenerator perlxs_generator;
  cli.RegisterGenerator("--out", &perlxs_generator,
                        "Generate Perl/XS source files.");

  cli.SetVersionInfo(perlxs_generator.GetVersionInfo());

  // process Perl/XS command line options first, and filter them out
  // of the argument list.  we really need to be able to register
  // options with the CLI instead of doing this stupid hack here.

  int j = 1;
  for (int i = 1; i < argc; i++) {
    if (perlxs_generator.ProcessOption(argv[i]) == false) {
      argv[j++] = argv[i];
    }
  }

  return cli.Run(j, argv);
}

Remove unused `using namespace std`


#ifndef MAIN_CPP
#define MAIN_CPP

#include <iostream>
#include <bitset>
#include <string>
#include <fstream>

int main() {

  std::ifstream myfile;
  std::string message,value,translate;
  enum States{W,Z,O,I};
  States state = W;

  myfile.open("input1.txt");

  while(!myfile.eof()) {
    std::getline(myfile,value,' ');
     value = value.substr(2,1);

    switch(state) {
      case W: {
        if(value == "0") {
          state = Z;
          message += value;
        }
        break;
      }
      case Z: {
        if(value == "1") {
          state = O;
          message +=value;
        }
        else {
          state = W;
          message = "";
        }
        break;
      }
      case O: {
        if(value == "1" || value == "0") {
          message += value;
          state = I;
        }
        else {
          state = W;
          value = "";
        }
        break;
      }
      case I: {
        if(!(value == "1" || value == "0")) {
          state = W;
        }

        else {
          message += value;

          if(message.length() == 8) {
            std::bitset<8> bs(message);
            translate += char(bs.to_ulong());
            message = "";

          }
        }
        break;
      }
      }

    }

    std::cout << translate;

};

#endif

#ifndef MAIN_CPP
#define MAIN_CPP

#include <iostream>
#include <bitset>
#include <string>

int main() {

  std::string message,value,translate;
  enum States{W,Z,O,I};
  States state = W;

  while(std::getline(std::cin,value,' ')) {
     value = value.substr(2,1);

    switch(state) {
      case W: {
        if(value == "0") {
          state = Z;
          message += value;
        }
        break;
      }
      case Z: {
        if(value == "1") {
          state = O;
          message +=value;
        }
        else {
          state = W;
          message = "";
        }
        break;
      }
      case O: {
        if(value == "1" || value == "0") {
          message += value;
          state = I;
        }
        else {
          state = W;
          value = "";
        }
        break;
      }
      case I: {
        if(!(value == "1" || value == "0")) {
          state = W;
        }

        else {
          message += value;

          if(message.length() == 8) {
            std::bitset<8> bs(message);
            translate += char(bs.to_ulong());
            message = "";

          }
        }
        break;
      }
      }

    }

    std::cout << translate;

};

#endif

Update c++ steganography solution to use cin


// Copyright (c) 2009 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

// Flaky, http://crbug.com/46601.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FLAKY_Popup) {
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("popup/popup_main")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupFromInfobar) {
  CommandLine::ForCurrentProcess()->AppendSwitch(
    switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("popup/popup_from_infobar")) << message_;
}

// Copyright (c) 2009 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

// Times out. See http://crbug.com/46601.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Popup) {
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("popup/popup_main")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupFromInfobar) {
  CommandLine::ForCurrentProcess()->AppendSwitch(
    switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("popup/popup_from_infobar")) << message_;
}

Disable ExtensionApiTest.Popup. It's been timing out for the last 750+ runs.


#include "particle.h"

Particle::Particle(const Vector4D &p, const Vector4D &v) :
    position(p),
    velocity(v),
    lifetime(0) {
}

#include "particle.h"

Particle::Particle(const Vector4D &p, const Vector4D &v) :
    position(p),
    velocity(v),
    lifetime(-1) {
}

Set default lifetime to lt 0


#include "gamelib/core/res/SpriteResource.hpp"
#include "gamelib/core/res/ResourceManager.hpp"
#include "gamelib/utils/json.hpp"

namespace gamelib
{
    void registerSpriteLoader(ResourceManager& resmgr)
    {
        resmgr.registerFileType("spr", spriteLoader);
    }

    BaseResourceHandle spriteLoader(const std::string& fname, ResourceManager* resmgr)
    {
        Json::Value node;
        if (!loadJsonFromFile(fname, node))
            return nullptr;

        if (!node.isMember("texture"))
        {
            LOG_ERROR("No texture specified for sprite: ", fname);
            return nullptr;
        }

        auto sprite = SpriteResource::create();
        sprite->tex = resmgr->get(node["texture"].asString()).as<TextureResource>();

        math::Vec2f tmp;

        if (loadFromJson(node["framepos"], tmp))
            sprite->rect.pos = tmp;

        if (loadFromJson(node["framesize"], tmp))
            sprite->rect.size = tmp;

        if (loadFromJson(node["origin"], tmp))
            sprite->origin = tmp.asPoint();

        sprite->ani.length = node.get("length", 1).asInt();
        sprite->ani.speed = node.get("speed", 0).asFloat();
        sprite->ani.setIndex(node.get("offset", 0).asInt());

        return sprite.as<BaseResource>();
    }
}

#include "gamelib/core/res/SpriteResource.hpp"
#include "gamelib/core/res/ResourceManager.hpp"
#include "gamelib/utils/json.hpp"
#include "gamelib/utils/conversions.hpp"

namespace gamelib
{
    void registerSpriteLoader(ResourceManager& resmgr)
    {
        resmgr.registerFileType("spr", spriteLoader);
    }

    BaseResourceHandle spriteLoader(const std::string& fname, ResourceManager* resmgr)
    {
        Json::Value node;
        if (!loadJsonFromFile(fname, node))
            return nullptr;

        if (!node.isMember("texture"))
        {
            LOG_ERROR("No texture specified for sprite: ", fname);
            return nullptr;
        }

        auto sprite = SpriteResource::create();
        sprite->tex = resmgr->get(node["texture"].asString()).as<TextureResource>();

        math::Vec2f pos, size = convert(sprite->tex->getSize());
        loadFromJson(node["framepos"], pos);
        loadFromJson(node["framesize"], size);

        sprite->rect.pos = pos;
        sprite->rect.size = size;

        loadFromJson(node["origin"], sprite->origin);

        sprite->ani.length = node.get("length", 1).asInt();
        sprite->ani.speed = node.get("speed", 0).asFloat();
        sprite->ani.setIndex(node.get("offset", 0).asInt());

        return sprite.as<BaseResource>();
    }
}

Use texture size as sprite frame size if not given


#include "h264manager.h"

H264Manager::H264Manager()
{
    encodingParameters = "-c:v libx264 -preset ultrafast -f matroska";
}

void H264Manager::start(QProcess &process, QString file)
{
    QString command = "ffmpeg -re -i \"" + file + "\" -c:v libx264 -preset ultrafast -an -f matroska udp://localhost:" + ENCODED_VIDEO_PORT + " -c:v libx264 -preset ultrafast -an -f matroska udp://localhost:"  + VIDEO_PROBE_PORT;
    process.start(command.toUtf8().constData());
}

Remove extra functions from codec classes


#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);
    }
}

void enter_replace_insert_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;
        }
    }
}

#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);
    }
}

void enter_replace_insert_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;
        }
    }
}

Use parens to silence clang warnings


#include "gtest/gtest.h"
#include "hemi/launch.h"

HEMI_MEM_DEVICE int result;
HEMI_MEM_DEVICE int rGDim;
HEMI_MEM_DEVICE int rBDim;

template <typename... Arguments>
struct k {
	HEMI_DEV_CALLABLE_MEMBER void operator()(Arguments... args) {
		result = sizeof...(args);
		rGDim = 1;//gridDim.x;
		rBDim = 1;//blockDim.x;
	}
};

TEST(PortableLaunchTest, KernelFunction_AutoConfig) {
	k<int> kernel;
	hemi::launch(kernel, 1);
}

#include "gtest/gtest.h"
#include "hemi/launch.h"

HEMI_MEM_DEVICE int result;
HEMI_MEM_DEVICE int rGDim;
HEMI_MEM_DEVICE int rBDim;

template <typename T, typename... Arguments>
HEMI_DEV_CALLABLE
T first(T f, Arguments...) {
	return f;
}

template <typename... Arguments>
struct k {
	HEMI_DEV_CALLABLE_MEMBER void operator()(Arguments... args) {
		result = first(args...); //sizeof...(args);
		rGDim = 1;//gridDim.x;
		rBDim = 1;//blockDim.x;
	}
};

TEST(PortableLaunchTest, KernelFunction_AutoConfig) {
	k<int> kernel;
	hemi::launch(kernel, 1);
}

Work around gcc variadic arguments warning


class Solution {
public:
    // Backtracking
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<vector<int>> res;
        vector<int> sub;
        subsets(nums, sub, res, 0);
        return res;
    }

    void subsets(vector<int>& nums, vector<int>& sub, vector<vector<int>>& subs, int start) {
        subs.push_back(sub);
        for (int i = start; i < nums.size(); i++) {
            sub.push_back(nums[i]);
            subsets(nums, sub, subs, i + 1);
            sub.pop_back();
        }
    }

    // Iterative
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<vector<int>> res;
        vector<int> sub;
        res.push_back(sub);
        for (int i = 0; i < nums.size(); i++) {
            int size = res.size();
            for (int j = 0; j < size; j++) {
                res.push_back(res[j]);
                res.back().push_back(nums[i]);
            }
        }
        return res;
    }
};

class Solution {
public:
    // Backtracking
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<vector<int>> res;
        vector<int> sub;
        subsets(nums, sub, res, 0);
        return res;
    }

    void subsets(vector<int>& nums, vector<int>& sub, vector<vector<int>>& subs, int start) {
        subs.push_back(sub);
        for (int i = start; i < nums.size(); i++) {
            sub.push_back(nums[i]);
            subsets(nums, sub, subs, i + 1);
            sub.pop_back();
        }
    }

    // Iterative
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<vector<int>> res;
        vector<int> sub;
        res.push_back(sub);
        for (int i = 0; i < nums.size(); i++) {
            int size = res.size();
            for (int j = 0; j < size; j++) {
                res.push_back(res[j]);
                res.back().push_back(nums[i]);
            }
        }
        return res;
    }

    // Bit manipulation
    vector<vector<int>> subsets(vector<int>& nums) {
        int n = nums.size();
        int resSize = (int)pow(2, n);
        vector<vector<int>> res(resSize, vector<int>());
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < resSize; j++) {
                if ((j >> i) & 1) {
                    res[j].push_back(nums[i]);
                }
            }
        }
        return res;
    }
};

Add another solution for the problem


#include "ElevatorSubsystem.h"
#include "../RobotMap.h"

ElevatorSubsystem::ElevatorSubsystem() :
		Subsystem("ElevatorSubsystem"),
		pullMotorRight(PULL_MOTOR_RIGHT),pullMotorLeft(PULL_MOTOR_LEFT),
		underSwitch(UNDER_LIMIT),upSwitch(UP_LIMIT)
{

}

void ElevatorSubsystem::InitDefaultCommand()
{
	// Set the default command for a subsystem here.
	//SetDefaultCommand(new MySpecialCommand());
}

// Put methods for controlling this subsystem
// here. Call these from Commands.
void ElevatorSubsystem::DriveElevator(float pullSpeed){
	pullMotorLeft.Set(pullSpeed);
	pullMotorRight.Set(pullSpeed);
}

#include "ElevatorSubsystem.h"
#include "../RobotMap.h"

ElevatorSubsystem::ElevatorSubsystem() :
		Subsystem("ElevatorSubsystem"),
		pullMotorRight(PULL_MOTOR_RIGHT),pullMotorLeft(PULL_MOTOR_LEFT),
		underSwitch(UNDER_LIMIT),upSwitch(UP_LIMIT)
{

}

void ElevatorSubsystem::InitDefaultCommand()
{
	// Set the default command for a subsystem here.
	//SetDefaultCommand(new MySpecialCommand());
}

// Put methods for controlling this subsystem
// here. Call these from Commands.
void ElevatorSubsystem::DriveElevator(float pullSpeed){
	//if underSwitch is pushed and pullspeed is plus, elevator doesn't move
	//if upSwitch is pushed and pullspeed is minus, elevator doesn't move
	if(!(underSwitch.Get() && pullSpeed > 0) && !(upSwitch.Get() && pullSpeed < 0)){
		pullMotorLeft.Set(pullSpeed);
		pullMotorRight.Set(pullSpeed);
	}
}

Fix Elevator Subsystem limit swtich


/*
 * Copyright (c) 2011 by Michael Berlin, Zuse Institute Berlin
 *
 * Licensed under the BSD License, see LICENSE file for details.
 *
 */

#include "libxtreemfs/callback/execute_sync_request.h"

using namespace xtreemfs::rpc;
using namespace xtreemfs::util;

namespace xtreemfs {

boost::thread_specific_ptr<int> intr_pointer;

void InterruptSyncRequest(int signal) {
  if (Logging::log->loggingActive(LEVEL_DEBUG)) {
    Logging::log->getLog(LEVEL_DEBUG)
        << "INTERRUPT triggered, setting TLS pointer" << std::endl;
  }
  intr_pointer.reset(new int(0));
}

}  // namespace xtreemfs

/*
 * Copyright (c) 2011 by Michael Berlin, Zuse Institute Berlin
 *
 * Licensed under the BSD License, see LICENSE file for details.
 *
 */

#include "libxtreemfs/callback/execute_sync_request.h"

using namespace xtreemfs::rpc;
using namespace xtreemfs::util;

namespace xtreemfs {

/** The TLS pointer is set to != NULL if the current operation shall be
 *  interrupted. */
boost::thread_specific_ptr<int> intr_pointer(NULL);

/** Calling malloc() inside a signal handler is a really bad idea as there may
 *  occur a dead lock on the lock of the heap: that happens if a malloc is in
 *  progress, which already obtained a lock on the heap, and now a signal
 *  handler is called (and executed in the same thread) and also tries to
 *  execute malloc.
 *
 *  For this reason the TLS is filled with the address of a static integer
 *  instead of a new-ly created integer.
 */
int dummy_integer = 1;

void InterruptSyncRequest(int signal) {
  if (Logging::log->loggingActive(LEVEL_DEBUG)) {
    Logging::log->getLog(LEVEL_DEBUG)
        << "INTERRUPT triggered, setting TLS pointer" << std::endl;
  }
  intr_pointer.reset(&dummy_integer);
}

}  // namespace xtreemfs

Remove implicit malloc() from interruption signal handler to prevent a deadlock of the whole client.


// RUN: %clang -fsyntax-only -verify %s
// RUN: %clang -fsyntax-only -verify -fshort-wchar %s

#include <limits.h>

const bool swchar = (wchar_t)-1 > (wchar_t)0;

#ifdef __WCHAR_UNSIGNED__
int signed_test[!swchar];
#else
int signed_test[swchar];
#endif

int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar_t)-1)];
int min_test[WCHAR_MIN == (swchar ? 0 : -WCHAR_MAX-1)];

// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify %s
// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -fshort-wchar %s

#include <limits.h>

const bool swchar = (wchar_t)-1 > (wchar_t)0;

#ifdef __WCHAR_UNSIGNED__
int signed_test[!swchar];
#else
int signed_test[swchar];
#endif

int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar_t)-1)];
int min_test[WCHAR_MIN == (swchar ? 0 : -WCHAR_MAX-1)];

Use -ffreestanding with clang_cc1 to make the test picks the clang builtin include.


#include "DeclarativeUserInfo.hpp"

#include "Client.hpp"
#include "DataStorage.hpp"

namespace Telegram {

namespace Client {

DeclarativeUserInfo::DeclarativeUserInfo(QObject *parent) :
    DeclarativeClientOperator(parent)
{
}

void DeclarativeUserInfo::setContactId(quint32 contactId)
{
    if (m_contactId == contactId) {
        return;
    }
    m_contactId = contactId;
    emit contactIdChanged(contactId);

    updateDisplayName();
}

void DeclarativeUserInfo::setDisplayName(const QString &displayName)
{
    if (m_displayName == displayName) {
        return;
    }
    m_displayName = displayName;
    emit displayNameChanged(displayName);
}

void DeclarativeUserInfo::updateDisplayName()
{
    UserInfo info;
    client()->dataStorage()->getUserInfo(&info, m_contactId);
    setDisplayName(info.firstName());
}

} // Client

} // Telegram

#include "DeclarativeUserInfo.hpp"

#include "Client.hpp"
#include "DataStorage.hpp"

#include <QLoggingCategory>

Q_DECLARE_LOGGING_CATEGORY(c_qmlLoggingCategory)

namespace Telegram {

namespace Client {

DeclarativeUserInfo::DeclarativeUserInfo(QObject *parent) :
    DeclarativeClientOperator(parent)
{
}

void DeclarativeUserInfo::setContactId(quint32 contactId)
{
    if (m_contactId == contactId) {
        return;
    }
    m_contactId = contactId;
    emit contactIdChanged(contactId);

    updateDisplayName();
}

void DeclarativeUserInfo::setDisplayName(const QString &displayName)
{
    if (m_displayName == displayName) {
        return;
    }
    m_displayName = displayName;
    emit displayNameChanged(displayName);
}

void DeclarativeUserInfo::updateDisplayName()
{
    UserInfo info;
    if (!client()) {
        qCWarning(c_qmlLoggingCategory) << this << "Client not set!";
        return;
    }
    client()->dataStorage()->getUserInfo(&info, m_contactId);
    setDisplayName(info.firstName());
}

} // Client

} // Telegram

Print a warning if client is not set


// Test that LargeAllocator unpoisons memory before releasing it to the OS.
// RUN: %clangxx_asan %s -o %t
// The memory is released only when the deallocated chunk leaves the quarantine,
// otherwise the mmap(p, ...) call overwrites the malloc header.
// RUN: ASAN_OPTIONS=quarantine_size=1 %t

#include <assert.h>
#include <malloc.h>
#include <string.h>
#include <sys/mman.h>

int main() {
  const int kPageSize = 4096;
  void *p = memalign(kPageSize, 1024 * 1024);
  free(p);

  char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);
  assert(q == p);

  memset(q, 42, kPageSize);

  munmap(q, kPageSize);
  return 0;
}

// Test that LargeAllocator unpoisons memory before releasing it to the OS.
// RUN: %clangxx_asan %s -o %t
// The memory is released only when the deallocated chunk leaves the quarantine,
// otherwise the mmap(p, ...) call overwrites the malloc header.
// RUN: ASAN_OPTIONS=quarantine_size=1 %t

#include <assert.h>
#include <string.h>
#include <sys/mman.h>
#include <stdlib.h>

#ifdef __ANDROID__
#include <malloc.h>
void *my_memalign(size_t boundary, size_t size) {
  return memalign(boundary, size);
}
#else
void *my_memalign(size_t boundary, size_t size) {
  void *p;
  posix_memalign(&p, boundary, size);
  return p;
}
#endif

int main() {
  const int kPageSize = 4096;
  void *p = my_memalign(kPageSize, 1024 * 1024);
  free(p);

  char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);
  assert(q == p);

  memset(q, 42, kPageSize);

  munmap(q, kPageSize);
  return 0;
}

Fix one test on OSX.


/*********************************************************************************
 *
 * Inviwo - Interactive Visualization Workshop
 *
 * Copyright (c) 2013-2017 Inviwo Foundation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *********************************************************************************/

#include <inviwo/core/datastructures/spatialdata.h>

namespace inviwo {

template class IVW_CORE_API SpatialEntity<2>;
template class IVW_CORE_API SpatialEntity<3>;

} // namespace

/*********************************************************************************
 *
 * Inviwo - Interactive Visualization Workshop
 *
 * Copyright (c) 2013-2017 Inviwo Foundation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *********************************************************************************/

#include <inviwo/core/datastructures/spatialdata.h>

namespace inviwo {

template class SpatialEntity<2>;
template class SpatialEntity<3>;

} // namespace

Remove extraneous IVW_CORE_API in explicit template instantiation


/*
    Copyright (C) 2002 by Eric Sunshine <sunshine@sunshineco.com>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "cssysdef.h"
#include "csutil/sysfunc.h"
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>

csString csGetUsername()
{
  csString username;
  struct passwd const* r = getpwuid(getuid());
  if (r != 0)
    username = r->pw_name;
  username.Trim();
  return username;
}

/*
    Copyright (C) 2002 by Eric Sunshine <sunshine@sunshineco.com>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "cssysdef.h"
#include "csutil/sysfunc.h"
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include "csutil/csstring.h"

csString csGetUsername()
{
  csString username;
  struct passwd const* r = getpwuid(getuid());
  if (r != 0)
    username = r->pw_name;
  username.Trim();
  return username;
}

Build fix for unix (return type csSting incomplete). Hope it's correct...


// Copyright 2014 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 "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // WebKit now expects NaN as uninitialized/null Date.
  if (file_info.last_modified.is_null())
    web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
  else
    web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

// Copyright 2014 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 "content/child/file_info_util.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"

namespace content {

void FileInfoToWebFileInfo(const base::File::Info& file_info,
                           blink::WebFileInfo* web_file_info) {
  DCHECK(web_file_info);
  // WebKit now expects NaN as uninitialized/null Date.
  if (file_info.last_modified.is_null()) {
    web_file_info->modificationTime = std::numeric_limits<double>::quiet_NaN();
    web_file_info->modificationTimeMS =
        std::numeric_limits<double>::quiet_NaN();
  } else {
    web_file_info->modificationTime = file_info.last_modified.ToDoubleT();
    web_file_info->modificationTimeMS = file_info.last_modified.ToJsTime();
  }
  web_file_info->length = file_info.size;
  if (file_info.is_directory)
    web_file_info->type = blink::WebFileInfo::TypeDirectory;
  else
    web_file_info->type = blink::WebFileInfo::TypeFile;
}

static_assert(std::numeric_limits<double>::has_quiet_NaN,
              "should have quiet NaN");

}  // namespace content

Upgrade Blink to milliseconds-based last modified filetimes, part 2.


#include "Halide.h"

namespace {

class EdgeDetect : public Halide::Generator<EdgeDetect> {
public:
    ImageParam input{ UInt(8), 2, "input" };

    Func build() {
        Var x, y;

        Func clamped = Halide::BoundaryConditions::repeat_edge(input);

        // Gradients in x and y.
        Func gx("gx");
        Func gy("gy");
        gx(x, y) = (clamped(x + 1, y) - clamped(x - 1, y)) / 2;
        gy(x, y) = (clamped(x, y + 1) - clamped(x, y - 1)) / 2;

        Func result("result");

        result(x, y) = gx(x, y) * gx(x, y) + gy(x, y) * gy(x, y) + 128;

        // CPU schedule:
        //   Parallelize over scan lines, 4 scanlines per task.
        //   Independently, vectorize in x.
        result
            .parallel(y, 4)
            .vectorize(x, natural_vector_size(UInt(8)));

        return result;
    }
};

Halide::RegisterGenerator<EdgeDetect> register_edge_detect{ "edge_detect" };

}  // namespace

#include "Halide.h"

namespace {

class EdgeDetect : public Halide::Generator<EdgeDetect> {
public:
    ImageParam input{ UInt(8), 2, "input" };

    Func build() {
        Var x, y;

        Func clamped = Halide::BoundaryConditions::repeat_edge(input);

        // Gradients in x and y.
        Func gx("gx");
        Func gy("gy");
        gx(x, y) = cast<uint16_t>(clamped(x + 1, y)) - clamped(x - 1, y);
        gy(x, y) = cast<uint16_t>(clamped(x, y + 1)) - clamped(x, y - 1);

        Func result("result");

        result(x, y) = cast<uint8_t>(min(255, gx(x, y) * gx(x, y) + gy(x, y) * gy(x, y)));

        // CPU schedule:
        //   Parallelize over scan lines, 4 scanlines per task.
        //   Independently, vectorize in x.
        result
            .parallel(y, 4)
            .vectorize(x, natural_vector_size(UInt(8)));

        return result;
    }
};

Halide::RegisterGenerator<EdgeDetect> register_edge_detect{ "edge_detect" };

}  // namespace

Fix overflow bug in edge detector


#include "SubDocPropValueRenderer.h"
#include <rapidjson/document.h>
#include <glog/logging.h>

namespace sf1r
{
void SubDocPropValueRenderer::renderSubDocPropValue(
    const std::string& propName,
    const std::string& origText,
    izenelib::driver::Value& resourceValue)
{
    if (origText.empty())
        return;
    rapidjson::Document doc;
    doc.Parse<0>(origText.c_str());
    const rapidjson::Value& subDocs = doc;
    assert(subDocs.IsArray());
    for (rapidjson::Value::ConstValueIterator vit = subDocs.Begin();
            vit != subDocs.End(); vit++)
    {
        izenelib::driver::Value& subDoc = resourceValue();
        for (rapidjson::Value::ConstMemberIterator mit = vit->MemberBegin();
             mit != vit->MemberEnd(); mit++)
        {
            subDoc[mit->name.GetString()]=mit->value.GetString();
        }
    }
}
}

#include "SubDocPropValueRenderer.h"
#include <rapidjson/document.h>
#include <glog/logging.h>

namespace sf1r
{
void SubDocPropValueRenderer::renderSubDocPropValue(
    const std::string& propName,
    const std::string& origText,
    izenelib::driver::Value& resourceValue)
{
    if (origText.empty())
        return;
    rapidjson::Document doc;
    if (doc.Parse<0>(origText.c_str()).HasParseError());
    {
        return;
    }
    const rapidjson::Value& subDocs = doc;
    assert(subDocs.IsArray());
    for (rapidjson::Value::ConstValueIterator vit = subDocs.Begin();
            vit != subDocs.End(); vit++)
    {
        izenelib::driver::Value& subDoc = resourceValue();
        for (rapidjson::Value::ConstMemberIterator mit = vit->MemberBegin();
             mit != vit->MemberEnd(); mit++)
        {
            subDoc[mit->name.GetString()]=mit->value.GetString();
        }
    }
}
}

Add checker for illegal json string


#include <fstream>
#include <iostream>
#include "person.pb.h"
//#include "../pb2json.h"
#include <pb2json.h>

using namespace std;

int main(int argc,char *argv[])
{
	ifstream fin("dump",ios::binary);
	fin.seekg(0,ios_base::end);
	size_t len = fin.tellg();
	fin.seekg(0,ios_base::beg);
	char *buf = new char [len];

	fin.read(buf,len);
	Message *p = new Person();
	char *json = pb2json(p,buf,len);
	cout<<json<<endl;
	free(json);
	delete p;
	return 0;
}

#include <fstream>
#include <iostream>
#include "person.pb.h"
//#include "../pb2json.h"
#include <pb2json.h>

using namespace std;

int main(int argc,char *argv[])
{
 	// Test 1: read binary PB from a file and convert it to JSON
	ifstream fin("dump",ios::binary);
	fin.seekg(0,ios_base::end);
	size_t len = fin.tellg();
	fin.seekg(0,ios_base::beg);
	char *buf = new char [len];

	fin.read(buf,len);
	Message *p = new Person();
	char *json = pb2json(p,buf,len);
	cout<<json<<endl;
	free(json);
	delete p;

	// Test 2: convert PB to JSON directly
	Person p2;
	char *json2 = pb2json(p2);
	cout<<json2<<endl;
	free(json2);

	return 0;
}

Add unit test for new wrapper call.


#include <QtTest/QtTest>
#include <gui/input.h>

class TestInput: public QObject
{
	Q_OBJECT
private slots:
	void specialKeys();
private:
	NeovimQt::InputConv input;
};

void TestInput::specialKeys()
{
	foreach(int k, input.specialKeys.keys()) {
		QCOMPARE(input.convertKey("", k, Qt::NoModifier),
			QString("<%1>").arg(input.specialKeys.value(k)));

		QCOMPARE(input.convertKey("", k, Qt::ControlModifier),
#ifdef Q_OS_MAC
			// On Mac Control is actually the Cmd key, which we
			// don't support yet
			QString("<%1>").arg(input.specialKeys.value(k)));
#else
			QString("<C-%1>").arg(input.specialKeys.value(k)));
#endif

		QCOMPARE(input.convertKey("", k, Qt::AltModifier),
			QString("<A-%1>").arg(input.specialKeys.value(k)));

		QCOMPARE(input.convertKey("", k, Qt::MetaModifier),
#ifdef Q_OS_MAC
			// On Mac Meta is actually the Control key
			QString("<C-%1>").arg(input.specialKeys.value(k)));
#else
			// Meta is not handled right now
			QString("<%1>").arg(input.specialKeys.value(k)));
#endif
	}
}

QTEST_MAIN(TestInput)
#include "tst_input.moc"

#include <QtTest/QtTest>
#include <gui/input.h>

class TestInput: public QObject
{
	Q_OBJECT
private slots:
	void specialKeys();
private:
	NeovimQt::InputConv input;
};

void TestInput::specialKeys()
{
	foreach(int k, input.specialKeys.keys()) {
		QCOMPARE(input.convertKey("", k, Qt::NoModifier),
			QString("<%1>").arg(input.specialKeys.value(k)));

		QCOMPARE(input.convertKey("", k, Qt::ControlModifier),
#ifdef Q_OS_MAC
			// On Mac Control is actually the Cmd key, which we
			// don't support yet
			QString("<D-%1>").arg(input.specialKeys.value(k)));
#else
			QString("<C-%1>").arg(input.specialKeys.value(k)));
#endif

		QCOMPARE(input.convertKey("", k, Qt::AltModifier),
			QString("<A-%1>").arg(input.specialKeys.value(k)));

		QCOMPARE(input.convertKey("", k, Qt::MetaModifier),
#ifdef Q_OS_MAC
			// On Mac Meta is actually the Control key
			QString("<C-%1>").arg(input.specialKeys.value(k)));
#else
			// Meta is not handled right now
			QString("<%1>").arg(input.specialKeys.value(k)));
#endif
	}
}

QTEST_MAIN(TestInput)
#include "tst_input.moc"

Fix input test on Mac for ControlModifier


// RUN: clang-cc -fsyntax-only -verify %s
// XFAIL: *

class C {
public:
  C(int a, int b);
};

C::C(int a, // expected-note {{previous definition}}
     int b) // expected-note {{previous definition}}
try {
  int c;

} catch (int a) { // expected-error {{redefinition of 'a'}}
  int b; // expected-error {{redefinition of 'b'}}
  ++c; // expected-error {{use of undeclared identifion 'c'}}
}

// RUN: clang-cc -fsyntax-only -verify %s
// XFAIL: *

class C {
public:
  C(int a, int b);
};

C::C(int a, // expected-note {{previous definition}}
     int b) // expected-note {{previous definition}}
try {
  int c;

} catch (int a) { // expected-error {{redefinition of 'a'}}
  int b; // expected-error {{redefinition of 'b'}}
  ++c; // expected-error {{use of undeclared identifier 'c'}}
}

Tweak expected error message, although we still fail this test


// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o -

// FIXME: Don't assert for non-Win32 triples (PR18251).
// RUN: %clang_cc1 -triple i686-pc-win32 -fno-rtti -emit-llvm %s -o -

struct A {
  virtual void Method() = 0;
};

struct B : public A {
  virtual void Method() { }
};

typedef void (A::*fn_type_a)(void);
typedef void (B::*fn_type_b)(void);

int main(int argc, char **argv)
{
  fn_type_a f = reinterpret_cast<fn_type_a>(&B::Method);
  fn_type_b g = reinterpret_cast<fn_type_b>(f);
  B b;
  (b.*g)();
  return 0;
}

// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o -
// RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm %s -o -

struct A {
  virtual void Method() = 0;
};

struct B : public A {
  virtual void Method() { }
};

typedef void (A::*fn_type_a)(void);
typedef void (B::*fn_type_b)(void);

int main(int argc, char **argv)
{
  fn_type_a f = reinterpret_cast<fn_type_a>(&B::Method);
  fn_type_b g = reinterpret_cast<fn_type_b>(f);
  B b;
  (b.*g)();
  return 0;
}

Remove FIXME and hardcoded triple from this test (PR18251)


#include <fabric/dataCore.hpp>

fabric::DataCore::DataCore()
{
	camPos.x = 0;
	camPos.y = 1;
	camPos.z = 0;

}

#include <fabric/dataCore.hpp>

fabric::DataCore::DataCore()
{
	camPos.x = 0;
	camPos.y = 0;
	camPos.z = 0;

}

Set cam pos to (0, 0, 0)


#include <monsoon/history/collect_history.h>

namespace monsoon {

collect_history::~collect_history() noexcept {}

std::size_t collect_history::metrics_hash::operator()(
    const std::tuple<group_name, metric_name>& t) const noexcept {
  return std::hash<group_name>()(std::get<0>(t));
}

std::size_t collect_history::metrics_hash::operator()(
    const std::tuple<simple_group, metric_name>& t) const noexcept {
  return std::hash<simple_group>()(std::get<0>(t));
}

} /* namespace monsoon */

#include <monsoon/history/collect_history.h>

namespace monsoon {

collect_history::~collect_history() noexcept {}

std::size_t collect_history::metrics_hash::operator()(
    const std::tuple<group_name, metric_name>& t) const noexcept {
  return std::hash<group_name>()(std::get<0>(t))
      ^ std::hash<metric_name>()(std::get<1>(t));
}

std::size_t collect_history::metrics_hash::operator()(
    const std::tuple<simple_group, metric_name>& t) const noexcept {
  return std::hash<simple_group>()(std::get<0>(t))
      ^ std::hash<metric_name>()(std::get<1>(t));
}

} /* namespace monsoon */

Strengthen hash function for (un)tagged metric name lookups.


// Compile with -O3 -march=native to see autovectorization
typedef double * __attribute__((aligned(64))) aligned_double;

void maxArray(aligned_double __restrict x, aligned_double __restrict y) {
    for (int i = 0; i < 65536; i++) {
        x[i] = ((y[i] > x[i]) ? y[i] : x[i]);
    }
}

// Compile with -O3 -march=native to see autovectorization
typedef double *__attribute__((aligned(64))) aligned_double;

void maxArray(aligned_double __restrict x, aligned_double __restrict y) {
    for (int i = 0; i < 65536; i++) {
        x[i] = ((y[i] > x[i]) ? y[i] : x[i]);
    }
}

Fix max array opt version


#include <QFile>

#include "ArchiveModel.hh"
#include "ArchiveListItemWidget.hh"
#include "ui_ArchiveListItemWidget.h"

#include "HumanReadableSize.hh"

ArchiveListItemWidget::ArchiveListItemWidget(QWidget *parent)
:
    QWidget(parent),
    d_ui(QSharedPointer<Ui::ArchiveListItemWidget>(new Ui::ArchiveListItemWidget()))
{
    d_ui->setupUi(this);
}

ArchiveListItemWidget::~ArchiveListItemWidget()
{
    // declared here to generate QSharedPointer destructor where Ui::ArchiveListItemWidget is known.
}

void ArchiveListItemWidget::setArchiveEntry(ArchiveEntry const &entry)
{
    d_ui->nameLabel->setText(entry.name);
    d_ui->descriptionLabel->setText(entry.description);

    d_ui->sizeLabel->setText(humanReadableSize(entry.size));

    d_ui->downloadedLabel->setVisible(entry.existsLocally());
}

#include <QFile>

#include "ArchiveModel.hh"
#include "ArchiveListItemWidget.hh"
#include "ui_ArchiveListItemWidget.h"

#include "HumanReadableSize.hh"

ArchiveListItemWidget::ArchiveListItemWidget(QWidget *parent)
:
    QWidget(parent),
    d_ui(QSharedPointer<Ui::ArchiveListItemWidget>(new Ui::ArchiveListItemWidget()))
{
    d_ui->setupUi(this);
}

ArchiveListItemWidget::~ArchiveListItemWidget()
{
    // declared here to generate QSharedPointer destructor where Ui::ArchiveListItemWidget is known.
}

void ArchiveListItemWidget::setArchiveEntry(ArchiveEntry const &entry)
{
    d_ui->nameLabel->setText(entry.name);
    d_ui->descriptionLabel->setText(entry.description);

    d_ui->sizeLabel->setText(humanReadableSize(entry.size));
    d_ui->sizeLabel->setVisible(!entry.existsLocally());

    d_ui->downloadedLabel->setVisible(entry.existsLocally());
}

Hide download size if file is already downloaded.


// Copyright (c) 2011 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
#define MAYBE_Infobars Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

// Copyright (c) 2011 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS)
#define MAYBE_Infobars Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
// Also disabled on mac.  See http://crbug.com/60990.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

Disable ExtensionApiTest.Infobars on Mac, as it is flaky.


#include <sdf/sdf.hh>
#include "gazebo/gazebo.hh"
#include "gazebo/common/Plugin.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/transport/transport.hh"
#include <iostream>

using namespace std;

namespace gazebo
{
  class SetupWorld : public WorldPlugin
  {
    public: void Load(physics::WorldPtr _parent, sdf::ElementPtr _sdf)
    {
      cout << "Setting up world..." << flush;

      // Create a new transport node
      transport::NodePtr node(new transport::Node());

      // Initialize the node with the world name
      node->Init(_parent->GetName());

      // Create a publisher on the ~/physics topic
      transport::PublisherPtr physicsPub =
        node->Advertise<msgs::Physics>("~/physics");

      msgs::Physics physicsMsg;
      physicsMsg.set_type(msgs::Physics::ODE);

      // Set the step time
      physicsMsg.set_max_step_size(0.001);

      // Set the real time update rate
      physicsMsg.set_real_time_update_rate(1000.0);

      // Change gravity
      //msgs::Set(physicsMsg.mutable_gravity(), math::Vector3(0.01, 0, 0.1));

      physicsPub->Publish(physicsMsg);

      cout << " done." << endl;
    }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_WORLD_PLUGIN(SetupWorld)
}

#include <sdf/sdf.hh>
#include "gazebo/gazebo.hh"
#include "gazebo/common/Plugin.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/transport/transport.hh"
#include <iostream>

using namespace std;

namespace gazebo
{
  class SetupWorld : public WorldPlugin
  {
    public: void Load(physics::WorldPtr _parent, sdf::ElementPtr _sdf)
    {
      cout << "Setting up world..." << flush;

      // Create a new transport node
      transport::NodePtr node(new transport::Node());

      // Initialize the node with the world name
      node->Init(_parent->GetName());

      // Create a publisher on the ~/physics topic
      transport::PublisherPtr physicsPub =
        node->Advertise<msgs::Physics>("~/physics");

      msgs::Physics physicsMsg;
      physicsMsg.set_type(msgs::Physics::ODE);

      // Set the step time
      physicsMsg.set_max_step_size(0.001);

      // Set the real time update rate
      physicsMsg.set_real_time_update_rate(0);

      // Change gravity
      //msgs::Set(physicsMsg.mutable_gravity(), math::Vector3(0.01, 0, 0.1));

      physicsPub->Publish(physicsMsg);

      cout << " done." << endl;
    }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_WORLD_PLUGIN(SetupWorld)
}

Allow the sim to run full speed


/*
 * Copyright 2016 - 2018 gtalent2@gmail.com
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <ox/fs/filesystem.hpp>
#include <ox/std/std.hpp>

#include "../media.hpp"

namespace nostalgia {
namespace core {

uint8_t *loadRom(const char*) {
	return nullptr;
}

}
}

/*
 * Copyright 2016 - 2018 gtalent2@gmail.com
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <ox/fs/fs.hpp>
#include <ox/std/std.hpp>

#include "../media.hpp"

namespace nostalgia {
namespace core {

uint8_t *loadRom(const char*) {
	return nullptr;
}

}
}

Fix FS refactor build issue


// Petter Strandmark 2013.
#include <map>
#include <stdexcept>
#include <vector>

#include <spii/term_factory.h>

using namespace std;

namespace spii
{

class TermFactory::Implementation
{
public:
	map<string, TermCreator> creators;
};

TermFactory::TermFactory() :
	impl(new TermFactory::Implementation)
{
}

Term* TermFactory::create(const std::string& term_name,
                          std::istream& in) const
{
	auto creator = impl->creators.find(fix_name(term_name));
	if (creator == impl->creators.end()) {
		std::string msg = "TermFactory::create: Unknown Term ";
		msg += term_name;
		throw runtime_error(msg.c_str());
	}
	return creator->second(in);
}

void TermFactory::teach_term(const std::string& term_name, const TermCreator& creator)
{
	impl->creators[fix_name(term_name)] = creator;
}

std::string TermFactory::fix_name(const std::string& org_name)
{
	std::string name = org_name;
	std::replace(std::begin(name), std::end(name), ' ', '-');
	return name;
}

}

// Petter Strandmark 2013.
#include <map>
#include <stdexcept>
#include <vector>

#include <spii/term_factory.h>

using namespace std;

namespace spii
{

class TermFactory::Implementation
{
public:
	map<string, TermCreator> creators;
};

TermFactory::TermFactory() :
	impl(new TermFactory::Implementation)
{
}

Term* TermFactory::create(const std::string& term_name,
                          std::istream& in) const
{
	auto creator = impl->creators.find(fix_name(term_name));
	if (creator == impl->creators.end()) {
		std::string msg = "TermFactory::create: Unknown Term ";
		msg += term_name;
		throw runtime_error(msg.c_str());
	}
	return creator->second(in);
}

void TermFactory::teach_term(const std::string& term_name, const TermCreator& creator)
{
	impl->creators[fix_name(term_name)] = creator;
}

std::string TermFactory::fix_name(const std::string& org_name)
{
	std::string name = org_name;
	std::replace(name.begin(), name.end(), ' ', '-');
	return name;
}

}

Use the member functions begin and end.


// Copyright (c) 2010 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS)
#define MAYBE_Infobars Infobars
#elif defined(OS_MACOSX)
// Temporarily marking as FAILS. See http://crbug.com/60990 for details.
#define MAYBE_Infobars FAILS_Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

// Copyright (c) 2010 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/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
#define MAYBE_Infobars Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

Revert 64157 - Marking ExtensionApiTest.Infobars as FAILS until 10.5 issue is resolved. Reverting in order to create a proper CL for it. BUG=60990


// Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h"

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Storage) {
  ASSERT_TRUE(RunExtensionTest("storage")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
  ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
}

// Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h"

#if defined(OS_LINUX)
// See http://crbug.com/42943.
#define MAYBE_Storage FLAKY_Storage
#else
#define MAYBE_Storage Storage
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Storage) {
  ASSERT_TRUE(RunExtensionTest("storage")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
  ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
}

Mark ExtensionApiTest.Storage as flaky. BUG=42943 TEST=none TBR=rafaelw


// Copyright (c) 2006-2008 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 "config.h"

#include "webkit/glue/resource_loader_bridge.h"

#include "net/http/http_response_headers.h"

namespace webkit_glue {

ResourceLoaderBridge::ResponseInfo::ResponseInfo() {
  content_length = -1;
#if defined(OS_WIN)
  response_data_file = base::kInvalidPlatformFileValue;
#elif defined(OS_POSIX)
  response_data_file.fd = base::kInvalidPlatformFileValue;
  response_data_file.auto_close = false;
#endif
}

ResourceLoaderBridge::ResponseInfo::~ResponseInfo() {
}

ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() {
}

ResourceLoaderBridge::SyncLoadResponse::~SyncLoadResponse() {
}

ResourceLoaderBridge::ResourceLoaderBridge() {
}

ResourceLoaderBridge::~ResourceLoaderBridge() {
}

}  // namespace webkit_glue

// Copyright (c) 2006-2008 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 "config.h"

#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/webappcachecontext.h"

#include "net/http/http_response_headers.h"

namespace webkit_glue {

ResourceLoaderBridge::ResponseInfo::ResponseInfo() {
  content_length = -1;
  app_cache_id = WebAppCacheContext::kNoAppCacheId;
#if defined(OS_WIN)
  response_data_file = base::kInvalidPlatformFileValue;
#elif defined(OS_POSIX)
  response_data_file.fd = base::kInvalidPlatformFileValue;
  response_data_file.auto_close = false;
#endif
}

ResourceLoaderBridge::ResponseInfo::~ResponseInfo() {
}

ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() {
}

ResourceLoaderBridge::SyncLoadResponse::~SyncLoadResponse() {
}

ResourceLoaderBridge::ResourceLoaderBridge() {
}

ResourceLoaderBridge::~ResourceLoaderBridge() {
}

}  // namespace webkit_glue

Fix an issue found by purify with my previous submission.


#include "cvd/utility.h"

namespace CVD
{
	void differences(const float* a, const float* b, float* diff, unsigned int size)
	{
		differences<float, float>(a, b, diff, size);
	}

	void add_multiple_of_sum(const float* a, const float* b, const float& c,  float* out, unsigned int count)
	{
		add_multiple_of_sum<float, float>(a, b, c, out, count);
	}

	void assign_multiple(const float* a, const float& c,  float* out, unsigned int count)
	{
		assign_multiple<float, float, float>(a, c, out, count);
	}

	double inner_product(const float* a, const float* b, unsigned int count)
	{
		return inner_product<float>(a, b, count);
	}

	double sum_squared_differences(const float* a, const float* b, size_t count)
	{
      return SumSquaredDifferences<double, float,float>::sum_squared_differences(a,b,count);
	}

	void square(const float* in, float* out, size_t count)
	{
		square<float, float>(in, out, count);
	}

	void subtract_square(const float* in, float* out, size_t count)
	{
		subtract_square<float, float>(in, out, count);
	}
}

#include "cvd/utility.h"

namespace CVD
{
	void differences(const float* a, const float* b, float* diff, unsigned int size)
	{
		differences<float, float>(a, b, diff, size);
	}

	void add_multiple_of_sum(const float* a, const float* b, const float& c,  float* out, size_t count)
	{
		add_multiple_of_sum<float, float>(a, b, c, out, count);
	}

	void assign_multiple(const float* a, const float& c,  float* out, unsigned int count)
	{
		assign_multiple<float, float, float>(a, c, out, count);
	}

	double inner_product(const float* a, const float* b, unsigned int count)
	{
		return inner_product<float>(a, b, count);
	}

	double sum_squared_differences(const float* a, const float* b, size_t count)
	{
      return SumSquaredDifferences<double, float,float>::sum_squared_differences(a,b,count);
	}

	void square(const float* in, float* out, size_t count)
	{
		square<float, float>(in, out, count);
	}

	void subtract_square(const float* in, float* out, size_t count)
	{
		subtract_square<float, float>(in, out, count);
	}
}

Fix compiler error on OSX PPC: fix definition to match header.


// Copyright (c) 2016-2017 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#include <clocale>
#include <cstdio>

#include "test.hpp"

namespace tao
{
   namespace TAOCPP_PEGTL_NAMESPACE
   {
      struct file_content : seq< TAOCPP_PEGTL_STRING( "dummy content" ), eol, discard >
      {
      };

      struct file_grammar : seq< rep_min_max< 11, 11, file_content >, eof >
      {
      };

      void unit_test()
      {
         const char* const filename = "src/test/pegtl/file_data.txt";
#if defined( _MSC_VER )
         std::FILE* stream;
         ::fopen_s( &stream, filename, "rb" );
#else
         std::FILE* stream = std::fopen( filename, "rb" );
#endif
         TAOCPP_PEGTL_TEST_ASSERT( stream != nullptr );
         TAOCPP_PEGTL_TEST_ASSERT( parse< file_grammar >( cstream_input<>( stream, 16, filename ) ) );
         std::fclose( stream );
      }

   }  // namespace TAOCPP_PEGTL_NAMESPACE

}  // namespace tao

#include "main.hpp"

// Copyright (c) 2016-2017 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#include <clocale>
#include <cstdio>

#include "test.hpp"

namespace tao
{
   namespace TAOCPP_PEGTL_NAMESPACE
   {
      struct file_content : seq< TAOCPP_PEGTL_STRING( "dummy content" ), eol, discard >
      {
      };

      struct file_grammar : seq< rep_min_max< 11, 11, file_content >, eof >
      {
      };

      void unit_test()
      {
         const char* const filename = "src/test/pegtl/file_data.txt";
#if defined( _MSC_VER )
         std::FILE* stream;
         ::fopen_s( &stream, filename, "rb" );  // NOLINT
#else
         std::FILE* stream = std::fopen( filename, "rb" );  // NOLINT
#endif
         TAOCPP_PEGTL_TEST_ASSERT( stream != nullptr );
         TAOCPP_PEGTL_TEST_ASSERT( parse< file_grammar >( cstream_input<>( stream, 16, filename ) ) );
         std::fclose( stream );
      }

   }  // namespace TAOCPP_PEGTL_NAMESPACE

}  // namespace tao

#include "main.hpp"

Mark lines as NOLINT for clang-tidy


// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include "SearchResultSectionOrder.h"

#include "SearchResultModel.h"
#include "SearchVendorNames.h"

namespace ExampleApp
{
    namespace SearchResultSection
    {
        namespace View
        {
            bool SearchResultSectionOrder::operator() (const Search::SdkModel::SearchResultModel& a, const Search::SdkModel::SearchResultModel& b)
            {
                //GeoNames results on top
                if(a.GetVendor() != b.GetVendor() && a.GetVendor() == Search::GeoNamesVendorName)
                {
                        return true;
                }
                //Order GeoNames results as they came in
                if(a.GetVendor() == Search::GeoNamesVendorName || b.GetVendor() == Search::GeoNamesVendorName)
                {
                    return false;
                }
                return a < b;
            }
        }
    }
}

// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include <limits>
#include <map>

#include "SearchResultSectionOrder.h"

#include "SearchResultModel.h"
#include "SearchVendorNames.h"

namespace ExampleApp
{
    namespace SearchResultSection
    {
        namespace View
        {
            namespace
            {
                int VendorPriority(const std::string& vendor)
                {
                    const int HighestPriority = std::numeric_limits<int>::max();
                    enum AscendingVendorPriority {
                        EegeoVendorPriority,
                        YelpVendorPriority,
                        GeoNamesVendorPriority
                    };

                    static const std::map<std::string, int> vendorPriorities{
                        {Search::EegeoVendorName,    EegeoVendorPriority},
                        {Search::YelpVendorName,     YelpVendorPriority},
                        {Search::GeoNamesVendorName, GeoNamesVendorPriority}};

                    const std::map<std::string, int>::const_iterator vendorIx = vendorPriorities.find(vendor);
                    return vendorIx != vendorPriorities.end()
                        ? vendorIx->second
                        : HighestPriority;
                }
            }

            bool SearchResultSectionOrder::operator() (const Search::SdkModel::SearchResultModel& a, const Search::SdkModel::SearchResultModel& b)
            {
                return VendorPriority(a.GetVendor()) < VendorPriority(b.GetVendor());
            }
        }
    }
}

Order search result display order by vendor to more closely match web results. Buddy: Blair.


// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 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 <util/validation.h>

#include <consensus/validation.h>
#include <tinyformat.h>

/** Convert ValidationState to a human-readable message for logging */
std::string FormatStateMessage(const ValidationState &state) {
    return strprintf(
        "%s%s (code %i)", state.GetRejectReason(),
        state.GetDebugMessage().empty() ? "" : ", " + state.GetDebugMessage(),
        state.GetRejectCode());
}

const std::string strMessageMagic = "Bitcoin Signed Message:\n";

// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 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 <util/validation.h>

#include <consensus/validation.h>
#include <tinyformat.h>

std::string FormatStateMessage(const ValidationState &state) {
    if (state.IsValid()) {
        return "Valid";
    }

    const std::string debug_message = state.GetDebugMessage();
    if (!debug_message.empty()) {
        return strprintf("%s, %s (code %i)", state.GetRejectReason(),
                         debug_message, state.GetRejectCode());
    }

    return strprintf("%s (code %i)", state.GetRejectReason(),
                     state.GetRejectCode());
}

const std::string strMessageMagic = "Bitcoin Signed Message:\n";

Refactor FormatStateMessage() to better match Core


#include <iostream>

#include <qimessaging/signature.hpp>

//sample foo function to take the signature from
int foo(int a, int b)
{
  return a + b + 42;
}

int main()
{
  //wrapper arround signature, to create the signature of a function with it's name
  std::string signature;

  signature = qi::makeFunctionSignature("foo", &foo);
  std::cout << "function signature should be      : foo::i:ii" << std::endl;
  std::cout << "function signature                : " << signature << std::endl;
  std::cout << "Pretty printed function signature : " << qi::signatureToString(signature) << std::endl;

  return 0;
}

#include <iostream>
#include <qimessaging/signature.hpp>

//sample foo function to take the signature from
int foo(int a, int b)
{
  return a + b + 42;
}

int main()
{
  //wrapper arround signature, to create the signature of a function with it's name
  std::string signature;

  signature = qi::makeFunctionSignature("foo", &foo);
  std::cout << "function signature should be      : foo::i(ii)" << std::endl;
  std::cout << "function signature                : " << signature << std::endl;
  std::cout << "Pretty printed function signature : " << qi::signatureToString(signature) << std::endl;

  return 0;
}

Update function example for foo::i(ii), instead of foo::i:ii


// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=1
// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=2
// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=3

struct A { int a; };

#if N == 1
// ChooseExpr
template<class T> void test(int (&)[sizeof(__builtin_choose_expr(true, 1, 1), T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(int)]);

#elif N == 2
// CompoundLiteralExpr
template<class T> void test(int (&)[sizeof((A){}, T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(A)]);

#elif N == 3
// DesignatedInitExpr
template<class T> void test(int (&)[sizeof(A{.a = 10}, T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(A)]);

// FIXME: There are several more cases we can't yet mangle.

#else
#error unknown N
#endif

// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1
// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2
// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=3

struct A { int a; };

#if N == 1
// ChooseExpr
template<class T> void test(int (&)[sizeof(__builtin_choose_expr(true, 1, 1), T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(int)]);

#elif N == 2
// CompoundLiteralExpr
template<class T> void test(int (&)[sizeof((A){}, T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(A)]);

#elif N == 3
// DesignatedInitExpr
template<class T> void test(int (&)[sizeof(A{.a = 10}, T())]) {} // expected-error {{cannot yet mangle}}
template void test<int>(int (&)[sizeof(A)]);

// FIXME: There are several more cases we can't yet mangle.

#else
#error unknown N
#endif

Fix test to specify an Itanium triple.


#include "stdafx.h"
#include "AudioDeviceWrapper.h"
#include "DefSoundException.h"

using namespace System;

bool AudioEndPointControllerWrapper::AudioDeviceWrapper::Equals(Object ^ o)
{
    if (o == (Object^)nullptr)
        return false;

    if(o->GetType() != this->GetType())
    {
        return false;
    }

    AudioDeviceWrapper^ that = static_cast<AudioDeviceWrapper^>(o);
    return that->Id == Id;
}

int AudioEndPointControllerWrapper::AudioDeviceWrapper::GetHashCode()
{
    return this->Id->GetHashCode();
}

void AudioEndPointControllerWrapper::AudioDeviceWrapper::SetAsDefault(Role role)
{
	try
	{
		_audioDevice->SetDefault(static_cast<::ERole>(role));
	}
	catch (DefSound::CNotActiveError error)
	{
		throw gcnew DefSoundNotActiveException(error);
	}
	catch(DefSound::CError error)
	{
		throw gcnew DefSoundException(error);
	}
}

bool AudioEndPointControllerWrapper::AudioDeviceWrapper::IsDefault(Role role)
{
	try
	{
		return _audioDevice->IsDefault(static_cast<::ERole>(role));
	}
	catch (DefSound::CNotActiveError error)
	{
		throw gcnew DefSoundNotActiveException(error);
	}
	catch (DefSound::CError error)
	{
		throw gcnew DefSoundException(error);
	}
}

#include "stdafx.h"
#include "AudioDeviceWrapper.h"
#include "Audio.EndPoint.Controller.Wrapper.h"
#include "DefSoundException.h"

using namespace System;

namespace AudioEndPointControllerWrapper {
    bool AudioDeviceWrapper::Equals(Object ^ o)
    {
        if (o == (Object^)nullptr)
            return false;

        if (o->GetType() != this->GetType())
        {
            return false;
        }

        AudioDeviceWrapper^ that = static_cast<AudioDeviceWrapper^>(o);
        return that->Id == Id;
    }

    int AudioDeviceWrapper::GetHashCode()
    {
        return this->Id->GetHashCode();
    }

    void AudioDeviceWrapper::SetAsDefault(Role role)
    {
        try
        {
            _audioDevice->SetDefault(static_cast<::ERole>(role));
            if (!AudioController::IsNotificationAvailable())
            {
                AudioController::RaiseDefault(gcnew DeviceDefaultChangedEvent(this, role));
            }
        }
        catch (DefSound::CNotActiveError error)
        {
            throw gcnew DefSoundNotActiveException(error);
        }
        catch (DefSound::CError error)
        {
            throw gcnew DefSoundException(error);
        }
    }

    bool AudioDeviceWrapper::IsDefault(Role role)
    {
        try
        {
            return _audioDevice->IsDefault(static_cast<::ERole>(role));
        }
        catch (DefSound::CNotActiveError error)
        {
            throw gcnew DefSoundNotActiveException(error);
        }
        catch (DefSound::CError error)
        {
            throw gcnew DefSoundException(error);
        }
    }
}

Make the device check for the presence of the NotificationClient In case it's not present, raise the event of change of default


#include <string>
#include <vector>
#include <unistd.h>
#include <gtest/gtest.h>
#include <scxcorelib/scxstrencodingconv.h>
#include "getusername.h"

using std::string;
using std::vector;
using SCXCoreLib::Utf16leToUtf8;

TEST(GetUserName,simple)
{
	// allocate a WCHAR_T buffer to receive username
	DWORD lpnSize = 64;
	WCHAR_T lpBuffer[lpnSize];

	BOOL result = GetUserName(lpBuffer, &lpnSize);

	// GetUserName returns 1 on success
	ASSERT_EQ(1, result);

	// get expected username
	string username = string(getlogin());

	// GetUserName sets lpnSize to length of username including null
	ASSERT_EQ(username.size()+1, lpnSize);

	// copy UTF-16 bytes from lpBuffer to vector for conversion
	vector<unsigned char> input(reinterpret_cast<unsigned char *>(&lpBuffer[0]),
	                            reinterpret_cast<unsigned char *>(&lpBuffer[lpnSize-1]));
	// convert to UTF-8 for assertion
	string output;
	Utf16leToUtf8(input, output);

	EXPECT_EQ(username, output);
}

#include <string>
#include <vector>
#include <unistd.h>
#include <gtest/gtest.h>
#include <scxcorelib/scxstrencodingconv.h>
#include "getusername.h"

using std::string;
using std::vector;
using SCXCoreLib::Utf16leToUtf8;

TEST(GetUserName,simple)
{
	// allocate a WCHAR_T buffer to receive username
	DWORD lpnSize = 64;
	WCHAR_T lpBuffer[lpnSize];

	BOOL result = GetUserName(lpBuffer, &lpnSize);

	// GetUserName returns 1 on success
	ASSERT_EQ(1, result);

	// get expected username
	string username = string(getlogin());

	// GetUserName sets lpnSize to length of username including null
	ASSERT_EQ(username.size()+1, lpnSize);

	// copy UTF-16 bytes (excluding null) from lpBuffer to vector for conversion
	unsigned char *begin = reinterpret_cast<unsigned char *>(&lpBuffer[0]);
	// -1 to skip null; *2 because UTF-16 encodes two bytes per character
	unsigned char *end = begin + (lpnSize-1)*2;
	vector<unsigned char> input(begin, end);
	// convert to UTF-8 for assertion
	string output;
	Utf16leToUtf8(input, output);

	EXPECT_EQ(username, output);
}

Clarify lpBuffer layout in GetUserName unit test


#include <iostream>
#include <string>

#include "ace/INET_Addr.h"
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Stream.h"
#include "ace/SOCK_Acceptor.h"

#include "ace/Acceptor.h"

#include "ace/Reactor.h"

#include "AndroidServiceHandler.h"

using namespace std;

int main(int argc, char **argv) {
  cout << "Creating acceptor..." << endl;

  //TODO: make interface and port number specifiable on the command line
  ACE_INET_Addr serverAddress(32869, "0.0.0.0");

  cout << "Listening on port " << serverAddress.get_port_number() << " on interface " << serverAddress.get_host_addr() << endl;

  //Creates and opens the socket acceptor; registers with the singleton ACE_Reactor
  //for accept events
  ACE_Acceptor<AndroidServiceHandler, ACE_SOCK_Acceptor> acceptor(serverAddress);

  //Get the process-wide ACE_Reactor (the one the acceptor should have registered with)
  ACE_Reactor *reactor = ACE_Reactor::instance();
  cout << "Starting event loop..." << endl << flush;
  reactor->run_reactor_event_loop();
}

#include <iostream>
#include <string>

#include "ace/Reactor.h"

#include "GatewayConnector/GatewayConnector.h"

using namespace std;

int main(int argc, char **argv) {
  cout << "Creating gateway connector..." << endl << flush;

  GatewayConnector *gatewayConnector = new GatewayConnector(NULL);

  //Get the process-wide ACE_Reactor (the one the acceptor should have registered with)
  ACE_Reactor *reactor = ACE_Reactor::instance();
  cout << "Starting event loop..." << endl << flush;
  reactor->run_reactor_event_loop();
}

Make sample push receiver actually compile


// tagged_sqlite.cpp : Defines the entry point for the application.
//

#include "tagged_sqlite.h"

using namespace std;

int main() {
  using db = define_database<
      class mydb,
      define_table<class customers, define_column<class id, std::int64_t>,
                   define_column<class name, std::string>>,
      define_table<class orders, define_column<class id, std::int64_t>,
                   define_column<class item, std::string>,
                   define_column<class customerid, std::int64_t>,
                   define_column<class price, double>>>;

  auto query = query_builder<db>()
                   .select(column<customisers. id>, column<customers, customerid>,
                           column<orders, id>.as<class orderid>())
                   .from(table<customers>, table<orders>)
	               .join()
                   .where(column <)

                       cout
               << to_statement(ss) << endl;

  auto e = column<class Test> == constant(5) ||
           column<class A> * constant(5) <= parameter<class P1, std::int64_t>();

  cout << expression_to_string(e) << std::endl;

  cout << "\n"
       << simple_type_name::long_name<
              detail::column_type<db, item>::value_type> << "\n";

  return 0;
}

// tagged_sqlite.cpp : Defines the entry point for the application.
//

#include "tagged_sqlite.h"

using namespace std;

int main() {
  using db = define_database<
      define_table<class customers,  //
                   define_column<class id, std::int64_t>,
                   define_column<class name, std::string>>,
      define_table<class orders,  //
                   define_column<class id, std::int64_t>,
                   define_column<class item, std::string>,
                   define_column<class customerid, std::int64_t>,
                   define_column<class price, double>>>;

  auto query =
      query_builder<db>()
          .select(column<customers, id>, column<orders, customerid>,
                  column<name>, column<orders, id>.as<class orderid>(),
                  column<price>)
          .from(table<customers>, table<orders>)
          .join(column<orderid> == column<customerid>)
          .where(column<price> > parameter<class price_parameter, double>)
          .build();

  for (auto& row : execute_query(query, parameter<price_parameter>(100.0))) {
    std::cout << row.get<customers, id>();
    std::cout << row.get<name>();
  }

  cout << to_statement(ss) << endl;

  auto e = column<class Test> == constant(5) ||
           column<class A> * constant(5) <= parameter<class P1, std::int64_t>();

  cout << expression_to_string(e) << std::endl;

  cout << "\n"
       << simple_type_name::long_name<
              detail::column_type<db, item>::value_type> << "\n";

  return 0;
}

Fix missing parts of query. Still does not compile


// Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h"

// Disabled, http://crbug.com/30151.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Toolstrip) {
  ASSERT_TRUE(RunExtensionTest("toolstrip")) << message_;
}

// Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h"

// Disabled, http://crbug.com/30151 (Linux and ChromeOS),
// http://crbug.com/35034 (others).
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Toolstrip) {
  ASSERT_TRUE(RunExtensionTest("toolstrip")) << message_;
}

Update bug reference link in ExtensionApiTest.Toolstrip


#include "http_server/parse_path.hpp"

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>

namespace http {
namespace server3 {

bool parse_path(const std::string &path, int &z, int &x, int &y)
{
  std::vector<std::string> splits;
  boost::algorithm::split(splits, path, boost::algorithm::is_any_of("/."));

  if (splits.size() != 4) {
    return false;
  }

  if (splits[3] != "pbf") {
    return false;
  }

  try {
    z = boost::lexical_cast<int>(splits[0]);
    x = boost::lexical_cast<int>(splits[1]);
    y = boost::lexical_cast<int>(splits[2]);

    return true;

  } catch (...) {
    return false;
  }
}

} }

#include "http_server/parse_path.hpp"

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>

namespace http {
namespace server3 {

bool parse_path(const std::string &path, int &z, int &x, int &y)
{
  std::vector<std::string> splits;
  boost::algorithm::split(splits, path, boost::algorithm::is_any_of("/."));

  // we're expecting a leading /, then 3 numbers separated by /,
  // then ".pbf" at the end.
  if (splits.size() != 5) {
    return false;
  }

  if (splits[0] != "") {
    return false;
  }

  if (splits[4] != "pbf") {
    return false;
  }

  try {
    z = boost::lexical_cast<int>(splits[1]);
    x = boost::lexical_cast<int>(splits[2]);
    y = boost::lexical_cast<int>(splits[3]);

    return true;

  } catch (...) {
    return false;
  }
}

} }

Fix bug: paths have a leading slash.


#include "generator/emitter_simple.hpp"

#include "generator/feature_builder.hpp"

#include "base/macros.hpp"

namespace generator
{
EmitterSimple::EmitterSimple(feature::GenerateInfo const & info) :
  m_regionGenerator(std::make_unique<SimpleGenerator>(info)) {}

void EmitterSimple::GetNames(std::vector<std::string> & names) const
{
  names = m_regionGenerator->Parent().GetNames();
}

void EmitterSimple::Process(FeatureBuilder1 & fb)
{
  (*m_regionGenerator)(fb);
}

void EmitterPreserialize::Process(FeatureBuilder1 & fb)
{
  UNUSED_VALUE(fb.PreSerialize());
  EmitterSimple::Process(fb);
}
}  // namespace generator

#include "generator/emitter_simple.hpp"

#include "generator/feature_builder.hpp"

#include "base/macros.hpp"

namespace generator
{
EmitterSimple::EmitterSimple(feature::GenerateInfo const & info) :
  m_regionGenerator(std::make_unique<SimpleGenerator>(info)) {}

void EmitterSimple::GetNames(std::vector<std::string> & names) const
{
  names = m_regionGenerator->Parent().GetNames();
}

void EmitterSimple::Process(FeatureBuilder1 & fb)
{
  auto & polygonizer = m_regionGenerator->Parent();
  // Emit each feature independently: clear current country names (see Polygonizer::GetCurrentNames()).
  polygonizer.Start();
  (*m_regionGenerator)(fb);
  polygonizer.Finish();
}

void EmitterPreserialize::Process(FeatureBuilder1 & fb)
{
  UNUSED_VALUE(fb.PreSerialize());
  EmitterSimple::Process(fb);
}
}  // namespace generator

Optimize EmitterSimple: empty Polygonizer::m_currentNames per feature


#include <iostream>

#include "pinocchio/multibody/model.hpp"
#include "pinocchio/multibody/parser/lua.hpp"

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE UrdfTest
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE ( ParsingLuaFile )

BOOST_AUTO_TEST_CASE ( buildModel )
{
  std::string filename = PINOCCHIO_SOURCE_DIR"/models/simple_model.lua";

  #ifndef NDEBUG
     std::cout << "Parse filename \"" << filename << "\"" << std::endl;
  #endif
    se3::Model model = se3::lua::buildModel(filename, true, true);
}

BOOST_AUTO_TEST_SUITE_END()

//
// Copyright (c) 2015 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio 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 Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.

#include <iostream>

#include "pinocchio/multibody/model.hpp"
#include "pinocchio/multibody/parser/lua.hpp"

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE LuaTest
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE ( ParsingLuaFile )

BOOST_AUTO_TEST_CASE ( buildModel )
{
  std::string filename = PINOCCHIO_SOURCE_DIR"/models/simple_model.lua";

  #ifndef NDEBUG
     std::cout << "Parse filename \"" << filename << "\"" << std::endl;
  #endif
    se3::Model model = se3::lua::buildModel(filename, true, true);
}

BOOST_AUTO_TEST_SUITE_END()

Add missing license in LUA unittest


#define CATCH_CONFIG_MAIN
#include <catch.hpp>

/*
 * Catch main file for faster compilation. This file is the only one defining the
 * main function.
 */

#define CATCH_CONFIG_RUNNER
#include "catch.hpp"

// On Windows, disable the "Application error" dialog box, because it
// requires an human intervention, and there is no one on Appveyor.
//
// On UNIX, does nothing
void silent_crash_handlers();

int main(int argc, char* argv[]) {
    silent_crash_handlers();
    return Catch::Session().run(argc, argv);
}

#if (defined(WIN32) || defined(WIN64))
    #include <windows.h>
    void silent_crash_handlers() {
        SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
    }
#else
    void silent_crash_handlers() {}
#endif

Disable error dialog on Windows