/*********************************** LICENSE **********************************\
 *                            Copyright 2017 Morphux                            *
 *                                                                              *
 *        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                     *
 *                                                                              *
 *                 http://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 M_UTIL
# define M_UTIL

# include <stdint.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <morphux.h>

/*!
 * \brief Delete a directory recursively
 *
 * \param[in] dir Path of the directory to delete
 *
 * \return true on success, false on failure
 */
bool recursive_delete(const char *dir);

#endif /* M_UTIL */

/*********************************** LICENSE **********************************\
 *                            Copyright 2017 Morphux                            *
 *                                                                              *
 *        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                     *
 *                                                                              *
 *                 http://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 M_UTIL
# define M_UTIL

# include <stdint.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <morphux.h>

# define STR_OR_EMPTY(str) (str ? str : "")
# define STR_NULL_OR_EMPTY(str) (str == NULL || (str != NULL && *str == '\0'))

/*!
 * \brief Delete a directory recursively
 *
 * \param[in] dir Path of the directory to delete
 *
 * \return true on success, false on failure
 */
bool recursive_delete(const char *dir);

#endif /* M_UTIL */

Add safe string macro checking

Add(Utils): Add safe string macro checking


#include <pthread.h>
#include <stdio.h>

int myglobal;
pthread_spinlock_t spinlock1;
pthread_spinlock_t spinlock2;

void *t_fun(void *arg) {
  pthread_spin_lock(&spinlock1);
  myglobal=myglobal+1; // NORACE
  pthread_spin_unlock(&spinlock1);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_spin_lock(&spinlock1);
  myglobal=myglobal+1; // NORACE
  pthread_spin_unlock(&spinlock1);
  pthread_join (id, NULL);
  return 0;
}

#include <pthread.h>
#include <stdio.h>

#ifdef __APPLE__
  int main(void) {
    // OS X has no spin_lock
    int x =5; //NORACE
  }
#else
  int myglobal;
  pthread_spinlock_t spinlock1;
  pthread_spinlock_t spinlock2;

  void *t_fun(void *arg) {
    pthread_spin_lock(&spinlock1);
    myglobal=myglobal+1; // NORACE
    pthread_spin_unlock(&spinlock1);
    return NULL;
  }

  int main(void) {
    pthread_t id;
    pthread_create(&id, NULL, t_fun, NULL);
    pthread_spin_lock(&spinlock1);
    myglobal=myglobal+1; // NORACE
    pthread_spin_unlock(&spinlock1);
    pthread_join (id, NULL);
    return 0;
  }
#endif

Work around Mac not having `pthread_spinlock`


/**
 * 	mpc5xxx_get_bus_frequency - Find the bus frequency for a device
 * 	@node:	device node
 *
 * 	Returns bus frequency (IPS on MPC512x, IPB on MPC52xx),
 * 	or 0 if the bus frequency cannot be found.
 */

#include <linux/kernel.h>
#include <linux/of_platform.h>
#include <linux/export.h>
#include <asm/mpc5xxx.h>

unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
{
	struct device_node *np;
	const unsigned int *p_bus_freq = NULL;

	of_node_get(node);
	while (node) {
		p_bus_freq = of_get_property(node, "bus-frequency", NULL);
		if (p_bus_freq)
			break;

		np = of_get_parent(node);
		of_node_put(node);
		node = np;
	}
	of_node_put(node);

	return p_bus_freq ? *p_bus_freq : 0;
}
EXPORT_SYMBOL(mpc5xxx_get_bus_frequency);

/**
 * 	mpc5xxx_get_bus_frequency - Find the bus frequency for a device
 * 	@node:	device node
 *
 * 	Returns bus frequency (IPS on MPC512x, IPB on MPC52xx),
 * 	or 0 if the bus frequency cannot be found.
 */

#include <linux/kernel.h>
#include <linux/of_platform.h>
#include <linux/export.h>
#include <asm/mpc5xxx.h>

unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
{
	const unsigned int *p_bus_freq = NULL;

	of_node_get(node);
	while (node) {
		p_bus_freq = of_get_property(node, "bus-frequency", NULL);
		if (p_bus_freq)
			break;

		node = of_get_next_parent(node);
	}
	of_node_put(node);

	return p_bus_freq ? *p_bus_freq : 0;
}
EXPORT_SYMBOL(mpc5xxx_get_bus_frequency);

Use of_get_next_parent to simplify code

powerpc/mpc5xxx: Use of_get_next_parent to simplify code

of_get_next_parent can be used to simplify the while() loop and
avoid the need of a temp variable.

Signed-off-by: Christophe JAILLET <aa5b4d6ac057e7b0849afbbced06a03fc6c87d45@wanadoo.fr>
Signed-off-by: Michael Ellerman <864f124608374e06e4da1fa5d2e47ed839b95411@ellerman.id.au>


// RUN: clang %s -emit-llvm -o - > %t1
// RUN: grep "shl i32 %tmp, 19" %t1 &&
// RUN: grep "ashr i32 %tmp1, 19" %t1 &&
// RUN: grep "shl i16 %tmp4, 1" %t1 &&
// RUN: grep "lshr i16 %tmp5, 9" %t1 &&
// RUN: grep "and i32 %tmp, -8192" %t1 &&
// RUN: grep "and i16 %tmp5, -32513" %t1 &&
// RUN: grep "getelementptr (i32\* bitcast (.struct.STestB2\* @stb2 to i32\*), i32 1)" %t1
// Test bitfield access

struct STestB1 { int a:13; char b; unsigned short c:7;} stb1;
struct STestB2 { short a[3]; int b:15} stb2;

int f() {
  return stb1.a + stb1.b + stb1.c;
}

void g() {
  stb1.a = -40;
  stb1.b = 10;
  stb1.c = 15;
}

int h() {
  return stb2.a[1] + stb2.b;
}

void i(){
  stb2.a[2] = -40;
  stb2.b = 10;
}

// RUN: clang %s -emit-llvm -o - > %t1
// RUN: grep "shl i32 .*, 19" %t1 &&
// RUN: grep "ashr i32 .*, 19" %t1 &&
// RUN: grep "shl i16 .*, 1" %t1 &&
// RUN: grep "lshr i16 .*, 9" %t1 &&
// RUN: grep "and i32 .*, -8192" %t1 &&
// RUN: grep "and i16 .*, -32513" %t1 &&
// RUN: grep "getelementptr (i32\* bitcast (.struct.STestB2\* @stb2 to i32\*), i32 1)" %t1
// Test bitfield access

struct STestB1 { int a:13; char b; unsigned short c:7;} stb1;
struct STestB2 { short a[3]; int b:15} stb2;

int f() {
  return stb1.a + stb1.b + stb1.c;
}

void g() {
  stb1.a = -40;
  stb1.b = 10;
  stb1.c = 15;
}

int h() {
  return stb2.a[1] + stb2.b;
}

void i(){
  stb2.a[2] = -40;
  stb2.b = 10;
}

Make this test actually pass, in addition to the previous patch
which made it work.

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


static struct hep_ctx ctx = {
        .initfails = 0,
        .hints = {{ 0 }},
        .capt_host  = "10.0.0.1",
        .capt_port  = "9060",
        .hints = {{ .ai_socktype = SOCK_DGRAM }},
        .capt_id = 101,
        .hep_version = 3,
        .usessl = 0,
        .pl_compress = 0,
        .sendPacketsCount = 0
};

static struct hep_ctx ctx = {
        .initfails = 0,
        .hints = {{ .ai_socktype = SOCK_DGRAM }},
        .capt_host  = "10.0.0.1",
        .capt_port  = "9060",
        .capt_id = 101,
        .hep_version = 3,
        .usessl = 0,
        .pl_compress = 0,
        .sendPacketsCount = 0
};

Move .hints definition in place.

Move .hints definition in place.


#ifndef TESTGP11HELPERS_H_
#define TESTGP11HELPERS_H_

#include "gp11.h"

#define FAIL_RES(res, e) do { \
	g_assert ((res) ? FALSE : TRUE); \
	g_assert ((e) && (e)->message && "error should be set"); \
	g_clear_error (&e); \
	} while (0)

#define SUCCESS_RES(res, err) do { \
	if (!(res)) g_printerr ("error: %s\n", err && err->message ? err->message : ""); \
	g_assert ((res) ? TRUE : FALSE && "should have succeeded"); \
	g_clear_error (&err); \
	} while(0)

#define WAIT_UNTIL(cond) \
	while(!cond) g_main_iteration (TRUE);

#endif /*TESTGP11HELPERS_H_*/

#ifndef TESTGP11HELPERS_H_
#define TESTGP11HELPERS_H_

#include "gp11.h"

#define FAIL_RES(res, e) do { \
	g_assert ((res) ? FALSE : TRUE); \
	g_assert ((e) && (e)->message && "error should be set"); \
	g_clear_error (&e); \
	} while (0)

#define SUCCESS_RES(res, err) do { \
	if (!(res)) g_printerr ("error: %s\n", err && err->message ? err->message : ""); \
	g_assert ((res) ? TRUE : FALSE && "should have succeeded"); \
	g_clear_error (&err); \
	} while(0)

#define WAIT_UNTIL(cond) \
	while(!cond) g_main_context_iteration (NULL, TRUE);

#endif /*TESTGP11HELPERS_H_*/

Remove usage of deprecated glib stuff.

Remove usage of deprecated glib stuff.

	* configure.in:
	* gp11/tests/gp11-test.h:
	* common/gkr-location.c: Remove usage of deprecated glib stuff.

svn path=/trunk/; revision=1362


/*
 * Common kernel entry point.
 */

#include <multiboot.h>
#include <types.h>

/*
 * This function is called by the architecture-specific boot proceedure, and
 * defines the entry to the euclid kernel.
 */
int k_main(struct multiboot *mboot, u32 stack);

int k_main(struct multiboot *mboot, u32 stack)
{
	/* For now let's just push a value to EAX (x86). */
	return (int)0xABCDEFCC;
}

Add a common kernel entry point

init: Add a common kernel entry point


#ifndef SESSION_CLIENT_H
#define SESSION_CLIENT_H

/// PROJECT
#include <csapex/io/session.h>

/// SYSTEM
#include <boost/asio.hpp>

namespace csapex
{
class SessionClient : public Session
{
public:
    SessionClient(const std::string& ip, int port);
    ~SessionClient() override;

    std::string getDescription() const override;

    void run() override;
    void shutdown() override;

    bool isRunning() const override;

private:
    boost::asio::io_service io_service;
    boost::asio::ip::tcp::socket socket_impl;
    boost::asio::ip::tcp::resolver resolver;
    boost::asio::ip::tcp::resolver::iterator resolver_iterator;

    bool io_service_running_;

