/*-------------------------------------------------------------------------
 *
 * pqsignal.c
 *	  reliable BSD-style signal(2) routine stolen from RWW who stole it
 *	  from Stevens...
 *
 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.15 2002/06/20 20:29:54 momjian Exp $
 *
 * NOTES
 *		This shouldn't be in libpq, but the monitor and some other
 *		things need it...
 *
 *-------------------------------------------------------------------------
 */
#include <stdlib.h>
#include <signal.h>

#include "pqsignal.h"

pqsigfunc
pqsignal(int signo, pqsigfunc func)
{
#if !defined(HAVE_POSIX_SIGNALS)
	return signal(signo, func);
#else
	struct sigaction act,
				oact;

	act.sa_handler = func;
	sigemptyset(&act.sa_mask);
	act.sa_flags = 0;
	if (signo != SIGALRM)
		act.sa_flags |= SA_RESTART;
	if (sigaction(signo, &act, &oact) < 0)
		return SIG_ERR;
	return oact.sa_handler;
#endif   /* !HAVE_POSIX_SIGNALS */
}

/*-------------------------------------------------------------------------
 *
 * pqsignal.c
 *	  reliable BSD-style signal(2) routine stolen from RWW who stole it
 *	  from Stevens...
 *
 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.16 2002/11/04 14:27:21 tgl Exp $
 *
 * NOTES
 *		This shouldn't be in libpq, but the monitor and some other
 *		things need it...
 *
 *-------------------------------------------------------------------------
 */
#include "pqsignal.h"

#include <signal.h>

pqsigfunc
pqsignal(int signo, pqsigfunc func)
{
#if !defined(HAVE_POSIX_SIGNALS)
	return signal(signo, func);
#else
	struct sigaction act,
				oact;

	act.sa_handler = func;
	sigemptyset(&act.sa_mask);
	act.sa_flags = 0;
	if (signo != SIGALRM)
		act.sa_flags |= SA_RESTART;
	if (sigaction(signo, &act, &oact) < 0)
		return SIG_ERR;
	return oact.sa_handler;
#endif   /* !HAVE_POSIX_SIGNALS */
}

Fix inclusion order, per Andreas.

Fix inclusion order, per Andreas.


//
//  PHCredentials.h
//  PerchRTC
//
//  Created by Sam Symons on 2015-05-08.
//  Copyright (c) 2015 Perch Communications. All rights reserved.
//

#ifndef PerchRTC_PHCredentials_h
#define PerchRTC_PHCredentials_h

#error Please enter your XirSys credentials (http://xirsys.com/pricing/)

static NSString *kPHConnectionManagerDomain = @"";
static NSString *kPHConnectionManagerApplication = @"";
static NSString *kPHConnectionManagerXSUsername = @"";
static NSString *kPHConnectionManagerXSSecretKey = @"";

#ifdef DEBUG
static NSString *kPHConnectionManagerDefaultRoomName = @"";
#else
static NSString *kPHConnectionManagerDefaultRoomName = @"";
#endif

#endif

//
//  PHCredentials.h
//  PerchRTC
//
//  Created by Sam Symons on 2015-05-08.
//  Copyright (c) 2015 Perch Communications. All rights reserved.
//

#ifndef PerchRTC_PHCredentials_h
#define PerchRTC_PHCredentials_h

#error Please enter your XirSys credentials (http://xirsys.com/pricing/)

static NSString *kPHConnectionManagerDomain = @"";
static NSString *kPHConnectionManagerApplication = @"default";
static NSString *kPHConnectionManagerXSUsername = @"";
static NSString *kPHConnectionManagerXSSecretKey = @"";

#ifdef DEBUG
static NSString *kPHConnectionManagerDefaultRoomName = @"default";
#else
static NSString *kPHConnectionManagerDefaultRoomName = @"default";
#endif

#endif

Use the XirSys defaults for room and application.


// RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml &> %t.out
// RUN: FileCheck -check-prefix=STDERR %s < %t.out
// STDERR: fatal error: virtual filesystem overlay file '{{.*}}' not found
// RUN: FileCheck %s < %t.out
// CHECK: missing_vfs.c:[[@LINE+1]]:6: FunctionDecl=foo:[[@LINE+1]]:6
void foo(void);

// RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml > %t.stdout 2> %t.stderr
// RUN: FileCheck -check-prefix=STDERR %s < %t.stderr
// STDERR: fatal error: virtual filesystem overlay file '{{.*}}' not found
// RUN: FileCheck %s < %t.stdout
// CHECK: missing_vfs.c:[[@LINE+1]]:6: FunctionDecl=foo:[[@LINE+1]]:6
void foo(void);

Make test more robust by writing stdout/stderr to different files.

Our internal build bots were failing this test randomly as the stderr
output was emitted to the file in the middle of the stdout output
line that the test was checking.

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


#include <Python.h>
#include <sys/personality.h>

int Cget_personality(void) {
	unsigned long int persona = 0xffffffff;
	return personality(persona);
}

static PyObject* get_personality(PyObject* self) {
	return Py_BuildValue("i", Cget_personality);
}

int Cset_personality(void) {
	unsigned long int persona = READ_IMPLIES_EXEC;
	return personality(persona);
}

static PyObject* set_personality(PyObject* self) {
	return Py_BuildValue("i", Cset_personality);
}

static PyMethodDef personality_methods[] = {
	{"get_personality", (PyCFunction)get_personality, METH_NOARGS, "Returns the personality value"},
	{"set_personality", (PyCFunction)set_personality, METH_NOARGS, "Sets the personality value"},
	/*	{"version", (PyCFunction)version, METH_NOARGS, "Returns the version number"}, */
	{NULL, NULL, 0, NULL}
};

static struct PyModuleDef pypersonality = {
	PyModuleDef_HEAD_INIT,
	"personality",
	"Module to manipulate process execution domain",
	-1,
	personality_methods
};

PyMODINIT_FUNC PyInit_pypersonality(void) {
	return PyModule_Create(&pypersonality);
}

#include <Python.h>
#include <sys/personality.h>
#include <stdint.h>

int Cget_personality(void) {
	unsigned long persona = 0xffffffffUL;
	return personality(persona);
}

static PyObject* get_personality(PyObject* self) {
	return Py_BuildValue("i", Cget_personality());
}

int Cset_personality(unsigned long persona) {
	return personality(persona);
}

static PyObject* set_personality(PyObject* self, PyObject *args) {
	unsigned long persona = READ_IMPLIES_EXEC;

	//Py_Args_ParseTuple(args, "i", &persona);
	return Py_BuildValue("i", Cset_personality(persona));
}

static PyMethodDef personality_methods[] = {
	{"get_personality", (PyCFunction)get_personality, METH_NOARGS, "Returns the personality value"},
	{"set_personality", (PyCFunction)set_personality, METH_NOARGS, "Sets the personality value"},
	/*	{"version", (PyCFunction)version, METH_NOARGS, "Returns the version number"}, */
	{NULL, NULL, 0, NULL}
};

static struct PyModuleDef pypersonality = {
	PyModuleDef_HEAD_INIT,
	"personality",
	"Module to manipulate process execution domain",
	-1,
	personality_methods
};

PyMODINIT_FUNC PyInit_pypersonality(void) {
	return PyModule_Create(&pypersonality);
}

Call the c functions instead of passing a pointer


#ifndef PG_QUERY_H
#define PG_QUERY_H

typedef struct {
	char* message; // exception message
	char* filename; // source of exception (e.g. parse.l)
	int lineno; // source of exception (e.g. 104)
	int cursorpos; // char in query at which exception occurred
} PgQueryError;

typedef struct {
  char* parse_tree;
  char* stderr_buffer;
  PgQueryError* error;
} PgQueryParseResult;

typedef struct {
  char* normalized_query;
  PgQueryError* error;
} PgQueryNormalizeResult;

void pg_query_init(void);
PgQueryNormalizeResult pg_query_normalize(char* input);
PgQueryParseResult pg_query_parse(char* input);

#endif

#ifndef PG_QUERY_H
#define PG_QUERY_H

typedef struct {
	char* message; // exception message
	char* filename; // source of exception (e.g. parse.l)
	int lineno; // source of exception (e.g. 104)
	int cursorpos; // char in query at which exception occurred
} PgQueryError;

typedef struct {
  char* parse_tree;
  char* stderr_buffer;
  PgQueryError* error;
} PgQueryParseResult;

typedef struct {
  char* normalized_query;
  PgQueryError* error;
} PgQueryNormalizeResult;

#ifdef __cplusplus
extern "C" {
#endif

void pg_query_init(void);
PgQueryNormalizeResult pg_query_normalize(char* input);
PgQueryParseResult pg_query_parse(char* input);

#ifdef __cplusplus
}
#endif

#endif

Make header file compatible with C++

Make header file compatible with C++


#ifndef TEST_HELPER_C
#define TEST_HELPER_C (1)

#include "MMDB.h"

#define MMDB_DEFAULT_DATABASE "/usr/local/share/GeoIP/GeoIP2-City.mmdb"

typedef union {
    struct in_addr v4;
    struct in6_addr v6;
} in_addrX;

char *get_test_db_fname(void);
void ip_to_num(MMDB_s * mmdb, char *ipstr, in_addrX * dest_ipnum);
int dbl_cmp(double a, double b);
#endif

#ifndef TEST_HELPER_C
#define TEST_HELPER_C (1)

#include "MMDB.h"

typedef union {
    struct in_addr v4;
    struct in6_addr v6;
} in_addrX;

char *get_test_db_fname(void);
void ip_to_num(MMDB_s * mmdb, char *ipstr, in_addrX * dest_ipnum);
int dbl_cmp(double a, double b);
#endif

Remove superfluous default db definition


#ifndef CPR_TIMEOUT_H
#define CPR_TIMEOUT_H

#include <cstdint>
#include <chrono>

namespace cpr {

class Timeout {
  public:
    Timeout(const std::chrono::milliseconds& timeout) : ms(timeout) {}
    Timeout(const std::int32_t& timeout) : ms(timeout) {}

    std::chrono::milliseconds ms;
};

} // namespace cpr

#endif

#ifndef CPR_TIMEOUT_H
#define CPR_TIMEOUT_H

#include <cstdint>
#include <chrono>
#include <limits>
#include <stdexcept>

namespace cpr {

class Timeout {
  public:
    Timeout(const std::chrono::milliseconds& duration) : ms{duration} {
        if(ms.count() > std::numeric_limits<long>::max()) {
            throw std::overflow_error("cpr::Timeout: timeout value overflow.");
        }
        if(ms.count() < std::numeric_limits<long>::min()) {
            throw std::underflow_error("cpr::Timeout: timeout value underflow.");
        }
    }
    Timeout(const std::int32_t& milliseconds)
            : Timeout{std::chrono::milliseconds(milliseconds)} {}

