#pragma once

template<typename B, typename R> static void ParseRecordsBenchmark(benchmark::State &state, const simdjson::padded_string &json) {
  // Warmup and equality check (make sure the data is right!)
  B bench;
  bench.SetUp();
  if (!bench.Run(json)) { state.SkipWithError("warmup tweet reading failed"); return; }
  {
    R reference;
    reference.SetUp();
    if (!reference.Run(json)) { state.SkipWithError("reference tweet reading failed"); return; }
    // assert(bench.Records() == reference.Records());
    reference.TearDown();
  }

  // Run the benchmark
  event_collector<true> events;
  events.start();
  for (SIMDJSON_UNUSED auto _ : state) {
    if (!bench.Run(json)) { state.SkipWithError("tweet reading failed"); return; }
  }
  state.SetBytesProcessed(json.size() * state.iterations());
  state.SetItemsProcessed(bench.Records().size() * state.iterations());
  auto counts = events.end();
  if (events.has_events()) {
    state.counters["Instructions"] = counts.instructions();
    state.counters["Cycles"] = counts.cycles();
    state.counters["Branch Misses"] = counts.branch_misses();
    state.counters["Cache References"] = counts.cache_references();
    state.counters["Cache Misses"] = counts.cache_misses();
  }
}

#pragma once

template<typename B, typename R> static void ParseRecordsBenchmark(benchmark::State &state, const simdjson::padded_string &json) {
  // Warmup and equality check (make sure the data is right!)
  B bench;
  bench.SetUp();
  if (!bench.Run(json)) { state.SkipWithError("warmup tweet reading failed"); return; }
  {
    R reference;
    reference.SetUp();
    if (!reference.Run(json)) { state.SkipWithError("reference tweet reading failed"); return; }
    // assert(bench.Records() == reference.Records());
    reference.TearDown();
  }

  // Run the benchmark
  event_collector<true> events;
  events.start();
  for (SIMDJSON_UNUSED auto _ : state) {
    if (!bench.Run(json)) { state.SkipWithError("tweet reading failed"); return; }
  }
  auto bytes = json.size() * state.iterations();
  state.SetBytesProcessed(bytes);
  state.SetItemsProcessed(bench.Records().size() * state.iterations());
  auto counts = events.end();
  if (events.has_events()) {
    state.counters["Ins./Byte"] = double(counts.instructions()) / double(bytes);
    state.counters["Ins./Cycle"] = double(counts.instructions()) / double(counts.cycles());
    state.counters["Cycles/Byte"] = double(counts.cycles()) / double(bytes);
    state.counters["BranchMiss"] = benchmark::Counter(counts.branch_misses(), benchmark::Counter::kAvgIterations);
    state.counters["CacheMiss"] = benchmark::Counter(counts.cache_misses(), benchmark::Counter::kAvgIterations);
    state.counters["CacheRef"] = benchmark::Counter(counts.cache_references(), benchmark::Counter::kAvgIterations);
  }
}

Make instructions / cycle counters more useful


//===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//  This file defines helper algorithms, some of which are ported from C++14,
//  which may not be available on all platforms yet.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_BASIC_ALGORITHM_H
#define SWIFT_BASIC_ALGORITHM_H

namespace swift {
  /// Returns the minimum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T& min(const T &a, const T &b) {
    return !(b < a) ? a : b;
  }

  /// Returns the maximum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T& max(const T &a, const T &b) {
    return (a < b) ? b : a;
  }
} // end namespace swift

#endif /* SWIFT_BASIC_ALGORITHM_H */

//===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//  This file defines helper algorithms, some of which are ported from C++14,
//  which may not be available on all platforms yet.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_BASIC_ALGORITHM_H
#define SWIFT_BASIC_ALGORITHM_H

namespace swift {
  /// Returns the minimum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T &min(const T &a, const T &b) {
    return !(b < a) ? a : b;
  }

  /// Returns the maximum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T &max(const T &a, const T &b) {
    return (a < b) ? b : a;
  }
} // end namespace swift

#endif /* SWIFT_BASIC_ALGORITHM_H */

Fix methods return type ampersand location (NFC)


// RUN: clang -checker-simple -verify %s

struct FPRec {
  void (*my_func)(int * x);
};

int bar(int x);

int f1_a(struct FPRec* foo) {
  int x;
  (*foo->my_func)(&x);
  return bar(x)+1; // no-warning
}

int f1_b() {
  int x;
  return bar(x)+1;  // expected-warning{{Pass-by-value argument in function is undefined.}}
}

int f2() {

  int x;

  if (x+1)  // expected-warning{{Branch}}
    return 1;

  return 2;
}

int f2_b() {
  int x;

  return ((x+1)+2+((x))) + 1 ? 1 : 2; // expected-warning{{Branch}}
}

int f3(void) {
  int i;
  int *p = &i;
  if (*p > 0) // expected-warning{{Branch condition evaluates to an uninitialized value}}
    return 0;
  else
    return 1;
}

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

Add test for path-sensitive uninit-val detection involving struct field.

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


#include <stdio.h>

static
int r( int n )
{
    printf("%d\n", n);
    if (n <= 1)
        return n;
    if (n%2)
        return r((n*3)+1);
    return r(n/2);
}

int main ( void )
{
    puts("Basic collatz fun - recursive C function");
    r(15);
    return 0;
}

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

static
long r( long n )
{
    printf("%ld\n", n);
    if (n <= 1)
        return n;
    if (n%2)
        return r((n*3)+1);
    return r(n/2);
}

int main (int argc, char **argv)
{
    long n = 15;
    if (argc > 1)
        n = strtol(argv[1], NULL, 10);
    puts("Basic collatz fun - recursive C function");
    r(n);
    return 0;
}

Allow passing ints as arg

Allow passing ints as arg


#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <adm/uaccess.h>

// Module Stuff
MODULE_LICENCE("Apache"); // Change this to "GPL" if you get annoyed about
						  // the kernal playing a crying fit about non GPL stuff
MODULE_DESCRIPTION("A Markov device driver.");
MODULE_AUTHOR("Ben Cartwright-Cox");

static int dev_open(struct inode *, struct file *);
static int dev_rls(struct inode *, struct file *);
static ssize_t dev_read(strict file *, char *, size_t, loff_t *);
static ssize_t dev_write(strict file *, const char *, size_t, loff_t *);

Change tabs to spaces, Lets nip this one in the bud.


#ifndef ASSOC_H
#define ASSOC_H

struct assoc {
   /* how many powers of 2's worth of buckets we use */
   unsigned int hashpower;

   /* Main hash table. This is where we look except during expansion. */
   hash_item** primary_hashtable;

   /*
    * Previous hash table. During expansion, we look here for keys that haven't
    * been moved over to the primary yet.
    */
   hash_item** old_hashtable;

   /* Number of items in the hash table. */
   unsigned int hash_items;

   /* Flag: Are we in the middle of expanding now? */
   bool expanding;

   /*
    * During expansion we migrate values with bucket granularity; this is how
    * far we've gotten so far. Ranges from 0 .. hashsize(hashpower - 1) - 1.
    */
   unsigned int expand_bucket;

   /*
    * serialise access to the hashtable
    */
   cb_mutex_t lock;
};

/* associative array */
ENGINE_ERROR_CODE assoc_init(struct default_engine *engine);
void assoc_destroy(void);
hash_item *assoc_find(struct default_engine *engine, uint32_t hash,
                      const hash_key* key);
int assoc_insert(struct default_engine *engine, uint32_t hash,
                 hash_item *item);
void assoc_delete(struct default_engine *engine, uint32_t hash,
                  const hash_key* key);
int start_assoc_maintenance_thread(struct default_engine *engine);
void stop_assoc_maintenance_thread(struct default_engine *engine);

#endif

#ifndef ASSOC_H
#define ASSOC_H

struct assoc {
   /* how many powers of 2's worth of buckets we use */
   unsigned int hashpower;

   /* Main hash table. This is where we look except during expansion. */
   hash_item** primary_hashtable;

   /*
    * Previous hash table. During expansion, we look here for keys that haven't
    * been moved over to the primary yet.
    */
   hash_item** old_hashtable;

   /* Number of items in the hash table. */
   unsigned int hash_items;

   /* Flag: Are we in the middle of expanding now? */
   bool expanding;

   /*
    * During expansion we migrate values with bucket granularity; this is how
    * far we've gotten so far. Ranges from 0 .. hashsize(hashpower - 1) - 1.
    */
   unsigned int expand_bucket;

   /*
    * serialise access to the hashtable
    */
   cb_mutex_t lock;
};

/* associative array */
ENGINE_ERROR_CODE assoc_init(struct default_engine *engine);
void assoc_destroy(void);
hash_item *assoc_find(struct default_engine *engine, uint32_t hash,
                      const hash_key* key);
int assoc_insert(struct default_engine *engine, uint32_t hash,
                 hash_item *item);
void assoc_delete(struct default_engine *engine, uint32_t hash,
                  const hash_key* key);

#endif

Remove prototypes for nonexistent functions

Change-Id: Ife8b66f32aa78159ea3cfdec17cbc5148d954f8d
Reviewed-on: http://review.couchbase.org/80561
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Jim Walker <1cd02e31b43620d7c664e038ca42a060d61727b9@couchbase.com>


// RUN: %llvmgcc -S %s -O0 -o - -mllvm --disable-llvm-optzns | grep bar
// Check that the gcc inliner is turned off.

#include <stdio.h>
static __inline__ __attribute__ ((always_inline))
     int bar (int x)
{
  return 4;
}

void
foo ()
{
  long long b = 1;
  int Y = bar (4);
  printf ("%d\n", Y);
}

Check that the gcc front-end is not doing inlining
when not doing unit-at-a-time.

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


/*
 * NovelProcessTool.h
 *
 *  Created on: 2015年2月19日
 *      Author: nemo
 */

#ifndef SRC_NOVELPROCESSTOOL_H_
#define SRC_NOVELPROCESSTOOL_H_

#include <string>
#include <fstream>
#include <vector>

using namespace std;

class NovelProcessTool {
public:
	NovelProcessTool();
	virtual ~NovelProcessTool();

protected:

	///		Check the work directory.
	void checkWorkingDirectory();

	///		Open in and out file.
	int fileOpen(string novelName);

	///		Close in and out files.
	void fileClosed();

	///		Analysis the temp folder.
	void analysisFile();

	fstream 		_fileInStream;		///< The file input stream.
	fstream 		_fileOutStream;		///< The file out stream.

	string			_tempDir;			///< The temp folder directory path.
	string			_resultDir;			///< The result folder directory path.

