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

Work around ppc64 compiler bug

[PATCH] Work around ppc64 compiler bug

In the process of optimising our per cpu data code, I found a ppc64
compiler bug that has been around forever. Basically the current
RELOC_HIDE can end up trashing r30. Details of the bug can be found at

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25572

This bug is present in all compilers before 4.1. It is masked by the
fact that our current per cpu data code is inefficient and causes
other loads that end up marking r30 as used.

A workaround identified by Alan Modra is to use the =r asm constraint
instead of =g.

Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org>
[ Verified that this makes no real difference on x86[-64] */
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>


// 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 (deactivated) refinement test for interval/congruence domain


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

Add connection and response to cursors.

Add connection and response to cursors.


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

Fix compilation fo the test runner on Windows

Patch by Stephen Hewitt

git-svn-id: 7928e23e4d58c5ca14aa7b47c53aeff82ee1dd0c@1078612 283d02a7-25f6-0310-bc7c-ecb5cbfe19da


#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

Update GPUImageFillModeType enum to use NS_ENUM


/**
 * Copyright (c) 2013-2014 Tomas Dzetkulic
 * Copyright (c) 2013-2014 Pavol Rusnak
 *
 * 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.
 */

#ifndef __RAND_H__
#define __RAND_H__

#include <stdint.h>

void init_rand(void);
int finalize_rand(void);
uint32_t random32(void);
void random_buffer(uint8_t *buf, size_t len);

#endif

/**
 * Copyright (c) 2013-2014 Tomas Dzetkulic
 * Copyright (c) 2013-2014 Pavol Rusnak
 *
 * 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.
 */

#ifndef __RAND_H__
#define __RAND_H__

#include <stdlib.h>
#include <stdint.h>

void init_rand(void);
int finalize_rand(void);
uint32_t random32(void);
void random_buffer(uint8_t *buf, size_t len);

#endif

Add `stdlib.h` to header. Needed for `size_t`.


#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 some hashing utility functions

Add some hashing utility functions


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

Add `heap_len` and `heap_cap` to example


/**
 * 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 license in comment header.

Fix license in comment header.

Signed-off-by: Dan Dennedy <2591e5f46f28d303f9dc027d475a5c60d8dea17a@dennedy.org>


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

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

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

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS
  #define SK_SUPPORT_LEGACY_DRAWLOOPER

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

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

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

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

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

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS
  #define SK_SUPPORT_LEGACY_DRAWLOOPER
  #define SK_IGNORE_LINEAR_METRICS_FIX

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

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

Add SK_IGNORE_LINEAR_METRICS_FIX flag for Skia.

This will hold out a Skia change to glyph metric calculation until the
framework can be updated to handle it.

Test: Adds build flag, does nothing right now.
Change-Id: Ibce90e396002ea493cdf545857e0b84f13738ff6


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

Fix potential data corruption bug

Fix potential data corruption bug


// This file is part of UDPipe <http://github.com/ufal/udpipe/>.
//
// Copyright 2016 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <sstream>
#include <stdexcept>

#include "common.h"

namespace ufal {
namespace udpipe {

class training_error : public runtime_error {
 public:
  training_error();

  static ostringstream message_collector;
};

#define training_failure(message) throw (training_error::message_collector << message, training_error())

} // namespace udpipe
} // namespace ufal

// This file is part of UDPipe <http://github.com/ufal/udpipe/>.
//
// Copyright 2016 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <sstream>
#include <stdexcept>

#include "common.h"

namespace ufal {
namespace udpipe {
namespace utils {

class training_error : public runtime_error {
 public:
  training_error();

  static ostringstream message_collector;
};

#define training_failure(message) throw (training_error::message_collector << message, training_error())

} // namespace utils
} // namespace udpipe
} // namespace ufal

Add training_error to utils namespace.

Add training_error to utils namespace.

The training_error is used by binary_encoder, which includes only
utils/common.h -- that opens std only in utils namespace, not in
whole ufal::udpipe.


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

Update the test to listen for brightness changed.


// 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 lvalue-argument function inlinling


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

Test for queue using array

Test for queue using array


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

Add normal information to terrain.

Add normal information to terrain.


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

Support nullable Item sourceView in Swift.


#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

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


#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

Define interface for data reader and writer objects

Also declare functions for  data import and export


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

Set empty texture default to transparent


#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

Remove the dll export flag

Remove the dll export flag


/* 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 C++14 and Lua version properly


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

Check for gtk version below 2.21.1 for comptability with gseal changes


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

Update the version a tick so that we can tell who has the recently
committed critical fixes.

svn path=/trunk/kdepim/; revision=285464


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

Fix warning from gcc4 (Laurent)

Fix warning from gcc4
(Laurent)


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

Increase version number of merge into master


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

Remove the templated copyright statement


#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

Make cardinal directions rely on VoxelUtils.


#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 printf module into libocl

Add printf module into libocl

Signed-off-by: Junyan He <8f73a735c668918c9613b750d3a88ebf2489599f@linux.intel.com>
Reviewed-by: Zhigang Gong <e04a7b9b70b1e4c6318cf117dcd1a9056e14b97a@intel.com>


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

Add a test for PR22531

InstrProf: Add a test for PR22531

This is a test for the llvm change in r228793. We need to make sure
that names referred to by coverage end up in the right section, or the
coverage tools won't work.

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


/*
   Mathieu Stefani, 28 janvier 2016

   Simple Prototype design pattern implement
*/

#pragma once

#include <memory>
#include <type_traits>

namespace Pistache
{

    /* In a sense, a Prototype is just a class that provides a clone() method */
    template <typename Class>
    struct Prototype
    {
    public:
        virtual ~Prototype() { }
        virtual std::shared_ptr<Class> clone() const = 0;
    };

} // namespace Pistache

#define PROTOTYPE_OF(Base, Class)                \
public:                                          \
    std::shared_ptr<Base> clone() const override \
    {                                            \
        return std::make_shared<Class>(*this);   \
    }\

Fix warning: backslash-newline at end of file


#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

Fix to windows build errors

Fix to windows build errors


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 important DCC functions to DCC header for interaction


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

Add sample headers as a macro

Add sample headers as a macro


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

Change proc() to task() and put overloaded config types.


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

Move DisposalDeleter out of bindings namespace.


// 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 some of these cast examples as test for congruences


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

Add a testcase for the vla and stack realignment warning.

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


#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

Fix missing header error in some boards

Fix missing header error in some boards


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

Add initial lua integration concept

Add initial lua integration concept


#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

Fix warning given by Clang

Fix warning given by Clang


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

Make jonable methods to return vectors via reference


#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

Remove line so file doesn't show in diff


#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

Allow custom shutdown check cycles by exposing private functions


#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

Use some paranthesis around macro parameters.


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

Fix potential memory leak - freeing the newly created OSyncList was
missing

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@5736 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e


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

Rename variable to be more .net like

Rename variable to be more .net like


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

int g = 0;

void *t_fun(void *arg) {
  g++; // RACE!
  return NULL;
}

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

  __goblint_assume_join(id2); // joining unknown thread ID, shouldn't make joined set All threads

  g++; // RACE!

  return 0;
}

