//
//  MZFormSheetPresentationControllerFramework.h
//  MZFormSheetPresentationControllerFramework
//

#import <UIKit/UIKit.h>

//! Project version number for MZFormSheetPresentation.
FOUNDATION_EXPORT double MZFormSheetPresentationControllerVersionNumber;

//! Project version string for MZFormSheetPresentation.
FOUNDATION_EXPORT const unsigned char MZFormSheetPresentationControllerVersionString[];

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

#import <MZFormSheetPresentationController/MZFormSheetPresentationController.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewController.h>

#import <MZFormSheetPresentationController/MZTransition.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewControllerAnimator.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewControllerAnimatedTransitioning.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewControllerInteractiveAnimator.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewControllerInteractiveTransitioning.h>

#import <MZFormSheetPresentationController/MZFormSheetPresentationContentSizing.h>
#import <MZFormSheetPresentationController/MZFormSheetPresentationViewControllerSegue.h>

#import <MZFormSheetPresentationController/MZBlurEffectAdapter.h>

Add MZBlurEffectAdapter.h to umbrella header


#import <Foundation/Foundation.h>

@interface StatsGroup : NSObject

@property (nonatomic, strong)   NSArray *items; // StatsItem
@property (nonatomic, assign)   BOOL moreItemsExist;
@property (nonatomic, copy)     NSString *titlePrimary;
@property (nonatomic, copy)     NSString *titleSecondary;
@property (nonatomic, strong)   NSURL *iconUrl;

@end

#import <Foundation/Foundation.h>

@interface StatsGroup : NSObject

@property (nonatomic, strong)   NSArray *items; // StatsItem
@property (nonatomic, copy)     NSString *titlePrimary;
@property (nonatomic, copy)     NSString *titleSecondary;
@property (nonatomic, strong)   NSURL *iconUrl;

@end

Revert "Added moreItems boolean to data model for a group"

This reverts commit ddbdfa290670584080d841244b53d6d3ede11de3.


/* mbedtls_config.h wrapper that forces calloc(0) to return NULL.
 * Used for testing.
 */
/*
 *  Copyright The Mbed TLS Contributors
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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 "mbedtls/mbedtls_config.h"

#include <stdlib.h>
static inline void *custom_calloc( size_t nmemb, size_t size )
{
    if( nmemb == 0 || size == 0 )
        return( NULL );
    return( calloc( nmemb, size ) );
}

#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc

/* mbedtls_config.h wrapper that forces calloc(0) to return NULL.
 * Used for testing.
 */
/*
 *  Copyright The Mbed TLS Contributors
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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 "mbedtls/mbedtls_config.h"

#include <stdlib.h>

#ifndef MBEDTLS_PLATFORM_STD_CALLOC
static inline void *custom_calloc( size_t nmemb, size_t size )
{
    if( nmemb == 0 || size == 0 )
        return( NULL );
    return( calloc( nmemb, size ) );
}

#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
#endif

Add header guard around malloc(0) returning NULL implementation

Make it safe to import the config multiple times without having
multiple definition errors.

(This prevents errors in the fuzzers in a later patch.)

Signed-off-by: Daniel Axtens <cf1af486034ab0119a20f38a060e40da25f4cea3@axtens.net>


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

#include "content/common/content_export.h"

namespace content {

class NotificationDetails;
class NotificationSource;

// This is the base class for notification observers. When a matching
// notification is posted to the notification service, Observe is called.
class CONTENT_EXPORT NotificationObserver {
 public:
  virtual void Observe(int type,
                       const NotificationSource& source,
                       const NotificationDetails& details) = 0;

 protected:
  NotificationObserver() {}
  virtual ~NotificationObserver() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_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 CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#pragma once

#include "content/common/content_export.h"

namespace content {

class NotificationDetails;
class NotificationSource;

// This is the base class for notification observers. When a matching
// notification is posted to the notification service, Observe is called.
class CONTENT_EXPORT NotificationObserver {
 public:
  virtual void Observe(int type,
                       const NotificationSource& source,
                       const NotificationDetails& details) = 0;

 protected:
  virtual ~NotificationObserver() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_

content: Remove unnecessary constructor from NotificationObserver.

BUG=98716
R=jam@chromium.org

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

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


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

#define URL "https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505\
(v=vs.85).aspx"
#define VERSION "0.1.0"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine,
                   int nShowCmd)
{
    LPWSTR *szArgList;
    int argCount;

    szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
    if (szArgList == NULL) {
        fprintf(stderr, "Unable to parse the command line.\n");
        return 255;
    }
    if (argCount < 3 || argCount > 4) {
        fprintf(stderr, "Batch MessageBox v" VERSION "\n");
        fprintf(stderr, "Usage: %ls message title [type]\n\n", szArgList[0]);

        fprintf(stderr, "Calls MessageBoxW() with the given arguments. See\n"
                        URL "\nfor the possible values of \"type\". "
                        "ERRORLEVEL is the return value or 255 on\nerror.\n");
        return 255;
    }
    /* Ignore _wtoi errors. */
    int type = _wtoi(szArgList[3]);
    int button = MessageBoxW(NULL, szArgList[1], szArgList[2], type);
    LocalFree(szArgList);
    return button;
}

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

#define URL "https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505\
(v=vs.85).aspx"
#define VERSION "0.1.0"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine,
                   int nCmdShow)
{
    LPWSTR *szArgList;
    int argCount;

    szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
    if (szArgList == NULL) {
        fprintf(stderr, "Unable to parse the command line.\n");
        return 255;
    }
    if (argCount < 3 || argCount > 4) {
        fprintf(stderr, "Batch MessageBox v" VERSION "\n");
        fprintf(stderr, "Usage: %ls message title [type]\n\n", szArgList[0]);

        fprintf(stderr, "Calls MessageBoxW() with the given arguments. See\n"
                        URL "\nfor the possible values of \"type\". "
                        "ERRORLEVEL is the return value or 255 on\nerror.\n");
        return 255;
    }
    /* Ignore _wtoi errors. */
    int type = _wtoi(szArgList[3]);
    int button = MessageBoxW(NULL, szArgList[1], szArgList[2], type);
    LocalFree(szArgList);
    return button;
}

Rename WinMain argument nShowCmd "nCmdShow"


/*
 * Challenger 1P Hello World Program for cc65.
 */

#include <conio.h>

#define VIDEO_RAM_START ((char *) 0xd000)

int main()
{
    static const char hello_world[] = "Hello world!";

    int scrpos;
    const char *cp;

    clrscr();

    for (cp = hello_world, scrpos = 0x083; *cp; scrpos += 1, cp += 1)
    {
        *(VIDEO_RAM_START + scrpos) = *cp;
    }

    while (1)
    {
        char c = cgetc();
        *(VIDEO_RAM_START + scrpos++) = c;
    }

    return 0;
}

/*
 * Challenger 1P Hello World Program for cc65.
 */

#include <conio.h>

#define VIDEO_RAM_START ((char *) 0xd000)

int main()
{
    static const char hello_world[] = "Hello world!\n";

    const char *cp;
    unsigned int i;

    clrscr();

    for (cp = hello_world; *cp; cp += 1)
    {
        cputc(*cp);
    }

    for (i = 0; i < 256; i += 1) {
        cputc((unsigned char ) i);
    }

    cputc(' ');
    cputc((char) wherex());

    while (1)
    {
        char c = cgetc();
        cputc(c);
    }

    return 0;
}

Replace direct video memory access with cputc() for character output.


/**
https://www.urionlinejudge.com.br/judge/en/problems/view/1160

TODO:
		Test this conjecture:
		Since f(x) is the number of inhabitants as a function of x years, such f is a function defined in natural numbers.
		Then f(x) = rx/100 + s, such that r and s are real (floating) constants,
		where r is the growing hate percentual (0<=r<=100)
		and s is the initial population in this experiment.

TODO2
		Test this conjecture:
		This loop can be turned into a recurrency relation (ie, a recursive function)

TODO3
		Test this conjecture:
		If TODO2 returns True, then this recurrency relation can be turned into a closed form (ie, a regular function).
*/

#include <stdio.h>

int main(){

	int testsQtt;

	int aPopulation, bPopulation;
	double aPercentualGrowing, bPercentualGrowing;

	scanf("%d", &testsQtt);

	char results[testsQtt];

	int i, years;
	for (i = 0; i < testsQtt; i++){

		scanf("%d %d %lf %lf", &aPopulation, &bPopulation, &aPercentualGrowing, &bPercentualGrowing);

		years = 0;
		while(aPopulation <= bPopulation){
			years++;

			if (years > 100){
				break;
			}

			aPopulation += (int) (aPopulation*aPercentualGrowing/100);
			bPopulation += (int) (bPopulation*bPercentualGrowing/100);
		}

		results[i] = years;
	}

	for (i = 0; i < testsQtt; i++){
		if (results[i] > 100){
			printf("Mais de 1 seculo.\n");
		} else{
			printf("%d anos.\n", results[i]);
		}
	}

    return 0;
}

Add 1160 solution, but it can be improved!


#include <stdio.h>

typedef struct {
    int *x;
    int **y;
} inner ;

typedef struct {
    int *g;
    inner in[3];
} outer;

int *ep;

int main(int argc, char *argv[])
{
    outer o;
    int z = 5;
    int zzz;

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

    ep = &z;

    o.in[2].x = ep;

    *o.in[2].x = 3;
    printf("%d\n" , z);

    inner i;
    i.x = &zzz;
    o.in[1] = i;

    int **ptr = &o.in[0].x;
    int *p = *ptr;
    /* outer oo[4]; */

    /* oo[2].in[2].y = &ep; */
    return 0;
}

#include <stdio.h>

typedef struct {
    int *x;
    int **y;
} inner ;

typedef struct {
    int *g;
    inner in[3];
} outer;

int *ep;

int main(int argc, char *argv[])
{
    outer o;
    int z = 5;
    int zzz;

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

    ep = &z;

    o.in[2].x = ep;

    *(o.in[2].x) = 3;
    printf("%d\n" , z);

    inner i;
    i.x = &zzz;
    o.in[1] = i;

    int **ptr = &(o.in[0].x);
    int *p = *ptr;
    /* outer oo[4]; */

    /* oo[2].in[2].y = &ep; */
    return 0;
}

Add parentheses to make example clearer.


//
//  GrowlBezelWindowView.h
//  Display Plugins
//
//  Created by Jorge Salvador Caffarena on 09/09/04.
//  Copyright 2004 Jorge Salvador Caffarena. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "GrowlNotificationView.h"

@interface GrowlBezelWindowView : GrowlNotificationView {
	NSImage			*icon;
	NSString		*title;
	NSString		*text;
	SEL				action;
	id				target;

	NSColor			*textColor;
	NSColor			*backgroundColor;
	NSLayoutManager	*layoutManager;
}

- (void) setIcon:(NSImage *)icon;
- (void) setTitle:(NSString *)title;
- (void) setText:(NSString *)text;
- (void) setPriority:(int)priority;

