#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class TLDAPServer;
#pragma link C++ class TLDAPResult;
#pragma link C++ class TLDAPEntry;
#pragma link C++ class TLDAPAttribute;

#pragma link C++ global LDAP_PORT;
#pragma link C++ global LDAP_SCOPE_DEFAULT;
#pragma link C++ global LDAP_SCOPE_BASE;
#pragma link C++ global LDAP_SCOPE_ONELEVEL;
#pragma link C++ global LDAP_SCOPE_SUBTREE;
#pragma link C++ global LDAP_MOD_ADD;
#pragma link C++ global LDAP_MOD_DELETE;
#pragma link C++ global LDAP_MOD_REPLACE;
#pragma link C++ global LDAP_MOD_BVALUES;
#pragma link C++ global LDAP_SERVER_DOWN;

#endif

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class TLDAPServer;
#pragma link C++ class TLDAPResult;
#pragma link C++ class TLDAPEntry;
#pragma link C++ class TLDAPAttribute;

// These constants are preprocessor statements
// in ldap.h and not variables
// #pragma link C++ global LDAP_PORT;
// #pragma link C++ global LDAP_SCOPE_DEFAULT;
// #pragma link C++ global LDAP_SCOPE_BASE;
// #pragma link C++ global LDAP_SCOPE_ONELEVEL;
// #pragma link C++ global LDAP_SCOPE_SUBTREE;
// #pragma link C++ global LDAP_MOD_ADD;
// #pragma link C++ global LDAP_MOD_DELETE;
// #pragma link C++ global LDAP_MOD_REPLACE;
// #pragma link C++ global LDAP_MOD_BVALUES;
// #pragma link C++ global LDAP_SERVER_DOWN;

#endif

Remove selection of preprocessor macros as globals in the linkdef


/*
 * Copyright (c) 2018-2021 mcumgr authors
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <string.h>

#include "img_mgmt/image.h"
#include "img_mgmt/img_mgmt.h"

int
img_mgmt_ver_str(const struct image_version *ver, char *dst)
{
	int rc = 0;
	int rc1 = 0;

	rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hhu.%hhu.%hu",
		ver->iv_major, ver->iv_minor, ver->iv_revision);

	if (rc >= 0 && ver->iv_build_num != 0) {
		rc1 = snprintf(&dst[rc], IMG_MGMT_VER_MAX_STR_LEN - rc, ".%u",
			ver->iv_build_num);
	}

	if (rc1 >= 0 && rc >= 0) {
		rc = rc + rc1;
	} else {
		/* If any failed then all failed */
		rc = -1;
	}

	return rc;
}

/*
 * Copyright (c) 2018-2021 mcumgr authors
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <string.h>

#include "img_mgmt/image.h"
#include "img_mgmt/img_mgmt.h"

int
img_mgmt_ver_str(const struct image_version *ver, char *dst)
{
	int rc = 0;
	int rc1 = 0;

	rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hu.%hu.%hu",
		(uint16_t)ver->iv_major, (uint16_t)ver->iv_minor,
		ver->iv_revision);

	if (rc >= 0 && ver->iv_build_num != 0) {
		rc1 = snprintf(&dst[rc], IMG_MGMT_VER_MAX_STR_LEN - rc, ".%u",
			ver->iv_build_num);
	}

	if (rc1 >= 0 && rc >= 0) {
		rc = rc + rc1;
	} else {
		/* If any failed then all failed */
		rc = -1;
	}

	return rc;
}

mgmt/mcumgr/lib: Make version string work with CONFIG_NEWLIB_LIBC

By default the newlib does not compile with %hhu processing,
to avoid turning on additional options for newlib compilation
this commit changes formatting string to use %hu instead.
The commit fixes problem with malformed version string being
returned, by smp_svr, when CONFIG_NEWLIB_LIBC=y is set together
with CONFIG_NEWLIB_LIBC_NANO=y.

Fixes #45261

Signed-off-by: Dominik Ermel <1a1d45a9cc0c98a37f8d0a0d2dbe3cacc0b2344f@nordicsemi.no>


/*
 * Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 */

#include "s2n_test.h"

#include <stdint.h>

#include <utils/s2n_safety.h>

#include "testlib/s2n_testlib.h"

uint8_t dst0[9];
const uint8_t src[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

int main(int argc, char **argv)
{
    uint8_t dst1[9];

    BEGIN_TEST();

    EXPECT_SUCCESS(s2n_constant_time_copy_or_dont(dst1, src, 9, 0 /* do copy */));
    EXPECT_EQUAL(s2n_constant_time_equals(dst1, src, 9), 1);

    EXPECT_SUCCESS(s2n_constant_time_copy_or_dont(dst0, src, 9, 1 /* don't */));
    EXPECT_EQUAL(s2n_constant_time_equals(dst0, src, 9), 0);

    END_TEST();
}

Add test for constant-time comparison and copy


#ifndef G_EBKLRON9896QUFJSD3FNA40IITV3F
#define G_EBKLRON9896QUFJSD3FNA40IITV3F
#ifdef __cplusplus
extern "C" {
#endif
/*@self.public()*/

static const double CAL_PI = 3.141592653589793238462643383279502884197169399375;

#ifdef __cplusplus
}
#endif
#endif

#ifndef G_EBKLRON9896QUFJSD3FNA40IITV3F
#define G_EBKLRON9896QUFJSD3FNA40IITV3F
#ifdef __cplusplus
extern "C" {
#endif
/*@self.public()*/

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279502884197169399375
#endif

#ifdef __cplusplus
}
#endif
#endif

Define M_PI instead of CAL_PI

Define M_PI instead of CAL_PI


#include "riot_arduino_uno.h"
#include "utils.h"

riot_arduino_uno_sinks* riot_arduino_uno_sinks_create() {
  riot_arduino_uno_sinks *sinks = xmalloc(sizeof(riot_arduino_uno_sinks));
  return sinks;
}

riot_arduino_uno_sources* riot_arduino_uno_sources_create() {
  riot_arduino_uno_sources *sources = xmalloc(sizeof(riot_arduino_uno_sources));
  return sources;
};

int riot_arduino_uno_run(riot_arduino_uno_main main) {
  if(main == NULL) {
    return -1;
  }
  riot_arduino_uno_sources *sources = riot_arduino_uno_sources_create();
  if(sources == NULL) {
    return -2;
  }
  riot_arduino_uno_sinks *sinks = main(sources);
  if(sinks == NULL) {
    return -3;
  }
  while(true) {
    // TODO: Read all inputs and map to sources
    // TODO: If all sinks/outputs have completed, break
  }
  return 0;
}

Add basic riot_run function definition

Add basic riot_run function definition


#ifndef __SEQUENCELOCATION_H__
#define __SEQUENCELOCATION_H__

#include "Types.h"
#include "IRefProvider.h"

//#pragma pack(push)
//#pragma pack(2)

struct SequenceLocation
{
	uint m_Location;
	short m_RefId;

	bool used() {
		return m_Location != 0;
	}

	bool operator< (SequenceLocation const & rhs) const
	{
		if (m_Location < rhs.m_Location)
			return true;
		else if (m_Location == rhs.m_Location)
			return (m_RefId < rhs.m_RefId);

		return false;
	}

	SequenceLocation() {

	}

	SequenceLocation(uint const loc, short const refid) {
		m_Location = loc;
		m_RefId = refid;
	}

	SequenceLocation(Location const & other) {
		m_Location = other.m_Location;
	}
};
//#pragma pack(pop)

#endif

#ifndef __SEQUENCELOCATION_H__
#define __SEQUENCELOCATION_H__

#include "Types.h"
#include "IRefProvider.h"

//#pragma pack(push)
//#pragma pack(2)

struct SequenceLocation
{
	uint m_Location;
	int m_RefId;

	bool used() {
		return m_Location != 0;
	}

	bool operator< (SequenceLocation const & rhs) const
	{
		if (m_Location < rhs.m_Location)
			return true;
		else if (m_Location == rhs.m_Location)
			return (m_RefId < rhs.m_RefId);

		return false;
	}

	SequenceLocation() {

	}

	SequenceLocation(uint const loc, short const refid) {
		m_Location = loc;
		m_RefId = refid;
	}

	SequenceLocation(Location const & other) {
		m_Location = other.m_Location;
	}
};
//#pragma pack(pop)

#endif

Fix for references with more than 32k sequences.


Use a single call only (warning x86 only) Move the y assignment to another point in code


//
// Created by admarkov on 22.04.17.
//

#ifndef FUNC_COMPOSER_FRAME_H
#define FUNC_COMPOSER_FRAME_H

#include <string>
typedef unsigned int index;

void crash(char info[]="") {
    puts("Fatal error.");
    exit(0);
}

#endif //FUNC_COMPOSER_FRAME_H

//
// Created by admarkov on 22.04.17.
//

#ifndef FUNC_COMPOSER_FRAME_H
#define FUNC_COMPOSER_FRAME_H

#include <string>
using namespace std;

typedef unsigned int index;

void crash(string info="No information.") {
    puts("Fatal error: "+info);
    exit(0);
}

#endif //FUNC_COMPOSER_FRAME_H

Add error output for crash()

Add error output for crash()


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 109
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 110
#endif

Update Skia milestone to 110

Update Skia milestone to 110

Change-Id: I99decad5e458e0353dfba0737c6d527ff550ae2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/603820
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Auto-Submit: Rakshit Sharma <e91e6cdce3825eaad0fa11b55195605cfed87fab@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


/*
 * disklist - List of disk and partitions using parted library
 *
 * Written in 2013 by Prashant P Shah <pshah.mumbai@gmail.com>
 *
 * To the extent possible under law, the author(s) have dedicated
 * all copyright and related and neighboring rights to this software
 * to the public domain worldwide. This software is distributed
 * without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication
 * along with this software.
 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
 *
 * Usage :
 * $sudo apt-get install libparted0-dev
 * $gcc disklist.c -o disklist -lparted
 * $sudo ./disklist
 */

#include <stdio.h>
#include <parted/parted.h>

typedef struct {
	unsigned char system;
} DosPartitionData;

int main()
{
	PedDevice *dev = NULL;
	PedDisk *disk = NULL;
	PedPartition *part = NULL;
	DosPartitionData *dos = NULL;
	char *type_name;

	ped_device_probe_all();

	/* Loop through each physical disk */
	while ((dev = ped_device_get_next (dev))) {
		printf("%s\n", dev->path);
		if (!ped_device_open(dev))
			continue;
		disk = ped_disk_new(dev);
		if (disk) {
			/* Loop through each disk partition */
			for (part = ped_disk_next_partition(disk, NULL); part;
					part = ped_disk_next_partition(disk, part)) {
				type_name = (char *)ped_partition_type_get_name(part->type);
				/* Check if its a primary or logical partition */
				if (part->type == 0 || part->type == 1) {
					dos = (DosPartitionData *)part->disk_specific;
					printf("num=%d type=%x fs_type=%s system=%x\n",
						part->num, part->type, type_name, dos->system);
				} else {
					printf("num=%d type=%x fs_type=%s\n",
						part->num, part->type, type_name);
				}
			}
			ped_disk_destroy(disk);
		}
	}
        exit(0);
}

Add listing disks and partitions program

Signed-off-by: Prashant Shah <80f978b5ac27fb318171799f0fb6a277863f2bf5@gmail.com>


/////////////////////////////////////////////////////////////////////////////////////////
///
///           \file  CudaLE.h
///
/// __Description__:     Main include file for the CudaLE lib
///
/// __Version__:         1.0\n
/// __Author__:          Alex Chen, fizban007@gmail.com\n
/// __Organization__:    Columbia University
///
/////////////////////////////////////////////////////////////////////////////////////////

#ifndef  _CUDALE_H_
#define  _CUDALE_H_

#include "cudaControl.h"
#include "Operators.h"
#include "Variable.h"
#include "Functions.h"
#include "Derivative.h"

#ifndef DEFINE_FUNCTOR
#define DEFINE_FUNCTOR(NAME, FUNCTOR)                    \
    private:                                             \
    typedef typeof(FUNCTOR) NAME ## _type;               \
    NAME ## _type defaultValue_ ## NAME () {             \
        return FUNCTOR;                                  \
    }                                                    \