	vector<string> 	_inputNovel;		///< The input file name.
};

#endif /* SRC_NOVELPROCESSTOOL_H_ */

/*
 * NovelProcessTool.h
 *
 *  Created on: 2015年2月19日
 *      Author: nemo
 */

#ifndef SRC_NOVELPROCESSTOOL_H_
#define SRC_NOVELPROCESSTOOL_H_

#include <string>
#include <fstream>
#include <vector>

using namespace std;

class NovelProcessTool {
public:
	NovelProcessTool();
	virtual ~NovelProcessTool();

protected:

	///		Check the work directory.
	void checkWorkingDirectory();

	///		Open in and out file.
	int fileOpen(string novelName);

	///		Close in and out files.
	void fileClosed();

	///		Analysis the temp folder.
	void analysisFile();

	///		Novel tool action, implement in sub class.
	virtual void parseContents() = 0;

	fstream 		_fileInStream;		///< The file input stream.
	fstream 		_fileOutStream;		///< The file out stream.

	string			_tempDir;			///< The temp folder directory path.
	string			_resultDir;			///< The result folder directory path.

	vector<string> 	_inputNovel;		///< The input file name.
};

#endif /* SRC_NOVELPROCESSTOOL_H_ */

Modify void parseContents(0) as pure virtual function.


#ifndef __INC_FASTLED_ARM_MXRT1062_H
#define __INC_FASTLED_ARM_MXRT1062_H

#include "fastpin_arm_mxrt1062.h"
#include "fastspi_arm_mxrt1062.h"
#include "clockless_arm_mxrt1062.h"
#include "block_clockless_arm_mxrt1062.h"

#endif

#ifndef __INC_FASTLED_ARM_MXRT1062_H
#define __INC_FASTLED_ARM_MXRT1062_H

#include "fastpin_arm_mxrt1062.h"
#include "fastspi_arm_mxrt1062.h"
#include "../k20/octows2811_controller.h"
#include "../k20/ws2812serial_controller.h"
#include "../k20/smartmatrix_t3.h"
#include "clockless_arm_mxrt1062.h"
#include "block_clockless_arm_mxrt1062.h"

#endif

Support WS2812Serial Library on Teensy T4

Recently there was reported that the WS2812Serial library (github.com/PaulStoffregen/WS2812Serial) was not ported over to work on the new Teensy T4, so I thought I would take a look.

I added the T4 support, which is now pending in a Pull Request.  During that I also found that there were errors in one of the core header files for the T4, which I also fixed, which is now pending in another Pull Request (github.com/PaulStoffregen/Cores)

After that was working, it was pointed out that the FastLED sample in the WS2812Serial librry did not compile. So...

More details in the forum Thread:
https://forum.pjrc.com/threads/58442-Non-Blocking-WS2812-LED-Library-and-Teensy-4-0


//
//  NSObject+ASPropertyAttributes.h
//  AppScaffold Cocoa Category
//
//  Created by Whirlwind on 15/4/3.
//  Copyright (c) 2015年 AppScaffold. All rights reserved.
//

#import <Foundation/Foundation.h>

#if __has_include("EXTRuntimeExtensions.h")
// This category need pod 'libextobjc'

#import "EXTRuntimeExtensions.h"

@interface NSObject (PropertyAttributes)

+ (ext_propertyAttributes *)copyPropertyAttributesByName:(NSString *)name;

@end

#endif

//
//  NSObject+ASPropertyAttributes.h
//  AppScaffold Cocoa Category
//
//  Created by Whirlwind on 15/4/3.
//  Copyright (c) 2015年 AppScaffold. All rights reserved.
//

#import <Foundation/Foundation.h>

#if __has_include(<libextobjc/EXTRuntimeExtensions.h>)
// This category need pod 'libextobjc'

#import <libextobjc/EXTRuntimeExtensions.h>

@interface NSObject (PropertyAttributes)

+ (ext_propertyAttributes *)copyPropertyAttributesByName:(NSString *)name;

@end

#endif

Fix check the libextobjc when it is framework


#ifndef OI_H
#define OI_H

#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>

class OI
{
private:
	Joystick joystick;

public:
	OI();
	inline float GetXplusY(){
		float val;
		val = FractionOmitted(joystick.GetY() + joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}
	inline float GetXminusY(){
		float val;
		val = FractionOmitted(joystick.GetY() - joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}

	inline float GetStickX(){ return FractionOmitted(joystick.GetX()); }
	inline float GetStickY(){ return FractionOmitted(joystick.GetY()); }
	inline float GetStickTwist(){ return FractionOmitted(joystick.GetTwist()); }
	inline float GetStickThrottle(){ return FractionOmitted(joystick.GetThrottle()); }

	inline float FractionOmitted(float original){
		if(fabsf(original) < 0.01 ){
			original = 0;
		}
		return original;
	}
};

#endif

#ifndef OI_H
#define OI_H

#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>

class OI
{
private:
	Joystick joystick;

public:
	OI();
	inline float GetXplusY(){
		float val;
		val = FractionOmitted(joystick.GetY() + joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}
	inline float GetXminusY(){
		float val;
		val = FractionOmitted(joystick.GetY() - joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}

	inline float GetStickX(){ return FractionOmitted(joystick.GetX()); }
	inline float GetStickY(){ return FractionOmitted(joystick.GetY()); }
	inline float GetStickTwist(){ return FractionOmitted(joystick.GetTwist()); }
	inline float GetStickThrottle(){ return FractionOmitted(joystick.GetThrottle()); }
	inline float GetStickRightX(){ return FractionOmitted(joystick.GetRawAxis(5)); }
	inline float GetStcikRightY(){ return FractionOmitted(joystick.GetRawAxis(6)); }

	inline float FractionOmitted(float original){
		if(fabsf(original) < 0.01 ){
			original = 0;
		}
		return original;
	}
};

#endif

Create RightStick X and Y value get Function


#ifndef SDL_EVENTS_H
#define SDL_EVENTS_H

#include "common.h"

#include "gba-thread.h"

#include <SDL.h>

#define SDL_BINDING_KEY 0x53444C4B
#define SDL_BINDING_BUTTON 0x53444C42

struct GBAVideoSoftwareRenderer;

struct GBASDLEvents {
	struct GBAInputMap* bindings;
	SDL_Joystick* joystick;
#if SDL_VERSION_ATLEAST(2, 0, 0)
	SDL_Window* window;
	int fullscreen;
	int windowUpdated;
#endif
};

bool GBASDLInitEvents(struct GBASDLEvents*);
void GBASDLDeinitEvents(struct GBASDLEvents*);

void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event);

enum GBAKey GBASDLMapButtonToKey(int button);

#endif

#ifndef SDL_EVENTS_H
#define SDL_EVENTS_H

#include "common.h"

#include "gba-thread.h"

#include <SDL.h>

#define SDL_BINDING_KEY 0x53444C4B
#define SDL_BINDING_BUTTON 0x53444C42

struct GBAVideoSoftwareRenderer;

struct GBASDLEvents {
	struct GBAInputMap* bindings;
	SDL_Joystick* joystick;
#if SDL_VERSION_ATLEAST(2, 0, 0)
	SDL_Window* window;
	int fullscreen;
	int windowUpdated;
#endif
};

bool GBASDLInitEvents(struct GBASDLEvents*);
void GBASDLDeinitEvents(struct GBASDLEvents*);

void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event);

#endif

Remove prototype for removed function

Remove prototype for removed function


// RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s

void f0(void *a, void *b) {
	__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}

// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
void rbit(unsigned a) {
  __builtin_arm_rbit(a);
}

// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
void rbit64(unsigned long long a) {
  __builtin_arm_rbit64(a);
}

// RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s

void f0(void *a, void *b) {
	__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}

// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
unsigned rbit(unsigned a) {
  return __builtin_arm_rbit(a);
}

// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
unsigned long long rbit64(unsigned long long a) {
  return __builtin_arm_rbit64(a);
}

Fix silly think-o in tests.

AArch64: Fix silly think-o in tests.

rdar://9283021

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


#ifndef UTIL_H
#define UTIL_H

#define estr(x)     #x
#define ENUM(x)     estr(x)

void exec_error(const char *msg, ...);
void fatal_error(const char *msg, ...);

typedef enum { FALSE, TRUE } BOOL;

#endif

#ifndef UTIL_H
#define UTIL_H

#define estr(x)     #x
#define ENUM(x)     estr(x)

void exec_error(const char *msg, ...);

#ifdef _MSC_VER
__declspec(noreturn)
#endif
void fatal_error(const char *msg, ...)
#ifdef __GNUC__
__attribute__((noreturn))
#endif
;

typedef enum { FALSE, TRUE } BOOL;

#endif

Add noreturn attribute to fatal_error

Add noreturn attribute to fatal_error


/*
 * PROBLEM
 * Discuss the stack data structure. Implement a stack in C using either a linked list or a dynamic array, and justify your decision.
 * Design the interface to your stack to be complete, consistent, and easy to use.
 */

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

typedef struct Element {
    struct Element *next;
    void *data;
} Element;

bool push (Element **stack, void *data){
    Element *elem = malloc(sizeof(Element));
    if (!elem) return false;
    elem->data = data;
    elem->next = *stack;
    *stack = elem;
    return true;
}

bool pop( Element **stack, void **data ) {
    Element *elem;
    if (!(elem=*stack)) return false;
    *data = elem->data;
    *stack = elem->next;
    free(elem);
    return true;
}

bool createStack( Element **stack ) {
    *stack = NULL;
    return true;
}

bool deleteStack ( Element **stack ){
    Element *next;
    while ( *stack ) {
        next = (*stack)->next;
        free (*stack);
        *stack = next;
    }
    return true;
}

void main() {
}

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

typedef struct Element {
    struct Element *next;
    void *data;
} Element;

/*
 * PROBLEM
 * Discuss the stack data structure. Implement a stack in C using either a linked list or a dynamic array, and justify your decision.
 * Design the interface to your stack to be complete, consistent, and easy to use.
 *
 * The solution contains the following push, pop, createStack, and deleteStack functions.
 */
bool push (Element **stack, void *data){
    Element *elem = malloc(sizeof(Element));
    if (!elem) return false;
    elem->data = data;
    elem->next = *stack;
    *stack = elem;
    return true;
}

bool pop( Element **stack, void **data ) {
    Element *elem;
    if (!(elem=*stack)) return false;
    *data = elem->data;
    *stack = elem->next;
    free(elem);
    return true;
}

bool createStack( Element **stack ) {
    *stack = NULL;
    return true;
}

bool deleteStack ( Element **stack ){
    Element *next;
    while ( *stack ) {
        next = (*stack)->next;
        free (*stack);
        *stack = next;
    }
    return true;
}

/*
 * PROBLEM
 * Find and fix the bugs in the following C function that is supposed to remove the head element from a singly linked list:
 * void removeHead (ListElement *head) {
 *   free(head); // Line 1
 *   head = head->next; // Line 2
 * }
 */
void removeHead (Element **head) {
    Element *temp;
    if (head && *head) {
        temp = (*head)->next;
        free (*head);
        *head = temp;
    }
}

void main() {
}

Add the problem of 'Bugs in removeHead'.


//
//  MCGraylog.h
//  MCGraylog
//
//  Created by Jordan on 2013-05-06.
//  Copyright (c) 2013 Marketcircle. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {
    GraylogLogLevelEmergency = 0,
    GraylogLogLevelAlert = 1,
    GraylogLogLevelCritical = 2,
    GraylogLogLevelError = 3,
    GraylogLogLevelWarning = 4,
    GraylogLogLevelNotice = 5,
    GraylogLogLevelInformational = 6,
    GraylogLogLevelDebug = 7
} GraylogLogLevel;

/**
 * Perform some up front work needed for all future log messages
 *
 * @return 0 on success, otherwise -1.
 */
int graylog_init(const char* address, const char* port);

void graylog_log(GraylogLogLevel lvl,
                 const char* facility,
                 const char* msg,
                 NSDictionary *data);

//
//  MCGraylog.h
//  MCGraylog
//
//  Created by Jordan on 2013-05-06.
//  Copyright (c) 2013 Marketcircle. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {
    GraylogLogLevelEmergency = 0,
    GraylogLogLevelAlert = 1,
    GraylogLogLevelCritical = 2,
    GraylogLogLevelError = 3,
    GraylogLogLevelWarning = 4,
    GraylogLogLevelNotice = 5,
    GraylogLogLevelInformational = 6,
    GraylogLogLevelDebug = 7
} GraylogLogLevel;