- (float) descriptionHeight:(NSString *)text attributes:(NSDictionary *)attributes width:(float)width;

- (id) target;
- (void) setTarget:(id)object;

- (SEL) action;
- (void) setAction:(SEL)selector;

@end

//
//  GrowlBezelWindowView.h
//  Display Plugins
//
//  Created by Jorge Salvador Caffarena on 09/09/04.
//  Copyright 2004 Jorge Salvador Caffarena. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "GrowlNotificationView.h"

@interface GrowlBezelWindowView : GrowlNotificationView {
	NSImage			*icon;
	NSString		*title;
	NSString		*text;

	NSColor			*textColor;
	NSColor			*backgroundColor;
	NSLayoutManager	*layoutManager;
}

- (void) setIcon:(NSImage *)icon;
- (void) setTitle:(NSString *)title;
- (void) setText:(NSString *)text;
- (void) setPriority:(int)priority;

- (float) descriptionHeight:(NSString *)text attributes:(NSDictionary *)attributes width:(float)width;

- (id) target;
- (void) setTarget:(id)object;

- (SEL) action;
- (void) setAction:(SEL)selector;

@end

Remove duplicate members so this compiles again


#include <stdio.h>
#include <stdlib.h>
/* Linked List Implementation in C */
// This program aims at "Revering the Link List"

typedef struct node{
	int data;
	struct node *link;
} node;

node* head; //global variable

void insert_append(int x){
node* temp;
temp = (node*)malloc(sizeof(node));

temp->data = x;
temp->link=NULL;

if(head!=NULL){
	node* temp_travel;
	temp_travel =head;
	while(temp_travel->link != NULL){
		temp_travel = temp_travel->link;
	}
	temp_travel->link = temp;

	return;
}
head =temp;
return;

}

void reverse(){

node* prev;
prev = NULL;
node* current;
current=head;

node* next;

while(current!= NULL){

next=current->link;
current->link = prev;
prev = current;
current=next;

}

head=prev;

return;
}

void print(){
	node* temp = head;
	printf("list is:");
	while(temp!= NULL){
		printf(" %d",temp->data);
		temp = temp->link;
	}
	printf("\n");
}

int main(){
	head = NULL; //empty list

	insert_append(1); //list is: 1
	insert_append(2); //list is: 1 2
	insert_append(3); //list is: 1 2 3
	insert_append(4); //list is: 1 2 3 4
	insert_append(5); //list is: 1 2 3 4 5

	print();

	reverse(); //list is : 5 4 3 2 1

	print();
	return 0;
}

Add Link List Recusrive Print and reverse print


/*
 * filter registration
 * copyright (c) 2008 Vitor Sessak
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg 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.
 *
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include "avfilter.h"

#define REGISTER_VF(X,x) { \
          extern AVFilter avfilter_vf_##x ; \
          if(ENABLE_VF_##X )  avfilter_register(&avfilter_vf_##x ); }

#define REGISTER_VSRC(X,x) { \
          extern AVFilter avfilter_vsrc_##x ; \
          if(ENABLE_VSRC_##X )  avfilter_register(&avfilter_vsrc_##x ); }

void avfilter_register_all(void)
{
    static int initialized;

    if (initialized)
        return;
    initialized = 1;

//    REGISTER_VF(CROP,crop);

}

Add last file of main filter framework

Add last file of main filter framework

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@12076 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


#include <spotify/api.h>

#include "debug.h"
#include "sp_opaque.h"

SP_LIBEXPORT(const char *) sp_user_canonical_name(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented");

	return "not-yet-implemented";
}

SP_LIBEXPORT(const char *) sp_user_display_name(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented");

	return "not-yet-implemented";
}

SP_LIBEXPORT(bool) sp_user_is_loaded(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented");

	return 0;
}

#include <spotify/api.h>

#include "debug.h"
#include "sp_opaque.h"

SP_LIBEXPORT(const char *) sp_user_canonical_name(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented\n");

	return "not-yet-implemented";
}

SP_LIBEXPORT(const char *) sp_user_display_name(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented\n");

	return "not-yet-implemented";
}

SP_LIBEXPORT(bool) sp_user_is_loaded(sp_user *user) {
	DSFYDEBUG("FIXME: Not yet implemented\n");

	return 0;
}

Add missing newlines to DSFYDEBUG() calls


#ifndef KERN_CONFIG
#define KERN_CONFIG

#define NUM_STACK_PAGES 2
#define MAX_AMOUNT_OF_CONTEXTS 32

#define NUM_FDS 32

// The trampoline must be mapped at the same vaddr for both the kernel and
// the userspace processes. The page is mapped to the last VPN slot available
// Sv39 has 39bit adresses: 2^39 - PAGESIZE = 0x80'0000'0000 - 0x100 = 0x80'0000'0000
// It will be mapped twice in the kernel address space
#define TRAMPOLINE_VADDR 0x7FFFFFFF00

// The top-most stack address for a user process. As the stack grows downwards, it's best to place it after the trap trampoline to prevent collisions.
// As specified by the RISC-V ELF psABI (https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md),
// we use a descending full stack, i.e. sp points to the last pushed element in the stack
// Thus, USERSPACE_STACK_START shall be positioned one above the actual first stack slot.
#define USERSPACE_STACK_START TRAMPOLINE_VADDR

#endif

#ifndef KERN_CONFIG
#define KERN_CONFIG

#define NUM_STACK_PAGES 2
#define MAX_AMOUNT_OF_CONTEXTS 32

#define NUM_FDS 32

// The trampoline must be mapped at the same vaddr for both the kernel and
// the userspace processes. The page is mapped to the last VPN slot available
// Sv39 has 39bit adresses: 2^39 - PAGESIZE = 0x80'0000'0000 - 0x100 = 0x7F'FFFF'F000
// According to the Sv39 documentation, the vaddr "must have bits 63–39 all equal to bit 38, or else a page-fault
// exception will occur", thus the actual vaddr is 0xFFFF'FFFF'FFFF'F000
// It will be mapped twice in the kernel address space
#define TRAMPOLINE_VADDR 0xFFFFFFFFFFFFF000

// The top-most stack address for a user process. As the stack grows downwards, it's best to place it after the trap trampoline to prevent collisions.
// As specified by the RISC-V ELF psABI (https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md),
// we use a descending full stack, i.e. sp points to the last pushed element in the stack
// Thus, USERSPACE_STACK_START shall be positioned one above the actual first stack slot.
#define USERSPACE_STACK_START TRAMPOLINE_VADDR

#endif

Fix trap trampoline virtual address

Fix trap trampoline virtual address [skip ci]

We want to map the trap trampoline to the highest possible virtual
address, i.e. the last PTE possible. However, Sv39 specifies that bits
39-63 must reflect bit 38's state lest the CPU raises a page fault.


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

#ifndef ELANG_BASE_ZONE_VECTOR_H_
#define ELANG_BASE_ZONE_VECTOR_H_

#include <vector>

#include "elang/base/zone.h"
#include "elang/base/zone_allocator.h"

namespace elang {

//////////////////////////////////////////////////////////////////////
//
// ZoneVector
// A wrapper subclass for |std::vector|.
//
template <typename T>
class ZoneVector : public std::vector<T, ZoneAllocator<T>> {
 public:
  explicit ZoneVector(Zone* zone)
      : std::vector<T, ZoneAllocator<T>>(ZoneAllocator<T>(zone)) {}

  ZoneVector(Zone* zone, size_t size, value_type& val = value_type())
      : std::vector<T, ZoneAllocator<T>>(size, val, ZoneAllocator<T>(zone)) {}

  ZoneVector(Zone* zone, const std::vector<T>& other)
      : std::vector<T, ZoneAllocator<T>>(other.begin(),
                                         other.end(),
                                         ZoneAllocator<T>(zone)) {}
};

}  // namespace elang

#endif  // ELANG_BASE_ZONE_VECTOR_H_

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

#ifndef ELANG_BASE_ZONE_VECTOR_H_
#define ELANG_BASE_ZONE_VECTOR_H_

#include <vector>

#include "elang/base/zone.h"
#include "elang/base/zone_allocator.h"

namespace elang {

//////////////////////////////////////////////////////////////////////
//
// ZoneVector
// A wrapper subclass for |std::vector|.
//
template <typename T>
class ZoneVector : public std::vector<T, ZoneAllocator<T>> {
 public:
  explicit ZoneVector(Zone* zone)
      : std::vector<T, ZoneAllocator<T>>(ZoneAllocator<T>(zone)) {}

  ZoneVector(Zone* zone, size_t size, const value_type& val = value_type())
      : std::vector<T, ZoneAllocator<T>>(size, val, ZoneAllocator<T>(zone)) {}

  ZoneVector(Zone* zone, const std::vector<T>& other)
      : std::vector<T, ZoneAllocator<T>>(other.begin(),
                                         other.end(),
                                         ZoneAllocator<T>(zone)) {}
};

}  // namespace elang

#endif  // ELANG_BASE_ZONE_VECTOR_H_

elang/base: Make |ZoneVector| constructor to take const reference.


#include <time.h>

#include "clock.h"

#include "clock_type.h"

extern int clock_init(struct Clock **clockp, struct Allocator *allocator)
{
        struct timespec res;

        if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
                /* unknown clock or insufficient resolution */
                return -1;
        }

        return clock_init_base(clockp, allocator, 1, 1000);
}

extern uint64_t clock_ticks(struct Clock const *const clock)
{
        struct timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);

        (void)clock;

        return ts.tv_sec * 1000000000LL + ts.tv_nsec;
}

#include <time.h>

#include "clock.h"

#include "clock_type.h"

extern int clock_init(struct SPDR_Clock **clockp, struct SPDR_Allocator *allocator)
{
        struct timespec res;

        if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
                /* unknown clock or insufficient resolution */
                return -1;
        }

        return clock_init_base(clockp, allocator, 1, 1000);
}

extern uint64_t clock_ticks(struct SPDR_Clock const *const clock)
{
        struct timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);

        (void)clock;

        return ts.tv_sec * 1000000000LL + ts.tv_nsec;
}

Fix compilation on posix platforms

Fix compilation on posix platforms


#include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */

/* Initially we put data to stdout. */
int cur_out = 1;

/* Put data to current output. */
void putd(const char *data, unsigned long len)
	{
	(void)write(cur_out,data,len);
	}

void put(const char *data)
	{
	putd(data, strlen(data));
	}

void put_ch(char ch)
	{
	char buf[1];
	buf[0] = ch;
	putd(buf,1);
	}

void put_long(long x)
	{
	put(format_long(x));
	}

void put_ulong(unsigned long x)
	{
	put(format_ulong(x));
	}

void put_double(double x)
	{
	put(format_double(x));
	}

void nl(void)
	{
	putd("\n",1);
	}

void set_output(int fd)
	{
	fsync(cur_out);
	cur_out = fd;
	}

