#ifndef __MORDOR_LIMITED_STREAM_H__
#define __MORDOR_LIMITED_STREAM_H__
// Copyright (c) 2009 - Mozy, Inc.

#include "filter.h"

namespace Mordor {

class LimitedStream : public MutatingFilterStream
{
public:
    typedef boost::shared_ptr<LimitedStream> ptr;

public:
    LimitedStream(Stream::ptr parent, long long size, bool own = true);

    bool strict() { return m_strict; }
    void strict(bool strict) { m_strict = strict; }

    bool supportsSeek() { return parent()->supportsSeek(); }
    bool supportsTell() { return true; }
    bool supportsSize() { return true; }
    bool supportsTruncate() { return false; }

    size_t read(Buffer &b, size_t len);
    size_t write(const Buffer &b, size_t len);
    long long seek(long long offset, Anchor anchor = BEGIN);
    long long size();
    void truncate(long long size);
    void unread(const Buffer &b, size_t len);

private:
    long long m_pos, m_size;
    bool m_strict;
};

}

#endif

#ifndef __MORDOR_LIMITED_STREAM_H__
#define __MORDOR_LIMITED_STREAM_H__
// Copyright (c) 2009 - Mozy, Inc.

#include "filter.h"

namespace Mordor {

class LimitedStream : public MutatingFilterStream
{
public:
    typedef boost::shared_ptr<LimitedStream> ptr;

public:
    LimitedStream(Stream::ptr parent, long long size, bool own = true);

    void reset() { m_pos = 0; }
    void reset(long long size) { m_pos = 0; m_size = size; }

    bool strict() { return m_strict; }
    void strict(bool strict) { m_strict = strict; }

    bool supportsSeek() { return parent()->supportsSeek(); }
    bool supportsTell() { return true; }
    bool supportsSize() { return true; }
    bool supportsTruncate() { return false; }

    size_t read(Buffer &b, size_t len);
    size_t write(const Buffer &b, size_t len);
    long long seek(long long offset, Anchor anchor = BEGIN);
    long long size();
    void truncate(long long size);
    void unread(const Buffer &b, size_t len);

private:
    long long m_pos, m_size;
    bool m_strict;
};

}

#endif

Support for resetting a LimitedStream

Support for resetting a LimitedStream

Both current position, and total length.

Change-Id: Ia484e8b91e98d8cd2153496cbb1d5b183dacb14f
Reviewed-on: https://gerrit.dechocorp.com/8980
Reviewed-by: Punky Brewster (labs admin) <4fefd66e0791c836d3da15985fe778b56ecb4b1b@example.com>
Reviewed-by: Jeremy Stanley <b3f594e10a9edcf5413cf1190121d45078c62290@mozy.com>


// RUN: %clang_cc1  %s -emit-llvm -o - | grep llvm.memset | count 3

#ifndef memset
void *memset(void*, int, unsigned long);
#endif
#ifndef bzero
void bzero(void*, unsigned long);
#endif

void test(int* X, char *Y) {
  // CHECK: call i8* llvm.memset
  memset(X, 4, 1000);
  // CHECK: call void bzero
  bzero(Y, 100);
}

// RUN: %clang_cc1  %s -emit-llvm -o - | grep llvm.memset | count 3

typedef __SIZE_TYPE__ size_t;
void *memset(void*, int, size_t);
void bzero(void*, size_t);

void test(int* X, char *Y) {
  // CHECK: call i8* llvm.memset
  memset(X, 4, 1000);
  // CHECK: call void bzero
  bzero(Y, 100);
}

Use the correct definition for memset.

Use the correct definition for memset.

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


#include <stdio.h>

int ssearch(int number, int target){
	if (number == 0)
		if (target == 0) return 1;
		else 			 return 0;
	else
		return ssearch(number/10, target) + (number % 10 == target);
}

int main(){
	printf("%d\n", ssearch(762021192, 2));
	return 0;
}

Resolve q3 (pythonic way? so close)

Resolve q3 (pythonic way? so close)


//
//  VOKAlertHelper.h
//  VOKUtilities
//
//  Created by Rachel Hyman on 6/15/15.
//  Copyright (c) 2015 Vokal. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <VOKAlertAction.h>

typedef void(^VOKAlertHelperActionBlock)(void);

NS_ASSUME_NONNULL_BEGIN

@interface VOKAlertHelper : NSObject

/**
 *  Displays an alert in the OS-appropriate fashion.
 *
 *  @param viewController View controller responsible for presenting the alert.
 *  @param title          Title for the alert.
 *  @param message        Message for the alert.
 *  @param buttons        Array of VOKAlertAction objects that correspond to button(s). Must have at least one object.
 */
+ (void)showAlertFromViewController:(UIViewController *)viewController
                          withTitle:(nullable NSString *)title
                            message:(nullable NSString *)message
                            buttons:(NSArray<VOKAlertAction *> *)buttons;

@end

NS_ASSUME_NONNULL_END

//
//  VOKAlertHelper.h
//  VOKUtilities
//
//  Created by Rachel Hyman on 6/15/15.
//  Copyright (c) 2015 Vokal. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "VOKAlertAction.h"

typedef void(^VOKAlertHelperActionBlock)(void);

NS_ASSUME_NONNULL_BEGIN

@interface VOKAlertHelper : NSObject

/**
 *  Displays an alert in the OS-appropriate fashion.
 *
 *  @param viewController View controller responsible for presenting the alert.
 *  @param title          Title for the alert.
 *  @param message        Message for the alert.
 *  @param buttons        Array of VOKAlertAction objects that correspond to button(s). Must have at least one object.
 */
+ (void)showAlertFromViewController:(UIViewController *)viewController
                          withTitle:(nullable NSString *)title
                            message:(nullable NSString *)message
                            buttons:(NSArray<VOKAlertAction *> *)buttons;

@end

NS_ASSUME_NONNULL_END

Use quotes for local include

Use quotes for local include


#import "WMFArticleListTableViewController.h"

@interface WMFDisambiguationPagesViewController : WMFArticleListTableViewController

@property (nonatomic, strong, readonly) MWKArticle* article;

- (instancetype)initWithArticle:(MWKArticle*)article dataStore:(MWKDataStore*)dataStore;

@end

#import "WMFArticleListDataSourceTableViewController.h"

@interface WMFDisambiguationPagesViewController : WMFArticleListDataSourceTableViewController

@property (nonatomic, strong, readonly) MWKArticle* article;

- (instancetype)initWithArticle:(MWKArticle*)article dataStore:(MWKDataStore*)dataStore;

@end

Update disambiguation VC base class

Update disambiguation VC base class


#ifndef DATASET_H
#define DATASET_H

#include "Record.h"
#include "Filter.h"
#include "RIVVector.h"

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

template<typename... Ts>
class RIVDataSet {
public:
    RIVVector<RIVRecord<Ts...>> records;
    RIVVector<Filter*> filters;

};

//class RIVDataSet
//{
//private :
//	//map<string,vector<int>> int_records;
//    std::vector<RIVRecord<float>> float_records;
//
//    std::vector<Filter*> filters;
//
//    std::map<int,bool> filtered_values; //Whether or not the value was filtered by any applied filters
//	//vector<int> filtered_value_indices; //Record value indices that do not pass the filters. //CAUTION: Obsolete, not efficient
//
//public:
//	RIVDataSet(void);
//	~RIVDataSet(void);
//	//void AddData(string name,vector<int>);
//	void AddRecord(RIVRecord<float>);
//    std::pair<float,float>* MinMax(int);
//	size_t NumberOfRecords();
//	size_t NumberOfValuesPerRecord();
//	RIVRecord<float>* GetRecord(int);
//	float* GetRecordValue(int,int);
//	void AddFilter(Filter*);
//	bool HasFilters();
//	void ClearFilters();
//	void ApplyFilters();
//};

#endif

#ifndef DATASET_H
#define DATASET_H

#include "Record.h"
#include "Filter.h"
#include "RIVVector.h"

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

template<typename... Ts>
class RIVDataSet {
public:
    RIVVector<RIVRecord<Ts...>> records;
};

//class RIVDataSet
//{
//private :
//	//map<string,vector<int>> int_records;
//    std::vector<RIVRecord<float>> float_records;
//
//    std::vector<Filter*> filters;
//
//    std::map<int,bool> filtered_values; //Whether or not the value was filtered by any applied filters
//	//vector<int> filtered_value_indices; //Record value indices that do not pass the filters. //CAUTION: Obsolete, not efficient
//
//public:
//	RIVDataSet(void);
//	~RIVDataSet(void);
//	//void AddData(string name,vector<int>);
//	void AddRecord(RIVRecord<float>);
//    std::pair<float,float>* MinMax(int);
//	size_t NumberOfRecords();
//	size_t NumberOfValuesPerRecord();
//	RIVRecord<float>* GetRecord(int);
//	float* GetRecordValue(int,int);
//	void AddFilter(Filter*);
//	bool HasFilters();
//	void ClearFilters();
//	void ApplyFilters();
//};

#endif

Revert "Introduced a neat vector class"

Revert "Introduced a neat vector class"

This reverts commit 15b0b1147ad0f2f77ae9b485ceb323c84f8d439f.


// RUN: %llvmgcc -S %s
typedef struct {
  union {
    struct { } __attribute((packed));
  };
} fenv_t;
const fenv_t _FE_DFL_ENV = {{{ 0, 0, 0, 0 }}};

Add a RUN line to the test case to make it functional.  <rdar://problem/9055247>

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


/***************************************************************************/
/* sha.h								   */
/*									   */
/* SHA-1 code header file.						   */
/* Taken from the public domain implementation by Peter C. Gutmann	   */
/* on 2 Sep 1992, modified by Carl Ellison to be SHA-1.			   */
/***************************************************************************/

#ifndef _SHA_H_
#define _SHA_H_

/* Define APG_LITTLE_ENDIAN if the machine is little-endian */

#define APG_LITTLE_ENDIAN

/* Useful defines/typedefs */

typedef unsigned char   BYTE ;
typedef unsigned long   LONG ;

/* The SHA block size and message digest sizes, in bytes */

#define SHA_BLOCKSIZE   64
#define SHA_DIGESTSIZE  20

/* The structure for storing SHA info */

typedef struct {
  LONG digest[ 5 ] ;            /* Message digest */
  LONG countLo, countHi ;       /* 64-bit bit count */
  LONG data[ 16 ] ;             /* SHA data buffer */
  LONG slop ;			/* # of bytes saved in data[] */
} apg_SHA_INFO ;

void apg_shaInit( apg_SHA_INFO *shaInfo ) ;
void apg_shaUpdate( apg_SHA_INFO *shaInfo, BYTE *buffer, int count ) ;
void apg_shaFinal( apg_SHA_INFO *shaInfo, BYTE hash[SHA_DIGESTSIZE] ) ;

#endif /* _SHA_H_ */

/***************************************************************************/
/* sha.h								   */
/*									   */
/* SHA-1 code header file.						   */
/* Taken from the public domain implementation by Peter C. Gutmann	   */
/* on 2 Sep 1992, modified by Carl Ellison to be SHA-1.			   */
/***************************************************************************/

#ifndef _SHA_H_
#define _SHA_H_

#include <stdint.h>

/* Define APG_LITTLE_ENDIAN if the machine is little-endian */

#define APG_LITTLE_ENDIAN

/* Useful defines/typedefs */

typedef uint8_t    BYTE ;
typedef uint32_t   LONG ;

/* The SHA block size and message digest sizes, in bytes */

#define SHA_BLOCKSIZE   64
#define SHA_DIGESTSIZE  20

/* The structure for storing SHA info */