/**
 * Perform some up front work needed for all future log messages
 *
 * @return 0 on success, otherwise -1.
 */
int graylog_init(const char* address, const char* port);

/**
 * Log a message to the Graylog server (or some other compatible service).
 *
 * @param lvl Log level, the severity of the message
 * @param facility Arbitrary string indicating the subsystem the message came
 *                 from (i.e. sync, persistence, etc.)
 * @param msg The actual log message
 * @param data Any additional information that might be useful that is JSON
 *             serializable (e.g. numbers, strings, arrays, dictionaries)
 */
void graylog_log(GraylogLogLevel lvl,
                 const char* facility,
                 const char* msg,
                 NSDictionary* data);

Add some basic documentation for graylog_log


//////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007  Qumranet All Rights Reserved
//
// Module Name:
// osdep.h
//
// Abstract:
// Windows OS dependent definitions of data types
//
// Author:
// Yan Vugenfirer  - February 2007.
//
//////////////////////////////////////////////////////////////////////////////////////////

#if defined(IGNORE_VIRTIO_OSDEP_H)
// to make simulation environment easy
#include "external_os_dep.h"
#else

#ifndef __OS_DEP_H
#define __OS_DEP_H

#include <ntddk.h>

#define ktime_t ULONGLONG
#define ktime_get() KeQueryPerformanceCounter(NULL).QuadPart

#define likely(x) x
#define unlikely(x) x

#define ENOSPC 1
#define BUG_ON(a) ASSERT(!(a))
#define WARN_ON(a)
#define BUG() ASSERT(0)

#if !defined(__cplusplus) && !defined(bool)
#define bool int
#define false FALSE
#define true TRUE
#endif

#define inline __forceinline

#ifdef DBG
#define DEBUG
#endif

#define mb()   KeMemoryBarrier()
#define rmb()  KeMemoryBarrier()
#define wmb()  KeMemoryBarrier()

#define SMP_CACHE_BYTES 64

#endif
#endif

//////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007  Qumranet All Rights Reserved
//
// Module Name:
// osdep.h
//
// Abstract:
// Windows OS dependent definitions of data types
//
// Author:
// Yan Vugenfirer  - February 2007.
//
//////////////////////////////////////////////////////////////////////////////////////////

#if defined(IGNORE_VIRTIO_OSDEP_H)
// to make simulation environment easy
#include "external_os_dep.h"
#else

#ifndef __OS_DEP_H
#define __OS_DEP_H

#include <ntddk.h>

#define ktime_t ULONGLONG
#define ktime_get() KeQueryPerformanceCounter(NULL).QuadPart

#define likely(x) x
#define unlikely(x) x

#define ENOSPC 1
#define BUG_ON(a) ASSERT(!(a))
#define WARN_ON(a)
#define BUG() ASSERT(0)

#if !defined(__cplusplus) && !defined(bool)
// Important note: in MSFT C++ bool length is 1 bytes
// C++ does not define length of bool
// inconsistent definition of 'bool' may create compatibility problems
#define bool u8
#define false FALSE
#define true TRUE
#endif

#define inline __forceinline

#ifdef DBG
#define DEBUG
#endif

#define mb()   KeMemoryBarrier()
#define rmb()  KeMemoryBarrier()
#define wmb()  KeMemoryBarrier()

#define SMP_CACHE_BYTES 64

#endif
#endif

Fix wrong bool definition in VirtIO library interface

BZ#1389445: VirtIO definition of bool as int used by all drivers
that use VirtIO library, except (currently) netkvm which is C++
and uses bool as fundamental C++ type.
Microsoft-specific implementationdefines bool size as 1 byte.
Different definition of bool in library interface creates
compatibility problem.
Example: when calling virtio_device_initialize(...)
bool parameter msix_used passed incorrectly.

Signed-off-by: Yuri Benditovich <88b9db763c3045958dd7f2a08b57403c2e6ebe14@redhat.com>


//===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "clang/Frontend/FrontendAction.h"
#include "llvm/ADT/OwningPtr.h"

namespace llvm {
  class Module;
}

namespace clang {

class CodeGenAction : public ASTFrontendAction {
private:
  unsigned Act;
  llvm::OwningPtr<llvm::Module> TheModule;

protected:
  CodeGenAction(unsigned _Act);
  ~CodeGenAction();

  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
                                         llvm::StringRef InFile);

  virtual void EndSourceFileAction();

public:
  /// takeModule - Take the generated LLVM module, for use after the action has
  /// been run. The result may be null on failure.
  llvm::Module *takeModule();
};

class EmitAssemblyAction : public CodeGenAction {
public:
  EmitAssemblyAction();
};

class EmitBCAction : public CodeGenAction {
public:
  EmitBCAction();
};

class EmitLLVMAction : public CodeGenAction {
public:
  EmitLLVMAction();
};

class EmitLLVMOnlyAction : public CodeGenAction {
public:
  EmitLLVMOnlyAction();
};

class EmitObjAction : public CodeGenAction {
public:
  EmitObjAction();
};

}

//===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "clang/Frontend/FrontendAction.h"
#include "llvm/ADT/OwningPtr.h"

namespace llvm {
  class Module;
}

namespace clang {

class CodeGenAction : public ASTFrontendAction {
private:
  unsigned Act;
  llvm::OwningPtr<llvm::Module> TheModule;

protected:
  CodeGenAction(unsigned _Act);

  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
                                         llvm::StringRef InFile);

  virtual void EndSourceFileAction();

public:
  ~CodeGenAction();

  /// takeModule - Take the generated LLVM module, for use after the action has
  /// been run. The result may be null on failure.
  llvm::Module *takeModule();
};

class EmitAssemblyAction : public CodeGenAction {
public:
  EmitAssemblyAction();
};

class EmitBCAction : public CodeGenAction {
public:
  EmitBCAction();
};

class EmitLLVMAction : public CodeGenAction {
public:
  EmitLLVMAction();
};

class EmitLLVMOnlyAction : public CodeGenAction {
public:
  EmitLLVMOnlyAction();
};

class EmitObjAction : public CodeGenAction {
public:
  EmitObjAction();
};

}

Make the destructor public. ddunbar, lemme know if you'd prefer a different
fix, just trying to get the build bots happy again.

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


/* go-traceback.c -- stack backtrace for Go.

   Copyright 2012 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include "config.h"

#include "runtime.h"
#include "go-string.h"

/* Print a stack trace for the current goroutine.  */

void
runtime_traceback ()
{
  uintptr pcbuf[100];
  int32 c;

  c = runtime_callers (1, pcbuf, sizeof pcbuf / sizeof pcbuf[0]);
  runtime_printtrace (pcbuf, c);
}

void
runtime_printtrace (uintptr *pcbuf, int32 c)
{
  int32 i;

  for (i = 0; i < c; ++i)
    {
      struct __go_string fn;
      struct __go_string file;
      int line;

      if (__go_file_line (pcbuf[i], &fn, &file, &line)
	  && runtime_showframe (fn.__data))
	{
	  runtime_printf ("%s\n", fn.__data);
	  runtime_printf ("\t%s:%d\n", file.__data, line);
	}
    }
}

/* go-traceback.c -- stack backtrace for Go.

   Copyright 2012 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include "config.h"

#include "runtime.h"
#include "go-string.h"

/* Print a stack trace for the current goroutine.  */

void
runtime_traceback ()
{
  uintptr pcbuf[100];
  int32 c;

  c = runtime_callers (1, pcbuf, sizeof pcbuf / sizeof pcbuf[0]);
  runtime_printtrace (pcbuf, c);
}

void
runtime_printtrace (uintptr *pcbuf, int32 c)
{
  int32 i;

  for (i = 0; i < c; ++i)
    {
      struct __go_string fn;
      struct __go_string file;
      int line;

      if (__go_file_line (pcbuf[i], &fn, &file, &line)
	  && runtime_showframe (fn.__data))
	{
	  runtime_printf ("%S\n", fn);
	  runtime_printf ("\t%S:%d\n", file, line);
	}
    }
}

Fix printing of names in stack dumps.

runtime: Fix printing of names in stack dumps.

R=iant
CC=gofrontend-dev
https://golang.org/cl/6305062


#include "_condor_fix_types.h"
#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include "condor_fix_limits.h"
#include "condor_fix_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#if !defined(SUNOS41)
#include <signal.h>
#endif

#if defined(WIN32)

#define NOGDI
#define NOUSER
#define NOSOUND
#include <winsock2.h>
#include <windows.h>
#include "_condor_fix_nt.h"
#include <stdlib.h>

#else

#include "_condor_fix_types.h"
#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include "condor_fix_limits.h"
#include "condor_fix_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include "condor_fix_signal.h"