public:                                                  \
NAME ## _type NAME

#endif

#endif   // ----- #ifndef _CUDALE_H_  -----

/////////////////////////////////////////////////////////////////////////////////////////
///
///           \file  CudaLE.h
///
/// __Description__:     Main include file for the CudaLE lib
///
/// __Version__:         1.0\n
/// __Author__:          Alex Chen, fizban007@gmail.com\n
/// __Organization__:    Columbia University
///
/////////////////////////////////////////////////////////////////////////////////////////

#ifndef  _CUDALE_H_
#define  _CUDALE_H_

#include "cudaControl.h"
#include "Operators.h"
#include "Variable.h"
#include "Functions.h"
#include "Derivative.h"

#ifndef DEFINE_FUNCTOR
#define DEFINE_FUNCTOR(NAME, FUNCTOR)                    \
    private:                                             \
    typedef __typeof__(FUNCTOR) NAME ## _type;               \
    NAME ## _type defaultValue_ ## NAME () {             \
        return FUNCTOR;                                  \
    }                                                    \
public:                                                  \
NAME ## _type NAME

#endif

#endif   // ----- #ifndef _CUDALE_H_  -----

Make the macro play nice with clang

Make the macro play nice with clang


//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

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

//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable.  Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
	// On Darwin, pagesize is always 4096 bytes
	const uintptr_t pageSize = 4096;
#else
	abort();
#endif
	const uintptr_t pageAlignMask = ~(pageSize-1);
	uintptr_t p = (uintptr_t)addr;
	unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
	unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
	mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}

//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

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

//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable.  Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
	// On Darwin, pagesize is always 4096 bytes
	const uintptr_t pageSize = 4096;
#else
        // FIXME: We should have a configure check for this.
        const uintptr_t pagesize = getpagesize();
#endif
	const uintptr_t pageAlignMask = ~(pageSize-1);
	uintptr_t p = (uintptr_t)addr;
	unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
	unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
	mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}

Use getpagesize() on non-Darwin platforms.
 - Presumably we will eventually need configure magic for this stuff.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@74586 91177308-0d34-0410-b5e6-96231b3b80d8


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

#pragma once

#include "context.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 *	Save up a string array to reprtab
 *
 *	@param	context	RuC context
 *	@param	str		Target string
 *
 *	@return	FIXME
 */
int toreprtab(compiler_context *context, char str[]);

/**
 *	Mode table initialization
 *
 *	@param	context	RuC context
 */
void init_modetab(compiler_context *context);

#ifdef __cplusplus
} /* extern "C" */
#endif

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

#pragma once

#include "context.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 *	Mode table initialization
 *
 *	@param	context	RuC context
 */
void init_modetab(compiler_context *context);

#ifdef __cplusplus
} /* extern "C" */
#endif

Remove useless interface of toreprtab

Remove useless interface of toreprtab


//
//  main.c
//  fast-xattr-test
//
//  Created by David Schlachter on 2015-07-09.
//  Copyright (c) 2015 David Schlachter. All rights reserved.
//

#include <stdio.h>
#include <sys/xattr.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

int main(int argc, const char * argv[]) {
    //char a[80];
    //strcpy(a, argv[1]);
    const char *path = argv[1];

    //char b[32];
    //strcpy(b, argv[2]);
    const char *name = argv[2];

    int value[1];

    long rval = 0;
    rval = getxattr(path, name, &value, sizeof(value), 0, 0);
    int c = errno;

    if (rval != -1) {
        return 0;
    } else {
        return 1;
    };
}

//
//  main.c
//  fast-xattr-test
//
//  Created by David Schlachter on 2015-07-09.
//  Copyright (c) 2015 David Schlachter. All rights reserved.
//

#include <stdio.h>
#include <sys/xattr.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

int main(int argc, const char * argv[]) {
    //char a[80];
    //strcpy(a, argv[2]);
    const char *path = argv[1];

    //char b[32];
    //strcpy(b, argv[1]);
    const char *name = argv[2];

    int value[1];

    long rval = 0;
    rval = getxattr(path, name, &value, sizeof(value), 0, 0);
    int c = errno;

    if (rval != -1) {
        return 0;
    } else {
        return 1;
    };
}

Set first argument to name, second to path


#pragma once

#include <iostream>
#include <string>

class UserTypeToString
{
public:
	UserTypeToString(std::string name, int age, double netWorth);
	~UserTypeToString();
	friend std::ostream& operator<<(std::ostream& os, const UserTypeToString& obj);

	std::string name;
	int age;
	double netWorth;
};

std::ostream& operator<<(std::ostream& os, const UserTypeToString& obj);
//{
//	// write obj to stream
//	os << "name - " << obj.name.c_str() << "age - " << obj.age << "netWorth - " << obj.netWorth << std::endl;
//	return os;
//}

#pragma once

#include <iostream>
#include <string>

class UserTypeToString
{
public:
	UserTypeToString(std::string name, int age, double netWorth);
	~UserTypeToString();
	friend std::ostream& operator<<(std::ostream& os, const UserTypeToString& obj);

	std::string name;
	int age;
	double netWorth;
};

// Must be inline or defined in the .cpp and can't be a member of the class
std::ostream& operator<<(std::ostream& os, const UserTypeToString& obj);

Remove unneccesary code and add a comment to the declaration of operator<<


#import <Foundation/Foundation.h>

/// Macro that marks an initializer as designated, and also makes the default Foundation initializers unavailable
#define HUB_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER; \
    /** Unavailable. Use the designated initializer instead */ \
    + (instancetype)new NS_UNAVAILABLE; \
    /** Unavailable. Use the designated initializer instead */ \
    - (instancetype)init NS_UNAVAILABLE; \
    /** Unavailable. Use the designated initializer instead */ \
    - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;

/// This macro was introduced in Xcode 8, so adding this here for now (if not defined) to support Xcode 7 as well
#ifndef NS_EXTENSIBLE_STRING_ENUM
    #define NS_EXTENSIBLE_STRING_ENUM
#endif

Define NS_EXTENSIBLE_STRING_ENUM if not defined

This enables us to support building with Xcode 7.


#ifndef SUBSCRIPTION_DATA_STORE_H
#define SUBSCRIPTION_DATA_STORE_H

#include <list>
#include <string>

class SubscriptionDataStore {
public:
  SubscriptionDataStore();

  std::list<std::string> getHandlersForType(const std::string &typeName);
  void subscribe(const std::string &typeName, const std::string &handlerName);
  void unsubscribe(const std::string &typeName, const std::string &handlerName);

private:
  struct HandlerInfo {
    std::string handlerName;
    unsigned int referenceCount;
  };

  struct SubscriptionItem {
    std::string typeName;
    std::vector<HandlerInfo> handlers;
    std::map<std::string typeName, SubscriptionItem *> subtypes;
    SubscriptionItem *parent;
  };
};

#endif

Add header file for cross-gateway subscription data store


/*
 * Environment variable to be removed for SUID programs.  The names are all
 * stuffed in a single string which means they have to be terminated with a
 * '\0' explicitly.
 */

#define UNSECURE_ENVVARS \
	"LD_PRELOAD\0" \
	"LD_LIBRARY_PATH\0" \
	"LD_DEBUG\0" \
	"LD_DEBUG_OUTPUT\0" \
	"LD_TRACE_LOADED_OBJECTS\0" \
	"TMPDIR\0"

/*
 * LD_TRACE_LOADED_OBJECTS is not in glibc-2.3.5's unsecvars.h
 * though used by ldd
 *
 * These environment variables are defined by glibc but ignored in
 * uClibc, but may very well have an equivalent in uClibc.
 *
 * LD_ORIGIN_PATH, LD_PROFILE, LD_USE_LOAD_BIAS, LD_DYNAMIC_WEAK, LD_SHOW_AUXV,
 * GCONV_PATH, GETCONF_DIR, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE,
 * NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TMPDIR, TZDIR
 */

/*
 * Environment variable to be removed for SUID programs.  The names are all
 * stuffed in a single string which means they have to be terminated with a
 * '\0' explicitly.
 */

#define UNSECURE_ENVVARS \
	"LD_PRELOAD\0" \
	"LD_LIBRARY_PATH\0" \
	"LD_DEBUG\0" \
	"LD_DEBUG_OUTPUT\0" \
	"LD_TRACE_LOADED_OBJECTS\0" \
	"TMPDIR\0"

/*
 * LD_TRACE_LOADED_OBJECTS is not in glibc-2.3.5's unsecvars.h
 * though used by ldd
 *
 * These environment variables are defined by glibc but ignored in
 * uClibc, but may very well have an equivalent in uClibc.
 *
 * LD_ORIGIN_PATH, LD_PROFILE, LD_USE_LOAD_BIAS, LD_DYNAMIC_WEAK, LD_SHOW_AUXV,
 * GCONV_PATH, GETCONF_DIR, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE,
 * NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TZDIR
 */

Remove TMPDIR from glibc's commented list


#include "logging.h"

