// Test this without pch.
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - &&

// Test with pch.
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -o %t %S/va_arg.h &&
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o -

char *g0(char** argv, int argc) { return argv[argc]; }

char *g(char **argv) {
  f(g0, argv, 1, 2, 3);
}

// Test this without pch.
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - &&

// Test with pch.
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h &&
// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o -

char *g0(char** argv, int argc) { return argv[argc]; }

char *g(char **argv) {
  f(g0, argv, 1, 2, 3);
}

Fix a problem with the RUN line of one of the PCH tests

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


/* ------------------------------------------------------------------------

   unicodedatabase -- The Unicode 3.0 data base.

   Data was extracted from the Unicode 3.0 UnicodeData.txt file.

   Written by Marc-Andre Lemburg (mal@lemburg.com).
   Rewritten for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)

   Copyright (c) Corporation for National Research Initiatives.

   ------------------------------------------------------------------------ */

#include <stdlib.h>
#include "unicodedatabase.h"

/* read the actual data from a separate file! */
#include "unicodedata_db.h"

const _PyUnicode_DatabaseRecord *
_PyUnicode_Database_GetRecord(int code)
{
    int index;

    if (code < 0 || code >= 65536)
        index = 0;
    else {
        index = index1[(code>>SHIFT)];
        index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
    }
    return &_PyUnicode_Database_Records[index];
}

const char *
_PyUnicode_Database_GetDecomposition(int code)
{
    int index;

    if (code < 0 || code >= 65536)
        index = 0;
    else {
        index = decomp_index1[(code>>DECOMP_SHIFT)];
        index = decomp_index2[(index<<DECOMP_SHIFT)+
                             (code&((1<<DECOMP_SHIFT)-1))];
    }
    return decomp_data[index];
}

/* ------------------------------------------------------------------------

   unicodedatabase -- The Unicode 3.0 data base.

   Data was extracted from the Unicode 3.0 UnicodeData.txt file.

   Written by Marc-Andre Lemburg (mal@lemburg.com).
   Rewritten for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)

   Copyright (c) Corporation for National Research Initiatives.

   ------------------------------------------------------------------------ */

#include "Python.h"
#include "unicodedatabase.h"

/* read the actual data from a separate file! */
#include "unicodedata_db.h"

const _PyUnicode_DatabaseRecord *
_PyUnicode_Database_GetRecord(int code)
{
    int index;

    if (code < 0 || code >= 65536)
        index = 0;
    else {
        index = index1[(code>>SHIFT)];
        index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
    }
    return &_PyUnicode_Database_Records[index];
}

const char *
_PyUnicode_Database_GetDecomposition(int code)
{
    int index;

    if (code < 0 || code >= 65536)
        index = 0;
    else {
        index = decomp_index1[(code>>DECOMP_SHIFT)];
        index = decomp_index2[(index<<DECOMP_SHIFT)+
                             (code&((1<<DECOMP_SHIFT)-1))];
    }
    return decomp_data[index];
}

Fix header file usage so that NULL is defined. NULL is needed by unicodedata_db.h.


#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/init.h>
#include <linux/percpu.h>
#include <linux/node.h>
#include <linux/nodemask.h>

static DEFINE_PER_CPU(struct cpu, cpu_devices);

static int __init topology_init(void)
{
	int i, ret;

#ifdef CONFIG_NEED_MULTIPLE_NODES
	for_each_online_node(i)
		register_one_node(i);
#endif

	for_each_present_cpu(i) {
		ret = register_cpu(&per_cpu(cpu_devices, i), i);
		if (unlikely(ret))
			printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n",
			       __FUNCTION__, i, ret);
	}

	return 0;
}
subsys_initcall(topology_init);

/*
 * arch/sh/kernel/topology.c
 *
 *  Copyright (C) 2007  Paul Mundt
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/init.h>
#include <linux/percpu.h>
#include <linux/node.h>
#include <linux/nodemask.h>

static DEFINE_PER_CPU(struct cpu, cpu_devices);

static int __init topology_init(void)
{
	int i, ret;

#ifdef CONFIG_NEED_MULTIPLE_NODES
	for_each_online_node(i)
		register_one_node(i);
#endif

	for_each_present_cpu(i) {
		ret = register_cpu(&per_cpu(cpu_devices, i), i);
		if (unlikely(ret))
			printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n",
			       __FUNCTION__, i, ret);
	}

#if defined(CONFIG_NUMA) && !defined(CONFIG_SMP)
	/*
	 * In the UP case, make sure the CPU association is still
	 * registered under each node. Without this, sysfs fails
	 * to make the connection between nodes other than node0
	 * and cpu0.
	 */
	for_each_online_node(i)
		if (i != numa_node_id())
			register_cpu_under_node(raw_smp_processor_id(), i);
#endif

	return 0;
}
subsys_initcall(topology_init);

Fix up cpu to node mapping in sysfs.

sh: Fix up cpu to node mapping in sysfs.

Currently cpu_to_node() is always 0 in the UP case, though
we do want to have the CPU association linked in under sysfs
even in the cases where we're only on a single CPU.

Fix this up, so we have the cpu0 link on all of the available
nodes that don't already have a CPU link of their own.

Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>


// Copyright (c) 2013 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.

#ifndef WIDEVINE_CDM_VERSION_H_
#define WIDEVINE_CDM_VERSION_H_

#include "third_party/widevine/cdm/widevine_cdm_common.h"

// Indicates that the Widevine CDM is available.
#define WIDEVINE_CDM_AVAILABLE

// Indicates that AVC1 decoding is available for ISO BMFF CENC.
#define WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE
// Indicates that AAC decoding is available for ISO BMFF CENC.
#define WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE

#endif  // WIDEVINE_CDM_VERSION_H_

// Copyright (c) 2013 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.

#ifndef WIDEVINE_CDM_VERSION_H_
#define WIDEVINE_CDM_VERSION_H_

#include "third_party/widevine/cdm/widevine_cdm_common.h"

// Indicates that the Widevine CDM is available.
#define WIDEVINE_CDM_AVAILABLE

#endif  // WIDEVINE_CDM_VERSION_H_

Remove obsolete defines from Android CDM file.

BUG=349185

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

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


// ---------------------------------------------------------------------
//
// Copyright (C) 2019 by the SampleFlow authors.
//
// This file is part of the SampleFlow library.
//
// The deal.II library is free software; you can use it, 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 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE.md at
// the top level directory of deal.II.
//
// ---------------------------------------------------------------------

#ifndef SAMPLEFLOW_CONSUMERS_COUNT_SAMPLES_H
#define SAMPLEFLOW_CONSUMERS_COUNT_SAMPLES_H

#include <sampleflow/consumer.h>
#include <mutex>

namespace SampleFlow
{
  namespace Consumers
  {
    /**
     * A Consumer class that simply counts how many samples it has received.
     *
     *
     * ### Threading model ###
     *
     * The implementation of this class is thread-safe, i.e., its
     * consume() member function can be called concurrently and from multiple
     * threads.
     *
     *
     * @tparam InputType The C++ type used for the samples $x_k$.
     */
    template <typename InputType>
    class CountSamples : public Consumer<InputType>
    {
      public:
        /**
         * The type of the information generated by this class, i.e., the type
         * of the object returned by get(). This is just the type used to store
         * the index of samples.
         */
        using value_type = types::sample_index;

        /**
         * Constructor.
         */
        CountSamples ();

        /**
         * Process one sample by just incrementing the sample counter.
         *
         * @param[in] sample The sample to process. Since this class does
         *   not care about the actual value of the sample, it simply
         *   ignores its value.
         * @param[in] aux_data Auxiliary data about this sample. The current
         *   class does not know what to do with any such data and consequently
         *   simply ignores it.
         */
        virtual
        void
        consume (InputType sample, AuxiliaryData aux_data) override;

        /**
         * A function that returns the number of samples received so far.
         *
         * @return The computed mean value.
         */
        value_type
        get () const;

      private:
        /**
         * A mutex used to lock access to all member variables when running
         * on multiple threads.
         */
        mutable std::mutex mutex;

        /**
         * The number of samples received so far.
         */
        types::sample_index n_samples;
    };

    template <typename InputType>
    CountSamples<InputType>::
    CountSamples ()
      :
      n_samples (0)
    {}

    template <typename InputType>
    void
    CountSamples<InputType>::
    consume (InputType /*sample*/, AuxiliaryData /*aux_data*/)
    {
      std::lock_guard<std::mutex> lock(mutex);

      ++n_samples;
    }

    template <typename InputType>
    typename CountSamples<InputType>::value_type
    CountSamples<InputType>::
    get () const
    {
      std::lock_guard<std::mutex> lock(mutex);

      return n_samples;
    }

  }
}

#endif

Add a consumer that just counts samples.


/******************************************************************************

  This source file is part of the MoleQueue project.

  Copyright 2011 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

******************************************************************************/

#ifndef JOB_H
#define JOB_H

#include <QObject>

namespace MoleQueue {

class Queue;
class Program;

class Job : public QObject
{
  Q_OBJECT

public:
  explicit Job(const Program *program);
  ~Job();

  void setName(const QString &name);
  QString name() const;
  void setTitle(const QString &title);
  QString title() const;

  const Program* program() const;
  const Queue* queue() const;

private:
  QString m_name;
  QString m_title;
  const Program* m_program;
};

} // end MoleQueue namespace

#endif // JOB_H

/******************************************************************************

  This source file is part of the MoleQueue project.

  Copyright 2011 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

******************************************************************************/

#ifndef JOB_H
#define JOB_H

#include <QObject>

namespace MoleQueue {

class Queue;
class Program;

/**
 * Class to represent an execution of a Program.
 */
class Job : public QObject
{
  Q_OBJECT

public:
  /** Creates a new job. */
  explicit Job(const Program *program);

  /* Destroys the job object. */
  ~Job();

  /** Set the name of the job to \p name. */
  void setName(const QString &name);

  /** Returns the name of the job. */
  QString name() const;

  /** Sets the title of the job to \p title. */
  void setTitle(const QString &title);

  /** Returns the title for the job. */
  QString title() const;

  /** Returns the program that the job is a type of. */
  const Program* program() const;

  /** Returns the queue that the job is a member of. */
  const Queue* queue() const;

private:
  /** The name of the job. */
  QString m_name;

  /** The title of the job. */
  QString m_title;

  /** The program that the job is a type of. */
  const Program* m_program;
};

} // end MoleQueue namespace

#endif // JOB_H

Add documentation for the Job class

Add documentation for the Job class


//
//  SQGlobalMarco.h
//
//  Created by Shi Eric on 3/18/12.
//  Copyright (c) 2012 Safe&Quick[http://www.saick.net]. All rights reserved.
//