typedef struct {
  LONG digest[ 5 ] ;            /* Message digest */
  LONG countLo, countHi ;       /* 64-bit bit count */
  LONG data[ 16 ] ;             /* SHA data buffer */
  LONG slop ;			/* # of bytes saved in data[] */
} apg_SHA_INFO ;

void apg_shaInit( apg_SHA_INFO *shaInfo ) ;
void apg_shaUpdate( apg_SHA_INFO *shaInfo, BYTE *buffer, int count ) ;
void apg_shaFinal( apg_SHA_INFO *shaInfo, BYTE hash[SHA_DIGESTSIZE] ) ;

#endif /* _SHA_H_ */

Use uint8_t and uint32_t in SHA-1 implementation.


#pragma once

#include <cstdint>
#include <string>

class SystemError
{
public:
    SystemError(int errorno, const std::string& syscall, const std::string& message, const std::string& path)
        : m_errorno(errorno), m_syscall(syscall), m_message(message), m_path(path)
    {}

    int errorno() const { return m_errorno; }
    const char* syscall() const { return m_syscall.c_str(); }
    const char* message() const { return m_message.c_str(); }
    const char* path() const { return m_path.c_str(); }

private:
    int m_errorno;
    std::string m_syscall;
    std::string m_message;
    std::string m_path;
};

struct DiskUsage {
    uint64_t available;
    uint64_t free;
    uint64_t total;
};

DiskUsage GetDiskUsage(const char* path);

#pragma once

#include <stdint.h>
#include <string>

class SystemError
{
public:
    SystemError(int errorno, const std::string& syscall, const std::string& message, const std::string& path)
        : m_errorno(errorno), m_syscall(syscall), m_message(message), m_path(path)
    {}

    int errorno() const { return m_errorno; }
    const char* syscall() const { return m_syscall.c_str(); }
    const char* message() const { return m_message.c_str(); }
    const char* path() const { return m_path.c_str(); }

private:
    int m_errorno;
    std::string m_syscall;
    std::string m_message;
    std::string m_path;
};

struct DiskUsage {
    uint64_t available;
    uint64_t free;
    uint64_t total;
};

DiskUsage GetDiskUsage(const char* path);

Use stdint.h instead of cstdint

Use stdint.h instead of cstdint

Fixes #16.


#include <ucontext.h>

#include "x86-decoder.h"
#include "unwind.h"

void
unw_init_arch(void)
{
  x86_family_decoder_init();
}

void
unw_init_cursor_arch(ucontext_t* context, unw_cursor_t *cursor)
{
  mcontext_t * mctxt = &(context->uc_mcontext);

#ifdef __CRAYXT_CATAMOUNT_TARGET
  cursor->pc = (void *)  mctxt->sc_rip;
  cursor->bp = (void **) mctxt->sc_rbp;
  cursor->sp = (void **) mctxt->sc_rsp;
#else
  cursor->pc = (void *)  mctxt->gregs[REG_RIP];
  cursor->bp = (void **) mctxt->gregs[REG_RBP];
  cursor->sp = (void **) mctxt->gregs[REG_RSP];
#endif
}

int
unw_get_reg_arch(unw_cursor_t *cursor, int reg_id, void **reg_value)
{
  assert(reg_id == UNW_REG_IP);
  *reg_value = cursor->pc;

  return 0;
}

#include <ucontext.h>
#include <assert.h>

#include "x86-decoder.h"
#include "unwind.h"

void
unw_init_arch(void)
{
  x86_family_decoder_init();
}

void
unw_init_cursor_arch(ucontext_t* context, unw_cursor_t *cursor)
{
  mcontext_t * mctxt = &(context->uc_mcontext);

#ifdef __CRAYXT_CATAMOUNT_TARGET
  cursor->pc = (void *)  mctxt->sc_rip;
  cursor->bp = (void **) mctxt->sc_rbp;
  cursor->sp = (void **) mctxt->sc_rsp;
#else
  cursor->pc = (void *)  mctxt->gregs[REG_RIP];
  cursor->bp = (void **) mctxt->gregs[REG_RBP];
  cursor->sp = (void **) mctxt->gregs[REG_RSP];
#endif
}

int
unw_get_reg_arch(unw_cursor_t *cursor, int reg_id, void **reg_value)
{
  assert(reg_id == UNW_REG_IP);
  *reg_value = cursor->pc;

  return 0;
}

Include <assert.h> to prevent linking error (unknown symbol 'assert').


#import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UIAlertViewDelegate, UIActionSheetDelegate>

@property (nonatomic, strong) Class alertControllerClass;
@property (nonatomic, strong) IBOutlet UIButton *showAlertButton;
@property (nonatomic, strong) IBOutlet UIButton *showActionSheetButton;
@property (nonatomic, assign) BOOL alertDefaultActionExecuted;
@property (nonatomic, assign) BOOL alertCancelActionExecuted;
@property (nonatomic, assign) BOOL alertDestroyActionExecuted;

- (IBAction)showAlert:(id)sender;
- (IBAction)showActionSheet:(id)sender;

@end

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (nonatomic, strong) Class alertControllerClass;
@property (nonatomic, strong) IBOutlet UIButton *showAlertButton;
@property (nonatomic, strong) IBOutlet UIButton *showActionSheetButton;
@property (nonatomic, assign) BOOL alertDefaultActionExecuted;
@property (nonatomic, assign) BOOL alertCancelActionExecuted;
@property (nonatomic, assign) BOOL alertDestroyActionExecuted;

- (IBAction)showAlert:(id)sender;
- (IBAction)showActionSheet:(id)sender;

@end

Remove unused protocol conformance from sample


#ifndef FUTURE_H_INCLUDED
#define FUTURE_H_INCLUDED

#include <boost/thread/thread.hpp>
#include <boost/thread/future.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility/result_of.hpp>

namespace thread {

template<typename Func>
boost::shared_future<typename boost::result_of<Func()>::type> submit_task(Func f) {
    typedef typename boost::result_of<Func()>::type ResultType;
    typedef boost::packaged_task<ResultType> PackagedTaskType;

    PackagedTaskType task(f);
    boost::shared_future<ResultType> res(task.get_future());
    boost::thread task_thread(std::move(task));
    return res;
}

}

#endif // FUTURE_H_INCLUDED

#ifndef FUTURE_H_INCLUDED
#define FUTURE_H_INCLUDED

#include <boost/thread/thread.hpp>
#include <boost/thread/future.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility/result_of.hpp>

namespace thread {

template<typename Func>
boost::shared_future<typename boost::result_of<Func()>::type> submit_task(Func f) {
    typedef typename boost::result_of<Func()>::type ResultType;
    typedef boost::packaged_task<ResultType> PackagedTaskType;

    PackagedTaskType task(f);
    boost::shared_future<ResultType> res(task.get_future());
    boost::thread task_thread(boost::move(task));
    return res;
}

}

#endif // FUTURE_H_INCLUDED

Use boost::move rather than std::move which seems to hate some versions ofr G++


// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s

int g();

int foo(int i) {
  return g(i);
}

int g(int i) {
  return g(i);
}

// rdar://6110827
typedef void T(void);
void test3(T f) {
  f();
}

int a(int);
int a() {return 1;}

// RUN: grep 'define void @f0()' %t
void f0() {}

void f1();
// RUN: grep 'call void @f1()' %t
void f2(void) {
  f1(1, 2, 3);
}
// RUN: grep 'define void @f1()' %t
void f1() {}

// RUN: grep 'define .* @f3' %t | not grep -F '...'
struct foo { int X, Y, Z; } f3() {
  while (1) {}
}

// PR4423 - This shouldn't crash in codegen
void f4() {}
void f5() { f4(42); }

// Qualifiers on parameter types shouldn't make a difference.
static void f6(const float f, const float g) {
}
void f7(float f, float g) {
  f6(f, g);
// CHECK: define void @f7(float{{.*}}, float{{.*}})
// CHECK: call void @f6(float{{.*}}, float{{.*}})
}

// RUN: %clang_cc1 %s -emit-llvm -o - -verify | FileCheck %s

int g();

int foo(int i) {
  return g(i);
}

int g(int i) {
  return g(i);
}

// rdar://6110827
typedef void T(void);
void test3(T f) {
  f();
}

int a(int);
int a() {return 1;}

void f0() {}
// CHECK: define void @f0()

void f1();
void f2(void) {
// CHECK: call void @f1()
  f1(1, 2, 3);
}
// CHECK: define void @f1()
void f1() {}

// CHECK: define {{.*}} @f3()
struct foo { int X, Y, Z; } f3() {
  while (1) {}
}

// PR4423 - This shouldn't crash in codegen
void f4() {}
void f5() { f4(42); } //expected-warning {{too many arguments}}

// Qualifiers on parameter types shouldn't make a difference.
static void f6(const float f, const float g) {
}
void f7(float f, float g) {
  f6(f, g);
// CHECK: define void @f7(float{{.*}}, float{{.*}})
// CHECK: call void @f6(float{{.*}}, float{{.*}})
}

Fix test case and convert fully to FileCheck.

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


#pragma once

#include <fstream>
#include <llvm/ADT/StringRef.h>

inline std::ostream& operator<<(std::ostream& stream, llvm::StringRef string) {
    return stream.write(string.data(), string.size());
}

template<typename... Args>
[[noreturn]] inline void error(SrcLoc srcLoc, Args&&... args) {
    std::cout << srcLoc.file << ':';
    if (srcLoc.isValid()) std::cout << srcLoc.line << ':' << srcLoc.column << ':';
    std::cout << " error: ";
    using expander = int[];
    (void)expander{0, (void(std::cout << std::forward<Args>(args)), 0)...};

    // Output caret.
    std::ifstream file(srcLoc.file);
    while (--srcLoc.line) file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    std::string line;
    std::getline(file, line);
    std::cout << '\n' << line << '\n';
    while (--srcLoc.column) std::cout << ' ';
    std::cout << "^\n";

    exit(1);
}

#pragma once

#include <fstream>
#include <llvm/ADT/StringRef.h>

inline std::ostream& operator<<(std::ostream& stream, llvm::StringRef string) {
    return stream.write(string.data(), string.size());
}

template<typename... Args>
[[noreturn]] inline void error(SrcLoc srcLoc, Args&&... args) {
    if (srcLoc.file) {
        std::cout << srcLoc.file << ':';
        if (srcLoc.isValid()) std::cout << srcLoc.line << ':' << srcLoc.column << ':';
    } else {
        std::cout << "<unknown file>:";
    }

    std::cout << " error: ";
    using expander = int[];
    (void)expander{0, (void(std::cout << std::forward<Args>(args)), 0)...};

    if (srcLoc.file && srcLoc.isValid()) {
        // Output caret.
        std::ifstream file(srcLoc.file);
        while (--srcLoc.line) file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
        std::string line;
        std::getline(file, line);
        std::cout << '\n' << line << '\n';
        while (--srcLoc.column) std::cout << ' ';
        std::cout << "^\n";
    }

    exit(1);
}

Fix error() if srcLoc.file is null or !srcLoc.isValid()


#ifndef MMSTESTFUNC_H
#define MMSTESTFUNC_H

#include "Function.h"
#include "FunctionInterface.h"

class MMSTestFunc;

template <>
InputParameters validParams<MMSTestFunc>();

/**
 *  Function of RHS for manufactured solution in spatial_constant_helmholtz test
 */
class MMSTestFunc : public Function, public FunctionInterface
{
public:
  MMSTestFunc(const InputParameters & parameters);

  virtual Real value(Real t, const Point & p) const override;

protected:
  Real _length;

  const Function & _a;
  const Function & _b;

  Real _d;
  Real _h;

  Real _g_0_real;
  Real _g_0_imag;

  Real _g_l_real;
  Real _g_l_imag;

  MooseEnum _component;

};

#endif // MMSTESTFUNC_H