void error_log(const char *format, ...){
	FILE *flog;
	//If the log file is over 3.5 megabytes, empty it and start again
	struct stat st;
	if (!stat(log_filename, &st) && st.st_size >= 36700160) //1048576 per megabyte
		flog = fopen(log_filename, "w+");
	else flog = fopen(log_filename, "a+");
	//Write to the log file
	if (!flog) fprintf(stderr, "Error! Could not open log file for writing!\n");
	else{
		//Get time of error
		time_t raw;
		struct tm *t;
		time(&raw);
		t = localtime(&raw);
		fprintf(flog, "[%d/%d %d:%d:%d] ", t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
		//Write error
		va_list args;
		va_start(args, format);
		vfprintf(flog, format, args);
		va_end(args);
		fclose(flog);
	}
}

#include "logging.h"

void error_log(const char *format, ...){
	FILE *flog;
	//If the log file is over 3.5 megabytes, empty it and start again
	struct stat st;
	if (!stat(log_filename, &st) && st.st_size >= 3670016) //1048576 per megabyte
		flog = fopen(log_filename, "w+");
	else flog = fopen(log_filename, "a+");
	//Write to the log file
	if (!flog) fprintf(stderr, "Error! Could not open log file for writing!\n");
	else{
		//Get time of error
		time_t raw;
		struct tm *t;
		time(&raw);
		t = localtime(&raw);
		fprintf(flog, "[%d/%d %d:%d:%d] ", t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
		//Write error
		va_list args;
		va_start(args, format);
		vfprintf(flog, format, args);
		va_end(args);
		fclose(flog);
	}
}

Set log limit back to 3.5 megabytes

Set log limit back to 3.5 megabytes


/*
 * Copyright (C) 2018-2019 Richard Hughes <richard@hughsie.com>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#pragma once

#include "fu-wacom-device.h"

#define FU_TYPE_WACOM_EMR_DEVICE (fu_wacom_emr_device_get_type ())
G_DECLARE_FINAL_TYPE (FuWacomEmrDevice, fu_wacom_emr_device, FU, WACOM_EMR_DEVICE, FuUdevDevice)

FuWacomEmrDevice	*fu_wacom_emr_device_new	(FuUdevDevice	*device);

/*
 * Copyright (C) 2018-2019 Richard Hughes <richard@hughsie.com>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#pragma once

#include "fu-wacom-device.h"

#define FU_TYPE_WACOM_EMR_DEVICE (fu_wacom_emr_device_get_type ())
G_DECLARE_FINAL_TYPE (FuWacomEmrDevice, fu_wacom_emr_device, FU, WACOM_EMR_DEVICE, FuWacomDevice)

FuWacomEmrDevice	*fu_wacom_emr_device_new	(FuUdevDevice	*device);

Fix a regression for EMR devices

wacom-emr: Fix a regression for EMR devices

Actually trying to instantiate the object leads to:

    Specified class size for type 'FuWacomEmrDevice' is smaller than the
    parent type's 'FuWacomDevice' class size.

Fixes https://github.com/fwupd/fwupd/issues/1456


/*Lien du tuto d'où provient le code
http://www.upsilonaudio.com/ar-drone-envoyer-des-commandes-at-paquets-udp/
lien vers un listing des commandes AT
http://www.upsilonaudio.com/ar-drone-recapitulatif-des-commandes-at/
*/

#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define BUFLEN 512
#define ADRESSEIP "127.0.0.1"
#define PORT 5556
#define MESSAGE1 "AT*REF=101,290718208\r"
#define MESSAGE2 "AT*REF=102,290717696\r"

void delai ( int delaiSecondes );
void err(char *s);

int main(int argc, char** argv)
{
    struct sockaddr_in serv_addr;
    int sockfd, slen=sizeof(serv_addr);
    if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
    {
        err("socket");
    }
    bzero(&serv_addr, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_port = htons(PORT);
    if (inet_aton(ADRESSEIP, &serv_addr.sin_addr)==0)
    {
        fprintf(stderr, "inet_aton() failed\n");
        exit(1);
    }
    if (sendto(sockfd, MESSAGE1, BUFLEN, 0, (struct sockaddr*)&serv_addr, slen)==-1)
    {
        err("sendto()");
    }
	/*delai(5);
    if (sendto(sockfd, MESSAGE2, BUFLEN, 0, (struct sockaddr*)&serv_addr, slen)==-1)
    {
        err("sendto()");
    }*/
    close(sockfd);
    return 0;
}

void err(char *s)
{
    perror(s);
    exit(1);
}

void delai ( int delaiSecondes )
{
    while ( clock()/CLOCKS_PER_SEC < delaiSecondes)
    {
    }
}

Add a test program: sending AT command to the drone


#include <stdio.h>

int main(void)
{
  printf("hello, world\n")
  return 0;
}

#include <stdio.h>

int main(void)
{
  printf("hello, world\n");
  return 0;
}

Fix the previous, remarkable error.

Fix the previous, remarkable error.


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

typedef struct list {
    int val;
    struct list *next;
} list_t;

// void mutate_list(list_t n){
//     list_t *next = n.next;
//     next->val = 42;
// }

int main(){
    list_t first;
    list_t second;

    first.next = &second;
    first.val = 1;
    second.next = NULL;
    second.val = 2;

    // When passing a struct to an unknown function, reachable memory should be invalidated
    mutate_list(first);
    assert(second.val == 2); //UNKNOWN!

    // Passing a pointer to the struct here.
    mutate_list2(&first);
    assert(second.val == 2); //UNKNOWN!
}

Add test where memory is not invalidated correctly.


/*
 * libvirt-gconfig-compat.h: libvirt configuration
 *
 * Copyright (C) 2012 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * Author: Christophe Fergeau <cfergeau@redhat.com>
 */

#ifndef __LIBVIRT_GCONFIG_COMPAT_H__
#define __LIBVIRT_GCONFIG_COMPAT_H__

#include <glib-object.h>

#if GLIB_CHECK_VERSION(2, 34, 0)
#define g_type_init()
#endif

#endif /* __LIBVIRT_GCONFIG_COMPAT_H__ */

/*
 * libvirt-gconfig-compat.h: libvirt configuration
 *
 * Copyright (C) 2012 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * Author: Christophe Fergeau <cfergeau@redhat.com>
 */

#ifndef __LIBVIRT_GCONFIG_COMPAT_H__
#define __LIBVIRT_GCONFIG_COMPAT_H__

#include <glib-object.h>

#if GLIB_CHECK_VERSION(2, 35, 0)
#define g_type_init()
#endif

#endif /* __LIBVIRT_GCONFIG_COMPAT_H__ */

Fix glib version check for g_type_init

Fix glib version check for g_type_init

g_type_init has been deprecated in glib 2.35, not 2.34. With versions
older than 2.35, we have to call it or we'll get a runtime failure.


/*
 * This file is part of hat-trie.
 *
 * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
 *
 *
 * Common typedefs, etc.
 *
 */

#ifndef HATTRIE_COMMON_H
#define HATTRIE_COMMON_H

typedef unsigned long value_t;

#endif

/*
 * This file is part of hat-trie.
 *
 * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
 *
 *
 * Common typedefs, etc.
 *
 */

#ifndef HATTRIE_COMMON_H
#define HATTRIE_COMMON_H

#include "pstdint.h"

typedef uintptr_t value_t;

#endif

Update hat-trie C library. Fix GH-11.

Update hat-trie C library. Fix GH-11.


#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/time.h>

int main(int argc, char ** argv){
    printf("Test %d\n", argc);
    int i;
    for(i = 0; i < argc; i++){
        printf("%d: %s\n", i, argv[i]);
    }
    struct timeval tv;
    if(gettimeofday(&tv, NULL) == 0){
        printf("Gettimeofday %d %d\n", tv.tv_sec, tv.tv_usec);
        void* test = malloc(1024*1024);
        if(test > 0){
            printf("Malloc %x\n", test);
            free(test);
            printf("Free\n");

            DIR * dir = opendir("file:///");
            if (dir != NULL) {
                struct dirent * ent;
                while ((ent = readdir(dir)) != NULL) {
                    printf("%s\n", ent->d_name);
                }
                closedir(dir);

        	    pid_t pid = fork();
                if(pid == 0){
                    printf("Fork Parent\n");
                }else if(pid > 0){
                    printf("Fork Child %d\n", pid);
                } else {
                    printf("Fork Failed\n");
                }
            }else{
                printf("Opendir Failed\n");
            }
        } else {
            printf("Malloc Failed\n");
        }
    } else {
        printf("Gettimeofday Failed\n");
    }
    return 0;
}

#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/time.h>

int main(int argc, char ** argv){
    printf("Test %d\n", argc);
    int i;
    for(i = 0; i < argc; i++){
        printf("%d: %s\n", i, argv[i]);
    }
    struct timespec tp;
    if(clock_gettime(CLOCK_REALTIME, &tp) == 0){
        printf("clock_gettime %d %d\n", tp.tv_sec, tp.tv_nsec);
        void* test = malloc(1024*1024);
        if(test > 0){
            printf("Malloc %x\n", test);
            free(test);
            printf("Free\n");

            DIR * dir = opendir("file:///");
            if (dir != NULL) {
                struct dirent * ent;
                while ((ent = readdir(dir)) != NULL) {
                    printf("%s\n", ent->d_name);
                }
                closedir(dir);

        	    pid_t pid = fork();
                if(pid > 0){
                    printf("Fork Parent %d = %d\n", getpid(), pid);
                }else if(pid == 0){
                    printf("Fork Child %d = %d\n", getpid(), pid);
                } else {
                    printf("Fork Failed %d = %d\n", getpid(), pid);
                }
            }else{
                printf("Opendir Failed\n");
            }
        } else {
            printf("Malloc Failed\n");
        }
    } else {
        printf("clock_gettime Failed\n");
    }
    return 0;
}

Implement PID, fix forking in C

Implement PID, fix forking in C


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

#ifndef __QUICKAVRO_H
#define __QUICKAVRO_H

#ifdef __cplusplus
extern "C" {
#endif

// Used when reading 'zig-zag' encoded values
#define MAX_VARINT_SIZE 10

// Initial write buffer
#define INITIAL_BUFFER_SIZE 1024

#ifdef __cplusplus
}
#endif

#endif

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

#ifndef __QUICKAVRO_H
#define __QUICKAVRO_H

#ifdef __cplusplus
extern "C" {
#endif

// Used when reading 'zig-zag' encoded values
#define MAX_VARINT_SIZE 10

// Initial write buffer
#define INITIAL_BUFFER_SIZE 1024 * 8

#ifdef __cplusplus
}
#endif

#endif

Increase initial buffer to 8192 bytes

Increase initial buffer to 8192 bytes


/*
    KindlePDFViewer: buffer for blitting muPDF data to framebuffer (blitbuffer)
    Copyright (C) 2011 Hans-Werner Hilse <hilse@web.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _UTIL_H
#define _UTIL_H

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

int luaopen_util(lua_State *L);

#endif

/*
    KindlePDFViewer: miscellaneous utility functions for Lua
    Copyright (C) 2011 Hans-Werner Hilse <hilse@web.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _UTIL_H
#define _UTIL_H

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

int luaopen_util(lua_State *L);

#endif

Correct the comment (the existing text was referring to a different file).


#ifndef STUD_String_H
#define STUD_String_H

#include <initializer_list>
#include <string>

namespace stud {

class string : public std::string {
  public:
    string() = default;
    string(const string& rhs) = default;
    string(string&& rhs) = default;
    string& operator=(const string& rhs) = default;
    string& operator=(string&& rhs) = default;
    explicit string(const char* raw_string) : std::string(raw_string) {}
    explicit string(const char* raw_string, size_t length) : std::string(raw_string, length) {}
    explicit string(size_t to_fill, char character) : std::string(to_fill, character) {}
    explicit string(const std::string& std_string) : std::string(std_string) {}
    explicit string(const std::string& std_string, size_t position,
                    size_t length = std::string::npos)
            : std::string(std_string, position, length) {}
    explicit string(std::initializer_list<char> il) : std::string(il) {}
    template <class InputIterator>
    explicit string(InputIterator first, InputIterator last)
            : std::string(first, last) {}
};

} // namespace stud

#endif // STUD_String_H

#ifndef STUD_String_H
#define STUD_String_H

#include <cstring>

#include <initializer_list>
#include <string>

namespace stud {

class string : public std::string {
  public:
    string() = default;
    string(const string& rhs) = default;
    string(string&& rhs) = default;
    string& operator=(const string& rhs) = default;
    string& operator=(string&& rhs) = default;
    explicit string(const char* raw_string) : std::string(raw_string) {}
    explicit string(const char* raw_string, size_t length) : std::string(raw_string, length) {}
    explicit string(size_t to_fill, char character) : std::string(to_fill, character) {}
    explicit string(const std::string& std_string) : std::string(std_string) {}
    explicit string(const std::string& std_string, size_t position,
                    size_t length = std::string::npos)
            : std::string(std_string, position, length) {}
    explicit string(std::initializer_list<char> il) : std::string(il) {}
    template <class InputIterator>
    explicit string(InputIterator first, InputIterator last)
            : std::string(first, last) {}
};

} // namespace stud

#endif // STUD_String_H

Add explicit header for size_t

Add explicit header for size_t


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

#define FASTCALL __attribute__((regparm(2)))

typedef struct {
  int aaa;
  double bbbb;
  int ccc[200];
} foo;

typedef void (*FType)(int, int)      __attribute ((regparm (3), stdcall));
FType bar;

static void FASTCALL
reduced(char b, double c, foo* d, double e, int f);

int
main(void) {
  // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null
  reduced(0, 0.0, 0, 0.0, 0);
  // CHECK: call x86_stdcallcc void %tmp(i32 inreg 1, i32 inreg 2)
  bar(1,2);
}

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

#define FASTCALL __attribute__((regparm(2)))

typedef struct {
  int aaa;
  double bbbb;
  int ccc[200];
} foo;

typedef void (*FType)(int, int)      __attribute ((regparm (3), stdcall));
FType bar;

static void FASTCALL
reduced(char b, double c, foo* d, double e, int f);

int
main(void) {
  // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null
  reduced(0, 0.0, 0, 0.0, 0);
  // CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2)
  bar(1,2);
}

Fix test in -Asserts build.

Fix test in -Asserts build.

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


#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    xmain();
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    xmain();
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

Use arc4random() in tests if available.

Use arc4random() in tests if available.


/**
 * @file
 * co.parabox.event.drop node implementation.
 *
 * @copyright Copyright © 2012–2014 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"
#include "VuoGlContext.h"
#include <OpenGL/CGLMacro.h>
#include <stdio.h>

VuoModuleMetadata({
					 "title" : "Text Contains",
					 "keywords" : [ "has", "search", "str", "string" ],
					 "version" : "1.0.0",
					 "description": "Returns true if `text` contains `value`, false otherwise.",
					 "node" : {
						  "exampleCompositions" : [ "" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoText) text,
		VuoInputData(VuoText) value,
		VuoOutputData(VuoBoolean) contains
)
{
	if(text == NULL || value == NULL)
		*contains = false;
	else
		*contains = strstr(text, value) != NULL;
}

Add Text Contains node. Fix Make Shader with GLSL incompatibility with newer versions of Vuo.


// Copyright 2014 Google Inc. All rights reserved.
//
// 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.

/**
 * Base class for decoders.
 */

#ifndef DECODER_H_
#define DECODER_H_

#include <memory>
#include <stdint.h>
#include <vector>

#include "dsp.h"

using namespace std;

namespace radioreceiver {

/**
 * Base class for decoders.
 */
class Decoder {
 public:
  /**
   * Demodulates a block of floating-point samples, producing a block of
   * stereo audio.
   * @param samples The samples to decode.
   * @param inStereo Whether to try decoding a stereo signal.
   * @return The generated stereo audio block.
   */
  virtual StereoAudio decode(const Samples& samples, bool inStereo) = 0;
};

}  // namespace radioreceiver

#endif  // DECODER_BASE_H_

// Copyright 2014 Google Inc. All rights reserved.
//
// 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.

/**
 * Base class for decoders.
 */

#ifndef DECODER_H_
#define DECODER_H_

#include <memory>
#include <stdint.h>
#include <vector>

#include "dsp.h"

using namespace std;

namespace radioreceiver {

/**
 * Base class for decoders.
 */
class Decoder {
 public:
  virtual ~Decoder() {}

  /**
   * Demodulates a block of floating-point samples, producing a block of
   * stereo audio.
   * @param samples The samples to decode.
   * @param inStereo Whether to try decoding a stereo signal.
   * @return The generated stereo audio block.
   */
  virtual StereoAudio decode(const Samples& samples, bool inStereo) = 0;
};

}  // namespace radioreceiver

#endif  // DECODER_BASE_H_

Add virtual destructor to base class.

Add virtual destructor to base class.


#ifndef __smoab_ExtractShell_h
#define __smoab_ExtractShell_h

#include "SimpleMoab.h"
#include "detail/LoadGeometry.h"
#include "detail/ReadMaterialTag.h"

#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>

#include <algorithm>

namespace smoab{

//we presume that we are extract the shell of a 3d volume, where the 2d
//surface elements that constructed the 3d volume are contained
//in the input parents
class ExtractShell
{
  const smoab::Interface& Interface;
  const smoab::Range& Parents;
  std::string MaterialName;
  smoab::Range SCells;

public:
  ExtractShell(const smoab::Interface& interface, const smoab::Range& parents):
    Interface(interface),
    Parents(parents),
    MaterialName("Material")
    {
    const smoab::GeomTag geom2Tag(2);
    //append all the entities cells together into a single range
    typedef smoab::Range::const_iterator iterator;
    for(iterator i=this->Parents.begin(); i!= this->Parents.end(); ++i)
      {
      //find all 2d cells
      smoab::Range entitiesCells =
          this->Interface.findEntitiesWithDimension(*i,geom2Tag);
      this->SCells.insert(entitiesCells.begin(),entitiesCells.end());
      }

    std::cout << "SCells size" << this->SCells.size() << std::endl;
    }

  //----------------------------------------------------------------------------
  template<typename T>
  bool fill(T* grid)
  {
  //we have all the volume cells, what we need is to compare these
  //volume cells to a collection of surface cells
  const smoab::GeomTag geom2Tag(2);

  //save the results into the grid
  detail::LoadGeometry loadGeom(this->SCells,this->Interface);
  loadGeom.fill(grid);

  vtkNew<vtkIntArray> materials;
  materials->SetName(this->MaterialName.c_str());
  detail::ReadMaterialTag materialReader(this->MaterialName,
                                         this->Parents,
                                         this->SCells,
                                         this->Interface);

  //fill the material array using geom2tag to determine how cells
  //maps back to the parents.
  materialReader.fill(materials.GetPointer(),&geom2Tag);
  grid->GetCellData()->AddArray(materials.GetPointer());

  //to properly label the model face / side information we need to query
  //for all the volume elements and find the 2d adjacencies of the 2d element
  //and 3 elements

  return true;
  }

  void materialIdName(const std::string& name) { this->MaterialName = name; }
};
}

#endif // EXTRACTSHELL_H

Introduce the explicit Shell reader which makes polydata from moab.

This is very similar to creating a dataSetConverter that is giving
3d parents and asked to extract the 2d cells only. The big difference is that
we will try to relate the 2d cells back to any 3d cells in the 3d parents.


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

void SystemPause() {
	puts("\nPress Enter to continue...");
	while (getchar() != '\n') {}
}

void SystemClear() {
	system("clear");
}

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

void SystemPause() {
	puts("\nPress Enter to continue...");
	while (getchar() != '\n') {}
}

void SystemClear() {
	fputs("\033[2J\033[H", stdout);
}

Use escape sequence to clear screen

Use escape sequence to clear screen


////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm 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.
//
////////////////////////////////////////////////////////////////////////////

#ifdef __cplusplus
extern "C" {
#endif

#import <Realm/RLMSchema.h>
#import <Realm/RLMDefines.h>

RLM_ASSUME_NONNULL_BEGIN

@class RLMRealm;

//
// RLMSchema private interface
//
@class RLMRealm;
@interface RLMSchema ()
@property (nonatomic, readwrite, copy) NSArray *objectSchema;

// schema based on runtime objects
+ (instancetype)sharedSchema;

// schema based on tables in a Realm
+ (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm;

// class for string
+ (nullable Class)classForString:(NSString *)className;

// shallow copy for reusing schema properties accross the same Realm on multiple threads
- (instancetype)shallowCopy;

@end

RLM_ASSUME_NONNULL_END

#ifdef __cplusplus
}
#endif

////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm 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.
//
////////////////////////////////////////////////////////////////////////////

#ifdef __cplusplus
extern "C" {
#endif

#import <Realm/RLMSchema.h>
#import <Realm/RLMDefines.h>

RLM_ASSUME_NONNULL_BEGIN

@class RLMRealm;

//
// RLMSchema private interface
//
@class RLMRealm;
@interface RLMSchema ()
@property (nonatomic, readwrite, copy) NSArray *objectSchema;

// schema based on runtime objects
+ (nullable instancetype)sharedSchema;

// schema based on tables in a Realm
+ (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm;

// class for string
+ (nullable Class)classForString:(NSString *)className;

// shallow copy for reusing schema properties accross the same Realm on multiple threads
- (instancetype)shallowCopy;

@end

RLM_ASSUME_NONNULL_END

#ifdef __cplusplus
}
#endif

Mark +[RLMSchema sharedSchema] as nullable.


#ifndef STRESS1_MERGE_NO_REEXPORT_H
#define STRESS1_MERGE_NO_REEXPORT_H

#include "m00.h"
#include "m01.h"
#include "m02.h"
#include "m03.h"

#endif

Add file missed from r244409.

Add file missed from r244409.

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


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

#ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
#define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_

#include <string>
#include <utility>
#include <vector>

#include "net/http/http_status_code.h"

namespace net {

class HttpServerResponseInfo {
 public:
  // Creates a 200 OK HttpServerResponseInfo.
  HttpServerResponseInfo();
  explicit HttpServerResponseInfo(HttpStatusCode status_code);
  ~HttpServerResponseInfo();

  static HttpServerResponseInfo CreateFor404();
  static HttpServerResponseInfo CreateFor500(const std::string& body);

  void AddHeader(const std::string& name, const std::string& value);

  // This also adds an appropriate Content-Length header.
  void SetBody(const std::string& body, const std::string& content_type);
  // Sets content-length and content-type. Body should be sent separately.
  void SetContentHeaders(size_t content_length,
                         const std::string& content_type);

  std::string Serialize() const;

  HttpStatusCode status_code() const;
  const std::string& body() const;

 private:
  typedef std::vector<std::pair<std::string, std::string> > Headers;

  HttpStatusCode status_code_;
  Headers headers_;
  std::string body_;
};

}  // namespace net

#endif  // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_

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

#ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
#define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_

#include <string>
#include <utility>

#include "base/strings/string_split.h"
#include "net/http/http_status_code.h"

namespace net {

class HttpServerResponseInfo {
 public:
  // Creates a 200 OK HttpServerResponseInfo.
  HttpServerResponseInfo();
  explicit HttpServerResponseInfo(HttpStatusCode status_code);
  ~HttpServerResponseInfo();

  static HttpServerResponseInfo CreateFor404();
  static HttpServerResponseInfo CreateFor500(const std::string& body);

  void AddHeader(const std::string& name, const std::string& value);

  // This also adds an appropriate Content-Length header.
  void SetBody(const std::string& body, const std::string& content_type);
  // Sets content-length and content-type. Body should be sent separately.
  void SetContentHeaders(size_t content_length,
                         const std::string& content_type);

  std::string Serialize() const;

  HttpStatusCode status_code() const;
  const std::string& body() const;

 private:
  using Headers = base::StringPairs;

  HttpStatusCode status_code_;
  Headers headers_;
  std::string body_;
};

}  // namespace net

#endif  // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_

Use of base::StringPairs appropriately in server

Bescause base/strings/string_split.h defines:
typedef std::vector<std::pair<std::string, std::string> > StringPairs;

BUG=412250

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

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


#import <Foundation/Foundation.h>

@class MITCollectionViewNewsGridLayout;

@interface MITCollectionViewGridLayoutSection : NSObject
@property (nonatomic,readonly,weak) MITCollectionViewNewsGridLayout *layout;
@property (nonatomic,readonly) NSInteger section;

@property (nonatomic) CGPoint origin;
@property (nonatomic) UIEdgeInsets contentInsets;

@property (nonatomic, readonly) CGSize bounds;
@property (nonatomic,readonly) CGRect frame;

@property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *headerLayoutAttributes;
@property (nonatomic,readonly,strong) UICollectionViewLayout *featuredItemLayoutAttributes;
@property (nonatomic,readonly,strong) NSArray *itemLayoutAttributes;

+ (instancetype)sectionWithLayout:(MITCollectionViewNewsGridLayout*)layout section:(NSInteger)section;
- (NSArray*)layoutAttributesInRect:(CGRect)rect;
- (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath:(NSIndexPath*)indexPath;

@end

#import <Foundation/Foundation.h>

@class MITCollectionViewNewsGridLayout;

@interface MITCollectionViewGridLayoutSection : NSObject
@property (nonatomic,readonly,weak) MITCollectionViewNewsGridLayout *layout;
@property (nonatomic,readonly) NSInteger section;

@property (nonatomic) CGPoint origin;
@property (nonatomic) UIEdgeInsets contentInsets;

@property (nonatomic,readonly) CGRect bounds;
@property (nonatomic,readonly) CGRect frame;

@property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *headerLayoutAttributes;
@property (nonatomic,readonly,strong) UICollectionViewLayoutAttributes *featuredItemLayoutAttributes;
@property (nonatomic,readonly,strong) NSArray *itemLayoutAttributes;

+ (instancetype)sectionWithLayout:(MITCollectionViewNewsGridLayout*)layout forSection:(NSInteger)section numberOfColumns:(NSInteger)numberOfColumns;
- (NSArray*)layoutAttributesInRect:(CGRect)rect;
- (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath:(NSIndexPath*)indexPath;

@end

Clean up some inconsistencies in the section helper header


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

#pragma once

#include "Stdafx.h"
#include "IRequestResponse.h"

using namespace System;
using namespace System::Net;

namespace CefSharp
{
    public enum class NavigationType
    {
        LinkClicked = NAVIGATION_LINK_CLICKED,
        FormSubmitted = NAVIGATION_FORM_SUBMITTED,
        BackForward = NAVIGATION_BACK_FORWARD,
        Reload = NAVIGATION_RELOAD,
        FormResubmitted = NAVIGATION_FORM_RESUBMITTED,
        Other = NAVIGATION_OTHER
    };

    public interface class IRequestHandler
    {
    public:
        bool OnBeforeBrowse(IWebBrowser^ browser, IRequest^ request, NavigationType navigationType, bool isRedirect);
        bool OnBeforeResourceLoad(IWebBrowser^ browser, IRequestResponse^ requestResponse);
        void OnResourceResponse(IWebBrowser^ browser, String^ url, int status, String^ statusText, String^ mimeType, WebHeaderCollection^ headers);
        bool GetDownloadHandler(IWebBrowser^ browser, String^ mimeType, String^ fileName, Int64 contentLength, IDownloadHandler ^% handler);
        bool GetAuthCredentials(IWebBrowser^ browser, bool isProxy, String^ host ,int port, String^ realm, String^ scheme, String^% username, String^% password);
   };
}

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

#pragma once

#include "Stdafx.h"
#include "IRequestResponse.h"

using namespace System;
using namespace System::Net;
using namespace System::Runtime::InteropServices;

namespace CefSharp
{
    public enum class NavigationType
    {
        LinkClicked = NAVIGATION_LINK_CLICKED,
        FormSubmitted = NAVIGATION_FORM_SUBMITTED,
        BackForward = NAVIGATION_BACK_FORWARD,
        Reload = NAVIGATION_RELOAD,
        FormResubmitted = NAVIGATION_FORM_RESUBMITTED,
        Other = NAVIGATION_OTHER
    };

    public interface class IRequestHandler
    {
        bool OnBeforeBrowse(IWebBrowser^ browser, IRequest^ request, NavigationType navigationType, bool isRedirect);
        bool OnBeforeResourceLoad(IWebBrowser^ browser, IRequestResponse^ requestResponse);
        void OnResourceResponse(IWebBrowser^ browser, String^ url, int status, String^ statusText, String^ mimeType, WebHeaderCollection^ headers);
        bool GetDownloadHandler(IWebBrowser^ browser, [Out] IDownloadHandler ^% handler);
        bool GetAuthCredentials(IWebBrowser^ browser, bool isProxy, String^ host ,int port, String^ realm, String^ scheme, String^% username, String^% password);
   };
}

Use a proper Out parameter.

Use a proper Out parameter.


#ifndef _MY_EDATA
#define _MY_EDATA

#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif

/** @brief struct that carries all information about experimental data */
typedef struct edata {
    /** observed data */
    double *am_my;
    /** standard deviation of observed data */
    double *am_ysigma;

    /** observed events */
    double *am_mz;
    /** standard deviation of observed events */
    double *am_zsigma;

    /** boolean indicating whether experimental data was provided */
    bool am_bexpdata;

	} ExpData;

EXTERNC void freeExpData(ExpData *edata);

#endif /* _MY_EDATA */

#ifndef _MY_EDATA
#define _MY_EDATA

#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#include <stdbool.h>
#endif

/** @brief struct that carries all information about experimental data */
typedef struct edata {
    /** observed data */
    double *am_my;
    /** standard deviation of observed data */
    double *am_ysigma;

    /** observed events */
    double *am_mz;
    /** standard deviation of observed events */
    double *am_zsigma;

    /** boolean indicating whether experimental data was provided */
    bool am_bexpdata;

} ExpData;

EXTERNC void freeExpData(ExpData *edata);

#endif /* _MY_EDATA */

Fix type bool for C

Fix type bool for C


#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

ErrorCode getErrorCodeForCurlError(int curl_code);

class Error {
  public:
    Error() : code{ErrorCode::OK}, message{""} {}

    template <typename TextType>
    Error(const ErrorCode& p_error_code, TextType&& p_error_message)
            : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;
};

} // namespace cpr

#endif

#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

ErrorCode getErrorCodeForCurlError(int curl_code);

class Error {
  public:
    Error() : code{ErrorCode::OK} {}

    template <typename TextType>
    Error(const ErrorCode& p_error_code, TextType&& p_error_message)
            : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;
};

} // namespace cpr

#endif

Remove explicit instantiation of empty message


#include <linux/init.h>
#include <linux/linkage.h>

#include <asm/i8259.h>
#include <asm/mipsregs.h>
#include <asm/qemu.h>
#include <asm/system.h>
#include <asm/time.h>

extern asmlinkage void qemu_handle_int(void);

asmlinkage void plat_irq_dispatch(void)
{
	unsigned int pending = read_c0_status() & read_c0_cause();

	if (pending & 0x8000) {
		ll_timer_interrupt(Q_COUNT_COMPARE_IRQ);
		return;
	}
	if (pending & 0x0400) {
		int irq = i8259_irq();

		if (likely(irq >= 0))
			do_IRQ(irq);

		return;
	}
}

void __init arch_init_irq(void)
{
	mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK;		/* 100MHz */

	init_i8259_irqs();
	set_c0_status(0x8400);
}

#include <linux/init.h>
#include <linux/linkage.h>

#include <asm/i8259.h>
#include <asm/mipsregs.h>
#include <asm/qemu.h>
#include <asm/system.h>
#include <asm/time.h>

asmlinkage void plat_irq_dispatch(void)
{
	unsigned int pending = read_c0_status() & read_c0_cause();

	if (pending & 0x8000) {
		ll_timer_interrupt(Q_COUNT_COMPARE_IRQ);
		return;
	}
	if (pending & 0x0400) {
		int irq = i8259_irq();

		if (likely(irq >= 0))
			do_IRQ(irq);

		return;
	}
}

void __init arch_init_irq(void)
{
	mips_hpt_frequency = QEMU_C0_COUNTER_CLOCK;		/* 100MHz */

	init_i8259_irqs();
	set_c0_status(0x8400);
}

[MIPS] Remove prototype for deleted function qemu_handle_int

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>


// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE="/" LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s

int main(int argc, const char *argv[]) {
  if (argc < 2)
    return 1;
  return 0;
}
// CHECK: LLVM Profile: Failed to write file

// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE="%t/" LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s

int main(int argc, const char *argv[]) {
  if (argc < 2)
    return 1;
  return 0;
}
// CHECK: LLVM Profile: Failed to write file

[profile] Test error reporting by writing to a temp directory

This test case is meant to check whether verbose error logging works. It
does this by _failing_ to write a profile to a path corresponding to a
directory. Make this clearer by writing to a temporary directory.

Patch suggested by Sean Silva!

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@264817 91177308-0d34-0410-b5e6-96231b3b80d8


#include <stdio.h>
#include <inttypes.h>
#include <capstone/capstone.h>

#define X86_CODE \
    "\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\x14\x9e\x08\x00\x45\x31\xe4"

int main(int argc, char* argv[])
{
	csh handle;
	cs_insn *insn;
	size_t count;
	int rc = 0;

	if (cs_open(CS_ARCH_X86, CS_MODE_64, &handle) != CS_ERR_OK) {
		return 1;
	}

	cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);

	count = cs_disasm(handle, (const uint8_t*) X86_CODE, sizeof(X86_CODE) - 1, 0x1000, 0, &insn);

	if (count > 0) {
		printf("count = %zu\n", count);
		for (size_t i = 0; i < count; i++) {
			printf("0x%"PRIx64": % - 6s %s\n", insn[i].address, insn[i].mnemonic, insn[i].op_str);
		}
		cs_free(insn, count);
	} else {
		puts("ERROR: Failed to dissasemble given code!\n");
		rc = 1;
	}

	cs_close(&handle);

	return rc;
}

Add capstone dissasembly C example.

Add capstone dissasembly C example.

compile with: gcc capstone_dissasembly.c -o capstone -lcapstone


#include <string>
#include <vector>
#ifndef __hpux
using namespace std;
#endif

#pragma create TClass vector<bool>;
#pragma create TClass vector<char>;
#pragma create TClass vector<short>;
#pragma create TClass vector<long>;
#pragma create TClass vector<unsigned char>;
#pragma create TClass vector<unsigned short>;
#pragma create TClass vector<unsigned int>;
#pragma create TClass vector<unsigned long>;
#pragma create TClass vector<float>;
#pragma create TClass vector<double>;
#pragma create TClass vector<char*>;
#pragma create TClass vector<const char*>;
#pragma create TClass vector<string>;

#if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300)
// gcc3.1,3.2 has a problem with iterator<void*,...,void&>
#pragma create TClass vector<void*>;
#endif

#include <string>
#include <vector>
#ifndef __hpux
using namespace std;
#endif

#pragma create TClass vector<bool>;
#pragma create TClass vector<char>;
#pragma create TClass vector<short>;
#pragma create TClass vector<long>;
#pragma create TClass vector<unsigned char>;
#pragma create TClass vector<unsigned short>;
#pragma create TClass vector<unsigned int>;
#pragma create TClass vector<unsigned long>;
#pragma create TClass vector<float>;
#pragma create TClass vector<double>;
#pragma create TClass vector<char*>;
#pragma create TClass vector<const char*>;
#pragma create TClass vector<string>;
#pragma create TClass vector<Long64_t>;
#pragma create TClass vector<ULong64_t>;

#if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300)
// gcc3.1,3.2 has a problem with iterator<void*,...,void&>
#pragma create TClass vector<void*>;
#endif

Add missing TClass creation for vector<Long64_t> and vector<ULong64_t>

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@38659 27541ba8-7e3a-0410-8455-c3a389f83636


// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t
// RUN: not grep subq %t
// RUN: not grep addq %t
// RUN: grep {\\-4(%%rsp)} %t | count 2
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t
// RUN: grep subq %t | count 1
// RUN: grep addq %t | count 1
// This is a test for x86-64, add your target below if it FAILs.
// XFAIL: alpha|ia64|arm|powerpc|sparc|x86

long double f0(float f) { return f; }

// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t
// RUN: not grep subq %t
// RUN: not grep addq %t
// RUN: grep {\\-4(%%rsp)} %t | count 2
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t
// RUN: grep subq %t | count 1
// RUN: grep addq %t | count 1
// This is a test for x86-64, add your target below if it FAILs.
// XFAIL: alpha|ia64|arm|powerpc|sparc|i.86

long double f0(float f) { return f; }

Make the XFAIL line actually match x86-32 targets.

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


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012  Raymond Jennings
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

Add subroutine daemon for Game

Add subroutine daemon for Game


/*
 @ 0xCCCCCCCC
*/

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef KBASE_BASIC_MACROS_H_
#define KBASE_BASIC_MACROS_H_

#define DISALLOW_COPY(CLASSNAME)                        \
    CLASSNAME(const CLASSNAME&) = delete;               \
    CLASSNAME& operator=(const CLASSNAME&) = delete

#define DISALLOW_MOVE(CLASSNAME)                        \
    CLASSNAME(CLASSNAME&&) = delete;                    \
    CLASSNAME& operator=(CLASSNAME&&) = delete

#endif  // KBASE_BASIC_MACROS_H_

/*
 @ 0xCCCCCCCC
*/

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef KBASE_BASIC_MACROS_H_
#define KBASE_BASIC_MACROS_H_

#define DISALLOW_COPY(CLASSNAME)                        \
    CLASSNAME(const CLASSNAME&) = delete;               \
    CLASSNAME& operator=(const CLASSNAME&) = delete

#define DISALLOW_MOVE(CLASSNAME)                        \
    CLASSNAME(CLASSNAME&&) = delete;                    \
    CLASSNAME& operator=(CLASSNAME&&) = delete

#define UNREFED_VAR(x) \
    ::kbase::internal::SilenceUnusedVariableWarning(x)

// Put complicated implementation below.

namespace kbase {

namespace internal {

template<typename T>
void SilenceUnusedVariableWarning(T&&)
{}

}   // namespace internal

}   // namespace kbase

#endif  // KBASE_BASIC_MACROS_H_

Add a macro UNREFED_VAR to silence unused variables warning.


#import <Foundation/Foundation.h>

@protocol TGSessionTokenNotifier <NSObject>

+(void)sessionTokenSet:(NSString*)token;

@end

#import <Foundation/Foundation.h>

@protocol TGSessionTokenNotifier <NSObject>

-(void)sessionTokenSet:(NSString*)token;

@end

Make token notifier method instance method


#ifndef LINESRC_HPP
#define LINESRC_HPP

#include <stdint.h>

#include <string>

class haxpp_linesource {
private:
    linecount_t         lineno_start = 0;
    linecount_t         lineno = 0;
    std::string         sourcepath;
    FILE*               fp = nullptr;
    char*               line = nullptr;
    size_t              line_alloc = 0;
    bool                fp_owner = false;
public:
    static constexpr size_t    line_alloc_minimum = 32u;
    static constexpr size_t    line_alloc_default = 1200u;
    static constexpr size_t    line_alloc_maximum = 65536u;
public:
    inline const std::string& getsourcename() const {
        return sourcepath;
    }
    inline size_t linesize() const { /* total buffer size including room for NUL terminator */
        return line_alloc;
    }
    inline linecount_t currentline() const {
        return lineno;
    }
public:
    haxpp_linesource();
    ~haxpp_linesource();
public:
    void setsource();
    void setsource(FILE *_fp);
    void setsource(const std::string &path);
    bool lineresize(const size_t newsz);
    void close();
    bool is_open() const;
    bool eof() const;
    bool error() const;
    bool open();
    char *readline();
};

#endif /*LINESRC_HPP*/

#ifndef LINESRC_HPP
#define LINESRC_HPP

#include <stdint.h>

#include <string>

class haxpp_linesource {
private:
    linecount_t         lineno_start = 0;
    linecount_t         lineno = 0;
    std::string         sourcepath;
    FILE*               fp = nullptr;
    char*               line = nullptr;
    size_t              line_alloc = 0;
    bool                fp_owner = false;
public:
    static constexpr size_t    line_alloc_minimum = 32u;
    static constexpr size_t    line_alloc_default = 1200u;
    static constexpr size_t    line_alloc_maximum = 65536u;
public:
    inline const std::string& getsourcename() const {
        return sourcepath;
    }
    inline size_t linesize() const { /* total buffer size including room for NUL terminator */
        return line_alloc;
    }
    inline linecount_t currentline() const {
        return lineno_start;
    }
public:
    haxpp_linesource();
    ~haxpp_linesource();
public:
    void setsource();
    void setsource(FILE *_fp);
    void setsource(const std::string &path);
    bool lineresize(const size_t newsz);
    void close();
    bool is_open() const;
    bool eof() const;
    bool error() const;
    bool open();
    char *readline();
};

#endif /*LINESRC_HPP*/

Fix line number off by 1 error

Fix line number off by 1 error


/*
 * SearchCubePruning.h
 *
 *  Created on: 16 Nov 2015
 *      Author: hieu
 */

#pragma once
#include <vector>
#include <boost/unordered_map.hpp>
#include "Search.h"

class Bitmap;

class SearchCubePruning : public Search
{
public:
	SearchCubePruning(Manager &mgr, Stacks &stacks);
	virtual ~SearchCubePruning();

	void Decode(size_t stackInd);

	const Hypothesis *GetBestHypothesis() const;

protected:
	boost::unordered_map<Bitmap*, std::vector<const Hypothesis*> > m_hyposPerBM;
};

/*
 * SearchCubePruning.h
 *
 *  Created on: 16 Nov 2015
 *      Author: hieu
 */

#ifndef SEARCH_SEARCHCUBEPRUNING_H_
#define SEARCH_SEARCHCUBEPRUNING_H_

#include "Search.h"

class SearchCubePruning : public Search
{
public:
	SearchCubePruning(Manager &mgr, Stacks &stacks);
	virtual ~SearchCubePruning();

	void Decode(size_t stackInd);

	const Hypothesis *GetBestHypothesis() const;

};

#endif /* SEARCH_SEARCHCUBEPRUNING_H_ */

Revert "for each input path.2"

Revert "for each input path.2"

This reverts commit 69e4cb0531ec93868ccc06ec54d52a4f88d62295.


#ifndef PERL_MONGO
#define PERL_MONGO

#include <mongo/client/dbclient.h>

extern "C" {

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#define PERL_MONGO_CALL_BOOT(name)  perl_mongo_call_xs (aTHX_ name, cv, mark)

void perl_mongo_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *cv), CV *cv, SV **mark);
SV *perl_mongo_call_reader (SV *self, const char *reader);
void perl_mongo_attach_ptr_to_instance (SV *self, void *ptr);
void *perl_mongo_get_ptr_from_instance (SV *self);
SV *perl_mongo_construct_instance (const char *klass, ...);
SV *perl_mongo_construct_instance_va (const char *klass, va_list ap);
SV *perl_mongo_construct_instance_with_magic (const char *klass, void *ptr, ...);
SV *perl_mongo_bson_to_sv (const char *oid_class, mongo::BSONObj obj);
mongo::BSONObj perl_mongo_sv_to_bson (SV *sv, const char *oid_class);

}

#endif

#ifndef PERL_MONGO
#define PERL_MONGO

#include <mongo/client/dbclient.h>

extern "C" {

#define PERL_GCC_BRACE_GROUPS_FORBIDDEN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#define PERL_MONGO_CALL_BOOT(name)  perl_mongo_call_xs (aTHX_ name, cv, mark)

void perl_mongo_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *cv), CV *cv, SV **mark);
SV *perl_mongo_call_reader (SV *self, const char *reader);
void perl_mongo_attach_ptr_to_instance (SV *self, void *ptr);
void *perl_mongo_get_ptr_from_instance (SV *self);
SV *perl_mongo_construct_instance (const char *klass, ...);
SV *perl_mongo_construct_instance_va (const char *klass, va_list ap);
SV *perl_mongo_construct_instance_with_magic (const char *klass, void *ptr, ...);
SV *perl_mongo_bson_to_sv (const char *oid_class, mongo::BSONObj obj);
mongo::BSONObj perl_mongo_sv_to_bson (SV *sv, const char *oid_class);

}

