Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Revert "Indicate the location of sqlite failures." | #ifndef _PKG_ERROR_H
#define _PKG_ERROR_H
#ifdef DEBUG
# define pkg_error_set(code, fmt, ...) \
_pkg_error_set(code, fmt " [at %s:%d]", ##__VA_ARGS__, __FILE__, __LINE__)
#else
# define pkg_error_set _pkg_error_set
#endif
#define ERROR_BAD_ARG(name) \
pkg_error_set(EPKG_FATAL, "Bad argument `%s` in %s", name, __FUNCTION__)
#define ERROR_SQLITE(db) \
pkg_error_set(EPKG_FATAL, "%s (sqlite at %s:%d)", sqlite3_errmsg(db), __FILE__, __LINE__)
pkg_error_t _pkg_error_set(pkg_error_t, const char *, ...);
#endif
| #ifndef _PKG_ERROR_H
#define _PKG_ERROR_H
#ifdef DEBUG
# define pkg_error_set(code, fmt, ...) \
_pkg_error_set(code, fmt " [at %s:%d]", ##__VA_ARGS__, __FILE__, __LINE__)
#else
# define pkg_error_set _pkg_error_set
#endif
#define ERROR_BAD_ARG(name) \
pkg_error_set(EPKG_FATAL, "Bad argument `%s` in %s", name, __FUNCTION__)
#define ERROR_SQLITE(db) \
pkg_error_set(EPKG_FATAL, "%s (sqlite)", sqlite3_errmsg(db))
pkg_error_t _pkg_error_set(pkg_error_t, const char *, ...);
#endif
|
Add a test for big-endian NEON on ARM64. | // RUN: %clang_cc1 -triple arm64-apple-darwin -target-feature +neon -fsyntax-only -ffreestanding -verify %s
#include <arm_neon.h>
// rdar://13527900
void vcopy_reject(float32x4_t vOut0, float32x4_t vAlpha, int t) {
vcopyq_laneq_f32(vOut0, 1, vAlpha, t); // expected-error {{argument to '__builtin_neon_vgetq_lane_f32' must be a constant integer}} expected-error {{initializing 'float32_t' (aka 'float') with an expression of incompatible type 'void'}}
}
// rdar://problem/15256199
float32x4_t test_vmlsq_lane(float32x4_t accum, float32x4_t lhs, float32x2_t rhs) {
return vmlsq_lane_f32(accum, lhs, rhs, 1);
}
| // RUN: %clang_cc1 -triple arm64-apple-darwin -target-feature +neon -fsyntax-only -ffreestanding -verify %s
// RUN: %clang_cc1 -triple arm64_be-none-linux-gnu -target-feature +neon -fsyntax-only -ffreestanding -verify %s
#include <arm_neon.h>
// rdar://13527900
void vcopy_reject(float32x4_t vOut0, float32x4_t vAlpha, int t) {
vcopyq_laneq_f32(vOut0, 1, vAlpha, t); // expected-error {{argument to '__builtin_neon_vgetq_lane_f32' must be a constant integer}} expected-error {{initializing 'float32_t' (aka 'float') with an expression of incompatible type 'void'}}
}
// rdar://problem/15256199
float32x4_t test_vmlsq_lane(float32x4_t accum, float32x4_t lhs, float32x2_t rhs) {
return vmlsq_lane_f32(accum, lhs, rhs, 1);
}
|
Document the usb protocol (ish) | #ifndef USB_COMMANDS_H
#define USB_COMMANDS_H
#define CMD_ACK 0xAF
#define CMD_RESP 0xBF
#define CMD_BL_ON 0x10
#define CMD_BL_OFF 0x11
#define CMD_BL_LEVEL 0x12
#define CMD_BL_UP 0x13
#define CMD_BL_DOWN 0x14
#define CMD_BL_GET_STATE 0x1F
#define CMD_RGB_SET 0x20
#define CMD_RGB_GET 0x2F
#endif
| /* USB commands use the first byte as the 'type' variable.
* Subsequent bytes are generally the 'arguments'.
* So host->device usb packets usually look like:
* [command, arg1, arg2, 0, 0, ... , 0, 0]
* to which the device will respond with
* [CMD_ACK, command, 0, 0, 0 ..., 0, 0]
*
* The exception to this, are the commands which 'GET'
* For them host->device generally looks like:
* [command, 0, ..., 0, 0]
* to which the device responds
* [CMD_RESP, command, arg1, arg2, 0, ..., 0, 0]
* */
#ifndef USB_COMMANDS_H
#define USB_COMMANDS_H
#define CMD_ACK 0xAF
#define CMD_RESP 0xBF
#define CMD_BL_ON 0x10
#define CMD_BL_OFF 0x11
#define CMD_BL_LEVEL 0x12
#define CMD_BL_UP 0x13
#define CMD_BL_DOWN 0x14
#define CMD_BL_GET_STATE 0x1F
#define CMD_RGB_SET 0x20
#define CMD_RGB_GET 0x2F
#endif
|
Test class to check for ambiguities in the dictionary source code in case of non virtual diamonds | #ifndef DICT2_CLASSN_H
#define DICT2_CLASSN_H
#include "ClassI.h"
#include "ClassL.h"
class ClassN: /* public ClassI, */ public ClassL {
public:
ClassN() : fN('n') {}
virtual ~ClassN() {}
int n() { return fN; }
void setN(int v) { fN = v; }
private:
int fN;
};
#endif // DICT2_CLASSN_H
| |
Use Intel byte order for floating point | #define CODE_EXPANDER
#include <system.h>
#include "back.h"
#include "mach.h"
#ifdef DEBUG
arg_error( s, arg)
char *s;
int arg;
{
fprint( STDERR, "arg_error %s %d\n", s, arg);
}
#endif
int push_waiting = FALSE;
int fit_byte( val)
int val;
{
return( val >= -128 && val <= 127);
}
#include <con_float>
| #define CODE_EXPANDER
#include <system.h>
#include "back.h"
#include "mach.h"
#ifdef DEBUG
arg_error( s, arg)
char *s;
int arg;
{
fprint( STDERR, "arg_error %s %d\n", s, arg);
}
#endif
int push_waiting = FALSE;
int fit_byte( val)
int val;
{
return( val >= -128 && val <= 127);
}
#define IEEEFLOAT
#define FL_MSL_AT_LOW_ADDRESS 0
#define FL_MSW_AT_LOW_ADDRESS 0
#define FL_MSB_AT_LOW_ADDRESS 0
#include <con_float>
|
Fix windows build issue for node v0.12 | #ifndef SECURITY_BUFFER_DESCRIPTOR_H
#define SECURITY_BUFFER_DESCRIPTOR_H
#include <node.h>
#include <node_object_wrap.h>
#include <v8.h>
#include <windows.h>
#include <sspi.h>
#include "nan.h"
using namespace v8;
using namespace node;
class SecurityBufferDescriptor : public ObjectWrap {
public:
Local<Array> arrayObject;
SecBufferDesc secBufferDesc;
SecurityBufferDescriptor();
SecurityBufferDescriptor(const Persistent<Array>& arrayObjectPersistent);
~SecurityBufferDescriptor();
// Has instance check
static inline bool HasInstance(Handle<Value> val) {
if (!val->IsObject()) return false;
Local<Object> obj = val->ToObject();
return NanNew(constructor_template)->HasInstance(obj);
};
char *toBuffer();
size_t bufferSize();
// Functions available from V8
static void Initialize(Handle<Object> target);
static NAN_METHOD(ToBuffer);
// Constructor used for creating new Long objects from C++
static Persistent<FunctionTemplate> constructor_template;
private:
static NAN_METHOD(New);
};
#endif | #ifndef SECURITY_BUFFER_DESCRIPTOR_H
#define SECURITY_BUFFER_DESCRIPTOR_H
#include <node.h>
#include <node_object_wrap.h>
#include <v8.h>
#include <WinSock2.h>
#include <windows.h>
#include <sspi.h>
#include "nan.h"
using namespace v8;
using namespace node;
class SecurityBufferDescriptor : public ObjectWrap {
public:
Local<Array> arrayObject;
SecBufferDesc secBufferDesc;
SecurityBufferDescriptor();
SecurityBufferDescriptor(const Persistent<Array>& arrayObjectPersistent);
~SecurityBufferDescriptor();
// Has instance check
static inline bool HasInstance(Handle<Value> val) {
if (!val->IsObject()) return false;
Local<Object> obj = val->ToObject();
return NanNew(constructor_template)->HasInstance(obj);
};
char *toBuffer();
size_t bufferSize();
// Functions available from V8
static void Initialize(Handle<Object> target);
static NAN_METHOD(ToBuffer);
// Constructor used for creating new Long objects from C++
static Persistent<FunctionTemplate> constructor_template;
private:
static NAN_METHOD(New);
};
#endif |
Support access to individual Hurd consoles. (st) | /*
* BRLTTY - A background process providing access to the console screen (when in
* text mode) for a blind person using a refreshable braille display.
*
* Copyright (C) 1995-2005 by The BRLTTY Team. All rights reserved.
*
* BRLTTY comes with ABSOLUTELY NO WARRANTY.
*
* This is free software, placed under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation. Please see the file COPYING for details.
*
* Web Page: http://mielke.cc/brltty/
*
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
#ifndef BRLTTY_INCLUDED_SCR_HURD
#define BRLTTY_INCLUDED_SCR_HURD
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define HURD_CONSDIR "/dev/cons"
#define HURD_VCSDIR "/dev/vcs"
#define HURD_INPUTPATH HURD_VCSDIR "/input"
#define HURD_DISPLAYPATH HURD_VCSDIR "/display"
#define HURD_CURVCSPATH HURD_CONSDIR "/vcs"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BRLTTY_INCLUDED_SCR_HURD */
| /*
* BRLTTY - A background process providing access to the console screen (when in
* text mode) for a blind person using a refreshable braille display.
*
* Copyright (C) 1995-2005 by The BRLTTY Team. All rights reserved.
*
* BRLTTY comes with ABSOLUTELY NO WARRANTY.
*
* This is free software, placed under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation. Please see the file COPYING for details.
*
* Web Page: http://mielke.cc/brltty/
*
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
#ifndef BRLTTY_INCLUDED_SCR_HURD
#define BRLTTY_INCLUDED_SCR_HURD
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define HURD_CONSDIR "/dev/cons"
#define HURD_VCSDIR "/dev/vcs"
#define HURD_INPUTPATH HURD_VCSDIR "/%u/input"
#define HURD_DISPLAYPATH HURD_VCSDIR "/%u/display"
#define HURD_CURVCSPATH HURD_CONSDIR "/vcs"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BRLTTY_INCLUDED_SCR_HURD */
|
Initialize some vars so we don't register for a timer when there's not a call oustanding | #ifndef __MORDOR_TIMEOUT_STREAM__
#define __MORDOR_TIMEOUT_STREAM__
// Copyright (c) 2010 - Mozy, Inc.
#include "filter.h"
#include "scheduler.h"
namespace Mordor {
class TimerManager;
class Timer;
class TimeoutStream : public FilterStream
{
public:
typedef boost::shared_ptr<TimeoutStream> ptr;
public:
TimeoutStream(Stream::ptr parent, TimerManager &timerManager, bool own = true)
: FilterStream(parent),
m_timerManager(timerManager),
m_readTimeout(~0ull),
m_writeTimeout(~0ull)
{}
unsigned long long readTimeout() const { return m_readTimeout; }
void readTimeout(unsigned long long readTimeout);
unsigned long long writeTimeout() const { return m_writeTimeout; }
void writeTimeout(unsigned long long writeTimeout);
size_t read(Buffer &buffer, size_t length);
size_t write(const Buffer &buffer, size_t length);
private:
TimerManager &m_timerManager;
unsigned long long m_readTimeout, m_writeTimeout;
bool m_readTimedOut, m_writeTimedOut;
boost::shared_ptr<Timer> m_readTimer, m_writeTimer;
FiberMutex m_mutex;
};
}
#endif
| #ifndef __MORDOR_TIMEOUT_STREAM__
#define __MORDOR_TIMEOUT_STREAM__
// Copyright (c) 2010 - Mozy, Inc.
#include "filter.h"
#include "scheduler.h"
namespace Mordor {
class TimerManager;
class Timer;
class TimeoutStream : public FilterStream
{
public:
typedef boost::shared_ptr<TimeoutStream> ptr;
public:
TimeoutStream(Stream::ptr parent, TimerManager &timerManager, bool own = true)
: FilterStream(parent),
m_timerManager(timerManager),
m_readTimeout(~0ull),
m_writeTimeout(~0ull),
m_readTimedOut(true),
m_writeTimedOut(true)
{}
unsigned long long readTimeout() const { return m_readTimeout; }
void readTimeout(unsigned long long readTimeout);
unsigned long long writeTimeout() const { return m_writeTimeout; }
void writeTimeout(unsigned long long writeTimeout);
size_t read(Buffer &buffer, size_t length);
size_t write(const Buffer &buffer, size_t length);
private:
TimerManager &m_timerManager;
unsigned long long m_readTimeout, m_writeTimeout;
bool m_readTimedOut, m_writeTimedOut;
boost::shared_ptr<Timer> m_readTimer, m_writeTimer;
FiberMutex m_mutex;
};
}
#endif
|
Make sure that we allocate something at our pointer and assign our init’d pool to the pointers value. | #include <connection_pool.h>
static void deallocate(ConnectionPool_T *pool)
{
ConnectionPool_stop(*pool);
ConnectionPool_free(pool);
}
/*
* Wrap libzdb's connection pool in a ruby object
*/
static VALUE allocate(VALUE klass)
{
ConnectionPool_T *pool;
return Data_Wrap_Struct(klass, NULL, deallocate, pool);
}
static VALUE initialize(VALUE self, VALUE rb_string)
{
Check_Type(rb_string, T_STRING);
ConnectionPool_T *poolPtr;
ConnectionPool_T pool;
URL_T url;
char *url_string;
Data_Get_Struct(self, ConnectionPool_T, poolPtr);
url_string = StringValueCStr(rb_string);
url = URL_new(url_string);
pool = ConnectionPool_new(url);
ConnectionPool_start(pool);
poolPtr = &pool;
URL_free(&url);
return self;
}
VALUE cLibzdbConnectionPool;
void init_connection_pool()
{
VALUE libzdb = rb_define_module("Libzdb");
VALUE klass = rb_define_class_under(libzdb, "ConnectionPool", rb_cObject);
cLibzdbConnectionPool = klass;
rb_define_alloc_func(cLibzdbConnectionPool, allocate);
rb_define_method(cLibzdbConnectionPool, "initialize", initialize, 1);
}
| #include <connection_pool.h>
static void deallocate(ConnectionPool_T *pool)
{
ConnectionPool_stop(*pool);
ConnectionPool_free(pool);
}
static VALUE allocate(VALUE klass)
{
ConnectionPool_T *pool = malloc(sizeof(ConnectionPool_T));
return Data_Wrap_Struct(klass, NULL, deallocate, pool);
}
static VALUE initialize(VALUE self, VALUE rb_string)
{
Check_Type(rb_string, T_STRING);
ConnectionPool_T *pool;
char *url_string = StringValueCStr(rb_string);
URL_T url = URL_new(url_string);
Data_Get_Struct(self, ConnectionPool_T, pool);
*pool = ConnectionPool_new(url);
ConnectionPool_start(*pool);
URL_free(&url);
return self;
}
VALUE cLibzdbConnectionPool;
void init_connection_pool()
{
VALUE libzdb = rb_define_module("Libzdb");
VALUE klass = rb_define_class_under(libzdb, "ConnectionPool", rb_cObject);
cLibzdbConnectionPool = klass;
rb_define_alloc_func(cLibzdbConnectionPool, allocate);
rb_define_method(cLibzdbConnectionPool, "initialize", initialize, 1);
}
|
Add method to get const article collection in walker | //! \file Walker.h
#ifndef _WALKER_H
#define _WALKER_H
#include "ArticleCollection.h"
//! Base class for article analyzers
class Walker
{
protected:
//! article collection, used as cache, for walked articles
ArticleCollection articleSet;
};
#endif // _WALKER_H
| //! \file Walker.h
#ifndef _WALKER_H
#define _WALKER_H
#include "ArticleCollection.h"
//! Base class for article analyzers
class Walker
{
public:
const ArticleCollection& getCollection() const
{
return articleSet;
}
protected:
//! article collection, used as cache, for walked articles
ArticleCollection articleSet;
};
#endif // _WALKER_H
|
Work around ppc64 compiler bug | /* Never include this file directly. Include <linux/compiler.h> instead. */
/*
* Common definitions for all gcc versions go here.
*/
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
#define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__asm__ ("" : "=g"(__ptr) : "0"(ptr)); \
(typeof(ptr)) (__ptr + (off)); })
#define inline inline __attribute__((always_inline))
#define __inline__ __inline__ __attribute__((always_inline))
#define __inline __inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
#define noinline __attribute__((noinline))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
| /* Never include this file directly. Include <linux/compiler.h> instead. */
/*
* Common definitions for all gcc versions go here.
*/
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
/*
* Versions of the ppc64 compiler before 4.1 had a bug where use of
* RELOC_HIDE could trash r30. The bug can be worked around by changing
* the inline assembly constraint from =g to =r, in this particular
* case either is valid.
*/
#define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
(typeof(ptr)) (__ptr + (off)); })
#define inline inline __attribute__((always_inline))
#define __inline__ __inline__ __attribute__((always_inline))
#define __inline __inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
#define noinline __attribute__((noinline))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
|
Add (deactivated) refinement test for interval/congruence domain | // PARAM: --disable ana.int.def_exc --enable ana.int.interval --enable ana.int.congruence
#include <assert.h>
int main(){
int r = -103;
for (int i = 0; i < 40; i++) {
r = r + 5;
}
// At this point r in the congr. dom should be 2 + 5Z
int k = r;
if (k >= 3) {
// After refinement with congruences, the lower bound should be 7 as the numbers 3 - 6 are not in the congr. class
assert (k < 7); // FAIL
}
if (r >= -11 && r <= -4) {
assert (r == -8);
}
return 0;
}
| |
Add connection and response to cursors. | /**
* @author Adam Grandquist
*/
#include "ReQL-ast.h"
#ifndef _REQL_H
#define _REQL_H
struct _ReQL_Conn_s {
int socket;
int error;
char *buf;
unsigned int max_token;
struct _ReQL_Cur_s **cursor;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;
struct _ReQL_Cur_s {
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;
int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port);
int _reql_close_conn(_ReQL_Conn_t *conn);
_ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs);
void _reql_next(_ReQL_Cur_t *cur);
void _reql_close_cur(_ReQL_Cur_t *cur);
#endif
| /**
* @author Adam Grandquist
*/
#include "ReQL-ast.h"
#ifndef _REQL_H
#define _REQL_H
struct _ReQL_Conn_s {
int socket;
int error;
char *buf;
unsigned int max_token;
struct _ReQL_Cur_s **cursor;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;
struct _ReQL_Cur_s {
_ReQL_Conn_t *conn;
unsigned int idx;
_ReQL_Op_t *response;
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;
int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port);
int _reql_close_conn(_ReQL_Conn_t *conn);
_ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs);
void _reql_next(_ReQL_Cur_t *cur);
void _reql_close_cur(_ReQL_Cur_t *cur);
#endif
|
Fix compilation fo the test runner on Windows | #include <string>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/fcntl.h>
using namespace std;
inline string copyFile(const string &filename, const string &ext)
{
string newname = string(tempnam(NULL, NULL)) + ext;
string oldname = string("data/") + filename + ext;
char buffer[4096];
int bytes;
int inf = open(oldname.c_str(), O_RDONLY);
int outf = open(newname.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
while((bytes = read(inf, buffer, sizeof(buffer))) > 0)
write(outf, buffer, bytes);
close(outf);
close(inf);
return newname;
}
inline void deleteFile(const string &filename)
{
remove(filename.c_str());
}
class ScopedFileCopy
{
public:
ScopedFileCopy(const string &filename, const string &ext)
{
m_filename = copyFile(filename, ext);
}
~ScopedFileCopy()
{
deleteFile(m_filename);
}
string fileName()
{
return m_filename;
}
private:
string m_filename;
};
| #ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#include <fcntl.h>
#include <sys/fcntl.h>
#endif
#include <stdio.h>
#include <string>
using namespace std;
inline string copyFile(const string &filename, const string &ext)
{
string newname = string(tempnam(NULL, NULL)) + ext;
string oldname = string("data/") + filename + ext;
#ifdef _WIN32
CopyFile(oldname.c_str(), newname.c_str(), FALSE);
SetFileAttributes(newname.c_str(), GetFileAttributes(newname.c_str()) & ~FILE_ATTRIBUTE_READONLY);
#else
char buffer[4096];
int bytes;
int inf = open(oldname.c_str(), O_RDONLY);
int outf = open(newname.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
while((bytes = read(inf, buffer, sizeof(buffer))) > 0)
write(outf, buffer, bytes);
close(outf);
close(inf);
#endif
return newname;
}
inline void deleteFile(const string &filename)
{
remove(filename.c_str());
}
class ScopedFileCopy
{
public:
ScopedFileCopy(const string &filename, const string &ext)
{
m_filename = copyFile(filename, ext);
}
~ScopedFileCopy()
{
deleteFile(m_filename);
}
string fileName()
{
return m_filename;
}
private:
string m_filename;
};
|
Update GPUImageFillModeType enum to use NS_ENUM | #import <UIKit/UIKit.h>
#import "GPUImageContext.h"
typedef enum {
kGPUImageFillModeStretch, // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
kGPUImageFillModePreserveAspectRatio, // Maintains the aspect ratio of the source image, adding bars of the specified background color
kGPUImageFillModePreserveAspectRatioAndFill // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
} GPUImageFillModeType;
/**
UIView subclass to use as an endpoint for displaying GPUImage outputs
*/
@interface GPUImageView : UIView <GPUImageInput>
{
GPUImageRotationMode inputRotation;
}
/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
*/
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;
/** This calculates the current display size, in pixels, taking into account Retina scaling factors
*/
@property(readonly, nonatomic) CGSize sizeInPixels;
@property(nonatomic) BOOL enabled;
/** Handling fill mode
@param redComponent Red component for background color
@param greenComponent Green component for background color
@param blueComponent Blue component for background color
@param alphaComponent Alpha component for background color
*/
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;
- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;
@end
| #import <UIKit/UIKit.h>
#import "GPUImageContext.h"
typedef NS_ENUM(NSUInteger, GPUImageFillModeType) {
kGPUImageFillModeStretch, // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
kGPUImageFillModePreserveAspectRatio, // Maintains the aspect ratio of the source image, adding bars of the specified background color
kGPUImageFillModePreserveAspectRatioAndFill // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
};
/**
UIView subclass to use as an endpoint for displaying GPUImage outputs
*/
@interface GPUImageView : UIView <GPUImageInput>
{
GPUImageRotationMode inputRotation;
}
/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
*/
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;
/** This calculates the current display size, in pixels, taking into account Retina scaling factors
*/
@property(readonly, nonatomic) CGSize sizeInPixels;
@property(nonatomic) BOOL enabled;
/** Handling fill mode
@param redComponent Red component for background color
@param greenComponent Green component for background color
@param blueComponent Blue component for background color
@param alphaComponent Alpha component for background color
*/
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;
- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;
@end
|
Add some hashing utility functions | #ifndef HASH_H
#define HASH_H
#include <unordered_map>
#include <unordered_set>
template <typename K, typename V>
using HashMap = std::unordered_map<K, V>;
template <typename T>
using HashSet = std::unordered_set<T>;
#endif // HASH_H
| #ifndef HASH_H
#define HASH_H
#include <cstdint>
#include <unordered_map>
#include <unordered_set>
template <typename K, typename V>
using HashMap = std::unordered_map<K, V>;
template <typename T>
using HashSet = std::unordered_set<T>;
// These come from boost
// Copyright 2005-2014 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
static inline uint32_t combineHashes(uint32_t seed, uint32_t value) {
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
return seed;
}
static inline uint64_t combineHashes(uint64_t h, uint64_t k) {
const uint64_t m = 0xc6a4a7935bd1e995UL;
const int r = 47;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
// Completely arbitrary number, to prevent 0's
// from hashing to 0.
h += 0xe6546b64;
return h;
}
template <typename It>
size_t hashRange(It b, It e) {
size_t h = 0;
for (It it = b; it != e; it++) {
h = combineHashes(h, std::hash<typename It::value_type>()(*it));
}
return h;
}
#endif // HASH_H
|
Add `heap_len` and `heap_cap` to example | // cc heap_example.c heap.c
#include <assert.h>
#include <stdio.h>
#include "bool.h"
#include "heap.h"
/* heap data comparator: return true if a < b */
bool
cmp(void *a, void *b)
{
return *(int *)a < *(int *)b;
}
int main(int argc, const char *argv[])
{
/* allocate empty heap with comparator */
struct heap *heap = heap(cmp);
/* push data into heap */
int a = 4, b = 1, c = 3, d = 2;
assert(heap_push(heap, &a) == HEAP_OK);
assert(heap_push(heap, &b) == HEAP_OK);
assert(heap_push(heap, &c) == HEAP_OK);
assert(heap_push(heap, &d) == HEAP_OK);
/* get current smallest data */
printf("smallest: %d\n", *(int *)heap_top(heap));
/* pop and print all data (should be in order) */
while (heap_len(heap) != 0)
printf("%d\n", *(int *)heap_pop(heap));
/* free heap */
heap_free(heap);
return 0;
}
| // cc heap_example.c heap.c
#include <assert.h>
#include <stdio.h>
#include "bool.h"
#include "heap.h"
/* heap data comparator: return true if a < b */
bool
cmp(void *a, void *b)
{
return *(int *)a < *(int *)b;
}
int main(int argc, const char *argv[])
{
/* allocate empty heap with comparator */
struct heap *heap = heap(cmp);
/* push data into heap */
int a = 4, b = 1, c = 3, d = 2, e = 5;
assert(heap_push(heap, &a) == HEAP_OK);
assert(heap_push(heap, &b) == HEAP_OK);
assert(heap_push(heap, &c) == HEAP_OK);
assert(heap_push(heap, &d) == HEAP_OK);
assert(heap_push(heap, &e) == HEAP_OK);
/* get current heap memory capacity (or memory allocated) */
printf("current heap allocated memory: %zu\n", heap_cap(heap));
printf("current heap length: %zu\n", heap_len(heap));
/* get current smallest data */
printf("smallest: %d\n", *(int *)heap_top(heap));
/* pop and print all data (should be in order) */
while (heap_len(heap) != 0)
printf("%d\n", *(int *)heap_pop(heap));
/* free heap */
heap_free(heap);
return 0;
}
|
Fix license in comment header. | /**
* config.h - Convenience header file for all mlt++ objects
* Copyright (C) 2004-2005 Charles Yates
* Author: Charles Yates <charles.yates@pandora.be>
*
* This program 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 License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef MLTPP_CONFIG_H_
#define MLTPP_CONFIG_H_
#ifdef WIN32
#ifdef MLTPP_EXPORTS
#define MLTPP_DECLSPEC __declspec( dllexport )
#else
#define MLTPP_DECLSPEC __declspec( dllimport )
#endif
#else
#define MLTPP_DECLSPEC
#endif
#endif
| /**
* config.h - Convenience header file for all mlt++ objects
* Copyright (C) 2004-2005 Charles Yates
* Author: Charles Yates <charles.yates@pandora.be>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MLTPP_CONFIG_H_
#define MLTPP_CONFIG_H_
#ifdef WIN32
#ifdef MLTPP_EXPORTS
#define MLTPP_DECLSPEC __declspec( dllexport )
#else
#define MLTPP_DECLSPEC __declspec( dllimport )
#endif
#else
#define MLTPP_DECLSPEC
#endif
#endif
|
Fix potential data corruption bug |
#include <stdlib.h>
#include "logging.h"
char out[512];
debug_mask_t debug_mask = 0;
static int debug_init = 0;
char *print_hex(uint8_t *buf, int count)
{
memset(out, 0, count);
int zz;
for(zz = 0; zz < count; zz++) {
sprintf(out + (zz * 2), "%02X", buf[zz]);
}
return out;
}
void debug(char *file, int line, uint32_t mask, const char *format, ...)
{
char *env;
// Only call getenv() once.
if (!debug_init) {
debug_init = 1;
if ((env = getenv("BD_DEBUG_MASK"))) {
debug_mask = atoi(env);
} else {
debug_mask = 0xffff;
}
}
if (mask & debug_mask) {
char buffer[512];
va_list args;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
fprintf(stderr, "%s:%d: %s", file, line, buffer);
}
}
|
#include <stdlib.h>
#include "logging.h"
char out[512];
debug_mask_t debug_mask = 0;
static int debug_init = 0;
char *print_hex(uint8_t *buf, int count)
{
memset(out, 0, sizeof(out));
int zz;
for(zz = 0; zz < count; zz++) {
sprintf(out + (zz * 2), "%02X", buf[zz]);
}
return out;
}
void debug(char *file, int line, uint32_t mask, const char *format, ...)
{
char *env;
// Only call getenv() once.
if (!debug_init) {
debug_init = 1;
if ((env = getenv("BD_DEBUG_MASK"))) {
debug_mask = atoi(env);
} else {
debug_mask = 0xffff;
}
}
if (mask & debug_mask) {
char buffer[512];
va_list args;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
fprintf(stderr, "%s:%d: %s", file, line, buffer);
}
}
|
Update the test to listen for brightness changed. | #include <dalston/dalston-brightness-manager.h>
static void
_manager_num_levels_changed_cb (DalstonBrightnessManager *manager,
gint num_levels)
{
g_debug (G_STRLOC ": Num levels changed: %d",
num_levels);
}
int
main (int argc,
char **argv)
{
GMainLoop *loop;
DalstonBrightnessManager *manager;
g_type_init ();
loop = g_main_loop_new (NULL, TRUE);
manager = dalston_brightness_manager_new ();
g_signal_connect (manager,
"num-levels-changed",
_manager_num_levels_changed_cb,
NULL);
g_main_loop_run (loop);
}
| #include <dalston/dalston-brightness-manager.h>
static void
_manager_num_levels_changed_cb (DalstonBrightnessManager *manager,
gint num_levels)
{
g_debug (G_STRLOC ": Num levels changed: %d",
num_levels);
}
static void
_brightness_changed_cb (DalstonBrightnessManager *manager,
gint value)
{
g_debug (G_STRLOC ": Brightness: %d", value);
}
int
main (int argc,
char **argv)
{
GMainLoop *loop;
DalstonBrightnessManager *manager;
g_type_init ();
loop = g_main_loop_new (NULL, TRUE);
manager = dalston_brightness_manager_new ();
g_signal_connect (manager,
"num-levels-changed",
_manager_num_levels_changed_cb,
NULL);
dalston_brightness_manager_start_monitoring (manager);
g_signal_connect (manager,
"brightness-changed",
_brightness_changed_cb,
NULL);
g_main_loop_run (loop);
}
|
Test for lvalue-argument function inlinling | // RUN: %ocheck 3 %s
__attribute((always_inline))
inline f(int x)
{
int i = x;
&x;
i++;
return i;
}
main()
{
int added = 5;
added = f(2);
return added;
}
| |
Test for queue using array | #include <check.h>
#include "../src/queue_using_array/queue.h"
queue q;
void setup() {
init( &q );
}
void teardown() {
}
START_TEST( test_normal_ops )
{
enqueue( &q, 10 );
enqueue( &q, 12 );
ck_assert_int_eq( dequeue( &q ), 10 );
ck_assert_int_eq( dequeue( &q ), 12 );
}
END_TEST
START_TEST( test_abnormal_enqueue )
{
enqueue( &q, 12 );
enqueue( &q, 14 );
enqueue( &q, 16 );
enqueue( &q, 18 );
enqueue( &q, 10 );
ck_assert_int_eq( enqueue( &q, 15 ), -2 );
}
END_TEST
START_TEST( test_abnormal_dequeue )
{
enqueue( &q, 12 );
ck_assert_int_eq( dequeue( &q ), 12 );
ck_assert_int_eq( dequeue( &q ), -3 );
}
END_TEST
START_TEST( test_null )
{
ck_assert_int_eq( enqueue( NULL, 10 ), -1 );
ck_assert_int_eq( dequeue( NULL ), -1 );
ck_assert_int_eq( peek( NULL ), -1 );
ck_assert_int_eq( init( NULL ), -1 );
}
END_TEST
Suite * queue_suite(void)
{
Suite *s;
TCase *tc_core, *tc_abnormal;
s = suite_create("Queue");
/* Core test case */
tc_core = tcase_create("Core");
/* Abnormal test case */
tc_abnormal = tcase_create("Abnormal");
tcase_add_checked_fixture(tc_core, setup, teardown);
tcase_add_checked_fixture(tc_abnormal, setup, teardown);
tcase_add_test(tc_core, test_normal_ops);
tcase_add_test(tc_abnormal, test_abnormal_enqueue);
tcase_add_test(tc_abnormal, test_abnormal_dequeue);
tcase_add_test(tc_abnormal, test_null);
suite_add_tcase(s, tc_core);
suite_add_tcase(s, tc_abnormal);
return s;
}
int main()
{
int number_failed;
Suite *s;
SRunner *sr;
s = queue_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
| |
Add normal information to terrain. | // =============================================================================
// 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
// =============================================================================
//
// Base class for a terrain subsystem.
//
// =============================================================================
#ifndef CH_TERRAIN_H
#define CH_TERRAIN_H
#include "core/ChShared.h"
#include "subsys/ChApiSubsys.h"
namespace chrono {
class CH_SUBSYS_API ChTerrain : public ChShared {
public:
ChTerrain() {}
virtual ~ChTerrain() {}
virtual void Update(double time) {}
virtual void Advance(double step) {}
virtual double GetHeight(double x, double y) const = 0;
};
} // end namespace chrono
#endif
| // =============================================================================
// 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
// =============================================================================
//
// Base class for a terrain subsystem.
//
// =============================================================================
#ifndef CH_TERRAIN_H
#define CH_TERRAIN_H
#include "core/ChShared.h"
#include "core/ChVector.h"
#include "subsys/ChApiSubsys.h"
namespace chrono {
class CH_SUBSYS_API ChTerrain : public ChShared {
public:
ChTerrain() {}
virtual ~ChTerrain() {}
virtual void Update(double time) {}
virtual void Advance(double step) {}
virtual double GetHeight(double x, double y) const = 0;
//// TODO: make this a pure virtual function...
virtual ChVector<> GetNormal(double x, double y) const { return ChVector<>(0, 0, 1); }
};
} // end namespace chrono
#endif
|
Support nullable Item sourceView in Swift. | //
// KSPhotoItem.h
// KSPhotoBrowser
//
// Created by Kyle Sun on 12/25/16.
// Copyright © 2016 Kyle Sun. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface KSPhotoItem : NSObject
@property (nonatomic, strong, readonly) UIView *sourceView;
@property (nonatomic, strong, readonly) UIImage *thumbImage;
@property (nonatomic, strong, readonly) UIImage *image;
@property (nonatomic, strong, readonly) NSURL *imageUrl;
@property (nonatomic, assign) BOOL finished;
- (instancetype)initWithSourceView:(UIView *)view
thumbImage:(UIImage *)image
imageUrl:(NSURL *)url;
- (instancetype)initWithSourceView:(UIImageView *)view
imageUrl:(NSURL *)url;
- (instancetype)initWithSourceView:(UIImageView *)view
image:(UIImage *)image;
+ (instancetype)itemWithSourceView:(UIView *)view
thumbImage:(UIImage *)image
imageUrl:(NSURL *)url;
+ (instancetype)itemWithSourceView:(UIImageView *)view
imageUrl:(NSURL *)url;
+ (instancetype)itemWithSourceView:(UIImageView *)view
image:(UIImage *)image;
@end
NS_ASSUME_NONNULL_END
| //
// KSPhotoItem.h
// KSPhotoBrowser
//
// Created by Kyle Sun on 12/25/16.
// Copyright © 2016 Kyle Sun. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KSPhotoItem : NSObject
@property (nonatomic, strong, readonly, nullable) UIView *sourceView;
@property (nonatomic, strong, readonly, nullable) UIImage *thumbImage;
@property (nonatomic, strong, readonly, nullable) UIImage *image;
@property (nonatomic, strong, readonly, nullable) NSURL *imageUrl;
@property (nonatomic, assign) BOOL finished;
- (nonnull instancetype)initWithSourceView:(nullable UIView *)view
thumbImage:(nullable UIImage *)image
imageUrl:(nullable NSURL *)url;
- (nonnull instancetype)initWithSourceView:(nullable UIImageView * )view
imageUrl:(nullable NSURL *)url;
- (nonnull instancetype)initWithSourceView:(nullable UIImageView *)view
image:(nullable UIImage *)image;
+ (nonnull instancetype)itemWithSourceView:(nullable UIView *)view
thumbImage:(nullable UIImage *)image
imageUrl:(nullable NSURL *)url;
+ (nonnull instancetype)itemWithSourceView:(nullable UIImageView *)view
imageUrl:(nullable NSURL *)url;
+ (nonnull instancetype)itemWithSourceView:(nullable UIImageView *)view
image:(nullable UIImage *)image;
@end
|
Update for some -current quirks, and some other things taken from the *bsd bind-8 ports. (our setpwent() was changed to return void, but our setgrent() returns int still!) | #define CAN_RECONNECT
#define USE_POSIX
#define POSIX_SIGNALS
#define USE_UTIME
#define USE_WAITPID
#define HAVE_GETRUSAGE
#define HAVE_FCHMOD
#define NEED_PSELECT
#define HAVE_SA_LEN
#define USE_LOG_CONS
#define HAVE_CHROOT
#define CAN_CHANGE_ID
#define _TIMEZONE timezone
#define PORT_NONBLOCK O_NONBLOCK
#define PORT_WOULDBLK EWOULDBLOCK
#define WAIT_T int
#define KSYMS "/kernel"
#define KMEM "/dev/kmem"
#define UDPSUM "udpcksum"
/*
* We need to know the IPv6 address family number even on IPv4-only systems.
* Note that this is NOT a protocol constant, and that if the system has its
* own AF_INET6, different from ours below, all of BIND's libraries and
* executables will need to be recompiled after the system <sys/socket.h>
* has had this type added. The type number below is correct on most BSD-
* derived systems for which AF_INET6 is defined.
*/
#ifndef AF_INET6
#define AF_INET6 24
#endif
| #define CAN_RECONNECT
#define USE_POSIX
#define POSIX_SIGNALS
#define USE_UTIME
#define USE_WAITPID
#define HAVE_GETRUSAGE
#define HAVE_FCHMOD
#define NEED_PSELECT
#define HAVE_SA_LEN
#define SETPWENT_VOID
#define RLIMIT_TYPE rlim_t
#define RLIMIT_LONGLONG
#define RLIMIT_FILE_INFINITY
#define HAVE_CHROOT
#define CAN_CHANGE_ID
#define _TIMEZONE timezone
#define PORT_NONBLOCK O_NONBLOCK
#define PORT_WOULDBLK EWOULDBLOCK
#define WAIT_T int
#define KSYMS "/kernel"
#define KMEM "/dev/kmem"
#define UDPSUM "udpcksum"
/*
* We need to know the IPv6 address family number even on IPv4-only systems.
* Note that this is NOT a protocol constant, and that if the system has its
* own AF_INET6, different from ours below, all of BIND's libraries and
* executables will need to be recompiled after the system <sys/socket.h>
* has had this type added. The type number below is correct on most BSD-
* derived systems for which AF_INET6 is defined.
*/
#ifndef AF_INET6
#define AF_INET6 24
#endif
|
Define interface for data reader and writer objects | #ifndef READ_AND_WRITE_DATA_H
#define READ_AND_WRITE_DATA_H
#include <objects.h>
using namespace std;
class FileReader {
protected:
string inputFile;
public:
FileReader(const string &inputFile) : inputFile(inputFile) {}
virtual bool hasNextLine() = 0;
virtual void readNextLine(DataInstance &instance) = 0;
~FileReader();
};
class FileWriter {
protected:
string outputFile;
public:
FileWriter(const string &outputFile) : outputFile(outputFile) {}
virtual void writeNextLine(DataInstance &instance) = 0;
~FileWriter();
};
void importData(FileReader &reader, vector<DataObject> &data);
void exportData(FileWriter &writer, const vector<DataObject> &data);
#endif | |
Set empty texture default to transparent | // Copyright 2016 Zheng Xian Qiu
//
#pragma once
#include "Seeker.h"
#ifndef _TEXTURE_H
#define _TEXTURE_H
using std::string;
namespace Seeker {
class Texture : public IResource {
public:
Texture(string path);
Texture(int width, int height, bool alpha = false);
~Texture();
int Width = 0;
int Height = 0;
void Prepare(SDL_Renderer* renderer);
void Draw(int x, int y);
void Draw(int x, int y, int w, int h);
void Destroy();
void AsRenderTarget(SDL_Renderer* renderer);
static string ResourceKey(string filename);
protected:
SDL_Texture* CreateTextureFromSurface(SDL_Renderer* renderer);
SDL_Texture* CreateTexture(SDL_Renderer* renderer);
private:
string filename;
bool alpha = false;
SDL_Texture* texture = nullptr;
};
}
#endif
| // Copyright 2016 Zheng Xian Qiu
//
#pragma once
#include "Seeker.h"
#ifndef _TEXTURE_H
#define _TEXTURE_H
using std::string;
namespace Seeker {
class Texture : public IResource {
public:
Texture(string path);
Texture(int width, int height, bool alpha = true);
~Texture();
int Width = 0;
int Height = 0;
void Prepare(SDL_Renderer* renderer);
void Draw(int x, int y);
void Draw(int x, int y, int w, int h);
void Destroy();
void AsRenderTarget(SDL_Renderer* renderer);
static string ResourceKey(string filename);
protected:
SDL_Texture* CreateTextureFromSurface(SDL_Renderer* renderer);
SDL_Texture* CreateTexture(SDL_Renderer* renderer);
private:
string filename;
bool alpha = true;
SDL_Texture* texture = nullptr;
};
}
#endif
|
Remove the dll export flag | #include "sqldatabasestorage.h"
CWF_BEGIN_NAMESPACE
namespace DbStorage {
CPPWEBFRAMEWORKSHARED_EXPORT static CWF::SqlDatabaseStorage _storage;
CPPWEBFRAMEWORKSHARED_EXPORT static QString _secret;
}
CWF_END_NAMESPACE
| #include "sqldatabasestorage.h"
CWF_BEGIN_NAMESPACE
namespace DbStorage {
static CWF::SqlDatabaseStorage _storage;
static QString _secret;
}
CWF_END_NAMESPACE
|
Check for C++14 and Lua version properly | /* Luwra
* Minimal-overhead Lua wrapper for C++
*
* Copyright (C) 2015, Ole Krüger <ole@vprsm.de>
*/
#ifndef LUWRA_COMMON_H_
#define LUWRA_COMMON_H_
#include <lua.hpp>
// Check for proper Lua version
#if defined(LUA_VERSION_NUM)
#if LUA_VERSION_NUM < 503 || LUA_VERSION >= 600
#warning "Luwra has not been tested against your installed version of Lua"
#end
#else
#error "Your Lua library does not define LUA_VERSION_NUM"
#end
#define LUWRA_NS_BEGIN namespace luwra {
#define LUWRA_NS_END }
#endif
| /* Luwra
* Minimal-overhead Lua wrapper for C++
*
* Copyright (C) 2015, Ole Krüger <ole@vprsm.de>
*/
#ifndef LUWRA_COMMON_H_
#define LUWRA_COMMON_H_
// Check C++ version
#if !defined(__cplusplus) || __cplusplus < 201402L
#error "You need a C++14 compliant compiler"
#endif
#include <lua.hpp>
// Check for proper Lua version
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 503 || LUA_VERSION >= 600
#warning "Luwra has not been tested against your installed version of Lua"
#endif
#define LUWRA_NS_BEGIN namespace luwra {
#define LUWRA_NS_END }
#endif
|
Check for gtk version below 2.21.1 for comptability with gseal changes | #ifndef __GTK_COMPAT_H__
#define __GTK_COMPAT_H__
#include <gtk/gtk.h>
/* Provide a compatibility layer for accessor functions introduced
* in GTK+ 2.22 which we need to build with sealed GDK.
* That way it is still possible to build with GTK+ 2.20.
*/
#if !GTK_CHECK_VERSION(2,21,2)
#define gdk_drag_context_get_actions(context) (context)->actions
#define gdk_drag_context_get_suggested_action(context) (context)->suggested_action
#define gdk_drag_context_get_selected_action(context) (context)->action
#endif /* GTK_CHECK_VERSION(2, 21, 0) */
#endif /* __GTK_COMPAT_H__ */
| #ifndef __GTK_COMPAT_H__
#define __GTK_COMPAT_H__
#include <gtk/gtk.h>
/* Provide a compatibility layer for accessor functions introduced
* in GTK+ 2.21.1 which we need to build with sealed GDK.
* That way it is still possible to build with GTK+ 2.20.
*/
#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 21) \
|| (GTK_MINOR_VERSION == 21 && GTK_MICRO_VERSION < 1)
#define gdk_drag_context_get_actions(context) (context)->actions
#define gdk_drag_context_get_suggested_action(context) (context)->suggested_action
#define gdk_drag_context_get_selected_action(context) (context)->action
#endif
#endif /* __GTK_COMPAT_H__ */
|
Update the version a tick so that we can tell who has the recently committed critical fixes. | // KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h
#define KMAIL_VERSION "1.6.50"
#endif /*kmversion_h*/
| // KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h
#define KMAIL_VERSION "1.6.51"
#endif /*kmversion_h*/
|
Fix warning from gcc4 (Laurent) | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
// $Id$
// $MpId: AliMpStationType.h,v 1.5 2005/10/28 15:05:04 ivana Exp $
/// \ingroup basic
/// \enum AliMpStationType
/// Enumeration for refering to a MUON station
///
/// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
#ifndef ALI_MP_STATION_TYPE_H
#define ALI_MP_STATION_TYPE_H
enum AliMpStationType
{
kStationInvalid = -1,///< invalid station
kStation1 = 0, ///< station 1 (quadrants)
kStation2, ///< station 2 (quadrants)
kStation345, ///< station 3,4,5 (slats)
kStationTrigger ///< trigger stations (slats)
};
inline
const char* StationTypeName(AliMpStationType stationType)
{
switch ( stationType )
{
case kStation1:
return "st1";
break;
case kStation2:
return "st2";
break;
case kStation345:
return "slat";
break;
case kStationTrigger:
return "trigger";
break;
case kStationInvalid:
default:
return "unknown";
break;
}
}
#endif //ALI_MP_STATION_TYPE_H
| /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
// $Id$
// $MpId: AliMpStationType.h,v 1.5 2005/10/28 15:05:04 ivana Exp $
/// \ingroup basic
/// \enum AliMpStationType
/// Enumeration for refering to a MUON station
///
/// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
#ifndef ALI_MP_STATION_TYPE_H
#define ALI_MP_STATION_TYPE_H
enum AliMpStationType
{
kStationInvalid = -1,///< invalid station
kStation1 = 0, ///< station 1 (quadrants)
kStation2, ///< station 2 (quadrants)
kStation345, ///< station 3,4,5 (slats)
kStationTrigger ///< trigger stations (slats)
};
inline
const char* StationTypeName(AliMpStationType stationType)
{
switch ( stationType )
{
case kStation1:
return "st1";
break;
case kStation2:
return "st2";
break;
case kStation345:
return "slat";
break;
case kStationTrigger:
return "trigger";
break;
case kStationInvalid:
default:
return "invalid";
break;
}
return "unknown";
}
#endif //ALI_MP_STATION_TYPE_H
|
Increase version number of merge into master | //
// MKVersion.h
// MKCommons
//
// Created by Michael Kuck on 9/27/13.
// Copyright (c) 2013 Michael Kuck. All rights reserved.
//
extern NSString *const MKApplicationVersion(void);
static NSUInteger const MAJOR = 1;
static NSUInteger const MINOR = 10;
static NSUInteger const PATCH = 4;
| //
// MKVersion.h
// MKCommons
//
// Created by Michael Kuck on 9/27/13.
// Copyright (c) 2013 Michael Kuck. All rights reserved.
//
extern NSString *const MKApplicationVersion(void);
static NSUInteger const MAJOR = 1;
static NSUInteger const MINOR = 11;
static NSUInteger const PATCH = 0;
|
Remove the templated copyright statement | //
// FacilitiesRoom.h
// MIT Mobile
//
// Created by Blake Skinner on 5/11/11.
// Copyright (c) 2011 MIT. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class FacilitiesLocation;
@interface FacilitiesRoom : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * floor;
@property (nonatomic, retain) NSString * number;
@property (nonatomic, retain) NSString * building;
- (NSString*)displayString;
- (NSString*)description;
@end
| #import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class FacilitiesLocation;
@interface FacilitiesRoom : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * floor;
@property (nonatomic, retain) NSString * number;
@property (nonatomic, retain) NSString * building;
- (NSString*)displayString;
- (NSString*)description;
@end
|
Make cardinal directions rely on VoxelUtils. | #ifndef CARDINAL_DIRECTION_H
#define CARDINAL_DIRECTION_H
#include <string>
#include "../Math/Vector2.h"
#include "../World/VoxelUtils.h"
// North, northeast, southwest, etc..
enum class CardinalDirectionName;
namespace CardinalDirection
{
// Cardinal directions in the XZ plane (bird's eye view).
const NewDouble2 North(-1.0, 0.0);
const NewDouble2 South(1.0, 0.0);
const NewDouble2 East(0.0, -1.0);
const NewDouble2 West(0.0, 1.0);
CardinalDirectionName getDirectionName(const NewDouble2 &direction);
const std::string &toString(CardinalDirectionName directionName);
}
#endif
| #ifndef CARDINAL_DIRECTION_H
#define CARDINAL_DIRECTION_H
#include <string>
#include "../Math/Vector2.h"
#include "../World/VoxelUtils.h"
// North, northeast, southwest, etc..
enum class CardinalDirectionName;
namespace CardinalDirection
{
// Cardinal directions in the XZ plane (bird's eye view).
const NewDouble2 North(static_cast<double>(VoxelUtils::North.x), static_cast<double>(VoxelUtils::North.y));
const NewDouble2 South(static_cast<double>(VoxelUtils::South.x), static_cast<double>(VoxelUtils::South.y));
const NewDouble2 East(static_cast<double>(VoxelUtils::East.x), static_cast<double>(VoxelUtils::East.y));
const NewDouble2 West(static_cast<double>(VoxelUtils::West.x), static_cast<double>(VoxelUtils::West.y));
CardinalDirectionName getDirectionName(const NewDouble2 &direction);
const std::string &toString(CardinalDirectionName directionName);
}
#endif
|
Add printf module into libocl | #ifndef __OCL_PRINTF_H__
#define __OCL_PRINTF_H__
#include "ocl_types.h"
/* The printf function. */
/* From LLVM 3.4, c string are all in constant address space */
#if 100*__clang_major__ + __clang_minor__ < 304
int __gen_ocl_printf_stub(const char * format, ...);
#else
int __gen_ocl_printf_stub(constant char * format, ...);
#endif
#define printf __gen_ocl_printf_stub
#endif
| |
Add a test for PR22531 | // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -o - %s | FileCheck %s
// Since foo is never emitted, there should not be a profile name for it.
// CHECK-NOT: @__llvm_profile_name_foo =
// CHECK: @__llvm_profile_name_bar =
// CHECK-NOT: @__llvm_profile_name_foo =
#ifdef IS_SYSHEADER
#pragma clang system_header
inline int foo() { return 0; }
#else
#define IS_SYSHEADER
#include __FILE__
int bar() { return 0; }
#endif
| // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -emit-llvm -main-file-name unused_names.c -o - %s > %t
// RUN: FileCheck -input-file %t %s
// RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s
// Since foo is never emitted, there should not be a profile name for it.
// CHECK-DAG: @__llvm_profile_name_bar = {{.*}} section "{{.*}}__llvm_prf_names"
// CHECK-DAG: @__llvm_profile_name_baz = {{.*}} section "{{.*}}__llvm_prf_names"
// CHECK-DAG: @"__llvm_profile_name_unused_names.c:qux" = {{.*}} section "{{.*}}__llvm_prf_names"
// SYSHEADER-NOT: @__llvm_profile_name_foo =
#ifdef IS_SYSHEADER
#pragma clang system_header
inline int foo() { return 0; }
#else
#define IS_SYSHEADER
#include __FILE__
int bar() { return 0; }
inline int baz() { return 0; }
static int qux() { return 42; }
#endif
|
Fix to windows build errors | #ifndef RBRIDGE_H
#define RBRIDGE_H
#include <RInside.h>
#include <Rcpp.h>
#include <string>
#include <map>
#include <boost/function.hpp>
#include "../JASP-Common/dataset.h"
#ifdef __WIN32__
#undef Realloc
#undef Free
#endif
//typedef int (*RCallback)(std::string value);
typedef boost::function<int(const std::string &)> RCallback;
void rbridge_init();
void rbridge_setDataSet(DataSet *dataSet);
std::string rbridge_run(const std::string &name, const std::string &options, const std::string &perform = "run", RCallback callback = NULL);
#endif // RBRIDGE_H
| #ifndef RBRIDGE_H
#define RBRIDGE_H
#include <RInside.h>
#include <Rcpp.h>
#ifdef __WIN32__
#undef Realloc
#undef Free
#endif
#include <string>
#include <map>
#include <boost/function.hpp>
#include "../JASP-Common/dataset.h"
//typedef int (*RCallback)(std::string value);
typedef boost::function<int(const std::string &)> RCallback;
void rbridge_init();
void rbridge_setDataSet(DataSet *dataSet);
std::string rbridge_run(const std::string &name, const std::string &options, const std::string &perform = "run", RCallback callback = NULL);
#endif // RBRIDGE_H
|
Add important DCC functions to DCC header for interaction | class dccChat : public Module {
public:
virtual ~dccChat();
virtual void onDCCReceive(std::string dccid, std::string message);
virtual void onDCCEnd(std::string dccid);
};
class dccSender : public Module {
public:
virtual ~dccSender();
virtual void dccSend(std::string dccid, std::string message);
virtual bool hookDCCMessage(std::string modName, std::string hookMsg);
virtual void unhookDCCSession(std::string modName, std::string dccid);
};
dccChat::~dccChat() {}
void dccChat::onDCCReceive(std::string dccid, std::string message) {}
void dccChat::onDCCEnd(std::string dccid) {}
dccSender::~dccSender() {}
void dccSender::dccSend(std::string dccid, std::string message) {}
bool dccSender::hookDCCMessage(std::string modName, std::string hookMsg) { return false; }
void dccSender::unhookDCCSession(std::string modName, std::string dccid) {} | class dccChat : public Module {
public:
virtual ~dccChat();
virtual void onDCCReceive(std::string dccid, std::string message);
virtual void onDCCEnd(std::string dccid);
};
class dccSender : public Module {
public:
virtual ~dccSender();
virtual void dccSend(std::string dccid, std::string message);
virtual bool hookDCCMessage(std::string modName, std::string hookMsg);
virtual void unhookDCCSession(std::string modName, std::string dccid);
virtual std::vector<std::string> getConnections();
virtual void closeDCCConnection(std::string dccid);
};
dccChat::~dccChat() {}
void dccChat::onDCCReceive(std::string dccid, std::string message) {}
void dccChat::onDCCEnd(std::string dccid) {}
dccSender::~dccSender() {}
void dccSender::dccSend(std::string dccid, std::string message) {}
bool dccSender::hookDCCMessage(std::string modName, std::string hookMsg) { return false; }
void dccSender::unhookDCCSession(std::string modName, std::string dccid) {} |
Add sample headers as a macro | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "httpserv.h"
#include "request.h"
#define PORT 5556
#define BACKLOG 5
int main(int argc, char* argv[]) {
setup_openssl();
req* r = init_request();
char* res = request_kahoot_token(r, "6573712");
printf("%s\n", res);
return 0;
}; | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "httpserv.h"
#include "request.h"
#include "kahoot.h"
#define PORT 5556
#define BACKLOG 5
#define HEADERS "HTTP/1.1 200 OK\
Server: openresty/1.11.2.2\
Date: Tue, 28 Mar 2017 14:55:03 GMT\
Content-Type: application/json\
Transfer-Encoding: chunked\
Connection: keep-alive\
Vary: Accept-Encoding\
x-kahoot-session-token: UhMIEhNAWF8LCgRTUSdNKwx+LWBRW39dfjoTTmwAcXBwCDdZDV1qfXcJJwJmLQdFLE0Obh9XW2d1GRB5QVJ6eF5fOU8GUgNvcgV7BW8DDlA5eGBcYG5XYjRmPS1CGGFP\
\
1a4\
{\"twoFactorAuth\":false,\"challenge\":"decode('rX7Rw1SRHxgrZVYKWkGHmVATO4zEGrV8Sl89RKwf3o82PZkT6e5eFjYNlPyu1HOpp724MtdhTGqgXHPLcYxNkBPjuEdarpy0BJJ1'); function decode(message) {var offset = ((67 + 21 * (98 * 54)) + (8 + 98) + 15); console.log(\"Offset derived as:\", offset); return _.replace(message, /./g, function(char, position) {return String.fromCharCode((((char.charCodeAt(0) * position) + offset) % 77) + 48);});}\"}\
0"
int main(int argc, char* argv[]) {
setup_openssl();
//
return 0;
}; |
Change proc() to task() and put overloaded config types. | /*
ModbusIP.h - Header for Modbus IP Library
Copyright (C) 2015 Andr Sarmento Barbosa
*/
#include <Arduino.h>
#include <Modbus.h>
#include <SPI.h>
#include <Ethernet.h>
#ifndef MODBUSIP_H
#define MODBUSIP_H
#define MODBUSIP_PORT 502
#define MODBUSIP_MAXFRAME 200
class ModbusIP : public Modbus {
private:
EthernetServer _server;
byte _MBAP[7];
public:
ModbusIP();
bool config(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet);
void proc();
};
#endif //MODBUSIP_H
| /*
ModbusIP.h - Header for Modbus IP Library
Copyright (C) 2015 Andr Sarmento Barbosa
*/
#include <Arduino.h>
#include <Modbus.h>
#include <SPI.h>
#include <Ethernet.h>
#ifndef MODBUSIP_H
#define MODBUSIP_H
#define MODBUSIP_PORT 502
#define MODBUSIP_MAXFRAME 200
class ModbusIP : public Modbus {
private:
EthernetServer _server;
byte _MBAP[7];
public:
ModbusIP();
void config(uint8_t *mac);
void config(uint8_t *mac, IPAddress ip);
void config(uint8_t *mac, IPAddress ip, IPAddress dns);
void config(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway);
void config(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet);
void task();
};
#endif //MODBUSIP_H
|
Move DisposalDeleter out of bindings namespace. | #ifndef SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
#define SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
#include <sauce/memory.h>
namespace sauce {
namespace internal {
namespace bindings {
template<typename Dependency, typename Scope>
class NakedBinding;
/**
* A smart pointer deleter that diposes with a given binding.
*/
template<typename Dependency, typename Scope>
class DisposalDeleter {
typedef typename Key<Dependency>::Iface Iface;
typedef sauce::shared_ptr<NakedBinding<Dependency, Scope> > BindingPtr;
friend class NakedBinding<Dependency, Scope>;
BindingPtr binding;
DisposalDeleter(BindingPtr binding):
binding(binding) {}
public:
/**
* Cast and dispose the given Iface instance.
*/
void operator()(Iface * iface) const {
binding->dispose(iface);
}
};
}
}
namespace i = ::sauce::internal;
namespace b = ::sauce::internal::bindings;
}
#endif // SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
| #ifndef SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
#define SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
#include <sauce/memory.h>
namespace sauce {
namespace internal {
namespace bindings {
template<typename Dependency, typename Scope>
class NakedBinding;
}
namespace b = ::sauce::internal::bindings;
/**
* A smart pointer deleter that diposes with a given binding.
*/
template<typename Dependency, typename Scope>
class DisposalDeleter {
typedef typename Key<Dependency>::Iface Iface;
typedef sauce::shared_ptr<b::NakedBinding<Dependency, Scope> > BindingPtr;
friend class b::NakedBinding<Dependency, Scope>;
BindingPtr binding;
DisposalDeleter(BindingPtr binding):
binding(binding) {}
public:
/**
* Cast and dispose the given Iface instance.
*/
void operator()(Iface * iface) const {
binding->dispose(iface);
}
};
}
namespace i = ::sauce::internal;
}
#endif // SAUCE_SAUCE_INTERNAL_DISPOSAL_DELETER_H_
|
Add some of these cast examples as test for congruences | // PARAM: --enable ana.int.congruence --enable ana.int.congruence_no_overflow
// from https://github.com/sosy-lab/sv-benchmarks/blob/master/c/bitvector-regression/implicitunsignedconversion-1.c
int main() {
unsigned int plus_one = 1;
int minus_one = -1;
int v = 0;
if(plus_one < minus_one) {
v = 1;
assert(1);
}
assert(v==1);
// from https://github.com/sosy-lab/sv-benchmarks/blob/master/c/bitvector-regression/integerpromotion-3.c
unsigned char port = 0x5a;
unsigned char result_8 = ( ~port ) >> 4;
if (result_8 == 0xfa) {
v = 2;
}
assert(v==2); // UNKNOWN
// from https://github.com/sosy-lab/sv-benchmarks/blob/master/c/bitvector-regression/signextension-1.c
unsigned short int allbits = -1;
short int signedallbits = allbits;
int unsignedtosigned = allbits;
unsigned int unsignedtounsigned = allbits;
int signedtosigned = signedallbits;
unsigned int signedtounsigned = signedallbits;
/*
printf ("unsignedtosigned: %d\n", unsignedtosigned);
printf ("unsignedtounsigned: %u\n", unsignedtounsigned);
printf ("signedtosigned: %d\n", signedtosigned);
printf ("signedtounsigned: %u\n", signedtounsigned);
*/
if (unsignedtosigned == 65535 && unsignedtounsigned == 65535
&& signedtosigned == -1 && signedtounsigned == 4294967295) {
v =3;
}
assert(v==3); // UNKNOWN
return (0);
} | |
Add a testcase for the vla and stack realignment warning. | // RUN: %llvmgcc -std=gnu99 %s -S |& grep {error: "is greater than the stack alignment" }
int foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
return 4;
}
| |
Fix missing header error in some boards | #ifndef TELEMETRY_TRANSPORT_HPP_
#define TELEMETRY_TRANSPORT_HPP_
#include "HardwareSerial.h"
int32_t read(uint8_t * buf, uint32_t sizeToRead)
{
return Serial.readBytes((char*)(buf), sizeToRead);
}
int32_t write(uint8_t * buf, uint32_t sizeToWrite)
{
Serial.write((char*)(buf),sizeToWrite);
return 0;
}
int32_t readable()
{
return Serial.available();
}
int32_t writeable()
{
return Serial.availableForWrite();
}
#endif
| #ifndef TELEMETRY_TRANSPORT_HPP_
#define TELEMETRY_TRANSPORT_HPP_
#include "HardwareSerial.h"
#include "Arduino.h"
int32_t read(uint8_t * buf, uint32_t sizeToRead)
{
return Serial.readBytes((char*)(buf), sizeToRead);
}
int32_t write(uint8_t * buf, uint32_t sizeToWrite)
{
Serial.write((char*)(buf),sizeToWrite);
return 0;
}
int32_t readable()
{
return Serial.available();
}
int32_t writeable()
{
return Serial.availableForWrite();
}
#endif
|
Add initial lua integration concept | #include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
int main(int argc, char *argv[])
{
lua_State *ls;
int status;
ls = luaL_newstate();
if(argc > 1) {
status = luaL_loadfile(ls, argv[1]);
if(status) {
printf("ERROR: %s\n", lua_tostring(ls, -1));
}
}
lua_close(ls);
return 0;
}
| |
Fix warning given by Clang |
#ifndef __CLOCK_SERVER_H__
#define __CLOCK_SERVER_H__
#include <std.h>
#include <scheduler.h>
extern int clock_server_tid;
typedef enum {
CLOCK_NOTIFY = 1,
CLOCK_DELAY = 2,
CLOCK_TIME = 3,
CLOCK_DELAY_UNTIL = 4
} clock_req_type;
typedef struct {
clock_req_type type;
uint ticks;
} clock_req;
void clock_server(void);
#endif
|
#ifndef __CLOCK_SERVER_H__
#define __CLOCK_SERVER_H__
#include <std.h>
#include <scheduler.h>
extern int clock_server_tid;
typedef enum {
CLOCK_NOTIFY = 1,
CLOCK_DELAY = 2,
CLOCK_TIME = 3,
CLOCK_DELAY_UNTIL = 4
} clock_req_type;
typedef struct {
clock_req_type type;
uint ticks;
} clock_req;
void __attribute__ ((noreturn)) clock_server(void);
#endif
|
Make jonable methods to return vectors via reference | #ifndef JOINABLE_IMPL
#define JOINABLE_IMPL
#include "joinable_types.h"
#include "types/MediaObjectImpl.h"
using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;
using ::com::kurento::kms::api::MediaSession;
namespace com { namespace kurento { namespace kms {
class JoinableImpl : public Joinable, public virtual MediaObjectImpl {
public:
JoinableImpl(MediaSession &session);
~JoinableImpl() throw() {};
std::vector<StreamType::type> getStreams(const Joinable& joinable);
void join(const JoinableImpl& to, const Direction::type direction);
void unjoin(const JoinableImpl& to);
void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
void unjoin(const JoinableImpl& to, const StreamType::type stream);
std::vector<Joinable> &getJoinees();
std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
std::vector<Joinable> &getJoinees(const StreamType::type stream);
std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction);
};
}}} // com::kurento::kms
#endif /* JOINABLE_IMPL */
| #ifndef JOINABLE_IMPL
#define JOINABLE_IMPL
#include "joinable_types.h"
#include "types/MediaObjectImpl.h"
using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;
using ::com::kurento::kms::api::MediaSession;
namespace com { namespace kurento { namespace kms {
class JoinableImpl : public Joinable, public virtual MediaObjectImpl {
public:
JoinableImpl(MediaSession &session);
~JoinableImpl() throw() {};
void getStreams(std::vector<StreamType::type> &_return);
void join(const JoinableImpl& to, const Direction::type direction);
void unjoin(const JoinableImpl& to);
void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
void unjoin(const JoinableImpl& to, const StreamType::type stream);
void getJoinees(std::vector<Joinable> &_return);
void getDirectionJoiness(std::vector<Joinable> &_return, const Direction::type direction);
void getJoinees(std::vector<Joinable> &_return, const StreamType::type stream);
void getDirectionJoiness(std::vector<Joinable> &_return, const StreamType::type stream, const Direction::type direction);
};
}}} // com::kurento::kms
#endif /* JOINABLE_IMPL */
|
Remove line so file doesn't show in diff | #import <UIKit/UIKit.h>
@interface NVSceneController : UIViewController
@property (nonatomic, copy) void (^boundsDidChangeBlock)(NVSceneController *controller);
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;
@property (nonatomic, assign) BOOL statusBarHidden;
- (id)initWithScene:(UIView *)view;
@end
@protocol NVScene
@property (nonatomic, assign) BOOL hidesTabBar;
- (void)didPop;
@end
@protocol NVNavigationBar
@property (nonatomic, assign) BOOL isHidden;
@property (nonatomic, assign) BOOL largeTitle;
@property (nonatomic, copy) NSString* title;
@property (nonatomic, copy) NSString *backTitle;
- (void)updateStyle;
@end
@protocol NVSearchBar
@property UISearchController *searchController;
@property (nonatomic, assign) BOOL hideWhenScrolling;
@end
@protocol NVStatusBar
@property (nonatomic, assign) UIStatusBarStyle tintStyle;
@property (nonatomic, assign) BOOL hidden;
- (void)updateStyle;
@end
| #import <UIKit/UIKit.h>
@interface NVSceneController : UIViewController
@property (nonatomic, copy) void (^boundsDidChangeBlock)(NVSceneController *controller);
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;
@property (nonatomic, assign) BOOL statusBarHidden;
- (id)initWithScene:(UIView *)view;
@end
@protocol NVScene
@property (nonatomic, assign) BOOL hidesTabBar;
- (void)didPop;
@end
@protocol NVNavigationBar
@property (nonatomic, assign) BOOL isHidden;
@property (nonatomic, assign) BOOL largeTitle;
@property (nonatomic, copy) NSString* title;
@property (nonatomic, copy) NSString *backTitle;
- (void)updateStyle;
@end
@protocol NVSearchBar
@property UISearchController *searchController;
@property (nonatomic, assign) BOOL hideWhenScrolling;
@end
@protocol NVStatusBar
@property (nonatomic, assign) UIStatusBarStyle tintStyle;
@property (nonatomic, assign) BOOL hidden;
- (void)updateStyle;
@end
|
Allow custom shutdown check cycles by exposing private functions | #ifndef QAK_SHUTDOWN_CHECK_H
#define QAK_SHUTDOWN_CHECK_H
#include <QDebug>
#include <QObject>
#include <QStandardPaths>
#include <QFile>
#include <QFileInfo>
#include <QDateTime>
class ShutdownCheck : public QObject
{
Q_OBJECT
public:
enum Status
{
OK,
FAILED,
Error
};
Q_ENUM(Status)
Q_PROPERTY(int status READ status NOTIFY statusChanged)
explicit ShutdownCheck(QObject* parent = 0);
~ShutdownCheck();
int status() const;
void setStatus(int status);
signals:
void statusChanged();
private:
QString _dataPath;
QString _mark;
int _status;
void writeMark();
void removeMark();
bool markExists();
};
#endif // QAK_SHUTDOWN_CHECK_H
| #ifndef QAK_SHUTDOWN_CHECK_H
#define QAK_SHUTDOWN_CHECK_H
#include <QDebug>
#include <QObject>
#include <QStandardPaths>
#include <QFile>
#include <QFileInfo>
#include <QDateTime>
class ShutdownCheck : public QObject
{
Q_OBJECT
public:
enum Status
{
OK,
FAILED,
Error
};
Q_ENUM(Status)
Q_PROPERTY(int status READ status NOTIFY statusChanged)
explicit ShutdownCheck(QObject* parent = 0);
~ShutdownCheck();
int status() const;
void setStatus(int status);
public slots:
void writeMark();
void removeMark();
bool markExists();
signals:
void statusChanged();
private:
QString _dataPath;
QString _mark;
int _status;
};
#endif // QAK_SHUTDOWN_CHECK_H
|
Use some paranthesis around macro parameters. | #ifndef CJET_CONFIG_H
#define CJET_CONFIG_H
#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40
/*
* It is somehow beneficial if this size is 32 bit aligned.
*/
#define MAX_MESSAGE_SIZE 512
#define WRITE_BUFFER_CHUNK 512
#define MAX_WRITE_BUFFER_SIZE 10 * WRITE_BUFFER_CHUNK
/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100
#endif
| #ifndef CJET_CONFIG_H
#define CJET_CONFIG_H
#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40
/*
* It is somehow beneficial if this size is 32 bit aligned.
*/
#define MAX_MESSAGE_SIZE 512
#define WRITE_BUFFER_CHUNK 512
#define MAX_WRITE_BUFFER_SIZE (10 * (WRITE_BUFFER_CHUNK))
/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100
#endif
|
Fix potential memory leak - freeing the newly created OSyncList was missing | #include <opensync/opensync.h>
#include <opensync/opensync-group.h>
int main(int argc, char *argv[]) {
OSyncList *groups, *g;
int i = 0;
osync_bool couldloadgroups;
OSyncGroup *group = NULL;
OSyncGroupEnv *groupenv = NULL;
groupenv = osync_group_env_new(NULL);
/* load groups from default dir */
couldloadgroups = osync_group_env_load_groups(groupenv, NULL, NULL);
if ( !couldloadgroups ) {
/* print error */
printf("Could not load groups.");
return -1;
}
groups = osync_group_env_get_groups(groupenv);
printf("found %i groups\n", osync_list_length(groups));
for (g = groups; g; g = g->next) {
group = (OSyncGroup *) g->data;
printf("group nr. %i is %s\n", i+1, osync_group_get_name(group));
}
/* free env */
osync_group_env_unref(groupenv);
return 0;
}
| #include <opensync/opensync.h>
#include <opensync/opensync-group.h>
int main(int argc, char *argv[]) {
OSyncList *groups, *g;
int i = 0;
osync_bool couldloadgroups;
OSyncGroup *group = NULL;
OSyncGroupEnv *groupenv = NULL;
groupenv = osync_group_env_new(NULL);
/* load groups from default dir */
couldloadgroups = osync_group_env_load_groups(groupenv, NULL, NULL);
if ( !couldloadgroups ) {
/* print error */
printf("Could not load groups.");
return -1;
}
groups = osync_group_env_get_groups(groupenv);
printf("found %i groups\n", osync_list_length(groups));
for (g = groups; g; g = g->next) {
group = (OSyncGroup *) g->data;
printf("group nr. %i is %s\n", i+1, osync_group_get_name(group));
}
/* Free the list */
osync_list_free(groups);
/* free env */
osync_group_env_unref(groupenv);
return 0;
}
|
Rename variable to be more .net like | // Copyright 2010-2015 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "../CefSharp.Core/Internals/Messaging/ProcessMessageDelegate.h"
namespace CefSharp
{
class CefAppUnmanagedWrapper;
namespace Internals
{
namespace Messaging
{
//This class handles incoming evaluate script messages and responses to them after fulfillment.
class EvaluateScriptDelegate : public ProcessMessageDelegate
{
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(EvaluateScriptDelegate);
CefRefPtr<CefAppUnmanagedWrapper> _appUnmanagedWrapper;
public:
EvaluateScriptDelegate(CefRefPtr<CefAppUnmanagedWrapper> appUnmanagedWrapper);
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message) override;
};
}
}
} | // Copyright 2010-2015 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "../CefSharp.Core/Internals/Messaging/ProcessMessageDelegate.h"
namespace CefSharp
{
class CefAppUnmanagedWrapper;
namespace Internals
{
namespace Messaging
{
//This class handles incoming evaluate script messages and responses to them after fulfillment.
class EvaluateScriptDelegate : public ProcessMessageDelegate
{
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(EvaluateScriptDelegate);
CefRefPtr<CefAppUnmanagedWrapper> _appUnmanagedWrapper;
public:
EvaluateScriptDelegate(CefRefPtr<CefAppUnmanagedWrapper> appUnmanagedWrapper);
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId sourceProcessId, CefRefPtr<CefProcessMessage> message) override;
};
}
}
} |
Add comment to test case for documentation. | // RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
};
struct s global;
void g(int);
void f4() {
int a;
if (global.data == 0)
a = 3;
if (global.data == 0)
g(a); // no-warning
}
| // RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
};
struct s global;
void g(int);
void f4() {
int a;
if (global.data == 0)
a = 3;
if (global.data == 0) // The true branch is infeasible.
g(a); // no-warning
}
|
Fix some printf format warnings | /*
* Let's make sure we always have a sane definition for ntohl()/htonl().
* Some libraries define those as a function call, just to perform byte
* shifting, bringing significant overhead to what should be a simple
* operation.
*/
/*
* Default version that the compiler ought to optimize properly with
* constant values.
*/
static inline unsigned int default_swab32(unsigned int val)
{
return (((val & 0xff000000) >> 24) |
((val & 0x00ff0000) >> 8) |
((val & 0x0000ff00) << 8) |
((val & 0x000000ff) << 24));
}
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define bswap32(x) ({ \
unsigned int __res; \
if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \
} else { \
__asm__("bswap %0" : "=r" (__res) : "0" (x)); \
} \
__res; })
#undef ntohl
#undef htonl
#define ntohl(x) bswap32(x)
#define htonl(x) bswap32(x)
#endif
| /*
* Let's make sure we always have a sane definition for ntohl()/htonl().
* Some libraries define those as a function call, just to perform byte
* shifting, bringing significant overhead to what should be a simple
* operation.
*/
/*
* Default version that the compiler ought to optimize properly with
* constant values.
*/
static inline uint32_t default_swab32(uint32_t val)
{
return (((val & 0xff000000) >> 24) |
((val & 0x00ff0000) >> 8) |
((val & 0x0000ff00) << 8) |
((val & 0x000000ff) << 24));
}
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define bswap32(x) ({ \
uint32_t __res; \
if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \
} else { \
__asm__("bswap %0" : "=r" (__res) : "0" (x)); \
} \
__res; })
#undef ntohl
#undef htonl
#define ntohl(x) bswap32(x)
#define htonl(x) bswap32(x)
#endif
|
Prepare for LLVM 7.0 migrating some utility passes | #define _GNU_SOURCE
#define __STDC_CONSTANT_MACROS
#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS
#include <llvm-c/Analysis.h>
#include <llvm-c/BitReader.h>
#include <llvm-c/BitWriter.h>
#include <llvm-c/Core.h>
#include <llvm-c/DebugInfo.h>
#include <llvm-c/Disassembler.h>
#include <llvm-c/ErrorHandling.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Initialization.h>
#include <llvm-c/IRReader.h>
#include <llvm-c/Linker.h>
#include <llvm-c/LinkTimeOptimizer.h>
#include <llvm-c/lto.h>
#include <llvm-c/Object.h>
#include <llvm-c/OrcBindings.h>
#include <llvm-c/Support.h>
#include <llvm-c/Target.h>
#include <llvm-c/TargetMachine.h>
#include <llvm-c/Transforms/IPO.h>
#include <llvm-c/Transforms/PassManagerBuilder.h>
#include <llvm-c/Transforms/Scalar.h>
#include <llvm-c/Transforms/Vectorize.h>
#include <llvm-c/Types.h>
| #define _GNU_SOURCE
#define __STDC_CONSTANT_MACROS
#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS
#include <llvm-c/Analysis.h>
#include <llvm-c/BitReader.h>
#include <llvm-c/BitWriter.h>
#include <llvm-c/Core.h>
#include <llvm-c/DebugInfo.h>
#include <llvm-c/Disassembler.h>
#include <llvm-c/ErrorHandling.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Initialization.h>
#include <llvm-c/IRReader.h>
#include <llvm-c/Linker.h>
#include <llvm-c/LinkTimeOptimizer.h>
#include <llvm-c/lto.h>
#include <llvm-c/Object.h>
#include <llvm-c/OrcBindings.h>
#include <llvm-c/Support.h>
#include <llvm-c/Target.h>
#include <llvm-c/TargetMachine.h>
#include <llvm-c/Transforms/IPO.h>
#include <llvm-c/Transforms/PassManagerBuilder.h>
#include <llvm-c/Transforms/Scalar.h>
#if LLVM_VERSION_MAJOR > 6
// LLVMAddLowerSwitchPass and LLVMAddPromoteMemoryToRegisterPass live here
// as of LLVM 7.0
#include <llvm-c/Transforms/Utils.h>
#endif
#include <llvm-c/Transforms/Vectorize.h>
#include <llvm-c/Types.h>
|
Add two more test cases for attribute 'noreturn'. | // RUN: clang-cc %s -fsyntax-only -verify -fblocks -Wmissing-noreturn
int j;
void test1() { // expected-warning {{function could be attribute 'noreturn'}}
^ (void) { while (1) { } }(); // expected-warning {{block could be attribute 'noreturn'}}
^ (void) { if (j) while (1) { } }();
while (1) { }
}
void test2() {
if (j) while (1) { }
}
| // RUN: clang-cc %s -fsyntax-only -verify -fblocks -Wmissing-noreturn
int j;
void test1() { // expected-warning {{function could be attribute 'noreturn'}}
^ (void) { while (1) { } }(); // expected-warning {{block could be attribute 'noreturn'}}
^ (void) { if (j) while (1) { } }();
while (1) { }
}
void test2() {
if (j) while (1) { }
}
// This test case illustrates that we don't warn about the missing return
// because the function is marked noreturn and there is an infinite loop.
extern int foo_test_3();
__attribute__((__noreturn__)) void* test3(int arg) {
while (1) foo_test_3();
}
__attribute__((__noreturn__)) void* test3_positive(int arg) {
while (0) foo_test_3();
} // expected-warning{{function declared 'noreturn' should not return}}
|
Add documentation and ensure parameters are unsigned | #pragma once
#include <map>
#include <vector>
class HotkeyInfo {
public:
enum HotkeyActions {
IncreaseVolume,
DecreaseVolume,
SetVolume,
Mute,
VolumeSlider,
EjectDrive,
EjectLatestDrive,
MediaKey,
RunApp,
Settings,
Exit,
};
static std::vector<std::wstring> ActionNames;
enum MediaKeys {
PlayPause,
Stop,
Next,
Previous,
};
static std::vector<std::wstring> MediaKeyNames;
static std::vector<unsigned short> MediaKeyVKs;
public:
int keyCombination = 0;
int action = -1;
std::vector<std::wstring> args;
int ArgToInt(int argIdx);
double ArgToDouble(int argIdx);
bool HasArgs();
void AllocateArg(unsigned int argIdx);
std::wstring ToString();
private:
std::map<int, int> _intArgs;
std::map<int, double> _doubleArgs;
}; | #pragma once
#include <map>
#include <vector>
class HotkeyInfo {
public:
enum HotkeyActions {
IncreaseVolume,
DecreaseVolume,
SetVolume,
Mute,
VolumeSlider,
EjectDrive,
EjectLatestDrive,
MediaKey,
RunApp,
Settings,
Exit,
};
static std::vector<std::wstring> ActionNames;
enum MediaKeys {
PlayPause,
Stop,
Next,
Previous,
};
static std::vector<std::wstring> MediaKeyNames;
static std::vector<unsigned short> MediaKeyVKs;
public:
int keyCombination = 0;
int action = -1;
std::vector<std::wstring> args;
/// <summary>
/// Retrieves the argument at the given index and converts it to an integer.
/// Subsequent calls that specify the same index will be cached.
/// </summary>
int ArgToInt(unsigned int argIdx);
/// <summary>
/// Retrieves the argument at the given index and converts it to a double.
/// Subsequent calls that specify the same index will be cached.
/// </summary>
double ArgToDouble(unsigned int argIdx);
bool HasArgs();
void AllocateArg(unsigned int argIdx);
std::wstring ToString();
private:
std::map<int, int> _intArgs;
std::map<int, double> _doubleArgs;
}; |
Use the new function names for the codec discovery tests |
#include <gst/gst.h>
#include <gst/farsight/fs-codec.h>
#include "fs-rtp-discover-codecs.h"
int main (int argc, char **argv)
{
GList *elements = NULL;
GError *error = NULL;
gst_init (&argc, &argv);
g_debug ("AUDIO STARTING!!");
elements = load_codecs (FS_MEDIA_TYPE_AUDIO, &error);
if (error)
g_debug ("Error: %s", error->message);
g_clear_error (&error);
unload_codecs (FS_MEDIA_TYPE_AUDIO);
g_debug ("AUDIO FINISHED!!");
g_debug ("VIDEO STARTING!!");
elements = load_codecs (FS_MEDIA_TYPE_VIDEO, &error);
if (error)
g_debug ("Error: %s", error->message);
g_clear_error (&error);
unload_codecs (FS_MEDIA_TYPE_VIDEO);
g_debug ("VIDEO FINISHED!!");
return 0;
}
|
#include <gst/gst.h>
#include <gst/farsight/fs-codec.h>
#include "fs-rtp-discover-codecs.h"
int main (int argc, char **argv)
{
GList *elements = NULL;
GError *error = NULL;
gst_init (&argc, &argv);
g_debug ("AUDIO STARTING!!");
elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_AUDIO, &error);
if (error)
g_debug ("Error: %s", error->message);
g_clear_error (&error);
fs_rtp_blueprints_unref (FS_MEDIA_TYPE_AUDIO);
g_debug ("AUDIO FINISHED!!");
g_debug ("VIDEO STARTING!!");
elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_VIDEO, &error);
if (error)
g_debug ("Error: %s", error->message);
g_clear_error (&error);
fs_rtp_blueprints_unref (FS_MEDIA_TYPE_VIDEO);
g_debug ("VIDEO FINISHED!!");
return 0;
}
|
Remove dot from exception message | #ifndef INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H
#define INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H
#include <patlms/type/exception/exception.h>
namespace type
{
namespace exception
{
namespace detail
{
class DateParseException : public interface::Exception {
inline char const* what() const throw () override;
};
char const* DateParseException::what() const throw () {
return "Can't parse date.";
}
}
}
}
#endif /* INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H */
| #ifndef INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H
#define INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H
#include <patlms/type/exception/exception.h>
namespace type
{
namespace exception
{
namespace detail
{
class DateParseException : public interface::Exception {
inline char const* what() const throw () override;
};
char const* DateParseException::what() const throw () {
return "Can't parse date";
}
}
}
}
#endif /* INCLUDE_PATLMS_EXCEPTION_DETAIL_DATE_PARSE_EXCEPTION_H */
|
Add Opus RTP payload format header | /*
* RTP Payload Format for the Opus Speech and Audio Codec
*/
#ifndef __BITSTREAM_IETF_RTP7587_H__
# define __BITSTREAM_IETF_RTP7587_H__
#define RTP_7587_CLOCKRATE 48000
#endif /* !__BITSTREAM_IETF_RTP7587_H__ */
| |
Add relational traces write vs mutex-meet example | // SKIP PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>
int g = 0;
int h = 0;
int i = 0;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; // h <= g
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER; // h == g
pthread_mutex_t C = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
int x, y, z;
pthread_mutex_lock(&C);
pthread_mutex_lock(&A);
x = g;
y = h;
assert(y <= x);
pthread_mutex_lock(&B);
assert(x == y); // TODO (mutex-meet succeeds, write unknown)
pthread_mutex_unlock(&B);
i = x + 31;
z = i;
assert(z >= x); // TODO (write succeeds, mutex-meet unknown)
pthread_mutex_unlock(&A);
pthread_mutex_unlock(&C);
return NULL;
}
int main(void) {
int x; // rand
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
pthread_mutex_lock(&B);
pthread_mutex_lock(&A);
i = 11;
g = x;
h = x - 17;
pthread_mutex_unlock(&A);
pthread_mutex_lock(&A);
h = x;
pthread_mutex_unlock(&A);
pthread_mutex_unlock(&B);
pthread_mutex_lock(&C);
i = 3;
pthread_mutex_unlock(&C);
return 0;
}
| |
Change dump power to 127 | void dc_dump() {
static int prev_l = 0, prev_r = 0;
if (!prev_l && vexRT[Btn7L])
dump_set(-80);
if (!prev_r && vexRT[Btn7R])
dump_set(80);
if ((prev_l && !vexRT[Btn7L]) || (prev_r && !vexRT[Btn7R]))
dump_set(0);
prev_l = vexRT[Btn7L];
prev_r = vexRT[Btn7R];
}
| void dc_dump() {
// TODO: Check direction and change to U and D
static int prev_l = 0, prev_r = 0;
if (!prev_l && vexRT[Btn7L])
dump_set(-127);
if (!prev_r && vexRT[Btn7R])
dump_set(127);
if ((prev_l && !vexRT[Btn7L]) || (prev_r && !vexRT[Btn7R]))
dump_set(0);
prev_l = vexRT[Btn7L];
prev_r = vexRT[Btn7R];
}
|
Introduce header for doing socket setup (useful for multicast). | /*
* sockcreate.h
* Copyright (C) 2009 Palo Alto Research Center, Inc. All rights reserved.
*/
struct sockaddr_storage;
struct sockaddr;
/**
* Holds a pair of socket file descriptors.
*
* Some platfoms/modes of operations require separate sockets for sending
* and receiving, so we accomodate that with this pairing. It is fine for
* the two file descriptors to be the same.
*/
struct ccn_sockets {
int recving;
int sending;
// flags?
};
struct ccn_sockdescr {
int ipproto; /**< as per http://www.iana.org/assignments/protocol-numbers -
should match IPPROTO_* in system headers */
const char *address; /**< acceptable to getaddrinfo */
const char *port; /**< service name or number */
const char *source_address; /**< may be needed for multicast */
int ttl; /**< may be needed for multicast */
};
/**
* Utility for setting up a socket (or pair of sockets) from a text-based
* description.
*
* @param
* @param logger should be used for reporting errors, printf-style
* @param logdat must be passed as first argument to logger()
* @param socks should be filled in with the pair of socket file descriptors
* @returns 0 for success, -1 for error
*/
int ccn_setup_socket(const struct ccn_sockdescr *descr,
(logger*)(void *, const char *, ...),
void *logdat,
struct ccn_sockets *socks);
| |
Add delegate for main view controller. | //
// ViewController.h
// PlayPlan
//
// Created by Zeacone on 15/10/25.
// Copyright © 2015年 Zeacone. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>
#import "PlayPlan.h"
#import "SideMenu.h"
@interface MainViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@end | //
// ViewController.h
// PlayPlan
//
// Created by Zeacone on 15/10/25.
// Copyright © 2015年 Zeacone. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>
#import "PlayPlan.h"
#import "SideMenu.h"
@class MainViewController;
@protocol MainDelegate <NSObject>
- (void)dismissViewController:(MainViewController *)mainViewController;
@end
@interface MainViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, assign) id<MainDelegate> delegate;
@end |
Add static helper to extract X509 from cert | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <folly/io/async/AsyncTransportCertificate.h>
#include <folly/portability/OpenSSL.h>
#include <folly/ssl/OpenSSLPtrTypes.h>
namespace folly {
/**
* Generic interface applications may implement to convey self or peer
* certificate related information.
*/
class OpenSSLTransportCertificate : public AsyncTransportCertificate {
public:
virtual ~OpenSSLTransportCertificate() = default;
// TODO: Once all callsites using getX509() perform dynamic casts to this
// OpenSSLTransportCertificate type, we can move that method to be declared
// here instead.
};
} // namespace folly
| /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <folly/io/async/AsyncTransportCertificate.h>
#include <folly/portability/OpenSSL.h>
#include <folly/ssl/OpenSSLPtrTypes.h>
namespace folly {
/**
* Generic interface applications may implement to convey self or peer
* certificate related information.
*/
class OpenSSLTransportCertificate : public AsyncTransportCertificate {
public:
virtual ~OpenSSLTransportCertificate() = default;
// TODO: Once all callsites using getX509() perform dynamic casts to this
// OpenSSLTransportCertificate type, we can move that method to be declared
// here instead.
static ssl::X509UniquePtr tryExtractX509(
const AsyncTransportCertificate* cert) {
auto opensslCert = dynamic_cast<const OpenSSLTransportCertificate*>(cert);
return opensslCert ? opensslCert->getX509() : nullptr;
}
};
} // namespace folly
|
Modify to work with dynamic class loader class. | #ifndef TEST_CASE_H
#define TEST_CASE_H
namespace fs_testing {
class test_case {
public:
virtual ~test_case() {};
virtual int setup() = 0;
virtual int run() = 0;
virtual int check_test() = 0;
};
typedef test_case* create_t();
typedef void destroy_t(test_case*);
} // namespace fs_testing
#endif
| #ifndef TEST_CASE_H
#define TEST_CASE_H
namespace fs_testing {
class test_case {
public:
virtual ~test_case() {};
virtual int setup() = 0;
virtual int run() = 0;
virtual int check_test() = 0;
};
typedef test_case* test_create_t();
typedef void test_destroy_t(test_case*);
} // namespace fs_testing
#endif
|
Add new member in MODBUSMasterStatus | //Declarations for master types
typedef enum
{
Register = 0
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)
typedef struct
{
uint8_t Address; //Device address
uint8_t Function; //Function called, in which exception occured
uint8_t Code; //Exception code
} MODBUSExceptionLog; //Parsed exception data
typedef struct
{
uint8_t Address; //Device address
MODBUSDataType DataType; //Data type
uint16_t Register; //Register, coil, input ID
uint16_t Value; //Value of data
} MODBUSData;
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Request frame content
} MODBUSRequestStatus; //Type containing information about frame that is set up at master side
typedef struct
{
MODBUSData *Data; //Data read from slave
MODBUSExceptionLog Exception; //Optional exception read
MODBUSRequestStatus Request; //Formatted request for slave
uint8_t DataLength; //Count of data type instances read from slave
uint8_t Error; //Have any error occured?
} MODBUSMasterStatus; //Type containing master device configuration data
| //Declarations for master types
typedef enum
{
Register = 0
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)
typedef struct
{
uint8_t Address; //Device address
uint8_t Function; //Function called, in which exception occured
uint8_t Code; //Exception code
} MODBUSExceptionLog; //Parsed exception data
typedef struct
{
uint8_t Address; //Device address
MODBUSDataType DataType; //Data type
uint16_t Register; //Register, coil, input ID
uint16_t Value; //Value of data
} MODBUSData;
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Request frame content
} MODBUSRequestStatus; //Type containing information about frame that is set up at master side
typedef struct
{
MODBUSData *Data; //Data read from slave
MODBUSExceptionLog Exception; //Optional exception read
MODBUSRequestStatus Request; //Formatted request for slave
uint8_t DataLength; //Count of data type instances read from slave
uint8_t Error; //Have any error occured?
uint8_t Finished; //Is parsing finished?
} MODBUSMasterStatus; //Type containing master device configuration data
|
Update method name in documentation | #import <Foundation/Foundation.h>
@interface NSProcessInfo (TDTEnvironmentDetection)
/**
Determine if the current process is running inside a unit test context.
Use case:
When running unit tests on iOS, it is not necessary to fully initialize the
application. The following check can be used to return early in the application
launch process:
\code
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(id)options {
#ifdef DEBUG
if ([[NSProcessInfo processInfo] isRunningTests]) return YES;
#endif
...
return YES;
}
\endcode
@return YES if the process has been invoked to run the XCTest bundle.
*/
@property (nonatomic, readonly) BOOL tdt_isRunningTests;
/**
Determine if a debugger is attached to the current process.
This can help decide, for example, whether to redirect standard error
(and hence, everything logged by @p TDTLog) to a file. Usually, when
a process is attached to a debugger, you do not want to redirect
standard error.
Source: Technical Q&A QA1361 "Detecting the Debugger"
@note This method relies on a public but unstable Apple API. It
should not be used in a release build.
*/
- (BOOL)tdt_isDebugged;
@end
| #import <Foundation/Foundation.h>
@interface NSProcessInfo (TDTEnvironmentDetection)
/**
Determine if the current process is running inside a unit test context.
Use case:
When running unit tests on iOS, it is not necessary to fully initialize the
application. The following check can be used to return early in the application
launch process:
\code
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(id)options {
#ifdef DEBUG
if ([[NSProcessInfo processInfo] tdt_isRunningTests]) return YES;
#endif
...
return YES;
}
\endcode
@return YES if the process has been invoked to run the XCTest bundle.
*/
@property (nonatomic, readonly) BOOL tdt_isRunningTests;
/**
Determine if a debugger is attached to the current process.
This can help decide, for example, whether to redirect standard error
(and hence, everything logged by @p TDTLog) to a file. Usually, when
a process is attached to a debugger, you do not want to redirect
standard error.
Source: Technical Q&A QA1361 "Detecting the Debugger"
@note This method relies on a public but unstable Apple API. It
should not be used in a release build.
*/
- (BOOL)tdt_isDebugged;
@end
|
Update RingOpenGL - Add Function (Source Code) : void glActiveTexture(GLenum texture) | #include "ring.h"
/*
OpenGL 2.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_FUNC(ring_glAccum)
{
if ( RING_API_PARACOUNT != 2 ) {
RING_API_ERROR(RING_API_MISS2PARA);
return ;
}
if ( ! RING_API_ISNUMBER(1) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return ;
}
if ( ! RING_API_ISNUMBER(2) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return ;
}
glAccum( (GLenum ) (int) RING_API_GETNUMBER(1), (GLfloat ) RING_API_GETNUMBER(2));
}
RING_API void ringlib_init(RingState *pRingState)
{
ring_vm_funcregister("glaccum",ring_glAccum);
}
| #include "ring.h"
/*
OpenGL 2.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_FUNC(ring_glAccum)
{
if ( RING_API_PARACOUNT != 2 ) {
RING_API_ERROR(RING_API_MISS2PARA);
return ;
}
if ( ! RING_API_ISNUMBER(1) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return ;
}
if ( ! RING_API_ISNUMBER(2) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return ;
}
glAccum( (GLenum ) (int) RING_API_GETNUMBER(1), (GLfloat ) RING_API_GETNUMBER(2));
}
RING_FUNC(ring_glActiveTexture)
{
if ( RING_API_PARACOUNT != 1 ) {
RING_API_ERROR(RING_API_MISS1PARA);
return ;
}
if ( ! RING_API_ISNUMBER(1) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return ;
}
glActiveTexture( (GLenum ) (int) RING_API_GETNUMBER(1));
}
RING_API void ringlib_init(RingState *pRingState)
{
ring_vm_funcregister("glaccum",ring_glAccum);
ring_vm_funcregister("glactivetexture",ring_glActiveTexture);
}
|
Add reading of geometrical parts. | /*! \file GeometricData.h Geometric data for robots when available.
Copyright (c) 2010
@author Olivier Stasse
JRL-Japan, CNRS/AIST
All rights reserved.
Please see License.txt for more informations on the license related to this software.
*/
#ifndef _DYNAMICS_JRL_JAPAN_GEOMETRIC_DATA_H_
#define _DYNAMICS_JRL_GEOMETRIC_DATA_H_
#if defined (WIN32)
# ifdef dynamicsJRLJapan_EXPORTS
# define DYN_JRL_JAPAN_EXPORT __declspec(dllexport)
# else
# define DYN_JRL_JAPAN_EXPORT __declspec(dllimport)
# endif
#else
# define DYN_JRL_JAPAN_EXPORT
#endif
#include <vector>
#include <string>
#include <MatrixAbstractLayer/MatrixAbstractLayer.h>
#include "robotDynamics/jrlHumanoidDynamicRobot.h"
#include "robotDynamics/jrlRobotDynamicsObjectConstructor.h"
namespace dynamicsJRLJapan
{
namespace Geometry
{
struct DYN_JRL_JAPAN_EXPORT Material
{
float ambientIntensity;
float diffuseColor[3];
float emissiveColor[3];
float specularColor[3];
float shininess[3];
float transparency;
Material():
ambientIntensity(0.2),
diffuseColor({0.8,0.8,0.8}),
emissiveColor({0.0,0.0,0.0}),
shininess({0.2}),
specularColor({0.0,0.0,0.0}),
transparency({0})
{};
};
struct DYN_JRL_JAPAN_EXPORT Texture
{
std::string FileName;
}
struct DYN_JRL_JAPAN_EXPORT TextureTransform
{
float center[2];
float rotation;
float scale[2];
float translation[2];
TextureTransform():
center({0.0,0.0}),
rotation(0),
scale({1.0,1.0}),
translation({0.0,0.0})
{};
}
class DYN_JRL_JAPAN_EXPORT Appearance
{
private:
Material m_Material;
Texture m_Texture;
TextureTransform m_TextureTransform;
public:
Appearance();
~Appearance();
/*! \name Setter and getters
@{
*/
void setMaterial(Material &aMaterial);
const Material &getMaterial() const;
void setTexture(Texture &aTexture);
const Texture &getTexture() const;
void setTextureTransform(TextureTransform &aTexture);
const TextureTransform &getTextureTransform() const;
/*! @} */
};
class DYN_JRL_JAPAN_EXPORT Shape
{
};
};
};
#endif /*! _DYNAMICS_JRL_GEOMETRIC_DATA_H_ */
| |
Fix compilation error with improved Optional. | #pragma once
#include <nucleus/optional.h>
#include "canvas/renderer/pipeline.h"
#include "canvas/renderer/vertex_definition.h"
#include "canvas/utils/shader_source.h"
namespace ca {
class Renderer;
class PipelineBuilder {
public:
explicit PipelineBuilder(Renderer* renderer);
PipelineBuilder& attribute(nu::StringView name, ComponentType type,
ComponentCount component_count);
PipelineBuilder& vertex_shader(ShaderSource source);
PipelineBuilder& geometry_shader(ShaderSource source);
PipelineBuilder& fragment_shader(ShaderSource source);
NU_NO_DISCARD nu::Optional<Pipeline> build() const;
private:
Renderer* renderer_;
VertexDefinition vertex_definition_;
nu::Optional<ShaderSource> vertex_shader_;
nu::Optional<ShaderSource> geometry_shader_;
nu::Optional<ShaderSource> fragment_shader_;
};
} // namespace ca
| #pragma once
#include <nucleus/optional.hpp>
#include "canvas/renderer/pipeline.h"
#include "canvas/renderer/vertex_definition.h"
#include "canvas/utils/shader_source.h"
namespace ca {
class Renderer;
class PipelineBuilder {
public:
explicit PipelineBuilder(Renderer* renderer);
PipelineBuilder& attribute(nu::StringView name, ComponentType type,
ComponentCount component_count);
PipelineBuilder& vertex_shader(ShaderSource source);
PipelineBuilder& geometry_shader(ShaderSource source);
PipelineBuilder& fragment_shader(ShaderSource source);
NU_NO_DISCARD nu::Optional<Pipeline> build() const;
private:
Renderer* renderer_;
VertexDefinition vertex_definition_;
nu::Optional<ShaderSource> vertex_shader_;
nu::Optional<ShaderSource> geometry_shader_;
nu::Optional<ShaderSource> fragment_shader_;
};
} // namespace ca
|
Fix asm label testcase flaw | // RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: not grep "@pipe()" %t
// RUN: grep '_thisIsNotAPipe' %t | count 3
// RUN: not grep 'g0' %t
// RUN: grep '_renamed' %t | count 2
// RUN: %clang_cc1 -DUSE_DEF -emit-llvm -o %t %s
// RUN: not grep "@pipe()" %t
// RUN: grep '_thisIsNotAPipe' %t | count 3
// <rdr://6116729>
void pipe() asm("_thisIsNotAPipe");
void f0() {
pipe();
}
void pipe(int);
void f1() {
pipe(1);
}
#ifdef USE_DEF
void pipe(int arg) {
int x = 10;
}
#endif
// PR3698
extern int g0 asm("_renamed");
int f2() {
return g0;
}
| // RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: not grep "@pipe()" %t
// RUN: grep '_thisIsNotAPipe' %t | count 3
// RUN: not grep '@g0' %t
// RUN: grep '_renamed' %t | count 2
// RUN: %clang_cc1 -DUSE_DEF -emit-llvm -o %t %s
// RUN: not grep "@pipe()" %t
// RUN: grep '_thisIsNotAPipe' %t | count 3
// <rdr://6116729>
void pipe() asm("_thisIsNotAPipe");
void f0() {
pipe();
}
void pipe(int);
void f1() {
pipe(1);
}
#ifdef USE_DEF
void pipe(int arg) {
int x = 10;
}
#endif
// PR3698
extern int g0 asm("_renamed");
int f2() {
return g0;
}
|
Add sample code to get efivar |
#include <efivar.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
efi_guid_t guid = EFI_GLOBAL_GUID;
const char* name = "BootCurrent";
uint8_t *data;
size_t data_size;
uint32_t attr;
int res = efi_get_variable(guid, name, &data, &data_size, &attr);
if (res < 0) {
perror("efi_get_variable");
exit(1);
}
printf("data_size: %zu\n", data_size);
return 0;
}
| |
Add example containing infinite loop with assert | // PARAM: --sets solver td3 --enable ana.int.interval --disable ana.int.def_exc --set ana.activated "['base']"
// This is a pattern we saw in some examples for SVCOMP, where instead of the assert(0) there was a call to verifier error.
// Because of the demand-driven nature of our solvers, we never looked at the code inside fail since there is no edge from the loop to the endpoint of f.
// However, the assert(0) (verifier error) is still rechable from main.
void f(void) {
fail:
assert(0); //FAIL
goto fail;
}
int main(void) {
int top;
if(top) {
f();
}
}
| |
Modify the instance getter of DataStore to public | #pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_
#include <memory>
#include "task_typedefs.h"
#include "transaction.h"
namespace You {
namespace DataStore {
namespace UnitTests {}
class DataStore {
public:
Transaction && begin();
// Modifying methods
void post(TaskId, SerializedTask&);
void put(TaskId, SerializedTask&);
void erase(TaskId);
std::vector<SerializedTask> getAllTask();
private:
static DataStore& get();
bool isServing = false;
};
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_DATASTORE_H_
| #pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_
#include <memory>
#include "task_typedefs.h"
#include "transaction.h"
namespace You {
namespace DataStore {
namespace UnitTests {}
class DataStore {
public:
Transaction && begin();
static DataStore& get();
// Modifying methods
void post(TaskId, SerializedTask&);
void put(TaskId, SerializedTask&);
void erase(TaskId);
std::vector<SerializedTask> getAllTask();
private:
bool isServing = false;
};
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_DATASTORE_H_
|
Change the way execution results are collected. | #pragma once
#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
namespace dev
{
namespace eth
{
class JitVM: public VMFace
{
public:
virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final;
private:
jit::RuntimeData m_data;
jit::ExecutionEngine m_engine;
std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};
}
}
| #pragma once
#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
namespace dev
{
namespace eth
{
class JitVM: public VMFace
{
public:
virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) override final;
private:
jit::RuntimeData m_data;
jit::ExecutionEngine m_engine;
std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};
}
}
|
Add headers for setting and getting continuous rendering state | #pragma once
#ifdef PLATFORM_ANDROID
struct _JNIEnv;
typedef _JNIEnv JNIEnv;
class _jobject;
typedef _jobject* jobject;
void jniInit(JNIEnv* _jniEnv, jobject obj, jobject _assetManager);
#endif
#if (defined PLATFORM_IOS) && (defined __OBJC__)
#import "ViewController.h"
void setViewController(ViewController* _controller);
#endif
#include <string>
/* Print a formatted message to the console
*
* Uses printf syntax to write a string to stderr (or logcat, on Android)
*/
void logMsg(const char* fmt, ...);
/* Request that a new frame be rendered by the windowing system
*/
void requestRender();
/* Read a bundled resource file as a string
*
* Opens the file at the given relative path and returns a string with its contents.
* _path is the location of the file within the core/resources folder. If the file
* cannot be found or read, the returned string is empty.
*/
std::string stringFromResource(const char* _path);
/* Read and allocates size bytes of memory
*
* Similarly to stringFromResource, _path is the location of file within
* core/resources. If the file cannot be read nothing is allocated and
* a nullptr is returned.
* _size is is an in/out parameter to retrieve the size in bytes of the
* allocated file
*/
unsigned char* bytesFromResource(const char* _path, unsigned int* _size);
| #pragma once
#ifdef PLATFORM_ANDROID
struct _JNIEnv;
typedef _JNIEnv JNIEnv;
class _jobject;
typedef _jobject* jobject;
void jniInit(JNIEnv* _jniEnv, jobject obj, jobject _assetManager);
#endif
#if (defined PLATFORM_IOS) && (defined __OBJC__)
#import "ViewController.h"
void setViewController(ViewController* _controller);
#endif
#include <string>
/* Print a formatted message to the console
*
* Uses printf syntax to write a string to stderr (or logcat, on Android)
*/
void logMsg(const char* fmt, ...);
/* Request that a new frame be rendered by the windowing system
*/
void requestRender();
/* If called with 'true', the windowing system will re-draw frames continuously;
* otherwise new frames will only be drawn when 'requestRender' is called.
*/
void setContinuousRendering(bool _isContinuous);
bool isContinuousRendering();
/* Read a bundled resource file as a string
*
* Opens the file at the given relative path and returns a string with its contents.
* _path is the location of the file within the core/resources folder. If the file
* cannot be found or read, the returned string is empty.
*/
std::string stringFromResource(const char* _path);
/* Read and allocates size bytes of memory
*
* Similarly to stringFromResource, _path is the location of file within
* core/resources. If the file cannot be read nothing is allocated and
* a nullptr is returned.
* _size is is an in/out parameter to retrieve the size in bytes of the
* allocated file
*/
unsigned char* bytesFromResource(const char* _path, unsigned int* _size);
|
Include logger.h later to prevent using SystemLog before definition | /*
* system_log.h
*
* Author: Ming Tsang
* Copyright (c) 2014 Ming Tsang
* Refer to LICENSE for details
*/
#pragma once
#include "libutils/io/logger.h"
#include "libutils/misc/singleton.h"
namespace libutils
{
namespace io
{
/**
* The default system logger
*/
template<typename CharT>
class SystemLog : public misc::Singleton<Logger<CharT>, SystemLog<CharT>>
{};
}
}
| /*
* system_log.h
*
* Author: Ming Tsang
* Copyright (c) 2014 Ming Tsang
* Refer to LICENSE for details
*/
#pragma once
#include "libutils/misc/singleton.h"
namespace libutils
{
namespace io
{
template<typename T> class Logger;
}
}
namespace libutils
{
namespace io
{
/**
* The default system logger
*/
template<typename CharT>
class SystemLog : public misc::Singleton<Logger<CharT>, SystemLog<CharT>>
{};
}
}
#include "libutils/io/logger.h"
|
Add GTMKeychain.h to umbrella header | /*! @file GTMAppAuth.h
@brief GTMAppAuth SDK
@copyright
Copyright 2016 Google Inc.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"
#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS
#import "GTMOAuth2KeychainCompatibility.h"
#elif TARGET_OS_MAC
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif
| /*! @file GTMAppAuth.h
@brief GTMAppAuth SDK
@copyright
Copyright 2016 Google Inc.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "GTMAppAuthFetcherAuthorization.h"
#import "GTMAppAuthFetcherAuthorization+Keychain.h"
#import "GTMKeychain.h"
#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS
#import "GTMOAuth2KeychainCompatibility.h"
#elif TARGET_OS_MAC
#import "GTMOAuth2KeychainCompatibility.h"
#else
#warn "Platform Undefined"
#endif
|
Fix compilation for MinGW, remove redundant class name on inline member | //===-- NativeRegisterContextWindows.h --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_NativeRegisterContextWindows_h_
#define liblldb_NativeRegisterContextWindows_h_
#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/Utility/DataBufferHeap.h"
namespace lldb_private {
class NativeThreadWindows;
class NativeRegisterContextWindows : public NativeRegisterContextRegisterInfo {
public:
NativeRegisterContextWindows::NativeRegisterContextWindows(
NativeThreadProtocol &native_thread,
RegisterInfoInterface *reg_info_interface_p);
static std::unique_ptr<NativeRegisterContextWindows>
CreateHostNativeRegisterContextWindows(const ArchSpec &target_arch,
NativeThreadProtocol &native_thread);
protected:
lldb::thread_t GetThreadHandle() const;
};
} // namespace lldb_private
#endif // liblldb_NativeRegisterContextWindows_h_
| //===-- NativeRegisterContextWindows.h --------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_NativeRegisterContextWindows_h_
#define liblldb_NativeRegisterContextWindows_h_
#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/Utility/DataBufferHeap.h"
namespace lldb_private {
class NativeThreadWindows;
class NativeRegisterContextWindows : public NativeRegisterContextRegisterInfo {
public:
NativeRegisterContextWindows(
NativeThreadProtocol &native_thread,
RegisterInfoInterface *reg_info_interface_p);
static std::unique_ptr<NativeRegisterContextWindows>
CreateHostNativeRegisterContextWindows(const ArchSpec &target_arch,
NativeThreadProtocol &native_thread);
protected:
lldb::thread_t GetThreadHandle() const;
};
} // namespace lldb_private
#endif // liblldb_NativeRegisterContextWindows_h_
|
Add a debug statement so accesses to bad register numbers can be seen with debugging enabled. | /* libunwind - a platform-independent unwind library
Copyright (C) 2002 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
HIDDEN int
x86_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
int write)
{
struct x86_loc loc = X86_LOC (0, 0);
switch (reg)
{
case UNW_X86_EIP:
if (write)
c->eip = *valp; /* also update the EIP cache */
loc = c->eip_loc;
break;
case UNW_X86_ESP:
if (write)
return -UNW_EREADONLYREG;
*valp = c->esp;
return 0;
default:
debug (1, "%s: bad register number %u\n", __FUNCTION__, reg);
return -UNW_EBADREG;
}
if (write)
return x86_put (c, loc, *valp);
else
return x86_get (c, loc, valp);
}
| |
Fix signed vs unsigned issue | // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_FLIP_FLIP_BITMASKS_H_
#define NET_FLIP_FLIP_BITMASKS_H_
namespace flip {
const int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader
const int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader
const int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME
const int kLengthMask = 0xffffff; // Mask the lower 24 bits.
} // flip
#endif // NET_FLIP_FLIP_BITMASKS_H_
| // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_FLIP_FLIP_BITMASKS_H_
#define NET_FLIP_FLIP_BITMASKS_H_
namespace flip {
const unsigned int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader
const unsigned int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader
const unsigned int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME
const unsigned int kLengthMask = 0xffffff; // Mask the lower 24 bits.
} // flip
#endif // NET_FLIP_FLIP_BITMASKS_H_
|
Simplify docs for nilValue / notNilValue | //
// OCHamcrest - HCIsNil.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//
#import <OCHamcrest/HCBaseMatcher.h>
/**
Is the value @c nil?
@b Factory: @ref nilValue, @ref notNilValue
@ingroup object_matchers
*/
@interface HCIsNil : HCBaseMatcher
+ (id)isNil;
@end
#pragma mark -
/**
Matches if the value is @c nil.
@b Synonym: @ref nilValue
@see HCIsNil
@ingroup object_matchers
*/
OBJC_EXPORT id<HCMatcher> HC_nilValue();
/**
Matches if the value is @c nil.
Synonym for @ref HC_nilValue, available if @c HC_SHORTHAND is defined.
@see HCIsNil
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define nilValue() HC_nilValue()
#endif
/**
Matches if the value is not @c nil.
@b Synonym: @ref notNilValue
@see HCIsNil
@see HCIsNot
@ingroup object_matchers
*/
OBJC_EXPORT id<HCMatcher> HC_notNilValue();
/**
Matches if the value is not @c nil.
Synonym for @ref HC_notNilValue, available if @c HC_SHORTHAND is defined.
@see HCIsNil
@see HCIsNot
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define notNilValue() HC_notNilValue()
#endif
| //
// OCHamcrest - HCIsNil.h
// Copyright 2011 hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//
#import <OCHamcrest/HCBaseMatcher.h>
@interface HCIsNil : HCBaseMatcher
+ (id)isNil;
@end
OBJC_EXPORT id<HCMatcher> HC_nilValue();
/**
Matches if the value is @c nil.
In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_nilValue instead.
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define nilValue() HC_nilValue()
#endif
OBJC_EXPORT id<HCMatcher> HC_notNilValue();
/**
Matches if the value is not @c nil.
In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
@c HC_notNilValue instead.
@ingroup object_matchers
*/
#ifdef HC_SHORTHAND
#define notNilValue() HC_notNilValue()
#endif
|
Extend the packet ringbuffer to have address stamps | #ifndef _PACKETQUEUE_H
#define _PACKETQUEUE_H 1
#include <libsvc/thread.h>
#include <libsvc/transport.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct pktbuf_s {
uint8_t pkt[4096];
} pktbuf;
typedef struct packetqueue_s {
thread super;
pthread_mutexattr_t mattr;
pthread_mutex_t mutex;
pthread_cond_t cond;
intransport *trans;
pktbuf *buffer;
size_t sz;
volatile size_t rpos;
volatile size_t wpos;
} packetqueue;
thread *packetqueue_create (size_t qcount, intransport *producer);
#endif
| #ifndef _PACKETQUEUE_H
#define _PACKETQUEUE_H 1
#include <libsvc/thread.h>
#include <libsvc/transport.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct pktbuf_s {
uint8_t pkt[4096];
struct sockaddr_storage addr;
} pktbuf;
typedef struct packetqueue_s {
thread super;
pthread_mutexattr_t mattr;
pthread_mutex_t mutex;
pthread_cond_t cond;
intransport *trans;
pktbuf *buffer;
size_t sz;
volatile size_t rpos;
volatile size_t wpos;
} packetqueue;
thread *packetqueue_create (size_t qcount, intransport *producer);
#endif
|
Add smart pointer for COM interfaces | /*
MIT License
Copyright (c) 2017 Eren Okka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include <memory>
#include <windows.h>
namespace anisthesia {
namespace win {
struct HandleDeleter {
using pointer = HANDLE;
void operator()(HANDLE handle) { ::CloseHandle(handle); }
};
using Handle = std::unique_ptr<HANDLE, HandleDeleter>;
} // namespace win
} // namespace anisthesia
| /*
MIT License
Copyright (c) 2017 Eren Okka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include <memory>
#include <type_traits>
#include <windows.h>
namespace anisthesia {
namespace win {
struct HandleDeleter {
using pointer = HANDLE;
void operator()(pointer p) const { ::CloseHandle(p); }
};
using Handle = std::unique_ptr<HANDLE, HandleDeleter>;
////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct ComInterfaceDeleter {
static_assert(std::is_base_of<IUnknown, T>::value, "Invalid COM interface");
using pointer = T*;
void operator()(pointer p) const { if (p) p->Release(); }
};
template <typename T>
using ComInterface = std::unique_ptr<T, ComInterfaceDeleter<T>>;
} // namespace win
} // namespace anisthesia
|
Increment version number from 1.50b to 1.51 | #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.50f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
#define VERSION_SUFFIX 'b'
| #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.51f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'
|
Revert "Remove public headers from umbrella header" | #import <Foundation/Foundation.h>
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
| #import <Foundation/Foundation.h>
#import <Nimble/NMBExceptionCapture.h>
#import <Nimble/DSL.h>
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
|
Remove obsolete includes in TKernel precompiled | #pragma once
#include <string>
#include <iostream>
#include <math.h>
#include "Standard.hxx"
#include "Standard_PrimitiveTypes.hxx"
#include "Standard_Stream.hxx"
#include "Standard_Failure.hxx"
#include "Standard_Transient.hxx"
#ifdef USE_STL_STREAM
#include <sstream>
#else /* USE_STL_STREAM */
#ifdef WNT
#include <strstrea.h>
#else
#include <strstream.h>
#endif
#endif
| #pragma once
#include <string>
#include <iostream>
#include <math.h>
#include "Standard.hxx"
#include "Standard_PrimitiveTypes.hxx"
#include "Standard_Stream.hxx"
#include "Standard_Failure.hxx"
#include "Standard_Transient.hxx"
|
Fix import of removed file | //
// OCATransformer.h
// Objective-Chain
//
// Created by Martin Kiss on 31.12.13.
// Copyright © 2014 Martin Kiss. All rights reserved.
//
#import "OCATransformer+Base.h"
#import "OCATransformer+Nil.h"
#import "OCATransformer+Predefined.h"
| //
// OCATransformer.h
// Objective-Chain
//
// Created by Martin Kiss on 31.12.13.
// Copyright © 2014 Martin Kiss. All rights reserved.
//
#import "OCATransformer+Base.h"
#import "OCATransformer+Predefined.h"
|
Move KHEAP macros into memlayout.h | #ifndef KMEM_H
#define KMEM_H
#include <stdbool.h>
#include <stdint.h>
#include <arch/x86/paging.h>
#include <libk/kabort.h>
#define KHEAP_PHYS_ROOT ((void*)0x100000)
//#define KHEAP_PHYS_END ((void*)0xc1000000)
#define KHEAP_END_SENTINEL (NULL)
#define KHEAP_BLOCK_SLOP 32
struct kheap_metadata {
size_t size;
struct kheap_metadata *next;
bool is_free;
};
struct kheap_metadata *root;
struct kheap_metadata *kheap_init();
int kheap_extend();
void kheap_install(struct kheap_metadata *root, size_t initial_heap_size);
void *kmalloc(size_t bytes);
void kfree(void *mem);
void kheap_defragment();
#endif
| #ifndef KMEM_H
#define KMEM_H
#include <stdbool.h>
#include <stdint.h>
#include <arch/x86/paging.h>
#include <arch/x86/memlayout.h>
#include <libk/kabort.h>
// KHEAP_PHYS_ROOT is defined in memlayout.h because it is architecture
// specific.
#define KHEAP_END_SENTINEL (NULL)
#define KHEAP_BLOCK_SLOP 32
struct kheap_metadata {
size_t size;
struct kheap_metadata *next;
bool is_free;
};
struct kheap_metadata *root;
struct kheap_metadata *kheap_init();
int kheap_extend();
void kheap_install(struct kheap_metadata *root, size_t initial_heap_size);
void *kmalloc(size_t bytes);
void kfree(void *mem);
void kheap_defragment();
#endif
|
Rename LOread() and LOwrite() to be lower case to allow use in case-insensitive SQL. Define LOread() and LOwrite() as macros to avoid having to update calls everywhere. | /*-------------------------------------------------------------------------
*
* be-fsstubs.h--
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: be-fsstubs.h,v 1.1 1996/08/28 07:22:56 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef BE_FSSTUBS_H
#define BE_FSSTUBS_H
extern Oid lo_import(text *filename);
extern int4 lo_export(Oid lobjId, text *filename);
extern Oid lo_creat(int mode);
extern int lo_open(Oid lobjId, int mode);
extern int lo_close(int fd);
extern int lo_read(int fd, char *buf, int len);
extern int lo_write(int fd, char *buf, int len);
extern int lo_lseek(int fd, int offset, int whence);
extern int lo_tell(int fd);
extern int lo_unlink(Oid lobjId);
extern struct varlena *LOread(int fd, int len);
extern int LOwrite(int fd, struct varlena *wbuf);
#endif /* BE_FSSTUBS_H */
| /*-------------------------------------------------------------------------
*
* be-fsstubs.h--
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: be-fsstubs.h,v 1.2 1997/05/06 07:14:34 thomas Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef BE_FSSTUBS_H
#define BE_FSSTUBS_H
/* Redefine names LOread() and LOwrite() to be lowercase to allow calling
* using the new v6.1 case-insensitive SQL parser. Define macros to allow
* the existing code to stay the same. - tgl 97/05/03
*/
#define LOread(f,l) loread(f,l)
#define LOwrite(f,b) lowrite(f,b)
extern Oid lo_import(text *filename);
extern int4 lo_export(Oid lobjId, text *filename);
extern Oid lo_creat(int mode);
extern int lo_open(Oid lobjId, int mode);
extern int lo_close(int fd);
extern int lo_read(int fd, char *buf, int len);
extern int lo_write(int fd, char *buf, int len);
extern int lo_lseek(int fd, int offset, int whence);
extern int lo_tell(int fd);
extern int lo_unlink(Oid lobjId);
extern struct varlena *loread(int fd, int len);
extern int lowrite(int fd, struct varlena *wbuf);
#endif /* BE_FSSTUBS_H */
|
Add checks to regression tests that unknown pointers and string pointers may be equal | #include <assert.h>
#include <stdlib.h>
int main(){
char* str = "Hello";
char* str2 = "Hello";
char* str3 = "hi";
char* str4 = "other string";
// Unknown since the there may be multiple copies of the same string
__goblint_check(str != str2); // UNKNOWN!
__goblint_check(str == str);
__goblint_check(str != str3);
char *ptr = NULL;
int top = rand();
if(top){
ptr = str2;
} else {
ptr = str3;
}
__goblint_check(*ptr == *str); //UNKNOWN
// This is unknwon due to only keeping one string pointer in abstract address sets
__goblint_check(*ptr == *str4); //UNKNOWN
return 0;
}
| #include <assert.h>
#include <stdlib.h>
int main(){
char* str = "Hello";
char* str2 = "Hello";
char* str3 = "hi";
char* str4 = "other string";
// Unknown since the there may be multiple copies of the same string
__goblint_check(str != str2); // UNKNOWN!
__goblint_check(str == str);
__goblint_check(str != str3);
char *ptr = NULL;
int top = rand();
if(top){
ptr = str2;
} else {
ptr = str3;
}
__goblint_check(*ptr == *str); //UNKNOWN
// This is unknwon due to only keeping one string pointer in abstract address sets
__goblint_check(*ptr == *str4); //UNKNOWN
char *ptr2 = unknown_function();
__goblint_check(ptr == ptr2); //UNKNOWN
__goblint_check(ptr2 == str); //UNKNOWN
return 0;
}
|
Remove Eigen/Dense include in type header | #pragma once
#include <Eigen/Dense>
namespace model {
#if BICYCLE_USE_DOUBLE_PRECISION_REAL
using real_t = double;
#else
using real_t = float;
#endif
} // namespace model
| #pragma once
namespace model {
#if BICYCLE_USE_DOUBLE_PRECISION_REAL
using real_t = double;
#else
using real_t = float;
#endif
} // namespace model
|
Make unpack_trees_options bit flags actual bitfields | #ifndef UNPACK_TREES_H
#define UNPACK_TREES_H
#define MAX_UNPACK_TREES 8
struct unpack_trees_options;
typedef int (*merge_fn_t)(struct cache_entry **src,
struct unpack_trees_options *options);
struct unpack_trees_options {
int reset;
int merge;
int update;
int index_only;
int nontrivial_merge;
int trivial_merges_only;
int verbose_update;
int aggressive;
int skip_unmerged;
int gently;
const char *prefix;
int pos;
struct dir_struct *dir;
merge_fn_t fn;
int head_idx;
int merge_size;
struct cache_entry *df_conflict_entry;
void *unpack_data;
struct index_state *dst_index;
const struct index_state *src_index;
struct index_state result;
};
extern int unpack_trees(unsigned n, struct tree_desc *t,
struct unpack_trees_options *options);
int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
#endif
| #ifndef UNPACK_TREES_H
#define UNPACK_TREES_H
#define MAX_UNPACK_TREES 8
struct unpack_trees_options;
typedef int (*merge_fn_t)(struct cache_entry **src,
struct unpack_trees_options *options);
struct unpack_trees_options {
unsigned int reset:1,
merge:1,
update:1,
index_only:1,
nontrivial_merge:1,
trivial_merges_only:1,
verbose_update:1,
aggressive:1,
skip_unmerged:1,
gently:1;
const char *prefix;
int pos;
struct dir_struct *dir;
merge_fn_t fn;
int head_idx;
int merge_size;
struct cache_entry *df_conflict_entry;
void *unpack_data;
struct index_state *dst_index;
const struct index_state *src_index;
struct index_state result;
};
extern int unpack_trees(unsigned n, struct tree_desc *t,
struct unpack_trees_options *options);
int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
#endif
|
Add slash = / to warning message | reference(citation): URLcheck
If [ $$stopFileNameCheck = 1 ]
Exit Script [ ]
End If
If [ Filter ( reference::fileName ; "?" ) = "?" or
Filter ( reference::fileName ; "#" ) = "#" or
Filter ( reference::fileName ; ";" ) = ";" or
Filter ( reference::fileName ; ":" ) = ":" ]
Show Custom Dialog [ Message: "These special characters ? # ; : prevent the system from opening files. Remove them from your filename and then test the 'file' button above to insure it opens your file."; Buttons: “OK” ]
Go to Field [ reference::fileName ]
End If
January 7, 平成26 17:54:06 Imagination Quality Management.fp7 - URLcheck -1-
| reference(citation): URLcheck
If [ $$stopFileNameCheck = 1 ]
Exit Script [ ]
End If
If [ Filter ( reference::fileName ; "?" ) = "?" or
Filter ( reference::fileName ; "#" ) = "#" or
Filter ( reference::fileName ; ";" ) = ";" or
Filter ( reference::fileName ; "/" ) = "/" or
Filter ( reference::fileName ; ":" ) = ":" ]
Show Custom Dialog [ Message: "These special characters ? # / ; : prevent the system from opening files. Remove them from your filename and then test the 'file' button above to insure it opens your file."; Buttons: “OK” ]
Go to Field [ reference::fileName ]
End If
April 26, 平成26 14:17:47 Imagination Quality Management.fp7 - URLcheck -1- |
Update name of null state to match Android | //
// ApptentiveConversationMetadataItem.h
// Apptentive
//
// Created by Frank Schmitt on 2/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, ApptentiveConversationState) {
ApptentiveConversationStateNone = 0,
ApptentiveConversationStateAnonymousPending,
ApptentiveConversationStateAnonymous,
ApptentiveConversationStateLoggedIn,
ApptentiveConversationStateLoggedOut
};
@interface ApptentiveConversationMetadataItem : NSObject <NSSecureCoding>
- (instancetype)initWithConversationIdentifier:(NSString *)conversationIdentifier filename:(NSString *)filename;
@property (assign, nonatomic) ApptentiveConversationState state;
@property (strong, nonatomic) NSString *conversationIdentifier;
@property (strong, nonatomic) NSString *fileName;
@end
| //
// ApptentiveConversationMetadataItem.h
// Apptentive
//
// Created by Frank Schmitt on 2/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, ApptentiveConversationState) {
ApptentiveConversationStateUndefined = 0,
ApptentiveConversationStateAnonymousPending,
ApptentiveConversationStateAnonymous,
ApptentiveConversationStateLoggedIn,
ApptentiveConversationStateLoggedOut
};
@interface ApptentiveConversationMetadataItem : NSObject <NSSecureCoding>
- (instancetype)initWithConversationIdentifier:(NSString *)conversationIdentifier filename:(NSString *)filename;
@property (assign, nonatomic) ApptentiveConversationState state;
@property (strong, nonatomic) NSString *conversationIdentifier;
@property (strong, nonatomic) NSString *fileName;
@end
|
Remove HAVE_USAGE because it is no longer used. | # define USE_POSIX_TIME
# define USE_POSIX_SIGNALS
# define NO_EMPTY_STMTS
# define SYSV_DIRENT
# define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#include <sys/isa_defs.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef PDP_ENDIAN
#define PDP_ENDIAN 3412
#endif
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#ifndef NAN
#ifndef __nan_bytes
#define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif /* __nan_bytes */
#ifdef __GNUC__
#define NAN \
(__extension__ ((union { unsigned char __c[8]; \
double __d; }) \
{ __nan_bytes }).__d)
#else /* Not GCC. */
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
#endif /* NAN */
#ifndef index
#define index strchr
#endif
#ifndef HAVE_RUSAGE
#define HAVE_RUSAGE 1
#endif
| # define USE_POSIX_TIME
# define USE_POSIX_SIGNALS
# define NO_EMPTY_STMTS
# define SYSV_DIRENT
# define HAS_TEST_AND_SET
typedef unsigned char slock_t;
#include <sys/isa_defs.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef PDP_ENDIAN
#define PDP_ENDIAN 3412
#endif
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#ifndef NAN
#ifndef __nan_bytes
#define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif /* __nan_bytes */
#ifdef __GNUC__
#define NAN \
(__extension__ ((union { unsigned char __c[8]; \
double __d; }) \
{ __nan_bytes }).__d)
#else /* Not GCC. */
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
#endif /* NAN */
#ifndef index
#define index strchr
#endif
|
Enable C++ support for socket debug transport | #if !defined(DUK_TRANS_SOCKET_H_INCLUDED)
#define DUK_TRANS_SOCKET_H_INCLUDED
#include "duktape.h"
void duk_trans_socket_init(void);
void duk_trans_socket_finish(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);
#endif /* DUK_TRANS_SOCKET_H_INCLUDED */
| #if !defined(DUK_TRANS_SOCKET_H_INCLUDED)
#define DUK_TRANS_SOCKET_H_INCLUDED
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
void duk_trans_socket_init(void);
void duk_trans_socket_finish(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_TRANS_SOCKET_H_INCLUDED */
|
Add a programatic interface to intrinsic names. | //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions. Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INTRINSICS_H
#define LLVM_INTRINSICS_H
namespace llvm {
/// Intrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM. These enum values are
/// returned by Function::getIntrinsicID().
///
namespace Intrinsic {
enum ID {
not_intrinsic = 0, // Must be zero
// Get the intrinsic enums generated from Intrinsics.td
#define GET_INTRINSIC_ENUM_VALUES
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_ENUM_VALUES
};
} // End Intrinsic namespace
} // End llvm namespace
#endif
| //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions. Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INTRINSICS_H
#define LLVM_INTRINSICS_H
namespace llvm {
/// Intrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM. These enum values are
/// returned by Function::getIntrinsicID().
///
namespace Intrinsic {
enum ID {
not_intrinsic = 0, // Must be zero
// Get the intrinsic enums generated from Intrinsics.td
#define GET_INTRINSIC_ENUM_VALUES
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_ENUM_VALUES
, num_intrinsics
};
/// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as
/// "llvm.ppc.altivec.lvx".
const char *getName(ID id);
} // End Intrinsic namespace
} // End llvm namespace
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.