    std::chrono::milliseconds ms;
};

} // namespace cpr

#endif

Check for under/overflow in Timeout constructor. Codestyle fixes.


/*
 *  Copyright (c) 2016, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */
#pragma once

#include <string>
#include <vector>

#include <folly/Conv.h>

namespace facebook { namespace memcache {

class McReply;
namespace cpp2 {
class McStatsReply;
}
template <class ThriftType>
class TypedThriftReply;

class StatsReply {
 public:
  template <typename V>
  void addStat(folly::StringPiece name, V value) {
    stats_.push_back(make_pair(name.str(), folly::to<std::string>(value)));
  }

  McReply getMcReply();
  TypedThriftReply<cpp2::McStatsReply> getReply();

 private:
  std::vector<std::pair<std::string, std::string>> stats_;
};

}}  // facebook::memcache

/*
 *  Copyright (c) 2016, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */
#pragma once

#include <string>
#include <vector>

#include <folly/Conv.h>

namespace facebook { namespace memcache {

class McReply;
namespace cpp2 {
class McStatsReply;
}
template <class ThriftType>
class TypedThriftReply;

class StatsReply {
 public:
  template <typename V>
  void addStat(folly::StringPiece name, V&& value) {
    stats_.emplace_back(name.str(),
                        folly::to<std::string>(std::forward<V>(value)));
  }

  McReply getMcReply();
  TypedThriftReply<cpp2::McStatsReply> getReply();

 private:
  std::vector<std::pair<std::string, std::string>> stats_;
};

}}  // facebook::memcache

Fix printf format, remove unused variables

Summary: title

Differential Revision: D3188505

fb-gh-sync-id: 7f544319c247b8607e058d2ae0c02c272e3c5fe1
fbshipit-source-id: 7f544319c247b8607e058d2ae0c02c272e3c5fe1


// RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt
#include <math.h>

float foo(float X) {
  // Check that this compiles to llvm.sqrt when errno is ignored.
  return sqrtf(X);
}

// RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt
// llvm.sqrt has undefined behavior on negative inputs, so it is
// inappropriate to translate C/C++ sqrt to this.
// XFAIL: *
#include <math.h>

float foo(float X) {
  // Check that this compiles to llvm.sqrt when errno is ignored.
  return sqrtf(X);
}

Disable test; what it's testing for is wrong.

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


#include <arv.h>
#include <arvgvinterface.h>

int
main (int argc, char **argv)
{
	ArvInterface *interface;
	ArvDevice *device;
	char buffer[1024];

	g_type_init ();

	interface = arv_gv_interface_get_instance ();

	device = arv_interface_get_first_device (interface);

	if (device != NULL) {
		arv_device_read (device, 0x00014150, 8, buffer);
		arv_device_read (device, 0x000000e8, 16, buffer);
		arv_device_read (device,
				 ARV_GVCP_GENICAM_FILENAME_ADDRESS_1,
				 ARV_GVCP_GENICAM_FILENAME_SIZE, buffer);
		arv_device_read (device,
				 ARV_GVCP_GENICAM_FILENAME_ADDRESS_2,
				 ARV_GVCP_GENICAM_FILENAME_SIZE, buffer);
		arv_device_read (device,
				 0x00100000, 0x00015904, buffer);

		g_object_unref (device);
	} else
		g_message ("No device found");

	g_object_unref (interface);

	return 0;
}

#include <arv.h>
#include <arvgvinterface.h>

int
main (int argc, char **argv)
{
	ArvInterface *interface;
	ArvDevice *device;
	char buffer[100000];

	g_type_init ();

	interface = arv_gv_interface_get_instance ();

	device = arv_interface_get_first_device (interface);

	if (device != NULL) {
		arv_device_read (device, 0x00014150, 8, buffer);
		arv_device_read (device, 0x000000e8, 16, buffer);
		arv_device_read (device,
				 ARV_GVCP_GENICAM_FILENAME_ADDRESS_1,
				 ARV_GVCP_GENICAM_FILENAME_SIZE, buffer);
		arv_device_read (device,
				 ARV_GVCP_GENICAM_FILENAME_ADDRESS_2,
				 ARV_GVCP_GENICAM_FILENAME_SIZE, buffer);
		arv_device_read (device,
				 0x00100000, 0x00015904, buffer);

		g_file_set_contents ("/tmp/genicam.xml", buffer, 0x00015904, NULL);

		g_object_unref (device);
	} else
		g_message ("No device found");

	g_object_unref (interface);

	return 0;
}

Save the genicam file in /tmp/genicam.xml


/**
 * Thanks to http://stackoverflow.com/users/68204/rberteig
 * http://stackoverflow.com/questions/807244/c-compiler-asserts-how-to-implement
 */

/** A compile time assertion check.
 *
 *  Validate at compile time that the predicate is true without
 *  generating code. This can be used at any point in a source file
 *  where typedef is legal.
 *
 *  On success, compilation proceeds normally.
 *
 *  On failure, attempts to typedef an array type of negative size. The
 *  offending line will look like
 *      typedef assertion_failed_file_h_42[-1]
 *  where file is the content of the second parameter which should
 *  typically be related in some obvious way to the containing file
 *  name, 42 is the line number in the file on which the assertion
 *  appears, and -1 is the result of a calculation based on the
 *  predicate failing.
 *
 *  \param predicate The predicate to test. It must evaluate to
 *  something that can be coerced to a normal C boolean.
 *
 *  \param file A sequence of legal identifier characters that should
 *  uniquely identify the source file in which this condition appears.
 */
#define CASSERT(predicate, file) _impl_CASSERT_LINE(predicate,__LINE__,file)

#define _impl_PASTE(a,b) a##b
#define _impl_CASSERT_LINE(predicate, line, file) \
    typedef char _impl_PASTE(assertion_failed_##file##_,line)[2*!!(predicate)-1];

Add compile time assert macro

Add compile time assert macro

Credit to Ross Berteig


/**************************************************************************************
**
** Copyright (C) 2014 Files Drag & Drop
**
** 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 FDNDAPPLICATION_H
#define FDNDAPPLICATION_H

#include <QObject>

#include "QtSingleApplication/singleapplication/qtsingleapplication.h"

/**
 * Application class that will allow to control system event
 * as the dock events on the mac
 */
class FDNDApplication : public QtSingleApplication
{
    Q_OBJECT
public:
    /// Constructor
    explicit FDNDApplication(int argc, char *argv[]);

signals:
    /**
     * Notify that the dock was clicked
     */
    void dockClicked();

public slots:
    /**
     * On mac dock clicked (use the low level objc API)
     */
    void onClickOnDock();

};

#endif // FDNDAPPLICATION_H

/**************************************************************************************
**
** Copyright (C) 2014 Files Drag & Drop
**
** 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 FDNDAPPLICATION_H
#define FDNDAPPLICATION_H

#include <QObject>

#include "qtsingleapplication/singleapplication/qtsingleapplication.h"

/**
 * Application class that will allow to control system event
 * as the dock events on the mac
 */
class FDNDApplication : public QtSingleApplication
{
    Q_OBJECT
public:
    /// Constructor
    explicit FDNDApplication(int argc, char *argv[]);

signals:
    /**
     * Notify that the dock was clicked
     */
    void dockClicked();

public slots:
    /**
     * On mac dock clicked (use the low level objc API)
     */
    void onClickOnDock();

};

#endif // FDNDAPPLICATION_H

FIX case sensitive include name (qtsingleapplication)


//***************************************************************************
// class Unique:
//	Mixin class for classes that should never be copied.
//
// Purpose:
//	This mixin disables both the copy constructor and the
//	assignment operator.  It also provides a default equality operator.
//
// History:
//     09/24/96 - vadve - Created (adapted from dHPF).
//
//***************************************************************************

#ifndef UNIQUE_H
#define UNIQUE_H

#include <assert.h>

class Unique
{
protected:
  /*ctor*/	Unique		() {}
  /*dtor*/ virtual ~Unique	() {}

public:
  virtual bool	operator==	(const Unique& u1) const;
  virtual bool	operator!=	(const Unique& u1) const;

private:
  //
  // Disable the copy constructor and the assignment operator
  // by making them both private:
  //
  /*ctor*/	Unique		(Unique&)		{ assert(0); }
  virtual Unique& operator=	(const Unique& u1)	{ assert(0);
							    return *this; }
};

// Unique object equality.
inline bool
Unique::operator==(const Unique& u2) const
{
    return (bool) (this == &u2);
}

// Unique object inequality.
inline bool
Unique::operator!=(const Unique& u2) const
{
    return (bool) !(this == &u2);
}

#endif

//************************************************************-*- C++ -*-
// class Unique:
//	Mixin class for classes that should never be copied.
//
// Purpose:
//	This mixin disables both the copy constructor and the
//	assignment operator.  It also provides a default equality operator.
//
// History:
//     09/24/96 - vadve - Created (adapted from dHPF).
//
//***************************************************************************

#ifndef UNIQUE_H
#define UNIQUE_H

#include <assert.h>

class Unique
{
protected:
  /*ctor*/	Unique		() {}
  /*dtor*/ virtual ~Unique	() {}

public:
  virtual bool	operator==	(const Unique& u1) const;
  virtual bool	operator!=	(const Unique& u1) const;

private:
  //
  // Disable the copy constructor and the assignment operator
  // by making them both private:
  //
  /*ctor*/	Unique		(Unique&)		{ assert(0); }
  virtual Unique& operator=	(const Unique& u1)	{ assert(0);
							    return *this; }
};

// Unique object equality.
inline bool
Unique::operator==(const Unique& u2) const
{
    return (bool) (this == &u2);
}

// Unique object inequality.
inline bool
Unique::operator!=(const Unique& u2) const
{
    return (bool) !(this == &u2);
}

#endif

Add flag for emacs so it realizes it's C++ code

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


/* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/

#ifndef LABELS_H
#define	LABELS_H

#define USER_CANCEL 1
#define READER_NOT_FOUND 5
#define UNKNOWN_ERROR 5
#define CERT_NOT_FOUND 2
#define INVALID_HASH 17
#define ONLY_HTTPS_ALLOWED 19

#include <map>
#include <string>
#include <vector>

class Labels {
 private:
	int selectedLanguage;
	std::map<std::string,std::string[3]> labels;
	std::map<int,std::string[3]> errors;
	std::map<std::string, int> languages;
	void init();

 public:
  Labels();
	void setLanguage(std::string language);
	std::string get(std::string labelKey);
	std::string getError(int errorCode);
};

extern Labels l10nLabels;

#endif	/* LABELS_H */

/* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/

#ifndef LABELS_H
#define	LABELS_H

#define USER_CANCEL 1
#define READER_NOT_FOUND 5
#define UNKNOWN_ERROR 5
#define CERT_NOT_FOUND 2
#define INVALID_HASH 17
#define ONLY_HTTPS_ALLOWED 19

#include <map>
#include <string>
#include <vector>

class Labels {
 private:
	int selectedLanguage;
	std::map<std::string,std::vector<std::string> > labels;
	std::map<int,std::vector<std::string> > errors;
	std::map<std::string, int> languages;
	void init();

 public:
  Labels();
	void setLanguage(std::string language);
	std::string get(std::string labelKey);
	std::string getError(int errorCode);
};

extern Labels l10nLabels;

#endif	/* LABELS_H */

Fix GCC bug based code (allows to compile with clang)


// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]}
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]}
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} | count 1
// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1
// PR 4349