#if defined(Solaris)
#	define BSD_COMP
#endif
#include <sys/ioctl.h>
#if defined(Solaris)
#	undef BSD_COMP
#endif

#endif // defined(WIN32)

Use condor_fix_signal.h, not <signal.h>, and include <sys/ioctl.h> properly. Also, NT specific changes committed to main trunk.


#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include "_condor_fix_types.h"
#include <errno.h>

#include "condor_fix_stdio.h"
#include <stdlib.h>
#include "condor_fix_unistd.h"
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include "_condor_fix_types.h"
#include <fcntl.h>
#include <errno.h>

Add <fcntl.h> to list of commonly included files.


// PARAM: --enable ana.int.interval --enable exp.partition-arrays.enabled --set ana.activated "['base', 'mallocWrapper', 'expRelation', 'var_eq']"
int *tmp;

int main ()
{
  int pathbuf[2];

  int *bound = pathbuf + sizeof(pathbuf)/sizeof(*pathbuf) - 1;

  int *p = pathbuf;

  while (p <= bound) {

    *p = 1;

    p++;
  }

  return 0;
}

// PARAM: --enable ana.int.interval --enable exp.partition-arrays.enabled --set ana.activated "['base', 'mallocWrapper', 'escape', 'expRelation', 'var_eq']"
int *tmp;

int main ()
{
  int pathbuf[2];

  int *bound = pathbuf + sizeof(pathbuf)/sizeof(*pathbuf) - 1;

  int *p = pathbuf;

  while (p <= bound) {

    *p = 1;

    p++;
  }

  return 0;
}

Enable escape in 31/04 for global-history to pass


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

int myglobal;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

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

void *t_fun2(void *arg) {
  pthread_mutex_lock(&mutex1);
  myglobal=myglobal+1; // RACE!
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id, id2;
  pthread_create(&id, NULL, t_fun, NULL); // enter multithreaded
  myglobal = 5; // NORACE

  pthread_create(&id2, NULL, t_fun2, NULL);
  pthread_mutex_lock(&mutex2);
  myglobal=myglobal+1; // RACE!
  pthread_mutex_unlock(&mutex2);
  return 0;
}

Add race test where all accesses don't race


int asserter_is_false(int);
int set_empty(void);
int set_size(int);
int set_add(int, int);

int main(void)
{
	// set_empty tests
	if (asserter_is_false(set_empty() == 0)) return __LINE__;

	// set_add tests
	if (asserter_is_false(set_add(set_empty(), 0) != set_empty())) return __LINE__;
	if (asserter_is_false(set_add(set_empty(), 1) != set_add(set_empty(), 2))) return __LINE__;
	if (asserter_is_false(set_add(set_add(set_empty(), 1), 2) != set_add(set_empty(), 2))) return __LINE__;
	if (asserter_is_false(set_add(set_add(set_empty(), 1), 1) == set_add(set_empty(), 1))) return __LINE__;

	// set_size tests
	if (asserter_is_false(set_size(set_empty()) == 0)) return __LINE__;
	if (asserter_is_false(set_size(set_add(set_empty(), 1)) == 1)) return __LINE__;
	if (asserter_is_false(set_size(set_add(set_add(set_empty(), 1), 2)) == 2)) return __LINE__;
	return 0;
}

int asserter_is_false(int);
int set_empty(void);
int set_size(int);
int set_add(int, int);

int main(void)
{
	// set_empty tests
	if (asserter_is_false(set_empty() == 0)) return __LINE__;

	// set_add tests
	if (asserter_is_false(set_add(set_empty(), 0) != set_empty())) return __LINE__;
	if (asserter_is_false(set_add(set_empty(), 1) != set_add(set_empty(), 2))) return __LINE__;
	if (asserter_is_false(set_add(set_add(set_empty(), 1), 2) != set_add(set_empty(), 2))) return __LINE__;
	if (asserter_is_false(set_add(set_add(set_empty(), 1), 1) == set_add(set_empty(), 1))) return __LINE__;
	// TODO: add bigger than sizeof(int) * 8 elements

	// set_size tests
	if (asserter_is_false(set_size(set_empty()) == 0)) return __LINE__;
	if (asserter_is_false(set_size(set_add(set_empty(), 1)) == 1)) return __LINE__;
	if (asserter_is_false(set_size(set_add(set_add(set_empty(), 1), 2)) == 2)) return __LINE__;
	// TODO: add more than sizeof(int) * 8 elements
	return 0;
}

Add TODOs for future work

[SET] REFACTOR: Add TODOs for future work


#ifndef __CR_SERVICE_H__
#define __CR_SERVICE_H__

#include "protobuf/rpc.pb-c.h"

#define CR_DEFAULT_SERVICE_ADDRESS "/tmp/criu_service.socket"
#define MAX_MSG_SIZE 1024

int cr_service(bool deamon_mode);

int send_criu_dump_resp(int socket_fd, bool success, bool restored);

extern struct _cr_service_client *cr_service_client;
extern unsigned int service_sk_ino;

#endif

#ifndef __CR_SERVICE_H__
#define __CR_SERVICE_H__

#include "protobuf/rpc.pb-c.h"

#define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket"
#define MAX_MSG_SIZE 1024

int cr_service(bool deamon_mode);

int send_criu_dump_resp(int socket_fd, bool success, bool restored);

extern struct _cr_service_client *cr_service_client;
extern unsigned int service_sk_ino;

#endif

Change default socket path to /var/run/

service: Change default socket path to /var/run/

This is where such stuff is typically placed.

Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>


#include <stddef.h>
#include <stdint.h>

#include "cc1.h"

Symbol *curfun;

extern Node *convert(Node *np, Type *tp1, char iscast);

static void
Return(void)
{
	Node *np;
	Type *tp = curfun->type->type;

	expect(RETURN);
	np = expr();
	if (np->type != tp) {
		if ((np = convert(np, tp, 0)) == NULL)
			error("incorrect type in return");
	}
	emitret(tp);
	emitexp(np);
}

void
compound(void)
{
	expect('{');
	while (!accept('}')) {
		switch (yytoken) {
		case TYPE: case SCLASS: case TQUALIFIER:
			decl();
			break;
		case RETURN:
			Return();
			break;
		default:
			emitexp(expr());
		}
		expect(';');
	}
}

#include <stddef.h>
#include <stdint.h>

#include "cc1.h"

Symbol *curfun;

extern Node *convert(Node *np, Type *tp1, char iscast);

static void
Return(void)
{
	Node *np;
	Type *tp = curfun->type->type;

	expect(RETURN);
	np = expr();
	if (np->type != tp) {
		if (tp == voidtype)
			warn(1, "function returning void returns a value");
		else if ((np = convert(np, tp, 0)) == NULL)
			error("incorrect type in return");
	}
	emitret(tp);
	emitexp(np);
}

void
compound(void)
{
	expect('{');
	while (!accept('}')) {
		switch (yytoken) {
		case TYPE: case SCLASS: case TQUALIFIER:
			decl();
			break;
		case RETURN:
			Return();
			break;
		default:
			emitexp(expr());
		}
		expect(';');
	}
}

Check that void function can return a value


// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
int \uaccess = 0;
// ALLOWED: "곎ss":
// ALLOWED-NOT: "\uaccess":
// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
// DENIED: error: expected identifier or '('

// RUN: %clang --target=x86_64--linux-gnu -S %s -o - | FileCheck %s -check-prefix=ALLOWED
// RUN: not %clang --target=x86_64--linux-gnu -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
int \uaccess = 0;
// ALLOWED: "곎ss":
// ALLOWED-NOT: "\uaccess":
// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
// DENIED: error: expected identifier or '('

Fix testcase when building on darwin

Fix testcase when building on darwin

Explicitely specify a target to avoid "_" prefixes on the names.

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


/* RUN: clang -fsyntax-only -verify %s &&
 * RUN: clang -std=gnu89 -fsyntax-only -verify %s &&
 * RUN: clang -DPEDANTIC -pedantic -std=gnu89 -fsyntax-only -verify %s
 */

#ifdef PEDANTIC

long double d = 0x0.0000003ffffffff00000p-16357L; /* expected-warning {{ hexadecimal floating constants are a C99 feature }} */

#else

long double d = 0x0.0000003ffffffff00000p-16357L;

#endif

Add test case for hex floating point constants in < C99 mode
 - For: rdar://6096838

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


#ifndef AIDLL_AI_AICOMPONENT_H
#define AIDLL_AI_AICOMPONENT_H

#include <DirectXMath.h>
enum Pattern : int
{
	AI_LINEAR = 1,
	AI_CIRCULAR,
	AI_ROUNTRIP,
	AI_RANDOM,
	AI_NONE = -1
};
__declspec(align(16)) struct AIComponent
{
	// System variables
	int AP_active = 0;
	int AP_entityID = -1;

	// AI variables
	bool AP_triggered;			// Trigger handling
	int AP_time;				// How long the component is active

	float AP_speed;				// Movement speed
	DirectX::XMVECTOR AP_dir;	// Normalised direction vector

	DirectX::XMVECTOR AP_position;// Current position
	int AP_pattern;				// Traversing of waypoints
	int AP_direction;			// Direction in array, might be removed due to AP_pattern's existance
	int AP_nextWaypointID;		// Index to next waypoint
	int AP_latestWaypointID;	// Index to latest visited waypoint
	int AP_nrOfWaypoint;		// Nr of waypoints used in array

	DirectX::XMVECTOR AP_waypoints[8];

	void* operator new(size_t i) { return _aligned_malloc(i, 16); };
	void operator delete(void* p) { _aligned_free(p); };
};

#endif

#ifndef AIDLL_AI_AICOMPONENT_H
#define AIDLL_AI_AICOMPONENT_H

#include <DirectXMath.h>
enum Pattern : int
{
	AI_LINEAR = 1,
	AI_CIRCULAR,
	AI_ROUNTRIP,
	AI_RANDOM,
	AI_NONE = -1
};
__declspec(align(16)) struct AIComponent
{
	// System variables
	int AP_active = 0;
	int AP_entityID = -1;

	// AI variables
	bool AP_triggered = false;	// Trigger handling
	int AP_time = 0;			// How long the component is active

	float AP_speed = 0;			// Movement speed
	DirectX::XMVECTOR AP_dir = DirectX::XMVECTOR();// Normalised direction vector

	DirectX::XMVECTOR AP_position = DirectX::XMVECTOR();// Current position
	int AP_pattern = AI_NONE;	// Traversing of waypoints
	int AP_direction = 0;		// Direction in array, might be removed due to AP_pattern's existance
	int AP_nextWaypointID = 0;	// Index to next waypoint
	int AP_latestWaypointID = 1;// Index to latest visited waypoint
	int AP_nrOfWaypoint = 0;	// Nr of waypoints used in array

	DirectX::XMVECTOR AP_waypoints[8];

	void* operator new(size_t i) { return _aligned_malloc(i, 16); };
	void operator delete(void* p) { _aligned_free(p); };
};