    std::string ip_;
    int port_;
};

}  // namespace csapex

#endif  // SESSION_CLIENT_H

#ifndef SESSION_CLIENT_H
#define SESSION_CLIENT_H

/// PROJECT
#include <csapex/io/session.h>

/// SYSTEM
#include <boost/asio.hpp>
#include <boost/version.hpp>

namespace csapex
{
class SessionClient : public Session
{
public:
    SessionClient(const std::string& ip, int port);
    ~SessionClient() override;

    std::string getDescription() const override;

    void run() override;
    void shutdown() override;

    bool isRunning() const override;

private:
    boost::asio::io_service io_service;
    boost::asio::ip::tcp::socket socket_impl;
    boost::asio::ip::tcp::resolver resolver;
#if (BOOST_VERSION / 100000) >= 1 && (BOOST_VERSION / 100 % 1000) >= 66
    boost::asio::ip::tcp::resolver::endpoint_type resolver_iterator;
#else
    // deprecated in boost 1.66
    boost::asio::ip::tcp::resolver::iterator resolver_iterator;
#endif

    bool io_service_running_;

    std::string ip_;
    int port_;
};

}  // namespace csapex

#endif  // SESSION_CLIENT_H

Fix depracted boost asio types

Fix depracted boost asio types


#pragma once

#include <type_traits>

namespace Halley
{
	// is_detected_v is based on https://en.cppreference.com/w/cpp/experimental/is_detected

	namespace detail {
	    template<template<class...> class Expr, class... Args>
	    std::false_type is_detected_impl(...);

	    template<template<class...> class Expr, class... Args>
	    std::true_type is_detected_impl(std::void_t<Expr<Args...>>*);
	}

	template<template<class...> class Expr, class... Args>
	using is_detected = decltype(detail::is_detected_impl<Expr, Args...>(nullptr));

	template<template<class...> class Expr, class... Args>
	constexpr bool is_detected_v = is_detected<Expr, Args...>::value;
}

#pragma once

#include <type_traits>

namespace Halley
{
	// is_detected_v is based on https://en.cppreference.com/w/cpp/experimental/is_detected

	struct nonesuch {
	    ~nonesuch() = delete;
	    nonesuch(nonesuch const&) = delete;
	    void operator=(nonesuch const&) = delete;
	};

	namespace detail {
		template <class Default, class AlwaysVoid, template<class...> class Op, class... Args>
		struct detector {
			using value_t = std::false_type;
			using type = Default;
		};

		template <class Default, template<class...> class Op, class... Args>
		struct detector<Default, std::void_t<Op<Args...>>, Op, Args...> {
			using value_t = std::true_type;
			using type = Op<Args...>;
		};
	}

	template <template<class...> class Op, class... Args>
	using is_detected = typename detail::detector<nonesuch, void, Op, Args...>::value_t;

	template<template<class...> class Expr, class... Args>
	constexpr bool is_detected_v = is_detected<Expr, Args...>::value;
}

Replace implementation of is_detected with one that works with gcc


#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning and copyright year
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       0
#define CLIENT_VERSION_MINOR       9
#define CLIENT_VERSION_REVISION    3
#define CLIENT_VERSION_BUILD       0

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  true

// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2013

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning and copyright year
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       0
#define CLIENT_VERSION_MINOR       9
#define CLIENT_VERSION_REVISION    5
#define CLIENT_VERSION_BUILD       0

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  true

// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2014

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

Update client version to 0.9.5

Update client version to 0.9.5


// PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>

int g = 42; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

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

int main(void) {
  int r, t;

  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  if (r) {
    g = 17;
    pthread_mutex_unlock(&B); // publish to g#prot
    pthread_mutex_lock(&B);
  }
  // locally written g is only in one branch, g == g#prot should be forgotten!
  t = g;
  assert(t == 17); // UNKNOWN!
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return 0;
}

Add relational protection-based litmus test


#include <syslog.h>
#include "cl_discovery.h"

#include "cl_discovery_thread.h"

void * start_discovery(void * args) {
  syslog(LOG_INFO, "started discovery thread");
  for (;;) {
    continue;
  }
}

#include <stdlib.h>
#include <syslog.h>
#include "cl_discovery.h"

#include "cl_discovery_thread.h"

void * start_discovery(void * args) {
  syslog(LOG_INFO, "started discovery thread");

  for (;;) {
    struct CL_Discovery_Transport *discovered_transport = malloc(sizeof(struct CL_Discovery_Transport));
    wait_for_transport(discovered_transport);
  }
}

Call into the discovery function and wait for someone to say hi


/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __otbLocalGradientVectorImageFilter_h
#define __otbLocalGradientVectorImageFilter_h

#include "otbUnaryFunctorNeighborhoodVectorImageFilter.h"

#include <itkNumericTraits.h>

namespace otb
{

namespace Functor
{
/** \class LocalGradientOperator
 * \brief Performs the calculation of LocalGradient derivation
 */
template < class TInput, class TOutput >
class LocalGradientOperator
{
public:
  LocalGradientOperator() { }
  virtual ~LocalGradientOperator() { }

  TOutput operator() ( const TInput & input )
  {
    /*
     * it is assumed that input and output have the same size
     */
    unsigned int length = input.GetPixel(0).Size();
    TOutput output ( length );
    for ( unsigned int i = 0; i < length; i++ )
    {
      output[i] = static_cast<typename TOutput::ValueType>(
                  input.GetPixel(4)[i]
                  - input.GetPixel(5)[i] / 2.
                  - input.GetPixel(7)[i] / 2. );
    }
    return output;
  }
}; // end of functor class

} // end of namespace Functor

/** \class LocalGradientVectorImageFilter
 * \brief Implements the 3x3 Local Gradient to be processed on a vector image
 */
template < class TInputImage, class TOutputImage >
class ITK_EXPORT LocalGradientVectorImageFilter
  : public UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage,
            Functor::LocalGradientOperator<
              typename itk::ConstNeighborhoodIterator<TInputImage>,
              typename TOutputImage::PixelType > >
{
public:
  /** Standart class typedefs */
  typedef LocalGradientVectorImageFilter Self;
  typedef UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage,
            Functor::LocalGradientOperator<
              typename itk::ConstNeighborhoodIterator<TInputImage>,
              typename TOutputImage::PixelType > >  Superclass;
  typedef itk::SmartPointer<Self> Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Creation through object factory macro */
  itkTypeMacro(LocalGradientVectorImageFilter, ImageToImageFilter);

protected:
  LocalGradientVectorImageFilter() { }
  virtual ~LocalGradientVectorImageFilter() { }

private:
  LocalGradientVectorImageFilter( const Self & ); // Not implemented
  void operator=( const Self & ); // Not implemented
}; // end of class

} // end of namespace otb

#endif // __otbLocalGradientVectorImageFilter_h

ADD Local Gardient (really high pass)

ADD Local Gardient (really high pass)


#ifndef SEARCHRESULTCOLOR_H
#define SEARCHRESULTCOLOR_H

#include <QColor>

namespace Find {
namespace Internal {

struct SearchResultColor{
    QColor textBackground;
    QColor textForeground;
    QColor highlightBackground;
    QColor highlightForeground;
};

} // namespace Internal
} // namespace Find

#endif // SEARCHRESULTCOLOR_H

#ifndef SEARCHRESULTCOLOR_H
#define SEARCHRESULTCOLOR_H

#include <QColor>

namespace Find {
namespace Internal {

class SearchResultColor{
public:
    QColor textBackground;
    QColor textForeground;
    QColor highlightBackground;
    QColor highlightForeground;
};

} // namespace Internal
} // namespace Find

#endif // SEARCHRESULTCOLOR_H

Fix warning about struct/class mismatch

Fix warning about struct/class mismatch

Change-Id: I832ea6ebf078e533623fb748809dd71b5abfb645
Reviewed-by: Eike Ziller <c142da16c73a95a82d35191bcc55b22835617128@digia.com>