#pragma once

#include "Function.h"
#include "FunctionInterface.h"

class MMSTestFunc;

template <>
InputParameters validParams<MMSTestFunc>();

/**
 *  Function of RHS for manufactured solution in spatial_constant_helmholtz test
 */
class MMSTestFunc : public Function, public FunctionInterface
{
public:
  MMSTestFunc(const InputParameters & parameters);

  virtual Real value(Real t, const Point & p) const override;

protected:
  Real _length;

  const Function & _a;
  const Function & _b;

  Real _d;
  Real _h;

  Real _g_0_real;
  Real _g_0_imag;

  Real _g_l_real;
  Real _g_l_imag;

  MooseEnum _component;

};

Convert to pragma once in test functions

refs #21085


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <algorithm>
#include <vespa/document/bucket/bucketid.h>

namespace storage {

/**
 * Utility class for keeping track of the lowest used bits count seen
 * across a set of buckets.
 *
 * Not threadsafe by itself.
 */
class MinimumUsedBitsTracker
{
    uint32_t _minUsedBits;
public:
    MinimumUsedBitsTracker()
        : _minUsedBits(58)
    {}

    /**
     * Returns true if new bucket led to a decrease in the used bits count.
     */
    bool update(const document::BucketId& bucket) {
        if (bucket.getUsedBits() < _minUsedBits) {
            _minUsedBits = bucket.getUsedBits();
            return true;
        }
        return false;
    }

    uint32_t getMinUsedBits() const {
        return _minUsedBits;
    }

    void setMinUsedBits(uint32_t minUsedBits) {
        _minUsedBits = minUsedBits;
    }
};

}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/document/bucket/bucketid.h>
#include <atomic>

namespace storage {

/**
 * Utility class for keeping track of the lowest used bits count seen
 * across a set of buckets.
 *
 * Thread safe for reads and writes.
 */
class MinimumUsedBitsTracker
{
    std::atomic<uint32_t> _min_used_bits;
public:
    constexpr MinimumUsedBitsTracker() noexcept
        : _min_used_bits(58)
    {}

    /**
     * Returns true iff new bucket led to a decrease in the used bits count.
     */
    bool update(const document::BucketId& bucket) noexcept {
        const uint32_t bucket_bits = bucket.getUsedBits();
        uint32_t current_bits = _min_used_bits.load(std::memory_order_relaxed);
        if (bucket_bits < current_bits) {
            while (!_min_used_bits.compare_exchange_strong(current_bits, bucket_bits,
                                                           std::memory_order_relaxed,
                                                           std::memory_order_relaxed))
            {
                if (bucket_bits >= current_bits) {
                    return false; // We've raced with another writer that had lower or equal bits to our own bucket.
                }
            }
            return true;
        }
        return false;
    }

    [[nodiscard]] uint32_t getMinUsedBits() const noexcept {
        return _min_used_bits.load(std::memory_order_relaxed);
    }

    void setMinUsedBits(uint32_t minUsedBits) noexcept {
        _min_used_bits.store(minUsedBits, std::memory_order_relaxed);
    }
};

}

Make MinimumUsedBitsTracker thread safe for both reads and writes


#include "debug.h"
#include "input.h"
#include "scene.h"
#include "sound.h"
#include "controller.h"
#include "controllers/chooseyourcat.h"

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

NEW_CONTROLLER(ChooseYourCat);

static void p1_confirm() {
    Sound_playSE(FX_SELECT);
    Scene_close();
    Scene_load(SCENE_PRESSSTART);
}

static void p2_confirm() {
    Sound_playSE(FX_SELECT);
    Scene_close();
    Scene_load(SCENE_PRESSSTART);
}

static void ChooseYourCatController_init() {
    EVENT_ASSOCIATE(press, P1_MARU, p1_confirm);
    EVENT_ASSOCIATE(press, P2_MARU, p2_confirm);
    logprint(success_msg);
}

#include "debug.h"
#include "input.h"
#include "scene.h"
#include "sound.h"
#include "controller.h"
#include "scenes/chooseyourcat.h"
#include "controllers/chooseyourcat.h"

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

static int P1_HAS_CHOSEN = false;
/*  false -> P1 escolhe o gato;
    true -> P2 escolhe o gato. */

NEW_CONTROLLER(ChooseYourCat);

static void p1_confirm() {
    if (!P1_HAS_CHOSEN) {
        Sound_playSE(FX_SELECT);
        P1_HAS_CHOSEN = true;
    }
}

static void p2_confirm() {
    if (P1_HAS_CHOSEN) {
        /* code */
        Sound_playSE(FX_SELECT);
        Scene_close();
        Scene_load(SCENE_PRESSSTART);
    }
}

static void ChooseYourCatController_init() {
    EVENT_ASSOCIATE(press, P1_MARU, p1_confirm);
    EVENT_ASSOCIATE(press, P2_MARU, p2_confirm);
    logprint(success_msg);
}

Add step for each player on choose your cat scene


// Copyright (c) 2010 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 CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#pragma once

#include <string>

#include "base/ref_counted.h"

class Extension;

namespace base {
class Time;
}

namespace webkit_glue {
struct WebApplicationInfo;
}

// Generates a version number for an extension from a time. The goal is to make
// use of the version number to communicate some useful information. The
// returned version has the format:
// <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits>
std::string ConvertTimeToExtensionVersion(const base::Time& time);

// Wraps the specified web app in an extension. The extension is created
// unpacked in the system temp dir. Returns a valid extension that the caller
// should take ownership on success, or NULL and |error| on failure.
//
// NOTE: This function does file IO and should not be called on the UI thread.
// NOTE: The caller takes ownership of the directory at extension->path() on the
// returned object.
scoped_refptr<Extension> ConvertWebAppToExtension(
    const webkit_glue::WebApplicationInfo& web_app_info,
    const base::Time& create_time);

#endif  // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_

// Copyright (c) 2010 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 CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_
#pragma once

#include <string>

#include "base/ref_counted.h"

class Extension;

namespace base {
class Time;
}

namespace webkit_glue {
class WebApplicationInfo;
}

// Generates a version number for an extension from a time. The goal is to make
// use of the version number to communicate some useful information. The
// returned version has the format:
// <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits>
std::string ConvertTimeToExtensionVersion(const base::Time& time);

// Wraps the specified web app in an extension. The extension is created
// unpacked in the system temp dir. Returns a valid extension that the caller
// should take ownership on success, or NULL and |error| on failure.
//
// NOTE: This function does file IO and should not be called on the UI thread.
// NOTE: The caller takes ownership of the directory at extension->path() on the
// returned object.
scoped_refptr<Extension> ConvertWebAppToExtension(
    const webkit_glue::WebApplicationInfo& web_app_info,
    const base::Time& create_time);

#endif  // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_

Revert 64847 - Clang fix.

Revert 64847 - Clang fix.

TBR=evan@chromium.org
Review URL: http://codereview.chromium.org/4300003

git-svn-id: http://src.chromium.org/svn/trunk/src@64850 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 61481afd2d1e81e91b533a55dc544a62738ba663


/** @file
    @brief Implementation

    @date 2014

    @author
    Ryan Pavlik
    <ryan@sensics.com>
    <http://sensics.com>
*/

/*
// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)
*/

/* Internal Includes */
#include <osvr/ClientKit/ContextC.h>
#include <osvr/ClientKit/InterfaceC.h>
#include <osvr/ClientKit/InterfaceStateC.h>

/* Library/third-party includes */
/* - none */

// Standard includes
#include <stdio.h>

int main() {
    OSVR_ClientContext ctx =
        osvrClientInit("org.opengoggles.exampleclients.TrackerState");

    OSVR_ClientInterface lefthand = NULL;
    /* This is just one of the paths. You can also use:
     * /me/hands/right
     * /me/head
     */
    osvrClientGetInterface(ctx, "/me/hands/left", &lefthand);

    // Pretend that this is your application's mainloop.
    int i;
    for (i = 0; i < 1000000; ++i) {
        osvrClientUpdate(ctx);
        if (i % 100) {
            // Every so often let's read the tracker state.
            // Similar methods exist for all other stock report types.
            OSVR_PoseState state;
            OSVR_TimeValue timestamp;
            OSVR_ReturnCode ret =
                osvrGetPoseState(lefthand, &timestamp, &state);
            if (ret != OSVR_RETURN_SUCCESS) {
                printf("No pose state!\n");
            } else {
                printf("Got POSE state: Position = (%f, %f, %f), orientation = "
                       "(%f, %f, "
                       "%f, %f)\n",
                       report->pose.translation.data[0],
                       report->pose.translation.data[1],
                       report->pose.translation.data[2],
                       osvrQuatGetW(&(report->pose.rotation)),
                       osvrQuatGetX(&(report->pose.rotation)),
                       osvrQuatGetY(&(report->pose.rotation)),
                       osvrQuatGetZ(&(report->pose.rotation)));
            }
        }
    }

    osvrClientShutdown(ctx);
    printf("Library shut down, exiting.\n");
    return 0;
}

Add c version of trackerstate example

Add c version of trackerstate example


// Check the various ways in which the three classes of values
// (scalar, complex, aggregate) interact with parameter passing
// (function entry, function return, call argument, call result).

// RUN: clang %s -triple i386-unknown-unknown -O3 -emit-llvm -o %t &&
// RUN: not grep '@g0' %t &&

// FIXME: Enable once PR3489 is fixed.
// RUNX: clang %s -triple x86_64-unknown-unknown -O3 -emit-llvm -o %t &&
// RUNX: not grep '@g0' %t &&

// RUN: clang %s -triple ppc-unknown-unknown -O3 -emit-llvm -o %t &&
// RUN: not grep '@g0' %t &&
// RUN: true

typedef int ScalarTy;
typedef _Complex int ComplexTy;
typedef struct { int a, b, c; } AggrTy;

static int result;

static AggrTy aggr_id(AggrTy a) { return a; }
static ScalarTy scalar_id(ScalarTy a) { return a; }
static ComplexTy complex_id(ComplexTy a) { return a; }

static void aggr_mul(AggrTy a) { result *= a.a * a.b * a.c; }

static void scalar_mul(ScalarTy a) { result *= a; }

static void complex_mul(ComplexTy a) { result *= __real a * __imag a; }

extern void g0(void);

void f0(void) {
  result = 1;

  aggr_mul(aggr_id((AggrTy) { 2, 3, 5}));
  scalar_mul(scalar_id(7));
  complex_mul(complex_id(11 + 13i));

  // This call should be eliminated.
  if (result != 30030)
    g0();
}

Add bare bones test that parameter passing is consistent for
scalar/complex/aggregate cases.
 - Currently disabled for x86_64, triggering a misoptimization
   (PR3489).

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


// RUN: %clang_cc1 -triple thumbv7-apple-darwin \
// RUN:   -target-abi apcs-gnu \
// RUN:   -target-cpu cortex-a8 \
// RUN:   -mfloat-abi soft \
// RUN:   -target-feature +soft-float-abi \
// RUN:   -ffreestanding \
// RUN:   -emit-llvm -w -o - %s | FileCheck %s

#include <arm_neon.h>

// Radar 9311427: Check that alignment specifier is used in Neon load/store
// intrinsics.
typedef float AlignedAddr __attribute__ ((aligned (16)));
void t1(AlignedAddr *addr1, AlignedAddr *addr2) {
// CHECK: call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* %{{.*}}, i32 16)
  float32x4_t a = vld1q_f32(addr1);
// CHECK: call void @llvm.arm.neon.vst1.v4f32(i8* %{{.*}}, <4 x float> %{{.*}}, i32 16)
  vst1q_f32(addr2, a);
}

Add a testcase for svn r129964 (Neon load/store intrinsic alignments).

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


// Copyright 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