#endif

UPDATE AIComp struct to initiate all variables except array


/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 *
 *  libhostile
 *
 *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 3 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#if defined(HAVE_LIBHOSTILE) && HAVE_LIBHOSTILE
void set_recv_close(bool arg, int frequency, int not_until_arg);

void set_send_close(bool arg, int frequency, int not_until_arg);
#else

#define set_recv_close(__arg, __frequency, __not_until_arg)
#define set_send_close(__arg, __frequency, __not_until_arg)

#endif

#ifdef __cplusplus
}
#endif

/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 *
 *  libhostile
 *
 *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 3 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

void set_recv_close(bool arg, int frequency, int not_until_arg);

void set_send_close(bool arg, int frequency, int not_until_arg);

#ifdef __cplusplus
}
#endif

Revert changes on .h file.

Revert changes on .h file.


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

#ifndef WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_

#include <string>
#include <vector>

// TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp.
// ImageDiff.cpp expects that PATH_MAX has already been defined :-/
#include <limits.h>

namespace webkit_support {

// Decode a PNG into an RGBA pixel array.
bool DecodePNG(const unsigned char* input, size_t input_size,
               std::vector<unsigned char>* output,
               int* width, int* height);

// Encode an RGBA pixel array into a PNG.
bool EncodeRGBAPNG(const unsigned char* input,
                   int width,
                   int height,
                   int row_byte_width,
                   std::vector<unsigned char>* output);

// Encode an BGRA pixel array into a PNG.
bool EncodeBGRAPNG(const unsigned char* input,
                   int width,
                   int height,
                   int row_byte_width,
                   bool discard_transparency,
                   std::vector<unsigned char>* output);

bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
                               int width,
                               int height,
                               int row_byte_width,
                               bool discard_transparency,
                               const std::string& checksum,
                               std::vector<unsigned char>* output);

}  // namespace webkit_support

#endif  // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_

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

#ifndef WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_

#include <string>
#include <vector>

namespace webkit_support {

// Decode a PNG into an RGBA pixel array.
bool DecodePNG(const unsigned char* input, size_t input_size,
               std::vector<unsigned char>* output,
               int* width, int* height);

// Encode an RGBA pixel array into a PNG.
bool EncodeRGBAPNG(const unsigned char* input,
                   int width,
                   int height,
                   int row_byte_width,
                   std::vector<unsigned char>* output);

// Encode an BGRA pixel array into a PNG.
bool EncodeBGRAPNG(const unsigned char* input,
                   int width,
                   int height,
                   int row_byte_width,
                   bool discard_transparency,
                   std::vector<unsigned char>* output);

bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
                               int width,
                               int height,
                               int row_byte_width,
                               bool discard_transparency,
                               const std::string& checksum,
                               std::vector<unsigned char>* output);

}  // namespace webkit_support

#endif  // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_

Remove an include which has been upstreamed to ImageDiff.cpp.

BUG=none
TEST=none

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

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


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

int print_tree(int length)
{
    int i = 0, j = 0;

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

    return 0;
}

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

    int length = atoi(argv[1]);

    print_tree(length);

    return 0;
}

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

void usage(char *argv0)
{
    printf("USAGE: %s [height] [half|full]\n", argv0);
    exit(-1);
}

int print_tree(int height, char half)
{
    int i = 0, j = 0;

    if (half) // Half tree
    {
        for (i = 0;i < height;i++)
        {
            for (j = 0;j <= i;j++)
            {
                printf("*");
            }
            printf("\n");
        }
    }
    else if (!half) // full tree
    {
        int max_width = 2 * (height - 1) + 1;

        for (i = 0;i < height;i++)
        {
            int width = i + height;
            for (j = 0;j < width;j++)
            {
                if (j < (height-1) - i)
                    printf(" ");
                else
                    printf("*");
            }
            printf("\n");
        }
    }

    return 0;
}

int main(int argc, char *argv[])
{
    if (argc != 3)
        usage(argv[0]);

    int height = atoi(argv[1]);

    char half = -1;
    if (!strncmp("half", argv[2], sizeof 4))
        half = 1;
    else if(!strncmp("full", argv[2], sizeof 4))
        half = 0;
    else
        usage(argv[0]);

    print_tree(height, half);

    return 0;
}

Add full/half option for tree.

Add full/half option for tree.


#define PORT 50000
#define TIMEOUT 10;

int waitforack(int sock);
int sendack(int sock);
int senderr(int sock, int ecode);
int sendfin(int sock);
int getsockfd();
int releasesockfd(int sock);

#define PORT 6012
#define TIMEOUT 10;

int waitforack(int sock);
int sendConnect(int sock);
int sendack(int sock);
int senderr(int sock, int ecode);
int sendFile(int sock, char * file);
int sendfin(int sock);
int getsockfd();
int releasesockfd(int sock);

Add missing sendFile function declaration


/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else
			return 0;
	}
	return value;
}

/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else if (data[i] >= 'a' && data[i] <= 'f')
			value += data[i]-'a' + 10;
		else
			return 0;
	}
	return value;
}

hex2dec(): Allow data to contain also lowercase hex characters.


#pragma once

// This header mainly contains functions needed by both Cpu and Debugger

#include "Base.h"

// Convenience cast functions
template <typename T>
constexpr int16_t S16(T v) {
    return static_cast<int16_t>(v);
}
template <typename T>
constexpr uint16_t U16(T v) {
    return static_cast<uint16_t>(v);
}
template <typename T>
constexpr uint32_t U32(T v) {
    return static_cast<uint32_t>(v);
}
template <typename T>
constexpr uint8_t U8(T v) {
    return static_cast<uint8_t>(v);
}
// Combine two 8-bit values into a 16-bit value
constexpr uint16_t CombineToU16(uint8_t msb, uint8_t lsb) {
    return U16(msb) << 8 | U16(lsb);
}
constexpr int16_t CombineToS16(uint8_t msb, uint8_t lsb) {
    return static_cast<int16_t>(CombineToU16(msb, lsb));
}

#pragma once

// This header mainly contains functions needed by both Cpu and Debugger

#include "Base.h"
#include <type_traits>

// Convenience cast functions
template <typename T>
constexpr int16_t S16(T v) {
    return static_cast<int16_t>(static_cast<std::make_signed_t<T>>(v));
}
template <typename T>
constexpr uint16_t U16(T v) {
    return static_cast<uint16_t>(v);
}
template <typename T>
constexpr uint32_t U32(T v) {
    return static_cast<uint32_t>(v);
}
template <typename T>
constexpr uint8_t U8(T v) {
    return static_cast<uint8_t>(v);
}
// Combine two 8-bit values into a 16-bit value
constexpr uint16_t CombineToU16(uint8_t msb, uint8_t lsb) {
    return U16(msb) << 8 | U16(lsb);
}
constexpr int16_t CombineToS16(uint8_t msb, uint8_t lsb) {
    return static_cast<int16_t>(CombineToU16(msb, lsb));
}

Cpu: Fix indexed mode instructions failing to add negative offset because value would not be correctly sign extended


#pragma once

#include <pthread.h>
#include <stdint.h>

namespace neosmart
{
	struct neosmart_event_t_;
	typedef neosmart_event_t_ * neosmart_event_t;

	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
	int DestroyEvent(neosmart_event_t event);
	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
	int SetEvent(neosmart_event_t event);
	int ResetEvent(neosmart_event_t event);
}

#pragma once

#include <pthread.h>
#include <stdint.h>

namespace neosmart
{
    //Type declarations
	struct neosmart_event_t_;
	typedef neosmart_event_t_ * neosmart_event_t;

    //WIN32-style pevent functions
	neosmart_event_t CreateEvent(bool manualReset = false, bool initialState = false);
	int DestroyEvent(neosmart_event_t event);
	int WaitForEvent(neosmart_event_t event, uint32_t milliseconds = -1);
	int SetEvent(neosmart_event_t event);
	int ResetEvent(neosmart_event_t event);

    //posix-style functions
    //TBD
}

TBD: Add posix-styled functions for using neosmart_event_t objects


/* $FreeBSD$ */
#ifndef __crypto_headers_h__
#define __crypto_headers_h__
#include <openssl/des.h>
#include <openssl/rc4.h>
#include <openssl/md4.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#endif /* __crypto_headers_h__ */

/* $FreeBSD$ */
#ifndef __crypto_headers_h__
#define __crypto_headers_h__
#define OPENSSL_DES_LIBDES_COMPATIBILITY
#include <openssl/des.h>
#include <openssl/rc4.h>
#include <openssl/md4.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#endif /* __crypto_headers_h__ */

Define OPENSSL_DES_LIBDES_COMPATIBILITY so that Heimdal will build with OpenSSL 0.9.7 when it is imported. (This currently has no effect.)


#include <unistd.h>

int main() {
  char c;
  while (read(STDIN_FILENO, &c, 1) == 1);
  return 0;
}

#include <unistd.h>

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

Quit after reading a q

Quit after reading a q


#include <stdio.h>

int MaxPairwiseProduct(int* numbers, int sizeofArray) {
  int result = 0;

  for (int i = 0; i < sizeofArray; ++i) {
    for (int j = i + 1; j < sizeofArray; ++j) {
      if (numbers[i] * numbers[j] > result) {
        result = numbers[i] * numbers[j];
      }
    }
  }
  return result;
}

int main(void){
	int n;
	char formatter[100];
	scanf("%d", &n);
	int numbers[n], i = 0;

	while (i < n && scanf("%d", &numbers[i++]) == 1);

	int result = MaxPairwiseProduct(numbers, n);
    printf("%d\n", result);
    return 0;
}

#include <stdio.h>

long long MaxPairwiseProduct(int* numbers, int sizeofArray) {
  long long result = 0;

  for (int i = 0; i < sizeofArray; ++i) {
    for (int j = i + 1; j < sizeofArray; ++j) {
      if (((long long)numbers[i]) * numbers[j] > result) {
        result = ((long long)numbers[i]) * numbers[j];
      }
    }
  }
  return result;
}

