#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

Declarative/UserInfo: 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.

[asan] Fix one test on OSX.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@201564 91177308-0d34-0410-b5e6-96231b3b80d8


/*********************************************************************************
 *
 * 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

Core: 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...

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@22653 8cc4aa7f-3514-0410-904f-f2cc9021211c


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

With WebFileInfo::modificationTimeMS now available, have
content::FileInfoToWebFileInfo() set it accordingly and alongside
modificationTime.

1: [blink] add WebFileInfo::modificationTimeMS [ https://codereview.chromium.org/873723004/ ]
2: [chromium] *this one* [ https://codereview.chromium.org/884413002/ ]
3: [blink] make use of modificationTimeMS [ https://codereview.chromium.org/884393002/ ]
4: [chromium] set modificationTime to something msec-based [ https://codereview.chromium.org/862203003/ ]
5: [blink] switch to using modificationTime instead of *MS [ https://codereview.chromium.org/882343002/ ]
6: [chromium] stop setting modificationTimeMS [ https://codereview.chromium.org/890523002/ ]
7: [blink] remove modificationTimeMS [ https://codereview.chromium.org/869613005/ ]

R=kinuko,jam
BUG=451747

Review URL: https://codereview.chromium.org/884413002

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#314214}


#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

Fix overflow bug in edge detector

Former-commit-id: 1d7fd3e5cf773ffc971ac069218b677b861daa83


#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

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.

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

On Mac OS X Qt's ControlModifier is actually the Cmd key and
generates the input sequence <D-Key>.


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

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


// 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)

We don't support using the MS ABI with non-x86/x86_64 targets anyway.

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


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

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

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.

BUG=60990
TEST=ExtensionApiTest.Infobars
Review URL: http://codereview.chromium.org/6798005

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


#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

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

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.

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

TBR=vangelis@chromium.org
Review URL: http://codereview.chromium.org/4200006

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

Former-commit-id: 4b7d905f0abfbfc08c9ebc6a171efb0c15a3cf97


// 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_;
}

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

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

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


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

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

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

Former-commit-id: 9b4d648a30f120aa6158413fbbeaa8442a4c2c0d


#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

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

Summary:
This completes the backport of Core [[https://github.com/bitcoin/bitcoin/pull/16688 | PR16688]] (see my note in the summary of D6652).
We diverge slightly due to a not-yet-backported change that will remove the RejectCode.

Depends on D6860

Test Plan: `ninja check check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6862


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

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

Change-Id: I78f2644fb56bc55d698cf852c11aa7020dc6cdbe
Reviewed-on: http://gerrit.aldebaran.lan:8080/82
Reviewed-by: Cedric GESTES <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>
Tested-by: Cedric GESTES <ddb78fe00abb42f91254c16a0860e38eb0781789@aldebaran-robotics.com>


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

Fix test to specify an Itanium triple.

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


#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

TBR=erikkay
TEST=no code change
BUG=30151, 35034

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

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

Former-commit-id: 60021e16292fb6851b314ce10c2f0b2eca6981d3


#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.

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

[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

[Minor] 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

Disable error dialog on Windows

It make the test hang for nothing


// 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 "content/browser/renderer_host/render_view_host_observer.h"

#include "content/browser/renderer_host/render_view_host.h"

RenderViewHostObserver::RenderViewHostObserver(RenderViewHost* render_view_host)
    : render_view_host_(render_view_host),
      routing_id_(render_view_host->routing_id()) {
  render_view_host_->AddObserver(this);
}

RenderViewHostObserver::~RenderViewHostObserver() {
  if (render_view_host_)
    render_view_host_->RemoveObserver(this);
}

void RenderViewHostObserver::RenderViewHostDestroyed() {
  delete this;
}

bool RenderViewHostObserver::OnMessageReceived(const IPC::Message& message) {
  return false;
}

bool RenderViewHostObserver::Send(IPC::Message* message) {
  if (!render_view_host_) {
    delete message;
    return false;
  }

  return render_view_host_->Send(message);
}

void RenderViewHostObserver::RenderViewHostDestruction() {
  render_view_host_->RemoveObserver(this);
  RenderViewHostDestroyed();
  render_view_host_ = NULL;
}

// 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 "content/browser/renderer_host/render_view_host_observer.h"

#include "content/browser/renderer_host/render_view_host.h"

RenderViewHostObserver::RenderViewHostObserver(RenderViewHost* render_view_host)
    : render_view_host_(render_view_host),
      routing_id_(render_view_host->routing_id()) {
  render_view_host_->AddObserver(this);
}

RenderViewHostObserver::~RenderViewHostObserver() {
  if (render_view_host_)
    render_view_host_->RemoveObserver(this);
}

void RenderViewHostObserver::RenderViewHostDestroyed() {
  delete this;
}

bool RenderViewHostObserver::OnMessageReceived(const IPC::Message& message) {
  return false;
}

bool RenderViewHostObserver::Send(IPC::Message* message) {
  if (!render_view_host_) {
    delete message;
    return false;
  }

  return render_view_host_->Send(message);
}

void RenderViewHostObserver::RenderViewHostDestruction() {
  render_view_host_->RemoveObserver(this);
  render_view_host_ = NULL;
  RenderViewHostDestroyed();
}

Fix invalid write in RenderViewHostObserver.

TBR=avi
Review URL: http://codereview.chromium.org/6813065

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

Former-commit-id: 0e1a5286d67cad9026e6ce23998df26f404008e6


#define CATCH_CONFIG_RUNNER
#include "Catch/catch.hpp"

#include <memory>

#include "decoration.hpp"
#include "printing.hpp"

#include "TestUtils.hpp"

int
main(int argc, const char *argv[])
{
    PrintingSettings::set(std::make_shared<TestSettings>());

    decor::disableDecorations();

    // Remove destination directory if it exists to account for crashes.
    TempDirCopy tempDirCopy("tests/test-repo/_git", "tests/test-repo/.git",
                            true);

    return Catch::Session().run(argc, argv);
}

#define CATCH_CONFIG_RUNNER
#include "Catch/catch.hpp"

#include <boost/algorithm/string/predicate.hpp>

#include <cstdlib>
#include <cstring>

#include <memory>

#include "decoration.hpp"
#include "printing.hpp"

#include "TestUtils.hpp"

int
main(int argc, const char *argv[])
{
    // Drop all `GIT_*` environment variables as they might interfere with
    // running some tests.
    extern char **environ;
    for (char **e = environ; *e != NULL; ++e) {
        if (boost::starts_with(*e, "GIT_")) {
            unsetenv(std::string(*e, std::strchr(*e, '=')).c_str());
        }
    }

    PrintingSettings::set(std::make_shared<TestSettings>());

    decor::disableDecorations();

    // Remove destination directory if it exists to account for crashes.
    TempDirCopy tempDirCopy("tests/test-repo/_git", "tests/test-repo/.git",
                            true);

    return Catch::Session().run(argc, argv);
}

Drop all GIT_* variables in tests

Drop all GIT_* variables in tests

They take precedence when `git` is run in tests and break those tests.


#include "../src/Sphere.h"
#include "../src/Plane.h"

void World::build() {
	vp.set_hres(200);
	vp.set_vres(200);
	vp.set_pixel_size(1.0);
	tracerPtr = new MultipleObjects(this);
	backgroundColor = RGBColor(0.0f, 0.0f, 0.0f);

	Sphere* sphere_ptr = new Sphere;
	sphere_ptr->setCenter(glm::vec3(0.0f, -25.0f, 0.0f));
	sphere_ptr->setRadius(80);
	sphere_ptr->setColor(1, 0, 0);
	addObject(sphere_ptr);

	sphere_ptr = new Sphere(glm::vec3(0.0f, 30.0f, 0.0f), 60.0f);
	sphere_ptr->setColor(1, 1, 0);
	addObject(sphere_ptr);

	Plane* plane_ptr = new Plane(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 1.0f));
	plane_ptr->setColor(0.0, 0.3, 0.0);
	addObject(plane_ptr);

}

#include "../src/Sphere.h"
#include "../src/Plane.h"
#include <iostream>

using namespace std;

void World::build() {
	vp.set_hres(200);
	vp.set_vres(200);
	vp.set_pixel_size(1.0);
	tracerPtr = new MultipleObjects(this);
	backgroundColor = RGBColor(0.0f, 0.0f, 0.0f);

	Sphere* sphere_ptr = new Sphere;
	sphere_ptr->setCenter(glm::vec3(0.0f, -25.0f, 0.0f));
	sphere_ptr->setRadius(80);
	sphere_ptr->setColor(1, 0, 0);
	addObject(sphere_ptr);

	sphere_ptr = new Sphere;
	sphere_ptr->setCenter(glm::vec3(0.0f, 30.0f, 0.0f));
	sphere_ptr->setRadius(60);
	sphere_ptr->setColor(1, 1, 0);
	addObject(sphere_ptr);

	Plane* plane_ptr = new Plane(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 1.0f));
	plane_ptr->setColor(0.0, 0.3, 0.0);
	addObject(plane_ptr);

}

Make some small changes on the code without changing its semantics


Update bug reference link in ExtensionApiTest.Toolstrip

TBR=erikkay
TEST=no code change
BUG=30151, 35034

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

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


#include "qmimedatabase.h"

#include <QtCore/QCoreApplication>
#include <QtCore/QFile>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    if (argc <= 1) {
        printf( "No filename specified\n" );
        return 1;
    }
    QString option;
    int fnPos = 1;
    if (argc > 2) {
        option = QString::fromLatin1(argv[1]);
        ++fnPos;
    }
    const QString fileName = QFile::decodeName(argv[fnPos]);
    //int accuracy;
    QMimeDatabase db;
    QMimeType mime;
    if (fileName == QLatin1String("-")) {
        QFile qstdin;
        qstdin.open(stdin, QIODevice::ReadOnly);
        const QByteArray data = qstdin.readAll();
        //mime = QMimeType::findByContent(data, &accuracy);
        mime = db.findByData(data);
    } else if (option == "-c") {
        QFile file(fileName);
        if (file.open(QIODevice::ReadOnly)) {
            mime = db.findByData(file.read(32000));
        }
    } else {
        //mime = QMimeType::findByPath(fileName, 0, args->isSet("f"), &accuracy);
        mime = db.findByFile(fileName);
    }
    if ( mime.isValid() /*&& !mime.isDefault()*/ ) {
        printf("%s\n", mime.name().toLatin1().constData());
        //printf("(accuracy %d)\n", accuracy);
    } else {
        return 1; // error
    }

    return 0;
}