#ifndef _SQGlobalMarco_h
#define _SQGlobalMarco_h

#define kMinOSVersion   4.0f

#define saferelease(foo) {if(foo != nil) {[foo release]; foo = nil;}}

#define isLandscape (UIInterfaceOrientationIsLandscape\
([[UIApplication sharedApplication] statusBarOrientation]))

#define isPad ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)]\
&& [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)

#define isPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define kOSVersion (float)([[[UIDevice currentDevice] systemVersion] length] > 0 ? [[[UIDevice currentDevice] systemVersion] doubleValue] : kMinOSVersion)

#endif

//
//  SQGlobalMarco.h
//
//  Created by Shi Eric on 3/18/12.
//  Copyright (c) 2012 Safe&Quick[http://www.saick.net]. All rights reserved.
//

#ifndef _SQGlobalMarco_h
#define _SQGlobalMarco_h

#define kMinOSVersion   4.0f

#define saferelease(foo) {if(foo != nil) {[foo release]; foo = nil;}}

#define isLandscape (UIInterfaceOrientationIsLandscape\
([[UIApplication sharedApplication] statusBarOrientation]))

#define isPad ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)]\
&& [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)

#define isPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define kOSVersion (float)([[[UIDevice currentDevice] systemVersion] length] > 0 ? [[[UIDevice currentDevice] systemVersion] doubleValue] : kMinOSVersion)

#define kScreenSize   [[UIScreen mainScreen] bounds].size

// Radians to degrees
#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI))
// Degrees to radians
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)

#endif

Add kScreenSize and Radians to or from degrees


/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

// This file is not part of the public Skia API.

#ifndef SkSpinlock_DEFINED
#define SkSpinlock_DEFINED

#include "SkAtomics.h"

#define SK_DECLARE_STATIC_SPINLOCK(name) namespace {} static SkPODSpinlock name

// This class has no constructor and must be zero-initialized (the macro above does this).
class SkPODSpinlock {
public:
    void acquire() {
        // To act as a mutex, we need an acquire barrier if we take the lock.
        if (sk_atomic_exchange(&fLocked, true, sk_memory_order_acquire)) {
            // Lock was contended.  Fall back to an out-of-line spin loop.
            this->contendedAcquire();
        }
    }

    void release() {
        // To act as a mutex, we need a release barrier.
        sk_atomic_store(&fLocked, false, sk_memory_order_release);
    }

private:
    void contendedAcquire();
    bool fLocked;
};

// For non-global-static use cases, this is normally what you want.
class SkSpinlock : public SkPODSpinlock {
public:
    SkSpinlock() { this->release(); }
};

#endif//SkSpinlock_DEFINED

/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

// This file is not part of the public Skia API.

#ifndef SkSpinlock_DEFINED
#define SkSpinlock_DEFINED

#include "SkAtomics.h"

#define SK_DECLARE_STATIC_SPINLOCK(name) namespace {} static SkPODSpinlock name

// This class has no constructor and must be zero-initialized (the macro above does this).
class SK_API SkPODSpinlock {
public:
    void acquire() {
        // To act as a mutex, we need an acquire barrier if we take the lock.
        if (sk_atomic_exchange(&fLocked, true, sk_memory_order_acquire)) {
            // Lock was contended.  Fall back to an out-of-line spin loop.
            this->contendedAcquire();
        }
    }

    void release() {
        // To act as a mutex, we need a release barrier.
        sk_atomic_store(&fLocked, false, sk_memory_order_release);
    }

private:
    void contendedAcquire();
    bool fLocked;
};

// For non-global-static use cases, this is normally what you want.
class SkSpinlock : public SkPODSpinlock {
public:
    SkSpinlock() { this->release(); }
};

#endif//SkSpinlock_DEFINED

Fix componene debug build failure in chromium

The error log is as follows:
../../third_party/skia/include/core/SkSpinlock.h:24: error: undefined reference to 'SkPODSpinlock::contendedAcquire()'
collect2: error: ld returned 1 exit status

[mtklein added below here]
Despite the presence in include/ and the added SK_API, this file is not part of Skia's public API... it's just used by files which are.
TBR=reed@google.com

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


/*
 *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
#define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H

#include "webrtc/common_video/interface/i420_video_frame.h"

// TODO(magjed): Remove this when all external dependencies are updated.
namespace webrtc {

typedef I420VideoFrame TextureVideoFrame;

}  // namespace webrtc

#endif  // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H

Add intermediate TextureVideoFrame typedef for Chromium

BUG=1128
R=perkj@webrtc.org
TBR=stefan

Review URL: https://webrtc-codereview.appspot.com/42239004

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#8630}
git-svn-id: 917f5d3ca488f358c4d40eaec14422cf392ccec9@8630 4adac7df-926f-26a2-2b94-8c16560cd09d


#ifndef STRUCTURE_H
#define STRUCTURE_H

#include <vector>

#include "Math/Vector2.h"

enum class BiomeType
{
	Snow,
	Tundra,
	Mountain,
	Taiga,
	Shrubland,
	TemprateDesert,
	TemprateRainForest,
	TemprateDeciduousForest,
	Grassland,
	TropicalRainForest,
	TropicalSeasonalForest,
	SubtropicalDesert,
	Ocean,
	Lake,
	Beach,

	Size,
	None
};

// Forward Declaration
struct Edge;
struct Corner;

#endif

#ifndef STRUCTURE_H
#define STRUCTURE_H

#include <vector>

#include "Math/Vector2.h"

enum class BiomeType
{
	Snow,
	Tundra,
	Mountain,
	Taiga,
	Shrubland,
	TemprateDesert,
	TemprateRainForest,
	TemprateDeciduousForest,
	Grassland,
	TropicalRainForest,
	TropicalSeasonalForest,
	SubtropicalDesert,
	Ocean,
	Lake,
	Beach,

	Size,
	None
};

// Forward Declaration
struct Edge;
struct Corner;

struct Center
{
	unsigned int m_index;
	Vector2 m_positon;

	bool m_water;
	bool m_ocean;
	bool m_coast;
	bool m_border;
	BiomeType m_biome;
	double m_elevation;
	double m_moisture;

	std::vector<Edge*> m_edges;
	std::vector<Corner*> m_corners;
	std::vector<Center*> m_centers;

	using CenterIterator = std::vector<Center*>::iterator;
};

#endif

Declare struct Center's member variables


Fix Lth_Assert not using stderr

assert: Fix Lth_Assert not using stderr


/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2008 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.03.01-k8"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	3
#define QLA_DRIVER_PATCH_VER	1
#define QLA_DRIVER_BETA_VER	0

/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2008 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.03.01-k9"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	3
#define QLA_DRIVER_PATCH_VER	1
#define QLA_DRIVER_BETA_VER	0

Update version number to 8.03.01-k9.

[SCSI] qla2xxx: Update version number to 8.03.01-k9.

Signed-off-by: Giridhar Malavali <799b6491fce2c7a80b5fedcf9a728560cc9eb954@qlogic.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>


#ifndef _STDARG_H
#define _STDARG_H

// As defined in the System V x86-64 ABI spec, in section 3.5.7
typedef struct {
	unsigned int next_int_reg_offset;
	unsigned int next_vector_reg_offset;
	void *next_stack_arg;
	void *register_save_area;
} va_list[1];

#define va_start(list, last_arg) __builtin_va_start(list)
#define va_arg(list, type) __builtin_va_arg(list, type)
#define va_end(args) __builtin_va_end(list)

static unsigned long __builtin_va_arg_uint64(va_list list)
{
	unsigned long result;
	if (list->next_int_reg_offset >= 48) {
		result = *(unsigned long *)list->next_stack_arg;
		list->next_stack_arg = (char *)list->next_stack_arg + 8;
	} else {
		result = *(unsigned long *)
			((char *)list->register_save_area + list->next_int_reg_offset);
		list->next_int_reg_offset += 8;
	}

	return result;
}

#endif

#ifndef _STDARG_H
#define _STDARG_H

// As defined in the System V x86-64 ABI spec, in section 3.5.7
typedef struct {
	unsigned int next_int_reg_offset;
	unsigned int next_vector_reg_offset;
	void *next_stack_arg;
	void *register_save_area;
} va_list[1];

#define va_start(list, last_arg) __builtin_va_start(list)
#define va_arg(list, type) __builtin_va_arg(list, type)
#define va_end(list) __builtin_va_end(list)

static unsigned long __builtin_va_arg_uint64(va_list list)
{
	unsigned long result;
	if (list->next_int_reg_offset >= 48) {
		result = *(unsigned long *)list->next_stack_arg;
		list->next_stack_arg = (char *)list->next_stack_arg + 8;
	} else {
		result = *(unsigned long *)
			((char *)list->register_save_area + list->next_int_reg_offset);
		list->next_int_reg_offset += 8;
	}

	return result;
}

#endif

Fix dumb bug in va_end.

Fix dumb bug in va_end.

This was never noticed because we don't actually use the argument to
va_end.


#ifndef _TEXTMETRICS_H_
#define _TEXTMETRICS_H_

namespace canvas {
  class TextMetrics {
  public:
  TextMetrics() : width(0) { }
  TextMetrics(float _width) : width(_width) { }

    float width;

#if 0
    float ideographicBaseline;
    float alphabeticBaseline;
    float hangingBaseline;
    float emHeightDescent;
    float emHeightAscent;
    float actualBoundingBoxDescent;
    float actualBoundingBoxAscent;
    float fontBoundingBoxDescent;
    float fontBoundingBoxAscent;
    float actualBoundingBoxRight;
    float actualBoundingBoxLeft;
#endif
  };
};

#endif

#ifndef _TEXTMETRICS_H_
#define _TEXTMETRICS_H_

namespace canvas {
  class TextMetrics {
  public:
  TextMetrics() : width(0) { }
  TextMetrics(float _width) : width(_width) { }
  TextMetrics(float _width, float fontBoundingBoxDescent, float _fontBoundingBoxAscent) :
  	width(_width) fontBoundingBoxDescent(_fontBoundingBoxDescent) fontBoundingBoxAscent(_fontBoundingBoxAscent)  { }

    float width;
    float fontBoundingBoxDescent;
    float fontBoundingBoxAscent;

#if 0
    float ideographicBaseline;
    float alphabeticBaseline;
    float hangingBaseline;
    float emHeightDescent;
    float emHeightAscent;
    float actualBoundingBoxDescent;
    float actualBoundingBoxAscent;
    float actualBoundingBoxRight;
    float actualBoundingBoxLeft;
#endif
  };
};

#endif

Add fontBoundingDescent and Ascent and add constructor with them


#ifndef IPC_NS_H_
#define IPC_NS_H_

#include "crtools.h"

extern void show_ipc_ns(int fd);
extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset);
extern int prepare_ipc_ns(int pid);

#endif /* IPC_NS_H_ */