int main(void){
	int n;
	char formatter[100];
	scanf("%d", &n);
	int numbers[n], i = 0;

	while (i < n && scanf("%d", &numbers[i++]) == 1);

	long long result = MaxPairwiseProduct(numbers, n);
    printf("%lld\n", result);
    return 0;
}

Change result data type to long long

Change result data type to long long


//
//  STPPaymentIntentSourceActionAuthorizeWithURL.h
//  Stripe
//
//  Created by Daniel Jackson on 11/7/18.
//  Copyright © 2018 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "STPAPIResponseDecodable.h"

NS_ASSUME_NONNULL_BEGIN

/**
 The `STPPaymentIntentSourceAction` details when type is `authorize_with_url`.

 These are created & owned by the containing `STPPaymentIntent`.
 */
@interface STPPaymentIntentSourceActionAuthorizeWithURL: NSObject<STPAPIResponseDecodable>

/**
 You cannot directly instantiate an `STPPaymentIntentSourceActionAuthorizeWithURL`.
 */
- (instancetype)init __attribute__((unavailable("You cannot directly instantiate an STPPaymentIntentSourceActionAuthorizeWithURL.")));

/**
 The URL where the user will authorize this charge.
 */
@property (nonatomic, readonly) NSURL *url;

/**
 The return URL that'll be redirected back to when the user is done
 authorizing the charge.
 */
@property (nonatomic, nullable, readonly) NSURL *returnURL;

@end

NS_ASSUME_NONNULL_END

//
//  STPPaymentIntentSourceActionAuthorizeWithURL.h
//  Stripe
//
//  Created by Daniel Jackson on 11/7/18.
//  Copyright © 2018 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "STPAPIResponseDecodable.h"

NS_ASSUME_NONNULL_BEGIN

/**
 The `STPPaymentIntentSourceAction` details when type is `STPPaymentIntentSourceActionTypeAuthorizeWithURL`.

 These are created & owned by the containing `STPPaymentIntent`.
 */
@interface STPPaymentIntentSourceActionAuthorizeWithURL: NSObject<STPAPIResponseDecodable>

/**
 You cannot directly instantiate an `STPPaymentIntentSourceActionAuthorizeWithURL`.
 */
- (instancetype)init __attribute__((unavailable("You cannot directly instantiate an STPPaymentIntentSourceActionAuthorizeWithURL.")));

/**
 The URL where the user will authorize this charge.
 */
@property (nonatomic, readonly) NSURL *url;

/**
 The return URL that'll be redirected back to when the user is done
 authorizing the charge.
 */
@property (nonatomic, nullable, readonly) NSURL *returnURL;

@end

NS_ASSUME_NONNULL_END

Use SDK's enum value instead of server's string constant in documentation


/*
 * copyright 2015 wink saville
 *
 * licensed under the apache license, version 2.0 (the "license");
 * you may not use this file except in compliance with the license.
 * you may obtain a copy of the license at
 *
 *     http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing, software
 * distributed under the license is distributed on an "as is" basis,
 * without warranties or conditions of any kind, either express or implied.
 * see the license for the specific language governing permissions and
 * limitations under the license.
 */

#ifndef SADIE_ARCH_X86_LIBS_AC_THREAD_INCS_AC_THREAD_STACK_MIN_H
#define SADIE_ARCH_X86_LIBS_AC_THREAD_INCS_AC_THREAD_STACK_MIN_H

#define AC_THREAD_STACK_MIN 0x100

#endif

/*
 * copyright 2015 wink saville
 *
 * licensed under the apache license, version 2.0 (the "license");
 * you may not use this file except in compliance with the license.
 * you may obtain a copy of the license at
 *
 *     http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing, software
 * distributed under the license is distributed on an "as is" basis,
 * without warranties or conditions of any kind, either express or implied.
 * see the license for the specific language governing permissions and
 * limitations under the license.
 */

#ifndef SADIE_ARCH_X86_LIBS_AC_THREAD_INCS_AC_THREAD_STACK_MIN_H
#define SADIE_ARCH_X86_LIBS_AC_THREAD_INCS_AC_THREAD_STACK_MIN_H

#define AC_THREAD_STACK_MIN 0x1000

#endif

Increase x86 AC_THREAD_STACK_MIN to 4K from 256 bytes just incase


#include "irc.h"
#include "irccommand.h"
#include "ircconnection.h"
#include "ircglobal.h"
#include "ircmessage.h"
#include "ircfilter.h"
#include "ircnetwork.h"
#include "ircprotocol.h"

Include ircprotocol.h in the IrcCore module header


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

#ifndef DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_
#define DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_

#include "base/android/jni_android.h"
#include "device/vibration/vibration_manager.mojom.h"

namespace device {

// TODO(timvolodine): consider implementing the VibrationManager mojo service
// directly in java, crbug.com/439434.
class VibrationManagerImplAndroid
    : public mojo::InterfaceImpl<VibrationManager> {
 public:
  static VibrationManagerImplAndroid* Create();
  static bool Register(JNIEnv* env);

  void Vibrate(int64 milliseconds) override;
  void Cancel() override;

 private:
  VibrationManagerImplAndroid();
  virtual ~VibrationManagerImplAndroid();

  base::android::ScopedJavaGlobalRef<jobject> j_vibration_provider_;
};

}  // namespace device

#endif  // DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_

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

#ifndef DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_
#define DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_

#include "base/android/jni_android.h"
#include "device/vibration/vibration_manager.mojom.h"

namespace device {

// TODO(timvolodine): consider implementing the VibrationManager mojo service
// directly in java, crbug.com/439434.
class VibrationManagerImplAndroid
    : public mojo::InterfaceImpl<VibrationManager> {
 public:
  static VibrationManagerImplAndroid* Create();
  static bool Register(JNIEnv* env);

  void Vibrate(int64 milliseconds) override;
  void Cancel() override;

 private:
  VibrationManagerImplAndroid();
  ~VibrationManagerImplAndroid() override;

  base::android::ScopedJavaGlobalRef<jobject> j_vibration_provider_;
};

}  // namespace device

#endif  // DEVICE_VIBRATION_VIBRATION_MANAGER_IMPL_ANDROID_H_

Update {virtual,override,final} to follow C++11 style in device.

The Google style guide states that only one of {virtual,override,final}
should be used for each declaration, since override implies virtual and
final implies both virtual and override.

This patch was automatically generated with an OS=android build using a
variation of https://codereview.chromium.org/598073004.

BUG=417463
R=timvolodine@chromium.org

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

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


// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
// RUN: grep 'define signext i8 @f0()' %t &&
// RUN: grep 'define signext i16 @f1()' %t &&
// RUN: grep 'define i32 @f2()' %t &&
// RUN: grep 'define float @f3()' %t &&
// RUN: grep 'define double @f4()' %t &&
// RUN: grep 'define x86_fp80 @f5()' %t &&
// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t

char f0(void) {
}

short f1(void) {
}

int f2(void) {
}

float f3(void) {
}

double f4(void) {
}

long double f5(void) {
}

void f6(char a0, short a1, int a2, long long a3, void *a4) {
}

// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
// RUN: grep 'define signext i8 @f0()' %t &&
// RUN: grep 'define signext i16 @f1()' %t &&
// RUN: grep 'define i32 @f2()' %t &&
// RUN: grep 'define float @f3()' %t &&
// RUN: grep 'define double @f4()' %t &&
// RUN: grep 'define x86_fp80 @f5()' %t &&
// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t &&
// RUN: grep 'define void @f7(i32 %a0)' %t

char f0(void) {
}

short f1(void) {
}

int f2(void) {
}

float f3(void) {
}

double f4(void) {
}

long double f5(void) {
}

void f6(char a0, short a1, int a2, long long a3, void *a4) {
}

typedef enum { A, B, C } E;

void f7(E a0) {
}

Add test for enum types

Add test for enum types

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


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

#ifndef VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_
#define VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_
#pragma once

namespace views {

// An interface implemented by an object to let it know that a tabbed pane was
// selected by the user at the specified index.
class TabbedPaneListener {
 public:
  // Called when the tab at |index| is selected by the user.
  virtual void TabSelectedAt(int index) = 0;
};

}  // namespace views

#endif  // VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_

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

#ifndef VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_
#define VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_
#pragma once

namespace views {

// An interface implemented by an object to let it know that a tabbed pane was
// selected by the user at the specified index.
class TabbedPaneListener {
 public:
  // Called when the tab at |index| is selected by the user.
  virtual void TabSelectedAt(int index) = 0;

 protected:
  virtual ~TabbedPaneListener() {}
};

}  // namespace views

#endif  // VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_LISTENER_H_

views: Add protected virtual destructor to TabbedPaneListener.

The use of a protected virtual destructor is to prevent the destruction of a
derived object via a base-class pointer.

That's it, TabbedPaneListenere should only be deleted through derived class.

Example:

class FooListener {
 public:
  ...

 protected:
  virtual ~FooListener() {}
};

class Foo : public FooListener {
};

FooListener* listener = new Foo;
delete listener;  // It should prevent this situation!

R=sky@chromium.org

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

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


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

#include "mono_embeddinator.h"

int main()
{
  mono_m2n_context_t ctx;
  mono_m2n_init(&ctx, "mono_embeddinnator");

  /* YOUR CODE HERE */

  mono_m2n_destroy(&ctx);
}

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

#include "mono_embeddinator.h"

int main()
{
  mono_m2n_context_t ctx = {};
  mono_m2n_init(&ctx, "mono_embeddinnator");

  /* YOUR CODE HERE */

  mono_m2n_destroy(&ctx);
}

Initialize the local Mono context struct for deterministic behavior.


/*********************************************************************
 *
 * Filename:      irlan_filter.h
 * Version:
 * Description:
 * Status:        Experimental.
 * Author:        Dag Brattli <dagb@cs.uit.no>
 * Created at:    Fri Jan 29 15:24:08 1999
 * Modified at:   Sun Feb  7 23:35:31 1999
 * Modified by:   Dag Brattli <dagb@cs.uit.no>
 *
 *     Copyright (c) 1998 Dag Brattli, All Rights Reserved.
 *
 *     This program is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of
 *     the License, or (at your option) any later version.
 *
 *     Neither Dag Brattli nor University of Troms admit liability nor
 *     provide warranty for any of this software. This material is
 *     provided "AS-IS" and at no charge.
 *
 ********************************************************************/

#ifndef IRLAN_FILTER_H
#define IRLAN_FILTER_H

void irlan_check_command_param(struct irlan_cb *self, char *param,
			       char *value);
void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb);
void irlan_print_filter(struct seq_file *seq, int filter_type);

#endif /* IRLAN_FILTER_H */