#include "qmimedatabase.h"

#include <QtCore/QCoreApplication>
#include <QtCore/QFile>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    if (argc <= 1) {
        printf( "No filename specified\n" );
        return 1;
    }
    QString option;
    int fnPos = 1;
    if (argc > 2) {
        option = QString::fromLatin1(argv[1]);
        ++fnPos;
    }
    const QString fileName = QFile::decodeName(argv[fnPos]);
    //int accuracy;
    QMimeDatabase db;
    QMimeType mime;
    if (fileName == QLatin1String("-")) {
        QFile qstdin;
        qstdin.open(stdin, QIODevice::ReadOnly);
        const QByteArray data = qstdin.readAll();
        //mime = QMimeType::findByContent(data, &accuracy);
        mime = db.findByData(data);
    } else if (option == "-c") {
        QFile file(fileName);
        if (file.open(QIODevice::ReadOnly)) {
            mime = db.findByData(file.read(32000));
        }
    } else if (option == "-f") {
        mime = db.findByName(fileName);
    } else {
        mime = db.findByFile(fileName);
    }
    if ( mime.isValid() /*&& !mime.isDefault()*/ ) {
        printf("%s\n", mime.name().toLatin1().constData());
        //printf("(accuracy %d)\n", accuracy);
    } else {
        return 1; // error
    }

    return 0;
}