union reg
{
    unsigned char b[2][2];
    unsigned short w[2];
    unsigned int d;
};
struct cpu
{
    union reg pc;
};
extern struct cpu cpu;
struct svar
{
    void *ptr;
};
struct svar svars1[] =
{
    { &((cpu.pc).w[0]) }
};
struct svar svars2[] =
{
    { &((cpu.pc).b[0][1]) }
};
struct svar svars3[] =
{
    { &((cpu.pc).w[1]) }
};
struct svar svars4[] =
{
    { &((cpu.pc).b[1][1]) }
};

Test for rev 73205 (PR 4349)

Test for rev 73205 (PR 4349)

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


#ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__

/*
 * c 2001 PPC 64 Team, IBM Corp
 *
 * This program 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.
 */

#include <linux/memblock.h>

#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>

/* Convenience macros */
#define virt_to_abs(va) __pa(va)
#define abs_to_virt(aa) __va(aa)

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_ABS_ADDR_H */

#ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__

/*
 * c 2001 PPC 64 Team, IBM Corp
 *
 * This program 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.
 */

#include <linux/memblock.h>

#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>

/* Convenience macros */
#define virt_to_abs(va) __pa(va)

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_ABS_ADDR_H */

powerpc: Remove abs_to_virt() now all users have been fixed

Signed-off-by: Michael Ellerman <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


//
// Created by bentoo on 29.11.16.
//

#ifndef GAME_ASSERT_H
#define GAME_ASSERT_H

#include <assert.h>
#include <cstdio>
#include <cstdlib>
#include <utility>

#include "DebugSourceInfo.h"

#ifdef _MSC_VER
#define YAGE_BREAK __debugbreak()
#elif __MINGW32__
#define YAGE_BREAK __builtin_trap()
#else
#include <signal.h>
#define YAGE_BREAK raise(SIGTRAP)
#endif