/*********************************************************************
 *
 * Filename:      irlan_filter.h
 * Version:
 * Description:
 * Status:        Experimental.
 * Author:        Dag Brattli <dagb@cs.uit.no>
 * Created at:    Fri Jan 29 15:24:08 1999
 * Modified at:   Sun Feb  7 23:35:31 1999
 * Modified by:   Dag Brattli <dagb@cs.uit.no>
 *
 *     Copyright (c) 1998 Dag Brattli, All Rights Reserved.
 *
 *     This program is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of
 *     the License, or (at your option) any later version.
 *
 *     Neither Dag Brattli nor University of Troms admit liability nor
 *     provide warranty for any of this software. This material is
 *     provided "AS-IS" and at no charge.
 *
 ********************************************************************/

#ifndef IRLAN_FILTER_H
#define IRLAN_FILTER_H

void irlan_check_command_param(struct irlan_cb *self, char *param,
			       char *value);
void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb);
#ifdef CONFIG_PROC_FS
void irlan_print_filter(struct seq_file *seq, int filter_type);
#endif

#endif /* IRLAN_FILTER_H */

[IRDA] irlan: Fix compile warning when CONFIG_PROC_FS=n

include/net/irda/irlan_filter.h:31: warning: 'struct seq_file' declared inside parameter list
include/net/irda/irlan_filter.h:31: warning: its scope is only this definition or declaration, which is probably not what you want

Signed-off-by: Randy Dunlap <e1d10faa7e2a0c027bf1ff1d20e7fd10154be7ea@oracle.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


// This file is part of MicroRestD <http://github.com/ufal/microrestd/>.
//
// Copyright 2015 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 <cstring>
#include <string>

namespace ufal {
namespace microrestd {

struct string_piece {
  const char* str;
  size_t len;

  string_piece() : str(nullptr), len(0) {}
  string_piece(const char* str) : str(str), len(strlen(str)) {}
  string_piece(const char* str, size_t len) : str(str), len(len) {}
  string_piece(const std::string& str) : str(str.c_str()), len(str.size()) {}
};

} // namespace microrestd
} // namespace ufal

// This file is part of MicroRestD <http://github.com/ufal/microrestd/>.
//
// Copyright 2015 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 <cstring>
#include <string>

namespace ufal {
namespace microrestd {

struct string_piece {
  const char* str;
  size_t len;

  string_piece() : str(nullptr), len(0) {}
  string_piece(const char* str) : str(str), len(str ? strlen(str) : 0) {}
  string_piece(const char* str, size_t len) : str(str), len(len) {}
  string_piece(const std::string& str) : str(str.c_str()), len(str.size()) {}
};

} // namespace microrestd
} // namespace ufal

Allow passing nullptr as only const char* argument.


//
//  LYPopView.h
//  LYPOPVIEW
//
//  CREATED BY LUO YU ON 19/12/2016.
//  COPYRIGHT © 2016 LUO YU. ALL RIGHTS RESERVED.
//

#import <UIKit/UIKit.h>

@interface LYPopView : UIView {

	CGFloat padding;
	CGFloat cornerRadius;
	CGFloat maxHeight;

	__weak UIView *vCont;
}

@property (nonatomic, strong) NSString *title;

@property (nonatomic, assign) BOOL autoDismiss;

- (void)show;

- (NSDictionary *)configurations;

@end

//
//  LYPopView.h
//  LYPOPVIEW
//
//  CREATED BY LUO YU ON 19/12/2016.
//  COPYRIGHT © 2016 LUO YU. ALL RIGHTS RESERVED.
//

#import <UIKit/UIKit.h>

@interface LYPopView : UIView {

	CGFloat padding;
	CGFloat cornerRadius;
	CGFloat maxHeight;

	__weak UIView *vCont;
}

@property (nonatomic, strong) NSString *title;

@property (nonatomic, assign) BOOL autoDismiss;

- (void)show;

- (void)dismiss;

- (NSDictionary *)configurations;

@end

Modify : enable dismiss method

Modify : enable dismiss method


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

#include <glog/logging.h>
#include <proxygen/lib/utils/Time.h>

namespace proxygen {

class MockTimeUtil : public TimeUtil {
 public:

  void advance(std::chrono::milliseconds ms) {
    t_ += ms;
  }

  void setCurrentTime(TimePoint t) {
    CHECK(t.time_since_epoch() > t_.time_since_epoch())
      << "Time can not move backwards";
    t_ = t;
  }

  void verifyAndClear() {
  }

  TimePoint now() const override {
    return t_;
  }

 private:
  TimePoint t_;
};

}

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

#include <glog/logging.h>
#include <proxygen/lib/utils/Time.h>

namespace proxygen {

template <typename ClockType = std::chrono::steady_clock>
class MockTimeUtilGeneric : public TimeUtilGeneric<ClockType> {
 public:

  void advance(std::chrono::milliseconds ms) {
    t_ += ms;
  }

  void setCurrentTime(std::chrono::time_point<ClockType> t) {
    CHECK(t.time_since_epoch() > t_.time_since_epoch())
      << "Time can not move backwards";
    t_ = t;
  }

  void verifyAndClear() {
  }

  std::chrono::time_point<ClockType> now() const override {
    return t_;
  }

 private:
  std::chrono::time_point<ClockType> t_;
};

using MockTimeUtil = MockTimeUtilGeneric<>;

}

Expire cached TLS session tickets using tlsext_tick_lifetime_hint

Summary:
Our current TLS cache in liger does not respect timeout hints. We should
start doing that because it will limit certain kinds of attacks if an
attacker gets access to a master key.

Test Plan: Added new test in SSLSessionPersistentCacheTest to test expiration

Reviewed By: subodh@fb.com

Subscribers: bmatheny, seanc, yfeldblum, devonharris

FB internal diff: D2299744

Tasks: 7633098

Signature: t1:2299744:1439331830:9d0770149e49b6094ca61bac4e1e4ef16938c4dc


#pragma once

// This file is part of 'Atoms' library - https://github.com/yaqwsx/atoms
// Author: Jan 'yaqwsx' Mrázek

#include <array>
#include <initializer_list>
#include <algorithm>

namespace atoms {

template <class T, size_t SIZE>
class RollingAverage {
public:
    RollingAverage() : sum(0), index(0)
    {
        std::fill(values.begin(), values.end(), T(0));
    };

    void push(const T& t) {
        sum += t - values[index];
        values[index] = t;
        index++;
        if (index == SIZE)
            index = 0;
    }

    T get_average() {
        return sum / T(SIZE);
    }

    T get_sum() {
        return sum;
    }

    void clear(T t = 0) {
        std::fill(values.begin(), values.end(), t);
        sum = t * SIZE;
    }

private:
    std::array<T, SIZE> values;
    T sum;
    size_t index;
};

}

#pragma once

// This file is part of 'Atoms' library - https://github.com/yaqwsx/atoms
// Author: Jan 'yaqwsx' Mrázek

#include <array>
#include <initializer_list>
#include <algorithm>

namespace atoms {

template <class T, size_t SIZE>
class RollingAverage {
public:
    RollingAverage() : sum(0), index(0)
    {
        std::fill(begin(), end(), T(0));
    };

    void push(const T& t) {
        sum += t - values[index];
        values[index] = t;
        index++;
        if (index == SIZE)
            index = 0;
    }

    T get_average() {
        return sum / T(SIZE);
    }

    T get_sum() {
        return sum;
    }

    void clear(T t = 0) {
        std::fill(begin(), end(), t);
        sum = t * SIZE;
    }

    T *begin() { return values; }
    T *end() { return values + SIZE; }
private:
    T values[ SIZE ];
    T sum;
    size_t index;
};

}

Remove std::array dependency of RollingAverage

This makes it compatible with MCUs without STL.


// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s

// Under Windows 64, int and long are 32-bits.  Make sure pointer math doesn't
// cause any sign extensions.

// CHECK:      [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*]]
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]] [[Q]], i64 0, i32 0

#define CR(Record, TYPE, Field) \
  ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))

typedef struct _LIST_ENTRY {
  struct _LIST_ENTRY  *ForwardLink;
  struct _LIST_ENTRY  *BackLink;
} LIST_ENTRY;

typedef struct {
  unsigned long long    Signature;
  LIST_ENTRY            Link;
} MEMORY_MAP;

int test(unsigned long long param)
{
  LIST_ENTRY      *Link;
  MEMORY_MAP      *Entry;

  Link = (LIST_ENTRY *) param;

  Entry = CR (Link, MEMORY_MAP, Link);
  return (int) Entry->Signature;
}

// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s

// Under Windows 64, int and long are 32-bits.  Make sure pointer math doesn't
// cause any sign extensions.

// CHECK:      [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*\*]]
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]] [[Q]], i64 0, i32 0

#define CR(Record, TYPE, Field) \
  ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))

typedef struct _LIST_ENTRY {
  struct _LIST_ENTRY  *ForwardLink;
  struct _LIST_ENTRY  *BackLink;
} LIST_ENTRY;

typedef struct {
  unsigned long long    Signature;
  LIST_ENTRY            Link;
} MEMORY_MAP;

int test(unsigned long long param)
{
  LIST_ENTRY      *Link;
  MEMORY_MAP      *Entry;

  Link = (LIST_ENTRY *) param;

  Entry = CR (Link, MEMORY_MAP, Link);
  return (int) Entry->Signature;
}

Tweak regex not to accidentally match a trailing \r.

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


const char *colorname[] = {{

  /* 8 normal colors */
  [0] = "{color0}", /* black   */
  [1] = "{color1}", /* red     */
  [2] = "{color2}", /* green   */
  [3] = "{color3}", /* yellow  */
  [4] = "{color4}", /* blue    */
  [5] = "{color5}", /* magenta */
  [6] = "{color6}", /* cyan    */
  [7] = "{color7}", /* white   */

  /* 8 bright colors */
  [8]  = "{color8}",  /* black   */
  [9]  = "{color9}",  /* red     */
  [10] = "{color10}", /* green   */
  [11] = "{color11}", /* yellow  */
  [12] = "{color12}", /* blue    */
  [13] = "{color13}", /* magenta */
  [14] = "{color14}", /* cyan    */
  [15] = "{color15}", /* white   */

  /* special colors */
  [256] = "{background}", /* background */
  [257] = "{foreground}", /* foreground */
  [258] = "{cursor}",     /* cursor */
}};

/* Default colors (colorname index)
 * foreground, background, cursor */
 unsigned int defaultbg = 256;
 unsigned int defaultfg = 257;
 unsigned int defaultcs = 258;