#ifndef CR_IPC_NS_H_
#define CR_IPC_NS_H_

#include "crtools.h"

extern void show_ipc_ns(int fd);
extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset);
extern int prepare_ipc_ns(int pid);

#endif /* CR_IPC_NS_H_ */

Add CR_ prefix to header defines

ips_ns.h: Add CR_ prefix to header defines

Reported-by: Stanislav Kinsbursky <43b28e187c4fe6e53d7ab0bb71957481e322f182@parallels.com>
Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@openvz.org>


#ifndef UTILS_H
#define UTILS_H

class Utils {
public:
	static const std::size_t CalculatePadding(const std::size_t offset, const std::size_t alignment) {
		const std::size_t multiplier = (offset / alignment) + 1;
		const std::size_t padding = (multiplier * alignment) - offset;
		return padding;
	}

};

#endif /* UTILS_H */

#ifndef UTILS_H
#define UTILS_H

class Utils {
public:
	static const std::size_t CalculatePadding(const std::size_t baseAddress, const std::size_t alignment) {
		const std::size_t multiplier = (baseAddress / alignment) + 1;
		const std::size_t alignedAddress = multiplier * alignment;
		const std::size_t padding = alignedAddress - baseAddress;
		return padding;
	}
};

#endif /* UTILS_H */

Rename first parameter to baseAddres to avoid confusion


#include <unistd.h>

int main(int argc, char* argv) {
   setuid(0);
   // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
   execl("/usr/bin/python2.7", "python2.7", "/home/vagrant/tails_files/test.py", (char*)NULL);
   return 0;
}

#include <unistd.h>

int main(int argc, char* argv) {
   setuid(0);
   // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
   execl("/usr/bin/python2.7", "python2.7", "/home/amnesia/Persistent/.securedrop/securedrop_init.py", (char*)NULL);
   return 0;
}

Fix path in tails_files C wrapper

Fix path in tails_files C wrapper


#include "modlib.h"

uint16_t MODBUSSwapEndian( uint16_t Data )
{
    //Change big-endian to little-endian and vice versa

    uint8_t Swap;

	//Create 2 bytes long union
    union Conversion
    {
        uint16_t Data;
        uint8_t Bytes[2];
    } Conversion;

	//Swap bytes
    Conversion.Data = Data;
    Swap = Conversion.Bytes[0];
    Conversion.Bytes[0] = Conversion.Bytes[1];
    Conversion.Bytes[1] = Swap;

    return Conversion.Data;
}

uint16_t MODBUSCRC16( uint16_t *Data, uint16_t Length )
{
	//Calculate CRC16 checksum using given data and length

	uint16_t CRC = 0xFFFF;
	uint16_t i;
	uint8_t j;

	for ( i = 0; i < Length; i++ )
	{
		CRC ^= Data[i]; //XOR current data byte with CRC value

		for ( j = 8; j != 0; j-- )
		{
			//For each bit
			//Is least-significant-bit is set?
    		if ( ( CRC & 0x0001 ) != 0 )
			{
    			CRC >>= 1; //Shift to right and xor
    			CRC ^= 0xA001;
    		}
    		else
    			CRC >>= 1;
		}
	}
	return CRC;
}

#include "modlib.h"

uint16_t MODBUSSwapEndian( uint16_t Data )
{
    //Change big-endian to little-endian and vice versa

    uint8_t Swap;

	//Create 2 bytes long union
    union Conversion
    {
        uint16_t Data;
        uint8_t Bytes[2];
    } Conversion;

	//Swap bytes
    Conversion.Data = Data;
    Swap = Conversion.Bytes[0];
    Conversion.Bytes[0] = Conversion.Bytes[1];
    Conversion.Bytes[1] = Swap;

    return Conversion.Data;
}

uint16_t MODBUSCRC16( uint8_t *Data, uint16_t Length )
{
	//Calculate CRC16 checksum using given data and length

	uint16_t CRC = 0xFFFF;
	uint16_t i;
	uint8_t j;

	for ( i = 0; i < Length; i++ )
	{
		CRC ^= Data[i]; //XOR current data byte with CRC value

		for ( j = 8; j != 0; j-- )
		{
			//For each bit
			//Is least-significant-bit is set?
    		if ( ( CRC & 0x0001 ) != 0 )
			{
    			CRC >>= 1; //Shift to right and xor
    			CRC ^= 0xA001;
    		}
    		else
    			CRC >>= 1;
		}
	}
	return CRC;
}

Fix types in CRC16 function

Fix types in CRC16 function


#ifndef VAST_ACTOR_H
#define VAST_ACTOR_H

#include <cppa/event_based_actor.hpp>
#include "vast/logger.h"

namespace vast {

namespace exit {

constexpr uint32_t done   = cppa::exit_reason::user_defined;
constexpr uint32_t stop   = cppa::exit_reason::user_defined + 1;
constexpr uint32_t error  = cppa::exit_reason::user_defined + 2;

} // namespace exit

/// An actor enhanced in
template <typename Derived>
class actor : public cppa::event_based_actor
{
public:
  /// Implements `cppa::event_based_actor::init`.
  virtual void init() override
  {
    VAST_LOG_ACTOR_VERBOSE(derived()->description(), "spawned");
    derived()->act();
    if (! has_behavior())
    {
      VAST_LOG_ACTOR_ERROR(derived()->description(),
                           "act() did not set a behavior, terminating");
      quit();
    }
  }

  /// Overrides `event_based_actor::on_exit`.
  virtual void on_exit() override
  {
    VAST_LOG_ACTOR_VERBOSE(derived()->description(), "terminated");
  }

private:
  Derived const* derived() const
  {
    return static_cast<Derived const*>(this);
  }

  Derived* derived()
  {
    return static_cast<Derived*>(this);
  }
};

} // namespace vast

#endif

#ifndef VAST_ACTOR_H
#define VAST_ACTOR_H

#include <cppa/event_based_actor.hpp>
#include "vast/logger.h"

namespace vast {

namespace exit {

constexpr uint32_t done   = cppa::exit_reason::user_defined;
constexpr uint32_t stop   = cppa::exit_reason::user_defined + 1;
constexpr uint32_t error  = cppa::exit_reason::user_defined + 2;

} // namespace exit

/// An actor enhanced in
template <typename Derived>
class actor : public cppa::event_based_actor
{
public:
  /// Implements `cppa::event_based_actor::init`.
  virtual void init() override
  {
    VAST_LOG_ACTOR_VERBOSE(derived()->description(), "spawned");
    derived()->act();
    if (! has_behavior())
    {
      VAST_LOG_ACTOR_ERROR(derived()->description(),
                           "act() did not set a behavior, terminating");
      quit(exit::error);
    }
  }

  /// Overrides `event_based_actor::on_exit`.
  virtual void on_exit() override
  {
    VAST_LOG_ACTOR_VERBOSE(derived()->description(), "terminated");
  }

private:
  Derived const* derived() const
  {
    return static_cast<Derived const*>(this);
  }

  Derived* derived()
  {
    return static_cast<Derived*>(this);
  }
};

} // namespace vast

#endif

Exit with error on missing behavior.

Exit with error on missing behavior.


#ifdef ENABLE_STATS

#include <stdio.h>
#include <sys/resource.h>

static size_t stats_peek_rss()
{
  struct rusage rusage;
  getrusage( RUSAGE_SELF, &rusage );
  return (size_t) (rusage.ru_maxrss * 1024L);
}

__attribute__((destructor))
void _print_stats(void)
{
  size_t rss = stats_peek_rss();
  printf("Maximum RSS: %ld KB\n", rss / 1024L);
}

#endif

Add function to read peek rss usage.

Add function to read peek rss usage.


/**
 * @file       BlynkSimpleWiFiNINA.h
 * @author     Volodymyr Shymanskyy
 * @license    This project is released under the MIT License (MIT)
 * @copyright  Copyright (c) 2018 Volodymyr Shymanskyy
 * @date       Sep 2018
 * @brief
 *
 */

#ifndef BlynkSimpleWiFiNINA_h
#define BlynkSimpleWiFiNINA_h

#ifndef BLYNK_INFO_CONNECTION
#define BLYNK_INFO_CONNECTION  "WiFiNINA"
#endif

#define BLYNK_SEND_ATOMIC
//#define BLYNK_USE_SSL

#include <WiFiNINA.h>
#include <Adapters/BlynkWiFiCommon.h>

//static WiFiSSLClient _blynkWifiClient;
static WiFiClient _blynkWifiClient;

static BlynkArduinoClient _blynkTransport(_blynkWifiClient);
BlynkWifiCommon Blynk(_blynkTransport);

#include <BlynkWidgets.h>

#endif

Add WiFiNINA, Arduino MKR WiFi 1010 support


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

#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

#include "ppapi/c/pp_var.h"

#define PPB_PRIVATE_INTERFACE "PPB_Private;1"