void put_to_error(void)
	{
	set_output(2);
	}

#include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */

/* Initially we put data to stdout. */
int cur_out = 1;

/* Put data to current output. */
void putd(const char *data, unsigned long len)
	{
	ssize_t n = write(cur_out,data,len);
	(void)n;
	}

void put(const char *data)
	{
	putd(data, strlen(data));
	}

void put_ch(char ch)
	{
	char buf[1];
	buf[0] = ch;
	putd(buf,1);
	}

void put_long(long x)
	{
	put(format_long(x));
	}

void put_ulong(unsigned long x)
	{
	put(format_ulong(x));
	}

void put_double(double x)
	{
	put(format_double(x));
	}

void nl(void)
	{
	putd("\n",1);
	}

void set_output(int fd)
	{
	fsync(cur_out);
	cur_out = fd;
	}

void put_to_error(void)
	{
	set_output(2);
	}

Work around incompatibility of warn_unused_result on one machine.

On one machine, the call to "write" in output.c gave this compiler error:
ignoring return value of ‘write’, declared with attribute warn_unused_result

To work around that, the code now grabs the return value and ignores it with
(void).


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

#pragma once

namespace vespalib::eval {

inline double hamming_distance(double a, double b) {
    uint8_t x = (uint8_t) a;
    uint8_t y = (uint8_t) b;
    return __builtin_popcount(x ^ y);
}

}

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

#pragma once

namespace vespalib::eval {

inline double hamming_distance(double a, double b) {
    uint8_t x = (uint8_t) (int8_t) a;
    uint8_t y = (uint8_t) (int8_t) b;
    return __builtin_popcount(x ^ y);
}

}

Convert from double to signed data type for reference hamming distance.


/* File:			connection.h
 *
 * Description:		See "md.h"
 *
 * Comments:		See "notice.txt" for copyright and license information.
 *
 */

#ifndef __MD5_H__
#define __MD5_H__

#include "psqlodbc.h"

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

#ifdef	WIN32
#define	MD5_ODBC
#define	FRONTEND
#endif
#define MD5_PASSWD_LEN	35

/* From c.h */
#ifndef __BEOS__

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true	((bool) 1)
#endif

#ifndef false
#define false	((bool) 0)
#endif
#endif   /* not C++ */
#endif   /* __BEOS__ */

/* Also defined in include/c.h */
#if SIZEOF_UINT8 == 0
typedef unsigned char uint8;	/* == 8 bits */
typedef unsigned short uint16;	/* == 16 bits */
typedef unsigned int uint32;	/* == 32 bits */
#endif   /* SIZEOF_UINT8 == 0 */

extern bool md5_hash(const void *buff, size_t len, char *hexsum);
extern bool EncryptMD5(const char *passwd, const char *salt,
		   size_t salt_len, char *buf);

#endif

/* File:			md5.h
 *
 * Description:		See "md5.c"
 *
 * Comments:		See "notice.txt" for copyright and license information.
 *
 */

#ifndef __MD5_H__
#define __MD5_H__

#include "psqlodbc.h"

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

#ifdef	WIN32
#define	MD5_ODBC
#define	FRONTEND
#endif
#define MD5_PASSWD_LEN	35

/* From c.h */
#ifndef __BEOS__

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true	((bool) 1)
#endif

#ifndef false
#define false	((bool) 0)
#endif
#endif   /* not C++ */
#endif   /* __BEOS__ */

/* Also defined in include/c.h */
#if SIZEOF_UINT8 == 0
typedef unsigned char uint8;	/* == 8 bits */
typedef unsigned short uint16;	/* == 16 bits */
typedef unsigned int uint32;	/* == 32 bits */
#endif   /* SIZEOF_UINT8 == 0 */

extern bool md5_hash(const void *buff, size_t len, char *hexsum);
extern bool EncryptMD5(const char *passwd, const char *salt,
		   size_t salt_len, char *buf);

#endif

Fix comment at top of file to match file name.


#pragma once

#include <memory>

#include <cstdio> // fopen, fclose

#include <openssl/evp.h>
#include <openssl/ec.h>

namespace JWTXX
{
namespace Utils
{

struct FileCloser
{
    void operator()(FILE* fp) { fclose(fp); }
};
typedef std::unique_ptr<FILE, FileCloser> FilePtr;

struct EVPKeyDeleter
{
    void operator()(EVP_PKEY* key) { EVP_PKEY_free(key); }
};
typedef std::unique_ptr<EVP_PKEY, EVPKeyDeleter> EVPKeyPtr;

struct EVPMDCTXDeleter
{
    void operator()(EVP_MD_CTX* ctx) { EVP_MD_CTX_destroy(ctx); }
};
typedef std::unique_ptr<EVP_MD_CTX, EVPMDCTXDeleter> EVPMDCTXPtr;

EVPKeyPtr readPEMPrivateKey(const std::string& fileName);
EVPKeyPtr readPEMPublicKey(const std::string& fileName);

std::string OPENSSLError();

}
}

#pragma once

#include <memory>

#include <cstdio> // fopen, fclose

#include <openssl/evp.h>
#include <openssl/ec.h>

namespace JWTXX
{
namespace Utils
{

struct EVPKeyDeleter
{
    void operator()(EVP_PKEY* key) { EVP_PKEY_free(key); }
};
typedef std::unique_ptr<EVP_PKEY, EVPKeyDeleter> EVPKeyPtr;

struct EVPMDCTXDeleter
{
    void operator()(EVP_MD_CTX* ctx) { EVP_MD_CTX_destroy(ctx); }
};
typedef std::unique_ptr<EVP_MD_CTX, EVPMDCTXDeleter> EVPMDCTXPtr;

EVPKeyPtr readPEMPrivateKey(const std::string& fileName);
EVPKeyPtr readPEMPublicKey(const std::string& fileName);

std::string OPENSSLError();

}
}

Move file closer out from public.

Move file closer out from public.


#include "bst.h"

static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);

struct BSTNode
{
	BSTNode* left;
	BSTNode* right;
	BSTNode* p;
	void* k;
};

struct BST
{
	BSTNode* root;
};

BST* BST_Create(void)
{
	BST* T = (BST* )malloc(sizeof(BST));
	T->root = NULL;
	return T;
}

Add BST Create function implementation

Add BST Create function implementation


// Make sure AddressSanitizer disables _FORTIFY_SOURCE on Darwin.

// REQUIRES: system-darwin
// RUN: %clang -faddress-sanitizer %s -E -dM -o - | FileCheck %s
// CHECK: #define _FORTIFY_SOURCE 0

// Make sure AddressSanitizer disables _FORTIFY_SOURCE on Darwin.

// RUN: %clang -faddress-sanitizer %s -E -dM -target x86_64-darwin - | FileCheck %s

// CHECK: #define _FORTIFY_SOURCE 0

Use an explicit target to test that source fortification is off when building for Darwin with -faddress-sanitizer.

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


#ifndef SYMBOLICMATHNODE_H
#define SYMBOLICMATHNODE_H

#include <vector>

#include "SymbolicMathNode.h"

namespace SymbolicMath
{

// clang-format off
Node abs(Node a) { return Node(UnaryFunctionType::ABS, a); }
Node acos(Node a) { return Node(UnaryFunctionType::ACOS, a); }
Node acosh(Node a) { return Node(UnaryFunctionType::ACOSH, a); }
Node asin(Node a) { return Node(UnaryFunctionType::ASIN, a); }
Node asinh(Node a) { return Node(UnaryFunctionType::ASINH, a); }
Node atan(Node a) { return Node(UnaryFunctionType::ATAN, a); }
Node atanh(Node a) { return Node(UnaryFunctionType::ATANH, a); }
Node ceil(Node a) { return Node(UnaryFunctionType::CEIL, a); }
Node cos(Node a) { return Node(UnaryFunctionType::COS, a); }
Node cosh(Node a) { return Node(UnaryFunctionType::COSH, a); }
Node cot(Node a) { return Node(UnaryFunctionType::COT, a); }
Node csc(Node a) { return Node(UnaryFunctionType::CSC, a); }
Node erf(Node a) { return Node(UnaryFunctionType::ERF, a); }
Node exp(Node a) { return Node(UnaryFunctionType::EXP, a); }
Node exp2(Node a) { return Node(UnaryFunctionType::EXP2, a); }
Node floor(Node a) { return Node(UnaryFunctionType::FLOOR, a); }
Node log(Node a) { return Node(UnaryFunctionType::LOG, a); }
Node log2(Node a) { return Node(UnaryFunctionType::LOG2, a); }
Node sec(Node a) { return Node(UnaryFunctionType::SEC, a); }
Node sin(Node a) { return Node(UnaryFunctionType::SIN, a); }
Node sinh(Node a) { return Node(UnaryFunctionType::SINH, a); }
Node tan(Node a) { return Node(UnaryFunctionType::TAN, a); }
Node tanh(Node a) { return Node(UnaryFunctionType::TANH, a); }
// clang-format on

// clang-format off
Node atan2(Node a, Node b) { return Node(BinaryFunctionType::ATAN2, a, b); }
Node max(Node a, Node b) { return Node(BinaryFunctionType::MAX, a, b); }
Node min(Node a, Node b) { return Node(BinaryFunctionType::MIN, a, b); }
Node plog(Node a, Node b) { return Node(BinaryFunctionType::PLOG, a, b); }
Node pow(Node a, Node b) { return Node(BinaryFunctionType::POW, a, b); }
// clang-format on

Node
conditional(Node a, Node b, Node c)
{
  return Node(ConditionalType::IF, a, b, c);
}

// end namespace SymbolicMath
}

Add functions to build SM trees

Add functions to build SM trees


/* -*- mode:linux -*- */
/**
 * \file timeout.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-12-16
 */

#define _POSIX_C_SOURCE 200112L

void timeout(unsigned int sec);

/* -*- mode:linux -*- */
/**
 * \file timeout.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-12-16
 */

void timeout(unsigned int sec);

Remove the _POSIX_C_SOURCE def that the sparc doesn't like


/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*     Copyright 2015 Couchbase, Inc
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/

/*
 * memcached binary protocol packet validators
 */
#pragma once

#include <memcached/protocol_binary.h>

#ifdef __cplusplus
extern "C" {
#endif

    typedef protocol_binary_response_status (*mcbp_package_validate)(void *packet);

    /**
     * Get the memcached binary protocol validators
     *
     * @return the array of 0x100 entries for the package
     *         validators
     */
    mcbp_package_validate *get_mcbp_validators(void);

#ifdef __cplusplus
}
#endif

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*     Copyright 2015 Couchbase, Inc
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/

/*
 * memcached binary protocol packet validators
 */
#pragma once

#include <memcached/protocol_binary.h>

typedef protocol_binary_response_status (*mcbp_package_validate)(void *packet);

/**
 * Get the memcached binary protocol validators
 *
 * @return the array of 0x100 entries for the package
 *         validators
 */