/**********************************************************************
 * File:        tprintf.h
 * Description: Trace version of printf - portable between UX and NT
 * Author:      Phil Cheatle
 *
 * (C) Copyright 1995, Hewlett-Packard Ltd.
 ** 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
 ** http://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 TESSERACT_CCUTIL_TPRINTF_H
#define TESSERACT_CCUTIL_TPRINTF_H

#include "params.h" // for BOOL_VAR_H
#include <tesseract/export.h> // for TESS_API

namespace tesseract {

// Disable some log messages by setting log_level > 0.
extern INT_VAR_H(log_level);

// Main logging function.
extern TESS_API void tprintf( // Trace printf
    const char *format, ...); // Message

} // namespace tesseract

#endif // define TESSERACT_CCUTIL_TPRINTF_H

/**********************************************************************
 * File:        tprintf.h
 * Description: Trace version of printf - portable between UX and NT
 * Author:      Phil Cheatle
 *
 * (C) Copyright 1995, Hewlett-Packard Ltd.
 ** 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
 ** http://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 TESSERACT_CCUTIL_TPRINTF_H
#define TESSERACT_CCUTIL_TPRINTF_H

#include "params.h" // for BOOL_VAR_H
#include <tesseract/export.h> // for TESS_API

namespace tesseract {

// Disable some log messages by setting log_level > 0.
extern TESS_API INT_VAR_H(log_level);

// Main logging function.
extern TESS_API void tprintf( // Trace printf
    const char *format, ...); // Message

} // namespace tesseract

#endif // define TESSERACT_CCUTIL_TPRINTF_H

Fix sw build error by using TESS_API for global variable log_level

Signed-off-by: Stefan Weil <8d4c780fcfdc41841e5070f4c43da8958ba6aec0@weilnetz.de>


// Copyright (c) 2013, Cloudera, inc.
//
// This is a C++ implementation of the Java CountDownLatch
// class.
// See http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/CountDownLatch.html
#ifndef KUDU_UTIL_COUNTDOWN_LATCH_H
#define KUDU_UTIL_COUNTDOWN_LATCH_H

#include <boost/noncopyable.hpp>
#include <boost/thread/mutex.hpp>

namespace kudu {

class CountDownLatch : boost::noncopyable {
public:
  // Initialize the latch with the given initial count.
  CountDownLatch(int count) :
    count_(count)
  {}

  // Decrement the count of this latch.
  // If the new count is zero, then all waiting threads are woken up.
  // If the count is already zero, this has no effect.
  void CountDown() {
    boost::lock_guard<boost::mutex> lock(lock_);
    if (count_ == 0) {
      return;
    }

    if (--count_ == 0) {
      // Latch has triggered.
      cond_.notify_all();
    }
  }

  // Wait until the count on the latch reaches zero.
  // If the count is already zero, this returns immediately.
  void Wait() {
    boost::unique_lock<boost::mutex> lock(lock_);
    while (count_ > 0) {
      cond_.wait(lock);
    }
  }

  // Wait on the latch for the given duration of time.
  // Return true if the latch reaches 0 within the given
  // timeout. Otherwise false.
  //
  // For example:
  //  latch.TimedWait(boost::posix_time::milliseconds(100));
  template<class TimeDuration>
  bool TimedWait(TimeDuration const &relative_time) {
    return TimedWait(boost::get_system_time() + relative_time);
  }

  // Wait on the latch until the given system time.
  // Return true if the latch reaches 0 within the given
  // timeout. Otherwise false.
  bool TimedWait(const boost::system_time &time_until) {
    boost::unique_lock<boost::mutex> lock(lock_);
    while (count_ > 0) {
      if (!cond_.timed_wait(lock, time_until)) {
        return false;
      }
    }
    return true;
  }

  uint64_t count() const {
    return count_;
  }

private:
  mutable boost::mutex lock_;
  boost::condition_variable cond_;

  uint64_t count_;
};

} // namespace kudu
#endif

Add a CountDownLatch class like Java's

util: Add a CountDownLatch class like Java's

This is handy in multi-threaded tests.


//===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H

#include "llvm/InstrTypes.h"

//===----------------------------------------------------------------------===//
//                 Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//

class AddInst : public BinaryOperator {
public:
  AddInst(Value *S1, Value *S2, const string &Name = "")
      : BinaryOperator(Instruction::Add, S1, S2, Name) {
  }

  virtual string getOpcode() const { return "add"; }
};

class SubInst : public BinaryOperator {
public:
  SubInst(Value *S1, Value *S2, const string &Name = "")
    : BinaryOperator(Instruction::Sub, S1, S2, Name) {
  }

  virtual string getOpcode() const { return "sub"; }
};

class SetCondInst : public BinaryOperator {
  BinaryOps OpType;
public:
  SetCondInst(BinaryOps opType, Value *S1, Value *S2,
	      const string &Name = "");

  virtual string getOpcode() const;
};

#endif

//===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H

#include "llvm/InstrTypes.h"

//===----------------------------------------------------------------------===//
//                 Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//

class GenericBinaryInst : public BinaryOperator {
  const char *OpcodeString;
public:
  GenericBinaryInst(unsigned Opcode, Value *S1, Value *S2,
		    const char *OpcodeStr, const string &Name = "")
    : BinaryOperator(Opcode, S1, S2, Name) {
    OpcodeString = OpcodeStr;
  }

  virtual string getOpcode() const { return OpcodeString; }
};

class SetCondInst : public BinaryOperator {
  BinaryOps OpType;
public:
  SetCondInst(BinaryOps opType, Value *S1, Value *S2,
	      const string &Name = "");

  virtual string getOpcode() const;
};

#endif

Make a new GenericBinaryInst class, instead of providing lots of silly
little classes.

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


/*
 Copyright 2020 The Matrix.org Foundation C.I.C

 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

 http://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.
 */

#import "MXSecretStorage.h"

@class MXSession;

NS_ASSUME_NONNULL_BEGIN

@interface MXSecretStorage ()

/**
 Constructor.

 @param mxSession the related 'MXSession' instance.
 */
- (instancetype)initWithMatrixSession:(MXSession *)mxSession  processingQueue:(dispatch_queue_t)processingQueue;

@end

NS_ASSUME_NONNULL_END

/*
 Copyright 2020 The Matrix.org Foundation C.I.C

 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

 http://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.
 */

#import "MXSecretStorage.h"

@class MXSession;
@class MXEncryptedSecretContent;

NS_ASSUME_NONNULL_BEGIN

@interface MXSecretStorage ()

/**
 Constructor.

 @param mxSession the related 'MXSession' instance.
 */
- (instancetype)initWithMatrixSession:(MXSession *)mxSession  processingQueue:(dispatch_queue_t)processingQueue;

- (nullable MXEncryptedSecretContent *)encryptedZeroStringWithPrivateKey:(NSData*)privateKey iv:(nullable NSData*)iv error:(NSError**)error;

- (nullable MXEncryptedSecretContent *)encryptSecret:(NSString*)unpaddedBase64Secret withSecretId:(nullable NSString*)secretId privateKey:(NSData*)privateKey iv:(nullable NSData*)iv error:(NSError**)error;

- (nullable NSString *)decryptSecretWithSecretId:(NSString*)secretId
                                   secretContent:(MXEncryptedSecretContent*)secretContent
                                  withPrivateKey:(NSData*)privateKey
                                           error:(NSError**)error;

@end

NS_ASSUME_NONNULL_END

Make aes-hmac-sha2 encryption methods from `MXSecretStorage` available in SDK


#ifndef _ASM_GENERIC_PAGE_H
#define _ASM_GENERIC_PAGE_H

#ifdef __KERNEL__
#ifndef __ASSEMBLY__

#include <linux/log2.h>

/*
 * non-const pure 2^n version of get_order
 * - the arch may override these in asm/bitops.h if they can be implemented
 *   more efficiently than using the arch log2 routines
 * - we use the non-const log2() instead if the arch has defined one suitable
 */