typedef enum _ppb_ResourceString {
  PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;

typedef struct _ppb_Private {
  // Returns a localized string.
  PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;

#endif  // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

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

#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

#include "third_party/ppapi/c/pp_var.h"

#define PPB_PRIVATE_INTERFACE "PPB_Private;1"

typedef enum _ppb_ResourceString {
  PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;

typedef struct _ppb_Private {
  // Returns a localized string.
  PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;

#endif  // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

Add third_party/ prefix to ppapi include for checkdeps.

The only users of this ppb should be inside chrome so this should work fine.

TBR=jam@chromium.org

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

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


#ifndef QXTFILTERDIALOG_P_H_INCLUDED
#define QXTFILTERDIALOG_P_H_INCLUDED

#include <QObject>
#include <QModelIndex>
#include <QRegExp>
#include <QPointer>
#include "qxtpimpl.h"

class QxtFilterDialog;
class QAbstractItemModel;
class QTreeView;
class QSortFilterProxyModel;
class QLineEdit;
class QCheckBox;
class QComboBox;

class QxtFilterDialogPrivate : public QObject, public QxtPrivate<QxtFilterDialog>
{
    Q_OBJECT
    public:
        QxtFilterDialogPrivate();
        QXT_DECLARE_PUBLIC(QxtFilterDialog);

        /*widgets*/
        QCheckBox * matchCaseOption;
        QCheckBox * filterModeOption;
        QComboBox * filterMode;
        QTreeView * listingTreeView;
        QLineEdit * lineEditFilter;

        /*models*/
        QPointer<QAbstractItemModel>    model;
        QSortFilterProxyModel*          proxyModel;

        /*properties*/
        int lookupColumn;
        int lookupRole;
        QRegExp::PatternSyntax syntax;
        Qt::CaseSensitivity caseSensitivity;

        /*result*/
        QModelIndex selectedIndex;

        /*member functions*/
        void updateFilterPattern();

    public slots:
        void createRegExpPattern(const QString &rawText);
        void filterModeOptionStateChanged(const int state);
        void matchCaseOptionStateChanged(const int state);
        void filterModeChoosen(int index);
};

#endif

Fix bad fileformat (was DOS without a final line terminator)


//#define DEBUG_INDEXER

#define MAX_CORPUS_FILE_SZ  (1024 * 8)

//#define DEBUG_INDEXER

#define MAX_CORPUS_FILE_SZ  (1024 * 1024 * 16)

Increase corpus buffer to 16MB

Increase corpus buffer to 16MB


#ifndef ROOT_TMevSimConverter
#define ROOT_TMevSimConverter

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#include "TObject.h"

class TMevSimConverter : public TObject {

    enum {kMaxParticles = 35};

    Int_t  fNPDGCodes;                   // Number of PDG codes known by G3
    Int_t  fPDGCode [kMaxParticles];     // Translation table of PDG codes

    void DefineParticles();

  public:

    TMevSimConverter() {DefineParticles();}
    virtual ~TMevSimConverter() {}

    Int_t PDGFromId(Int_t gpid);
    Int_t IdFromPDG(Int_t pdg);

    ClassDef(TMevSimConverter,1)
};

#endif

#ifndef ROOT_TMevSimConverter
#define ROOT_TMevSimConverter

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#include "TObject.h"

class TMevSimConverter : public TObject {

    enum {kMaxParticles = 35};

    Int_t  fNPDGCodes;                   // Number of PDG codes known by G3
    Int_t  fPDGCode [kMaxParticles];     // Translation table of PDG codes

    void DefineParticles();

  public:

    TMevSimConverter() : fNPDGCodes(0) {DefineParticles();}
    virtual ~TMevSimConverter() {}

    Int_t PDGFromId(Int_t gpid);
    Int_t IdFromPDG(Int_t pdg);

    ClassDef(TMevSimConverter,1)
};

#endif

Initialize fNPDGcodes to 0 to prevent sigsegv (Christian)


#include "fitz_base.h"
#include "fitz_stream.h"

fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
	fz_error reason;
	unsigned char *oldrp;
	unsigned char *oldwp;

	assert(!out->eof);

	oldrp = in->rp;
	oldwp = out->wp;

	if (f->done)
	    return fz_iodone;

	reason = f->process(f, in, out);

	assert(in->rp <= in->wp);
	assert(out->wp <= out->ep);

	f->consumed = in->rp > oldrp;
	f->produced = out->wp > oldwp;
	f->count += out->wp - oldwp;

	/* iodone or error */
	if (reason != fz_ioneedin && reason != fz_ioneedout)
	{
		if (reason != fz_iodone)
			reason = fz_rethrow(reason, "cannot process filter");
		out->eof = 1;
		f->done = 1;
	}

	return reason;
}

fz_filter *
fz_keepfilter(fz_filter *f)
{
	f->refs ++;
	return f;
}

void
fz_dropfilter(fz_filter *f)
{
	if (--f->refs == 0)
	{
		if (f->drop)
			f->drop(f);
		fz_free(f);
	}
}

#include "fitz_base.h"
#include "fitz_stream.h"

fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
	fz_error reason;
	unsigned char *oldrp;
	unsigned char *oldwp;

	oldrp = in->rp;
	oldwp = out->wp;

	if (f->done)
	    return fz_iodone;

	assert(!out->eof);

	reason = f->process(f, in, out);

	assert(in->rp <= in->wp);
	assert(out->wp <= out->ep);

	f->consumed = in->rp > oldrp;
	f->produced = out->wp > oldwp;
	f->count += out->wp - oldwp;

	/* iodone or error */
	if (reason != fz_ioneedin && reason != fz_ioneedout)
	{
		if (reason != fz_iodone)
			reason = fz_rethrow(reason, "cannot process filter");
		out->eof = 1;
		f->done = 1;
	}

	return reason;
}

fz_filter *
fz_keepfilter(fz_filter *f)
{
	f->refs ++;
	return f;
}

void
fz_dropfilter(fz_filter *f)
{
	if (--f->refs == 0)
	{
		if (f->drop)
			f->drop(f);
		fz_free(f);
	}
}

Move assert test of EOF to after testing if a filter is done.


/* Author:  Lisandro Dalcin   */
/* Contact: dalcinl@gmail.com */

#ifndef MPI_COMPAT_H
#define MPI_COMPAT_H

#include <mpi.h>

#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
typedef void *PyMPI_MPI_Message;
#define MPI_Message PyMPI_MPI_Message
#endif

#endif/*MPI_COMPAT_H*/

/* Author:  Lisandro Dalcin   */
/* Contact: dalcinl@gmail.com */

#ifndef MPI_COMPAT_H
#define MPI_COMPAT_H

#include <mpi.h>

#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
typedef void *PyMPI_MPI_Message;
#define MPI_Message PyMPI_MPI_Message
#endif

#if (MPI_VERSION < 4) && !defined(PyMPI_HAVE_MPI_Session)
typedef void *PyMPI_MPI_Session;
#define MPI_Session PyMPI_MPI_Session
#endif

#endif/*MPI_COMPAT_H*/

Define MPI_Session for compatibility with current mpi4py main branch


#include <pthread.h>
#include <assert.h>

int g;

void *t_fun(void *arg) {
  return NULL;
}

void main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  g = 1;
  assert(g); // Mine's analysis would succeed, our mine-W doesn't
}

#include <pthread.h>
#include <assert.h>

int g;

void *t_fun(void *arg) {
  return NULL;
}

void main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  g = 1;
  assert(g); // TODO (Mine's analysis would succeed, our mine-W doesn't)
}

Mark Mine init privatization test TODO to make others pass


// RUN: %layout_check %s

struct A
{
	int : 0;
	int a;
	int : 0;
	int b;
	int : 0;
};

struct A a = { 1, 2 };

// RUN: %layout_check %s

struct A
{
	int : 0;
	int a;
	int : 0;
	int : 0;
	int : 0;
	int : 0;
	int b;
	int : 0;
};

struct A a = { 1, 2 };

Add more zero-width fields to bitfield padding test


// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify

_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-extension"
_Nonnull int *ptr2; // no-warning
#pragma clang diagnostic pop

#if __has_feature(nullability)
#  error Nullability should not be supported in C under -pedantic -std=c99
#endif

#if !__has_extension(nullability)
#  error Nullability should always be supported as an extension
#endif

// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify

_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-extension"
_Nonnull int *ptr2; // no-warning
#pragma clang diagnostic pop

#if !__has_feature(nullability)
#  error Nullability should always be supported
#endif

#if !__has_extension(nullability)
#  error Nullability should always be supported as an extension
#endif

Fix a test case broken by my previous commit.

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


//
//  FLEXRuntimeSafety.h
//  FLEX
//
//  Created by Tanner on 3/25/17.
//

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

#pragma mark - Classes

extern NSUInteger const kFLEXKnownUnsafeClassCount;
extern const Class * FLEXKnownUnsafeClassList(void);
extern NSSet * FLEXKnownUnsafeClassNames(void);
extern CFSetRef FLEXKnownUnsafeClasses;

static inline BOOL FLEXClassIsSafe(Class cls) {
    if (!cls) return NO;

    return !CFSetContainsValue(FLEXKnownUnsafeClasses, (__bridge void *)cls);
}

static inline BOOL FLEXClassNameIsSafe(NSString *cls) {
    if (!cls) return NO;

    NSSet *ignored = FLEXKnownUnsafeClassNames();
    return ![ignored containsObject:cls];
}

#pragma mark - Ivars

extern CFSetRef FLEXKnownUnsafeIvars;

static inline BOOL FLEXIvarIsSafe(Ivar ivar) {
    if (!ivar) return NO;

    return !CFSetContainsValue(FLEXKnownUnsafeIvars, ivar);
}

//
//  FLEXRuntimeSafety.h
//  FLEX
//
//  Created by Tanner on 3/25/17.
//

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

#pragma mark - Classes

extern NSUInteger const kFLEXKnownUnsafeClassCount;
extern const Class * FLEXKnownUnsafeClassList(void);
extern NSSet * FLEXKnownUnsafeClassNames(void);
extern CFSetRef FLEXKnownUnsafeClasses;

static Class cNSObject = nil, cNSProxy = nil;

__attribute__((constructor))
static void FLEXInitKnownRootClasses() {
    cNSObject = [NSObject class];
    cNSProxy = [NSProxy class];
}

static inline BOOL FLEXClassIsSafe(Class cls) {
    // Is it nil or known to be unsafe?
    if (!cls || CFSetContainsValue(FLEXKnownUnsafeClasses, (__bridge void *)cls)) {
        return NO;
    }

    // Is it a known root class?
    if (!class_getSuperclass(cls)) {
        return cls == cNSObject || cls == cNSProxy;
    }

    // Probably safe
    return YES;
}

static inline BOOL FLEXClassNameIsSafe(NSString *cls) {
    if (!cls) return NO;

    NSSet *ignored = FLEXKnownUnsafeClassNames();
    return ![ignored containsObject:cls];
}

#pragma mark - Ivars

extern CFSetRef FLEXKnownUnsafeIvars;

static inline BOOL FLEXIvarIsSafe(Ivar ivar) {
    if (!ivar) return NO;

    return !CFSetContainsValue(FLEXKnownUnsafeIvars, ivar);
}

Make FLEXClassIsSafe return NO for unknown root classes


/*
 * Copyright (C) 2009 Cjacker Huang <jzhuang@redflag-linux.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; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef HS_WEBKIT_H
#define HS_WEBKIT_H
/* to avoid stdbool.h error in JavaScriptCore/JSBase.h*/
#define _Bool int

#define WINAPI
#define CALLBACK

/* include webkit headers*/
#include <webkit/webkit.h>
#include <webkit/webkitdom.h>
#endif

#include "events.h"

/*
 * Copyright (C) 2009 Cjacker Huang <jzhuang@redflag-linux.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; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifdef __BLOCKS__
#undef __BLOCKS__
#endif

#ifndef HS_WEBKIT_H
#define HS_WEBKIT_H
/* to avoid stdbool.h error in JavaScriptCore/JSBase.h*/
#define _Bool int

#define WINAPI
#define CALLBACK