#ifndef NDEBUG
#define YAGE_ASSERT(predicate, message, ... ) (predicate) ? ((void)0) \
 : (Utils::Assert(DEBUG_SOURCE_INFO, message, ##__VA_ARGS__), YAGE_BREAK, ((void)0))
#else
#define YAGE_ASSERT(predicate, message, ... ) (void(0))
#endif

namespace Utils
{
	struct Assert
	{
		static char buffer[256];

		template <typename ... Args>
		Assert(Utils::DebugSourceInfo info, const char* message, Args&& ... args)
		{
			std::snprintf(buffer, sizeof(buffer), message, std::forward<Args>(args)...);
			std::fprintf(stderr, "Assert failed!\n\tfile %s, line %zu,\nreason : %s",
						 info.file, info.line, buffer);
		}
	};
}

#endif //GAME_ASSERT_H

//
// Created by bentoo on 29.11.16.
//

#ifndef GAME_ASSERT_H
#define GAME_ASSERT_H

#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <utility>

#include "DebugSourceInfo.h"

#ifdef _MSC_VER
#define YAGE_BREAK __debugbreak()
#elif __MINGW32__
#define YAGE_BREAK __builtin_trap()
#else
#include <csignal>
#define YAGE_BREAK raise(SIGTRAP)
#endif

#ifndef NDEBUG
#define YAGE_ASSERT(predicate, message, ... ) (predicate) ? ((void)0) \
 : (Utils::Assert(DEBUG_SOURCE_INFO, message, ##__VA_ARGS__), YAGE_BREAK, ((void)0))
#else
#define YAGE_ASSERT(predicate, message, ... ) (void(0))
#endif

namespace Utils
{
	struct Assert
	{
		static char buffer[256];

		template <typename ... Args>
		Assert(Utils::DebugSourceInfo info, const char* message, Args&& ... args)
		{
			std::snprintf(buffer, sizeof(buffer), message, std::forward<Args>(args)...);
			std::fprintf(stderr, "Assert failed!\n\tfile %s, line %zu,\nreason : %s",
						 info.file, info.line, buffer);
		}
	};
}

#endif //GAME_ASSERT_H

Include std headers instead of C ones

Include std headers instead of C ones


Add list of functions for SDP power supply

Signed-off-by: Jiri Pinkava <ceb72a6f0e3f077f8f7e99199f4b556b3392348f@vscht.cz>


/*
 * RELIC is an Efficient LIbrary for Cryptography
 * Copyright (C) 2007-2011 RELIC Authors
 *
 * This file is part of RELIC. RELIC is legal property of its developers,
 * whose names are not listed here. Please refer to the COPYRIGHT file
 * for contact information.
 *
 * RELIC 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.
 *
 * RELIC 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 RELIC. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @file
 *
 * Implementation of AVR-dependent routines.
 *
 * @version $Id$
 * @ingroup arch
 */

/*============================================================================*/
/* Public definitions                                                         */
/*============================================================================*/

void arch_init(void) {
}

void arch_clean(void) {
}

Add missing file for ARCH = AVR.

Add missing file for ARCH = AVR.


#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <cstdint>
#include <functional>
#include <unordered_map>

#include "pugixml.hpp"

namespace You {
namespace DataStore {

class DataStore {
public:
	/// Test classes
	friend class DataStoreAPITest;

	/// typedefs
	/// typedef for Serialized Task
	typedef std::unordered_map<std::wstring, std::wstring> STask;
	/// typedef for Task ID
	typedef int64_t TaskId;

	DataStore() = default;
	~DataStore() = default;

	/// Insert a task into the datastore
	void post(STask);

	/// Update the content of a task
	void put(TaskId, STask);

	/// Get a task
	STask get(TaskId);

	/// Delete a task
	void erase(TaskId);

	/// Commits the changes
	void commit();

	/// Roll back to the last commited changes
	void rollback();

	/// Get a list of tasks that passes the filter
	std::vector<STask> filter(const std::function<bool(STask)>&);

private:
	static const std::wstring FILE_PATH;
	pugi::xml_document document;

	/// Saves the xml object to a file
	/// Returns true if operation successful and false otherwise
	bool saveData();
	/// Loads the xml file into the xml object
	void loadData();
};

}  // namespace DataStore
}  // namespace You

#endif  // YOU_DATASTORE_DATASTORE_H_

#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <cstdint>
#include <functional>
#include <unordered_map>

#include "pugixml.hpp"

namespace You {
namespace DataStore {

class DataStore {
public:
	/// Test classes
	friend class DataStoreAPITest;

	/// typedefs
	/// typedef for Serialized Task
	typedef std::unordered_map<std::wstring, std::wstring> STask;
	/// typedef for Task ID
	typedef int64_t TaskId;

	DataStore() = default;
	~DataStore() = default;

	/// Insert a task into the datastore
	void post(STask);

	/// Update the content of a task
	void put(TaskId, STask);

	/// Get a task
	STask get(TaskId);

	/// Delete a task
	void erase(TaskId);

	/// Get a list of tasks that passes the filter
	std::vector<STask> filter(const std::function<bool(STask)>&);

private:
	static const std::wstring FILE_PATH;
	pugi::xml_document document;

	/// Saves the xml object to a file
	/// Returns true if operation successful and false otherwise
	bool saveData();
	/// Loads the xml file into the xml object
	void loadData();
};

}  // namespace DataStore
}  // namespace You

#endif  // YOU_DATASTORE_DATASTORE_H_

Remove commit and rollback method

Remove commit and rollback method

To be implemented on Transaction class


/*
 * Copyright © 2015 Canonical Limited
 *
 * 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 of the licence, 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, see <http://www.gnu.org/licenses/>.
 *
 * Author: Ryan Lortie <desrt@desrt.ca>
 */

#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif

G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)

/*
 * Copyright © 2015 Canonical Limited
 *
 * 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 of the licence, 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, see <http://www.gnu.org/licenses/>.
 *
 * Author: Ryan Lortie <desrt@desrt.ca>
 */

#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif

G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_clear)

Use g_value_clear as clear function

gvalue: Use g_value_clear as clear function

This change allow leaving a scope before g_value_init() has been
called. This would happen if you do:

  {
    g_auto(GValue) value = G_VALUE_INIT;
  }

Or have a return statement (due to failure) before the part of
your code where you set this GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=755766


// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Radu Serban
// =============================================================================
//
// Generic rack-pinion steering model.
//
// =============================================================================

#ifndef GENERIC_RACKPINION_H
#define GENERIC_RACKPINION_H

#include "subsys/steering/ChRackPinion.h"

class Generic_RackPinion : public chrono::ChRackPinion
{
public:

  Generic_RackPinion(const std::string& name) : ChRackPinion(name) {}
  ~Generic_RackPinion() {}

  virtual double GetSteeringLinkMass() const                       { return 9.0; }
  virtual const chrono::ChVector<>& GetSteeringLinkInertia() const { return chrono::ChVector<>(1, 1, 1); }
  virtual double GetSteeringLinkCOM() const                        { return 0.0; }
  virtual double GetSteeringLinkRadius() const                     { return 0.03; }
  virtual double GetSteeringLinkLength() const                     { return 0.896; }

  virtual double GetPinionRadius() const                           { return 0.1; }

  virtual double GetMaxAngle() const                               { return 0.87; }
};

#endif

Add a generic rack-pinion steering subsystem.


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

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

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

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT
  #define SK_SUPPORT_LEGACY_MATRIX_IMAGEFILTER

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

Add flag to stage api change am: f83df73740

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/skia/+/13451544

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ied4b884f3b02f3a7777a6464a996414d3cfdb3d6


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

int main(int argc, char** argv)
{
    ((void) argc);
    ((void) argv);

    for ( int i1 = 0; i1 < 10000; ++i1 )
    {
        uint8_t hex_uuid[33];
        uint8_t hex_uuid2[33];
        uint8_t uuid[16];
        uint8_t uuid2[16];

        for ( int i2 = 0; i2 < 16; ++i2 ) {
            uuid[i2] = random();
        }
        tdb_cookie_hex(uuid, hex_uuid);
        tdb_cookie_raw(hex_uuid, uuid2);
        assert(!memcmp(uuid, uuid2, 16));

        for ( int i2 = 0; i2 < 32; ++i2 ) {
            hex_uuid[i2] = random() % 16;
            hex_uuid[i2] += '0';
            if ( hex_uuid[i2] > '9' ) {
                hex_uuid[i2] -= ('9'+1);
                hex_uuid[i2] += 'a';
            }
        }
        tdb_cookie_raw(hex_uuid, uuid);
        tdb_cookie_hex(uuid, hex_uuid2);
        assert(!memcmp(hex_uuid, hex_uuid2, 32));
    }
    return 0;
}

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

int main(int argc, char** argv)
{
    ((void) argc);
    ((void) argv);

    for ( int i1 = 0; i1 < 10000; ++i1 )
    {
        uint8_t hex_uuid[33];
        uint8_t hex_uuid2[33];
        uint8_t uuid[16];
        uint8_t uuid2[16];

        for ( int i2 = 0; i2 < 16; ++i2 ) {
            uuid[i2] = rand();
        }
        tdb_cookie_hex(uuid, hex_uuid);
        tdb_cookie_raw(hex_uuid, uuid2);
        assert(!memcmp(uuid, uuid2, 16));

        for ( int i2 = 0; i2 < 32; ++i2 ) {
            hex_uuid[i2] = rand() % 16;
            hex_uuid[i2] += '0';
            if ( hex_uuid[i2] > '9' ) {
                hex_uuid[i2] -= ('9'+1);
                hex_uuid[i2] += 'a';
            }
        }
        tdb_cookie_raw(hex_uuid, uuid);
        tdb_cookie_hex(uuid, hex_uuid2);
        assert(!memcmp(hex_uuid, hex_uuid2, 32));
    }
    return 0;
}

Fix warnings in one of the tests.

Fix warnings in one of the tests.

random() is not as standard as I thought. Use rand() instead.


/** Exercise 1.17
 * Write a program to print all input lines that are longer than 80 characters.
 */
#include <stdio.h>

#define MINLINE 80

main() {
    int i, buffer_printed;
    char buffer[MINLINE + 1];
    char c;

    i = buffer_printed = 0;
    buffer[MINLINE] = '\0';

    while ((c = getchar()) != EOF) {
        if (!buffer_printed) {
            buffer[i] = c;
            ++i;
            if (i > MINLINE) {
                printf("%s", buffer);
                buffer_printed = 1;
            }
        } else {
            putchar(c);
        }

        if (c == '\n') {
            i = 0;
            buffer_printed = 0;
        }
    }

    return 0;
}

Add solution for exercise 17.

Add solution for exercise 17.


//===-- CGBuilder.h - Choose IRBuilder implementation  ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef CLANG_CODEGEN_CGBUILDER_H
#define CLANG_CODEGEN_CGBUILDER_H

#include "llvm/Support/IRBuilder.h"

namespace clang {
namespace CodeGen {

// Don't preserve names on values in an optimized build.
#ifdef NDEBUG
typedef llvm::IRBuilder<false> CGBuilderTy;
#else
typedef llvm::IRBuilder<> CGBuilderTy;
#endif

}  // end namespace CodeGen
}  // end namespace clang

#endif

//===-- CGBuilder.h - Choose IRBuilder implementation  ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef CLANG_CODEGEN_CGBUILDER_H
#define CLANG_CODEGEN_CGBUILDER_H

#include "llvm/IRBuilder.h"

namespace clang {
namespace CodeGen {

// Don't preserve names on values in an optimized build.
#ifdef NDEBUG
typedef llvm::IRBuilder<false> CGBuilderTy;
#else
typedef llvm::IRBuilder<> CGBuilderTy;
#endif

}  // end namespace CodeGen
}  // end namespace clang

#endif

Update Clang to reflect the new home of IRBuilder.h as of r159421.

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


/* File:			connection.h
 *
 * Description:		See "md.h"
 *
 * Comments:		See "notice.txt" for copyright and license information.
 *
 */

#ifndef __MD5_H__
#define __MD5_H__

#include "psqlodbc.h"

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

#ifdef	WIN32
#define	MD5_ODBC
#define	FRONTEND
#endif
#define MD5_PASSWD_LEN	35

/* From c.h */
#ifndef __BEOS__

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true	((bool) 1)
#endif

#ifndef false
#define false	((bool) 0)
#endif
#endif   /* not C++ */
#endif   /* __BEOS__ */

/* #if SIZEOF_UINT8 == 0  Can't get this from configure */
typedef unsigned char uint8;	/* == 8 bits */
typedef unsigned short uint16;	/* == 16 bits */
typedef unsigned int uint32;	/* == 32 bits */
/* #endif */

extern bool EncryptMD5(const char *passwd, const char *salt,
		   size_t salt_len, char *buf);

#endif

/* File:			connection.h
 *
 * Description:		See "md.h"
 *
 * Comments:		See "notice.txt" for copyright and license information.
 *
 */

#ifndef __MD5_H__
#define __MD5_H__

#include "psqlodbc.h"

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

#ifdef	WIN32
#define	MD5_ODBC
#define	FRONTEND
#endif
#define MD5_PASSWD_LEN	35

/* From c.h */
#ifndef __BEOS__

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true	((bool) 1)
#endif

#ifndef false
#define false	((bool) 0)
#endif
#endif   /* not C++ */
#endif   /* __BEOS__ */

/* Also defined in include/c.h */
#if SIZEOF_UINT8 == 0
typedef unsigned char uint8;	/* == 8 bits */
typedef unsigned short uint16;	/* == 16 bits */
typedef unsigned int uint32;	/* == 32 bits */
#endif   /* SIZEOF_UINT8 == 0 */

extern bool EncryptMD5(const char *passwd, const char *salt,
		   size_t salt_len, char *buf);

#endif

Add configure result checks on odbc, per Peter E.


// RUN: clang -emit-llvm < %s
void* a(unsigned x) {
return __builtin_return_address(0);
}

void* c(unsigned x) {
return __builtin_frame_address(0);
}
// RUN: clang -emit-llvm < %s
void* a(unsigned x) {
return __builtin_return_address(0);
}

void* c(unsigned x) {
return __builtin_frame_address(0);
}

// RUN: clang -emit-llvm < %s | grep "llvm.returnaddress"
// RUN: clang -emit-llvm < %s | grep "llvm.frameaddress"
void* a(unsigned x) {
return __builtin_return_address(0);
}

void* c(unsigned x) {
return __builtin_frame_address(0);
}

Fix test (it was incorrectly succeeding).

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


//******************************************************************************
//
// Copyright (c) Microsoft. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once

#include <CoreGraphics/CGColor.h>

struct __CGColorQuad {
    CGFloat r;
    CGFloat g;
    CGFloat b;
    CGFloat a;

    bool operator==(const __CGColorQuad& other) const {
        return (r == other.r) && (g == other.g) && (b == other.b) && (a == other.a);
    }

    void Clear() {
        r = g = b = a = 0.0f;
    }

    void SetColorComponents(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) {
        r = red;
        g = green;
        b = blue;
        a = alpha;
    }
};

Implement internal representation of Color. This will help represent the component values of colors with respect to their colorspace


//
//  OCTClient+Issues.h
//  OctoKit
//
//  Created by leichunfeng on 15/3/7.
//  Copyright (c) 2015年 GitHub. All rights reserved.
//

#import <OctoKit/OctoKit.h>

@interface OCTClient (Issues)

// Creates an issue.
//
// title      - The title of the issue. This must not be nil.
// body       - The contents of the issue. This can be nil.
// assignee   - Login for the user that this issue should be assigned to. NOTE:
//              Only users with push access can set the assignee for new issues.
//              The assignee is silently dropped otherwise. This can be nil.
// milestone  - Milestone to associate this issue with. NOTE: Only users with
//              push access can set the milestone for new issues. The milestone
//              is silently dropped otherwise. This can be nil.
// labels     - Labels to associate with this issue. NOTE: Only users with push
//              access can set labels for new issues. Labels are silently dropped
//              otherwise. This can be nil.
// repository - The repository in which to create the issue. This must not be nil.
//
// Returns a signal which will send the created `OCTIssue` then complete, or error.
- (RACSignal *)createIssueWithTitle:(NSString *)title body:(NSString *)body assignee:(NSString *)assignee milestone:(NSUInteger)milestone labels:(NSArray *)labels inRepository:(OCTRepository *)repository;

@end

//
//  OCTClient+Issues.h
//  OctoKit
//
//  Created by leichunfeng on 15/3/7.
//  Copyright (c) 2015年 GitHub. All rights reserved.
//

#import <OctoKit/OctoKit.h>

@interface OCTClient (Issues)

/// Creates an issue.
///
/// title      - The title of the issue. This must not be nil.
/// body       - The contents of the issue. This can be nil.
/// assignee   - Login for the user that this issue should be assigned to. NOTE:
///              Only users with push access can set the assignee for new issues.
//               The assignee is silently dropped otherwise. This can be nil.
/// milestone  - Milestone to associate this issue with. NOTE: Only users with
///              push access can set the milestone for new issues. The milestone
///              is silently dropped otherwise. This can be nil.
/// labels     - Labels to associate with this issue. NOTE: Only users with push
///              access can set labels for new issues. Labels are silently dropped
///              otherwise. This can be nil.
/// repository - The repository in which to create the issue. This must not be nil.
///
/// Returns a signal which will send the created `OCTIssue` then complete, or error.
- (RACSignal *)createIssueWithTitle:(NSString *)title body:(NSString *)body assignee:(NSString *)assignee milestone:(NSUInteger)milestone labels:(NSArray *)labels inRepository:(OCTRepository *)repository;

@end

Use triple /s replace double /s.

Use triple /s replace double /s.


#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

#include "Entity.h"

class DoorEntity :
	public Entity
{
private:
	bool m_isOpened;
	float m_minRotation;
	float m_maxRotation;
	float m_rotateTime;
	float m_rotatePerSec;

public:
	DoorEntity();
	virtual ~DoorEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float minRotation, float maxRotation, float rotateTime);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	bool SetIsOpened(bool isOpened);
	bool GetIsOpened();
};

#endif

#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

#include "Entity.h"

class DoorEntity :
	public Entity
{
private:
	bool m_isOpened;
	float m_minRotation;
	float m_maxRotation;
	float m_rotateTime;
	float m_rotatePerSec;

public:
	DoorEntity();
	virtual ~DoorEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float minRotation = 0.0f, float maxRotation = DirectX::XM_PI / 2, float rotateTime = 1.0f);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	bool SetIsOpened(bool isOpened);
	bool GetIsOpened();
};

#endif

UPDATE Door.h initialize standard values