mcbp_package_validate *get_mcbp_validators(void);

Drop C linkage for message validators

Drop C linkage for message validators

Change-Id: I5a95a6ddd361ee2009ea399479a7df51733af709
Reviewed-on: http://review.couchbase.org/54979
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>


@import Foundation;

@interface NSObject (DPLJSONObject)

/**
 Returns a JSON compatible version of the receiver.

 @discussion

 - NSDictionary and NSArray will call `DPLJSONObject' on all of their items.
 - Objects in an NSDictionary not keyed by an NSString will be removed.
 - NSNumbers that are NaN or Inf will be represented by a string.
 - NSDate objects will be represented as `timeIntervalSinceReferenceDate'.
 - JSON incompatible objects will return their description.
 - All NSNulls will be removed because who wants an NSNull.

 @see NSJSONSerialization
 */
- (id)DPL_JSONObject;

@end

Fix warning 'Empty paragraph passed to '@discussion' command'


/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2000-2003 University of Utah and the Flux Group.
 * All rights reserved.
 */

#define TBSERVER_PORT		7777
#define TBSERVER_PORT2		14447
#define MYBUFSIZE		2048
#define BOSSNODE_FILENAME	"bossnode"

/*
 * As the tmcd changes, incompatable changes with older version of
 * the software cause problems. Starting with version 3, the client
 * will tell tmcd what version they are. If no version is included,
 * assume its DEFAULT_VERSION.
 *
 * Be sure to update the versions as the TMCD changes. Both the
 * tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
 * install new versions of each binary when the current version
 * changes. libsetup.pm module also encodes a current version, so be
 * sure to change it there too!
 *
 * Note, this is assumed to be an integer. No need for 3.23.479 ...
 * NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
 */
#define DEFAULT_VERSION		2
#define CURRENT_VERSION		8

/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2000-2003 University of Utah and the Flux Group.
 * All rights reserved.
 */

#define TBSERVER_PORT		7777
#define TBSERVER_PORT2		14447
#define MYBUFSIZE		2048
#define BOSSNODE_FILENAME	"bossnode"

/*
 * As the tmcd changes, incompatable changes with older version of
 * the software cause problems. Starting with version 3, the client
 * will tell tmcd what version they are. If no version is included,
 * assume its DEFAULT_VERSION.
 *
 * Be sure to update the versions as the TMCD changes. Both the
 * tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
 * install new versions of each binary when the current version
 * changes. libsetup.pm module also encodes a current version, so be
 * sure to change it there too!
 *
 * Note, this is assumed to be an integer. No need for 3.23.479 ...
 * NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
 */
#define DEFAULT_VERSION		2
#define CURRENT_VERSION		9

Update to version 9 to match libsetup/tmcd.


#ifndef GWKV_HT_WRAPPER
#define GWKV_HT_WRAPPER

#include <stdlib.h>

typedef enum {
        GET,
        SET
} method;

/* Defines for result codes */
#define STORED 0
#define NOT_STORED 1
#define EXISTS 2
#define NOT_FOUND 3

struct {
        method method_type,
        const char* key,
        size_t key_length,
        const char* value,
        size_t value_length
} operation;

/**
 * Wrapper function to set a value in the hashtable
 * Returns either STORED or NOT_STORED (defined above)
 */
int
gwkv_memcache_set (memcached_st *ptr,
                  const char *key,
                  size_t key_length,
                  const char *value,
                  size_t value_length);

/**
 * Wrapper function to read a value from the hashtable
 * Returns the data if sucessful, or NULL on error
 * These correspond to the EXISTS and NOT_FOUND codes above
 */
char*
gwkv_memcached_get (memcached_st *ptr,
                    const char *key,
                    size_t key_length,
                    size_t *value_length);

#endif

#ifndef GWKV_HT_WRAPPER
#define GWKV_HT_WRAPPER

#include <stdlib.h>
#include "../hashtable/hashtable.h"

typedef enum {
        GET,
        SET
} method;

/* Defines for result codes */
#define STORED 0
#define NOT_STORED 1
#define EXISTS 2
#define NOT_FOUND 3

struct {
        method method_type,
        const char* key,
        size_t key_length,
        const char* value,
        size_t value_length
} operation;

/**
 * Wrapper function to set a value in the hashtable
 * Returns either STORED or NOT_STORED (defined above)
 */
int
gwkv_server_set (memcached_st *ptr,
                 const char *key,
                 size_t key_length,
                 const char *value,
                 size_t value_length);

/**
 * Wrapper function to read a value from the hashtable
 * Returns the data if sucessful, or NULL on error
 * These correspond to the EXISTS and NOT_FOUND codes above
 */
char*
gwkv_server_get (memcached_st *ptr,
                 const char *key,
                 size_t key_length,
                 size_t *value_length);

#endif

Change server set/get function names

Change server set/get function names


#ifndef _COMMON_H
#define _COMMON_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#ifdef _LINUX
#include <bsd/string.h>
#endif

#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlsave.h>
#include <libxml/encoding.h>
#include <libxml/xmlstring.h>

#include <openssl/bio.h>
#include <openssl/evp.h>

#ifndef _READLINE
#include <histedit.h>
#else
#include <readline/readline.h>
#include <readline/history.h>
#endif

#define	USAGE	"[-k database file] [-p password file] [-m cipher mode] [-b] [-v] [-h] [-d]"

#define	VERSION	"kc 2.1"

#ifndef _READLINE
const char *el_prompt_null(void);
#endif
const char *prompt_str(void);
int malloc_check(void *);
char *get_random_str(size_t, char);
void version(void);
void quit(int);

char		debug;

#endif

#ifndef _COMMON_H
#define _COMMON_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#ifdef _LINUX
#include <bsd/string.h>
#endif

#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlsave.h>
#include <libxml/encoding.h>
#include <libxml/xmlstring.h>

#include <openssl/bio.h>
#include <openssl/evp.h>

#ifndef _READLINE
#include <histedit.h>
#else
#include <readline/readline.h>
#include <readline/history.h>
#endif

#define	USAGE	"[-k database file] [-p password file] [-m cipher mode] [-b] [-v] [-h] [-d]"

#define	VERSION	"kc 2.1.1"

#ifndef _READLINE
const char *el_prompt_null(void);
#endif
const char *prompt_str(void);
int malloc_check(void *);
char *get_random_str(size_t, char);
void version(void);
void quit(int);

char		debug;

#endif

Tag 2.1.1 because of the segfault fix.

Tag 2.1.1 because of the segfault fix.


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

Add file that holds the string hash function.


/**
 * @file    random.h
 * @ingroup CppAlgorithms
 * @brief   Random utility functions.
 *
 * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

/**
 * @brief Random utility functions.
 */
class Random
{
public:
    /**
     * @brief Generate a printable alphanumeric character.
     */
    static char GenChar();

    /**
     * @brief Generate a printable alphanumeric string.
     */
    static void GenString(char* str, size_t len);
};

/**
 * @file    random.h
 * @ingroup CppAlgorithms
 * @brief   Random utility functions.
 *
 * Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

#include <cstddef>  // size_t

/**
 * @brief Random utility functions.
 */
class Random
{
public:
    /**
     * @brief Generate a printable alphanumeric character.
     */
    static char GenChar();

    /**
     * @brief Generate a printable alphanumeric string.
     */
    static void GenString(char* str, size_t len);
};

Fix Travis build (missing include for size_t)


// SKIP PARAM: --sets ana.activated[+] octApron --sets sem.int.signed_overflow assume_none --disable ana.int.interval
// copied from signed-overflows/intervals for octApron
int main(void) {
    int x = 0;
    while(x != 42) {
        x++;
        assert(x >= 1);
    }

}

Add octApron test on signed overflows

Add octApron test on signed overflows


#ifndef __GAME_OBJECT_H__
#define __GAME_OBJECT_H__

#include<iostream>
#include<SDL2/SDL.h>

class GameObject
{
   public:
        void load(int pX, int pY, int pWidth, int pHeight, std::string pTextureId);
        void draw(SDL_Renderer *renderer);
        void update();
        void clean() { std::cout << "clean game object"; }

    protected:
        std::string textureId;

        int currentFrame;
        int currentRow;

        int x;
        int y;

        int width;
        int height;
};

#endif

#ifndef __GAME_OBJECT_H__
#define __GAME_OBJECT_H__

#include<iostream>
#include<SDL2/SDL.h>

class GameObject
{
   public:
        virtual void load(int pX, int pY, int pWidth, int pHeight, std::string pTextureId);
        virtual void draw(SDL_Renderer *renderer);
        virtual void update();
        virtual void clean() {};

    protected:
        std::string textureId;

        int currentFrame;
        int currentRow;

        int x;
        int y;

        int width;
        int height;
};

#endif

Include virtual in all methods.

Include virtual in all methods.


#ifndef _EXCELFORMUAL_TOKEN_ARRAY_H__
#define _EXCELFORMUAL_TOKEN_ARRAY_H__

#include <vector>

using std::vector;

namespace ExcelFormula{

	class Token;

	class TokenArray{
		public:
			TokenArray();

			void toVector(vector<Token*>&);
			void fromVector(vector<Token*>&);

			size_t size() {return m_tokens.size();}

			bool isBOF() {return (m_index <= 0)?true:false;}

			bool isEOF() {return (m_index >= m_tokens.size())?true:false;}

			Token* getCurrent();

			Token* getNext();

			Token* getPrevious();

			Token* add(Token*);

			bool moveNext();

			void reset(){m_index = 0;}

			void releaseAll();

		private:
			size_t m_index;
			vector<Token*> m_tokens;
	};
}

#endif

#ifndef _EXCELFORMUAL_TOKEN_ARRAY_H__
#define _EXCELFORMUAL_TOKEN_ARRAY_H__

#include <vector>
#include <cstddef>

using std::vector;

namespace ExcelFormula{

	class Token;

	class TokenArray{
		public:
			TokenArray();

			void toVector(vector<Token*>&);
			void fromVector(vector<Token*>&);

			size_t size() {return m_tokens.size();}

			bool isBOF() {return (m_index <= 0)?true:false;}

			bool isEOF() {return (m_index >= m_tokens.size())?true:false;}

			Token* getCurrent();

			Token* getNext();

			Token* getPrevious();

			Token* add(Token*);

			bool moveNext();

			void reset(){m_index = 0;}

			void releaseAll();

		private:
			size_t m_index;
			vector<Token*> m_tokens;
	};
}

#endif

Add missing include for size_t

Add missing include for size_t

Fixes compile error:
[...]
g++ -c  -g TokenArray.cpp
In file included from TokenArray.cpp:1:0:
TokenArray.h:20:4: error: ‘size_t’ does not name a type
    size_t size() {return m_tokens.size();}
    ^
TokenArray.h:41:4: error: ‘size_t’ does not name a type
    size_t m_index;
    ^


#ifndef LIBPORT_UNISTD_H
# define LIBPORT_UNISTD_H