#ifndef ARCH_HAS_GET_ORDER
static inline __attribute__((const))
int __get_order(unsigned long size, int page_shift)
{
#if BITS_PER_LONG == 32 && defined(ARCH_HAS_ILOG2_U32)
	int order = __ilog2_u32(size) - page_shift;
	return order >= 0 ? order : 0;
#elif BITS_PER_LONG == 64 && defined(ARCH_HAS_ILOG2_U64)
	int order = __ilog2_u64(size) - page_shift;
	return order >= 0 ? order : 0;
#else
	int order;

	size = (size - 1) >> (page_shift - 1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
#endif
}
#endif

/**
 * get_order - calculate log2(pages) to hold a block of the specified size
 * @n - size
 *
 * calculate allocation order based on the current page size
 * - this can be used to initialise global variables from constant data
 */
#define get_order(n)							\
(									\
	__builtin_constant_p(n) ?					\
	((n < (1UL << PAGE_SHIFT)) ? 0 : ilog2(n) - PAGE_SHIFT) :	\
	__get_order(n, PAGE_SHIFT)					\
 )

#endif	/* __ASSEMBLY__ */
#endif	/* __KERNEL__ */

#endif	/* _ASM_GENERIC_PAGE_H */

#ifndef _ASM_GENERIC_PAGE_H
#define _ASM_GENERIC_PAGE_H

#ifdef __KERNEL__
#ifndef __ASSEMBLY__

#include <linux/compiler.h>

/* Pure 2^n version of get_order */
static __inline__ __attribute_const__ int get_order(unsigned long size)
{
	int order;

	size = (size - 1) >> (PAGE_SHIFT - 1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
}

#endif	/* __ASSEMBLY__ */
#endif	/* __KERNEL__ */

#endif	/* _ASM_GENERIC_PAGE_H */

Revert "[PATCH] LOG2: Alter get_order() so that it can make use of ilog2() on a constant"

This reverts commit 39d61db0edb34d60b83c5e0d62d0e906578cc707.

The commit was buggy in multiple ways:
 - the conversion to ilog2() was incorrect to begin with
 - it tested the wrong #defines, so on all architectures but FRV you'd
   never see the bug except for constant arguments.
 - the new "get_order()" macro used its arguments multiple times, and
   didn't even parenthesize them properly
 - despite the comments, it was not true that you could use it for
   constant initializers, since not all architectures even use the
   generic page.h header file.

All of the problems are individually fixable, but it all boils down to:
better just revert it, and re-do it from scratch.

Cc: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com>
Cc: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


// SKIP
#include <assert.h>
struct str{
    int a;
    char c;
};

int main(){
    struct str a;

    char* ca = (char*) &a;
    void *ptr = &ca[4];
    void *ptr2 = &a.c;

    int z = 1;

    // Alginment of struct fields, and thus result of the equality check here is implementation defined.
    if(ptr == ptr2){
        z = 1;
    } else {
        z = 2;
    }

    // Aaccording to the C standard (section 6.2.8 in the C11 standard),
    // the alignment of fields in structs is implementation defined.
    // When compiling with GCC, the following check as an assert happens to hold.
    __goblint_check(z==1); //UNKNOWN!
}

Add skipped regression test that exposes unsoundness when comparing addresses with integer and field offset.


@import CoreData;

@interface NSManagedObject (HYPURI)

- (NSString *)hyp_URI;

@end

@import CoreData;

@interface NSManagedObject (HYPURI)

- (NSString *)hyp_URI;

+ (NSManagedObject *)managedObjectWithURI:(NSString *)URI inContext:(NSManagedObjectContext *)context;

@end

Add method to retrieve object using an URI


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

#ifndef WEBKIT_GLUE_SCREEN_INFO_H_
#define WEBKIT_GLUE_SCREEN_INFO_H_

#include "base/gfx/rect.h"

namespace webkit_glue {

struct ScreenInfo {
  int depth;
  int depth_per_component;
  bool is_monochrome;
  gfx::Rect rect;
  gfx::Rect available_rect;
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_SCREEN_INFO_H_

Add missing file. Oops :(

Add missing file.  Oops :(

TBR=dglazkov

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

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


// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "ModuleManager.h"

DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All);

class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface
{
public:

	bool PythonGILAcquire();
	void PythonGILRelease();

	virtual void StartupModule() override;
	virtual void ShutdownModule() override;

	void RunString(char *);
	void RunFile(char *);
	void RunFileSandboxed(char *);

private:
	void *ue_python_gil;
	// used by console
	void *main_dict;
	void *local_dict;
};

struct FScopePythonGIL {
	FScopePythonGIL()
	{
#if defined(UEPY_THREADING)
		UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
		safeForRelease = UnrealEnginePythonModule.PythonGILAcquire();
#endif
	}

	~FScopePythonGIL()
	{
#if defined(UEPY_THREADING)
		if (safeForRelease) {
			UnrealEnginePythonModule.PythonGILRelease();
		}
#endif
	}

	FUnrealEnginePythonModule UnrealEnginePythonModule;
	bool safeForRelease;
};

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "ModuleManager.h"

DECLARE_LOG_CATEGORY_EXTERN(LogPython, Log, All);

class UNREALENGINEPYTHON_API FUnrealEnginePythonModule : public IModuleInterface
{
public:

	bool PythonGILAcquire();
	void PythonGILRelease();

	virtual void StartupModule() override;
	virtual void ShutdownModule() override;

	void RunString(char *);
	void RunFile(char *);
	void RunFileSandboxed(char *);

private:
	void *ue_python_gil;
	// used by console
	void *main_dict;
	void *local_dict;
	void *main_module;
};

struct FScopePythonGIL {
	FScopePythonGIL()
	{
#if defined(UEPY_THREADING)
		UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
		safeForRelease = UnrealEnginePythonModule.PythonGILAcquire();
#endif
	}

	~FScopePythonGIL()
	{
#if defined(UEPY_THREADING)
		if (safeForRelease) {
			UnrealEnginePythonModule.PythonGILRelease();
		}
#endif
	}

	FUnrealEnginePythonModule UnrealEnginePythonModule;
	bool safeForRelease;
};

Revert "Revert "Add support for the Python Stdout Log""

This reverts commit 32671bbd7b2134d5d1912225eb47bb368ee3e7ab.


#pragma once
#include "gtest\gtest.h"
#include "../pugixml/src/pugixml.hpp"
#include <Integrations\Tiled\Parsers\TileMapParser.h>
#include <Integrations\Tiled\DataStructures\TiledMap.h>

class TiledFixture : public ::testing::Test
{
protected:
    virtual void SetUp()
    {
        pugi::xml_document doc;
        auto parseResult = doc.load_file("./Content/TestMap.tmx");

        auto parser = TileMapParser();
        this->_parsedMap = parser.parse(doc.child("map"));
    }

    virtual void TearDown()
    {
        delete _parsedMap;
    }

    TiledMap * _parsedMap;
};

#pragma once
#include "gtest\gtest.h"
#include "../pugixml/src/pugixml.hpp"
#include <Integrations\Tiled\Parsers\TileMapParser.h>
#include <Integrations\Tiled\DataStructures\TiledMap.h>
#include "../../../2DXngine.Core/src/ContentManagement/AssetPath.h"

class TiledFixture : public ::testing::Test
{
protected:
    virtual void SetUp()
    {
        AssetPath path = AssetPath::create("Content\\TestMap.tmx");
        pugi::xml_document doc;
        auto parseResult = doc.load_file(path.get_fullPath().c_str());

        auto parser = TileMapParser();
        this->_parsedMap = parser.parse(doc.child("map"));
    }

    virtual void TearDown()
    {
        delete _parsedMap;
    }

    TiledMap * _parsedMap;
};

Fix path to map xml

EDIT: Fix path to map xml


//
//  RocksDBMergeOperator.h
//  ObjectiveRocks
//
//  Created by Iska on 07/12/14.
//  Copyright (c) 2014 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RocksDBMergeOperator : NSObject

+ (instancetype)operatorWithName:(NSString *)name
						andBlock:(id (^)(id key, id existingValue, id value))block;

+ (instancetype)operatorWithName:(NSString *)name
			   partialMergeBlock:(NSString * (^)(id key, NSString *leftOperand, NSString *rightOperand))partialMergeBlock
				  fullMergeBlock:(id (^)(id key, id existingValue, NSArray *operandList))fullMergeBlock;

@end

//
//  RocksDBMergeOperator.h
//  ObjectiveRocks
//
//  Created by Iska on 07/12/14.
//  Copyright (c) 2014 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 A Merge operator is an atomic Read-Modify-Write operation in RocksDB.
 */
@interface RocksDBMergeOperator : NSObject

/**
 Initializes a new instance of an associative merge operator.

 @discussion This Merge Operator can be use for associative data:

 * The merge operands are formatted the same as the Put values, AND
 * It is okay to combine multiple operands into one (as long as they are in the same order)

 @param name The name of the merge operator.
 @param block The block that merges the existing and new values for the given key.
 @return A newly-initialized instance of the Merge Operator.
 */
+ (instancetype)operatorWithName:(NSString *)name
						andBlock:(id (^)(id key, id existingValue, id value))block;

/**
 Initializes a new instance of a generic merge operator.

 @discussion If either of the two associativity constraints do not hold, then the Generic Merge Operator could
 be used.

 The Generic Merge Operator has two methods, PartialMerge, FullMerge:

 * PartialMerge: used to combine two-merge operands (if possible). If the client-specified operator can logically
 handle “combining” two merge-operands into a single operand, the semantics for doing so should be provided in this
 method, which should then return a non-nil object. If `nil` is returned, then it means that the two merge-operands
 couldn’t be combined into one.

 * FullMerge: this function is given an existingValue and a list of operands that have been stacked. The
 client-specified MergeOperator should then apply the operands one-by-one and return the resulting object.
 If `nil` is returned, then this indicates a failure, i.e. corrupted data, errors ... etc.

 @param name The name of the merge operator.
 @param partialMergeBlock The block to perform a partial merge.
 @param fullMergeBlock The block to perform the full merge.
 @return A newly-initialized instance of the Merge Operator.
 */
+ (instancetype)operatorWithName:(NSString *)name
			   partialMergeBlock:(NSString * (^)(id key, NSString *leftOperand, NSString *rightOperand))partialMergeBlock
				  fullMergeBlock:(id (^)(id key, id existingValue, NSArray *operandList))fullMergeBlock;

@end

Add source code documentation for the Merge Operator class


//
//  AKTableViewCellAdapter.h
//  AppKit
//
//  Created by Zijiao Liu on 12/20/15.
//  Copyright © 2015 Zijiao Liu. All rights reserved.
//

#import "AKTableViewConfiguration.h"
#import "AKTableViewCell.h"

@interface AKTableViewCellAdapter : NSObject <AKTableViewConfiguration>

- (CGFloat)dataViewController:(nonnull AKDataViewController *)dataViewController item:(nonnull id<NSObject>)item groupStyle:(AKTableViewCellGroupStyle)groupStyle seperatorEnabled:(BOOL)seperatorEnabled heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath;

@end

//
//  AKTableViewCellAdapter.h
//  AppKit
//
//  Created by Zijiao Liu on 12/20/15.
//  Copyright © 2015 Zijiao Liu. All rights reserved.
//

#import "AKTableViewConfiguration.h"
#import "AKTableViewCell.h"

@interface AKTableViewCellAdapter : NSObject <AKTableViewConfiguration>

- (CGFloat)dataViewController:(nonnull AKDataViewController *)dataViewController item:(nonnull id<NSObject>)item heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath NS_UNAVAILABLE;

- (CGFloat)dataViewController:(nonnull AKDataViewController *)dataViewController item:(nonnull id<NSObject>)item groupStyle:(AKTableViewCellGroupStyle)groupStyle seperatorEnabled:(BOOL)seperatorEnabled heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath;

@end

Disable a method in adapter

Disable a method in adapter


//
//  STPLocalizedStringUtils.h
//  Stripe
//
//  Created by Brian Dorfman on 8/11/16.
//  Copyright © 2016 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#define STPLocalizedString(key, comment) \
[STPLocalizationUtils localizedStripeStringForKey:(key)]

@interface STPLocalizationUtils : NSObject

/**
 Acts like NSLocalizedString but tries to find the string in the Stripe
 bundle first if possible.
 */
+ (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key;

@end

//
//  STPLocalizationUtils.h
//  Stripe
//
//  Created by Brian Dorfman on 8/11/16.
//  Copyright © 2016 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface STPLocalizationUtils : NSObject

/**
 Acts like NSLocalizedString but tries to find the string in the Stripe
 bundle first if possible.
 */
+ (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key;

@end

static inline NSString * _Nonnull STPLocalizedString(NSString* _Nonnull key, NSString * _Nullable __unused comment) {
    return [STPLocalizationUtils localizedStripeStringForKey:key];
}

Change to use inline function instead of macro.

This makes FauxPas's localization checks work properly.


//
//  BRScrollerUtilities.c
//  BRScroller
//
//  Created by Matt on 7/11/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#include "BRScrollerUtilities.h"

#if !defined(MIN)
	#define MIN(A,B)	((A) < (B) ? (A) : (B))
#endif

inline bool BRFloatsAreEqual(CGFloat a, CGFloat b) {
	const CGFloat d = a - b;
	return (d < 0 ? -d : d) < 1e-4;
}

inline CGSize BRAspectSizeToFit(CGSize aSize, CGSize maxSize) {
	CGFloat scale = 1.0;
	if ( aSize.width > 0.0 && aSize.height > 0.0 ) {
		CGFloat dw = maxSize.width / aSize.width;
		CGFloat dh = maxSize.height / aSize.height;
		scale = dw < dh ? dw : dh;
	}
	return CGSizeMake(MIN(floorf(maxSize.width), ceilf(aSize.width * scale)),
					  MIN(floorf(maxSize.height), ceilf(aSize.height * scale)));
}

//
//  BRScrollerUtilities.c
//  BRScroller
//
//  Created by Matt on 7/11/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#include "BRScrollerUtilities.h"

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

inline bool BRFloatsAreEqual(CGFloat a, CGFloat b) {
	const CGFloat d = a - b;
	return (d < 0 ? -d : d) < 1e-4;
}

inline CGSize BRAspectSizeToFit(CGSize aSize, CGSize maxSize) {
	CGFloat scale = 1.0;
	if ( aSize.width > 0.0 && aSize.height > 0.0 ) {
		CGFloat dw = maxSize.width / aSize.width;
		CGFloat dh = maxSize.height / aSize.height;
		scale = dw < dh ? dw : dh;
	}
	return CGSizeMake(MIN(floorf(maxSize.width), ceilf(aSize.width * scale)),
					  MIN(floorf(maxSize.height), ceilf(aSize.height * scale)));
}

Fix includes to just what is needed.

Fix includes to just what is needed.


//
//  RxHyperdrive.h
//  RxHyperdrive
//
//  Created by Kyle Fuller on 13/09/2015.
//  Copyright © 2015 Cocode. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for RxHyperdrive.
FOUNDATION_EXPORT double RxHyperdriveVersionNumber;

//! Project version string for RxHyperdrive.
FOUNDATION_EXPORT const unsigned char RxHyperdriveVersionString[];

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

//
//  RxHyperdrive.h
//  RxHyperdrive
//
//  Created by Kyle Fuller on 13/09/2015.
//  Copyright © 2015 Cocode. All rights reserved.
//

@import Foundation;

//! Project version number for RxHyperdrive.
FOUNDATION_EXPORT double RxHyperdriveVersionNumber;

//! Project version string for RxHyperdrive.
FOUNDATION_EXPORT const unsigned char RxHyperdriveVersionString[];

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

Use Foundation in the umbrella header

Use Foundation in the umbrella header


//===- ASTSerializationListener.h - Decl/Type PCH Write Events -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the ASTSerializationListener class, which is notified
//  by the ASTWriter when an entity is serialized.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_FRONTEND_AST_SERIALIZATION_LISTENER_H
#define LLVM_CLANG_FRONTEND_AST_SERIALIZATION_LISTENER_H

#include "llvm/System/DataTypes.h"

namespace clang {

class PreprocessedEntity;

/// \brief Listener object that receives callbacks when certain kinds of
/// entities are serialized.
class ASTSerializationListener {
public:
  virtual ~ASTSerializationListener();

  /// \brief Callback invoked whenever a preprocessed entity is serialized.
  ///
  /// This callback will only occur when the translation unit was created with
  /// a detailed preprocessing record.
  ///
  /// \param Entity The entity that has been serialized.
  ///
  /// \param Offset The offset (in bits) of this entity in the resulting
  /// AST file.
  virtual void SerializedPreprocessedEntity(PreprocessedEntity *Entity,
                                            uint64_t Offset) = 0;
};

}

#endif

Add missing file from last commit

Add missing file from last commit

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


/*
 *  test_gcrypt - Copyright 2009 Slide, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the
 * Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <glib.h>
#include <gcrypt.h>

void __test_mpi_scan()
{
	const char *order = "ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973";
	char *outbuf;
	gcry_mpi_t point = gcry_mpi_new(0);
	int rc = 0;
	int n = 0;

	rc = gcry_mpi_scan(&point, GCRYMPI_FMT_HEX, order, 0, NULL);
	g_assert(rc == 0);

	fprintf(stderr, "OUT %s : %d\n", outbuf, n);
}

int main(int argc, char **argv)
{
	int rc = 0;
	g_test_init(&argc, &argv, NULL);

	/*
	 * Test some basic mpi operations
	 */
	g_test_add_func("/mpi/scan", __test_mpi_scan);

	rc = g_test_run();
	fflush(stderr);
	return rc;
}

Add a simple test to play with libgcrypt


/*
 * Copyright (c) 2017 Contributors as noted in the AUTHORS file
 *
 * This file is part of Solo5, a sandboxed execution environment.
 *
 * 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.
 */

#include "../bindings.h"
#include "muen-net.h"

bool solo5_yield(uint64_t deadline)
{
    bool rc = false;
    do {
        if (muen_net_pending_data()) {
            rc = true;
            break;
        }
        __asm__ __volatile__("pause");
    } while (solo5_clock_monotonic() < deadline);

    if (muen_net_pending_data()) {
        rc = true;
    }

    return rc;
}

/*
 * Copyright (c) 2017 Contributors as noted in the AUTHORS file
 *
 * This file is part of Solo5, a sandboxed execution environment.
 *
 * 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.
 */

#include "../bindings.h"
#include "muen-net.h"

void solo5_yield(solo5_time_t deadline, solo5_handle_set_t *ready_set)
{
    solo5_handle_set_t tmp_ready_set = 0;

    do {
        for (solo5_handle_t i = 0U; i < MFT_MAX_ENTRIES; ++i) {
            if (muen_net_pending_data(i))
                tmp_ready_set |= 1UL << i;
        }

        if (tmp_ready_set > 0)
            break;

        __asm__ __volatile__("pause");
    } while (solo5_clock_monotonic() < deadline);

    if (ready_set)
        *ready_set = tmp_ready_set;
}

muen: Rework solo5_yield to support multiple devices


/*------------------------------------------------------------------------------
| NuCTex	| items.h
| Author	| Benjamin A - Nullsrc
| Created	| 17 January, 2016
| Changed	| 17 January, 2016
|-------------------------------------------------------------------------------
| Overview	| Declare item structures used in the code
\-----------------------------------------------------------------------------*/
#ifndef NULLSRC_ITEMS_HEADER
#define NULLSRC_ITEMS_HEADER

typedef struct Item {
	char* name;
	char* description;
	int id;
	float size;
	float weight;

	int strength;
	int agility;
	int intelligence;
	int charisma;
} Item;

typedef struct Inventory {
	item[26];
} Inventory;

Add definition for item structs

Add definition for item structs


#ifndef RCR_LEVEL1PAYLOAD_SETUP_H_
#define RCR_LEVEL1PAYLOAD_SETUP_H_

#if defined(ARDUINO) && ARDUINO >= 100
	#include "arduino.h"
#else
	#include "WProgram.h"
#endif

namespace rcr {
namespace level1payload {

// Setup the object. Swallow any errors.
template<typename T>
inline void setup_object(T& obj, const char* error_message, const char* success_message) {
  if (!obj.begin()) {
    Serial.println(error_message);
    // Swallow the error. Fault tolerance is required.
  }
  else {
    Serial.println(success_message);
  }
  Serial.println();
}

} // namespace level1_payload
} // namespace rcr

#endif // RCR_LEVEL1PAYLOAD_SETUP_H_

#ifndef RCR_LEVEL1PAYLOAD_SETUP_H_
#define RCR_LEVEL1PAYLOAD_SETUP_H_

#if defined(ARDUINO) && ARDUINO >= 100
	#include "arduino.h"
#else
	#include "WProgram.h"
#endif

namespace rcr {
namespace level1payload {

// Setup the object. Swallow any errors.
template<typename T, typename TArg>
inline void setup_object(T& obj, TArg arg, const char* display_name) {
  if (!obj.begin(arg)) {
    Serial.print("ERROR: ");
    Serial.print(display_name);
    Serial.println(" could not be found or setup.");

    // Swallow the error. Fault tolerance is required.
  }
  else {
    Serial.print("Success: ");
    Serial.print(display_name);
    Serial.println(" ready.");
  }
  Serial.println();
}
template<typename T>
inline void setup_object(T& obj, const char* display_name) {
  if (!obj.begin()) {
    Serial.print("ERROR: ");
    Serial.print(display_name);
    Serial.println(" could not be found or setup.");

    // Swallow the error. Fault tolerance is required.
  }
  else {
    Serial.print("Success: ");
    Serial.print(display_name);
    Serial.println(" ready.");
  }
  Serial.println();
}

} // namespace level1_payload
} // namespace rcr

#endif // RCR_LEVEL1PAYLOAD_SETUP_H_

Add template overload for begin() arguments


// 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 VIEWS_VIEW_CONSTANTS_H_
#define VIEWS_VIEW_CONSTANTS_H_
#pragma once

#include "views/views_export.h"

namespace views {

// Size (width or height) within which the user can hold the mouse and the
// view should scroll.
extern const int kAutoscrollSize;

// Time in milliseconds to autoscroll by a row. This is used during drag and
// drop.
extern const int kAutoscrollRowTimerMS;

// Used to determine whether a drop is on an item or before/after it. If a drop
// occurs kDropBetweenPixels from the top/bottom it is considered before/after
// the item, otherwise it is on the item.
VIEWS_EXPORT extern const int kDropBetweenPixels;

}  // namespace views

#endif  // VIEWS_VIEW_CONSTANTS_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 VIEWS_VIEW_CONSTANTS_H_
#define VIEWS_VIEW_CONSTANTS_H_
#pragma once

#include "views/views_export.h"

namespace views {

// Size (width or height) within which the user can hold the mouse and the
// view should scroll.
VIEWS_EXPORT extern const int kAutoscrollSize;

// Time in milliseconds to autoscroll by a row. This is used during drag and
// drop.
VIEWS_EXPORT extern const int kAutoscrollRowTimerMS;

// Used to determine whether a drop is on an item or before/after it. If a drop
// occurs kDropBetweenPixels from the top/bottom it is considered before/after
// the item, otherwise it is on the item.
VIEWS_EXPORT extern const int kDropBetweenPixels;

}  // namespace views

#endif  // VIEWS_VIEW_CONSTANTS_H_

Add VIEWS_EXPORT to autoscroll constants.

Referenced by browser/bookmarks/bookmark_drop_info.cc, fixes link when in
component and incremental linking on Windows.

BUG=
TEST=Links in Component build mode

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

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


#include "sphia-test.h"

// See #51
static void
test_clear_similar_keys() {
  sphia_set(sphia, "key-1", "hello world");
  sphia_set(sphia, "key-10", "hello world");
  assert(2 == sphia_count(sphia));
  assert(0 == sphia_clear(sphia));
  assert(0 == sphia_count(sphia));
}

TEST(test_clear_similar_keys);

#include "sphia-test.h"

// See #51
static void
test_clear_similar_keys() {
  sphia_set(sphia, "key-1", "hello world");
  sphia_set(sphia, "key-10", "hello world");
  sphia_set(sphia, "00000000", "hello world");
  sphia_set(sphia, "000000000", "hello world");
  assert(4 == sphia_count(sphia));
  assert(0 == sphia_clear(sphia));
  assert(0 == sphia_count(sphia));
}

TEST(test_clear_similar_keys);

Update clear test to use keys longer than 8 chars


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

int g;

pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

void* f1(void* ptr) {
    pthread_mutex_lock(&mut);
    g = 1;
    pthread_cond_wait(&cond,&mut);
    assert(g == 0); // TODO (no cond-flow support)
    printf("g is %i", g);
    g = 0;
    pthread_mutex_unlock(&mut);
}

void* f2(void* ptr) {
    pthread_mutex_lock(&mut);
    assert(g == 0); //UNKNOWN!
    g = 0;
    pthread_cond_signal(&cond);
    pthread_mutex_unlock(&mut);
}

int main(int argc, char const *argv[])
{
    pthread_t t1;
    pthread_t t2;

    pthread_create(&t1,NULL,f1,NULL);
    sleep(1);
    pthread_create(&t2,NULL,f2,NULL);

    pthread_join(t1, NULL);
    pthread_join(t2, NULL);

    return 0;
}

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

int g;

pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

void* f1(void* ptr) {
    pthread_mutex_lock(&mut);
    g = 1;
    pthread_cond_wait(&cond,&mut);
    assert(g == 0); // TODO (no cond-flow support)
    printf("g is %i", g);
    g = 0;
    pthread_mutex_unlock(&mut);
    return NULL;
}

void* f2(void* ptr) {
    pthread_mutex_lock(&mut);
    assert(g == 0); //UNKNOWN!
    g = 0;
    pthread_cond_signal(&cond);
    pthread_mutex_unlock(&mut);
    return NULL;
}

int main(int argc, char const *argv[])
{
    pthread_t t1;
    pthread_t t2;

    pthread_create(&t1,NULL,f1,NULL);
    sleep(1);
    pthread_create(&t2,NULL,f2,NULL);

    pthread_join(t1, NULL);
    pthread_join(t2, NULL);

    return 0;
}

Add missing return to 13/67

Add missing return to 13/67


// Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else  // !BUILDING_CEF_SHARED

// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

#endif  // !BUILDING_CEF_SHARED

#endif  // CEF_LIBCEF_DLL_CEF_MACROS_H_
// Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else  // !BUILDING_CEF_SHARED

// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

#endif  // !BUILDING_CEF_SHARED

#endif  // CEF_LIBCEF_DLL_CEF_MACROS_H_

Remove duplicate content in file.

Remove duplicate content in file.


using namespace std;

        	vector<int> Int;
		vector<string> Name;

int CheckForInt(string ProcessInput)
{
	if (ProcessInput.substr(0, 3) == "int")
	{
		int EqualLocation;
		int SemicolonLocation;
		stringstream Number;
		stringstream StringName;
		int FinalNumber;
		string FinalName;
		EqualLocation = ProcessInput.find("=");
		EqualLocation++;
		SemicolonLocation = ProcessInput.find(";");
		Number << ProcessInput.substr(EqualLocation, SemicolonLocation);
		Number >> FinalNumber;
		StringName << ProcessInput.substr(4, EqualLocation);
		StringName >> FinalName;
		cout << FinalName << " = " << FinalNumber << "\n\n";
		Int.push_back(FinalNumber);
		Name.push_back(FinalName);
	}
	return 0;
}

Add integer interpret and register algorithm.

This algorithm uses vectors and standard C++ functions to register
integers into the program with name and value corresponding in order.
There's another algorithm that will make the program be able to retrieve
the results using the console out function. Which that algorithm is
still being tested and soon will be committed into the GitHub project
when it is completed.


#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>

#include "epollinterface.h"

#define MAX_EPOLL_EVENTS 10

void add_epoll_handler(int epoll_fd, struct epoll_event_handler* handler, uint32_t event_mask)
{
    struct epoll_event event;

    event.data.ptr = handler;
    event.events = event_mask;
    if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, handler->fd, &event) == -1) {
        perror("Couldn't register server socket with epoll");
        exit(-1);
    }
}

void do_reactor_loop(int epoll_fd)
{
    struct epoll_event epoll_events[MAX_EPOLL_EVENTS];

    while (1) {
        int ii;
        int num_events;

        num_events = epoll_wait(epoll_fd, epoll_events, MAX_EPOLL_EVENTS, -1);
        for (ii=0; ii < num_events; ii++ ) {
            struct epoll_event_handler* handler = (struct epoll_event_handler*) epoll_events[ii].data.ptr;
            handler->handle(handler, epoll_events[ii].events);
        }

    }

}

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>

#include "epollinterface.h"

#define MAX_EPOLL_EVENTS 1

void add_epoll_handler(int epoll_fd, struct epoll_event_handler* handler, uint32_t event_mask)
{
    struct epoll_event event;

    event.data.ptr = handler;
    event.events = event_mask;
    if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, handler->fd, &event) == -1) {
        perror("Couldn't register server socket with epoll");
        exit(-1);
    }
}

void do_reactor_loop(int epoll_fd)
{
    struct epoll_event epoll_events[MAX_EPOLL_EVENTS];

    while (1) {
        int ii;
        int num_events;

        num_events = epoll_wait(epoll_fd, epoll_events, MAX_EPOLL_EVENTS, -1);
        for (ii=0; ii < num_events; ii++ ) {
            struct epoll_event_handler* handler = (struct epoll_event_handler*) epoll_events[ii].data.ptr;
            handler->handle(handler, epoll_events[ii].events);
        }

    }

}

Handle epoll events one at a time. Doesn't seem to make things slower, and eliminates (I think) risk of freed backends getting events.


#ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H

#include <string>

#include "CardType.h"

namespace ygo
{
namespace data
{

struct StaticCardData
{
    std::string name;
    CardType cardType;
    // monster only
    Attribute attribute;
    MonsterType monsterType;
    Type type;
    MonsterType monsterAbility;
    int level;
    int attack;
    int defense;
    int lpendulum;
    int rpendulum;
    // spell and trap only
    SpellType spellType;
    TrapType trapType;
};

}
}

#endif

#ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H

#include <string>

#include "CardType.h"

namespace ygo
{
namespace data
{

struct StaticCardData
{
    const char* name;
    CardType cardType;
    // monster only
    Attribute attribute;
    MonsterType monsterType;
    Type type;
    MonsterType monsterAbility;
    int level;
    int attack;
    int defense;
    int lpendulum;
    int rpendulum;
    // spell and trap only
    SpellType spellType;
    TrapType trapType;
};

}
}

#endif

Change name to const char *

Change name to const char *

Allow for trivially constructable type


#ifndef REQUESTHANDLER_H
#define REQUESTHANDLER_H

class RequestHandler {
public:
    virtual bool canHandle(HTTPMethod method, String uri) { return false; }
    virtual bool canUpload(String uri) { return false; }
    virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { return false; }
    virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) {}

    RequestHandler* next() { return _next; }
    void next(RequestHandler* r) { _next = r; }

private:
    RequestHandler* _next = nullptr;
};

#endif //REQUESTHANDLER_H

#ifndef REQUESTHANDLER_H
#define REQUESTHANDLER_H

class RequestHandler {
public:
    virtual ~RequestHandler() { }
    virtual bool canHandle(HTTPMethod method, String uri) { return false; }
    virtual bool canUpload(String uri) { return false; }
    virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { return false; }
    virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) {}

    RequestHandler* next() { return _next; }
    void next(RequestHandler* r) { _next = r; }

private:
    RequestHandler* _next = nullptr;
};