Add option -f (file name only)

Add option -f (file name only)


//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <random>

// template <class UIntType, UIntType a, UIntType c, UIntType m>
//   class linear_congruential_engine;

// template<class Sseq> void seed(Sseq& q);

#include <random>
#include <cassert>

int main()
{
    {
        unsigned a[] = {3, 5, 7};
        std::seed_seq sseq(a, a+3);
        std::linear_congruential_engine<unsigned, 5, 7, 11> e1;
        std::linear_congruential_engine<unsigned, 5, 7, 11> e2(4);
        assert(e1 != e2);
        e1.seed(sseq);
        assert(e1 == e2);
    }
}

//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <random>

// template <class UIntType, UIntType a, UIntType c, UIntType m>
//   class linear_congruential_engine;

// template<class Sseq> void seed(Sseq& q);

#include <random>
#include <cassert>

int main()
{
    {
        unsigned a[] = {3, 5, 7};
        std::seed_seq sseq(a, a+3);
        std::linear_congruential_engine<unsigned, 5, 7, 11> e1;
        std::linear_congruential_engine<unsigned, 5, 7, 11> e2(4);
        assert(e1 != e2);
        e1.seed(sseq);
        assert(e1 == e2);
    }
    {
        unsigned a[] = {3, 5, 7, 9, 11};
        std::seed_seq sseq(a, a+5);
        typedef std::linear_congruential_engine<unsigned long long, 1, 1, 0x200000001ULL> E;
        E e1(4309005589);
        E e2(sseq);
        assert(e1 == e2);
    }
}