#endif

Stop the headers of debugging perls to generate gcc brace groups.

Those don't work with g++ easily.


// Derived from blog post at http://www.ermicro.com/blog/?p=1239

#ifndef __I2C_UTILS_H__
#define __I2C_UTILS_H__

#define I2C_MAX_TRIES 50     // Connection attempts (0 < tries < 255)
#define I2C_START 0
#define I2C_DATA 1
#define I2C_DATA_ACK 2
#define I2C_STOP 3

void i2c_init(void);
unsigned char i2c_transmit(unsigned char type);
char i2c_start(unsigned int dev_id, unsigned int dev_addr, unsigned char rw_type);
void i2c_stop(void);
char i2c_write(char data);
char i2c_read(char *data, char ack_type);

#endif  /*__I2C_UTILS_H__*/

// Derived from blog post at http://www.ermicro.com/blog/?p=1239

#ifndef __I2C_UTILS_H__
#define __I2C_UTILS_H__

#include <compat/twi.h>

#define I2C_MAX_TRIES 50     // Connection attempts (0 < tries < 255)
#define I2C_START 0
#define I2C_DATA 1
#define I2C_DATA_ACK 2
#define I2C_STOP 3
#define I2C_SCL 100000L      // Set I2C clock to 100 kHz

void i2c_init(void);
uint8_t i2c_transmit(uint8_t type);
char i2c_start(uint8_t dev_addr, uint8_t rw_type);
void i2c_stop(void);
char i2c_write(char data);
char i2c_read(char *data, char ack_type);