#endif //REQUESTHANDLER_H

Fix warning due to lack of virtual destructor


#if (PAGE_SIZE == 4096)
	CACHE(32)
#endif
	CACHE(64)
#if L1_CACHE_BYTES < 64
	CACHE(96)
#endif
	CACHE(128)
#if L1_CACHE_BYTES < 128
	CACHE(192)
#endif
	CACHE(256)
	CACHE(512)
	CACHE(1024)
	CACHE(2048)
	CACHE(4096)
	CACHE(8192)
	CACHE(16384)
	CACHE(32768)
	CACHE(65536)
	CACHE(131072)
#ifndef CONFIG_MMU
	CACHE(262144)
	CACHE(524288)
	CACHE(1048576)
#ifdef CONFIG_LARGE_ALLOCS
	CACHE(2097152)
	CACHE(4194304)
	CACHE(8388608)
	CACHE(16777216)
	CACHE(33554432)
#endif /* CONFIG_LARGE_ALLOCS */
#endif /* CONFIG_MMU */

#if (PAGE_SIZE == 4096)
	CACHE(32)
#endif
	CACHE(64)
#if L1_CACHE_BYTES < 64
	CACHE(96)
#endif
	CACHE(128)
#if L1_CACHE_BYTES < 128
	CACHE(192)