#ifndef LIBCWAP_H
#define LIBCWAP_H

#include <stddef.h>
#include <inttypes.h>

typedef uint32_t time_t;

typedef size_t (*read_function_t)(char *, size_t);

#define CWAP_TIME_REQUEST '\t'
#define CWAP_TIME_SET 'T'
#define CWAP_SET_ALARM_TIMESTAMP 'O'

struct libcwap_functions {
    void (*time_request_function)(void);
    void (*time_set_function)(time_t);
    void (*alarm_set_timestamp)(uint8_t, time_t);
    // etc.
};

void libcwap_action(size_t (*)(char *, size_t));
void libcwap_register(struct libcwap_functions *);
#endif

#ifndef LIBCWAP_H
#define LIBCWAP_H

#include <stddef.h>
#include <inttypes.h>

typedef uint32_t time_t;

typedef size_t (*read_function_t)(char *, size_t);

#define CWAP_TIME_REQUEST '\t'
#define CWAP_TIME_SET 'T'
#define CWAP_SET_ALARM_TIMESTAMP 'O'

struct libcwap_functions {
    void (*time_request_function)(void);
    void (*time_set_function)(time_t);
    void (*alarm_set_timestamp)(uint8_t, time_t);
    // etc.
};

void libcwap_action(read_function_t);
void libcwap_register(struct libcwap_functions *);
#endif

Use the typedef read_function_t for readability


#include <stdlib.h>

#include "libcwap.h"

struct libcwap_functions * registered_functions = NULL;

void libcwap_action(size_t (*read_function)(char *, size_t)) {
    char action;
    if (!read_function(&action, 1))
        return;

    // Remember to increase the buffer if we want to receive larger packets.
    char data[4];
    switch (action) {
        case 'T':
            if (!read_function(data, 4))
                break;
            if (registered_functions->time_set_function != NULL)
                registered_functions->time_set_function(*(time_t *) data); // TODO verify these casts
            break;
        case 'O':
            if (!read_function(data, 4))
                break;
            if (registered_functions->alarm_set_timestamp != NULL)
                registered_functions->alarm_set_timestamp(*(time_t *) data);
            break;
            // etc.
        default:
            ; // Assume the data was garbage.
    }
}

void libcwap_register(struct libcwap_functions * funs) {
    registered_functions = funs;
}

#include <stdlib.h>

#include "libcwap.h"

struct libcwap_functions * registered_functions = NULL;

typedef union {
    char chars[4];
    uint32_t uinteger;
    int32_t integer;
} data32_t;

void libcwap_action(size_t (*read_function)(char *, size_t)) {
    char action;
    if (!read_function(&action, 1))
        return;

    data32_t data32;
    switch (action) {
        case 'T':
            if (!read_function(data32.chars, 4))
                break;
            if (registered_functions->time_set_function != NULL)
                registered_functions->time_set_function(data32.uinteger); // TODO verify these casts
            break;
        case 'O':
            if (!read_function(data32.chars, 4))
                break;
            if (registered_functions->alarm_set_timestamp != NULL)
                registered_functions->alarm_set_timestamp(data32.uinteger);
            break;
            // etc.
        default:
            ; // Assume the data was garbage.
    }
}

void libcwap_register(struct libcwap_functions * funs) {
    registered_functions = funs;
}

Make a 32bit union for receiving data rather than shady casting


// Check that the -fprofile-instr-generate= form works.
// RUN: %clang_cc1 -main-file-name c-generate.c %s -o - -emit-llvm -fprofile-instr-generate=c-generate-test.profraw | FileCheck %s

// CHECK: private constant [24 x i8] c"c-generate-test.profraw\00"
// CHECK: call void @__llvm_profile_set_filename_env_override(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @0, i32 0, i32 0))
// CHECK: declare void @__llvm_profile_set_filename_env_override(i8*)

int main(void) {
  return 0;
}

// Check that the -fprofile-instr-generate= form works.
// RUN: %clang_cc1 -main-file-name c-generate.c %s -o - -emit-llvm -fprofile-instr-generate=c-generate-test.profraw | FileCheck %s

// CHECK: private constant [24 x i8] c"c-generate-test.profraw\00"
// CHECK: call void @__llvm_profile_override_default_filename(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @0, i32 0, i32 0))
// CHECK: declare void @__llvm_profile_override_default_filename(i8*)

int main(void) {
  return 0;
}

InstrProf: Update name of compiler-rt routine for setting filename

Patch by Teresa Johnson.

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


#include "../common.c"
#include "m-dict.h"

static inline bool oor_equal_p(unsigned int k, unsigned char n)
{
  return k == (unsigned int)n;
}
static inline void oor_set(unsigned int *k, unsigned char n)
{
  *k = (unsigned int)n;
}

DICT_OA_DEF2(dict_oa_uint,
	     unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)),
	     unsigned int, M_DEFAULT_OPLIST)

void test_int(uint32_t n, uint32_t x0)
{
  uint32_t i, x, z = 0;
  dict_oa_uint_t h;
  dict_oa_uint_init(h);
  for (i = 0, x = x0; i < n; ++i) {
    x = hash32(x);
    unsigned int key = get_key(n, x);
    unsigned int *ptr = dict_oa_uint_get(h, key);
    if (ptr) { (*ptr)++; z+= *ptr; }
    else { dict_oa_uint_set_at(h, key, 1); z+=1; }
  }
  fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
  dict_oa_uint_clear(h);
}

#include "../common.c"
#include "m-dict.h"

static inline bool oor_equal_p(unsigned int k, unsigned char n)
{
  return k == (unsigned int)n;
}
static inline void oor_set(unsigned int *k, unsigned char n)
{
  *k = (unsigned int)n;
}

DICT_OA_DEF2(dict_oa_uint,
	     unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)),
	     unsigned int, M_DEFAULT_OPLIST)

void test_int(uint32_t n, uint32_t x0)
{
  uint32_t i, x, z = 0;
  dict_oa_uint_t h;
  dict_oa_uint_init(h);
  for (i = 0, x = x0; i < n; ++i) {
    x = hash32(x);
    unsigned int key = get_key(n, x);
    unsigned int *ptr = dict_oa_uint_get_at(h, key);
    (*ptr)++;
    z+= *ptr;
  }
  fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
  dict_oa_uint_clear(h);
}

Simplify code to use get_at method with its get & create semantic


#pragma once
class StageInformation;
class Collider;
class Bullet;
class Sling;

class ColliderManager
{
public:
	ColliderManager() {}
	~ColliderManager() {}

	void InitBullets(StageInformation* si);
	void ResetBullets();
	Bullet* GetBulletToShot(Sling* sling);
	Vector<Collider*>& GetColliders(){ return colliders; }

	bool HasBullet();
	void AddExplosion(Collider* explosion);
	void EraseCollider(Collider* collider);

private:
	Vector<Collider*> colliders;
	int curBulletIndex;
	int defaultBulletNum;
};

#pragma once
#include "Collider.h"
class StageInformation;
class Bullet;
class Sling;

class ColliderManager
{
public:
	ColliderManager() {}
	~ColliderManager() {}

	void InitBullets(StageInformation* si);
	void ResetBullets();
	Bullet* GetBulletToShot(Sling* sling);
	Vector<Collider*>& GetColliders(){ return colliders; }

	bool HasBullet();
	void AddExplosion(Collider* explosion);
	void EraseCollider(Collider* collider);

private:
	Vector<Collider*> colliders;
	int curBulletIndex;
	int defaultBulletNum;
};

Fix file include bug (cocos Vector<T>)

Fix file include bug (cocos Vector<T>)


/** @file

  Root include file for Mde Package SEC, PEIM, PEI_CORE type modules.

  This is the include file for any module of type PEIM. PEIM
  modules only use types defined via this include file and can
  be ported easily to any environment.

Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __PI_PEI_H__
#define __PI_PEI_H__

#include <Uefi/UefiBaseType.h>
#include <Pi/PiPeiCis.h>
#include <Uefi/UefiMultiPhase.h>

//
// BUGBUG: The EFI_PEI_STARTUP_DESCRIPTOR definition does not follows PI specification.
//         After enabling PI for Nt32Pkg and tools generate correct autogen for PEI_CORE,
//         the following structure should be removed at once.
//
typedef struct {
  UINTN                   BootFirmwareVolume;
  UINTN                   SizeOfCacheAsRam;
  EFI_PEI_PPI_DESCRIPTOR  *DispatchTable;
} EFI_PEI_STARTUP_DESCRIPTOR;

#endif

/** @file

  Root include file for Mde Package SEC, PEIM, PEI_CORE type modules.

  This is the include file for any module of type PEIM. PEIM
  modules only use types defined via this include file and can
  be ported easily to any environment.

Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __PI_PEI_H__
#define __PI_PEI_H__

#include <Uefi/UefiBaseType.h>
#include <Pi/PiPeiCis.h>
#include <Uefi/UefiMultiPhase.h>

#endif

Move the EFI_PEI_STARTUP_DESCRIPTOR into IntelFrameworkPkg.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@4120 6f19259b-4bc3-4df7-8a09-765794883524


Change on_key term event to on_key_press


/*
  Copyright(C) 2014 Brazil

  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 GROONGA_H
#define GROONGA_H

#include <groonga/groonga.h>
#include <groonga/ii.h>
#include <groonga/expr.h>
#include <groonga/util.h>

#endif /* GROONGA_H */

/*
  Copyright(C) 2014 Brazil

  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 GROONGA_H
#define GROONGA_H

#include "groonga/groonga.h"
#include "groonga/ii.h"
#include "groonga/expr.h"
#include "groonga/util.h"

#endif /* GROONGA_H */

Use "..." for ensure including header files in sub directory


#ifndef MEMLAYOUT_H
#define MEMLAYOUT_H

#include <stdint.h>

#define KERNEL_START ((uint32_t)&kernel_start)
#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_SIZE (KERNEL_START - KERNEL_END)

#define VIDEO_MEMORY_BEGIN 0xB8000
#define VIDEO_MEMORY_SIZE (80 * 24)

#define VIRTUAL_TO_PHYSICAL(addr) ((uint32_t)(addr) - KERNEL_START)
#define PHYSICAL_TO_VIRTUAL(addr) ((void *)(addr) + KERNEL_START)

#endif

#ifndef MEMLAYOUT_H
#define MEMLAYOUT_H

#include <stdint.h>

// These two variables are defined by the linker. They are located where you
// would expect based on the names.
extern uint32_t kernel_start;
extern uint32_t kernel_end;

#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_START ((uint32_t)&kernel_start)
#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_SIZE (KERNEL_START - KERNEL_END)