#include "native_client/src/include/nacl_macros.h"

class PPB_Core;

namespace ppapi_proxy {

// Implements the untrusted side of the PPB_Core interface.
// We will also need an rpc service to implement the trusted side, which is a
// very thin wrapper around the PPB_Core interface returned from the browser.
class PluginCore {
 public:
  // Return an interface pointer usable by PPAPI plugins.
  static const PPB_Core* GetInterface();
  // Mark the calling thread as the main thread for IsMainThread.
  static void MarkMainThread();

 private:
  NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore);
};

}  // namespace ppapi_proxy

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

#include "native_client/src/include/nacl_macros.h"

struct PPB_Core;

namespace ppapi_proxy {

// Implements the untrusted side of the PPB_Core interface.
// We will also need an rpc service to implement the trusted side, which is a
// very thin wrapper around the PPB_Core interface returned from the browser.
class PluginCore {
 public:
  // Return an interface pointer usable by PPAPI plugins.
  static const PPB_Core* GetInterface();
  // Mark the calling thread as the main thread for IsMainThread.
  static void MarkMainThread();

 private:
  NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore);
};

}  // namespace ppapi_proxy

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_

Declare PPB_Core as a struct, not a class. (Prevents Clang warning)

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

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


#include <stdio.h>
#define MAX 1000

int main() {
    int i, j, k, maxP;
    int ps[1001];

    for(i = 1; i <= MAX; i++) {
        for(j = i;j <= MAX; j++) {
            for(k = j; (k * k) < (i * i + j * j); k++);
            if((i * i + j * j) == (k * k) && (i + j + k) <= MAX) {
                ps[i+j+k]++;
            }
        }
    }

    for(i = 1; i <= MAX; i++) {
        if(ps[maxP] < ps[i])
            maxP = i;
    }

    printf("%d\n",maxP);

    return 0;
}

#include <stdio.h>
#define MAX 1000

int main() {
    int i, j , k, maxP = 1;
    int ps[1001];

    for (i=0; i <= MAX; ps[++i] =0);

    for(i = 1; i <= MAX; i++) {
        for(j = i;j <= MAX; j++) {
            for(k = j; (k * k) < (i * i + j * j); k++);
            if((i * i + j * j) == (k * k) && (i + j + k) <= MAX) {
                ps[i+j+k] += 1;
            }
        }
    }

    for(i = 1; i <= MAX; i++) {
        if(ps[maxP] < ps[i])
            maxP = i;
    }

    printf("%d\n",maxP);

    return 0;
}

Fix C solution for Problem039

Fix C solution for Problem039

The Author forgot to explicitily initialize the vector elements with
zeros. On my computer, without this, I get the wrong answer.

BTW, if maxP is not defined before, I don't even get a wrong answer.
A beatiful segmentation fault is raised.


//
//  NSString+Convert.h
//  LYCATEGORY
//
//  CREATED BY LUO YU ON 2016-11-04.
//  COPYRIGHT (C) 2016 LUO YU. ALL RIGHTS RESERVED.
//

#import <Foundation/Foundation.h>

@interface NSString (Convert)

- (NSString *)encodingURL;

@end

//
//  NSString+Convert.h
//  LYCATEGORY
//
//  CREATED BY LUO YU ON 2016-11-04.
//  COPYRIGHT (C) 2016 LUO YU. ALL RIGHTS RESERVED.
//

#import <Foundation/Foundation.h>

@interface NSString (Convert)

- (NSString *)encodingURL;

- (NSString *)pinyin;

@end

Add : string convert to pinyin

Add : string convert to pinyin


{% import "common_macros.inc.c" as util with context -%}
{% set stepfun = g.stepFunctions[targetStep] -%}

#include "{{g.name}}.h"

/**
 * Step function defintion for "{{stepfun.collName}}"
 */
void {{util.qualified_step_name(stepfun)}}({{ util.print_tag(stepfun.tag, typed=True)
        }}{{ util.print_bindings(stepfun.inputItems, typed=True)
        }}{{util.g_ctx_param()}}) {
{% if stepfun.rangedInputItems %}
    //
    // INPUTS
    //
{% call util.render_indented(1) -%}
{{ util.render_step_inputs(stepfun.rangedInputItems) }}
{% endcall -%}
{% endif %}
    //
    // OUTPUTS
    //
{% call util.render_indented(1) -%}
{{ util.render_step_outputs(stepfun.outputs) }}
{%- endcall %}

}

{% import "common_macros.inc.c" as util with context -%}
{% set stepfun = g.stepFunctions[targetStep] -%}

#include "{{g.name}}.h"

/**
 * Step function definition for "{{stepfun.collName}}"
 */
void {{util.qualified_step_name(stepfun)}}({{ util.print_tag(stepfun.tag, typed=True)
        }}{{ util.print_bindings(stepfun.inputItems, typed=True)
        }}{{util.g_ctx_param()}}) {
{% if stepfun.rangedInputItems %}
    //
    // INPUTS
    //
{% call util.render_indented(1) -%}
{{ util.render_step_inputs(stepfun.rangedInputItems) }}
{% endcall -%}
{% endif %}
    //
    // OUTPUTS
    //
{% call util.render_indented(1) -%}
{{ util.render_step_outputs(stepfun.outputs) }}
{%- endcall %}

}

Fix typo in step function comment

Fix typo in step function comment


/* Exercise 2-18: Write a program to remove trailing blanks and tabs from each
 * line of input, and to delete entirely blank lines. */

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

struct buffer_node {
  int32_t data;
  struct buffer_node *next_node;
};

void deleteBuffer(struct buffer_node **buffer_head);

int main(int argc, char **argv)
{
  int32_t character = 0;
  int32_t previous_character = 0;
  struct buffer_node *buffer_head = NULL;
  while ((character = getchar()) != EOF) {
    switch (character) {
      case ' ':
      case '\t': {
        struct buffer_node *new_node = malloc(sizeof(struct buffer_node));
        new_node->data = character;
        new_node->next_node = buffer_head;
        buffer_head = new_node;
        break;
      }
      case '\n':
        deleteBuffer(&buffer_head);
        if (previous_character != character) {
          putchar(character);
        }
        previous_character = character;
        break;
      default: {
        struct buffer_node *current_node = buffer_head;
        while (current_node != NULL) {
          putchar(current_node->data);
          current_node = current_node->next_node;
        }
        deleteBuffer(&buffer_head);
        putchar(character);
        previous_character = character;
        break;
      }
    }
  }
  return EXIT_SUCCESS;
}

void deleteBuffer(struct buffer_node **buffer_head)
{
  while (*buffer_head != NULL) {
    struct buffer_node *temp_node = *buffer_head;
    *buffer_head = (*buffer_head)->next_node;
    free(temp_node);
  }
}

Add solution to Exercise 1-18.

Add solution to Exercise 1-18.


/*
 * Copyright (c) 2012-2016
 * See LICENSE for details.
 *
 * Israel Jacquez <mrkotfw@gmail.com
 */

#include <sys/cdefs.h>

#include <smpc/smc.h>

#include <cpu/instructions.h>
#include <cpu/frt.h>
#include <cpu/intc.h>
#include <cpu/map.h>
#include <cpu/slave.h>

static void _slave_entry(void);
static void _default_entry(void);

static void (*_entry)(void) = _default_entry;

void
cpu_slave_init(void)
{
        smpc_smc_sshoff_call();

        cpu_slave_entry_clear();

        cpu_intc_ihr_set(INTC_INTERRUPT_SLAVE_ENTRY, _slave_entry);

        smpc_smc_sshon_call();
}

void
cpu_slave_entry_set(void (*entry)(void))
{
        _entry = (entry != NULL) ? entry : _default_entry;
}

static void
_slave_entry(void)
{
        while (true) {
                while (((cpu_frt_status_get()) & FRTCS_ICF) == 0x00);

                cpu_frt_control_chg((uint8_t)~FRTCS_ICF);

                _entry();
        }
}

static void
_default_entry(void)
{
}

/*
 * Copyright (c) 2012-2016
 * See LICENSE for details.
 *
 * Israel Jacquez <mrkotfw@gmail.com
 */

#include <sys/cdefs.h>

#include <smpc/smc.h>

#include <cpu/instructions.h>
#include <cpu/frt.h>
#include <cpu/intc.h>
#include <cpu/map.h>
#include <cpu/slave.h>

static void _slave_entry(void);

static void _default_entry(void);

static void (*_entry)(void) = _default_entry;

void
cpu_slave_init(void)
{
        smpc_smc_sshoff_call();

        cpu_slave_entry_clear();

        cpu_intc_ihr_set(INTC_INTERRUPT_SLAVE_ENTRY, _slave_entry);

        smpc_smc_sshon_call();
}

void
cpu_slave_entry_set(void (*entry)(void))
{
        _entry = (entry != NULL) ? entry : _default_entry;
}

static void __noreturn
_slave_entry(void)
{
        while (true) {
                while (((cpu_frt_status_get()) & FRTCS_ICF) == 0x00);

                cpu_frt_control_chg((uint8_t)~FRTCS_ICF);

                _entry();
        }
}

static void
_default_entry(void)
{
}

Mark _slave_entry to never return

Mark _slave_entry to never return


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

#ifndef METADATA_H
#define METADATA_H

typedef struct Metadata
{
  /**
   * File's name.
   */
  char md_name[255];

  /**
   * File's extension.
   */
  char md_extension[10];

  /**
   * List of keywords to describe the file.
   */
  char md_keywords[255];

  /**
   * Hash of the content. We use SHA-1 which generates a
   * 160-bit hash value rendered as 40 digits long in
   * hexadecimal.
   */
  char md_hash[41];
} Metadata;

Metadata *new_metadata(char name[], char extension[], char keywords[], char hash[]);
void free_metadata(Metadata *md);
Metadata *create_metadata_from_path(char pathFile[1000]);

#endif /* METADATA_H */

Indent better than Videl :)

Indent better than Videl :)


//
//  NSManagedObject+JSONHelpers.h
//
//  Created by Saul Mora on 6/28/11.
//  Copyright 2011 Magical Panda Software LLC. All rights reserved.
//

#import <CoreData/CoreData.h>

extern NSString * const kMagicalRecordImportCustomDateFormatKey;
extern NSString * const kMagicalRecordImportDefaultDateFormatString;
extern NSString * const kMagicalRecordImportUnixTimeString;
extern NSString * const kMagicalRecordImportAttributeKeyMapKey;
extern NSString * const kMagicalRecordImportAttributeValueClassNameKey;

extern NSString * const kMagicalRecordImportRelationshipMapKey;
extern NSString * const kMagicalRecordImportRelationshipLinkedByKey;
extern NSString * const kMagicalRecordImportRelationshipTypeKey;

@interface NSManagedObject (MagicalRecord_DataImport)