#endif
	CACHE(256)
	CACHE(512)
	CACHE(1024)
	CACHE(2048)
	CACHE(4096)
	CACHE(8192)
	CACHE(16384)
	CACHE(32768)
	CACHE(65536)
	CACHE(131072)
#if (NR_CPUS > 512) || (MAX_NUMNODES > 256) || !defined(CONFIG_MMU)
	CACHE(262144)
#endif
#ifndef CONFIG_MMU
	CACHE(524288)
	CACHE(1048576)
#ifdef CONFIG_LARGE_ALLOCS
	CACHE(2097152)
	CACHE(4194304)
	CACHE(8388608)
	CACHE(16777216)
	CACHE(33554432)
#endif /* CONFIG_LARGE_ALLOCS */
#endif /* CONFIG_MMU */

[PATCH] Increase max kmalloc size for very large systems

Systems with extemely large numbers of nodes or cpus need to kmalloc
structures larger than is currently supported.  This patch increases the
maximum supported size for very large systems.

This patch should have no effect on current systems.

(akpm: why not just use alloc_pages() for sysfs_cpus?)

Signed-off-by: Jack Steiner <9fc09c92f9d4898dd6e5af3e81679b627e939258@sgi.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>


/*
 * 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 88
#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 89
#endif

Update Skia milestone to 89

Update Skia milestone to 89

Change-Id: I9de827fe1902a9a91898fcf70d82153a821500ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334418
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


#pragma once
#ifndef INC_SAMPLOG_LOGLEVEL_H
#define INC_SAMPLOG_LOGLEVEL_H

#ifdef ERROR //because Microsoft
#undef ERROR
#endif

enum samplog_LogLevel
{
	NONE = 0,
	DEBUG = 1,
	INFO = 2,
	WARNING = 4,
	ERROR = 8,
	FATAL = 16,
	VERBOSE = 32,
};

inline samplog_LogLevel operator|(samplog_LogLevel a, samplog_LogLevel b)
{
	return static_cast<samplog_LogLevel>(static_cast<int>(a) | static_cast<int>(b));
}

#ifdef __cplusplus
namespace samplog
{
	typedef samplog_LogLevel LogLevel;
}
#endif /* __cplusplus */

#endif /* INC_SAMPLOG_LOGLEVEL_H */

#pragma once
#ifndef INC_SAMPLOG_LOGLEVEL_H
#define INC_SAMPLOG_LOGLEVEL_H

#ifdef ERROR //because Microsoft
#undef ERROR
#endif

enum samplog_LogLevel
{
	NONE = 0,
	DEBUG = 1,
	INFO = 2,
	WARNING = 4,
	ERROR = 8,
	FATAL = 16,
	VERBOSE = 32,
};

#ifdef __cplusplus
inline samplog_LogLevel operator|(samplog_LogLevel a, samplog_LogLevel b)
{
	return static_cast<samplog_LogLevel>(static_cast<int>(a) | static_cast<int>(b));
}

namespace samplog
{
	typedef samplog_LogLevel LogLevel;
}
#endif /* __cplusplus */

#endif /* INC_SAMPLOG_LOGLEVEL_H */

Put enum OR declaration in `__cplusplus`


/*
 *  mbedtls_device.h
 *******************************************************************************
 * Copyright (c) 2017, STMicroelectronics
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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
 *
 *  http://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 MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H

/* FIXME: Don't enable AES hardware acceleration until issue #4928 is fixed.
 * (https://github.com/ARMmbed/mbed-os/issues/4928) */
/* #define MBEDTLS_AES_ALT */

#define MBEDTLS_SHA256_ALT

#define MBEDTLS_SHA1_ALT

#define MBEDTLS_MD5_ALT

#endif /* MBEDTLS_DEVICE_H */

/*
 *  mbedtls_device.h
 *******************************************************************************
 * Copyright (c) 2017, STMicroelectronics
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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
 *
 *  http://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 MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H

/* FIXME: Don't enable AES hardware acceleration until issue #4928 is fixed.
 * (https://github.com/ARMmbed/mbed-os/issues/4928) */
/* #define MBEDTLS_AES_ALT */

/* FIXME: Don't enable SHA1, SHA256 and MD5 hardware acceleration until issue
 * #5079 is fixed. (https://github.com/ARMmbed/mbed-os/issues/5079) */
/* #define MBEDTLS_SHA256_ALT */

/* #define MBEDTLS_SHA1_ALT */

/* #define MBEDTLS_MD5_ALT */

#endif /* MBEDTLS_DEVICE_H */

mbedtls: Disable MD5, SHA1, SHA256 HW ACC for STM32F439xI