Add assume join test with unknown thread ID


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

Add comment to test case for documentation.

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


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

Fix some printf format warnings

Fix some printf format warnings

commit 51ea551 ("make sure byte swapping is optimal for git"
2009-08-18) introduced a "sane definition for ntohl()/htonl()"
for use on some GNU C platforms. Unfortunately, for some of
these platforms, this results in the introduction of a problem
which is essentially the reverse of a problem that commit 6e1c234
("Fix some warnings (on cygwin) to allow -Werror" 2008-07-3) was
intended to fix.

In particular, on platforms where the uint32_t type is defined
to be unsigned long, the return type of the new ntohl()/htonl()
is causing gcc to issue printf format warnings, such as:

    warning: long unsigned int format, unsigned int arg (arg 3)

(nine such warnings, covering six different files). The earlier
commit (6e1c234) needed to suppress these same warnings, except
that the types were in the opposite direction; namely the format
specifier ("%u") was 'unsigned int' and the argument type (ie the
return type of ntohl()) was 'long unsigned int' (aka uint32_t).

In order to suppress these warnings, the earlier commit used the
(C99) PRIu32 format specifier, since the definition of this macro
is suitable for use with the uint32_t type on that platform.
This worked because the return type of the (original) platform
ntohl()/htonl() functions was uint32_t.

In order to suppress these warnings, we change the return type of
the new byte swapping functions in the compat/bswap.h header file
from 'unsigned int' to uint32_t.

Signed-off-by: Ramsay Jones <3e74413778ce9c8bebbbaedfd56741f6850faeaf@ramsay1.demon.co.uk>
Acked-by: Nicolas Pitre <d659c10e27d52b00987b65e85d99bce5480adcae@fluxnic.net>
Signed-off-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>


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

Prepare for LLVM 7.0 migrating some utility passes


#define MVM_SHARED 1
#include "moar.h"