Fix a couple of bugs in linear_congruential_engine::seed.  Regression test added.

git-svn-id: 273b07cebdae5845b4a75aae04570b978db9eb50@182421 91177308-0d34-0410-b5e6-96231b3b80d8


#include <gloperate/painter/PipelineOutputCapability.h>

#include <gloperate/base/collection.hpp>

#include <gloperate/pipeline/AbstractPipeline.h>

namespace gloperate
{

/**
*  @brief
*    Constructor
*/
PipelineOutputCapability::PipelineOutputCapability(const gloperate::AbstractPipeline & pipeline)
    : AbstractOutputCapability{}
    , m_pipeline { pipeline }
{
}

/**
*  @brief
*    Destructor
*/
PipelineOutputCapability::~PipelineOutputCapability()
{
}

std::vector<gloperate::AbstractData*> PipelineOutputCapability::allOutputs() const
{
    return m_pipeline.allOutputs();
}

}

#include <gloperate/painter/PipelineOutputCapability.h>

#include <gloperate/base/collection.hpp>

#include <gloperate/pipeline/AbstractPipeline.h>

namespace gloperate
{

/**
*  @brief
*    Constructor
*/
PipelineOutputCapability::PipelineOutputCapability(const gloperate::AbstractPipeline & pipeline)
    : AbstractOutputCapability{}
    , m_pipeline ( pipeline )
{
}

/**
*  @brief
*    Destructor
*/
PipelineOutputCapability::~PipelineOutputCapability()
{
}

std::vector<gloperate::AbstractData*> PipelineOutputCapability::allOutputs() const
{
    return m_pipeline.allOutputs();
}

}

Fix compilation for GCC 4.8.2

Fix compilation for GCC 4.8.2


#include "types.h"

#include <cassert>

namespace nadam {

MessageInfo::MessageInfo(std::string name, uint32_t size, bool isVariableSize)
	: name{name}, size{size}, isVariableSize{isVariableSize},
	hash{constructHash(name, size, isVariableSize)} {
	assert(name.length());
}

util::sha1::hash MessageInfo::constructHash(const std::string& name, uint32_t size, bool isVariableSize) {
	util::sha1::Digest sha;
	sha.put(name.data(), static_cast<uint32_t>(name.size()));
	sha.put(isVariableSize);
	for (size_t i = 0; i < sizeof(size); ++i) {
		size_t byteNumber = sizeof(size) - 1 - i;
		sha.put(size >> 8 * byteNumber & 0xff);
	}
	return sha.finish();
}

} // namespace nadam

#include "types.h"

#include <cassert>