+ (instancetype) MR_importFromObject:(id)data;
+ (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context;

+ (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData;
+ (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context;

@end

@interface NSManagedObject (MagicalRecord_DataImportControls)

- (BOOL) shouldImport:(id)data;
- (void) willImport:(id)data;
- (void) didImport:(id)data;

@end

//
//  NSManagedObject+JSONHelpers.h
//
//  Created by Saul Mora on 6/28/11.
//  Copyright 2011 Magical Panda Software LLC. All rights reserved.
//

#import <CoreData/CoreData.h>

extern NSString * const kMagicalRecordImportCustomDateFormatKey;
extern NSString * const kMagicalRecordImportDefaultDateFormatString;
extern NSString * const kMagicalRecordImportUnixTimeString;
extern NSString * const kMagicalRecordImportAttributeKeyMapKey;
extern NSString * const kMagicalRecordImportAttributeValueClassNameKey;

extern NSString * const kMagicalRecordImportRelationshipMapKey;
extern NSString * const kMagicalRecordImportRelationshipLinkedByKey;
extern NSString * const kMagicalRecordImportRelationshipTypeKey;

@protocol MagicalRecordDataImportProtocol <NSObject>

@optional
- (BOOL) shouldImport:(id)data;
- (void) willImport:(id)data;
- (void) didImport:(id)data;

@end

@interface NSManagedObject (MagicalRecord_DataImport) <MagicalRecordDataImportProtocol>

+ (instancetype) MR_importFromObject:(id)data;
+ (instancetype) MR_importFromObject:(id)data inContext:(NSManagedObjectContext *)context;

+ (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData;
+ (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context;

@end

Move the import controls into a formal protocol


/** @file
Definitions for CPU S3 data.

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

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

**/

#ifndef _ACPI_CPU_DATA_H_
#define _ACPI_CPU_DATA_H_

//
// Register types in register table
//
typedef enum _REGISTER_TYPE {
  Msr,
  ControlRegister,
  MemoryMapped,
  CacheControl
} REGISTER_TYPE;

//
// Element of register table entry
//
typedef struct {
  REGISTER_TYPE RegisterType;
  UINT32        Index;
  UINT8         ValidBitStart;
  UINT8         ValidBitLength;
  UINT64        Value;
} CPU_REGISTER_TABLE_ENTRY;

//
// Register table definition, including current table length,
// allocated size of this table, and pointer to the list of table entries.
//
typedef struct {
  UINT32                   TableLength;
  UINT32                   NumberBeforeReset;
  UINT32                   AllocatedSize;
  UINT32                   InitialApicId;
  CPU_REGISTER_TABLE_ENTRY *RegisterTableEntry;
} CPU_REGISTER_TABLE;

typedef struct {
  EFI_PHYSICAL_ADDRESS  StartupVector;
  EFI_PHYSICAL_ADDRESS  GdtrProfile;
  EFI_PHYSICAL_ADDRESS  IdtrProfile;
  EFI_PHYSICAL_ADDRESS  StackAddress;
  UINT32                StackSize;
  UINT32                NumberOfCpus;
  EFI_PHYSICAL_ADDRESS  MtrrTable;
  //
  // Physical address of a CPU_REGISTER_TABLE structure
  //
  EFI_PHYSICAL_ADDRESS  PreSmmInitRegisterTable;
  //
  // Physical address of a CPU_REGISTER_TABLE structure
  //
  EFI_PHYSICAL_ADDRESS  RegisterTable;
  EFI_PHYSICAL_ADDRESS  ApMachineCheckHandlerBase;
  UINT32                ApMachineCheckHandlerSize;
} ACPI_CPU_DATA;

#endif

Add ACPI CPU Data include file

UefiCpuPkg: Add ACPI CPU Data include file

Add AcpuCpuData.h that defines a data structure that is shared between
modules and is required for ACPI S3 support.
APState field removed between V1 and V2 patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>

git-svn-id: 3158a46dfd52e07d1fda3e32e1ab2e353a00b20f@18642 6f19259b-4bc3-4df7-8a09-765794883524


///
/// \file cleanup.h
/// \brief Functions to clean up memory
/// \defgroup cleanup Memory Cleanup
/// \brief Frees memory before loading
/// @{
///
#ifndef UVL_CLEANUP
#define UVL_CLEANUP

#include "types.h"

int uvl_cleanup_memory ();
int uvl_unload_all_modules ();

#endif
/// @}

///
/// \file cleanup.h
/// \brief Functions to clean up memory
/// \defgroup cleanup Memory Cleanup
/// \brief Frees memory before loading
/// @{
///
#ifndef UVL_CLEANUP
#define UVL_CLEANUP

#include "types.h"

int uvl_cleanup_memory ();
int uvl_unload_all_modules();
void uvl_pre_clean();

#endif
/// @}

Fix a warning about implicit function declaration.


#pragma once

#include <iostream>

// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

std::ostream& getLogStream(char const* _channel);

}
}

#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)

#else // Release
	#define DLOG(CHANNEL) true ? std::cerr : std::cerr
#endif

#pragma once

#include <iostream>

// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

std::ostream& getLogStream(char const* _channel);

}
}

#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)

#else // Release

namespace dev
{
namespace evmjit
{

struct Voider
{
	void operator=(std::ostream const&) {}
};

}
}

#define DLOG(CHANNEL) true ? (void)0 : ::dev::evmjit::Voider{} = std::cerr

#endif

Reimplement no-op version of DLOG to avoid C++ compiler warning


//tests for linked lists tasks from the "Cracking The Coding Interview".

#include <assert.h>
#include <stdbool.h>

int main()
{
    assert(false && "First unit test");
    return 0;
}

//tests for linked lists tasks from the "Cracking The Coding Interview".

#include <assert.h>
#include <stdbool.h>
#include "../../c_double_linked_list/double_linked_list.h"

int main()
{
    struct Node* h = initHeadNode(0);
    printList(h);
    clear(h);

    return 0;
}

Add simple test (proof of working) for double linked list api.


#ifndef PBEC_EPS_H
#define PBEC_EPS_H

#include "functional.h"
#include "constants.h"
#include "pw92eps.h"
#include "vwn.h"

namespace pbec_eps
{
  template<class num, class T>
  static num A(const num &eps, const T &u3)
  {
    using xc_constants::param_beta_gamma;
    using xc_constants::param_gamma;
    return param_beta_gamma/expm1(-eps/(param_gamma*u3));
  }

  template<class num, class T>
  static num H(const num &d2, const num &eps, const T &u3)
  {
    num d2A = d2*A(eps,u3);
    using xc_constants::param_gamma;
    using xc_constants::param_beta_gamma;
    return param_gamma*u3*
      log(1+param_beta_gamma*d2*(1 + d2A)/(1+d2A*(1+d2A)));
  }

  // This is [(1+zeta)^(2/3) + (1-zeta)^(2/3)]/2, reorganized.
  template<class num>
  static num phi(const densvars<num> &d)
  {
    return pow(2.0,-1.0/3.0)*d.n_m13*d.n_m13*(sqrt(d.a_43)+sqrt(d.b_43));
  }

  template<class num>
  static num pbec_eps(const densvars<num> &d)
  {
    num eps = pw92eps::pw92eps(d);
    num u = phi(d);
    // Avoiding the square root of d.gnn here
    num d2 = pow(1.0/12*pow(3,5.0/6.0)/pow(M_PI,-1.0/6),2)*
      d.gnn/(u*u*pow(d.n,7.0/3.0));
    return (eps + H(d2,eps,pow3(u)));
  }

  template<class num>
  static num pbec_eps_polarized(const num &a, const num &gaa)
  {
    num eps = pw92eps::pw92eps_polarized(a);
    parameter u = pow(2.0,-1.0/3.0); //phi(d) for alpha or beta density =0

    // Avoiding the square root of d.gnn here
    num d2 = pow(1.0/12*pow(3,5.0/6.0)/pow(M_PI,-1.0/6),2)*
      gaa/(u*u*pow(a,7.0/3.0));
    return (eps + H(d2,eps,pow3(u)));
  }

}

#endif

Add forgotten PBE epsilon header.

Add forgotten PBE epsilon header.


/*
*The MIT License (MIT)
*
* Copyright (c) <2017> <Stephan Gatzka>
*
* 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 <stdint.h>
#include <winsock2.h>

#include "jet_endian.h"

uint16_t jet_be16toh(uint16_t big_endian_16bits)
{
	return ntohs(big_endian_16bits);
}

uint32_t jet_be32toh(uint32_t big_endian_32bits)
{
	return ntohl(big_endian_32bits);
}

uint64_t jet_be64toh(uint64_t big_endian_64bits)
{
	return ntohll(big_endian_64bits);
}

uint16_t jet_htobe16(uint16_t host_endian_16bits)
{
	return htons(host_endian_16bits);
}

uint32_t jet_htobe32(uint32_t host_endian_32bits)
{
	return htonl(host_endian_32bits);
}

uint64_t jet_htobe64(uint64_t host_endian_64bits)
{
	return htonll(host_endian_64bits);
}

Add endianess conversion functions for windows.


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2013 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k3"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2013 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k4"

Update driver version to 5.04.00-k4

[SCSI] qla4xxx: Update driver version to 5.04.00-k4

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


#pragma once

// Branch prediction hints
#define LIKELY(condition) __builtin_expect(static_cast<bool>(condition), 1)
#define UNLIKELY(condition) __builtin_expect(static_cast<bool>(condition), 0)

Add common header - just has branch prediction hint macros for now


#ifndef CTF_ADD_H
#define CTF_ADD_H

#include <sys/queue.h>
#include <sys/stddef.h>

#include "file/errors.h"

#define _CTF_ADD_PROTO(FUNCTION_NAME, OBJECT_TYPE, VALUE_TYPE) \
int \
FUNCTION_NAME (OBJECT_TYPE object, VALUE_TYPE value);

#define _CTF_ADD_IMPL(FUNCTION_NAME, OBJECT_TYPE, VALUE_TYPE, LIST_NAME, \
  LIST_ENTRY_NAME) \
int \
FUNCTION_NAME (OBJECT_TYPE object, VALUE_TYPE value) \
{ \
	if (object != NULL) \
	{ \
		if (object->LIST_NAME != NULL) \
		{ \
			TAILQ_INSERT_TAIL(object->LIST_NAME, value, LIST_ENTRY_NAME); \
			return CTF_OK; \
		} \
		else \
			return CTF_E_NULL; \
	} \
	else \
		return CTF_E_NULL; \
}

#endif

#ifndef CTF_ADD_H
#define CTF_ADD_H

#include <sys/queue.h>
#include <sys/stddef.h>

#include "file/errors.h"

#define _CTF_ADD_PROTO(FUNCTION_NAME, OBJECT_TYPE, VALUE_TYPE) \
int \
FUNCTION_NAME (OBJECT_TYPE object, VALUE_TYPE value);

#define _CTF_ADD_IMPL(FUNCTION_NAME, OBJECT_TYPE, VALUE_TYPE, LIST_NAME, \
  LIST_ENTRY_NAME, LIST_COUNTER) \
int \
FUNCTION_NAME (OBJECT_TYPE object, VALUE_TYPE value) \
{ \
	if (object != NULL) \
	{ \
		if (object->LIST_NAME != NULL) \
		{ \
			TAILQ_INSERT_TAIL(object->LIST_NAME, value, LIST_ENTRY_NAME); \
			object->LIST_COUNTER++; \
			return CTF_OK; \
		} \
		else \
			return CTF_E_NULL; \
	} \
	else \
		return CTF_E_NULL; \
}

#endif

Add API increments count variable

Add API increments count variable


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

int main() {
    float h, s;

    scanf("%f", &h);
    scanf("%f", &s);

    printf("%.3f\n", h * s / 12.0);
}

Solve Fuel Spent in c

Solve Fuel Spent in c


// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

/// Mintegral mediation adapter version.
static NSString *const GADMAdapterMintegralVersion = @"7.2.1.0";

/// Mintegral mediation adapter Mintegral App ID parameter key.
static NSString *const GADMAdapterMintegralAppID = @"app_id";

/// Mintegral mediation adapter Mintegral App Key parameter key.
static NSString *const GADMAdapterMintegralAppKey = @"app_key";

/// Mintegral mediation adapter Ad Unit ID parameter key.
static NSString *const GADMAdapterMintegralAdUnitID = @"ad_unit_id";

/// Mintegral mediation adapter Ad Placement ID parameter key.
static NSString *const GADMAdapterMintegralPlacementID = @"placement_id";

/// Mintegral adapter error domain.
static NSString *const GADMAdapterMintegralErrorDomain = @"com.google.mediation.mintegral";

// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

/// Mintegral mediation adapter version.
static NSString *const GADMAdapterMintegralVersion = @"7.2.4.0";

/// Mintegral mediation adapter Mintegral App ID parameter key.
static NSString *const GADMAdapterMintegralAppID = @"app_id";

/// Mintegral mediation adapter Mintegral App Key parameter key.
static NSString *const GADMAdapterMintegralAppKey = @"app_key";

/// Mintegral mediation adapter Ad Unit ID parameter key.
static NSString *const GADMAdapterMintegralAdUnitID = @"ad_unit_id";

/// Mintegral mediation adapter Ad Placement ID parameter key.
static NSString *const GADMAdapterMintegralPlacementID = @"placement_id";

/// Mintegral adapter error domain.
static NSString *const GADMAdapterMintegralErrorDomain = @"com.google.mediation.mintegral";

Modify the adapter version number.

Modify the adapter version number.


/*
 * This file is part of linux-driver-management.
 *
 * Copyright © 2016-2017 Ikey Doherty
 *
 * linux-driver-management 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.
 */

#pragma once

#include <manager.h>

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */

/*
 * This file is part of linux-driver-management.
 *
 * Copyright © 2016-2017 Ikey Doherty
 *
 * linux-driver-management 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.
 */

#pragma once

#include <device.h>
#include <manager.h>

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */

Include device in the LDM headers

Include device in the LDM headers

Signed-off-by: Ikey Doherty <d8d992cf0016e35c2a8339d5e7d44bebd12a2d77@solus-project.com>


/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* 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.
*/

/**
* Header file containing strided array macros.
*/
#ifndef STDLIB_STRIDED_MACROS_H
#define STDLIB_STRIDED_MACROS_H

#include "strided_nullary_macros.h"
#include "strided_unary_macros.h"
#include "strided_binary_macros.h"
#include "strided_ternary_macros.h"
#include "strided_quaternary_macros.h"
#include "strided_quinary_macros.h"

#endif // !STDLIB_STRIDED_MACROS_H

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* 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.
*/

/**
* Header file containing strided array macros.
*/
#ifndef STDLIB_STRIDED_MACROS_H
#define STDLIB_STRIDED_MACROS_H

// Note: keep in alphabetical order...
#include "strided_binary_macros.h"
#include "strided_nullary_macros.h"
#include "strided_quaternary_macros.h"
#include "strided_quinary_macros.h"
#include "strided_ternary_macros.h"
#include "strided_unary_macros.h"

#endif // !STDLIB_STRIDED_MACROS_H

Sort headers in alphabetical order

Sort headers in alphabetical order


/*
 * consumer_sdl_osx.m -- An OS X compatibility shim for SDL
 * Copyright (C) 2010 Ushodaya Enterprises Limited
 * Author: Dan Dennedy
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _CONSUMER_SDL_OSX_H_
#define _CONSUMER_SDL_OSX_H_

#ifdef __DARWIN__
void* mlt_cocoa_autorelease_init();
void  mlt_cocoa_autorelease_close( void* );

#else
static inline void *mlt_cocoa_autorelease_init()
{
	return NULL;
}

static inline void mlt_cocoa_autorelease_close(void*)
{
}
#endif

#endif

/*
 * consumer_sdl_osx.m -- An OS X compatibility shim for SDL
 * Copyright (C) 2010 Ushodaya Enterprises Limited
 * Author: Dan Dennedy
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _CONSUMER_SDL_OSX_H_
#define _CONSUMER_SDL_OSX_H_

#ifdef __DARWIN__
void* mlt_cocoa_autorelease_init();
void  mlt_cocoa_autorelease_close( void* );

#else
static inline void *mlt_cocoa_autorelease_init()
{
	return NULL;
}

static inline void mlt_cocoa_autorelease_close(void* p)
{
}
#endif

#endif

Fix build on non-OSX due to missing parameter name.


#ifndef CROWN_PLATFORM_GOVERNANCE_H
#define CROWN_PLATFORM_GOVERNANCE_H

#include "primitives/transaction.h"
#include "uint256.h"

#include <boost/function.hpp>

#include <vector>

namespace Platform
{
    class Vote
    {
    public:
        enum Value { abstain = 0, yes, no };

        CTxIn voterId;
        int64_t electionCode;
        uint256 candidate;
        Value value;
        std::vector<unsigned char> signature;
    };

    class VotingRound
    {
    public:
        virtual void RegisterCandidate(uint256 id) = 0;
        virtual void AcceptVote(const Vote& vote) = 0;
        virtual std::vector<uint256> CalculateResult() const = 0;
        virtual void NotifyResultChange(
            boost::function<void(uint256)> onElected,
            boost::function<void(uint256)> onDismissed
        ) = 0;
    };

    VotingRound& AgentsVoting();
}

#endif //CROWN_PLATFORM_GOVERNANCE_H

#ifndef CROWN_PLATFORM_GOVERNANCE_H
#define CROWN_PLATFORM_GOVERNANCE_H

#include "primitives/transaction.h"
#include "uint256.h"

#include <boost/function.hpp>

#include <vector>

namespace Platform
{
    class Vote
    {
    public:
        enum Value { abstain = 0, yes, no };

        CTxIn voterId;
        int64_t electionCode;
        uint256 candidate;
        Value value;
        std::vector<unsigned char> signature;
    };

    class VotingRound
    {
    public:
        virtual ~VotingRound() = default;

        virtual void RegisterCandidate(uint256 id) = 0;
        virtual void AcceptVote(const Vote& vote) = 0;
        virtual std::vector<uint256> CalculateResult() const = 0;
        virtual void NotifyResultChange(
            boost::function<void(uint256)> onElected,
            boost::function<void(uint256)> onDismissed
        ) = 0;
    };

    VotingRound& AgentsVoting();
}

#endif //CROWN_PLATFORM_GOVERNANCE_H

Fix issues pointed out in review

Fix issues pointed out in review


// RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
int global;
// CHECK: asciz  "global"                                    ## DW_AT_name
int main() { return 0;}

// RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
int global;
// CHECK: asciz "global" ## External Name
int main() { return 0;}

Adjust testcase for recent DWARF printer changes.

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


// PARAM: --set ana.activated[+] "'region'"
#include<pthread.h>
#include<stdlib.h>
#include<stdio.h>

struct s {
  int datum;
  struct s *next;
} *A, *B;

struct s *new(int x) {
  struct s *p = malloc(sizeof(struct s));
  p->datum = x;
  p->next = NULL;
  return p;
}

pthread_mutex_t A_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B_mutex = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&A_mutex);
  A->datum++; // RACE <-- this line is also relevant.
  pthread_mutex_unlock(&A_mutex);

  pthread_mutex_lock(&B_mutex);
  B->datum++; // <-- this is not relevant at all.
  pthread_mutex_unlock(&B_mutex);
  return NULL;
}

int main () {
  pthread_t t1;

  A = new(3);
  B = new(5);

  pthread_create(&t1, NULL, t_fun, NULL);

  int *data;
  pthread_mutex_lock(&A_mutex);
  data = &A->datum; // NORACE
  pthread_mutex_unlock(&A_mutex);
  *data = 42; // RACE <-- this is the real bug!
  return 0;
}

Add example for warning ranking.

Add example for warning ranking.


static inline unsigned int hash_func_string(const char* key)
{
	unsigned int hash = 0;
	int c;
	while ((c = *key++) != 0)
		hash = c + (hash << 6) + (hash << 16) - hash;
	return hash;
}

static inline uint32_t hash_func_string(const char* key)
{
	uint32_t hash = 0;
	int c;
	while ((c = *key++) != 0)
		hash = c + (hash << 6) + (hash << 16) - hash;
	return hash;
}

Change unsigned int to uint32_t.

Change unsigned int to uint32_t.

The fixed width data type is necessary to calculate the hash function
correctly.


#include <stdio.h>

#include "../slice.h"
#include "../assert.h"
#include "../nelem.h"

int main( void )
{
    int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

    printf( "Testing subset slice...\n" );
    int const ws[] = { SLICE( xs, 3, 4 ) };
    ASSERT( NELEM( ws ) == 4,
            ws[ 0 ] == xs[ 3 ],
            ws[ 1 ] == xs[ 4 ],
            ws[ 2 ] == xs[ 5 ],
            ws[ 3 ] == xs[ 6 ] );

    printf( "Testing total slice...\n" );
    int const ys[] = { SLICE( xs, 0, 6 ) };
    ASSERT( NELEM( ys ) == 6,
            ys[ 0 ] == xs[ 0 ],
            ys[ 1 ] == xs[ 1 ],
            ys[ 2 ] == xs[ 2 ],
            ys[ 3 ] == xs[ 3 ],
            ys[ 4 ] == xs[ 4 ],
            ys[ 5 ] == xs[ 5 ] );

    printf( "Testing empty slice...\n" );
    int const zs[] = { 0, SLICE( xs, 2, 0 ) };
    ASSERT( NELEM( zs ) == 1 );

    printf( "SLICE() tests passed.\n" );
}

#include <stdio.h>

#include "../slice.h"
#include "../assert.h"
#include "../nelem.h"

int main( void )
{
    int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

    printf( "Testing subset slice...\n" );
    int const ws[] = { SLICE( xs, 3, 4 ) };
    ASSERT( NELEM( ws ) == 4,
            ws[ 0 ] == xs[ 3 ],
            ws[ 1 ] == xs[ 4 ],
            ws[ 2 ] == xs[ 5 ],
            ws[ 3 ] == xs[ 6 ] );
    ( void ) ws;

    printf( "Testing total slice...\n" );
    int const ys[] = { SLICE( xs, 0, 6 ) };
    ASSERT( NELEM( ys ) == 6,
            ys[ 0 ] == xs[ 0 ],
            ys[ 1 ] == xs[ 1 ],
            ys[ 2 ] == xs[ 2 ],
            ys[ 3 ] == xs[ 3 ],
            ys[ 4 ] == xs[ 4 ],
            ys[ 5 ] == xs[ 5 ] );
    ( void ) ys;

    printf( "Testing empty slice...\n" );
    int const zs[] = { 0, SLICE( xs, 2, 0 ) };
    ASSERT( NELEM( zs ) == 1 );
    ( void ) zs;

    printf( "SLICE() tests passed.\n" );
}

Fix 'unused variable' warning on fast build


/* Copyright (c) 2015, ENEA Software AB
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef _OFPI_CONFIG_H_
#define _OFPI_CONFIG_H_

#include "ofp_config.h"

#define ARP_SANITY_CHECK 1

#endif

/* Copyright (c) 2015, ENEA Software AB
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef _OFPI_CONFIG_H_
#define _OFPI_CONFIG_H_

#include "api/ofp_config.h"

#define ARP_SANITY_CHECK 1

#endif

Fix include path for ofp_config.h

Fix include path for ofp_config.h

Signed-off-by: Bogdan Pricope <385103c4eae27e55111df6ab7856eefb0647e14e@enea.com>
Reviewed-by: Sorin Vultureanu <64c6f728decd077990042fe7e6ea94271dcc3ede@enea.com>


#ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H

// This header simply includes Python.h, taking care of platform-specific stuff

// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must include Python.h before any
// standard headers are included."

#if defined(_WIN32)
#	define MS_NO_COREDLL // deactivate pragma linking on Win32 done in Python.h
#endif

#if defined(_MSC_VER) && defined(_DEBUG)
// undefine _DEBUG since we want to always link agains the release version of
// python and pyconfig.h automatically links debug version if _DEBUG is defined.
// ocarre: no we don't, in debug on Windows we cannot link with python release, if we want to build SofaPython in debug we have to compile python in debug
//#    undef _DEBUG
#    include <Python.h>
//#    define _DEBUG
#elif defined(__APPLE__) && defined(__MACH__)
#    include <Python/Python.h>
#else
#    include <Python.h>
#endif

#endif

#ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H

// This header simply includes Python.h, taking care of platform-specific stuff

// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must include Python.h before any
// standard headers are included."

#if defined(_WIN32)
#	define MS_NO_COREDLL // deactivate pragma linking on Win32 done in Python.h
#	define Py_ENABLE_SHARED 1 // this flag ensure to use dll's version (needed because of MS_NO_COREDLL define).
#endif

#if defined(_MSC_VER) && defined(_DEBUG)
// if you use Python on windows in debug build, be sure to provide a compiled version because
// installation package doesn't come with debug libs.
#    include <Python.h>
#elif defined(__APPLE__) && defined(__MACH__)
#    include <Python/Python.h>
#else
#    include <Python.h>
#endif

#endif

Fix python link in release build.

Fix python link in release build.

Former-commit-id: f2b0e4ff65df702ae4f98bed2a39dcfdc0f7e9c4


/*
 *******************************************************************************
 *
 * Purpose: Utils. Atomic types helper.
 *
 *******************************************************************************
 * Copyright Monstrenyatko 2014.
 *
 * Distributed under the MIT License.
 * (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
 *******************************************************************************
 */

#ifndef UTILS_ATOMIC_H_
#define UTILS_ATOMIC_H_

#ifndef __has_feature
#define __has_feature(__x) 0
#endif

#if __has_feature(cxx_atomic)
#include <atomic>
#else
#include <boost/atomic.hpp>
#define UTILS_USE_BOOST_ATOMIC
#endif

namespace Utils {

#ifdef UTILS_USE_BOOST_ATOMIC
	typedef boost::atomic_bool atomic_bool;
	typedef boost::atomic_uint32_t atomic_uint32_t;
#else
	typedef std::atomic_bool atomic_bool;
	typedef std::atomic<uint32_t> atomic_uint32_t;
#endif

} /* namespace Utils */

#endif /* UTILS_ATOMIC_H_ */

/*
 *******************************************************************************
 *
 * Purpose: Utils. Atomic types helper.
 *
 *******************************************************************************
 * Copyright Monstrenyatko 2014.
 *
 * Distributed under the MIT License.
 * (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
 *******************************************************************************
 */

#ifndef UTILS_ATOMIC_H_
#define UTILS_ATOMIC_H_

#ifndef __has_feature
#define __has_feature(__x) 0
#endif

#if __cplusplus < 201103L
#include <boost/atomic.hpp>
#define UTILS_USE_BOOST_ATOMIC
#else
#include <atomic>
#endif

namespace Utils {

#ifdef UTILS_USE_BOOST_ATOMIC
	typedef boost::atomic_bool atomic_bool;
	typedef boost::atomic_uint32_t atomic_uint32_t;
#else
	typedef std::atomic_bool atomic_bool;
	typedef std::atomic<uint32_t> atomic_uint32_t;
#endif

} /* namespace Utils */

#endif /* UTILS_ATOMIC_H_ */

Use boost::atomic if C++ compiler older than 201103.


//===-- RemarkParserImpl.h - Implementation details -------------*- C++/-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file provides implementation details for the remark parser.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_REMARKS_REMARK_PARSER_IMPL_H
#define LLVM_REMARKS_REMARK_PARSER_IMPL_H

namespace llvm {
namespace remarks {
/// This is used as a base for any parser implementation.
struct ParserImpl {
  enum class Kind { YAML };

  // The parser kind. This is used as a tag to safely cast between
  // implementations.
  Kind ParserKind;
};
} // end namespace remarks
} // end namespace llvm

#endif /* LLVM_REMARKS_REMARK_PARSER_IMPL_H */

//===-- RemarkParserImpl.h - Implementation details -------------*- C++/-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file provides implementation details for the remark parser.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_REMARKS_REMARK_PARSER_IMPL_H
#define LLVM_REMARKS_REMARK_PARSER_IMPL_H

namespace llvm {
namespace remarks {
/// This is used as a base for any parser implementation.
struct ParserImpl {
  enum class Kind { YAML };

  explicit ParserImpl(Kind TheParserKind) : ParserKind(TheParserKind) {}
  // Virtual destructor prevents mismatched deletes
  virtual ~ParserImpl() {}

  // The parser kind. This is used as a tag to safely cast between
  // implementations.
  Kind ParserKind;
};
} // end namespace remarks
} // end namespace llvm

#endif /* LLVM_REMARKS_REMARK_PARSER_IMPL_H */

[Remarks] Fix mismatched delete due to missing virtual destructor

This fixes an asan failure introduced in r356519.

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


#pragma once

#include <chrono>
#include <string>

enum class ref_src_t {
    FILE,
    AIRCRAFT,
    PLUGIN,
    USER_MSG,
    BLACKLIST,
};

/// Superclass defining some common interface items for dataref and commandref.

class RefRecord {
protected:
    std::string name;
    ref_src_t source;
    std::chrono::system_clock::time_point last_updated;
    std::chrono::system_clock::time_point last_updated_big;
    RefRecord(const std::string & name, ref_src_t source) : name(name), source(source), last_updated(std::chrono::system_clock::now()) {}
public:
    virtual ~RefRecord() {}
    const std::string & getName() const { return name; }
    ref_src_t getSource() const { return source; }
    virtual std::string getDisplayString(size_t display_length) const  = 0;

    bool isBlacklisted() const { return ref_src_t::BLACKLIST == source; }

    const std::chrono::system_clock::time_point & getLastUpdateTime() const { return last_updated; }
    const std::chrono::system_clock::time_point & getLastBigUpdateTime() const { return last_updated_big; }
};

#pragma once

#include <chrono>
#include <string>

enum class ref_src_t {
    FILE,
    AIRCRAFT,
    PLUGIN,
    USER_MSG,
    BLACKLIST,
};

/// Superclass defining some common interface items for dataref and commandref.

class RefRecord {
protected:
    std::string name;
    ref_src_t source;
    std::chrono::system_clock::time_point last_updated;
    std::chrono::system_clock::time_point last_updated_big;
    RefRecord(const std::string & name, ref_src_t source) : name(name), source(source), last_updated(std::chrono::system_clock::from_time_t(0)), last_updated_big(std::chrono::system_clock::from_time_t(0)) {}
public:
    virtual ~RefRecord() {}
    const std::string & getName() const { return name; }
    ref_src_t getSource() const { return source; }
    virtual std::string getDisplayString(size_t display_length) const  = 0;

    bool isBlacklisted() const { return ref_src_t::BLACKLIST == source; }

    const std::chrono::system_clock::time_point & getLastUpdateTime() const { return last_updated; }
    const std::chrono::system_clock::time_point & getLastBigUpdateTime() const { return last_updated_big; }
};

Handle initialization of change detection variables in a more sane way. No more false positives of changes on startup.


/****************************************************************************
 *
 *   Copyright (C) 2013 PX4 Development Team. 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.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * 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 OWNER 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.
 *
 ****************************************************************************/

/**
 * @file Airspeed driver interface.
 */

#ifndef _DRV_AIRSPEED_H
#define _DRV_AIRSPEED_H

#include <stdint.h>
#include <sys/ioctl.h>

#include "drv_sensor.h"
#include "drv_orb_dev.h"

#define AIRSPEED_DEVICE_PATH	"/dev/airspeed"

/**
 * Airspeed report structure.  Reads from the device must be in multiples of this
 * structure.
 */
struct airspeed_report {
	uint64_t timestamp;
	uint8_t speed; 			/** in meters/sec */
};

/*
 * ObjDev tag for raw range finder data.
 */
ORB_DECLARE(sensor_differential_pressure);

/*
 * ioctl() definitions
 *
 * Airspeed drivers also implement the generic sensor driver
 * interfaces from drv_sensor.h
 */

#define _AIRSPEEDIOCBASE			(0x7700)
#define __AIRSPEEDIOC(_n)		(_IOC(_AIRSPEEDIOCBASE, _n))

#endif /* _DRV_AIRSPEED_H */

Add in the missing header.

Add in the missing header.


//===========================================
//  Lumina-DE source code
//  Copyright (c) 2016, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
//  This is the backend classe for interacting with the "git" utility
//===========================================
#ifdef _LUMINA_FM_GIT_COMPAT_H
#define _LUMINA_FM_GIT_COMPAT_H

#include <QProcess>
#include <QString>
#include <QProcessEnvironment>

#include <LuminaUtils.h>

class GIT{
public:
	//Check if the git utility is installed and available
	static bool isAvailable(){
	  QString bin = "git"
	  return isValidBinary(bin);
	}

	//Return if the current directory is a git repository
	static bool isRepo(QString dir){
	  QProcess P;
	  P.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
	  P.setWorkingDirectory(dir);
	  P.exec("git",QStringList() <<"status" << "--porcelain" );
          return (0==P.exitCode());
	}

	//Return the current status of the repository
	static QString status(QString dir){
	  QProcess P;
	  P.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
	  P.setWorkingDirectory(dir);
	  P.setProcessChannelMode(QProcess::MergedChannels);
	  P.exec("git",QStringList() <<"status" );
          return P.readAllStandardOutput();
	}

	//Setup a process for running the clone operation (so the calling process can hook up any watchers and start it when ready)
	static QProcess setupClone(QString indir, QString url, QString branch = "", int depth = -1){
          QProcess P;
	  P.setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
	  P.setWorkingDirectory(indir);
	  P.setProgram("git");
          QStringList args;
	    args << "clone";
	    if(!branch.isEmpty()){ args << "-b" << branch; }
	    if(depth>0){ args << "--depth" << QString::number(depth); }
	    args << url;
	  P.setArguments(args);
 	  return P;
	}
};
#endif

Add the backend class/functions for using GIT within lumina-fm.


// RUN: clang -fsyntax-only -verify %s

struct foo; // expected-note 3 {{forward declaration of 'struct foo'}}

struct foo a();
void b(struct foo);
void c();

void func() {
  a(); // expected-error{{return type of called function ('struct foo') is incomplete}}
  b(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}}
  c(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}}
}