/* Initializes the Perl 6 extension ops. */
static void p6init(MVMThreadContext *tc) {
}

/* Registers the extops with MoarVM. */
void Rakudo_ops_init(MVMThreadContext *tc) {
    MVM_ext_register_extop(tc, "p6init",  p6init, 0, NULL);
}

#define MVM_SHARED 1
#include "moar.h"

/* Initializes the Perl 6 extension ops. */
static void p6init(MVMThreadContext *tc) {
}

/* Registers the extops with MoarVM. */
MVM_DLL_EXPORT void Rakudo_ops_init(MVMThreadContext *tc) {
    MVM_ext_register_extop(tc, "p6init",  p6init, 0, NULL);
}

Make sure to export extops init symbol.

Make sure to export extops init symbol.


// 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 two more test cases for attribute 'noreturn'.

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


#pragma once

//#define __PLATFORM_CARRIOTS__ 1
//#define __PLATFORM_INITIALSTATE__ 1
#define __PLATFORM_SHIFTR__ 1
#define __PLATFORM_THINGSPEAK__ 1

#pragma once

#define __PLATFORM_CARRIOTS__ 1
//#define __PLATFORM_INITIALSTATE__ 1
//#define __PLATFORM_SHIFTR__ 1
//#define __PLATFORM_THINGSPEAK__ 1

Change platform selection to Carriots

Change platform selection to Carriots


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

Add documentation and ensure parameters are unsigned


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

Use the new function names for the codec discovery tests


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

Remove dot from exception message

Remove dot from exception message


/*
 * 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 Opus RTP payload format header

Add Opus RTP payload format header


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

Add relational traces write vs mutex-meet example


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];

}

Change dump power to 127

Change dump power to 127


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

Introduce header for doing socket setup (useful for multicast).


//
//  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 delegate for main view controller.

Add delegate for main view controller.


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

Add static helper to extract X509 from cert

Summary:
Since callsites wanting an X509 from an AsyncTransportCertificate will have to
perform a dynamic cast to an OpenSSLTransportCertificiate, we might as well
abstract that away into a static helper.

This makes it potentially a bit easier to change implementation details in the
future without having to update a bunch of existing callsites (and it hides the
ugliness of the dynamic cast).

Reviewed By: yfeldblum, mingtaoy

Differential Revision: D31358948

fbshipit-source-id: 9ed2f81db4cf746a83871961895a0c1f1fb5c297


#ifndef PICTUS_IMAGECACHE_FILEENTRY_H
#define PICTUS_IMAGECACHE_FILEENTRY_H

#include "illa/image.h"
#include "orz/types.h"

#include <boost/date_time.hpp>

#if _WIN32
#define ENABLE_CREATED_TIME
#endif

namespace Img {
	namespace Internal {
		class FileEntry {
		public:
			Img::Image::Ptr Image();

			const std::string& Name() const;
			void Rename(const std::string& newName);

			std::time_t DateModified();
			std::time_t DateCreated();
			std::time_t FileSize();

			FileEntry(std::string fullname);

		private:
			void QueryFile();

			Img::Image::Ptr m_image;
			std::string m_fullname;
#ifdef ENABLE_CREATED_TIME
			std::time_t m_dateCreate;
#endif
			std::time_t m_dateModified;
			bool m_hasQueriedFile;
			uintmax_t m_fileSize;

		};
	}
}

#endif

#ifndef PICTUS_IMAGECACHE_FILEENTRY_H
#define PICTUS_IMAGECACHE_FILEENTRY_H

#include "illa/image.h"
#include "orz/types.h"

#include <boost/date_time.hpp>

#if _WIN32
#define ENABLE_CREATED_TIME
#endif

namespace Img {
	namespace Internal {
		class FileEntry {
		public:
			Img::Image::Ptr Image();

			const std::string& Name() const;
			void Rename(const std::string& newName);

			std::time_t DateModified();
			std::time_t DateCreated();
			FileInt FileSize();

			FileEntry(std::string fullname);

		private:
			void QueryFile();

			Img::Image::Ptr m_image;
			std::string m_fullname;
#ifdef ENABLE_CREATED_TIME
			std::time_t m_dateCreate;
#endif
			std::time_t m_dateModified;
			bool m_hasQueriedFile;
			uintmax_t m_fileSize;

		};
	}
}

#endif

Use correct data type for file size

Use correct data type for file size


#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

Modify to work with dynamic class loader class.


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

Add new member in MODBUSMasterStatus

Add new member in MODBUSMasterStatus