namespace nadam {

MessageInfo::MessageInfo(std::string name, uint32_t size, bool isVariableSize)
	: name(name), size(size), isVariableSize(isVariableSize),
	hash(constructHash(name, size, isVariableSize)) {
	assert(name.length());
}

util::sha1::hash MessageInfo::constructHash(const std::string& name, uint32_t size, bool isVariableSize) {
	util::sha1::Digest sha;
	sha.put(name.data(), static_cast<uint32_t>(name.size()));
	sha.put(isVariableSize);
	for (size_t i = 0; i < sizeof(size); ++i) {
		size_t byteNumber = sizeof(size) - 1 - i;
		sha.put(size >> 8 * byteNumber & 0xff);
	}
	return sha.finish();
}

} // namespace nadam

Make initializer list compatible with older GCC


#include <iostream>
#include "Shell.h"
#include "RemoteCommand.h"

namespace RhIO
{
    RemoteCommand::RemoteCommand(std::string fullName_, std::string desc_)
        : fullName(fullName_), desc(desc_), origin(""), name("")
    {
        auto found = fullName.find_last_of("/");
        if (found > 0) {
            origin = fullName.substr(0, found);
            name = fullName.substr(found+1);
        } else {
            name = fullName;
        }
    }

    std::string RemoteCommand::getName()
    {
        return name;
    }

    std::string RemoteCommand::getDesc()
    {
        return desc;
    }

    std::string RemoteCommand::getOrigin()
    {
        return origin;
    }

    void RemoteCommand::process(std::vector<std::string> args)
    {
        auto response = shell->getClient()->call(fullName, args);
        std::cout << response;
        if (response.size() && response[response.size()-1]!='\n') {
            std::cout << std::endl;
        }
    }
}

#include <iostream>
#include "Shell.h"
#include "RemoteCommand.h"

namespace RhIO
{
    RemoteCommand::RemoteCommand(std::string fullName_, std::string desc_)
        : fullName(fullName_), desc(desc_), origin(""), name("")
    {
        auto found = fullName.find_last_of("/");
        if (found != std::string::npos) {
            origin = fullName.substr(0, found);
            name = fullName.substr(found+1);
        } else {
            name = fullName;
        }
    }

    std::string RemoteCommand::getName()
    {
        return name;
    }

    std::string RemoteCommand::getDesc()
    {
        return desc;
    }

    std::string RemoteCommand::getOrigin()
    {
        return origin;
    }

    void RemoteCommand::process(std::vector<std::string> args)
    {
        auto response = shell->getClient()->call(fullName, args);
        std::cout << response;
        if (response.size() && response[response.size()-1]!='\n') {
            std::cout << std::endl;
        }
    }
}

Fix in Remote command name parsing

Fix in Remote command name parsing


#include "listener.h"
#include "log.h"
#include "buffers.h"

void conditionalEnqueue(QUEUE_TYPE(uint8_t)* queue, uint8_t* message,
        int messageSize) {
    if(queue_available(queue) < messageSize + 2) {
        debug("Dropped incoming CAN message -- send queue (at %p) full\r\n",
                queue);
        return;
    }

    for(int i = 0; i < messageSize; i++) {
        QUEUE_PUSH(uint8_t, queue, (uint8_t)message[i]);
    }
    QUEUE_PUSH(uint8_t, queue, (uint8_t)'\r');
    QUEUE_PUSH(uint8_t, queue, (uint8_t)'\n');
}

void sendMessage(Listener* listener, uint8_t* message, int messageSize) {
    conditionalEnqueue(&listener->usb->sendQueue, message, messageSize);
    conditionalEnqueue(&listener->serial->sendQueue, message, messageSize);
}

void processListenerQueues(Listener* listener) {
    // Must always process USB, because this function usually runs the MCU's USB
    // task that handles SETUP and enumeration.
    processInputQueue(listener->usb);
    processInputQueue(listener->serial);
}

#include "listener.h"
#include "log.h"
#include "buffers.h"