Add testcase for incomplete call/return types for calls.

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


/*
*
* Copyright (c) 2016 The Khronos Group Inc.
* Copyright (c) 2016 Valve Corporation
* Copyright (c) 2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Lobodzinski <mark@lunarg.com>
*
*/
#pragma once

// Linked list node for tree of debug callback functions
typedef struct VkLayerDbgFunctionNode_ {
    VkDebugReportCallbackEXT msgCallback;
    PFN_vkDebugReportCallbackEXT pfnMsgCallback;
    VkFlags msgFlags;
    void *pUserData;
    struct VkLayerDbgFunctionNode_ *pNext;
} VkLayerDbgFunctionNode;

Include every single file in the vulkan update.


#ifndef _ALPHA_BUG_H
#define _ALPHA_BUG_H

#include <linux/linkage.h>

#ifdef CONFIG_BUG
#include <asm/pal.h>

/* ??? Would be nice to use .gprel32 here, but we can't be sure that the
   function loaded the GP, so this could fail in modules.  */
#define BUG()	do {							\
	__asm__ __volatile__(						\
		"call_pal %0  # bugchk\n\t"				\
		".long %1\n\t.8byte %2"					\
		: : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));	\
	for ( ; ; ); } while (0)

#define HAVE_ARCH_BUG
#endif