/* include webkit headers*/
#include <webkit/webkit.h>
#include <webkit/webkitdom.h>
#endif

#include "events.h"

Fix CPP issue on OS X

Fix CPP issue on OS X


#ifndef _NET_UTILS_H
#define _NET_UTILS_H

#include <string.h>
#include <unistd.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>

char *get_local_addr(int fd);
int set_sock_nonblock(int sockfd);
int tcp_open();
int tcp_connect(int sock_fd, const char *host, unsigned int port);
int tcp_write(int fd, const char *buf, int n);
int tcp_read(int fd, char *buf, int n);

#endif /* _NET_UTILS_H */

#ifndef _NET_UTILS_H
#define _NET_UTILS_H

#include <string.h>
#include <unistd.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>

char *get_local_addr(int fd);
int set_sock_nonblock(int sockfd);
int tcp_open(void);
int tcp_connect(int sock_fd, const char *host, unsigned int port);
int tcp_write(int fd, const char *buf, int n);
int tcp_read(int fd, char *buf, int n);

#endif /* _NET_UTILS_H */

OTHER: Fix function prototype in airplay plugin.


#include <stdlib.h>

#include <event2/event.h>
#include <event2/http.h>

static void time_request_cb(struct evhttp_request *req, void *arg)
{
    (void) arg;
    printf("Received request for %s\n", evhttp_request_get_uri(req));
    evhttp_send_reply(req, 200, "OK", NULL);
}

int main(int argc, char **argv) {
    struct event_base *base;
    struct evhttp *http;
    struct evhttp_bound_socket *handle;

    base = event_base_new();
    if (base == NULL) {
        fprintf(stderr, "couldn't create event base\n");
        return EXIT_FAILURE;
    }

    http = evhttp_new(base);
    if (http == NULL) {
        fprintf(stderr, "couldn't create evhttp\n");
        return EXIT_FAILURE;
    }

    evhttp_set_gencb(http, time_request_cb, NULL);
    handle = evhttp_bind_socket_with_handle(http, "0.0.0.0", 8080);
    if (handle == NULL) {
        fprintf(stderr, "couldn't bind to port 8080\n");
        return EXIT_FAILURE;
    }

    event_base_dispatch(base);

    return EXIT_SUCCESS;
}

#include <stdlib.h>
#include <time.h>

#include <event2/buffer.h>
#include <event2/event.h>
#include <event2/http.h>

static void time_request_cb(struct evhttp_request *req, void *arg)
{
    (void) arg;
    struct evbuffer *evb = evbuffer_new();

    printf("Received request for %s\n", evhttp_request_get_uri(req));

    time_t ts = time(NULL);
    evbuffer_add_printf(evb, "%s", ctime(&ts));

    evhttp_send_reply(req, 200, "OK", evb);
    evbuffer_free(evb);
}

int main(int argc, char **argv) {
    struct event_base *base;
    struct evhttp *http;
    struct evhttp_bound_socket *handle;

    base = event_base_new();
    if (base == NULL) {
        fprintf(stderr, "couldn't create event base\n");
        return EXIT_FAILURE;
    }

    http = evhttp_new(base);
    if (http == NULL) {
        fprintf(stderr, "couldn't create evhttp\n");
        return EXIT_FAILURE;
    }

    evhttp_set_gencb(http, time_request_cb, NULL);
    handle = evhttp_bind_socket_with_handle(http, "0.0.0.0", 8080);
    if (handle == NULL) {
        fprintf(stderr, "couldn't bind to port 8080\n");
        return EXIT_FAILURE;
    }

    event_base_dispatch(base);

    return EXIT_SUCCESS;
}

Return local server time on request

Return local server time on request


/* $FreeBSD$ */
/* Derived from:  Id: linux_genassym.c,v 1.8 1998/07/29 15:50:41 bde Exp */

#include <sys/param.h>
#include <sys/assym.h>

#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>

/* XXX: This bit sucks rocks, but gets rid of compiler errors.  Maybe I should
 * fix the include files instead... */
#define SVR4_MACHDEP_JUST_REGS
#include <i386/svr4/svr4_machdep.h>

ASSYM(SVR4_SIGF_HANDLER, offsetof(struct svr4_sigframe, sf_handler));
ASSYM(SVR4_SIGF_UC, offsetof(struct svr4_sigframe, sf_uc));
ASSYM(SVR4_UC_FS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_FS]));
ASSYM(SVR4_UC_GS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_GS]));
ASSYM(SVR4_UC_EFLAGS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_EFL]));

/* $FreeBSD$ */
/* Derived from:  Id: linux_genassym.c,v 1.8 1998/07/29 15:50:41 bde Exp */

#include <sys/param.h>
#include <sys/assym.h>
#include <sys/systm.h>

#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>

/* XXX: This bit sucks rocks, but gets rid of compiler errors.  Maybe I should
 * fix the include files instead... */
#define SVR4_MACHDEP_JUST_REGS
#include <i386/svr4/svr4_machdep.h>

ASSYM(SVR4_SIGF_HANDLER, offsetof(struct svr4_sigframe, sf_handler));
ASSYM(SVR4_SIGF_UC, offsetof(struct svr4_sigframe, sf_uc));
ASSYM(SVR4_UC_FS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_FS]));
ASSYM(SVR4_UC_GS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_GS]));
ASSYM(SVR4_UC_EFLAGS, offsetof(struct svr4_ucontext,
    uc_mcontext.greg[SVR4_X86_EFL]));

Include <sys/systm.h> for the definition of offsetof() instead of depending on the definition being misplaced in <sys/types.h>. The definition probably belongs in <sys/stddef.h>.


#pragma once

#include "types/process_filter.h"

namespace TooManyPeeps {

  class BackgroundExtractor : public ProcessFilter {

    private:
      static const bool TRACK_SHADOWS = false;

    private:
      cv::Ptr<cv::BackgroundSubtractor> backgroundExtractor;

    public:
      BackgroundExtractor(const cv::Mat& original, cv::Mat& result, int historySize, double threshold);
      ~BackgroundExtractor(void);

    public:
      virtual void execute(void);
  };

};

#pragma once

#include "types/process_filter.h"

namespace TooManyPeeps {

  class BackgroundExtractor : public ProcessFilter {

    private:
      static const bool TRACK_SHADOWS = true;

    private:
      cv::Ptr<cv::BackgroundSubtractor> backgroundExtractor;

    public:
      BackgroundExtractor(const cv::Mat& original, cv::Mat& result, int historySize, double threshold);
      ~BackgroundExtractor(void);

    public:
      virtual void execute(void);
  };

};

Allow mog to track shadows

Allow mog to track shadows


//
//  kjchess.h
//  kjchess
//
//  Created by Kristopher Johnson on 3/11/17.
//  Copyright © 2017 Kristopher Johnson. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for kjchess.
FOUNDATION_EXPORT double kjchessVersionNumber;

//! Project version string for kjchess.
FOUNDATION_EXPORT const unsigned char kjchessVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <kjchess/PublicHeader.h>

//
//  kjchess.h
//  kjchess
//
//  Copyright © 2017 Kristopher Johnson. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for kjchess.
FOUNDATION_EXPORT double kjchessVersionNumber;

//! Project version string for kjchess.
FOUNDATION_EXPORT const unsigned char kjchessVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <kjchess/PublicHeader.h>

Remove a "Created by" comment line

Remove a "Created by" comment line


void osx_cf_run_loop_run();

CFRunLoopRunResult osx_cf_run_loop_run_in_mode
(CFStringRef mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled);

Add run_in_mode prototype to util header


/*****************************************************************************
 * internal.h:
 *****************************************************************************
 * Copyright (C) 2010-2012 L-SMASH project
 *
 * Authors:  Takashi Hirata <silverfilain@gmail.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *****************************************************************************/

/* This file is available under an ISC license. */

#ifndef INTERNAL_H
#define INTERNAL_H

#include "common/osdep.h" /* must be placed before stdio.h */
#include <stdio.h>
#include <assert.h>

#ifndef lsmash_fseek
#define lsmash_fseek fseek
#define lsmash_ftell ftell
#endif

#include "lsmash.h"

#endif

/*****************************************************************************
 * internal.h:
 *****************************************************************************
 * Copyright (C) 2010-2012 L-SMASH project
 *
 * Authors:  Takashi Hirata <silverfilain@gmail.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *****************************************************************************/

/* This file is available under an ISC license. */

#ifndef INTERNAL_H
#define INTERNAL_H

#include "common/osdep.h" /* must be placed before stdio.h */
#include <stdio.h>
#include <assert.h>

#ifndef lsmash_fseek
#define lsmash_fseek fseeko
#define lsmash_ftell ftello
#endif

#include "lsmash.h"

#endif

Use ftello/fseeko instead of ftell/fseek

On 32-bit systems, fseek returns a long, which is 32-bits, and
fseek takes its offset argument as a long, as well. In order
to return and use 64-bit offsets, use ftello and fseeko, along
which defining _FILE_OFFSET_BITS 64, which is already in osdep.h.


#include <stdio.h>
#include "main.h"

int main(int argc, char *argv[]) {
	usage(argv[0]);
}

void usage(char *utilname) {
	printf("Usage: %s <input_file> <output_file> [options]\n", utilname);
	printf("WARNING: UTILITY IS NOT FULLY FUNCTIONAL YET\n");
	printf("Options:\n");
	//TODO: add optional arguments for each filter option
	printf("  -b --blur             Apply box blur\n");
	printf("  -g --gaussian         Apply Gaussian blur\n");
	printf("  -s --sharpen          Sharpen image\n");
	printf("  -u --unsharpen        Unsharpen image\n");
	printf("  -o --outline          Outline image\n");
	printf("  -e --emboss           Emboss image\n");
	printf("  --topsobel            Apply top Sobel filter\n");
	printf("  --bottomsobel         Apply bottom Sobel filter\n");
	printf("  --rightsobel          Apply right Sobel filter\n");
	printf("  --leftsobel           Apply left Sobel filter\n");
	printf("  -c FILE --custom=FILE Apply custom filter\n");
}

#include <stdio.h>
#include "main.h"

int main(int argc, char *argv[])
{
	usage(argv[0]);
}

void usage(char *utilname)
{
	printf("Usage: %s <input_file> <output_file> [options]\n", utilname);
	printf("WARNING: UTILITY IS NOT FULLY FUNCTIONAL YET\n");
	printf("Options:\n");
	/* TODO: add optional arguments for each filter option */
	printf("  -b --blur             Apply box blur\n");
	printf("  -g --gaussian         Apply Gaussian blur\n");
	printf("  -s --sharpen          Sharpen image\n");
	printf("  -u --unsharpen        Unsharpen image\n");
	printf("  -o --outline          Outline image\n");
	printf("  -e --emboss           Emboss image\n");
	printf("  --topsobel            Apply top Sobel filter\n");
	printf("  --bottomsobel         Apply bottom Sobel filter\n");
	printf("  --rightsobel          Apply right Sobel filter\n");
	printf("  --leftsobel           Apply left Sobel filter\n");
	printf("  -c FILE --custom=FILE Apply custom filter\n");
}