// Paging related
#define PAGE_ALIGN(x) (((uintptr_t)(x)) & ~0xfff)
#define NEXT_PAGE(x) (((uintptr_t)(x)+PAGE_SIZE) & ~0xfff)
#define PAGE_DIRECTORY NEXT_PAGE(KERNEL_END)

// Heap related
#define KHEAP_PHYS_ROOT ((void*)0x100000)
#define KHEAP_PHYS_END ((void*)NEXT_PAGE(KHEAP_PHYS_ROOT))

// Video memory related
#define VIDEO_MEMORY_BEGIN 0xB8000
#define VIDEO_MEMORY_SIZE (80 * 24)

#endif

Reorganize macros related to memory layout


#ifndef F_CPU
#define F_CPU F_OSC
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <ctype.h>
#include <math.h>
#include <stdint.h>
#include <util/delay.h>

#include "config.h"
#include "nco.h"
#include "uart.h"

static void handle_midi(void);
int main(void);

__attribute__((optimize("unroll-loops")))
static void handle_midi(void) {
    uint8_t command;
    uint8_t channel;

    do {
        command = rx();
    } while(!(command&0x80));

    channel = command & 0x0F;
    command = (command >> 4) - 8;

    uint8_t p1, p2;

    if(channel != 0) {
        return;
    }

    switch(command) {
    case 0:
        p1 = rx();
        p2 = rx();
        stop_tone(p1, p2);
        break;
    case 1:
        p1 = rx();
        p2 = rx();
        start_tone(p1, p2);
        break;
    default:
        break;
    }
}
int main(void) {
    uart_init(38400);
    nco_init();
    sei();
    uint8_t i = 0;
    while(1) {
        handle_midi();
    }

    return 0;
}

#ifndef F_CPU
#define F_CPU F_OSC
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <ctype.h>
#include <math.h>
#include <stdint.h>
#include <util/delay.h>

#include "config.h"
#include "nco.h"
#include "uart.h"

static void handle_midi(void);
int main(void);

__attribute__((optimize("unroll-loops")))
static void handle_midi(void) {
    uint8_t command;
    uint8_t channel;

    do {
        command = rx();
    } while(!(command&0x80));

    channel = command & 0x0F;
    command = (command >> 4) - 8;

    uint8_t p1, p2;

    if(channel != 0) {
        return;
    }

    switch(command) {
    case 0:
    case 1:
        p1 = rx();
        p2 = rx();
        if(p2 != 0 && command != 0) {
            start_tone(p1, p2);
        } else {
            stop_tone(p1, p2);
        }
        break;
    default:
        break;
    }
}
int main(void) {
    uart_init(38400);
    nco_init();
    sei();
    uint8_t i = 0;
    while(1) {
        handle_midi();
    }

    return 0;
}

Use stop_tone() if velocity set to 0

Use stop_tone() if velocity set to 0


/* --------------------------------------------------------------------------
 *    Name: walk.c
 * Purpose: Associative array implemented as a hash
 * ----------------------------------------------------------------------- */

#include <stdlib.h>

#include "base/memento/memento.h"

#include "base/errors.h"

#include "datastruct/hash.h"

#include "impl.h"

error hash_walk(const hash_t *h, hash_walk_callback *cb, void *cbarg)
{
  int i;

  for (i = 0; i < h->nbins; i++)
  {
    hash__node_t *n;
    hash__node_t *next;

    for (n = h->bins[i]; n != NULL; n = next)
    {
      int r;

      next = n->next;

      r = cb(&n->item, cbarg);
      if (r < 0)
        return r;
    }
  }

  return error_OK;
}

/* --------------------------------------------------------------------------
 *    Name: walk.c
 * Purpose: Associative array implemented as a hash
 * ----------------------------------------------------------------------- */

#include <stdlib.h>

#include "base/memento/memento.h"

#include "base/errors.h"

#include "datastruct/hash.h"

#include "impl.h"

error hash_walk(const hash_t *h, hash_walk_callback *cb, void *cbarg)
{
  int i;

  for (i = 0; i < h->nbins; i++)
  {
    hash__node_t *n;
    hash__node_t *next;

    for (n = h->bins[i]; n != NULL; n = next)
    {
      error r;

      next = n->next;

      r = cb(&n->item, cbarg);
      if (r < 0)
        return r;
    }
  }

  return error_OK;
}

Fix itype int -> error.

Fix itype int -> error.


#ifndef SimTK_SimTKCOMMON_ARRAY_H_
#define SimTK_SimTKCOMMON_ARRAY_H_

/* -------------------------------------------------------------------------- *
 *                      SimTK Core: SimTKcommon                               *
 * -------------------------------------------------------------------------- *
 * This is part of the SimTK Core biosimulation toolkit originating from      *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org.               *
 *                                                                            *
 * Portions copyright (c) 2010 Stanford University and the Authors.           *
 * Authors: Michael Sherman                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * Permission is hereby granted, free of charge, to any person obtaining a    *
 * copy of this software and associated documentation files (the "Software"), *
 * to deal in the Software without restriction, including without limitation  *
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
 * and/or sell copies of the Software, and to permit persons to whom the      *
 * Software is furnished to do so, subject to the following conditions:       *
 *                                                                            *
 * The above copyright notice and this permission notice shall be included in *
 * all copies or substantial portions of the Software.                        *
 *                                                                            *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
 * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
 * -------------------------------------------------------------------------- */

#include "SimTKcommon/internal/common.h"

namespace SimTK {

/**
 * Array_<T> is like std::vector<T> but better ...
 */

} // namespace SimTK

#endif // SimTK_SimTKCOMMON_ARRAY_H_

Add new header (nothing in it yet).

Add new header (nothing in it yet).


// Test case taken from sqlite3.c
#include <string.h>

typedef unsigned long u64;

# define EXP754 (((u64)0x7ff)<<52)
# define MAN754 ((((u64)1)<<52)-1)
# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)

static int sqlite3IsNaN(double x){
  int rc;   /* The value return */
  u64 y;
  memcpy(&y,&x,sizeof(y));  // Goblint used to crash here
  rc = IsNaN(y);
  return rc;
}

int foo(){
    int x = 23;
    int y;

    memcpy(&y, &x, sizeof(int));

    __goblint_check(y == 23);
    return 0;
}

int main(){
    sqlite3IsNaN(23.0);
    foo();
    return 0;
}

// Test case taken from sqlite3.c
#include <string.h>

typedef unsigned long u64;

# define EXP754 (((u64)0x7ff)<<52)
# define MAN754 ((((u64)1)<<52)-1)
# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)

static int sqlite3IsNaN(double x){
  int rc;   /* The value return */
  u64 y;
  memcpy(&y,&x,sizeof(y));  // Goblint used to crash here
  rc = IsNaN(y);
  return rc;
}

int foo(){
    int x = 23;
    int y;

    memcpy(&y, &x, sizeof(int));

    __goblint_check(y == 23);
    return 0;
}

int bar(){
    int arr[10];
    double y;

    for(int i = 0; i < 10; i++){
        arr[i] = 0;
    }
    __goblint_check(arr[0] == 0);
    __goblint_check(arr[3] == 0);

    memcpy(&arr, &y, sizeof(double));

    __goblint_check(arr[0] == 0); //UNKNOWN!
    __goblint_check(arr[3] == 0); //UNKNOWN

    return 0;
}

int main(){
    sqlite3IsNaN(23.0);
    foo();
    bar();
    return 0;
}

Add test case checking that memcpy into an array invalidates it.


/****************************************************************************
*
* Copyright (c) 2008 by Casey Duncan and contributors
* All Rights Reserved.
*
* This software is subject to the provisions of the MIT License
* A copy of the license should accompany this distribution.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
****************************************************************************/
/* Renderer shared code
 *
 * $Id$
 */

#ifndef _RENDERER_H_
#define _RENDERER_H_

typedef struct {
	PyObject_HEAD
	Py_ssize_t size;
	float *data;
} FloatArrayObject;

/* Return true if o is a bon-a-fide FloatArrayObject */
int FloatArrayObject_Check(FloatArrayObject *o);

FloatArrayObject *
FloatArray_new(Py_ssize_t size);

FloatArrayObject *
generate_default_2D_tex_coords(GroupObject *pgroup);

/* Initialize the glew OpenGL extension manager
   If glew has already been initialized, do nothing */
int
glew_initialize(void);

#endif

// Windows lacks fminf
#ifndef fminf
#define fminf(x, y) (((x) < (y)) ? (x) : (y))
#endif

Define fminf for platforms that lack it

Define fminf for platforms that lack it


#include "stdio.h"

 __attribute__((constructor)) static void PrintReference() {
  printf(" ----------------------------------------------------------------------------\n"
	 "| Welcome to ROBAST                               https://robast.github.io/  |\n"
	 "|                                                                            |\n"
	 "| Please cite the following paper when you publish your ROBAST simulation.   |\n"
	 "|                                                                            |\n"
	 "| Akira Okumura, Koji Noda, Cameron Rulten (2016)                            |\n"
	 "| \"ROBAST: Development of a ROOT-Based Ray-Tracing Library for Cosmic-Ray    |\n"
	 "| Telescopes and its Applications in the Cherenkov Telescope Array\"          |\n"
	 "| Astroparticle Physics 76 38-47                                             |\n"
	 "|                                                                            |\n"
	 "| For support & FAQ, please visit https://robast.github.io/support.html      |\n"
	 "|                                                                            |\n"
	 "|                       ROBAST is developed by Akira Okumura (oxon@mac.com)  |\n"
	 " ----------------------------------------------------------------------------\n");
}

#include "stdio.h"

 __attribute__((constructor)) static void PrintReference() {
  printf(" ----------------------------------------------------------------------------\n"
	 "| Welcome to ROBAST                               https://robast.github.io/  |\n"
	 "|                                                                            |\n"
	 "| Please cite the following paper when you publish your ROBAST simulation.   |\n"
	 "|                                                                            |\n"
	 "| Akira Okumura, Koji Noda, Cameron Rulten (2016)                            |\n"
	 "| \"ROBAST: Development of a ROOT-Based Ray-Tracing Library for Cosmic-Ray    |\n"
	 "| Telescopes and its Applications in the Cherenkov Telescope Array\"          |\n"
	 "| \e[3mAstroparticle Physics\e[0m \e[1m76\e[0m 38-47                                             |\n"
	 "|                                                                            |\n"
	 "| For support & FAQ, please visit https://robast.github.io/support.html      |\n"
	 "|                                                                            |\n"
	 "|                       ROBAST is developed by Akira Okumura (oxon@mac.com)  |\n"
	 " ----------------------------------------------------------------------------\n");
}

Add escape sequences to make characters italic or bold