#include <asm-generic/bug.h>

#endif

#ifndef _ALPHA_BUG_H
#define _ALPHA_BUG_H

#include <linux/linkage.h>

#ifdef CONFIG_BUG
#include <asm/pal.h>

/* ??? Would be nice to use .gprel32 here, but we can't be sure that the
   function loaded the GP, so this could fail in modules.  */
#define BUG()	do {							\
	__asm__ __volatile__(						\
		"call_pal %0  # bugchk\n\t"				\
		".long %1\n\t.8byte %2"					\
		: : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));	\
	unreachable();							\
  } while (0)

#define HAVE_ARCH_BUG
#endif

#include <asm-generic/bug.h>

#endif

Convert BUG() to use unreachable()

alpha: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of for(;;);

Signed-off-by: David Daney <0662de36cfb0706ed279bff52abef14720945acc@caviumnetworks.com>
CC: Richard Henderson <aea4fd857e97ee7d33f60175ba9388a955b9d916@twiddle.net>
CC: Ivan Kokshaysky <ec437ab60af367f0fec0f6a3cd47f9cbad7b487f@jurassic.park.msu.ru>
CC: 92b16e4f8d3bce14a77cfee1aa13cdb592ef5039@vger.kernel.org
Signed-off-by: Matt Turner <789b315743a28dd066a4ba1459c35951c291d8a6@gmail.com>