Convert to Linux kernel style

Convert to Linux kernel style


#ifndef MAIN_H
#define MAIN_H
#include <cstdlib>
#include <iostream>
#include <tr1/unordered_map>
#include <vector>
#include <list>
#include <set>

#include <pthread.h>
#endif

#ifndef MAIN_H
#define MAIN_H
#include <unistd.h>
#include <cstdlib>
#include <iostream>
#include <tr1/unordered_map>
#include <vector>
#include <list>
#include <set>

#include <pthread.h>
#endif

Fix compile on some systems

Fix compile on some systems


/*
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

#ifndef lint
static char rcsid[] = "$FreeBSD$";
#endif

#include <float.h>

#include "fpmath.h"
#include "math.h"
#include "math_private.h"

#define	LDBL_INFNAN_EXP	(LDBL_MAX_EXP * 2 - 1)

float
nexttowardf(float x, long double y)
{
	union IEEEl2bits uy;
	volatile float t;
	int32_t hx,ix;

	GET_FLOAT_WORD(hx,x);
	ix = hx&0x7fffffff;		/* |x| */
	uy.e = y;

	if((ix>0x7f800000) ||
	   (uy.bits.exp == LDBL_INFNAN_EXP &&
	    ((uy.bits.manh&~LDBL_NBIT)|uy.bits.manl) != 0))
	   return x+y;	/* x or y is nan */
	if(x==y) return (float)y;		/* x=y, return y */
	if(ix==0) {				/* x == 0 */
	    SET_FLOAT_WORD(x,(uy.bits.sign<<31)|1);/* return +-minsubnormal */
	    t = x*x;
	    if(t==x) return t; else return x;	/* raise underflow flag */
	}
	if(hx>=0 ^ x < y)			/* x -= ulp */
	    hx -= 1;
	else					/* x += ulp */
	    hx += 1;
	ix = hx&0x7f800000;
	if(ix>=0x7f800000) return x+x;	/* overflow  */
	if(ix<0x00800000) {		/* underflow */
	    t = x*x;
	    if(t!=x) {		/* raise underflow flag */
	        SET_FLOAT_WORD(y,hx);
		return y;
	    }
	}
	SET_FLOAT_WORD(x,hx);
	return x;
}

Implement nexttowardf. This is used on both platforms with 11-bit exponents and platforms with 15-bit exponents for long doubles.


#include <Python.h>
#include <drafter/drafter.h>

static PyObject *drafterpy_parse_blueprint_to(PyObject *self, PyObject *args){
    char *blueprint;
    char *format;
    char *result = NULL;

    drafter_options options;
    options.sourcemap = true;

    if(!PyArg_ParseTuple(args, "ss", &blueprint, &format))
        return NULL;

    if(strcmp("json", format) == 0)
        options.format = DRAFTER_SERIALIZE_JSON;
    else if (strcmp("yaml", format) == 0)
        options.format = DRAFTER_SERIALIZE_YAML;
    else {
        fprintf(stderr, "Fatal error: Invalid output format\n");
        return NULL;
    }
    drafter_parse_blueprint_to(blueprint, &result, options);

    return Py_BuildValue("s", result);

}

static PyObject *drafterpy_check_blueprint(PyObject *self, PyObject *args){
    char *blueprint;
    char *format;

    if(!PyArg_ParseTuple(args, "s", &blueprint))
        return NULL;

    drafter_result* result = drafter_check_blueprint(blueprint);

    if (result == NULL)
        return Py_BuildValue("O", Py_True);

    drafter_free_result(result);
    return Py_BuildValue("O", Py_False);

}

static PyMethodDef drafterpy_methods[] = {
    {"parse_blueprint_to", (PyCFunction)drafterpy_parse_blueprint_to, METH_VARARGS,
     "Parses a blueprint into JSON or YAML."},
    {"check_blueprint", (PyCFunction)drafterpy_check_blueprint, METH_VARARGS,
     "Verify given blueprint correctness."},
    {NULL, NULL, 0, NULL}   /* Sentinel */
};

static char drafterpy_docstring[] =
    "Python bindings for libdrafter.\nDrafter is a Snowcrash parser harness.";

static struct PyModuleDef drafterpymodule = {
    PyModuleDef_HEAD_INIT,
    "drafterpy",
    drafterpy_docstring,
    -1,
    drafterpy_methods
};

PyMODINIT_FUNC PyInit_drafterpy(void){
    return PyModule_Create(&drafterpymodule);
}

int main(int argc, char *argv[]){
    wchar_t *program = Py_DecodeLocale(argv[0], NULL);
    if (program == NULL) {
        fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
    }

    /* Add a built-in module, before Py_Initialize */
    PyImport_AppendInittab("drafterpy", PyInit_drafterpy);

    /* Pass argv[0] to the Python interpreter. REQUIRED */
    Py_SetProgramName(program);

    /* Initialize the Python Interpreter. REQUIRED */
    Py_Initialize();

    PyImport_ImportModule("drafterpy");

    PyMem_RawFree(program);
    return 0;
}

Add C-API bindings with initial methods. It can verify a blueprint and parse it into json or yaml.


/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2006  Ralf Baechle <ralf@linux-mips.org>
 *
 */
#ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H
#define __ASM_MACH_GENERIC_DMA_COHERENCE_H

struct device;

static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
{
	return virt_to_phys(addr);
}

static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
{
	return page_to_phys(page);
}

static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
{
	return dma_addr;
}

static void plat_unmap_dma_mem(dma_addr_t dma_addr)
{
}

static inline int plat_device_is_coherent(struct device *dev)
{
#ifdef CONFIG_DMA_COHERENT
	return 1;
#endif
#ifdef CONFIG_DMA_NONCOHERENT
	return 0;
#endif
}

#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */

/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2006  Ralf Baechle <ralf@linux-mips.org>
 *
 */
#ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H
#define __ASM_MACH_GENERIC_DMA_COHERENCE_H

struct device;

static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
	size_t size)
{
	return virt_to_phys(addr);
}

static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
	struct page *page)
{
	return page_to_phys(page);
}

static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
{
	return dma_addr;
}

static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
{
}

static inline int plat_device_is_coherent(struct device *dev)
{
#ifdef CONFIG_DMA_COHERENT
	return 1;
#endif
#ifdef CONFIG_DMA_NONCOHERENT
	return 0;
#endif
}

#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */

[MIPS] DMA: Fix a bunch of warnings due to missing inline keywords.

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>


// Copyright 2019 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef BITS_H_
#define BITS_H_

#ifdef __BMI2__

#include <immintrin.h>

#include <cstdint>

namespace qsim {
namespace bits {

inline uint32_t ExpandBits(uint32_t bits, unsigned n, uint32_t mask) {
  return _pdep_u32(bits, mask);
}

inline uint64_t ExpandBits(uint64_t bits, unsigned n, uint64_t mask) {
  return _pdep_u64(bits, mask);
}

inline uint32_t CompressBits(uint32_t bits, unsigned n, uint32_t mask) {
  return _pext_u32(bits, mask);
}

inline uint64_t CompressBits(uint64_t bits, unsigned n, uint64_t mask) {
  return _pext_u64(bits, mask);
}

}  // namespace bits
}  // namespace qsim

#else  // __BMI2__

namespace qsim {
namespace bits {

template <typename I>
inline I ExpandBits(I bits, unsigned n, I mask) {
  I ebits = 0;
  unsigned k = 0;

  for (unsigned i = 0; i < n; ++i) {
    if ((mask >> i) & 1) {
      ebits |= ((bits >> k) & 1) << i;
      ++k;
    }
  }

  return ebits;
}

template <typename I>
inline I CompressBits(I bits, unsigned n, I mask) {
  I sbits = 0;
  unsigned k = 0;

  for (unsigned i = 0; i < n; ++i) {
    if ((mask >> i) & 1) {
      sbits |= ((bits >> i) & 1) << k;
      ++k;
    }
  }

  return sbits;
}

}  // namespace bits
}  // namespace qsim

#endif  // __BMI2__

namespace qsim {
namespace bits {

template <typename I>
inline I PermuteBits(I bits, unsigned n, const std::vector<unsigned>& perm) {
  I pbits = 0;

  for (unsigned i = 0; i < n; ++i) {
    pbits |= ((bits >> i) & 1) << perm[i];
  }

  return pbits;
}

}  // namespace bits
}  // namespace qsim

#endif  // BITS_H_

Add matrix routines for multi-qubit gates. Add required file.


#ifndef LIBSPELL_H
#define LIBSPELL_H
char *spell(sqlite3*, char *);
char *get_suggestions(char *);

#endif

#ifndef LIBSPELL_H
#define LIBSPELL_H
char *spell(char *);
char *get_suggestions(char *);

#endif

Remove sqlite3 * parameter from the spell function's declaration.


// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

Add missing '-no-canonical-prefixes' in test.

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


#pragma once

#include <cassert>

namespace Utilities {
namespace Array {
template <class T, class Size = unsigned int>
class Array {
 public:
  Array(T* data, Size capacity) : data_(data), capacity_(capacity) {
    assert(data_);
    assert(capacity_ > 0);
  }

  T& operator[](Size index) {
    assert(index < capacity_);
    return data_[index];
  }
  const T& operator[](Size index) const {
    assert(index < capacity_);
    return data_[index];
  }
  T& operator*() { return *data_; }
  const T& operator*() const { return *data_; }
  T* data() { return data_; }
  const T* data() const { return data_; }

  /**
   * If T is primitive but not floating point, or if value is zero, the
   * caller should probably use memset on the raw pointer instead
   */
  void assign(Size numElements, const T& value) {
#pragma vector always assert
    for (Size i = 0; i < numElements; ++i) {
      data_[i] = value;
    }
  }
  void clear() { capacity_ = 0; }

  Size capacity() const { return capacity_; }
  Size size() const { return capacity_; }
  Size length() const { return capacity_; }

 private:
  T* data_;
  Size capacity_;
};
}
}

#pragma once

#include <cassert>
#include <functional>