const char *colorname[] = {{

  /* 8 normal colors */
  [0] = "{color0}", /* black   */
  [1] = "{color1}", /* red     */
  [2] = "{color2}", /* green   */
  [3] = "{color3}", /* yellow  */
  [4] = "{color4}", /* blue    */
  [5] = "{color5}", /* magenta */
  [6] = "{color6}", /* cyan    */
  [7] = "{color7}", /* white   */

  /* 8 bright colors */
  [8]  = "{color8}",  /* black   */
  [9]  = "{color9}",  /* red     */
  [10] = "{color10}", /* green   */
  [11] = "{color11}", /* yellow  */
  [12] = "{color12}", /* blue    */
  [13] = "{color13}", /* magenta */
  [14] = "{color14}", /* cyan    */
  [15] = "{color15}", /* white   */

  /* special colors */
  [256] = "{background}", /* background */
  [257] = "{foreground}", /* foreground */
  [258] = "{cursor}",     /* cursor */
}};

/* Default colors (colorname index)
 * foreground, background, cursor */
 unsigned int defaultbg = 0;
 unsigned int defaultfg = 257;
 unsigned int defaultcs = 258;

Fix bg color not updating

st: Fix bg color not updating


#ifndef QML_SOCKETS_TCP_SERVER
#define QML_SOCKETS_TCP_SERVER

#include <QtNetwork>

#include "tcp.h"

class TCPServer : public QObject
{
    Q_OBJECT

    Q_PROPERTY(uint port MEMBER m_port NOTIFY portChanged)

signals:
    void portChanged();

    void clientRead(TCPSocket* client, const QString &message);
    void clientConnected(TCPSocket* client);
    void clientDisconnected(TCPSocket* client);

public:
    TCPServer()
    {
        m_server = new QTcpServer(this);

        QObject::connect(m_server, &QTcpServer::newConnection,
        [=]() {
            TCPSocket *client = \
                new TCPSocket(m_server->nextPendingConnection());

            QObject::connect(client, &TCPSocket::read,
            [=](const QString &message) {
                emit clientRead(client, message);
            });

            QObject::connect(client, &TCPSocket::disconnected,
            [=]() {
                emit clientDisconnected(client);
                delete client;
            });

            emit clientConnected(client);
        });

    };

    ~TCPServer()
    {
    }

public slots:
    void listen()
    { m_server->listen(QHostAddress::Any, m_port); }

public:
    uint m_port;
    QTcpServer *m_server = NULL;
};

#endif

#ifndef QML_SOCKETS_TCP_SERVER
#define QML_SOCKETS_TCP_SERVER

#include <QtNetwork>

#include "tcp.h"

class TCPServer : public QObject
{
    Q_OBJECT

    Q_PROPERTY(uint port MEMBER m_port NOTIFY portChanged)

signals:
    void portChanged();

    void clientRead(TCPSocket* client, const QString &message);
    void clientConnected(TCPSocket* client);
    void clientDisconnected(TCPSocket* client);

public:
    TCPServer()
    {
        m_server = new QTcpServer(this);

        QObject::connect(m_server, &QTcpServer::newConnection,
        [=]() {
            TCPSocket *client = \
                new TCPSocket(m_server->nextPendingConnection());

            QObject::connect(client, &TCPSocket::read,
            [=](const QString &message) {
                emit clientRead(client, message);
            });

            QObject::connect(client, &TCPSocket::disconnected,
            [=]() {
                emit clientDisconnected(client);
                delete client;
            });

            emit clientConnected(client);
        });
    };

    ~TCPServer()
    { delete m_server; m_server = NULL; }

public slots:
    void listen()
    { m_server->listen(QHostAddress::Any, m_port); }

public:
    uint m_port;
    QTcpServer *m_server = NULL;
};

#endif

Add deletion of m_server from TCPServer in destructor

--HG--
extra : amend_source : 0364038a316b4f2a036025a5e896379ac29f77c5


/*
 * Copyright (c) 2015 Ivan Valiulin
 *
 * This file is part of viaVR.
 *
 * viaVR 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.
 *
 * viaVR 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 viaVR. If not, see http://www.gnu.org/licenses
 */

R"(#version 300 es
precision mediump float;

uniform sampler2D video;
in vec2 coord;
out vec4 outColor;

void main () {
	outColor = texture (video, coord);
})";

/*
 * Copyright (c) 2015 Ivan Valiulin
 *
 * This file is part of viaVR.
 *
 * viaVR 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.
 *
 * viaVR 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 viaVR. If not, see http://www.gnu.org/licenses
 */

R"(#version 300 es
precision highp float;

uniform sampler2D video;
in vec2 coord;
out vec4 outColor;

void main () {
	outColor = texture (video, coord);
})";

Switch display fragment shader to highp

Switch display fragment shader to highp


// Copyright (c) 2014-2017, NetApp, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "common.h"

int main(void)
{
    init();
    io(111111);
    cleanup();
}

// Copyright (c) 2014-2017, NetApp, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "common.h"

int main(void)
{
    init();
    io(8);
    cleanup();
}

Use a saner test size

Use a saner test size


//
//  MGSFragariaPrefsViewController.h
//  Fragaria
//
//  Created by Jonathan on 22/10/2012.
//
//

#import <Cocoa/Cocoa.h>

/**
 *  MGSFragariaPrefsViewController provides a base class for other Fragaria
 *  preferences controllers. It is not implemented directly anywhere.
 *  @see MGSFragariaFontsAndColorsPrefsViewController.h
 *  @see MGSFragariaTextEditingPrefsViewController.h
 **/

@interface MGSFragariaPrefsViewController : NSViewController <NSTabViewDelegate>

/**
 *  Commit edits, discarding changes on error.
 **/
- (BOOL)commitEditingAndDiscard:(BOOL)discard;

@end

//
//  MGSFragariaPrefsViewController.h
//  Fragaria
//
//  Created by Jonathan on 22/10/2012.
//
//

#import <Cocoa/Cocoa.h>

/**
 *  MGSFragariaPrefsViewController provides a base class for other Fragaria
 *  preferences controllers. It is not implemented directly anywhere.
 *  @see MGSFragariaFontsAndColoursPrefsViewController
 *  @see MGSFragariaTextEditingPrefsViewController
 **/

@interface MGSFragariaPrefsViewController : NSViewController <NSTabViewDelegate>

/**
 *  Commit edits, discarding changes on error.
 *  @param discard indicates whether or not to discard current uncommitted changes.
 **/
- (BOOL)commitEditingAndDiscard:(BOOL)discard;

@end

Add @param description for AppleDoc.

Add @param description for AppleDoc.


#include "common.h"

static void args_empty(void **state) {
    args *args = *state;

    assert_null(args->opts);
    assert_null(args->operands);
}

static void add_option_passed_null(void **state) {
    args *args = *state;

    assert_int_equal(
            ARGPARSE_PASSED_NULL,
            args_add_option(args, NULL)
            );
}

static void empty_option_fail(void **state) {
    args *args = *state;

    option *opt = option_new("", "", "");
    assert_int_equal(
            ARGPARSE_EMPTY_OPTION,
            args_add_option(args, opt)
            );

    option_free(opt);
}

static void add_operand_passed_null(void **state) {
    args *args = *state;

    assert_int_equal(
            ARGPARSE_PASSED_NULL,
            args_add_operand(args, NULL)
            );
}

int main() {
    const struct CMUnitTest tests[] = {
        cmocka_unit_test(args_empty),
        cmocka_unit_test(add_option_passed_null),
        cmocka_unit_test(empty_option_fail),
        cmocka_unit_test(add_operand_passed_null),
    };

    return cmocka_run_group_tests(tests, common_setup, common_teardown);
}

#include "common.h"

static void args_empty(void **state) {
    args *args = *state;

    assert_null(args->opts);
    assert_null(args->operands);
}

static void add_option_passed_null(void **state) {
    args *args = *state;

    assert_int_equal(
            ARGPARSE_PASSED_NULL,
            args_add_option(args, NULL)
            );
}

static void empty_option_fail(void **state) {
    args *args = *state;

    option *opt = option_new("", "", "");
    assert_int_equal(
            ARGPARSE_EMPTY_OPTION,
            args_add_option(args, opt)
            );

    option_free(opt);
}

static void add_operand_passed_null(void **state) {
    args *args = *state;

    assert_int_equal(
            ARGPARSE_PASSED_NULL,
            args_add_operand(args, NULL)
            );
}

int main() {
    #define TEST(test) cmocka_unit_test_setup_teardown( \
            test, \
            common_setup, \
            common_teardown \
            )

    const struct CMUnitTest tests[] = {
        TEST(args_empty),
        TEST(add_option_passed_null),
        TEST(empty_option_fail),
        TEST(add_operand_passed_null),
    };

    return cmocka_run_group_tests(tests, NULL, NULL);
}

Use a TEST() macro to run common_{setup,teardown}


/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS.

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include <rtems/error.h>
#include <rtems/system.h>
#include <rtems/rtems/tasks.h>

/* RTEMS does not support GNU TLS extension __thread.  */
void
__wrap_rtems_task_variable_add (void **var)
{
  rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    {
      rtems_error (sc, "rtems_task_variable_add failed");
    }
}

/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS.

   Copyright 2010 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include <assert.h>

#include <rtems/error.h>
#include <rtems/system.h>
#include <rtems/rtems/tasks.h>

/* RTEMS does not support GNU TLS extension __thread.  */
void
__wrap_rtems_task_variable_add (void **var)
{
  rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    {
      rtems_error (sc, "rtems_task_variable_add failed");
      assert (0);
    }
}

Add assert on rtems_task_variable_add error.

assert is used so that if rtems_task_variable_add fails, the error
is fatal.

R=iant
CC=gofrontend-dev, joel.sherrill
https://golang.org/cl/1684053


/*
   For more information, please see: http://software.sci.utah.edu

   The MIT License

   Copyright (c) 2011 Scientific Computing and Imaging Institute,
   University of Utah.

   Permission is hereby granted, free of charge, to any person obtaining a
   copy of this software and associated documentation files (the "Software"),
   to deal in the Software without restriction, including without limitation
   the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included
   in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   DEALINGS IN THE SOFTWARE.
*/
#pragma once

#ifndef TUVOK_COMMAND_H
#define TUVOK_COMMAND_H

namespace tuvok {

/// Return value for an executed Command.
class CommandReturn {
  public:
    virtual ~CommandReturn() {}
};

}

#endif /* TUVOK_COMMAND_H */

Add empty shell for return value of a command.

git-svn-id: 0a20d38d1bcdb3210d244a647211d61b0aabf366@152 5b8196f7-c1c0-4be6-8b13-4feed349168d