/*
 * libvirt-gconfig-domain-chardev-source-private.h: libvirt domain chardev configuration
 *
 * Copyright (C) 2013 Red Hat, 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, see
 * <http://www.gnu.org/licenses/>.
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_PRIVATE_H__
#define __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_PRIVATE_H__

#include <libvirt-gconfig/libvirt-gconfig-xml-doc.h>

G_BEGIN_DECLS

GVirConfigDomainChardevSource *
gvir_config_domain_chardev_source_new_from_tree(GVirConfigXmlDoc *doc,
                                                xmlNodePtr tree);

GVirConfigDomainChardevSource *
gvir_config_domain_chardev_source_pty_new_from_tree(GVirConfigXmlDoc *doc,
                                                    xmlNodePtr tree);

G_END_DECLS

#endif /* __LIBVIRT_GCONFIG_DOMAIN_CHARDEV_SOURCE_PRIVATE_H__ */

Add missing file from previous commit

Add missing file from previous commit

The commit 35a310c62a8bf704aceb3a5b3ecce36c11525914 forgot
to add libvirt-gconfig/libvirt-gconfig-domain-chardev-source-private.h

Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>


#ifndef INICPP_DLL_H
#define INICPP_DLL_H

#ifdef INICPP_DLL
#ifdef INICPP_EXPORT
#define INICPP_API __declspec(dllexport)
#else
#define INICPP_API __declspec(dllimport)
#endif
#else
#define INICPP_API
#endif

// Disable unwanted and not necessary MSVC++ warnings
#pragma warning(disable:4800)
#pragma warning(disable:4251)

#endif // INICPP_DLL_H

#ifndef INICPP_DLL_H
#define INICPP_DLL_H

#ifdef INICPP_DLL
#ifdef INICPP_EXPORT
#define INICPP_API __declspec(dllexport)
#else
#define INICPP_API __declspec(dllimport)
#endif
#else
#define INICPP_API
#endif

// Disable unwanted and not necessary MSVC++ warnings
#ifdef _MSC_VER
#pragma warning(disable:4800)
#pragma warning(disable:4251)
#endif

#endif // INICPP_DLL_H

Enable disabling warnings using pragmas only on MSVC++


#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

struct termios orig_termios;

void disableRawMode() {
  tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enableRawMode() {
  tcgetattr(STDIN_FILENO, &orig_termios);
  atexit(disableRawMode);

  struct termios raw = orig_termios;
  raw.c_lflag &= ~(ECHO);

  tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
  enableRawMode();

  char c;
  while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q');
  return 0;
}

#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

struct termios orig_termios;

void disableRawMode() {
  tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enableRawMode() {
  tcgetattr(STDIN_FILENO, &orig_termios);
  atexit(disableRawMode);

  struct termios raw = orig_termios;
  raw.c_lflag &= ~(ECHO | ICANON);

  tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
  enableRawMode();

  char c;
  while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q');
  return 0;
}

Disable canonical mode in terminal

Disable canonical mode in terminal


#ifndef IPV4_H
#define IPV4_H
#include "syshead.h"

#include "netdev.h"

#define IPV4 0x04

#define ICMPV4 0x01

struct iphdr {
    uint8_t ihl : 4; /* TODO: Support Big Endian hosts */
    uint8_t version : 4;
    uint8_t tos;
    uint16_t len;
    uint16_t id;
    uint16_t flags : 3;
    uint16_t frag_offset : 13;
    uint8_t ttl;
    uint8_t proto;
    uint16_t csum;
    uint32_t saddr;
    uint32_t daddr;
} __attribute__((packed));

void ipv4_incoming(struct netdev *netdev, struct eth_hdr *hdr);

#endif

#ifndef IPV4_H
#define IPV4_H
#include "syshead.h"

#include "netdev.h"

#define IPV4 0x04

#define ICMPV4 0x01

struct iphdr {
    uint8_t ihl : 4; /* TODO: Support Big Endian hosts */
    uint8_t version : 4;
    uint8_t tos;
    uint16_t len;
    uint16_t id;
    uint16_t flags : 3;
    uint16_t frag_offset : 13;
    uint8_t ttl;
    uint8_t proto;
    uint16_t csum;
    uint32_t saddr;
    uint32_t daddr;
    uint8_t data[];
} __attribute__((packed));

void ipv4_incoming(struct netdev *netdev, struct eth_hdr *hdr);

#endif

Add payload field to IPv4 header

Add payload field to IPv4 header


#include "../command.h"

#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

pid_t cmd_execute(const char *path, const char *const argv[]) {
    pid_t pid = fork();
    if (pid == -1) {
        perror("fork");
        return -1;
    }
    if (pid == 0) {
        execvp(path, (char *const *)argv);
        perror("exec");
        exit(1);
    }
    return pid;
}

SDL_bool cmd_terminate(pid_t pid) {
    return kill(pid, SIGTERM) != -1;
}

SDL_bool cmd_simple_wait(pid_t pid, int *exit_code) {
    int status;
    int code;
    if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) {
        // cannot wait, or exited unexpectedly, probably by a signal
        code = -1;
    } else {
        code = WEXITSTATUS(status);
    }
    if (exit_code) {
        *exit_code = code;
    }
    return !code;
}

#include "../command.h"

#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

pid_t cmd_execute(const char *path, const char *const argv[]) {
    pid_t pid = fork();
    if (pid == -1) {
        perror("fork");
        return -1;
    }
    if (pid == 0) {
        execvp(path, (char *const *)argv);
        perror("exec");
        _exit(1);
    }
    return pid;
}

SDL_bool cmd_terminate(pid_t pid) {
    return kill(pid, SIGTERM) != -1;
}

SDL_bool cmd_simple_wait(pid_t pid, int *exit_code) {
    int status;
    int code;
    if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) {
        // cannot wait, or exited unexpectedly, probably by a signal
        code = -1;
    } else {
        code = WEXITSTATUS(status);
    }
    if (exit_code) {
        *exit_code = code;
    }
    return !code;
}

Use _exit() instead of exit() in child process

exit() should not be called from within a child process, since it would
call functions registered with atexit(), and flush stdio streams. Use
_exit() instead.


#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include "bmp.h"

#define SIGNATURE_LENGTH 2

const char usage[] = "Usage: %s <filenname>\n";

int main(int argc, char *argv[])
{
	if (argc != 2) {
		printf(usage, argv[0]);
		return 1;
	}

	int fd = open(argv[1], O_RDONLY);
	char buf[SIGNATURE_LENGTH];
	ssize_t bytes = read(fd, buf, SIGNATURE_LENGTH);
	if (bytes == -1) {
		perror("error reading file");
		return 1;
	}

	lseek(fd, 0, SEEK_SET);

	switch (buf[0] << 8 | buf[1]) {
	case BMP_SIGNATURE:
		return print_bmp(fd);
	default:
		puts("Error: unrecognized file format");
		return 1;
	}
}

#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include "bmp.h"

#define SIGNATURE_LENGTH 2

const char usage[] = "Usage: %s <filenname>\n";

int main(int argc, char *argv[])
{
	if (argc != 2) {
		printf(usage, argv[0]);
		return 1;
	}

	int fd = open(argv[1], O_RDONLY);
	if (fd == -1) {
		perror("error opening file");
		return 1;
	}

	char buf[SIGNATURE_LENGTH];
	ssize_t bytes = read(fd, buf, SIGNATURE_LENGTH);
	if (bytes == -1) {
		perror("error reading file");
		return 1;
	}

	lseek(fd, 0, SEEK_SET);

	switch (buf[0] << 8 | buf[1]) {
	case BMP_SIGNATURE:
		return print_bmp(fd);
	default:
		puts("Error: unrecognized file format");
		return 1;
	}
}

Check for error when calling open()

Check for error when calling open()


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