// Higher-level convenience functions composed from functions above.
void    i2c_write_byte(uint8_t dev_addr, char data);
void    i2c_write_byte_to_register(uint8_t dev_addr, uint8_t reg, char data);
uint8_t i2c_read_byte_from_register(uint8_t dev_addr, uint8_t reg_addr);

#endif  /*__I2C_UTILS_H__*/

Add high-level write and read functions

Add high-level write and read functions


#define DUMMY			0
#define FUNC			1
#define PARAM			2
#define XFER_FUNC		3
#define ALLOC_FUNC		4
#define ACTION_PARAM	5
#define NOSUPP_FUNC		6

struct token {
	int		tok_type;
	char	*val;
};

struct node {
	int		node_type;
	char	*type_name;
	char	*id;
	int		is_ptr;
	int		is_const;
	int		is_const_ptr;
	int		is_mapped;
	int		is_array;
	int		is_ref;
	int		in_param;
	int		out_param;
	int		extract;
	struct node	*next;
	struct node *prev;
	struct node *param_list;
	struct node *action_func_list;
};

#define XDR_FUNC id

struct p_mode {
	int		in;
	int		out;
};

union yystype {
	struct	token tok;
	struct	node *node;
	struct	p_mode param_mode;
	int		bool;
};
#define YYSTYPE union yystype