/* Header file for AsynchFile plugin */
/* module initialization/shutdown */
int asyncFileInit(void);
int asyncFileShutdown(void);

/*** Experimental Asynchronous File I/O ***/
typedef struct {
	int			sessionID;
	void		*state;
} AsyncFile;

int asyncFileClose(AsyncFile *f);
int asyncFileOpen(AsyncFile *f, long fileNamePtr, int fileNameSize, int writeFlag, int semaIndex);
int asyncFileRecordSize();
int asyncFileReadResult(AsyncFile *f, long bufferPtr, int bufferSize);
int asyncFileReadStart(AsyncFile *f, int fPosition, int count);
int asyncFileWriteResult(AsyncFile *f);
int asyncFileWriteStart(AsyncFile *f, int fPosition, long bufferPtr, int bufferSize);

/* Header file for AsynchFile plugin */
/* module initialization/shutdown */
int asyncFileInit(void);
int asyncFileShutdown(void);

/*** Experimental Asynchronous File I/O ***/
typedef struct {
	int			sessionID;
	void		*state;
} AsyncFile;

int asyncFileClose(AsyncFile *f);
int asyncFileOpen(AsyncFile *f, char *fileNamePtr, int fileNameSize, int writeFlag, int semaIndex);
int asyncFileRecordSize();
int asyncFileReadResult(AsyncFile *f, void *bufferPtr, int bufferSize);
int asyncFileReadStart(AsyncFile *f, int fPosition, int count);
int asyncFileWriteResult(AsyncFile *f);
int asyncFileWriteStart(AsyncFile *f, int fPosition, void *bufferPtr, int bufferSize);

Update platforms/* with Eliot's fixes for 64-bit clean AsyncPlugin.

The platforms/unix changes are tested. The win32 and Mac OS changes are not tested but I believe them to be correct.
Not applicable to RiscOS.
Updates not applied to iOS.

@eliot - I changed the declarations in Cross to (void *) rather than long to reduce type casts in platforms/[unix|win32|Mac OS].

@esteban - I did not update platforms/iOS in SVN trunk. Please update declarations as needed.

@tim - no change required for RiscOS.

git-svn-id: http://squeakvm.org/svn/squeak/trunk@3178 fa1542d4-bde8-0310-ad64-8ed1123d492a

Former-commit-id: 55982481b07c41df485b88dff5a63920f92525d0


#include <badgewars.h>
#include <stdio.h>

/* Initialize the BadgeWars world */
void bw_init(struct bw_world *world)
{
    puts("bw_init requested");
}

/* Run the BadgeWars world for a single instruction */
int bw_run(struct bw_world *world)
{
    puts("bw_run requested");
    return 0;
}

/* Receive a BadgeWars command from the outside world */
void bw_receive(struct bw_world *world, OPCODE command, void *addr, void(*send_response)(int, void *))
{
    printf("bw_receive got op: %d\n", command.op);
}

/* Peek into the core state */
CELL bw_peek(struct bw_world *world, CELLPTR addr)
{
    printf("bw_peek(%d) called\n", addr);
    return 0;
}

#include <badgewars.h>
#include <string.h>

/* Initialize the BadgeWars world */
void bw_init(struct bw_world *world)
{
    memset(&world->core, 0, sizeof(world->core));
    world->queue_head = world->queue_tail = 0;
}

/* Run the BadgeWars world for a single instruction */
int bw_run(struct bw_world *world)
{
    return 0;
}

/* Receive a BadgeWars command from the outside world */
void bw_receive(struct bw_world *world, OPCODE command, void *addr, void(*send_response)(int, void *))
{
}

/* Peek into the core state */
CELL bw_peek(struct bw_world *world, CELLPTR addr)
{
    return world->core[addr];
}

Initialize the world state to zero

Initialize the world state to zero


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

#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

#include "ppapi/c/pp_var.h"

#define PPB_PRIVATE_INTERFACE "PPB_Private;1"

typedef enum _ppb_ResourceString {
  PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;

typedef struct _ppb_Private {
  // Returns a localized string.
  PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;

#endif  // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

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

#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

#include "third_party/ppapi/c/pp_var.h"

#define PPB_PRIVATE_INTERFACE "PPB_Private;1"

typedef enum _ppb_ResourceString {
  PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;

typedef struct _ppb_Private {
  // Returns a localized string.
  PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;

#endif  // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_

Add third_party/ prefix to ppapi include for checkdeps.

The only users of this ppb should be inside chrome so this should work fine.

TBR=jam@chromium.org

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

git-svn-id: http://src.chromium.org/svn/trunk/src@52766 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: b5583121378597058f8f083243d2299fd262e509


/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Maps and raises the specified window id (integer).
 */

#include <X11/Xlib.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    if (argc != 2) return 2;
    Display* display = XOpenDisplay(NULL);
    if (!display) return 1;
    XMapRaised(display, atoi(argv[1]));
    XCloseDisplay(display);
    return 0;
}

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Maps and raises the specified window id (integer).
 */

/* TODO: use XResizeWindow to do the +1 width ratpoison hack.
 * And at this point, we might as well use XMoveResizeWindow, rename this to
 * wmtool and unmap the previously-mapped window, and perhaps call the
 * equivalent of XRefresh, eliminating the need for ratpoison entirely (!!).
 */

#include <X11/Xlib.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    if (argc != 2) return 2;
    Display* display = XOpenDisplay(NULL);
    if (!display) return 1;
    XMapRaised(display, atoi(argv[1]));
    XCloseDisplay(display);
    return 0;
}

Add TODO to replace ratpoison.

Add TODO to replace ratpoison.


#include <zephyr.h>
#include <init.h>
#include <posix/time.h>
#include <csp/csp_debug.h>

#include <logging/log.h>
LOG_MODULE_REGISTER(libcsp);

static void hook_func(csp_debug_level_t level, const char * format, va_list args) {
	uint32_t args_num = log_count_args(format);

	switch (level) {
		case CSP_ERROR:
			Z_LOG_VA(LOG_LEVEL_ERR, format, args, args_num, LOG_STRDUP_EXEC);
			break;
		case CSP_WARN:
			Z_LOG_VA(LOG_LEVEL_WRN, format, args, args_num, LOG_STRDUP_EXEC);
			break;
		default:
			Z_LOG_VA(LOG_LEVEL_INF, format, args, args_num, LOG_STRDUP_EXEC);
			break;
	}
}

static int libcsp_zephyr_init(const struct device * unused) {
	csp_debug_hook_set(hook_func);

	struct timespec ts = {
		.tv_sec = 946652400,
		.tv_nsec = 0,
	};
	clock_settime(CLOCK_REALTIME, &ts);

	return 0;
}

SYS_INIT(libcsp_zephyr_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);

#include <zephyr.h>
#include <init.h>
#include <posix/time.h>
#include <csp/csp_debug.h>

#include <logging/log.h>
LOG_MODULE_REGISTER(libcsp);

}

static int libcsp_zephyr_init(const struct device * unused) {

	struct timespec ts = {
		.tv_sec = 946652400,
		.tv_nsec = 0,
	};
	clock_settime(CLOCK_REALTIME, &ts);

	return 0;
}

SYS_INIT(libcsp_zephyr_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);

Remove debug print hook function

zephyr: Remove debug print hook function

Debug print facility has been removed by the commit 39d6478;
csp_debug_hook_set(), csp_debug_level_t, CSP_ERROR and its friends are
gone.

Remove it from Zephyr as well.

Signed-off-by: Yasushi SHOJI <afa9ca3be149447780c2f7b524d61ed3d3db63f9@spacecubics.com>


//
//  AFNetworkEnvironment.h
//  CoreNetworking
//
//  Created by Keith Duncan on 05/01/2013.
//  Copyright (c) 2013 Keith Duncan. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "CoreNetworking/AFNetwork-Macros.h"

/*!
	\brief
	Schedule environment for run loop and dispatch
 */
@interface AFNetworkSchedule : NSObject {
 @package
	NSRunLoop *_runLoop;
	NSString *_runLoopMode;

	void *_dispatchQueue;
}

- (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;

- (void)scheduleInQueue:(dispatch_queue_t)queue;

@end

//
//  AFNetworkEnvironment.h
//  CoreNetworking
//
//  Created by Keith Duncan on 05/01/2013.
//  Copyright (c) 2013 Keith Duncan. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "CoreNetworking/AFNetwork-Macros.h"

/*!
	\brief
	Schedule environment for run loop and dispatch
 */
@interface AFNetworkSchedule : NSObject {
 @public
	NSRunLoop *_runLoop;
	NSString *_runLoopMode;

	void *_dispatchQueue;
}

- (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;

- (void)scheduleInQueue:(dispatch_queue_t)queue;

@end

Make the run loop and queue @public until we enhance the scheduler API


/*
 * Header file for the definitions of packers/protectors
 *
 * Tim "diff" Strazzere <strazz@gmail.com>
 */

typedef struct {
  char* name;
  char* description;
  char* filter;
  char* marker;
} packer;

static packer packers[] = {

  // APKProtect
  {
    "APKProtect v1->5",
    "APKProtect generialized detection",
    // This is actually the filter APKProtect uses itself for finding it's own odex to modify
    ".apk@",
    "/libAPKProtect"
  },

  // LIAPP
  {
    "LIAPP 'Egg' (v1->?)",
    "LockIn APP (lockincomp.com)",
    "LIAPPEgg.dex",
    "/LIAPPEgg"
  },

  // Qihoo 'Monster'
  {
    "Qihoo 'Monster' (v1->?)",
    "Qihoo unknown version, code named 'monster'",
    "monster.dex",
    "/libprotectClass"
  }
};

/*
 * Header file for the definitions of packers/protectors
 *
 * Tim "diff" Strazzere <strazz@gmail.com>
 */

typedef struct {
  char* name;
  char* description;
  char* filter;
  char* marker;
} packer;

static packer packers[] = {

  // APKProtect
  {
    "APKProtect v1->5",
    "APKProtect generialized detection",
    // This is actually the filter APKProtect uses itself for finding it's own odex to modify
    ".apk@",
    "/libAPKProtect"
  },

  // Bangcle (??) or something equally silly
  {
    "Bangcle (??) silly version",
    "Something silly used by malware",
    "classes.dex",
    "/app_lib/"
  },

  // LIAPP
  {
    "LIAPP 'Egg' (v1->?)",
    "LockIn APP (lockincomp.com)",
    "LIAPPEgg.dex",
    "/LIAPPEgg"
  },

  // Qihoo 'Monster'
  {
    "Qihoo 'Monster' (v1->?)",
    "Qihoo unknown version, code named 'monster'",
    "monster.dex",
    "/libprotectClass"
  }
};

Add detection for whatever silly protector new malware was using.

Closes issue #22