STM32F439xI-family MD5, SHA1 and SHA256 hardware acceleration
occasionally produces incorrect output (#5079).

Don't enable MD5, SHA1 and SHA256 HW acceleration on STM32F439xI-family
targets by default until issue #5079 is fixed.


/*
* Utils for calling OpenSSL
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_OPENSSL_H__
#define BOTAN_OPENSSL_H__

#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <memory>

#include <openssl/err.h>

namespace Botan {

class OpenSSL_Error : public Exception
   {
   public:
      OpenSSL_Error(const std::string& what) :
         Exception(what + " failed: " + ERR_error_string(ERR_get_error(), nullptr)) {}
   };

#define BOTAN_OPENSSL_BLOCK_PRIO 150
#define BOTAN_OPENSSL_HASH_PRIO  150
#define BOTAN_OPENSSL_RC4_PRIO   150

#define BOTAN_OPENSSL_RSA_PRIO     150
#define BOTAN_OPENSSL_ECDSA_PRIO   150

}

#endif

/*
* Utils for calling OpenSSL
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_OPENSSL_H__
#define BOTAN_OPENSSL_H__

#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <memory>

#include <openssl/err.h>

namespace Botan {

class OpenSSL_Error : public Exception
   {
   public:
      OpenSSL_Error(const std::string& what) :
         Exception(what + " failed: " + ERR_error_string(ERR_get_error(), nullptr)) {}
   };

#define BOTAN_OPENSSL_BLOCK_PRIO 150
#define BOTAN_OPENSSL_HASH_PRIO  150
#define BOTAN_OPENSSL_RC4_PRIO   150

#define BOTAN_OPENSSL_RSA_PRIO     90
#define BOTAN_OPENSSL_ECDSA_PRIO   90

}

#endif

Make OpenSSL ECDSA and RSA request only until they can be tested


//===- Slab.h -------------------------------------------------------------===//
//
//                            The Bold Project
//
//  This file is distributed under the New BSD License.
//  See LICENSE for details.
//
//===----------------------------------------------------------------------===//
#ifndef BOLD_SUPPORT_SLAB_H
#define BOLD_SUPPORT_SLAB_H
#include <bold/ADT/IListNode.h>

namespace bold {

/** \class Slab
 *  \brief Slab is a continuous memory space that amounts to `Amount`
 *  `DataType` elements.
 *
 *  Slab is a basic allocated unit of BumpAllocator.
 *
 *  @tparam DataType the type of elements
 *  @tparam Amount   the amount of elements in a slab
 */
template<typename DataType, unsigned int Amount>
struct Slab : public IListNode<Slab>
{
public:
  enum {
    max_size = Amount
  };

public:
  DataType data[max_size];
};

} // namespace bold

#endif

//===- Slab.h -------------------------------------------------------------===//
//
//                            The Bold Project
//
//  This file is distributed under the New BSD License.
//  See LICENSE for details.
//
//===----------------------------------------------------------------------===//
#ifndef BOLD_SUPPORT_SLAB_H
#define BOLD_SUPPORT_SLAB_H
#include <bold/ADT/IListNode.h>

namespace bold {

/** \class Slab
 *  \brief Slab is a continuous memory space that amounts to `Amount`
 *  `DataType` elements.
 *
 *  Slab is a basic allocated unit of BumpAllocator.
 *
 *  @tparam DataType the type of elements
 *  @tparam Amount   the amount of elements in a slab
 */
template<typename DataType, unsigned int Amount>
struct Slab : public IListNodeBase
{
public:
  enum {
    max_size = Amount
  };

public:
  DataType data[max_size];
};

} // namespace bold

#endif

Fix bug - obviously, recursive template type is impossible.


#include "ruby.h"
#include "noyes.h"

HammingWindow * new_hamming_window(int window_size) {
  HammingWindow *hw = malloc(sizeof(HammingWindow));
  hw->buf = malloc(window_size * sizeof(double));
  hw->buflen = window_size;
  return hw;
}

void free_hamming_window(HammingWindow *hw) {
  free(hw->buf);
  free(hw);
}

NData2 * hamming_window_apply(HammingWindow *self, NData2* data) {
  return NULL;
}

Implement allocation and deallocation for c hamming window.


/*
 * Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifndef __TRACKER_MINER_FS_WRITEBACK_H__
#define __TRACKER_MINER_FS_WRITEBACK_H__

#include <libtracker-miner/tracker-miner.h>

#include "tracker-config.h"

#include "tracker-miner-files.h"

G_BEGIN_DECLS

void tracker_writeback_init     (TrackerMinerFiles  *miner_files,
                                 TrackerConfig      *config,
                                 GError            **error);
void tracker_writeback_shutdown (void);

G_END_DECLS

#endif /* __TRACKER_MINER_FS_WRITEBACK_H__ */

/*
 * Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifndef __TRACKER_MINER_FS_WRITEBACK_H__
#define __TRACKER_MINER_FS_WRITEBACK_H__

#include <libtracker-miner/tracker-miner.h>

#include "tracker-config.h"

#include "tracker-miner-files.h"

G_BEGIN_DECLS

void tracker_writeback_init     (TrackerMinerFiles  *miner_files,
                                 TrackerConfig      *config,
                                 GError            **error);
void tracker_writeback_shutdown (void);

G_END_DECLS

#endif /* __TRACKER_MINER_FS_WRITEBACK_H__ */

Fix licensing errors in files

tracker-miner-fs: Fix licensing errors in files

Some were changed from GPL to LGPL for some reason. Now they're all GPL as
they should be.


//
//  PFQuery+RACExtensions.h
//  Parse-RACExtensions
//
//  Created by Dave Lee on 2013-06-28.
//  Copyright (c) 2013 Dave Lee. All rights reserved.
//

#import <Parse/PFQuery.h>

@class RACSignal;

@interface PFQuery (RACExtensions)

/// Gets a PFObject with the given id.
///
/// @warning This mutates the PFQuery.
///
/// @see -getObjectInBackgroundWithId:block:
///
/// @return A signal that sends the identified PFObject.
- (RACSignal *)rac_getObjectWithId:(NSString *)objectId;

/// Finds objects based on the constructed query.
///
/// @see -findObjectsInBackgroundWithBlock:
///
/// @return A signal that sends the NSArray of matching PFObjects.
- (RACSignal *)rac_findObjects;

/// Gets an object based on the constructed query.
///
/// @warning This mutates the PFQuery.
///
/// @see -getFirstObjectInBackgroundWithBlock:
///
/// @return A signal that sends the first matching PFObject.
- (RACSignal *)rac_getFirstObject;

/// Counts objects based on the constructed query.
///
/// @see -countObjectsInBackgroundWithBlock:
///
/// @return A signal that sends the integer count of matching PFObjects
- (RACSignal *)rac_countObjects;

@end

//
//  PFQuery+RACExtensions.h
//  Parse-RACExtensions
//
//  Created by Dave Lee on 2013-06-28.
//  Copyright (c) 2013 Dave Lee. All rights reserved.
//

#import <Parse/PFQuery.h>

@class RACSignal;

@interface PFQuery (RACExtensions)

/// Gets a PFObject with the given id.
///
/// Disposing subscription will also cancel the query.
///
/// @warning This mutates the PFQuery.
///
/// @see -getObjectInBackgroundWithId:block:
///
/// @return A signal that sends the identified PFObject.
- (RACSignal *)rac_getObjectWithId:(NSString *)objectId;

/// Finds objects based on the constructed query.
///
/// Disposing subscription will also cancel the query.
///
/// @see -findObjectsInBackgroundWithBlock:
///
/// @return A signal that sends the NSArray of matching PFObjects.
- (RACSignal *)rac_findObjects;

/// Gets an object based on the constructed query.
///
/// Disposing subscription will also cancel the query.
///
/// @warning This mutates the PFQuery.
///
/// @see -getFirstObjectInBackgroundWithBlock:
///
/// @return A signal that sends the first matching PFObject.
- (RACSignal *)rac_getFirstObject;

/// Counts objects based on the constructed query.
///
/// Disposing subscription will also cancel the query.
///
/// @see -countObjectsInBackgroundWithBlock:
///
/// @return A signal that sends the integer count of matching PFObjects
- (RACSignal *)rac_countObjects;

@end

Document PFQuery disposal side effects

Document PFQuery disposal side effects


/* StdAfx.h
 *
 * Copyright (C) 2013 Michael Imamura
 *
 * 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
 *
 * http://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.
 */

#pragma once

#ifdef _WIN32
#	define WIN32_LEAN_AND_MEAN
#	include <windows.h>
#endif

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

#include <algorithm>
#include <list>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include <utility>

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>

/* StdAfx.h
 *
 * Copyright (C) 2013 Michael Imamura
 *
 * 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
 *
 * http://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.
 */

#pragma once

#ifdef _WIN32
#	define WIN32_LEAN_AND_MEAN

	// Minimum Windows version: XP
#	define WINVER 0x0501

#	define _CRT_NONSTDC_NO_WARNINGS
#	define _CRT_SECURE_NO_DEPRECATE
#	define _SCL_SECURE_NO_DEPRECATE

#	include <windows.h>
#endif

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

#include <algorithm>
#include <list>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include <utility>

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>

Set API ver and disable CRT warnings on Win32.


#ifndef __BTC_WIF_H__
#define __BTC_WIF_H__

#include <string>
#include <vector>

namespace btc {
namespace wif {

std::string PrivateKeyToWif(const std::vector<uint8_t> &priv_key);

std::vector<uint8_t> WifToPrivateKey(const std::string &priv_key_str);

}  // namespace wif
}  // namespace btc

#endif

#ifndef __BTC_WIF_H__
#define __BTC_WIF_H__

#include <string>
#include <vector>

namespace btc {
namespace wif {

/**
 * Convert private key to string in WIF
 *
 * @param priv_key Private key data.
 *
 * @return WIF string.
 */
std::string PrivateKeyToWif(const std::vector<uint8_t> &priv_key);

/**
 * Parse WIF private key string.
 *
 * @param priv_key_str Private key string in WIF format.
 *
 * @return Private key data.
 */
std::vector<uint8_t> WifToPrivateKey(const std::string &priv_key_str);

}  // namespace wif
}  // namespace btc

#endif

Add comment for WIF functions.

Add comment for WIF functions.


#include "ethernet.h"
#include "icmpv4.h"
#include "ip.h"
#include "utils.h"

void icmpv4_incoming(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;

    //TODO: Check csum

    switch (icmp->type) {
        case ICMP_V4_ECHO:
            icmpv4_reply(skb);
            break;
        default:
            perror("ICMPv4 did not match supported types");
            return;
    }
}