int main(int argc, char*argv[])
{
    int length = 8;

    for (int i = 0;i<length;i++)
    {
        for (int j = 0;j<=i;j++)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

/*Build: gcc -std=c99 -o xmas3 xmas3.c*/
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char*argv[])
{
    if (argc != 2)
    {
        printf("USAGE: %s [length]\n", argv[0]);
        exit(-1);
    }

    int length = atoi(argv[1]);

    for (int i = 0;i<length;i++)
    {
        for (int j = 0;j<=i;j++)
        {
            printf("*");
        }
        printf("\n");
    }

    return 0;
}

Add length as a parameter in command line.


#include "arch.h"
#include "cc2.h"

Node *
optm(Node *np)
{
	Node *dst;

	switch (np->op) {
	case OJMP:
	case OBRANCH:
		dst = np->u.sym->u.stmt;
		if (dst->op == OJMP)
			np->u.sym = dst->u.sym;
		break;
	}
	return np;
}

#include <stddef.h>

#include "arch.h"
#include "cc2.h"

Node *
optm(Node *np)
{
	Node *p, *dst, *next = np->next;
	Symbol *sym, *osym;

	switch (np->op) {
	case ONOP:
		if (next && next->op == ONOP) {
			sym = np->u.sym;
			osym = next->u.sym;
			osym->id = sym->id;
			osym->numid = sym->id;
			osym->u.stmt = sym->u.stmt;
			return NULL;
		}
		break;
	case OJMP:
	case OBRANCH:
		for (;;) {
			dst = np->u.sym->u.stmt;
			if (dst->op != OJMP)
				break;
			np->u.sym = dst->u.sym;
		}
		for (p = np->next; p; p = p->next) {
			if (p == dst)
				return NULL;
			if (p->op == ONOP ||
			    p->op == OBLOOP ||
			    p->op == OELOOP) {
				continue;
			}
			break;
		}
		break;
	}
	return np;
}

[cc2] Add general tree optimizations for jumps and labels

These commit adds:
	- Remove consecutive labels
	- Jump to jump
	- Jump to next instruction


//! Non overloaded function
void simplefunc();

//! Function which takes two int arguments
void f(int, int);

//! Function which takes two double arguments
void f(double, double);

namespace test {

//! Another function which takes two int arguments
void g(int, int);

//! Another function which takes two double arguments
void g(double, double);

}

class MyType {};

class MyOtherType {};

//! Another function which takes a custom type
void h(std::string, MyType);

//! Another function which takes another custom type
void h(std::string, MyOtherType);

//! Another function which takes a basic type
void h(std::string, int);

Add simple function to test domain cpp:func

Probably others in the examples but this does no harm and was useful for
testing.


#include "sys/socket.h"
#include "sys/uio.h"

#define SIZE_OF_T(TYPE)                   \
    do {                                  \
        if (0 == strcmp(type, #TYPE)) {   \
            return sizeof(TYPE);          \
        }                                 \
    } while (0)

#define SIZE_OF_S(TYPE)                   \
    do {                                  \
        if (0 == strcmp(type, #TYPE)) {   \
            return sizeof(struct TYPE);   \
        }                                 \
    } while (0)

size_t
size_of(const char* type) {
    // Builtin
    SIZE_OF_T(long);

    // sys/socket
    SIZE_OF_S(sockaddr_storage);

    // sys/uio
    SIZE_OF_S(iovec);

    return 0;
}

#include <sys/socket.h>
#include <sys/uio.h>

#include <string.h>

#define SIZE_OF_T(TYPE)                   \
    do {                                  \
        if (0 == strcmp(type, #TYPE)) {   \
            return sizeof(TYPE);          \
        }                                 \
    } while (0)

#define SIZE_OF_S(TYPE)                   \
    do {                                  \
        if (0 == strcmp(type, #TYPE)) {   \
            return sizeof(struct TYPE);   \
        }                                 \
    } while (0)

size_t
size_of(const char* type) {
    // Builtin
    SIZE_OF_T(long);

    // sys/socket
    SIZE_OF_S(sockaddr_storage);

    // sys/uio
    SIZE_OF_S(iovec);

    return 0;
}

Fix a compiler warning on FreeBSD

Fix a compiler warning on FreeBSD


#ifndef SOME_CIPHER_H
#define SOME_CIPHER_H

#include <stdint.h>

#define ROUNDS 7

extern const uint16_t RCONS[];
extern const uint16_t TE0[16], TE1[16], TE2[16], TE3[16], TE4[16];
extern const uint16_t TD0[16], TD1[16], TD2[16], TD3[16], TD4[16];
extern const uint16_t MC_INV_0[16], MC_INV_1[16], MC_INV_2[16], MC_INV_3[16];

void encrypt(const uint16_t *input, uint16_t *output, const uint16_t *key);
void decrypt(const uint16_t *input, uint16_t *output, const uint16_t *key);

#endif

#ifndef SOME_CIPHER_H
#define SOME_CIPHER_H

#include <stdint.h>

#define ROUNDS 6

extern const uint16_t RCONS[];
extern const uint16_t TE0[16], TE1[16], TE2[16], TE3[16], TE4[16];
extern const uint16_t TD0[16], TD1[16], TD2[16], TD3[16], TD4[16];
extern const uint16_t MC_INV_0[16], MC_INV_1[16], MC_INV_2[16], MC_INV_3[16];

void encrypt(const uint16_t *input, uint16_t *output, const uint16_t *key);
void decrypt(const uint16_t *input, uint16_t *output, const uint16_t *key);

#endif

Revert "extend to 7 rounds"

Revert "extend to 7 rounds"

This reverts commit 2057f426e6c2e02aa9123e63b4c00bf7c8c0f586.


#pragma once

#include <istream>
#include <memory>
#include <vector>
#include "types.h"
#include "mbc.h"

class Cartridge
{
  const static size_t max_rom_size = 0x400000; // 4 MB
  std::vector<u8> rom;
  std::vector<u8> ram;
  std::unique_ptr<MemoryBankController> mbc;

public:
  Cartridge() : rom(max_rom_size), ram(0x2000), mbc(new MBC1(rom, ram)) {}

  void load_rom(std::istream& src)
  {
    src.read(reinterpret_cast<char *>(rom.data()), max_rom_size);
  }

  u8 get8(uint address) const
  {
    return mbc->get8(address);
  }

  void set8(uint address, u8 value)
  {
    mbc->set8(address, value);
  }
};

#pragma once

#include <istream>
#include <memory>
#include <vector>
#include "types.h"
#include "mbc.h"

class Cartridge
{
  const static size_t max_rom_size = 0x400000; // 4 MB
  std::vector<u8> rom;
  std::vector<u8> ram;
  std::unique_ptr<MemoryBankController> mbc;

public:
  Cartridge() : rom(max_rom_size), ram(0x20000), mbc(new MBC1(rom, ram)) { }

  void load_rom(std::istream& src)
  {
    src.read(reinterpret_cast<char *>(rom.data()), max_rom_size);
  }

  u8 get8(uint address) const
  {
    return mbc->get8(address);
  }

  void set8(uint address, u8 value)
  {
    mbc->set8(address, value);
  }
};

Cartridge: Make RAM 128KB - big enough for any game


CHIPSET(0x0010, VIRTGL, VIRTGL)
CHIPSET(0x1050, VIRTGL, VIRTGL)

Add virtio 1.0 PCI ID to driver map

virtio_gpu: Add virtio 1.0 PCI ID to driver map

Add the virtio-gpu PCI ID for virtio 1.0 (according to the
specification, "the PCI Device ID is calculated by adding 0x1040 to the
Virtio Device ID")

Support for virtio 1.0 was added in qemu 2.4 (same time virtio-gpu
landed).

Cc: "11.1 11.2" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Marc-André Lureau <a6f2b960a4aca61381fc650a67901b2ac8e83e6d@redhat.com>
Reviewed-by: Emil Velikov <f20878473f414da183da19ee25c8722cc1d711e4@collabora.com>


//
//  TangramMap.h
//  TangramMap
//
//  Created by Matt Smollinger on 7/8/16.
//
//

#import <UIKit/UIKit.h>

/// Project version number for TangramMap.
FOUNDATION_EXPORT double TangramMapVersionNumber;

/// Project version string for TangramMap.
FOUNDATION_EXPORT const unsigned char TangramMapVersionString[];

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

#import <TangramMap/TGMapViewController.h>

//
//  TangramMap.h
//  TangramMap
//
//  Created by Matt Smollinger on 7/8/16.
//  Updated by Karim Naaji on 2/28/17.
//  Copyright (c) 2017 Mapzen. All rights reserved.
//

#import <UIKit/UIKit.h>

/// Project version number for TangramMap.
FOUNDATION_EXPORT double TangramMapVersionNumber;

/// Project version string for TangramMap.
FOUNDATION_EXPORT const unsigned char TangramMapVersionString[];

#import <TangramMap/TGMapViewController.h>
#import <TangramMap/TGMapData.h>
#import <TangramMap/TGGeoPoint.h>
#import <TangramMap/TGGeoPolygon.h>
#import <TangramMap/TGGeoPolyline.h>
#import <TangramMap/TGEaseType.h>
#import <TangramMap/TGHttpHandler.h>
#import <TangramMap/TGMarker.h>
#import <TangramMap/TGMapData.h>
#import <TangramMap/TGSceneUpdate.h>
#import <TangramMap/TGMarkerPickResult.h>
#import <TangramMap/TGLabelPickResult.h>

Update umbrella header with public interface


/* The Halfling Project - A Graphics Engine and Projects
 *
 * The Halfling Project is the legal property of Adrian Astley
 * Copyright Adrian Astley 2013
 */

#ifndef COMMON_TYPEDEFS_H
#define COMMON_TYPEDEFS_H

typedef unsigned char byte;
typedef unsigned char uint8;
typedef signed char int8;

typedef unsigned short uint16;
typedef signed short int16;

typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned int uint;

typedef __int64				int64;
typedef unsigned __int64	uint64;

#endif

/* The Halfling Project - A Graphics Engine and Projects
 *
 * The Halfling Project is the legal property of Adrian Astley
 * Copyright Adrian Astley 2013
 */

#ifndef COMMON_TYPEDEFS_H
#define COMMON_TYPEDEFS_H

typedef unsigned char byte;
typedef unsigned char uint8;
typedef signed char int8;

typedef unsigned short uint16;
typedef signed short int16;

typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned int uint;

typedef __int64				int64;
typedef unsigned __int64	uint64;

namespace DisposeAfterUse {
	enum Flag { NO, YES };
}

#endif

COMMON: Add namespace and enum for signaling auto-disposing


// project-specific definitions for otaa sensor
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
#define CFG_as923 1
#define LMIC_COUNTRY_CODE   LMIC_COUNTRY_CODE_JP
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
#define LMIC_DEBUG_LEVEL 2
#define LMIC_DEBUG_PRINTF_FN lmic_printf

// project-specific definitions for otaa sensor
//#define CFG_eu868 1
#define CFG_us915 1
//#define CFG_au921 1
//#define CFG_as923 1
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS

Set project_config back to defaults

Set project_config back to defaults


#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
#import <React/RCTConvert.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#elif __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#import "RCTEventEmitter.h"
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTUtils.h"
#endif

typedef NS_ENUM(NSInteger, OSNotificationEventTypes) {
    NotificationReceived,
    NotificationOpened,
    IdsAvailable,
    EmailSubscriptionChanged
};

#define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription"]
#define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum]

@interface RCTOneSignalEventEmitter : RCTEventEmitter <RCTBridgeModule>

+ (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body;
+ (BOOL)hasSetBridge;

@end

#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
#import <React/RCTConvert.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#elif __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#import "RCTEventEmitter.h"
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTUtils.h"
#endif

typedef NS_ENUM(NSInteger, OSNotificationEventTypes) {
    NotificationReceived,
    NotificationOpened,
    IdsAvailable,
    EmailSubscriptionChanged,
    InAppMessageClicked
};

#define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription",@"OneSignal-inAppMessageClicked"]
#define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum]

@interface RCTOneSignalEventEmitter : RCTEventEmitter <RCTBridgeModule>

+ (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body;
+ (BOOL)hasSetBridge;

@end

Add InAppMessage event to iOS

Add InAppMessage event to iOS


// Copyright 2017 Google Inc.
//
// 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 parse_taq_line_h
#define parse_taq_line_h

#include "taq.pb.h"

#include <utility>

namespace bigtable_api_samples {
// Parse a line from a TAQ file and convert it to a quote.
Quote parse_taq_line(int lineno, std::string const& line);
} // namespace bigtable_api_samples

#endif // parse_taq_line_h

// Copyright 2017 Google Inc.
//
// 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 parse_taq_line_h
#define parse_taq_line_h

#include "taq.pb.h"

#include <utility>

namespace bigtable_api_samples {
// Parse a line from a TAQ file and convert it to a quote.
//
// TAQ files are delimiter (using '|' as the delimiter) separated text
// files, using this format:
//
// timestamp|exchange|ticker|bid price|bid qty|offer price|offer qty|...
// 093000123456789|K|GOOG|800.00|100|900.00|200|...
// ...
// END|20161024|78721395|||||||||||||||||||||||||
//
// The first line is a header, it defines the fields, each line
// contains all the data for a quote, in this example we are only
// interested in the first few fields, the last line is indicated by
// the 'END' marker, it contains the date (timestamps are relative to
// midnight on this date), and the total number of lines.
Quote parse_taq_line(int lineno, std::string const& line);
} // namespace bigtable_api_samples

#endif // parse_taq_line_h

Document the format of the TAQ file.

Document the format of the TAQ file.


Add a tag (dummy) header file that will be updated whenever CINT's dictionaries need to be regenerated.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@21793 27541ba8-7e3a-0410-8455-c3a389f83636