# include <libport/detect-win32.h>
# include <libport/windows.hh> // Get sleep wrapper

# include <libport/config.h>

// This is traditional Unix file.
# ifdef LIBPORT_HAVE_UNISTD_H
#  include <unistd.h>
# endif

// OSX does not have O_LARGEFILE.  No information was found whether
// some equivalent flag is needed or not.  Other projects simply do as
// follows.
# ifndef O_LARGEFILE
#  define O_LARGEFILE 0
# endif

// This seems to be its WIN32 equivalent.
// http://msdn2.microsoft.com/en-us/library/ms811896(d=printer).aspx#ucmgch09_topic7.
# if defined WIN32 || defined LIBPORT_WIN32
#  include <io.h>
# endif

# ifdef WIN32
#  include <direct.h>
extern "C"
{
  int chdir (const char* path)
  {
    return _chdir(path);
  }
}
# endif

# if !defined LIBPORT_HAVE_GETCWD
#  if defined LIBPORT_HAVE__GETCWD
#   define getcwd _getcwd
#  elif defined LIBPORT_URBI_ENV_AIBO
    // Will be defined in libport/unistd.cc.
#  else
#   error I need either getcwd() or _getcwd()
#  endif
# endif

#endif // !LIBPORT_UNISTD_H

#ifndef LIBPORT_UNISTD_H
# define LIBPORT_UNISTD_H

# include <libport/detect-win32.h>
# include <libport/windows.hh> // Get sleep wrapper

# include <libport/config.h>

// This is traditional Unix file.
# ifdef LIBPORT_HAVE_UNISTD_H
#  include <unistd.h>
# endif

// OSX does not have O_LARGEFILE.  No information was found whether
// some equivalent flag is needed or not.  Other projects simply do as
// follows.
# ifndef O_LARGEFILE
#  define O_LARGEFILE 0
# endif

// This seems to be its WIN32 equivalent.
// http://msdn2.microsoft.com/en-us/library/ms811896(d=printer).aspx#ucmgch09_topic7.
# if defined WIN32 || defined LIBPORT_WIN32
#  include <io.h>
# endif

# ifdef WIN32
#  include <direct.h>
#  define chdir _chdir
# endif

# if !defined LIBPORT_HAVE_GETCWD
#  if defined LIBPORT_HAVE__GETCWD
#   define getcwd _getcwd
#  elif defined LIBPORT_URBI_ENV_AIBO
    // Will be defined in libport/unistd.cc.
#  else
#   error I need either getcwd() or _getcwd()
#  endif
# endif

#endif // !LIBPORT_UNISTD_H

Define chdir as a macro.

Define chdir as a macro.

The previous definition was uselessly complicated, and lacked the
proper API declaration.

	* include/libport/unistd.h (chdir): Define as "_chdir".


//
//  TSDKCollectionJSON.h
//  TeamSnapSDK
//
//  Created by Jason Rahaim on 1/10/14.
//  Copyright (c) 2014 TeamSnap. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TSDKCollectionJSON : NSObject <NSCoding, NSCopying>

@property (nonatomic, strong) NSURL *_Nullable href;
@property (nonatomic, strong) NSString *_Nullable version;
@property (nonatomic, strong) NSString *_Nullable type;
@property (nonatomic, strong) NSString *_Nullable rel;
@property (nonatomic, strong) NSString *_Nullable errorTitle;
@property (nonatomic, strong) NSString *_Nullable errorMessage;
@property (nonatomic, assign) NSInteger errorCode;
@property (nonatomic, strong) NSMutableDictionary *_Nullable links;
@property (nonatomic, strong) NSMutableDictionary *_Nullable data;
@property (nonatomic, strong) NSMutableDictionary *_Nullable commands;
@property (nonatomic, strong) NSMutableDictionary *_Nullable queries;
@property (nonatomic, strong) id _Nullable collection;

+(NSDictionary *_Nullable)dictionaryToCollectionJSON:(NSDictionary *_Nonnull)dictionary;
- (instancetype _Nullable)initWithCoder:(NSCoder *_Nonnull)aDecoder;
- (instancetype _Nullable)initWithJSON:(NSDictionary *_Nonnull)JSON;
+ (instancetype _Nullable)collectionJSONForEncodedData:(NSData *_Nonnull)objectData;
- (NSString *_Nullable)getObjectiveCHeaderSkeleton;
- (NSData *_Nonnull)dataEncodedForSave;

@end

//
//  TSDKCollectionJSON.h
//  TeamSnapSDK
//
//  Created by Jason Rahaim on 1/10/14.
//  Copyright (c) 2014 TeamSnap. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TSDKCollectionJSON : NSObject <NSCoding, NSCopying>

@property (nonatomic, strong) NSURL *_Nullable href;
@property (nonatomic, strong) NSString *_Nullable version;
@property (nonatomic, strong) NSString *_Nullable type;
@property (nonatomic, strong) NSString *_Nullable rel;
@property (nonatomic, strong) NSString *_Nullable errorTitle;
@property (nonatomic, strong) NSString *_Nullable errorMessage;
@property (nonatomic, assign) NSInteger errorCode;
@property (nonatomic, strong) NSMutableDictionary *_Nullable links;
@property (nonatomic, strong) NSMutableDictionary *_Nullable data;
@property (nonatomic, strong) NSMutableDictionary *_Nullable commands;
@property (nonatomic, strong) NSMutableDictionary *_Nullable queries;
@property (nonatomic, strong) NSMutableArray <TSDKCollectionJSON *> *_Nullable collection;

+ (NSDictionary *_Nullable)dictionaryToCollectionJSON:(NSDictionary *_Nonnull)dictionary;
- (instancetype _Nullable)initWithCoder:(NSCoder *_Nonnull)aDecoder;
- (instancetype _Nullable)initWithJSON:(NSDictionary *_Nonnull)JSON;
+ (instancetype _Nullable)collectionJSONForEncodedData:(NSData *_Nonnull)objectData;
- (NSString *_Nullable)getObjectiveCHeaderSkeleton;
- (NSData *_Nonnull)dataEncodedForSave;

@end

Add type to Collection Property

Add type to Collection Property


// Scott Kuhl
#include <stdio.h>

/* Static functions and static global variables are only visible in
 * the file that it is declared in. Static variables inside of a
 * function have a different meaning and is described below */

void foo()
{
	int x = 0;
	static int staticx = 0; // initialized once; keeps value between invocations of foo().
	x++;
	staticx++;
	printf("x=%d\n", x);
	printf("staticx=%d\n", staticx);
}

int main(void)
{
	for(int i=0; i<10; i++)
		foo();
}

Add name to top of file.

Add name to top of file.


/******************************
** Tsunagari Tile Engine     **
** config.h                  **
** Copyright 2011 OmegaSDG   **
******************************/

#ifndef CONFIG_H
#define CONFIG_H

// === Default Configuration Settings ===
	/* Tsunagari config file. -- Command Line */
	#define CLIENT_CONF_FILE "./client.conf"

	/* Error verbosity level. -- Command Line */
	#define MESSAGE_MODE MM_DEBUG

	/* Milliseconds of button down before starting persistent input in
	   roguelike movement mode. -- Move to World Descriptor */
	#define ROGUELIKE_PERSIST_DELAY_INIT 500

	/* Milliseconds between persistent input sends in roguelike movement
	   mode. -- Move to World Descriptor */
	#define ROGUELIKE_PERSIST_DELAY_CONSECUTIVE 100

	/* Time to live in seconds for empty resource cache entries before they
	   are deleted. -- Command Line */
	#define CACHE_EMPTY_TTL 300
// ===

#endif

/******************************
** Tsunagari Tile Engine     **
** config.h                  **
** Copyright 2011 OmegaSDG   **
******************************/

#ifndef CONFIG_H
#define CONFIG_H

// === Default Configuration Settings ===
	/* Tsunagari config file. -- Command Line */
	#define CLIENT_CONF_FILE "./client.conf"

	/* Error verbosity level. -- Command Line */
	#define MESSAGE_MODE MM_DEBUG

	/* Milliseconds of button down before starting persistent input in
	   roguelike movement mode. -- Move to World Descriptor */
	#define ROGUELIKE_PERSIST_DELAY_INIT 500

	/* Milliseconds between persistent input sends in roguelike movement
	   mode. -- Move to World Descriptor */
	#define ROGUELIKE_PERSIST_DELAY_CONSECUTIVE 100

	/* Time to live in seconds for empty resource cache entries before they
	   are deleted. -- Command Line */
	#define CACHE_EMPTY_TTL 300
// ===

// === Compiler Specific Defines ===
	/* Fix snprintf for VisualC++. */
	#ifdef _MSC_VER
		#define snprintf _snprintf
	#endif
// ===

#endif

Fix snprintf on VisualC++ with a conditional define.


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

#ifndef WEBKIT_GLUE_SCREEN_INFO_H_
#define WEBKIT_GLUE_SCREEN_INFO_H_

#include "base/gfx/rect.h"