bool conditionalEnqueue(QUEUE_TYPE(uint8_t)* queue, uint8_t* message,
        int messageSize) {
    if(queue_available(queue) < messageSize + 2) {
        return false;
    }

    for(int i = 0; i < messageSize; i++) {
        QUEUE_PUSH(uint8_t, queue, (uint8_t)message[i]);
    }
    QUEUE_PUSH(uint8_t, queue, (uint8_t)'\r');
    QUEUE_PUSH(uint8_t, queue, (uint8_t)'\n');
    return true;
}

void sendMessage(Listener* listener, uint8_t* message, int messageSize) {
    if(!conditionalEnqueue(&listener->usb->sendQueue, message, messageSize)) {
        debug("USB send queue full, dropping CAN message: %s\r\n", message);
    }

    if(!conditionalEnqueue(&listener->serial->sendQueue, message, messageSize)) {
        debug("UART send queue full, dropping CAN message: %s\r\n", message);
    }
}

void processListenerQueues(Listener* listener) {
    // Must always process USB, because this function usually runs the MCU's USB
    // task that handles SETUP and enumeration.
    processInputQueue(listener->usb);
    processInputQueue(listener->serial);
}

Print a queue-specific debug message when dropping CAN messages.


// 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/in_process_webkit/webkit_thread.h"
#include "testing/gtest/include/gtest/gtest.h"

TEST(WebKitThreadTest, ExposedInChromeThread) {
  int* null = NULL;  // Help the template system out.
  EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT, FROM_HERE, null));
  {
    WebKitThread thread;
    EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                          FROM_HERE, null));
    thread.Initialize();
    EXPECT_TRUE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                         FROM_HERE, null));
  }
  EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                        FROM_HERE, null));
}

// 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/in_process_webkit/webkit_thread.h"
#include "testing/gtest/include/gtest/gtest.h"

TEST(WebKitThreadTest, DISABLED_ExposedInChromeThread) {
  int* null = NULL;  // Help the template system out.
  EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT, FROM_HERE, null));
  {
    WebKitThread thread;
    EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                          FROM_HERE, null));
    thread.Initialize();
    EXPECT_TRUE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                         FROM_HERE, null));
  }
  EXPECT_FALSE(ChromeThread::DeleteSoon(ChromeThread::WEBKIT,
                                        FROM_HERE, null));
}

Disable WebKitThreadTest.ExposedInChromeThread, due to subsequent assert.

BUG=46087
TEST=see bug
TBR=evan

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

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


// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/render_widget_host_view.h"

#include "base/logging.h"

// static
void RenderWidgetHostView::GetDefaultScreenInfo(
    WebKit::WebScreenInfo* results) {
  NOTIMPLEMENTED();
}

////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostView, public:

// static
RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
    RenderWidgetHost* widget) {
  NOTIMPLEMENTED();
  return NULL;
}

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/render_widget_host_view.h"

#include "base/logging.h"

// static
void RenderWidgetHostViewBase::GetDefaultScreenInfo(
    WebKit::WebScreenInfo* results) {
  NOTIMPLEMENTED();
}

////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostView, public:

// static
RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
    RenderWidgetHost* widget) {
  NOTIMPLEMENTED();
  return NULL;
}

Fix compile error when building content_unittests for android.

In CL http://codereview.chromium.org/9307055 RenderWidgetHostView was split into two classes.
The android stubs weren't updated causing a compile error when building content_unittests locally.

BUG=None
TEST=

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

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


/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2016 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#include "xenia/gpu/vulkan/vulkan_gpu_flags.h"

DEFINE_bool(vulkan_renderdoc_capture_all, false,
            "Capture everything with RenderDoc.");
DEFINE_bool(vulkan_native_msaa, true, "Use native MSAA");
DEFINE_bool(vulkan_dump_disasm, false,
            "Dump shader disassembly. NVIDIA only supported.");

/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2016 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#include "xenia/gpu/vulkan/vulkan_gpu_flags.h"

DEFINE_bool(vulkan_renderdoc_capture_all, false,
            "Capture everything with RenderDoc.");
DEFINE_bool(vulkan_native_msaa, false, "Use native MSAA");
DEFINE_bool(vulkan_dump_disasm, false,
            "Dump shader disassembly. NVIDIA only supported.");

Disable Vulkan native MSAA by default for now.