void icmpv4_reply(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;
    uint16_t icmp_len = iphdr->len - (iphdr->ihl * 4);

    skb_reserve(skb, ETH_HDR_LEN + IP_HDR_LEN + icmp_len);
    skb_push(skb, icmp_len);

    icmp->type = ICMP_V4_REPLY;
    icmp->csum = 0;
    icmp->csum = checksum(icmp, icmp_len, 0);

    iphdr->daddr = iphdr->saddr;

    skb->protocol = ICMPV4;

    ip_output(NULL, skb);
}

#include "ethernet.h"
#include "icmpv4.h"
#include "ip.h"
#include "utils.h"

void icmpv4_incoming(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct icmp_v4 *icmp = (struct icmp_v4 *) iphdr->data;

    //TODO: Check csum

    switch (icmp->type) {
        case ICMP_V4_ECHO:
            icmpv4_reply(skb);
            break;
        default:
            perror("ICMPv4 did not match supported types");
            return;
    }
}

void icmpv4_reply(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct icmp_v4 *icmp;
    struct sock sk;
    uint16_t icmp_len = iphdr->len - (iphdr->ihl * 4);

    skb_reserve(skb, ETH_HDR_LEN + IP_HDR_LEN + icmp_len);
    skb_push(skb, icmp_len);

    icmp = (struct icmp_v4 *)skb->data;

    icmp->type = ICMP_V4_REPLY;
    icmp->csum = 0;
    icmp->csum = checksum(icmp, icmp_len, 0);

    skb->protocol = ICMPV4;
    sk.daddr = iphdr->saddr;

    ip_output(&sk, skb);
}

Fix ICMPv4 dest addr set

Fix ICMPv4 dest addr set


#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__

#endif

#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;

#endif

Add BSTNode & BST struct declaration

Add BSTNode & BST struct declaration


#ifndef GEOMETRY_H
#define GEOMETRY_H

#include <vector>
#include <string>
#include <memory>
#include "linalg/ray.h"
#include "linalg/transform.h"

class Geometry {
public:
	virtual bool intersect(Ray &r) = 0;
};

class Node {
	std::vector<std::shared_ptr<Node>> children;
	std::shared_ptr<Geometry> geometry;
	Transform transform;
	std::string name;

public:
	/*
	 * Create a node in the scene graph, placing some named geometry in
	 * the scene
	 */
	Node(const std::shared_ptr<Geometry> &geom, const Transform &t,
		const std::string &name);
	const std::vector<std::shared_ptr<Node>>& get_children() const;
	std::vector<std::shared_ptr<Node>>& get_children();
	const Geometry& get_geometry() const;
	const Transform& get_transform() const;
	Transform& get_transform();
};

#endif

#ifndef GEOMETRY_H
#define GEOMETRY_H

#include <vector>
#include <string>
#include <memory>
#include "linalg/ray.h"
#include "linalg/transform.h"

class Geometry {
public:
	/*
	 * Test a ray for intersection with the geometry.
	 * The ray should have been previously transformed into object space
	 */
	virtual bool intersect(Ray &r) = 0;
};

class Node {
	std::vector<std::shared_ptr<Node>> children;
	std::shared_ptr<Geometry> geometry;
	Transform transform;
	std::string name;

public:
	/*
	 * Create a node in the scene graph, placing some named geometry in
	 * the scene
	 */
	Node(const std::shared_ptr<Geometry> &geom, const Transform &t,
		const std::string &name);
	const std::vector<std::shared_ptr<Node>>& get_children() const;
	std::vector<std::shared_ptr<Node>>& get_children();
	const Geometry& get_geometry() const;
	const Transform& get_transform() const;
	Transform& get_transform();
};

#endif

Add comment on what space the incoming ray should be in


#ifndef DISTRIBUTED_H_
#define DISTRIBUTED_H_

#include <pthread.h>

#include "synch.h"

#define N_WORKERS 2

/* The Nahanni device */
#define SHM_DEV        "/dev/uio0"
/* The size of the shared memory, in bytes */
#define SHM_SIZE       (1024L * 1024L * 1024L)
/* Where we should map the memory */
#define SHM_LOC        (void *)(1024L * 1024L * 1024L * 1024L)

#define MASTER if(master_node)
#define WORKER if(!master_node)

typedef struct {
	pthread_spinlock_t lock;
	int count;
	int alldone;
	int exited;
} mr_barrier_t;

void *shm_base;

void shm_init();
void barrier_init(mr_barrier_t *bar);
void barrier(mr_barrier_t *bar);

int master_node;

#endif /* DISTRIBUTED_H_ */

#ifndef DISTRIBUTED_H_
#define DISTRIBUTED_H_

#include <pthread.h>

#include "synch.h"

/* This is a misnomer - it's actually the number of processes (master + workers) */
#define N_WORKERS 3

/* The Nahanni device */
#define SHM_DEV        "/dev/uio0"
/* The size of the shared memory, in bytes */
#define SHM_SIZE       (1024L * 1024L * 1024L)
/* Where we should map the memory */
#define SHM_LOC        (void *)(1024L * 1024L * 1024L * 1024L)

#define MASTER if(master_node)
#define WORKER if(!master_node)

typedef struct {
	pthread_spinlock_t lock;
	int count;
	int alldone;
	int exited;
} mr_barrier_t;

void *shm_base;

void shm_init();
void barrier_init(mr_barrier_t *bar);
void barrier(mr_barrier_t *bar);

int master_node;

#endif /* DISTRIBUTED_H_ */

Increase node count to 3

Increase node count to 3


// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -verify -fasm-blocks

#define M __asm int 0x2c
#define M2 int

void t1(void) { M }
void t2(void) { __asm int 0x2c }
void t3(void) { __asm M2 0x2c }
void t4(void) { __asm mov eax, fs:[0x10] }
void t5() {
  __asm {
    int 0x2c ; } asm comments are fun! }{
  }
  __asm {}
}
int t6() {
  __asm int 3 ; } comments for single-line asm
  __asm {}

  __asm int 4
  return 10;
}
void t7() {
  __asm {
    push ebx
    mov ebx, 0x07
    pop ebx
  }
}
void t8() {
  __asm nop __asm nop __asm nop
}
void t9() {
  __asm nop __asm nop ; __asm nop
}
int t_fail() { // expected-note {{to match this}}
  __asm
  __asm { // expected-error 3 {{expected}} expected-note {{to match this}}

// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks

#define M __asm int 0x2c
#define M2 int

void t1(void) { M }
void t2(void) { __asm int 0x2c }
void t3(void) { __asm M2 0x2c }
void t4(void) { __asm mov eax, fs:[0x10] }
void t5() {
  __asm {
    int 0x2c ; } asm comments are fun! }{
  }
  __asm {}
}
int t6() {
  __asm int 3 ; } comments for single-line asm
  __asm {}

  __asm int 4
  return 10;
}
void t7() {
  __asm {
    push ebx
    mov ebx, 0x07
    pop ebx
  }
}
void t8() {
  __asm nop __asm nop __asm nop
}
void t9() {
  __asm nop __asm nop ; __asm nop
}
int t_fail() { // expected-note {{to match this}}
  __asm
  __asm { // expected-error 3 {{expected}} expected-note {{to match this}}

Add a triple, per Ben's suggestion.

Add a triple, per Ben's suggestion.

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


// RUN: %clang_cc1 -fsyntax-only -verify %s
//
// This file contains typo correction tests which hit different code paths in C
// than in C++ and may exhibit different behavior as a result.

__typeof__(struct F*) var[invalid];  // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}

void PR21656() {
  float x;
  x = (float)arst;  // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
}

a = b ? : 0;  // expected-warning {{type specifier missing, defaults to 'int'}} \
              // expected-error {{use of undeclared identifier 'b'}}

struct ContainerStuct {
  enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}}
};

void func(int arg) {
  switch (arg) {
  case SOME_ENUM_:
    ; // expected-error {{use of undeclared identifier 'SOME_ENUM_'; did you mean 'SOME_ENUM'}}
  }
}

// RUN: %clang_cc1 -fsyntax-only -verify %s
//
// This file contains typo correction tests which hit different code paths in C
// than in C++ and may exhibit different behavior as a result.

__typeof__(struct F*) var[invalid];  // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}

void PR21656() {
  float x;
  x = (float)arst;  // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
}

a = b ? : 0;  // expected-warning {{type specifier missing, defaults to 'int'}} \
              // expected-error {{use of undeclared identifier 'b'}}

struct ContainerStuct {
  enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}}
};

void func(int arg) {
  switch (arg) {
  case SOME_ENUM_: // expected-error {{use of undeclared identifier 'SOME_ENUM_'; did you mean 'SOME_ENUM'}}
    ;
  }
}

Fix test from my previous commit

Fix test from my previous commit

(I should have re-run the test after running clang-format)

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


//
//  UTAPIObjCAdapter-iOS.h
//  UTAPIObjCAdapter-iOS
//
//  Created by Mark Woollard on 15/05/2016.
//  Copyright © 2016 UrbanThings. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT double UTAPIObjCAdapter_iOSVersionNumber;

//! Project version string for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT const unsigned char UTAPIObjCAdapter_iOSVersionString[];

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

//
//  UTAPIObjCAdapter-iOS.h
//  UTAPIObjCAdapter-iOS
//
//  Created by Mark Woollard on 15/05/2016.
//  Copyright © 2016 UrbanThings. All rights reserved.
//

//! Project version number for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT double UTAPIObjCAdapter_iOSVersionNumber;

//! Project version string for UTAPIObjCAdapter-iOS.
FOUNDATION_EXPORT const unsigned char UTAPIObjCAdapter_iOSVersionString[];

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

Make master header platform neutral

Make master header platform neutral


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int is_unique(char *str)
{
    int c;
    int table[128];

    for (int i = 0; i < 128; i++) {
        table[i] = 0;
    }

    for (int i = 0; i < strlen(str); i++) {
        if (str[i] != ' ') {
            c = (int) str[i];
            table[c]++;

            if (table[c] > 1) {
                return 0;
            }
        }
    }

    return 1;
}

int main(void)
{
    FILE * file;
    char file_name[128];
    char * line = NULL;
    size_t length = 0;
    ssize_t read;

    printf("Provide input file: ");

    fgets(file_name, 128, stdin);
    strtok(file_name, "\n");

    file = fopen(file_name, "r");

    if (file == NULL) {
        printf("Failed to open file at %s: ", file_name);
        exit(1);
    }

    while ((read = getline(&line, &length, file)) != -1) {
        strtok(line, "\n");
        if (is_unique(line) == 1) {
            printf("%s is unique\n", line);
        } else {
            printf("%s is not unique\n", line);
        }
    }

    free(line);
    fclose(file);
    exit(0);
}

Solve c problem to validate a string contains no repeated characters