namespace webkit_glue {

struct ScreenInfo {
  int depth;
  int depth_per_component;
  bool is_monochrome;
  gfx::Rect rect;
  gfx::Rect available_rect;
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_SCREEN_INFO_H_

Add missing file. Oops :(

Add missing file.  Oops :(

TBR=dglazkov

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

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


/***************************************************************************
*   Copyright © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
*                                                                         *
*   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.                                   *
***************************************************************************/

#ifndef KREDBIMPORTER_H
#define KREDBIMPORTER_H

#include <QString>

#include "baseimporter.h"

/** Class to import recipes from any other Krecipes database backend.
  * Note: Though independent of database type, the two databases must have the same structure (i.e. be the same version)
  * @author Jason Kivlighn
  */
class KreDBImporter : public BaseImporter
{
public:
	KreDBImporter( const QString &dbType, const QString &host = QString(), const QString &user = QString(), const QString &pass = QString(), int port = 0 );
	virtual ~KreDBImporter();

private:
	virtual void parseFile( const QString &file_or_table );

	QString dbType;
	QString host;
	QString user;
	QString pass;
	int port;
};

#endif //KREDBIMPORTER_H

/***************************************************************************
*   Copyright © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
*                                                                         *
*   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.                                   *
***************************************************************************/

#ifndef KREDBIMPORTER_H
#define KREDBIMPORTER_H

#include <QString>

#include "baseimporter.h"

/** Class to import recipes from any other Krecipes database backend.
  * Note: Though independent of database type, the two databases must have the same structure (i.e. be the same version)
  * @author Jason Kivlighn
  */
class KreDBImporter : public BaseImporter
{
public:
	explicit KreDBImporter( const QString &dbType, const QString &host = QString(), const QString &user = QString(), const QString &pass = QString(), int port = 0 );
	virtual ~KreDBImporter();

private:
	virtual void parseFile( const QString &file_or_table );

	QString dbType;
	QString host;
	QString user;
	QString pass;
	int port;
};

#endif //KREDBIMPORTER_H

Fix Krazy warnings: explicit - KreDBImporter

svn path=/trunk/extragear/utils/krecipes/; revision=1119833


/*
 * Configurables.  Adjust these to be appropriate for your system.
 */

/* change blacklist parameters (-b) if necessary */
static const char *ealargs[] = {
	"if_dpdk",
	"-b 00:00:03.0",
	"-c 1",
	"-n 1",
};

/* change PORTID to the one your want to use */
#define IF_PORTID 0

/* change to the init method of your NIC driver */
#ifndef PMD_INIT
#define PMD_INIT rte_pmd_init_all
#endif

/* Receive packets in bursts of 16 per read */
#define MAX_PKT_BURST 16

/*
 * Configurables.  Adjust these to be appropriate for your system.
 */

/* change blacklist parameters (-b) if necessary
 * If you have more than one interface, you will likely want to blacklist
 * at least one of them.
 */
static const char *ealargs[] = {
	"if_dpdk",
	"-b 00:00:03.0",
	"-c 1",
	"-n 1",
};

/* change PORTID to the one your want to use */
#define IF_PORTID 0

/* change to the init method of your NIC driver */
#ifndef PMD_INIT
#define PMD_INIT rte_pmd_init_all
#endif

/* Receive packets in bursts of 16 per read */
#define MAX_PKT_BURST 16

Add note about blacklisting interfaces

Add note about blacklisting interfaces


#pragma once
#include <mixal/config.h>
#include <mixal/parsers_utils.h>

namespace mixal {

class MIXAL_PARSER_LIB_EXPORT IParser
{
public:
	std::size_t parse_stream(std::string_view str, std::size_t offset = 0);

protected:
	~IParser() = default;

	virtual void do_clear() = 0;
	virtual std::size_t do_parse_stream(std::string_view str, std::size_t offset) = 0;
};

inline std::size_t IParser::parse_stream(std::string_view str, std::size_t offset /*= 0*/)
{
	do_clear();

	if (offset > str.size())
	{
		return InvalidStreamPosition();
	}

	const auto pos = do_parse_stream(str, offset);
	if (IsInvalidStreamPosition(pos))
	{
		// Parser is in undetermined state.
		// Put back in default state for free
		do_clear();
	}

	return pos;
}

} // namespace mixal

#pragma once
#include <mixal/config.h>
#include <mixal/parsers_utils.h>

namespace mixal {

class MIXAL_PARSER_LIB_EXPORT IParser
{
public:
	std::size_t parse_stream(std::string_view str, std::size_t offset = 0);

	bool is_valid() const;
	std::string_view str() const;

protected:
	IParser() = default;
	~IParser() = default;

	virtual void do_clear() = 0;
	virtual std::size_t do_parse_stream(std::string_view str, std::size_t offset) = 0;

private:
	void clear();

private:
	std::string_view str_;
	bool is_valid_{false};
};

inline std::size_t IParser::parse_stream(std::string_view str, std::size_t offset /*= 0*/)
{
	clear();

	if (offset > str.size())
	{
		return InvalidStreamPosition();
	}

	const auto pos = do_parse_stream(str, offset);
	if (IsInvalidStreamPosition(pos))
	{
		// Parser is in undetermined state.
		// Put back in default state for free
		clear();
		return InvalidStreamPosition();
	}

	is_valid_ = true;
	str_ = str.substr(offset, pos - offset);
	return pos;
}

inline void IParser::clear()
{
	is_valid_ = false;
	do_clear();
}

inline bool IParser::is_valid() const
{
	return is_valid_;
}

inline std::string_view IParser::str() const
{
	return str_;
}

} // namespace mixal

Extend IParser interface: remember parse state - succesfull or not; what part of string was parsed


#include <stdio.h>

int main(int argc, char *argv[]){
    int numbers[4] = {0};
    char name[4] = {'a'};

    //first print them out raw
    printf("numbers: %d %d %d %d.\n",
        numbers[0],
        numbers[1],
        numbers[2],
        numbers[3]);

    printf("name each: %c %c %c %c.\n",
        name[0],
        name[1],
        name[2],
        name[3]);

    return 0;
}

Print out values of first two arrays

Print out values of first two arrays


// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
// PR 5995
struct s {
  int word;
  struct {
    int filler __attribute__ ((aligned (8)));
  };
};

void func (struct s *s)
{
  // CHECK: load %struct.s** %s.addr, align 8
  s->word = 0;
}

// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
// PR 5995
struct s {
  int word;
  struct {
    int filler __attribute__ ((aligned (8)));
  };
};

void func (struct s *s)
{
  // CHECK: load %struct.s**{{.*}}align 8
  s->word = 0;
}

Rewrite matching line to be friendlier to misc buildbots.

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


#ifndef EP_TESTSUITE_H
#define EP_TESTSUITE_H 1

#include <memcached/engine.h>
#include <memcached/engine_testapp.h>

#ifdef __cplusplus
extern "C" {
#endif

MEMCACHED_PUBLIC_API
engine_test_t* get_tests(void);

MEMCACHED_PUBLIC_API
bool setup_suite(struct test_harness *th);

#ifdef __cplusplus
}
#endif

#endif

#ifndef EP_TESTSUITE_H
#define EP_TESTSUITE_H 1

#include <memcached/engine.h>
#include <memcached/engine_testapp.h>

#ifdef __cplusplus
extern "C" {
#endif

MEMCACHED_PUBLIC_API
engine_test_t* get_tests(void);

MEMCACHED_PUBLIC_API
bool setup_suite(struct test_harness *th);

MEMCACHED_PUBLIC_API
bool teardown_suite();

enum test_result prepare(engine_test_t *test);

void cleanup(engine_test_t *test, enum test_result result);

#ifdef __cplusplus
}
#endif

#endif

Fix test suite compilation errors

Fix test suite compilation errors

This fixes some missing function declaration errors:

  CXX    ep_testsuite_la-ep_testsuite.lo
cc1plus: warnings being treated as errors
ep_testsuite.cc: In function ‘test_result prepare(engine_test_t*)’:
ep_testsuite.cc:5425: error: no previous declaration for ‘test_result prepare(engine_test_t*)’ [-Wmissing-declarations]
ep_testsuite.cc: In function ‘void cleanup(engine_test_t*, test_result)’:
ep_testsuite.cc:5447: error: no previous declaration for ‘void cleanup(engine_test_t*, test_result)’ [-Wmissing-declarations]
ep_testsuite.cc: In function ‘bool teardown_suite()’:
ep_testsuite.cc:5965: error: no previous declaration for ‘bool teardown_suite()’ [-Wmissing-declarations]
make[2]: *** [ep_testsuite_la-ep_testsuite.lo] Error 1

Change-Id: I2363240c962a09740301a4a85f0559bc04981bcd
Reviewed-on: http://review.couchbase.org/7913
Tested-by: Filipe David Borba Manana <e0fcd583df77ec6c08e6d1257619cc1216ddc994@gmail.com>
Reviewed-by: Dustin Sallings <1c08efb9b3965701be9d700d9a6f481f1ffec3ea@spy.net>


/*
    Copyright (C) 2016 William Hart

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_mpoly.h"
#include "ulong_extras.h"

int
main(void)
{
    int i;
    FLINT_TEST_INIT(state);

    flint_printf("void....");
    fflush(stdout);

    /* Check aliasing of a and c */
    for (i = 0; i < 1000 * flint_test_multiplier(); i++)
    {
    }

    FLINT_TEST_CLEANUP(state);

    flint_printf("PASS\n");
    return 0;
}

Add empty test to prevent build system complaining.


#ifndef INPUTSTATE_H
#define INPUTSTATE_H

#include <SDL2/SDL.h>
#undef main
#include <map>

class InputState
{
public:
	enum KeyFunction { KF_EXIT, KF_FORWARDS, KF_BACKWARDS, KF_ROTATE_SUN };

	InputState();
	void readInputState();
	bool getKeyState(KeyFunction f);
	int getAbsoluteMouseX() { return mouse_x; };
	int getAbsoluteMouseY() { return mouse_y; };
	float getMouseX() { return (float)mouse_x / (float)w; };
	float getMouseY() { return (float)mouse_y / (float)h; };

	int w, h;
	int mouse_x, mouse_y;

private:
	Uint8 *keys;
	Uint8 key_function_to_keycode[3];
};

#endif

#ifndef INPUTSTATE_H
#define INPUTSTATE_H

#include <SDL2/SDL.h>
#undef main
#include <map>

class InputState
{
public:
	enum KeyFunction { KF_EXIT, KF_FORWARDS, KF_BACKWARDS, KF_ROTATE_SUN };

	InputState();
	void readInputState();
	bool getKeyState(KeyFunction f);
	int getAbsoluteMouseX() { return mouse_x; };
	int getAbsoluteMouseY() { return mouse_y; };
	float getMouseX() { return (float)mouse_x / (float)w; };
	float getMouseY() { return (float)mouse_y / (float)h; };

	int w, h;
	int mouse_x, mouse_y;

private:
	Uint8 *keys;
	Uint8 key_function_to_keycode[4];
};

#endif

Fix InputSize symbol array size.

Fix InputSize symbol array size.


/*
 * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
 * Copyright (c) 2011-2012 Basile Starynkevitch <basile@starynkevitch.net>
 *
 * Jansson is free software; you can redistribute it and/or modify it
 * under the terms of the MIT license. See LICENSE for details.
 */

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

#include "jansson.h"
#include "jansson_private.h"

/* memory function pointers */
static json_malloc_t do_malloc = malloc;
static json_free_t do_free = free;

void *jsonp_malloc(size_t size)
{
    if(!size)
        return NULL;

    return (*do_malloc)(size);
}

void jsonp_free(void *ptr)
{
    if(!ptr)
        return;

    (*do_free)(ptr);
}

char *jsonp_strdup(const char *str)
{
    char *new_str;

    new_str = jsonp_malloc(strlen(str) + 1);
    if(!new_str)
        return NULL;

    strcpy(new_str, str);
    return new_str;
}

void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn)
{
    do_malloc = malloc_fn;
    do_free = free_fn;
}

/*
 * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
 * Copyright (c) 2011-2012 Basile Starynkevitch <basile@starynkevitch.net>
 *
 * Jansson is free software; you can redistribute it and/or modify it
 * under the terms of the MIT license. See LICENSE for details.
 */

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

#include "jansson.h"
#include "jansson_private.h"

/* memory function pointers */
static json_malloc_t do_malloc = malloc;
static json_free_t do_free = free;

void *jsonp_malloc(size_t size)
{
    if(!size)
        return NULL;

    return (*do_malloc)(size);
}

void jsonp_free(void *ptr)
{
    if(!ptr)
        return;

    (*do_free)(ptr);
}

char *jsonp_strdup(const char *str)
{
    char *new_str;
    size_t len;

    len = strlen(str);
    if(len == (size_t)-1)
        return NULL;

    new_str = jsonp_malloc(len + 1);
    if(!new_str)
        return NULL;

    strcpy(new_str, str);
    return new_str;
}

void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn)
{
    do_malloc = malloc_fn;
    do_free = free_fn;
}

Fix integer overflow in jsonp_strdup()

Fix integer overflow in jsonp_strdup()

Fixes #129.


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

#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once

#include <vector>

#include "base/basictypes.h"
#include "base/string_util.h"

namespace ui {

// A class to recognize compose and dead key sequence.
// Outputs composed character.
//
// TODO(hashimoto): support unicode character composition starting with
// Ctrl-Shift-U. http://crosbug.com/15925
class CharacterComposer {
 public:
  CharacterComposer();
  ~CharacterComposer();