#include <gtest/gtest.h>
TEST(MathTest, TwoPlusTwoEqualsFour) {
EXPECT_EQ(2 + 2, 4);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest( &argc, argv );
return RUN_ALL_TESTS();
}

#include <gtest/gtest.h>
TEST(MathTest, TwoPlusTwoEqualsFour) {
EXPECT_EQ(2 + 2, 5);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest( &argc, argv );
return RUN_ALL_TESTS();
}

Make sure Travis detects failing test

Make sure Travis detects failing test


#include "removegrain.h"
#include "clense.h"
#include "repair.h"
#include "vertical_cleaner.h"

const AVS_Linkage *AVS_linkage = nullptr;

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
    AVS_linkage = vectors;

    env->AddFunction("RemoveGrain2", "c[mode]i[modeU]i[modeV]i[opt]s", Create_RemoveGrain, 0);
    env->AddFunction("Repair2", "cc[mode]i[modeU]i[modeV]i[opt]s", Create_Repair, 0);
    env->AddFunction("Clense2", "c[previous]c[next]c[grey]b", Create_Clense, 0);
    env->AddFunction("ForwardClense2", "c[grey]b", Create_ForwardClense, 0);
    env->AddFunction("BackwardClense2", "c[grey]b", Create_BackwardClense, 0);
    env->AddFunction("VerticalCleaner2", "c[mode]i[modeU]i[modeV]i", Create_VerticalCleaner, 0);
    return "Itai, onii-chan!";
}

#include "removegrain.h"
#include "clense.h"
#include "repair.h"
#include "vertical_cleaner.h"

const AVS_Linkage *AVS_linkage = nullptr;

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
    AVS_linkage = vectors;

    env->AddFunction("RemoveGrain", "c[mode]i[modeU]i[modeV]i[opt]s", Create_RemoveGrain, 0);
    env->AddFunction("Repair", "cc[mode]i[modeU]i[modeV]i[opt]s", Create_Repair, 0);
    env->AddFunction("Clense", "c[previous]c[next]c[grey]b", Create_Clense, 0);
    env->AddFunction("ForwardClense", "c[grey]b", Create_ForwardClense, 0);
    env->AddFunction("BackwardClense", "c[grey]b", Create_BackwardClense, 0);
    env->AddFunction("VerticalCleaner", "c[mode]i[modeU]i[modeV]i", Create_VerticalCleaner, 0);
    return "Itai, onii-chan!";
}

Remove 2 from all filters' names

Remove 2 from all filters' names


#include "Sprite.h"

Sprite::Sprite() : Node()
{
    // Image
    m_sprite_path = "";
}

Sprite::Sprite(std::string p_sprite_path) : Sprite()
{
    m_sprite_path = p_sprite_path;
}

Sprite::~Sprite() {}

std::string Sprite::getSpritePath()
{
    return m_sprite_path;
}

#include "Sprite.h"

Sprite::Sprite() : Node()
{
    // Image
    m_sprite_path = "";
}

Sprite::Sprite(std::string p_sprite_path) : Node()
{
    // Image
    m_sprite_path = p_sprite_path;
}

Sprite::~Sprite() {}

std::string Sprite::getSpritePath()
{
    return m_sprite_path;
}

Use more useful ancestor constructor

Use more useful ancestor constructor


// 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/renderer/renderer_logging.h"

#include "base/logging.h"
#include "googleurl/src/gurl.h"

namespace renderer_logging {

// Sets the URL that is logged if the renderer crashes. Use GURL() to clear
// the URL.
void SetActiveRendererURL(const GURL& url) {
  // TODO(port): Once breakpad is integrated we can turn this on.
  NOTIMPLEMENTED();
}

}  // namespace renderer_logging

// 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/renderer/renderer_logging.h"

#include "base/logging.h"
#include "googleurl/src/gurl.h"

namespace renderer_logging {

// Sets the URL that is logged if the renderer crashes. Use GURL() to clear
// the URL.
void SetActiveRendererURL(const GURL& url) {
  // crbug.com/9646
}

}  // namespace renderer_logging

Comment out a very annoying NOTIMPLEMENTED().

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

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