#define DUMMY			0
#define FUNC			1
#define PARAM			2
#define XFER_FUNC		3
#define ALLOC_FUNC		4
#define ACTION_PARAM	5
#define NOSUPP_FUNC		6

struct token {
	int		tok_type;
	char	*val;
};

struct node {
	int		node_type;
	char	*type_name;
	char	*id;
	int		is_ptr;
	int		is_const;
	int		is_const_ptr;
	int		is_mapped;
	int		is_array;
	int		is_ref;
	int		in_param;
	int		out_param;
	int		extract;
	int		pseudo;
	struct node	*next;
	struct node *prev;
	struct node *param_list;
	struct node *action_func_list;
};

#define XDR_FUNC id

struct p_mode {
	int		in;
	int		out;
};

union yystype {
	struct	token tok;
	struct	node *node;
	struct	p_mode param_mode;
	int		bool;
};
#define YYSTYPE union yystype

Add boolean node attirbute "pseudo" to describe whether a given system call is a "normal" one, or a "pseudo" call. This needs to be know by the receivers where normal syscalls can be invoked directly by their name, but pseudo calls must have hand written code to handle their functionality.


// RUN: %ocheck 1 '-DNULL=(void *)0'
// RUN: %ocheck 0 '-DNULL=0'

int null_is_ptr_type()
{
	char s[1][1+(int)NULL];
	int i = 0;
	sizeof s[i++];
	return i;
}