namespace Utilities {
namespace Array {
template <class T, class Size = unsigned int>
class Array {
 public:
  Array(T*&& data, Size capacity, std::function<void(T**)>&& deleteData)
      : data_(std::move(data)),
        capacity_(capacity),
        deleteData_(std::move(deleteData)) {
    assert(data_);
    assert(capacity_ > 0);
  }
  Array(T* data, Size capacity)
      : data_(data), capacity_(capacity), deleteData_([](T**) {}) {
    assert(data_);
    assert(capacity_ > 0);
  }
  virtual ~Array() { deleteData_(&data_); }

  T& operator[](Size index) {
    assert(index < capacity_);
    return data_[index];
  }
  const T& operator[](Size index) const {
    assert(index < capacity_);
    return data_[index];
  }
  T& operator*() { return *data_; }
  const T& operator*() const { return *data_; }
  T* data() { return data_; }
  const T* data() const { return data_; }

  /**
   * If T is primitive but not floating point, or if value is zero, the
   * caller should probably use memset on the raw pointer instead
   */
  void assign(Size numElements, const T& value) {
#pragma vector always assert
    for (Size i = 0; i < numElements; ++i) {
      data_[i] = value;
    }
  }
  void clear() { capacity_ = 0; }

  Size capacity() const { return capacity_; }
  Size size() const { return capacity_; }
  Size length() const { return capacity_; }

 protected:
  T* data_;
  Size capacity_;
  std::function<void(T**)> deleteData_;
};
}
}

Add ability for Array to take ownership of its data


/*
 * Represents an element which can be rendered as part of a scene.
 * Author: Dino Wernli
 */

#ifndef ELEMENT_H_
#define ELEMENT_H_

#include <cstddef>

class IntersectionData;
class Ray;

class Element {
 public:
  virtual ~Element();
  bool Intersect(const Ray& ray, IntersectionData* data = NULL) = 0;
};

#endif  /* ELEMENT_H_ */

/*
 * Represents an element which can be rendered as part of a scene.
 * Author: Dino Wernli
 */

#ifndef ELEMENT_H_
#define ELEMENT_H_

#include <cstddef>

class IntersectionData;
class Ray;

class Element {
 public:
  virtual ~Element();
  virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) = 0;
};

#endif  /* ELEMENT_H_ */

Fix build failure by adding virtual keyword.


// AFJSONUtilities.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>

NSData * AFJSONEncode(id object, NSError **error);
id AFJSONDecode(NSData *data, NSError **error);

// AFJSONUtilities.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>

extern NSData * AFJSONEncode(id object, NSError **error);
extern id AFJSONDecode(NSData *data, NSError **error);

Mark the AFJSON* functions as 'extern'.

Mark the AFJSON* functions as 'extern'.


// RUN: cat %s | %clang -emit-llvm -g -S \
// RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s
// CHECK: ; ModuleID = 'test/foo.c'
// CHECK: source_filename = "test/foo.c"
// CHECK: !1 = !DIFile(filename: "test/foo.c"

int main() {}

// RUN: cat %s | %clang -emit-llvm -g -S \
// RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s
// CHECK: ; ModuleID = 'test/foo.c'
// CHECK: source_filename = "test/foo.c"
// CHECK: !DIFile(filename: "test/foo.c"

int main() {}

Fix buildbot failure from r373217 (don't match metadata id exactly)

Fix this failure by ignoring the id of the metadata being checked:
    http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/3046/consoleFull#-21332887158254eaf0-7326-4999-85b0-388101f2d404

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


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

#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

#include "native_client/src/include/nacl_macros.h"

class PPB_Core;

namespace ppapi_proxy {

// Implements the untrusted side of the PPB_Core interface.
// We will also need an rpc service to implement the trusted side, which is a
// very thin wrapper around the PPB_Core interface returned from the browser.
class PluginCore {
 public:
  // Return an interface pointer usable by PPAPI plugins.
  static const PPB_Core* GetInterface();
  // Mark the calling thread as the main thread for IsMainThread.
  static void MarkMainThread();

 private:
  NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore);
};

}  // namespace ppapi_proxy

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

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

#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

#include "native_client/src/include/nacl_macros.h"

struct PPB_Core;

namespace ppapi_proxy {

// Implements the untrusted side of the PPB_Core interface.
// We will also need an rpc service to implement the trusted side, which is a
// very thin wrapper around the PPB_Core interface returned from the browser.
class PluginCore {
 public:
  // Return an interface pointer usable by PPAPI plugins.
  static const PPB_Core* GetInterface();
  // Mark the calling thread as the main thread for IsMainThread.
  static void MarkMainThread();

 private:
  NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore);
};

}  // namespace ppapi_proxy

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

Declare PPB_Core as a struct, not a class. (Prevents Clang warning)

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

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


#ifndef COMPONENTMANAGER_H_
#define COMPONENTMANAGER_H_

#include "entity/Entity.h"

/**
 * Enumeration for each of our types of components
 */
enum component_t {
	Position,
	Render
};

/**
 * Base class for all Component Managers.
 */
class ComponentManager
{
	public:
		/**
		 * Check if the given Entity has this manager's Component.
		 *
		 * @param e The Entity to test for.
		 *
		 * @return True if the Entity has this Component.
		 */
		virtual bool entityHasComponent(Entity e) = 0;

		/**
		 * Add the Component (with default values) to the Entity.
		 *
		 * @param e The Entity to add the Component to.
		 */
		virtual void addComponent(Entity e) = 0;

		/**
		 * Remove the Component from the Entity.
		 *
		 * @param e The Entity to remove it from.
		 */
		virtual void removeComponent(Entity e) = 0;

		/**
		 * Gets the type of component that this ComponentManager subclass
		 * manages.
		 *
		 * @return One of the component_t enumerations.
		 */
		virtual component_t getComponentType() = 0;

	protected:
		/**
		 * This class must be inherited, it cannot be instantiated directly.
		 *
		 * NB: We actually gain this from having pure virtual methods already,
		 * but it can't hurt to have an extra layer e.g. in case for any reason
		 * we start to implement default versions of the above.
		 */
		ComponentManager() {};
};

#endif

#ifndef COMPONENTMANAGER_H_
#define COMPONENTMANAGER_H_

#include "entity/Entity.h"

/**
 * Enumeration for each of our types of components
 */
enum component_t {
	Position,
	Sprite
};

/**
 * Base class for all Component Managers.
 */
class ComponentManager
{
	public:
		/**
		 * Check if the given Entity has this manager's Component.
		 *
		 * @param e The Entity to test for.
		 *
		 * @return True if the Entity has this Component.
		 */
		virtual bool entityHasComponent(Entity e) = 0;

		/**
		 * Add the Component (with default values) to the Entity.
		 *
		 * @param e The Entity to add the Component to.
		 */
		virtual void addComponent(Entity e) = 0;

		/**
		 * Remove the Component from the Entity.
		 *
		 * @param e The Entity to remove it from.
		 */
		virtual void removeComponent(Entity e) = 0;

		/**
		 * Gets the type of component that this ComponentManager subclass
		 * manages.
		 *
		 * @return One of the component_t enumerations.
		 */
		virtual component_t getComponentType() = 0;

	protected:
		/**
		 * This class must be inherited, it cannot be instantiated directly.
		 *
		 * NB: We actually gain this from having pure virtual methods already,
		 * but it can't hurt to have an extra layer e.g. in case for any reason
		 * we start to implement default versions of the above.
		 */
		ComponentManager() {};
};

#endif

Rename Render component to Sprite

Rename Render component to Sprite

The old name made no sense; the new isn't *entirely* accurate, though,
although neither is it entirely inaccurate.


#ifndef INCLUDE_POD_NODE_H
#define INCLUDE_POD_NODE_H

#include <stddef.h>

// A node is a place on a list.  It simplifies doubly linked lists because the
// header is just another node.  Everything in Pod is a node, potentially a
// part of a list or map.  Header nodes should be initialized to point to
// themselves.  Otherwise, initialize them to NULL.
//
// For example:
//      pod_node header;
//
//      header.previous = &header;
//      header.next = &header;

struct pod_node;
typedef struct pod_node pod_node;

struct pod_node {
    pod_node *previous;
    pod_node *next;
};

extern pod_node *pod_node_remove(pod_node *node);
inline pod_node *pod_node_remove(pod_node *node)
{
    pod_node *next;

    next = node->next;
    node->previous->next = node->next;
    node->next->previous = node->previous;
    node->previous = node->next = NULL;

    return next;
}

#endif /*INCLUDE_POD_NODE_H */

#ifndef INCLUDE_POD_NODE_H
#define INCLUDE_POD_NODE_H

#include <stddef.h>

// A node is a place on a list.  It simplifies doubly linked lists because the
// header is just another node.  Everything in Pod is a node, potentially a
// part of a list or map.  Header nodes should be initialized to point to
// themselves.  Otherwise, initialize them to NULL.
//
// For example:
//      pod_node header;
//
//      header.previous = &header;
//      header.next = &header;

struct pod_node;
typedef struct pod_node pod_node;

struct pod_node {
    pod_node *previous;
    pod_node *next;
};

    // Other pod_node related functions

// extern pod_node *pod_node_remove(pod_node *node);
extern inline pod_node *pod_node_remove(pod_node *node)
{
    pod_node *next;

    next = node->next;
    node->previous->next = node->next;
    node->next->previous = node->previous;
    node->previous = node->next = NULL;

    return next;
}

#endif /*INCLUDE_POD_NODE_H */

Use "extern inline" in declarations (I think).


/*!
 * This file defines a Python-like range function for sequences.
 *
 * @author Louis Dionne
 */

#ifndef JOY_INTERNAL_SEQRANGE_H
#define JOY_INTERNAL_SEQRANGE_H

#include <chaos/preprocessor/recursion/expr.h>
#include <chaos/preprocessor/repetition/repeat_from_to.h>

#define JOY_SEQRANGE(from, to) \
    JOY_SEQRANGE_S(CHAOS_PP_STATE(), from, to)

#define JOY_SEQRANGE_S(state, from, to)                                        \
    CHAOS_PP_EXPR_S(state)(                                                    \
        CHAOS_PP_REPEAT_FROM_TO_S(state, from, to, JOY_I_SEQRANGE, ~)          \
    )                                                                          \
/**/

#define JOY_I_SEQRANGE(state, n, useless) (n)

#endif /* !JOY_INTERNAL_SEQRANGE_H */

Add a Python-like range macro for sequences.


#pragma once
#include <functional>
#include <boost/asio.hpp>