  void Reset();

  // Filters keypress.
  // Returns true if the keypress is recognized as a part of composition
  // sequence.
  bool FilterKeyPress(unsigned int keycode);

  // Returns a string consisting of composed character.
  // Empty string is returned when there is no composition result.
  const string16& composed_character() const {
    return composed_character_;
  }

 private:
  // Remembers keypresses previously filtered.
  std::vector<unsigned int> compose_buffer_;

  // A string representing the composed character.
  string16 composed_character_;

  DISALLOW_COPY_AND_ASSIGN(CharacterComposer);
};

}  // namespace ui

#endif  // UI_BASE_IME_CHARACTER_COMPOSER_H_

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

#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once

#include <vector>

#include "base/basictypes.h"
#include "base/string_util.h"
#include "ui/base/ui_export.h"

namespace ui {

// A class to recognize compose and dead key sequence.
// Outputs composed character.
//
// TODO(hashimoto): support unicode character composition starting with
// Ctrl-Shift-U. http://crosbug.com/15925
class UI_EXPORT CharacterComposer {
 public:
  CharacterComposer();
  ~CharacterComposer();

  void Reset();

  // Filters keypress.
  // Returns true if the keypress is recognized as a part of composition
  // sequence.
  bool FilterKeyPress(unsigned int keycode);

  // Returns a string consisting of composed character.
  // Empty string is returned when there is no composition result.
  const string16& composed_character() const {
    return composed_character_;
  }

 private:
  // Remembers keypresses previously filtered.
  std::vector<unsigned int> compose_buffer_;

  // A string representing the composed character.
  string16 composed_character_;

  DISALLOW_COPY_AND_ASSIGN(CharacterComposer);
};

}  // namespace ui

#endif  // UI_BASE_IME_CHARACTER_COMPOSER_H_

Fix link error when component=shared_library is set

BUG=103789
TEST=Manual

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

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


#ifndef G__IOSFWD_H
#define G__IOSFWD_H
#include <iostream.h>
typedef basic_streambuf<char, char_traits<char> > streambuf;
#endif

#ifndef G__IOSFWD_H
#define G__IOSFWD_H
#include <iostream.h>
#endif

Undo change proposed by Philippe. Too many side effects.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@5468 27541ba8-7e3a-0410-8455-c3a389f83636


// 13 september 2016
#include "uipriv_unix.h"

struct uiImage {
	uiUnixControl c;
	GtkWidget *widget;
};

uiUnixControlAllDefaults(uiImage)

uiImage *uiNewImage(const char *filename)
{
	uiImage *img;

	uiUnixNewControl(uiImage, img);

	img->widget = gtk_image_new_from_file(filename);

	return img;
}

// 13 september 2016
#include "uipriv_unix.h"

struct uiImage {
	uiUnixControl c;
	GtkWidget *widget;
};

uiUnixControlAllDefaults(uiImage)

void uiImageSetSize(uiImage *i, unsigned int width, unsigned int height)
{
	GdkPixbuf *pixbuf;

	pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(i->widget));
	pixbuf = gdk_pixbuf_scale_simple(pixbuf,
		width,
		height,
		GDK_INTERP_BILINEAR);
	gtk_image_set_from_pixbuf(GTK_IMAGE(i->widget), pixbuf);
	g_object_unref(pixbuf);
}

void uiImageGetSize(uiImage *i, unsigned int *width, unsigned int *height)
{
	GdkPixbuf *pixbuf;

	pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(i->widget));
	*width = gdk_pixbuf_get_width(pixbuf);
	*height = gdk_pixbuf_get_height(pixbuf);
}

uiImage *uiNewImage(const char *filename)
{
	uiImage *img;

	uiUnixNewControl(uiImage, img);

	img->widget = gtk_image_new_from_file(filename);

	return img;
}

Implement getting and setting uiImage size in Gtk


// LAF OS Library
// Copyright (C) 2022  Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef OS_GL_CONTEXT_NSGL_INCLUDED
#define OS_GL_CONTEXT_NSGL_INCLUDED
#pragma once

#include "os/gl/gl_context.h"

namespace os {

class GLContextNSGL : public GLContext {
public:
  GLContextNSGL();
  ~GLContextNSGL();

  void setView(id view);

  bool isValid() override;
  bool createGLContext() override;
  void destroyGLContext() override;
  void makeCurrent() override;
  void swapBuffers() override;

  id nsglContext() {
    return m_nsgl;
  }

private:
  id m_nsgl = nil; // NSOpenGLContext
  id m_view = nil; // NSView
};

} // namespace os

#endif

// LAF OS Library
// Copyright (C) 2022  Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef OS_GL_CONTEXT_NSGL_INCLUDED
#define OS_GL_CONTEXT_NSGL_INCLUDED
#pragma once

#include "os/gl/gl_context.h"

namespace os {

class GLContextNSGL : public GLContext {
public:
  GLContextNSGL();
  ~GLContextNSGL();

  void setView(id view);

  bool isValid() override;
  bool createGLContext() override;
  void destroyGLContext() override;
  void makeCurrent() override;
  void swapBuffers() override;

  id nsglContext() {
    return m_nsgl;
  }

private:
  id m_nsgl = nullptr; // NSOpenGLContext
  id m_view = nullptr; // NSView
};

} // namespace os

#endif

[osx] Replace nil with nullptr in GLContextNSGL to compile correctly


/*
 *
 * Copyright 2016 gRPC 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.
 *
 */

#include <grpc/grpc.h>
#include <v8.h>

namespace grpc {
namespace node {

grpc_completion_queue *GetCompletionQueue();

void CompletionQueueNext();

void CompletionQueueInit(v8::Local<v8::Object> exports);

}  // namespace node
}  // namespace grpc

/*
 *
 * Copyright 2016 gRPC 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.
 *
 */

#include <grpc/grpc.h>
#include <v8.h>

namespace grpc {
namespace node {

grpc_completion_queue *GetCompletionQueue();

void CompletionQueueNext();

void CompletionQueueInit(v8::Local<v8::Object> exports);

void CompletionQueueForcePoll();

}  // namespace node
}  // namespace grpc

Update completion queue header to match code changes


#ifndef SCALAR_INDEXING_NONCONST_H
#define SCALAR_INDEXING_NONCONST_H

// Scalar indexing non-const
//----------------------------------------------------------------------------------------------------------//
template<typename... Args, typename std::enable_if<sizeof...(Args)==dimension_t::value &&
                                is_arithmetic_pack<Args...>::value,bool>::type =0>
FASTOR_INLINE T& operator()(Args ... args) {
    return _data[get_flat_index(args...)];
}
template<typename Arg, typename std::enable_if<1==dimension_t::value &&
                                is_arithmetic_pack<Arg>::value,bool>::type =0>
FASTOR_INLINE T& operator[](Arg arg) {
    return _data[get_flat_index(arg)];
}
//----------------------------------------------------------------------------------------------------------//

#endif // SCALAR_INDEXING_NONCONST_H

#ifndef SCALAR_INDEXING_CONST_H
#define SCALAR_INDEXING_CONST_H

// Scalar indexing const
//----------------------------------------------------------------------------------------------------------//
template<typename... Args, typename std::enable_if<sizeof...(Args)==dimension_t::value &&
                                is_arithmetic_pack<Args...>::value,bool>::type =0>
constexpr FASTOR_INLINE const T& operator()(Args ... args) const {
    return _data[get_flat_index(args...)];
}
template<typename Arg, typename std::enable_if<1==dimension_t::value &&
                                is_arithmetic_pack<Arg>::value,bool>::type =0>
constexpr FASTOR_INLINE const T& operator[](Arg arg) const {
    return _data[get_flat_index(arg)];
}
//----------------------------------------------------------------------------------------------------------//

#endif // SCALAR_INDEXING_CONST_H

Allow indexing by operator[] when dimension is 1


/**
 *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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.
 *
 *  This file is part of mbed TLS (https://tls.mbed.org)
 */

#if defined(DEVICE_TRNG)
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#endif

#if defined(DEVICE_RTC)
#define MBEDTLS_HAVE_TIME_DATE
#endif

#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
#include "mbedtls_device.h"
#endif

/**
 *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  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.
 *
 *  This file is part of mbed TLS (https://tls.mbed.org)
 */

#if defined(DEVICE_TRNG)
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#endif

#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
#include "mbedtls_device.h"
#endif

Disable MBEDTLS_HAVE_DATE_TIME as ARMCC does not support gmtime


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

#include <vdp2/tvmd.h>

#include "vdp-internal.h"

void
vdp2_tvmd_display_clear(void)
{
        _state_vdp2()->regs.tvmd &= 0x7FFF;

        /* Change the DISP bit during VBLANK */
        vdp2_tvmd_vblank_in_wait();

        MEMORY_WRITE(16, VDP2(TVMD), _state_vdp2()->regs.tvmd);
}

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

#include <vdp2/tvmd.h>

#include "vdp-internal.h"

void
vdp2_tvmd_display_clear(void)
{
        _state_vdp2()->regs.tvmd &= 0x7EFF;

        /* Change the DISP bit during VBLANK */
        vdp2_tvmd_vblank_in_wait();

        MEMORY_WRITE(16, VDP2(TVMD), _state_vdp2()->regs.tvmd);
}

Clear bit when writing to VDP2(TVMD)

Clear bit when writing to VDP2(TVMD)


// Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else  // !BUILDING_CEF_SHARED

// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

#endif  // !BUILDING_CEF_SHARED

#endif  // CEF_LIBCEF_DLL_CEF_MACROS_H_
// Copyright (c) 2014 The Chromium Embedded Framework 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 CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

#ifdef BUILDING_CEF_SHARED
#include "base/macros.h"
#else  // !BUILDING_CEF_SHARED

// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

#endif  // !BUILDING_CEF_SHARED

#endif  // CEF_LIBCEF_DLL_CEF_MACROS_H_

Remove duplicate content in file.

Remove duplicate content in file.

git-svn-id: 66addb63d0c46e75f185859367c4faf62af16cdd@1734 5089003a-bbd8-11dd-ad1f-f1f9622dbc98


/**
 * xrdp: A Remote Desktop Protocol server.
 *
 * Copyright (C) Jay Sorg 2004-2012
 *
 * 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.
 */

/**
 *
 * @file libscp_init.c
 * @brief libscp initialization code
 * @author Simone Fedele
 *
 */