main()
{
	return null_is_ptr_type();
}

// RUN: %ocheck 1 %s '-DNULL=(void *)0'
// RUN: %ocheck 0 %s '-DNULL=0'

int null_is_ptr_type()
{
	char s[1][1+(int)NULL];
	int i = 0;
	sizeof s[i++];
	return i;
}

main()
{
	return null_is_ptr_type();
}

Fix standard-nonconst vla test commands

Fix standard-nonconst vla test commands


//
//  Messages.h
//  Pods
//
//  Created by Tyler Clemens on 6/2/16.
//
//

#import <Foundation/Foundation.h>
#import "STMMessage.h"

@protocol MessagesDelegate <NSObject>

@optional

- (void)MessagesResults:(NSArray *_Nullable)arrayMessages;
- (void)UnreadMessageResults:(NSNumber *_Nullable)count;

@end

@interface Messages : NSObject <STMHTTPResponseHandlerDelegate>

+ (void)initAll;
+ (void)freeAll;

+ (Messages *_Nonnull)controller;

- (void)requestForMessagesWithDelegate:(id<MessagesDelegate> _Nullable)delegate;
- (void)requestForUnreadMessageCountWithDelegate:(id<MessagesDelegate> _Nullable)delegate;
- (void)requestForMessage:(NSString * _Nonnull)messageId completionHandler:(void (^_Nullable)(NSError *_Nullable, id _Nullable))completionHandler;
- (void)cancelAllRequests;

@end

//
//  Messages.h
//  Pods
//
//  Created by Tyler Clemens on 6/2/16.
//
//

#import <Foundation/Foundation.h>
#import "STMMessage.h"
#import "STMNetworking.h"

@protocol MessagesDelegate <NSObject>

@optional

- (void)MessagesResults:(NSArray *_Nullable)arrayMessages;
- (void)UnreadMessageResults:(NSNumber *_Nullable)count;

@end

@interface Messages : NSObject <STMHTTPResponseHandlerDelegate>

+ (void)initAll;
+ (void)freeAll;

+ (Messages *_Nonnull)controller;

- (void)requestForMessagesWithDelegate:(id<MessagesDelegate> _Nullable)delegate;
- (void)requestForUnreadMessageCountWithDelegate:(id<MessagesDelegate> _Nullable)delegate;
- (void)requestForMessage:(NSString * _Nonnull)messageId completionHandler:(void (^_Nullable)(NSError *_Nullable, id _Nullable))completionHandler;
- (void)cancelAllRequests;

@end

Fix a linking issue found by lint

Fix a linking issue found by lint


#include <Sub/Types.h>
// This comment ensures that this file is not identical to
// HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h

Change this comment to helpfully explain why it's there.

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


#ifndef ONEDMASSFLUX_H
#define ONEDMASSFLUX_H

#include "Kernel.h"

class OneDMassFlux;

template<>
InputParameters validParams<OneDMassFlux>();

/**
 * Mass flux
 */
class OneDMassFlux : public Kernel
{
public:
  OneDMassFlux(const InputParameters & parameters);
  virtual ~OneDMassFlux();

protected:
  virtual Real computeQpResidual();
  virtual Real computeQpJacobian();
  virtual Real computeQpOffDiagJacobian(unsigned int jvar);

  VariableValue & _rhouA;
  unsigned int _rhouA_var_number;
};

#endif /* ONEDMASSFLUX_H */

#ifndef ONEDMASSFLUX_H
#define ONEDMASSFLUX_H

#include "Kernel.h"

class OneDMassFlux;

template<>
InputParameters validParams<OneDMassFlux>();

/**
 * Mass flux
 */
class OneDMassFlux : public Kernel
{
public:
  OneDMassFlux(const InputParameters & parameters);
  virtual ~OneDMassFlux();

protected:
  virtual Real computeQpResidual();
  virtual Real computeQpJacobian();
  virtual Real computeQpOffDiagJacobian(unsigned int jvar);

  const VariableValue & _rhouA;
  unsigned int _rhouA_var_number;
};

#endif /* ONEDMASSFLUX_H */

Prepare RELAP-7 for MooseVariable::sln() const update.

This set of changes prepares RELAP-7 to work with an upcoming version of
MOOSE in which MooseVariable::sln() returns a const reference.

Refs idaholab/moose#6327.


#include <string>

using namespace std;

/* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */
void tokenizeString(const string& str,
				vector<string>& tokens,
				const string& delimiters)
{
	// Skip delimiters at beginning.
	string::size_type lastPos = str.find_first_not_of(delimiters, 0);
	// Find first "non-delimiter".
	string::size_type pos     = str.find_first_of(delimiters, lastPos);

	while (string::npos != pos || string::npos != lastPos)
	{
		// Found a token, add it to the vector.
		tokens.push_back(str.substr(lastPos, pos - lastPos));
		// Skip delimiters.  Note the "not_of"
		lastPos = str.find_first_not_of(delimiters, pos);
		// Find next "non-delimiter"
		pos = str.find_first_of(delimiters, lastPos);
	}
}

#include <string>

/* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */
void tokenizeString(const std::string& str,
				std::vector<std::string>& tokens,
				const std::string& delimiters)
{
	// Skip delimiters at beginning.
	std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
	// Find first "non-delimiter".
	std::string::size_type pos     = str.find_first_of(delimiters, lastPos);

	while (std::string::npos != pos || std::string::npos != lastPos)
	{
		// Found a token, add it to the vector.
		tokens.push_back(str.substr(lastPos, pos - lastPos));
		// Skip delimiters.  Note the "not_of"
		lastPos = str.find_first_not_of(delimiters, pos);
		// Find next "non-delimiter"
		pos = str.find_first_of(delimiters, lastPos);
	}
}