Former-commit-id: 35737b2c9e80659f67896930a27718af168a8b5f


Matrix2f M = Matrix2f::Random();
Matrix2f m;
m = M;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Now we want to replace m by its own transpose." << endl;
cout << "If we do m = m.transpose(), then m becomes:" << endl;
m = m.transpose() * 1;
cout << m << endl << "which is wrong!" << endl;
cout << "Now let us instead do m = m.transpose().eval(). Then m becomes" << endl;
m = M;
m = m.transpose().eval();
cout << m << endl << "which is right." << endl;

Matrix2f M = Matrix2f::Random();
Matrix2f m;
m = M;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Now we want to copy a column into a row." << endl;
cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl;
m.col(1) = m.row(0);
cout << m << endl << "which is wrong!" << endl;
cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
m = M;
m.col(1) = m.row(0).eval();
cout << m << endl << "which is right." << endl;

Make snippet run successfully again: the snippet for 'eval' was taking m=m.transpose() as an example of code that needs an explicit call to eval(), but that doesn't work anymore now that we have the clever assert detecting aliasing issues.


#include "CogServer.h"
#include "QueryProcessor.h"
#include "WordSenseProcessor.h"

using namespace opencog;

int main(int argc, char *argv[])
{
    CogServer server;

    // Cheapo hack to get the query processory up and running.
    // XXX fix me with some more permanent, appropriate solution.
    QueryProcessor *qp = new QueryProcessor();
    server.plugInMindAgent(qp, 1);

    WordSenseProcessor *wsd = new WordSenseProcessor();
    server.plugInMindAgent(wsd, 1);

    server.serverLoop();
}

#include "CogServer.h"
#include "QueryProcessor.h"
#include "WordSenseProcessor.h"
#include "Config.h"

using namespace opencog;

static void usage(char* progname) {
    cerr << "Usage: " << progname << " [-c <config-file>]\n\n";
}

int main(int argc, char *argv[]) {
    // check command line
    if ((argc == 1) || ((argc == 3) && (strcmp(argv[1], "-c") == 0))) {
        // load the configuration from file if a filename was supplied on the command line
        if (argc == 3) {
            try {
                config().load(argv[2]);
            } catch (RuntimeException &e) {
                cerr << e.getMessage() << std::endl;
                return 1;
            }
        }

        // create server instance
        CogServer server;

        // Cheapo hack to get the query processory up and running.
        // XXX fix me with some more permanent, appropriate solution.
        server.plugInMindAgent(new QueryProcessor(), 1);
        server.plugInMindAgent(new WordSenseProcessor(), 1);

        server.serverLoop();
    } else {
        usage(argv[0]);
        return 1;
    }
}

Add support to optionally load configuration parameters from a file at runtime by using the option "-c".


#include <iostream>

#include <sqlpp11/postgresql/postgresql.h>
#include <sqlpp11/postgresql/insert.h>
//#include <sqlpp11/sqlpp11.h>

#include "Sample.h"

int Returning(int argc, char **argv) {

  // Configuration
  auto config = std::make_shared<sqlpp::postgresql::connection_config>();

  // DB connection
  sqlpp::postgresql::connection db(config);

  // Model
  test::TabBar t_bar;

  auto ins_news = insert_into(t_bar)
	  .set(t_bar.gamma = true, t_bar.beta = "test")
	  .returning(t_bar.beta);
  return 0;
}

#include <iostream>

#include <sqlpp11/postgresql/postgresql.h>
#include <sqlpp11/postgresql/insert.h>
//#include <sqlpp11/sqlpp11.h>

#include "Sample.h"

int Returning(int argc, char **argv) {

  // Configuration
  //auto config = std::make_shared<sqlpp::postgresql::connection_config>();

  // DB connection
  //sqlpp::postgresql::connection db(config);

  // Model
  test::TabBar t_bar;
  auto ins_news = insert_into(t_bar)
	  .set(t_bar.gamma = true, t_bar.beta = "test")
	  .returning(t_bar.beta);

  return 0;
}

Disable database connection for now.

Disable database connection for now.