#include "libscp_init.h"

//struct log_config* s_log;

/* server API */
int DEFAULT_CC
scp_init()
{
    /*
      if (0 == log)
      {
        return 1;
      }
    */

    //s_log = log;

    scp_lock_init();

    log_message(LOG_LEVEL_WARNING, "[init:%d] libscp initialized", __LINE__);

    return 0;
}

/**
 * xrdp: A Remote Desktop Protocol server.
 *
 * Copyright (C) Jay Sorg 2004-2012
 *
 * 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.
 */

/**
 *
 * @file libscp_init.c
 * @brief libscp initialization code
 * @author Simone Fedele
 *
 */

#include "libscp_init.h"

//struct log_config* s_log;

/* server API */
int DEFAULT_CC
scp_init()
{
    /*
      if (0 == log)
      {
        return 1;
      }
    */

    //s_log = log;

    scp_lock_init();

    log_message(LOG_LEVEL_DEBUG, "libscp initialized");

    return 0;
}

Downgrade "libscp initialized" to LOG_LEVEL_DEBUG, remove line number

It's a bad style to start the log with a cryptic warning.


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

inherit LIB_RAWVERB;

void main(object actor, string args)
{
	object user;
	float interval;

	user = query_user();

	if (user->query_class() < 2) {
		send_out("You do not have sufficient access rights to tune the bulk sync system.\n");
		return;
	}

	if (args == "") {
		send_out("Current bulk sync interval: " + STRINGD->mixed_sprint(BULKD->query_interval()) + "\n");
		return;
	}

	if (!sscanf(args, "%f", interval)) {
		send_out("Floats only please.\n");
		return;
	}

	BULKD->set_interval(interval);

	send_out("BulkD tuned.\n");
	return;
}

Add command to tune bulkd

Add command to tune bulkd


#pragma once

#include "Control.h"
#include "../../3RVX/Logger.h"

class Label : public Control {
public:
    Label() {

    }

    Label(int id, HWND parent) :
    Control(id, parent) {

    }
};

#pragma once

#include "Control.h"
#include "../../3RVX/Logger.h"

class Label : public Control {
public:
    Label() {

    }

    Label(int id, HWND parent) :
    Control(id, parent) {

    }

    Label(int id, DialogBase &parent, bool translate = true) :
    Control(id, parent, false) {

    }
};

Add a new-style constructor for labels

Add a new-style constructor for labels


#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>

@interface PPSSignatureView : GLKView

@property (assign, nonatomic) UIColor *strokeColor;
@property (assign, nonatomic) BOOL hasSignature;
@property (strong, nonatomic) UIImage *signatureImage;

- (void)erase;

@end

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>

@interface PPSSignatureView : GLKView

@property (assign, nonatomic) IBInspectable UIColor *strokeColor;
@property (assign, nonatomic) BOOL hasSignature;
@property (strong, nonatomic) UIImage *signatureImage;

- (void)erase;

@end

Make stroke color an IBInspectable property.


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

// angleutils.h: Common ANGLE utilities.

#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_

// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

template <typename T, unsigned int N>
inline unsigned int ArraySize(T(&)[N])
{
    return N;
}

#if defined(_MSC_VER)
#define snprintf _snprintf
#endif

#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE

#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD

#endif // COMMON_ANGLEUTILS_H_

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

// angleutils.h: Common ANGLE utilities.

#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_

// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  void operator=(const TypeName&)

template <typename T, unsigned int N>
inline unsigned int ArraySize(T(&)[N])
{
    return N;
}

template <typename T, unsigned int N>
void SafeRelease(T (&resourceBlock)[N])
{
    for (unsigned int i = 0; i < N; i++)
    {
        SafeRelease(resourceBlock[i]);
    }
}

template <typename T>
void SafeRelease(T& resource)
{
    if (resource)
    {
        resource->Release();
        resource = NULL;
    }
}

#if defined(_MSC_VER)
#define snprintf _snprintf
#endif

#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE

#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD

#endif // COMMON_ANGLEUTILS_H_

Add helper functions to safely release Windows COM resources, and arrays of COM resources.

TRAC #22656

Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Author: Jamie Madill

git-svn-id: 2a1ef23f1c4b6a1dbccd5f9514022461535c55c0@2014 736b8ea6-26fd-11df-bfd4-992fa37f6226


#ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_

#define array_malloc(size) calloc(1, (size))
#define array_free free

#include <stdint.h>

#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });

#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[index] = value)
#endif

#define _lang_array__Array_free(array) { array_free(array.data); }

typedef struct {
    size_t length;
    void* data;
} _lang_array__Array;

#endif

#ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_

#define array_malloc(size) calloc(1, (size))
#define array_free free

#include <stdint.h>

#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });

#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[index] = value)
#endif

#define _lang_array__Array_free(array) { array_free(array.data); array.data = NULL; array.length = 0; }

typedef struct {
    size_t length;
    void* data;
} _lang_array__Array;

#endif

Set pointer to array data to null after free


// RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s

// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32

#include <stdio.h>
int main() {
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile char buf[2];
  fputs(stderr, "before sprintf");
  sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
  fputs(stderr, "after sprintf");
  fputs(stderr, (const char *)buf);
  return 0;
  // Check that size of output buffer is sanitized.
  // CHECK-ON: before sprintf
  // CHECK-ON-NOT: after sprintf
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
}

// RUN: %clang_asan -O2 %s -o %t
// RUN: %env_asan_opts=check_printf=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s

// FIXME: sprintf is not intercepted on Windows yet.
// XFAIL: win32

#include <stdio.h>
int main() {
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile char buf[2];
  fputs("before sprintf\n", stderr);
  sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
  fputs("after sprintf", stderr);
  fputs((const char *)buf, stderr);
  return 0;
  // Check that size of output buffer is sanitized.
  // CHECK-ON: before sprintf
  // CHECK-ON-NOT: after sprintf
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
}

Fix order of arguments to fputs

Fix order of arguments to fputs

This time actually tested on Linux, where the test is not XFAILed.

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


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/config/helper/configfetcher.h>
#include <vespa/config/subscription/configuri.h>
#include <vespa/config-stateserver.h>

namespace vespalib {
    class HealthProducer;
    class MetricsProducer;
    class ComponentConfigProducer;
    class StateServer;
}
namespace slobrok {

class ReconfigurableStateServer : private config::IFetcherCallback<vespa::config::core::StateserverConfig> {
public:
    ReconfigurableStateServer(const config::ConfigUri & configUri,
                              vespalib::HealthProducer & healt,
                              vespalib::MetricsProducer & metrics,
                              vespalib::ComponentConfigProducer & component);
    ~ReconfigurableStateServer();
private:
    void configure(std::unique_ptr<vespa::config::core::StateserverConfig> config) override;
    vespalib::HealthProducer               & _health;
    vespalib::MetricsProducer              & _metrics;
    vespalib::ComponentConfigProducer      & _components;
    std::unique_ptr<config::ConfigFetcher>   _configFetcher;
    std::unique_ptr<vespalib::StateServer>   _server;
};

}

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/config/helper/configfetcher.h>
#include <vespa/config/subscription/configuri.h>
#include <vespa/config-stateserver.h>

namespace vespalib {
    struct HealthProducer;
    struct MetricsProducer;
    struct ComponentConfigProducer;
    class StateServer;
}
namespace slobrok {

class ReconfigurableStateServer : private config::IFetcherCallback<vespa::config::core::StateserverConfig> {
public:
    ReconfigurableStateServer(const config::ConfigUri & configUri,
                              vespalib::HealthProducer & healt,
                              vespalib::MetricsProducer & metrics,
                              vespalib::ComponentConfigProducer & component);
    ~ReconfigurableStateServer();
private:
    void configure(std::unique_ptr<vespa::config::core::StateserverConfig> config) override;
    vespalib::HealthProducer               & _health;
    vespalib::MetricsProducer              & _metrics;
    vespalib::ComponentConfigProducer      & _components;
    std::unique_ptr<config::ConfigFetcher>   _configFetcher;
    std::unique_ptr<vespalib::StateServer>   _server;
};

}

Adjust forward declarations in slobrok.

Adjust forward declarations in slobrok.


#ifndef _NPY_ARRAY_CONVERT_DATATYPE_H_
#define _NPY_ARRAY_CONVERT_DATATYPE_H_

NPY_NO_EXPORT PyObject *
PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran);

#endif

#ifndef _NPY_ARRAY_CONVERT_DATATYPE_H_
#define _NPY_ARRAY_CONVERT_DATATYPE_H_

NPY_NO_EXPORT PyObject *
PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran);

NPY_NO_EXPORT int
PyArray_CastTo(PyArrayObject *out, PyArrayObject *mp);

NPY_NO_EXPORT PyArray_VectorUnaryFunc *
PyArray_GetCastFunc(PyArray_Descr *descr, int type_num);

NPY_NO_EXPORT int
PyArray_CanCastSafely(int fromtype, int totype);

NPY_NO_EXPORT Bool
PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to);

NPY_NO_EXPORT int
PyArray_ObjectType(PyObject *op, int minimum_type);

NPY_NO_EXPORT PyArrayObject **
PyArray_ConvertToCommonType(PyObject *op, int *retn);

NPY_NO_EXPORT int
PyArray_ValidType(int type);

#endif

Add API for datatype conversion.

Add API for datatype conversion.


#pragma once

#include <spotify/json.hpp>

#include <noise/noise.h>

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<noise::NoiseQuality>
{
    using NoiseQuality = noise::NoiseQuality;
    static codec::enumeration_t<NoiseQuality, codec::string_t> codec()
    {
        auto codec = codec::enumeration<NoiseQuality, std::string>({
            {NoiseQuality::QUALITY_FAST, "Fast"},
            {NoiseQuality::QUALITY_STD, "Standard"},
            {NoiseQuality::QUALITY_BEST, "Best"}
        });

        return codec;
    }
};

}
}

#pragma once

#include <spotify/json.hpp>

#include <noise/noise.h>

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<noise::NoiseQuality>
{
    using NoiseQuality = noise::NoiseQuality;
    static codec::one_of_t<
        codec::enumeration_t<NoiseQuality, codec::number_t<int>>,
        codec::enumeration_t<NoiseQuality, codec::string_t>> codec()
    {
        auto codec_str = codec::enumeration<NoiseQuality, std::string>({
            {NoiseQuality::QUALITY_FAST, "Fast"},
            {NoiseQuality::QUALITY_STD, "Standard"},
            {NoiseQuality::QUALITY_BEST, "Best"}
        });
        auto codec_int = codec::enumeration<NoiseQuality, int>({
            {NoiseQuality::QUALITY_FAST, 0},
            {NoiseQuality::QUALITY_STD, 1},
            {NoiseQuality::QUALITY_BEST, 2}
        });
        return codec::one_of(codec_int, codec_str);
    }
};

}
}

Allow specification of NoiseQuality with an int