Remove use of using-directive for std

Common: Remove use of using-directive for std


//PARAM: --enable ana.int.interval --disable exp.lower-constants
#include <assert.h>

int main(){
    int a = 0;

    // maximum value for ulonglong
    unsigned long long x = 18446744073709551615ull;
    if(x > 18446744073709551612ull){
        a = 1;
    }
    assert(a);

    unsigned long long y = x + 4;
    // Unsigned overflow -- The following assertion should succeed
    assert(y == 3);

    // maximum value for long long
    signed long long s = 9223372036854775807;
    assert(s > 9223372036854775806);

    signed long long t = s + 2;
    // Signed overflow -- The following assertion must be UNKNOWN!
    assert(t == 1); // UNKNOWN!

    return 0;
}

//PARAM: --disable ana.int.interval
#include <assert.h>

int main(){
    int a = 0;

    // maximum value for ulonglong
    unsigned long long x = 18446744073709551615ull;
    if(x > 18446744073709551612ull){
        a = 1;
    }
    assert(a);

    unsigned long long y = x + 4;
    // Unsigned overflow -- The following assertion should succeed
    assert(y == 3);

    // maximum value for long long
    signed long long s = 9223372036854775807;
    assert(s > 9223372036854775806);

    signed long long t = s + 2;
    // Signed overflow -- The following assertion must be UNKNOWN!
    assert(t == 1); // UNKNOWN!

    return 0;
}

Test defexc with large integers

Test defexc with large integers


#define BUF_SIZE 4096

#define MAXINTERFACES 10
#define MAXNEIGHBOURS 20

#define MESSAGE_PAD1 0
#define MESSAGE_PADN 1
#define MESSAGE_ACK_REQ 2
#define MESSAGE_ACK 3
#define MESSAGE_HELLO 4
#define MESSAGE_IHU 5
#define MESSAGE_ROUTER_ID 6
#define MESSAGE_NH 7
#define MESSAGE_UPDATE 8

#define MESSAGE_REQUEST 9
#define MESSAGE_MH_REQUEST 10

#define AE_WILDCARD 0
#define AE_IPV4 1
#define AE_IPV6 2
#define AE_LL 3

#define INFINITY 0xFFFF

#define BUF_SIZE 4096

#define MAXINTERFACES 5
#define MAXNEIGHBOURS 10

#define MESSAGE_PAD1 0
#define MESSAGE_PADN 1
#define MESSAGE_ACK_REQ 2
#define MESSAGE_ACK 3
#define MESSAGE_HELLO 4
#define MESSAGE_IHU 5
#define MESSAGE_ROUTER_ID 6
#define MESSAGE_NH 7
#define MESSAGE_UPDATE 8

#define MESSAGE_REQUEST 9
#define MESSAGE_MH_REQUEST 10

#define AE_WILDCARD 0
#define AE_IPV4 1
#define AE_IPV6 2
#define AE_LL 3

#define INFINITY 0xFFFF

Reduce size of neighbour and interface table.

Now that we're able to expire neighbours, we can get away with a smaller table.


//
// Copyright (C) 2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

// Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>

#ifndef _plgg726_h_
#define _plgg726_h_

#include <mp/codecs/PlgDefsV1.h>

#include <spandsp/bitstream.h>
#include <spandsp/g726.h>

int internal_decode_g726(void* handle, const void* pCodedData,
                         unsigned cbCodedPacketSize, void* pAudioBuffer,
                         unsigned cbBufferSize, unsigned *pcbCodedSize,
                         const struct RtpHeader* pRtpHeader);

int internal_encode_g726(void* handle, const void* pAudioBuffer,
                         unsigned cbAudioSamples, int* rSamplesConsumed,
                         void* pCodedData, unsigned cbMaxCodedData,
                         int* pcbCodedSize, unsigned* pbSendNow);

#endif

//
// Copyright (C) 2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

// Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>

#ifndef _plgg726_h_
#define _plgg726_h_

#include <mp/codecs/PlgDefsV1.h>

#include <spandsp/bitstream.h>
#include <spandsp/g726.h>

#ifndef G726_PACKING_NONE
#define G726_PACKING_NONE 0
#endif

#ifndef G726_ENCODING_LINEAR
#define G726_ENCODING_LINEAR	0
#endif

int internal_decode_g726(void* handle, const void* pCodedData,
                         unsigned cbCodedPacketSize, void* pAudioBuffer,
                         unsigned cbBufferSize, unsigned *pcbCodedSize,
                         const struct RtpHeader* pRtpHeader);

int internal_encode_g726(void* handle, const void* pAudioBuffer,
                         unsigned cbAudioSamples, int* rSamplesConsumed,
                         void* pCodedData, unsigned cbMaxCodedData,
                         int* pcbCodedSize, unsigned* pbSendNow);

#endif

FIx build of G.726 codec wrapper with older versions of SpanDSP.

git-svn-id: 5274dacc98e2a95d0b0452670772bfdffe61ca90@10190 a612230a-c5fa-0310-af8b-88eea846685b


////////////////////////////////////////////////////////////////////////////////
//
//  TYPHOON FRAMEWORK
//  Copyright 2013, Typhoon Framework Contributors
//  All Rights Reserved.
//
//  NOTICE: The authors permit you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>
#import "TyphoonMethodSwizzler.h"

@class TyphoonAssembly;

@interface TyphoonAssemblyAdviser : NSObject

+ (BOOL)assemblyClassIsAdvised:(Class)class;

- (id)initWithAssembly:(TyphoonAssembly *)assembly;

- (void)adviseAssembly;

- (NSSet *)definitionSelectors;

- (NSDictionary *)assemblyClassPerDefinitionKey;

@property(readonly, weak) TyphoonAssembly *assembly;
@property(nonatomic, strong) id <TyphoonMethodSwizzler> swizzler;

@end

////////////////////////////////////////////////////////////////////////////////
//
//  TYPHOON FRAMEWORK
//  Copyright 2013, Typhoon Framework Contributors
//  All Rights Reserved.
//
//  NOTICE: The authors permit you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>
#import "TyphoonMethodSwizzler.h"

@class TyphoonAssembly;

@interface TyphoonAssemblyAdviser : NSObject

+ (BOOL)assemblyClassIsAdvised:(Class)klass;

- (id)initWithAssembly:(TyphoonAssembly *)assembly;

- (void)adviseAssembly;

- (NSSet *)definitionSelectors;

- (NSDictionary *)assemblyClassPerDefinitionKey;

@property(readonly, weak) TyphoonAssembly *assembly;
@property(nonatomic, strong) id <TyphoonMethodSwizzler> swizzler;

@end

Remove use of reserved keyboard in public header


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

int is_multiple_of_three(int n) {
	int odd_bits_cnt = 0;
	int even_bits_cnt = 0;

	if (n < 0) n = -n;
	if (n == 0) return 1;
	if (n == 1) return 0;

	while (n) {
		if (n & 0x1) {
			odd_bits_cnt++;
		}

		n >>= 1;

		if (n & 0x1) {
			even_bits_cnt++;
		}

		n >>= 1;
	}

	return is_multiple_of_three(abs(odd_bits_cnt - even_bits_cnt));
}

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

	printf("Enter a number to test is it multiple of 3: ");
	int n = 0;
	scanf("%d", &n);
	printf(is_multiple_of_three(n) ? "true\n" : "false\n");

	return 0;
}

Add function that checks if a given number is multiple of three.


/*
  Ruby/SDL   Ruby extension library for SDL

  Copyright (C) 2001-2007 Ohbayashi Ippei

  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
  */
#include "rubysdl.h"

static VALUE sdl_getTicks(VALUE mod)
{
  return UINT2NUM(SDL_GetTicks());
}

static VALUE delay(void* t)
{
  SDL_Delay(*((Uint32*)t));
  return Qnil;
}

static VALUE sdl_delay(VALUE mod,VALUE ms)
{
  Uint32 t = NUM2UINT(ms);
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
  rb_thread_blocking_region(delay, &t, RUBY_UBF_IO, NULL);
#else
  SDL_Delay(t);
#endif
  return Qnil;
}

void rubysdl_init_time(VALUE mSDL)
{
  rb_define_module_function(mSDL,"getTicks",sdl_getTicks,0);
  rb_define_module_function(mSDL,"delay",sdl_delay,1);
}

/*
  Ruby/SDL   Ruby extension library for SDL

  Copyright (C) 2001-2007 Ohbayashi Ippei

  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
  */
#include "rubysdl.h"

static VALUE sdl_getTicks(VALUE mod)
{
  return UINT2NUM(SDL_GetTicks());
}

static VALUE sdl_delay(VALUE mod,VALUE ms)
{
  Uint32 t = NUM2UINT(ms);
  SDL_Delay(t);
  return Qnil;
}

void rubysdl_init_time(VALUE mSDL)
{
  rb_define_module_function(mSDL,"getTicks",sdl_getTicks,0);
  rb_define_module_function(mSDL,"delay",sdl_delay,1);
}

Remove rb_thread_blocking_region when SDL_Delay is called.

This means that SDL.delay stops all of Ruby threads now.


// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s
// rdar://10033986

typedef void (^BLOCK)(void);
int main ()
{
    _Complex double c;
    BLOCK b =  ^() {
      _Complex double z;
      z = z + c;
    };
    b();
}

// CHECK: define internal void @__main_block_invoke_0
// CHECK:  [[C1:%.*]] = alloca { double, double }, align 8
// CHECK:  [[C1]].realp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0
// CHECK-NEXT:  [[C1]].real = load double* [[C1]].realp
// CHECK-NEXT:  [[C1]].imagp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1
// CHECK-NEXT:  [[C1]].imag = load double* [[C1]].imagp

// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s
// rdar://10033986

typedef void (^BLOCK)(void);
int main ()
{
    _Complex double c;
    BLOCK b =  ^() {
      _Complex double z;
      z = z + c;
    };
    b();
}

// CHECK: define internal void @__main_block_invoke_0
// CHECK:  [[C1:%.*]] = alloca { double, double }, align 8
// CHECK:  [[RP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0
// CHECK-NEXT:  [[R:%.*]] = load double* [[RP]]
// CHECK-NEXT:  [[IP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1
// CHECK-NEXT:  [[I:%.*]] = load double* [[IP]]

Revise test and see if it passes with a release-built clang.

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


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 53
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 54
#endif

Update skia milestone to next

Update skia milestone to next

No API changes, just moving version fwd.

TBR=reed@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2115573002

Review-Url: https://codereview.chromium.org/2115573002