// This class abstracts the boost::asio timer in order to provide a generic
// facility for timeouts. Once constructed, this class will wait a certain
// amount of time and then call the function. The timeout must be canceled
// with cancel() before you invalidate your callback.
//
// You must start the timeout with start().
//
// NOTE: The thread that calls the function is undefined. Ensure that your
// callback is thread-safe.
class Timeout : public std::enable_shared_from_this<Timeout>
{
  public:
    Timeout(unsigned long ms, std::function<void()> f);
    ~Timeout();
    inline void start() { reset(); }
    void reset();
    // cancel() attempts to invalidate the callback and ensure that it will not
    // run. On success, returns true, guaranteeing that the callback has/will
    // not be triggered. On failure, returns false, indicating either that the
    // callback was already canceled, the callback has already finished
    // running, or the callback is (about to be) called.
    bool cancel();

  private:
    boost::asio::deadline_timer m_timer;
    std::function<void()> m_callback;
    long m_timeout_interval;

    std::atomic<bool> m_callback_disabled;

    void timer_callback(const boost::system::error_code &ec);
};

#pragma once
#include <functional>
#include <atomic>
#include <memory>
#include <boost/asio.hpp>

// This class abstracts the boost::asio timer in order to provide a generic
// facility for timeouts. Once constructed, this class will wait a certain
// amount of time and then call the function. The timeout must be canceled
// with cancel() before you invalidate your callback.
//
// You must start the timeout with start().
//
// NOTE: The thread that calls the function is undefined. Ensure that your
// callback is thread-safe.
class Timeout : public std::enable_shared_from_this<Timeout>
{
  public:
    Timeout(unsigned long ms, std::function<void()> f);
    ~Timeout();
    inline void start() { reset(); }
    void reset();
    // cancel() attempts to invalidate the callback and ensure that it will not
    // run. On success, returns true, guaranteeing that the callback has/will
    // not be triggered. On failure, returns false, indicating either that the
    // callback was already canceled, the callback has already finished
    // running, or the callback is (about to be) called.
    bool cancel();

  private:
    boost::asio::deadline_timer m_timer;
    std::function<void()> m_callback;
    long m_timeout_interval;

    std::atomic<bool> m_callback_disabled;

    void timer_callback(const boost::system::error_code &ec);
};

util: Add missing includes to fix Clang build.


// Copyright (c) 2016-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.

#ifndef SYSCOIN_POLICY_RBF_H
#define SYSCOIN_POLICY_RBF_H

#include <txmempool.h>

enum class RBFTransactionState {
    UNKNOWN,
    REPLACEABLE_BIP125,
    FINAL
};

// Determine whether an in-mempool transaction is signaling opt-in to RBF
// according to BIP 125
// This involves checking sequence numbers of the transaction, as well
// as the sequence numbers of all in-mempool ancestors.
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
// SYSCOIN
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);

#endif // SYSCOIN_POLICY_RBF_H

// Copyright (c) 2016-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.

#ifndef SYSCOIN_POLICY_RBF_H
#define SYSCOIN_POLICY_RBF_H

#include <txmempool.h>

/** The rbf state of unconfirmed transactions */
enum class RBFTransactionState {
    /** Unconfirmed tx that does not signal rbf and is not in the mempool */
    UNKNOWN,
    /** Either this tx or a mempool ancestor signals rbf */
    REPLACEABLE_BIP125,
    /** Neither this tx nor a mempool ancestor signals rbf */
    FINAL,
};

/**
 * Determine whether an unconfirmed transaction is signaling opt-in to RBF
 * according to BIP 125
 * This involves checking sequence numbers of the transaction, as well
 * as the sequence numbers of all in-mempool ancestors.
 *
 * @param tx   The unconfirmed transaction
 * @param pool The mempool, which may contain the tx
 *
 * @return     The rbf state
 */
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
// SYSCOIN
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);

#endif // SYSCOIN_POLICY_RBF_H

Add doxygen comment to IsRBFOptIn

doc: Add doxygen comment to IsRBFOptIn

Former-commit-id: 9d51bef94ec279947bd1d28bbbc917d476da2f6e


#pragma once

#if PLATFORM_WINDOWS
#include "AllowWindowsPlatformTypes.h"
#endif
#include "include/cef_client.h"
#include "include/cef_app.h"
#if PLATFORM_WINDOWS
#include "HideWindowsPlatformTypes.h"
#endif

class BLU_API BluManager : public CefApp
{

	public:

		BluManager();

		static void doBluMessageLoop();
		static CefSettings settings;
		static CefMainArgs main_args;

	virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
			CefRefPtr< CefCommandLine > command_line) override;

	IMPLEMENT_REFCOUNTING(BluManager)

};

#pragma once

#if PLATFORM_WINDOWS
#include "AllowWindowsPlatformTypes.h"
#endif
#include "include/cef_client.h"
#include "include/cef_app.h"
#if PLATFORM_WINDOWS
#include "HideWindowsPlatformTypes.h"
#endif

class BLU_API BluManager : public CefApp
{

	public:

		BluManager();

		static void doBluMessageLoop();
		static CefSettings settings;
		static CefMainArgs main_args;
		static bool CPURenderSettings;

	virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
			CefRefPtr< CefCommandLine > command_line) override;

	IMPLEMENT_REFCOUNTING(BluManager)

};

Allow user to pick render settings

Allow user to pick render settings


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 74
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 75
#endif

Update Skia milestone to 75

Update Skia milestone to 75

Bug: skia:
Change-Id: I5f682b3685eb68f36e36bf3581d068069af67ba4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198604
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Auto-Submit: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


#include <pthread.h>
#include <assert.h>

int g = 0;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t C = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&A);
  pthread_mutex_lock(&C);
  pthread_mutex_lock(&B);
  g = 5;
  pthread_mutex_unlock(&B);
  pthread_mutex_lock(&B);
  g = 0;
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&C);
  pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  assert(g == 0);
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);

  pthread_mutex_lock(&B);
  pthread_mutex_lock(&C);
  assert(g == 0);
  pthread_mutex_unlock(&C);
  pthread_mutex_unlock(&B);

  pthread_join(id, NULL);
  return 0;
}

#include <pthread.h>
#include <assert.h>

int g = 0;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t C = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&A);
  pthread_mutex_lock(&C);
  pthread_mutex_lock(&B);
  g = 5;
  pthread_mutex_unlock(&B);
  pthread_mutex_lock(&B);
  g = 0;
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&C);
  pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  // This must be before the other to get Mine to fail for the other even with thread ID partitioning.
  pthread_mutex_lock(&B);
  pthread_mutex_lock(&C);
  assert(g == 0);
  pthread_mutex_unlock(&C);
  pthread_mutex_unlock(&B);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  assert(g == 0);
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);

  pthread_join(id, NULL);
  return 0;
}

Fix 13/32 to fail Mine even with thread ID partitioning


// Scintilla source code edit control
/** @file PlatWin.h
 ** Implementation of platform facilities on Windows.
 **/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

extern bool IsNT();
extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise();

#if defined(_MSC_VER)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
extern IDWriteFactory *pIDWriteFactory;
#endif

// Scintilla source code edit control
/** @file PlatWin.h
 ** Implementation of platform facilities on Windows.
 **/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

extern bool IsNT();
extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise();

#if defined(USE_D2D)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
extern IDWriteFactory *pIDWriteFactory;
#endif

Allow choice of D2D on compiler command line.


//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=//
//
// This pass is used to ensure that methods have at most one return instruction
// in them.  It also holds onto the return instruction of the last unified
// method.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
#define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H

#include "llvm/Pass.h"

struct UnifyMethodExitNodes : public MethodPass {
  BasicBlock *ExitNode;
public:
  static AnalysisID ID;            // Pass ID
  UnifyMethodExitNodes(AnalysisID id) : ExitNode(0) { assert(ID == id); }

  // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
  // BasicBlock, and converting all returns to unconditional branches to this
  // new basic block.  The singular exit node is returned in ExitNode.
  //
  // If there are no return stmts in the Method, a null pointer is returned.
  //
  static bool doit(Method *M, BasicBlock *&ExitNode);

  virtual bool runOnMethod(Method *M) {
    return doit(M, ExitNode);
  }

  BasicBlock *getExitNode() const { return ExitNode; }

  virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
                                    Pass::AnalysisSet &Destroyed,
                                    Pass::AnalysisSet &Provided) {
    // FIXME: Should invalidate CFG
    Provided.push_back(ID);  // Provide self!
  }
};

#endif

//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=//
//
// This pass is used to ensure that methods have at most one return instruction
// in them.  It also holds onto the return instruction of the last unified
// method.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
#define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H

#include "llvm/Pass.h"

struct UnifyMethodExitNodes : public MethodPass {
  BasicBlock *ExitNode;
public:
  static AnalysisID ID;            // Pass ID
  UnifyMethodExitNodes(AnalysisID id = ID) : ExitNode(0) { assert(ID == id); }

  // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
  // BasicBlock, and converting all returns to unconditional branches to this
  // new basic block.  The singular exit node is returned in ExitNode.
  //
  // If there are no return stmts in the Method, a null pointer is returned.
  //
  static bool doit(Method *M, BasicBlock *&ExitNode);

  virtual bool runOnMethod(Method *M) {
    return doit(M, ExitNode);
  }

  BasicBlock *getExitNode() const { return ExitNode; }

  virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
                                    Pass::AnalysisSet &Destroyed,
                                    Pass::AnalysisSet &Provided) {
    // FIXME: Should invalidate CFG
    Provided.push_back(ID);  // Provide self!
  }
};

#endif

Add constructor for addition to opt program

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@1626 91177308-0d34-0410-b5e6-96231b3b80d8


// Check that we can operate on files from /dev/fd.
// REQUIRES: dev-fd-fs

// Check reading from named pipes. We cat the input here instead of redirecting
// it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
//
// RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
// RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s

// DEV-FD-INPUT: int x;
int x;

// Check that we can operate on files from /dev/fd.
// REQUIRES: dev-fd-fs

// Check reading from named pipes. We cat the input here instead of redirecting
// it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
//
// RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
// RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s
//
// DEV-FD-INPUT: int x;

// Check writing to /dev/fd named pipes. We use cat here as before to ensure we
// get a named pipe.
//
// RUN: %clang -x c %s -E -o /dev/fd/1 | cat > %t
// RUN: FileCheck --check-prefix DEV-FD-FIFO-OUTPUT < %t %s
//
// DEV-FD-FIFO-OUTPUT: int x;

// Check writing to /dev/fd regular files.
//
// RUN: %clang -x c %s -E -o /dev/fd/1 > %t
// RUN: FileCheck --check-prefix DEV-FD-REG-OUTPUT < %t %s
//
// DEV-FD-REG-OUTPUT: int x;

int x;

tests: Check that we can output to /dev/fd filesystem.

 - An LLVM unique_file() bug could cause us to infinite loop on the later test
   case.

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