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

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

Update Skia milestone to 102

Update Skia milestone to 102

Change-Id: Ie332216b5338b1538de9ef07a34a28854c7c805a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522137
Reviewed-by: Kevin Lubick <7cdab2cfab351f23814786ba39716e90eed69047@google.com>


// Defines the generic Parser interface for the Casper parser generator library.
//
#ifndef HITTOP_PARSER_PARSER_H
#define HITTOP_PARSER_PARSER_H

#include "hittop/parser/parse_error.h"

#include "hittop/util/fallible.h"

namespace hittop {
namespace parser {

using util::Fallible;

/// The form of a Parser class.  There is no generic implementation of Parser,
/// only partial and full specializations that define how to parse specific
/// grammars.
template <typename Grammar> class Parser;

/// Convenience wrapper around defining a new Parser object and invoking it on
/// the given input range.  Allows the invocation operator defined on
/// Parser<Grammer> to be non-const, as the parser instance created within this
/// function is itself non-const.
template <typename Grammar, typename Range>
auto Parse(const Range &input)
    -> decltype(std::declval<Parser<Grammar>>()(input)) {
  Parser<Grammar> parser;
  return parser(input);
}

} // namespace parser
} // namespace hittop

#endif // HITTOP_PARSER_PARSER_H

// Defines the generic Parser interface for the Casper parser generator library.
//
#ifndef HITTOP_PARSER_PARSER_H
#define HITTOP_PARSER_PARSER_H

#include "boost/range/as_literal.hpp"

#include "hittop/parser/parse_error.h"

#include "hittop/util/fallible.h"

namespace hittop {
namespace parser {

using util::Fallible;

/// The form of a Parser class.  There is no generic implementation of Parser,
/// only partial and full specializations that define how to parse specific
/// grammars.
template <typename Grammar> class Parser;

/// Convenience wrapper around defining a new Parser object and invoking it on
/// the given input range.  Allows the invocation operator defined on
/// Parser<Grammer> to be non-const, as the parser instance created within this
/// function is itself non-const.
template <typename Grammar, typename Range>
auto Parse(const Range &input)
    -> decltype(std::declval<Parser<Grammar>>()(input)) {
  Parser<Grammar> parser;
  return parser(input);
}

/// Convenience function that parsers a C string as a literal character range.
template <typename Grammar>
auto Parse(const char *input)
    -> decltype(Parse<Grammar>(boost::as_literal(input))) {
  return Parse<Grammar>(boost::as_literal(input));
}

} // namespace parser
} // namespace hittop

#endif // HITTOP_PARSER_PARSER_H

Add convenience overload of Parse that accepts c-string literals


// RUN: %ocheck 3 %s

g()
{
	return 3;
}

main()
{
	if(0){
		f(); // shouldn't hit a linker error here - dead code
a:
		return g();
	}

	goto a;
}

// RUN: %ocheck 3 %s -g
// test debug emission too

g()
{
	return 3;
}

main()
{
	if(0){
		int i;
		f(); // shouldn't hit a linker error here - dead code
a:
		i = 2;
		return g(i);
	}

	goto a;
}

Test debug label emission with local variables


#ifndef ROOT_RVersion
#define ROOT_RVersion

/* Version information automatically generated by installer. */

/*
 * These macros can be used in the following way:
 *
 *    #if ROOT_VERSION_CODE >= ROOT_VERSION(2,23,4)
 *       #include <newheader.h>
 *    #else
 *       #include <oldheader.h>
 *    #endif
 *
*/

#define ROOT_RELEASE "5.34/22"
#define ROOT_RELEASE_DATE "Oct 10 2014"
#define ROOT_RELEASE_TIME "15:29:14"
#define ROOT_SVN_REVISION 49361
#define ROOT_GIT_COMMIT "v5-34-21-104-gf821c17"
#define ROOT_GIT_BRANCH "heads/v5-34-00-patches"
#define ROOT_VERSION_CODE 336406
#define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

#endif

#ifndef ROOT_RVersion
#define ROOT_RVersion

/* Version information automatically generated by installer. */

/*
 * These macros can be used in the following way:
 *
 *    #if ROOT_VERSION_CODE >= ROOT_VERSION(2,23,4)
 *       #include <newheader.h>
 *    #else
 *       #include <oldheader.h>
 *    #endif
 *
*/

#define ROOT_RELEASE "5.34/23"
#define ROOT_RELEASE_DATE "Nov  7 2014"
#define ROOT_RELEASE_TIME "15:06:58"
#define ROOT_SVN_REVISION 49361
#define ROOT_GIT_COMMIT "v5-34-22-106-g4a0dea3"
#define ROOT_GIT_BRANCH "heads/v5-34-00-patches"
#define ROOT_VERSION_CODE 336407
#define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

#endif

Update ROOT version files to v5.34/23.

Update ROOT version files to v5.34/23.


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

EAPI E_Config_Dialog *e_int_config_theme(E_Container *con, const char *params __UNUSED__);

EAPI void             e_int_config_theme_import_done(E_Config_Dialog *dia);
EAPI void             e_int_config_theme_update(E_Config_Dialog *dia, char *file);

#endif
#endif

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

EAPI E_Config_Dialog *e_int_config_theme(E_Container *con, const char *params __UNUSED__);

EAPI void             e_int_config_theme_import_done(E_Config_Dialog *dia);
EAPI void             e_int_config_theme_update(E_Config_Dialog *dia, char *file);
EAPI void             e_int_config_theme_web_done(E_Config_Dialog *dia);

#endif
#endif

Declare public function in header.

Declare public function in header.

SVN revision: 35475


#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
}

Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_ZERO


#ifndef PHYSICAL_ALLOCATOR_H
#define PHYSICAL_ALLOCATOR_H

typedef uint32_t page_frame_t;

#define PAGE_FRAME_CACHE_SIZE 32
#define PAGE_FRAME_MAP_SIZE (PHYS_MEMORY_SIZE/8/PAGE_SIZE)

// Linear search of page frame bitmap
page_frame_t alloc_frame_helper();

void free_frame(page_frame_t frame);

page_frame_t alloc_frame();

void use_frame(page_frame_t frame);

#endif

#ifndef PHYSICAL_ALLOCATOR_H
#define PHYSICAL_ALLOCATOR_H

#include <stdint.h>
#include <stddef.h>
#include <libk/kabort.h>
#include <libk/kassert.h>
#include <libk/kputs.h>

#ifdef ARCH_X86
#include <arch/x86/memlayout.h>
#endif

#ifdef ARCH_USERLAND
#include "tests/memlayout.h"
#endif

typedef uint32_t page_frame_t;

#define BIT_INDEX(x) (1 << ((x) % 8))
#define BYTE_INDEX(x) ((x)/8)
#define PAGE_FRAME_CACHE_SIZE 32
#define PAGE_FRAME_MAP_SIZE (PHYS_MEMORY_SIZE/8/PAGE_SIZE)

// Linear search of page frame bitmap
page_frame_t alloc_frame_helper();

void free_frame(page_frame_t frame);

page_frame_t alloc_frame();

void use_frame(page_frame_t frame);

#endif

Create macros for certain repetitive shifts


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

#include <windows.h>

int CALLBACK
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    RaiseException(100, EXCEPTION_NONCONTINUABLE, 0, NULL);

    return 0;
}

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

#include <windows.h>

int CALLBACK
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    RaiseException(0xE0000001, EXCEPTION_NONCONTINUABLE, 0, NULL);

    return 0;
}

Use a better custom exception code.

test/apps: Use a better custom exception code.


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

static NSString *const _Nonnull kGADMAdapterVungleVersion = @"6.7.0.0-early2";
static NSString *const _Nonnull kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const _Nonnull kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const _Nonnull kGADMAdapterVungleErrorDomain = @"com.google.mediation.vungle";

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

static NSString *const _Nonnull kGADMAdapterVungleVersion = @"6.7.0.0";
static NSString *const _Nonnull kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const _Nonnull kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const _Nonnull kGADMAdapterVungleErrorDomain = @"com.google.mediation.vungle";

Update version number to 6.7.0.0

Update version number to 6.7.0.0


/*
 * Copyright (c) 2017 Contributors as noted in the AUTHORS file
 *
 * This file is part of Solo5, a unikernel base layer.
 *
 * Permission to use, copy, modify, and/or distribute this software
 * for any purpose with or without fee is hereby granted, provided
 * that the above copyright notice and this permission notice appear
 * in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "../kernel.h"

/* ukvm block interface */
int solo5_blk_write_sync(uint64_t sec __attribute__((unused)),
                         uint8_t *data __attribute__((unused)),
                         int n __attribute__((unused)))
{
    return -1;
}

int solo5_blk_read_sync(uint64_t sec __attribute__((unused)),
                        uint8_t *data __attribute__((unused)),
                        int *n __attribute__((unused)))
{
    return -1;
}

int solo5_blk_sector_size(void)
{
    return -1;
}

uint64_t solo5_blk_sectors(void)
{
    return 0;
}

int solo5_blk_rw(void)
{
    return -1;
}

Add dummy block implementation for Muen

Add dummy block implementation for Muen

For now there is no support for block devices on the Muen platform.


// PARAM: --set ana.activated[+] "'var_eq'"
// Copy of 04/45 with var_eq enabled
// octApron needs to be included again and fixed
#include <pthread.h>
#include <stdio.h>

pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int *p = (int *) arg;
  pthread_mutex_lock(&mutex1);
  (*p)++;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

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

// PARAM: --set ana.activated[+] "'var_eq'"
// Copy of 04/45 with var_eq enabled
#include <pthread.h>
#include <stdio.h>

pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int *p = (int *) arg;
  pthread_mutex_lock(&mutex1);
  (*p)++;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

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

Remove outdated octApron comment from 06/24


// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify %s
// PR6913

#include <stdio.h>

int main()
{
   int x[10][10];
   int (*p)[] = x;

   int i;

   for(i = 0; i < 10; ++i)
   {
       p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}}
   }
}

// rdar://13705391
void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}

// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
// PR6913

int main()
{
   int x[10][10];
   int (*p)[] = x;

   int i;

   for(i = 0; i < 10; ++i)
   {
       p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}}
   }
}

// rdar://13705391
void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}

Remove an old stdio.h include from the invalid-array test

This should get it up and running on win and other builders without system
headers.

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


/*
 * File:   executeStage.h
 * Author: Alex Savarda
 */

#define INSTR_COUNT     16   // Possible size of the instruction set

#ifndef EXECUTESTAGE_H
#define	EXECUTESTAGE_H

typedef struct {
    unsigned int stat;
    unsigned int icode;
    unsigned int ifun;
    unsigned int valC;
    unsigned int valA;
    unsigned int valB;
    unsigned int dstE;
    unsigned int dstM;
    unsigned int srcA;
    unsigned int srcB;
} eregister;

struct E {
    unsigned int stat;
    unsigned int icode;
    unsigned int ifun;
    unsigned int valC;
    unsigned int valA;
    unsigned int valB;
    unsigned int dstE;
    unsigned int dstM;
    unsigned int srcA;
    unsigned int srcB;
};

// Function prototypes
eregister getEregister(void);
void clearEregister(void);
void executeStage();
void initFuncPtrArray(void);
void updateEregister(unsigned int stat, unsigned int icode, unsigned int ifun,
                     unsigned int valC, unsigned int valA, unsigned int valB,
                     unsigned int dstE, unsigned int dstM, unsigned int srcA,
                     unsigned int srcB);
#endif	/* EXECUTESTAGE_H */

Convert a tab into a space

Convert a tab into a space


/* This is main header file that is ought to be included as library */

//Include proper header files
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>

#include "parser.h"

//Function prototypes
extern uint16_t MODBUSSwapEndian( uint16_t );
extern uint16_t MODBUSCRC16( uint16_t *, uint16_t );

/* This is main header file that is ought to be included as library */

//Include proper header files
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>

//Function prototypes
extern uint16_t MODBUSSwapEndian( uint16_t );
extern uint16_t MODBUSCRC16( uint8_t *, uint16_t );

Remove inclusion of 'parser.h' and fix pointer type


#include "Components.h"

class HealthComponent : public HealthComponentBase {
public:
    HealthComponent(Entity* entity, int maxHealth, int startHealth, const int& Health): HealthComponentBase(entity, maxHealth, startHealth, Health) {
    }

    void OnHeal(int amount) {
    }
    void OnDamage(int amount) {
    }
    void AttribHealth(int health) {
    }
};
class MonsterDieComponent : public MonsterDieComponentBase {
public:
    MonsterDieComponent(Entity* entity): MonsterDieComponentBase(entity) {
    }

    void OnDie() {
    }
};

#include "Components.h"

class HealthComponent : public HealthComponentBase {
public:
    HealthComponent(Entity* entity, int maxHealth, int startHealth, const int& Health): HealthComponentBase(entity, maxHealth, startHealth, Health) {
    }

    void HandleHeal(int amount) {
    }
    void HandleDamage(int amount) {
    }
    void AttribHealth(int health) {
    }
};
class MonsterDieComponent : public MonsterDieComponentBase {
public:
    MonsterDieComponent(Entity* entity): MonsterDieComponentBase(entity) {
    }

    void HandleDie() {
    }
};

Fix the small test to use Handle instead of On


#include <stdio.h>

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

  //create two arrays we care about
  int ages[] = {23,55,15,34,78,12};
  char *names[] = {
    "Feinb", "Fhilp", "Wastan", "Wustak","Henris","Abkar"
  };

  //safely get the size of ages
  int count = sizeof(ages) / sizeof(int);

  int i = 0;

  //first way using indexing
  for(i = 0; i < count; i++){
    printf("%s had lived for %d years.\n", names[i], ages[i]);
  }

  printf("---\n");

  return 0;
}

#include <stdio.h>

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

  //create two arrays we care about
  int ages[] = {23,55,15,34,78,12};
  char *names[] = {
    "Feinb", "Fhilp", "Wastan", "Wustak","Henris","Abkar"
  };

  //safely get the size of ages
  int count = sizeof(ages) / sizeof(int);

  int i = 0;

  //first way using indexing
  for(i = 0; i < count; i++){
    printf("%s has lived for %d years.\n", names[i], ages[i]);
  }

  printf("---\n");

  //setup pointers to the start of the arrays
  int *cur_age = ages;
  char **cur_name = names;

  // second way using pointers
  for(i = 0; i < count; i++){
    printf("%s is %d years old.\n",
      *(cur_name+i), *(cur_age+i));
  }

  printf("---\n");

  return 0;
}

Use pointers to start of arrays

Use pointers to start of arrays


#ifndef IFILE_H
#define IFILE_H

#include <vector>
#include <memory>

#include "IMediaLibrary.h"
#include "ITrackInformation.h"

class IAlbumTrack;
class IShowEpisode;
class ITrackInformation;

class IFile
{
    public:
        enum Type
        {
            VideoType, // Any video file, not being a tv show episode
            AudioType, // Any kind of audio file, not being an album track
            ShowEpisodeType,
            AlbumTrackType,
            UnknownType,
        };
        virtual ~IFile() {}

        virtual unsigned int id() const = 0;
        virtual AlbumTrackPtr albumTrack() = 0;
        virtual bool setAlbumTrack(AlbumTrackPtr albumTrack ) = 0;
        virtual unsigned int duration() const = 0;
        virtual std::shared_ptr<IShowEpisode> showEpisode() = 0;
        virtual bool setShowEpisode( ShowEpisodePtr showEpisode ) = 0;
        virtual int playCount() const = 0;
        virtual const std::string& mrl() const = 0;
        virtual bool addLabel( LabelPtr label ) = 0;
        virtual bool removeLabel( LabelPtr label ) = 0;
        virtual MoviePtr movie() = 0;
        virtual bool setMovie( MoviePtr movie ) = 0;
        virtual std::vector<std::shared_ptr<ILabel> > labels() = 0;
};

#endif // IFILE_H

#ifndef IFILE_H
#define IFILE_H

#include <vector>
#include <memory>

#include "IMediaLibrary.h"
#include "ITrackInformation.h"

class IAlbumTrack;
class IShowEpisode;
class ITrackInformation;

class IFile
{
    public:
        enum Type
        {
            VideoType, // Any video file, not being a tv show episode
            AudioType, // Any kind of audio file, not being an album track
            ShowEpisodeType,
            AlbumTrackType,
            UnknownType
        };
        virtual ~IFile() {}

        virtual unsigned int id() const = 0;
        virtual AlbumTrackPtr albumTrack() = 0;
        virtual bool setAlbumTrack(AlbumTrackPtr albumTrack ) = 0;
        virtual unsigned int duration() const = 0;
        virtual std::shared_ptr<IShowEpisode> showEpisode() = 0;
        virtual bool setShowEpisode( ShowEpisodePtr showEpisode ) = 0;
        virtual int playCount() const = 0;
        virtual const std::string& mrl() const = 0;
        virtual bool addLabel( LabelPtr label ) = 0;
        virtual bool removeLabel( LabelPtr label ) = 0;
        virtual MoviePtr movie() = 0;
        virtual bool setMovie( MoviePtr movie ) = 0;
        virtual std::vector<std::shared_ptr<ILabel> > labels() = 0;
};

#endif // IFILE_H

Fix a warning with -pedantic on some old gcc versions


/*
 *  Copyright (c) 2011 The WebRTC 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 in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/******************************************************************

 iLBC Speech Coder ANSI-C Source Code

 WebRtcIlbcfix_NearestNeighbor.c

******************************************************************/

#include "defines.h"

void WebRtcIlbcfix_NearestNeighbor(size_t* index,
                                   const size_t* array,
                                   size_t value,
                                   size_t arlength) {
  size_t min_diff = (size_t)-1;
  for (size_t i = 0; i < arlength; i++) {
    const size_t diff =
        (array[i] < value) ? (value - array[i]) : (array[i] - value);
    if (diff < min_diff) {
      *index = i;
      min_diff = diff;
    }
  }
}

/*
 *  Copyright (c) 2011 The WebRTC 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 in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/******************************************************************

 iLBC Speech Coder ANSI-C Source Code

 WebRtcIlbcfix_NearestNeighbor.c

******************************************************************/

#include "defines.h"

void WebRtcIlbcfix_NearestNeighbor(size_t* index,
                                   const size_t* array,
                                   size_t value,
                                   size_t arlength) {
  size_t i;
  size_t min_diff = (size_t)-1;
  for (i = 0; i < arlength; i++) {
    const size_t diff =
        (array[i] < value) ? (value - array[i]) : (array[i] - value);
    if (diff < min_diff) {
      *index = i;
      min_diff = diff;
    }
  }
}

Fix ChromeOS build (C99 break)

Fix ChromeOS build (C99 break)

BUG=5016
TBR=henrik.lundin@webrtc.org

Review URL: https://codereview.webrtc.org/1354163002

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


/*
 * chewing-compat.h
 *
 * Copyright (c) 2014
 *      libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

#ifndef _CHEWING_COMPAT_
#define _CHEWING_COMPAT_

/** @brief indicate the internal encoding of data processing.
 *  @since 0.3.0
 */
#define LIBCHEWING_ENCODING "UTF-8"

/* deprecated function. for API compatibility */
CHEWING_API int chewing_zuin_Check(ChewingContext *ctx) DEPRECATED_FOR(chewing_bopomofo_Check);
CHEWING_API char *chewing_zuin_String(ChewingContext *,
                                      int *zuin_count) DEPRECATED_FOR(chewing_bopomofo_String_static);

CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath) DEPRECATED;
CHEWING_API void chewing_Terminate() DEPRECATED;
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd) DEPRECATED_FOR(chewing_set_*);
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode) DEPRECATED_FOR(chewing_set_selKey);
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx) DEPRECATED_FOR(chewing_get_selKey);

#endif

/*
 * chewing-compat.h
 *
 * Copyright (c) 2014
 *      libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

/* *INDENT-OFF* */
#ifndef _CHEWING_COMPAT_
#define _CHEWING_COMPAT_
/* *INDENT-ON* */

/** @brief indicate the internal encoding of data processing.
 *  @since 0.3.0
 */
#define LIBCHEWING_ENCODING "UTF-8"

/* deprecated function. for API compatibility */
CHEWING_API int chewing_zuin_Check(ChewingContext *ctx) DEPRECATED_FOR(chewing_bopomofo_Check);
CHEWING_API char *chewing_zuin_String(ChewingContext *,
                                      int *zuin_count) DEPRECATED_FOR(chewing_bopomofo_String_static);

CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath) DEPRECATED;
CHEWING_API void chewing_Terminate() DEPRECATED;
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd) DEPRECATED_FOR(chewing_set_*);
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode) DEPRECATED_FOR(chewing_set_selKey);
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx) DEPRECATED_FOR(chewing_get_selKey);

/* *INDENT-OFF* */
#endif
/* *INDENT-ON* */

Add indent comment for header guard

Add indent comment for header guard


#include <stdio.h>

typedef struct {
    int hands[2][2];
    int turn;
} Sticks;

void sticks_create(Sticks *sticks) {
    sticks->hands[0][0] = 1;
    sticks->hands[0][1] = 1;
    sticks->hands[1][0] = 1;
    sticks->hands[1][1] = 1;
    sticks->turn = 0;
}

void sticks_play(Sticks *sticks, int actor, int target) {
    sticks->hands[!sticks->turn][target] += sticks->hands[sticks->turn][actor];
    sticks->turn = !sticks->turn;
}

int main(void) {
    Sticks sticks;
    sticks_create(&sticks);
    printf("%d\n", sticks.hands[0][0]);
    printf("%d\n", sticks.turn);
    sticks_play(&sticks, 0, 1);
    printf("%d\n", sticks.hands[1][1]);
    printf("%d\n", sticks.turn);
}

#include <stdio.h>

typedef struct {
    int hands[2][2];
    int turn;
} Sticks;

void sticks_create(Sticks *sticks) {
    sticks->hands[0][0] = 1;
    sticks->hands[0][1] = 1;
    sticks->hands[1][0] = 1;
    sticks->hands[1][1] = 1;
    sticks->turn = 0;
}

void sticks_play(Sticks *sticks, int actor, int target) {
    sticks->hands[!sticks->turn][target] += sticks->hands[sticks->turn][actor];
    if (sticks->hands[!sticks->turn][target] >= 5) {
        sticks->hands[!sticks->turn][target] = 0;
    }
    sticks->turn = !sticks->turn;
}

int main(void) {
    Sticks sticks;
    sticks_create(&sticks);
    printf("%d\n", sticks.hands[0][0]);
    printf("%d\n", sticks.turn);
    sticks_play(&sticks, 0, 1);
    printf("%d\n", sticks.hands[1][1]);
    printf("%d\n", sticks.turn);
}

Kill hands that reach five fingers

Kill hands that reach five fingers


// Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)

#pragma once

class VolumeTransformation;

class VolumeController {
public:
    struct DeviceInfo {
        std::wstring name;
        std::wstring id;
    };

    /// <summary>
    /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
    /// </summary>
    virtual float Volume() = 0;

    /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
    virtual void Volume(float vol) = 0;

    virtual bool Muted() = 0;
    virtual void Muted(bool mute) = 0;
    virtual void ToggleMute() {
        (Muted() == true) ? Muted(false) : Muted(true);
    }

    virtual void AddTransformation(VolumeTransformation *transform) = 0;
    virtual void RemoveTransformation(VolumeTransformation *transform) = 0;

public:
    static const int MSG_VOL_CHNG = WM_APP + 1080;
    static const int MSG_VOL_DEVCHNG = WM_APP + 1081;

};

// Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)

#pragma once

class VolumeTransformation;

class VolumeController {
public:
    struct DeviceInfo {
        std::wstring name;
        std::wstring id;
    };

    /// <summary>
    /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
    /// </summary>
    virtual float Volume() = 0;

    /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
    virtual void Volume(float vol) = 0;

    virtual bool Muted() = 0;
    virtual void Muted(bool mute) = 0;
    virtual void ToggleMute() {
        (Muted() == true) ? Muted(false) : Muted(true);
    }

    virtual void Enabled() = 0;

    virtual void AddTransformation(VolumeTransformation *transform) = 0;
    virtual void RemoveTransformation(VolumeTransformation *transform) = 0;

public:
    static const int MSG_VOL_CHNG = WM_APP + 1080;
    static const int MSG_VOL_DEVCHNG = WM_APP + 1081;

};

Add method to check audio device state

Add method to check audio device state


// PARAM: --enable ana.int.interval
// Copied & modified from 13/24.
#include <pthread.h>
#include <assert.h>

int g2;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t __global_lock = PTHREAD_MUTEX_INITIALIZER;

void *t2_fun(void *arg) {
  pthread_mutex_lock(&mutex2);
  pthread_mutex_lock(&__global_lock);
  g2++;
  pthread_mutex_unlock(&__global_lock); // Write Mine influence: [[g2, __global_lock], t2_fun, {mutex2}] -> 1
  pthread_mutex_lock(&__global_lock);
  g2--;
  pthread_mutex_unlock(&__global_lock); // Write Mine influence: [[g2, __global_lock], t2_fun, {mutex2}] -> 0
  pthread_mutex_unlock(&mutex2);
  return NULL;
}

int main(void) {
  pthread_t id2;
  pthread_create(&id2, NULL, t2_fun, NULL);

  pthread_mutex_lock(&mutex1);
  pthread_mutex_lock(&__global_lock); // Read & join to g2 Mine influence: [[g2, __global_lock], t2_fun, {mutex2}] -> (0 join 1 = Unknown)
  assert(0 <= g2); // TODO (widening)
  assert(g2 <= 1);
  pthread_mutex_unlock(&__global_lock);

  pthread_mutex_lock(&mutex2);
  pthread_mutex_lock(&__global_lock);
  assert(g2 == 0);
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_unlock(&mutex2);

  pthread_mutex_unlock(&mutex1);

  pthread_join(id2, NULL);
  return 0;
}

Add Vesal's version of 13/24 where mutex-oplus and mutex-meet are more precise than old and mine


#import "AsyncActualValue.h"

namespace CedarAsync {
    template<typename T>
    struct InTimeMarker {
        T(^actualExpression)(void);
        const char *fileName;
        int lineNumber;
    };

    template<typename T>
    const AsyncActualValue<T> operator,(const InTimeMarker<T> & marker, const Cedar::Matchers::ActualValueMarker & _) {
        return AsyncActualValue<T>(marker.fileName, marker.lineNumber, marker.actualExpression);
    }

    template<typename T>
    const AsyncActualValueMatchProxy<T> operator,(const AsyncActualValue<T> & actualValue, bool negate) {
        return negate ? actualValue.to_not : actualValue.to;
    }

    template<typename T, typename MatcherType>
    void operator,(const AsyncActualValueMatchProxy<T> & matchProxy, const MatcherType & matcher) {
        matchProxy(matcher);
    }
}

#ifndef CEDAR_ASYNC_DISALLOW_IN_TIME
#define in_time(x) (InTimeMarker<typeof(x)>){^{return x;}, __FILE__, __LINE__}
#endif

#import "AsyncActualValue.h"

namespace CedarAsync {
    template<typename T>
    struct InTimeMarker {
        T(^actualExpression)(void);
        const char *fileName;
        int lineNumber;
    };

    template<typename T>
    const AsyncActualValue<T> operator,(const InTimeMarker<T> & marker, const Cedar::Matchers::ActualValueMarker & _) {
        return AsyncActualValue<T>(marker.fileName, marker.lineNumber, marker.actualExpression);
    }

    template<typename T>
    const AsyncActualValueMatchProxy<T> operator,(const AsyncActualValue<T> & actualValue, bool negate) {
        return negate ? actualValue.to_not : actualValue.to;
    }

    template<typename T, typename MatcherType>
    void operator,(const AsyncActualValueMatchProxy<T> & matchProxy, const MatcherType & matcher) {
        matchProxy(matcher);
    }
}

#ifndef CEDAR_ASYNC_DISALLOW_IN_TIME
#define in_time(x) (InTimeMarker<__typeof__(x)>){^{return x;}, __FILE__, __LINE__}
#endif

Use __typeof__ since typeof is unavailable in our build


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

#ifndef SSL_PRIVATE_H
#define SSL_PRIVATE_H

/* OpenSSL headers */
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/x509v3.h>
/* Avoid tripping over an engine build installed globally and detected
 * when the user points at an explicit non-engine flavor of OpenSSL
 */
#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
#include <openssl/engine.h>
#endif

#endif /* SSL_PRIVATE_H */

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

#ifndef SSL_PRIVATE_H
#define SSL_PRIVATE_H

/* OpenSSL headers */
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/x509v3.h>
/* Avoid tripping over an engine build installed globally and detected
 * when the user points at an explicit non-engine flavor of OpenSSL
 */
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif

#endif /* SSL_PRIVATE_H */

Use OpenSSL engine by default.

Use OpenSSL engine by default.

git-svn-id: b819289d3a0e8888cd070d2ae628b7cf730b797f@300663 13f79535-47bb-0310-9956-ffa450edef68


#pragma once

#include "onnx/onnx_pb.h"
#include "onnx/ir.h"

namespace onnx { namespace optimization {

enum class API_TYPE {
  PROTO, IR
};

struct OptimizePass {

  std::string name;
  API_TYPE type;

  explicit OptimizePass(const std::string name, API_TYPE type)
    : name(name), type(type) {
  }

  virtual void optimize(onnx::ModelProto& mp) {}

  virtual void optimize(Graph& graph) {}

};

}} // namespace onnx::optimization

#pragma once

#include "onnx/onnx_pb.h"
#include "onnx/ir.h"

namespace onnx { namespace optimization {

enum class API_TYPE {
  PROTO, IR
};

struct OptimizePass {

  std::string name;
  API_TYPE type;

  explicit OptimizePass(const std::string& name, API_TYPE type)
    : name(name), type(type) {
  }

  virtual void optimize(onnx::ModelProto& mp) {}

  virtual void optimize(Graph& graph) {}

};

}} // namespace onnx::optimization

Fix the constructor of OptimizePass

Fix the constructor of OptimizePass


#ifndef _AUTOMATON_H_
#define _AUTOMATON_H_

/*
 * type and function definitions for an automaton
 */

#include "event.h"
#include "srpc/srpc.h"

typedef struct automaton Automaton;

void          au_init(void);
Automaton     *au_create(char *program, RpcConnection rpc, char *ebuf);
int           au_destroy(unsigned long id);
void          au_publish(unsigned long id, Event *event);
unsigned long au_id(Automaton *au);
Automaton     *au_au(unsigned long id);
RpcConnection au_rpc(Automaton *au);

#endif /* _AUTOMATON_H_ */

#ifndef _AUTOMATON_H_
#define _AUTOMATON_H_
/*
 * Copyright (c) 2013, Court of the University of Glasgow
 * All rights reserved.

 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:

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

/*
 * type and function definitions for an automaton
 */

#include "event.h"
#include "srpc/srpc.h"

typedef struct automaton Automaton;

void          au_init(void);
Automaton     *au_create(char *program, RpcConnection rpc, char *ebuf);
int           au_destroy(unsigned long id);
void          au_publish(unsigned long id, Event *event);
unsigned long au_id(Automaton *au);
Automaton     *au_au(unsigned long id);
RpcConnection au_rpc(Automaton *au);

#endif /* _AUTOMATON_H_ */

Add BSD 3-clause open source header

Add BSD 3-clause open source header


#include "DefSoundDeviceState.h"
#include "AudioEndPointLibraryImpl.h"

// This class is exported from the AudioEndPointLibrary.dll
namespace AudioEndPoint {

    class AUDIOENDPOINTLIBRARY_API CAudioEndPointLibrary {
    public:
        ~CAudioEndPointLibrary();
        HRESULT OnDeviceStateChanged(LPCWSTR pwstr_device_id, DWORD dw_new_state) const;
        HRESULT OnDeviceAdded(LPCWSTR pwstr_device_id) const;
        HRESULT OnDeviceRemoved(LPCWSTR pwstr_device_id) const;
        HRESULT OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstr_default_device_id) const;
        static CAudioEndPointLibrary& GetInstance();
        AudioDeviceList GetPlaybackDevices(DefSound::EDeviceState state) const;
        AudioDeviceList GetRecordingDevices(DefSound::EDeviceState state) const;
        HRESULT RegisterNotificationClient() const;
        HRESULT UnRegisterNotificationClient() const;

        AudioEndPointLibrarySignals* m_signals1() const
        {
            return m_signals;
        }

        __declspec(property(get = m_signals1)) AudioEndPointLibrarySignals* Signals;

    private:
        CAudioEndPointLibrary(void);
        CAudioEndPointLibrary(CAudioEndPointLibrary const&) = delete;
        void operator=(CAudioEndPointLibrary const&) = delete;
        void Refresh() const;

        struct AudioEndPointLibraryImpl;
        struct AudioEndPointLibraryDevicesImpl;

        AudioEndPointLibraryImpl* m_container;
        AudioEndPointLibrarySignals* m_signals;
        AudioEndPointLibraryDevicesImpl* m_devices_lists;
    };

}

#include "DefSoundDeviceState.h"
#include "AudioEndPointLibraryImpl.h"

// This class is exported from the AudioEndPointLibrary.dll
namespace AudioEndPoint {

    class AUDIOENDPOINTLIBRARY_API CAudioEndPointLibrary {
    public:
        ~CAudioEndPointLibrary();
        HRESULT OnDeviceStateChanged(LPCWSTR pwstr_device_id, DWORD dw_new_state) const;
        HRESULT OnDeviceAdded(LPCWSTR pwstr_device_id) const;
        HRESULT OnDeviceRemoved(LPCWSTR pwstr_device_id) const;
        HRESULT OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstr_default_device_id) const;
        static CAudioEndPointLibrary& GetInstance();
        AudioDeviceList GetPlaybackDevices(DefSound::EDeviceState state) const;
        AudioDeviceList GetRecordingDevices(DefSound::EDeviceState state) const;

        AudioEndPointLibrarySignals* m_signals1() const
        {
            return m_signals;
        }

        __declspec(property(get = m_signals1)) AudioEndPointLibrarySignals* Signals;

    private:
        CAudioEndPointLibrary(void);
        CAudioEndPointLibrary(CAudioEndPointLibrary const&) = delete;
        void operator=(CAudioEndPointLibrary const&) = delete;
        void Refresh() const;
        HRESULT RegisterNotificationClient() const;
        HRESULT UnRegisterNotificationClient() const;

        struct AudioEndPointLibraryImpl;
        struct AudioEndPointLibraryDevicesImpl;

        AudioEndPointLibraryImpl* m_container;
        AudioEndPointLibrarySignals* m_signals;
        AudioEndPointLibraryDevicesImpl* m_devices_lists;
    };

}

Make the registering and unregistering of the Notification private


/* GTK - The GIMP Toolkit
 * Copyright (C) 2011 Chun-wei Fan <fanc999@yahoo.com.tw>
 *
 * Author: Chun-wei Fan <fanc999@yahoo.com.tw>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <math.h>

/* Workaround for round() for non-GCC/non-C99 compilers */
#ifndef HAVE_ROUND
static inline double
round (double x)
{
  if (x >= 0)
    return floor (x + 0.5);
  else
    return ceil (x - 0.5);
}
#endif

/* Workaround for rint() for non-GCC/non-C99 compilers */
#ifndef HAVE_RINT
static inline double
rint (double x)
{
  if (ceil (x + 0.5) == floor (x + 0.5))
  {
    int a;
    a = (int) ceil (x);
    if (a % 2 == 0)
      return ceil (x);
    else
      return floor (x);
  }
  else
  {
    if (x >= 0)
      return floor (x + 0.5);
    else
      return ceil (x - 0.5);
  }
}
#endif

Add fallback implemetation for rint()/round()

Add an implementation for rint() and round() for compilers that do not
define one or both of them.  Note that this file should be included
after config.h was included.


// RUN: %clang_cc1 "-triple" "x86_64-apple-darwin3.0.0-iphoneos" -fsyntax-only -verify %s

void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1)));
void f1(int) __attribute__((availability(ios,introduced=2.1)));
void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0)));
void f3(int) __attribute__((availability(ios,introduced=3.0)));
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}

void test() {
  f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
  f1(0);
  f2(0); // expected-warning{{'f2' is deprecated: first deprecated in iOS 3.0}}
  f3(0);
  f4(0); // expected-error{{f4' is unavailable: obsoleted in iOS 3.0}}
}

// RUN: %clang_cc1 "-triple" "x86_64-apple-darwin3.0.0-iphoneos" -fsyntax-only -verify %s

void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1)));
void f1(int) __attribute__((availability(ios,introduced=2.1)));
void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0)));
void f3(int) __attribute__((availability(ios,introduced=3.0)));
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}

void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0)));
void f6(int) __attribute__((availability(ios,deprecated=3.0)));
void f6(int) __attribute__((availability(ios,introduced=2.0)));

void test() {
  f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
  f1(0);
  f2(0); // expected-warning{{'f2' is deprecated: first deprecated in iOS 3.0}}
  f3(0);
  f4(0); // expected-error{{f4' is unavailable: obsoleted in iOS 3.0}}
  f5(0); // expected-warning{{'f5' is deprecated: first deprecated in iOS 3.0}}
  f6(0); // expected-warning{{'f6' is deprecated: first deprecated in iOS 3.0}}
}

Test attribute merging for the availability attribute.

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


#pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_

#include <unordered_map>
#include "../ds_task_typedefs.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	/// The constructor
	/// \param stask the serialized task the operation need to work with
	explicit IOperation(SerializedTask& stask);
	virtual ~IOperation();

	/// Executes the operation
	virtual void run() = 0;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_INTERNAL_OPERATION_H_

#pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATION_H_

#include <unordered_map>
#include "../ds_task_typedefs.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	/// The constructor
	/// \param stask the serialized task the operation need to work with
	explicit IOperation(SerializedTask& stask);
	virtual ~IOperation();

	/// Executes the operation
	virtual bool run() = 0;
protected:
	TaskId taskId;
	SerializedTask task;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_INTERNAL_OPERATION_H_

Change return value of run to bool

Change return value of run to bool

Conflicts:
	You-DataStore/internal/operation.h
	You-DataStore/internal/operations/post_operation.h


// Copyright (c) Sandeep Mistry. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#ifndef _BLE_LIMITS_H_
#define _BLE_LIMITS_H_

#include <stdlib.h>

#ifndef __AVR__

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

#endif

#if defined(NRF51) || defined(__RFduino__)

#define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH    26
#define BLE_SCAN_DATA_MAX_VALUE_LENGTH             29
#define BLE_EIR_DATA_MAX_VALUE_LENGTH              29
#define BLE_ATTRIBUTE_MAX_VALUE_LENGTH             20
#define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH      22

#else

#define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH    20
#define BLE_SCAN_DATA_MAX_VALUE_LENGTH             20
#define BLE_EIR_DATA_MAX_VALUE_LENGTH              20
#define BLE_ATTRIBUTE_MAX_VALUE_LENGTH             20
#define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH      22

#endif

#endif

// Copyright (c) Sandeep Mistry. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#ifndef _BLE_LIMITS_H_
#define _BLE_LIMITS_H_

#include <stdlib.h>

#ifndef __AVR__

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

#endif

#if defined(NRF51) || defined(NRF52) || defined(__RFduino__)

#define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH    26
#define BLE_SCAN_DATA_MAX_VALUE_LENGTH             29
#define BLE_EIR_DATA_MAX_VALUE_LENGTH              29
#define BLE_ATTRIBUTE_MAX_VALUE_LENGTH             20
#define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH      22

#else

#define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH    20
#define BLE_SCAN_DATA_MAX_VALUE_LENGTH             20
#define BLE_EIR_DATA_MAX_VALUE_LENGTH              20
#define BLE_ATTRIBUTE_MAX_VALUE_LENGTH             20
#define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH      22

#endif

#endif

Fix length issues with nRF52

Fix length issues with nRF52


/*
  This file is part of ethash.

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

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

  You should have received a copy of the GNU General Public License
  along with ethash.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file util.h
 * @author Tim Hughes <tim@twistedfury.com>
 * @date 2015
 */
#pragma once
#include <stdint.h>
#include "compiler.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _MSC_VER
void debugf(char const* str, ...);
#else
#define debugf printf
#endif

static inline uint32_t min_u32(uint32_t a, uint32_t b)
{
	return a < b ? a : b;
}

static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_)
{
	return x < min_ ? min_ : (x > max_ ? max_ : x);
}

#ifdef __cplusplus
}
#endif

/*
  This file is part of ethash.

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

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

  You should have received a copy of the GNU General Public License
  along with ethash.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file util.h
 * @author Tim Hughes <tim@twistedfury.com>
 * @date 2015
 */
#pragma once
#include <stdint.h>
#include "compiler.h"

#ifdef __cplusplus
extern "C" {
#endif

//#ifdef _MSC_VER
void debugf(char const* str, ...);
//#else
//#define debugf printf
//#endif

static inline uint32_t min_u32(uint32_t a, uint32_t b)
{
	return a < b ? a : b;
}

static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_)
{
	return x < min_ ? min_ : (x > max_ ? max_ : x);
}

#ifdef __cplusplus
}
#endif

Comment out conflicting debug macro

Comment out conflicting debug macro


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

float f(float x) {
    return 1/x;
}

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

    // Integral (1 to 6) of 1/x
    float integral;
    float a = 1, b = 6;
    int n = 2000;
    float h;
    float x;

    h = (b-a)/n;

    integral = (f(a) + f(b)) / 2.0;
    x = a;

    for (int i = 1; i <= n - 1; i++) {
        x = x + h;
        integral = integral + f(x);
    }

    integral = integral * h;

    float expected = 1.79175946923;
    printf("Integral (%.0f to %.0f) of 1/x \n\n", a, b);
    printf("Expected  result  = %.11f\n", expected);
    printf("Estimated result  = %.11f\n", integral);
    printf("                    -------------\n");

    float difference = expected - integral;
    difference = fabsf(difference); // absolute value (no minus sign)
    printf("Difference        = %.11f\n", difference);

    return 0;
}

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

double f(double x) { return 1 / x; }

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

    // Integral (1 to 6) of 1/x
    double integral;
    int a = 1, b = 6;
    int n = 2000;
    double h;
    double x;

    h = (double)(b-a)/n;

    integral = (f(a) + f(b)) / 2.0;
    x = a;

    for (int i = 1; i < n; i++) {
        x = x + h;
        integral = integral + f(x);
    }

    integral = integral * h;

    double expected = 1.79175946923;
    printf("Integral (%d to %d) of 1/x \n\n", a, b);
    printf("Expected  result  = %.11f\n", expected);
    printf("Estimated result  = %.11f\n", integral);
    printf("                    -------------\n");

    double difference = expected - integral;
    difference = fabsf(difference); // absolute value (no minus sign)
    printf("Difference        = %.11f\n", difference);

    return 0;
}

Use double instead of float

Use double instead of float

Float was not able to maintain data precision


#pragma once

#include <string>
#include <vector>
#include <sqltypes.h>

namespace cpp_odbc { namespace level2 {

/**
 * @brief This class represents a buffer for u16strings for use with the unixodbc C API.
 */
class u16string_buffer {
public:
    /**
     * @brief Constructs a new string buffer with the given capacity, i.e., maximum size
     * @param capacity Capacity of the buffer
     */
    u16string_buffer(signed short int capacity);

    /**
     * @brief Retrieve the capacity of the buffer (in characters) in a format suitable for passing
     *        to unixodbc API functions.
     */
    signed short int capacity() const;

    /**
     * @brief Retrieve a pointer to the internal buffer suitable for passing to unixodbc API functions.
     *        This buffer contains the actual string data. Do not exceed the allocated capacity!
     */
    SQLWCHAR * data_pointer();

    /**
     * @brief Retrieve a pointer to a size buffer suitable for passing to unixodbc API functions.
     *        This buffer contains the number of significant bytes in the buffer returned by
     *        data_pointer().
     */
    signed short int * size_pointer();

    /**
     * @brief Conversion operator. Retrieve the buffered data as a string. Bad things will happen if
     *        the value of size_pointer is larger than the capacity!
     */
    operator std::u16string() const;

private:
    std::vector<SQLWCHAR> data_;
    signed short int used_size_;
};

} }

#pragma once

#include <string>
#include <vector>
#include <sql.h>

namespace cpp_odbc { namespace level2 {

/**
 * @brief This class represents a buffer for u16strings for use with the unixodbc C API.
 */
class u16string_buffer {
public:
    /**
     * @brief Constructs a new string buffer with the given capacity, i.e., maximum size
     * @param capacity Capacity of the buffer
     */
    u16string_buffer(signed short int capacity);

    /**
     * @brief Retrieve the capacity of the buffer (in characters) in a format suitable for passing
     *        to unixodbc API functions.
     */
    signed short int capacity() const;

    /**
     * @brief Retrieve a pointer to the internal buffer suitable for passing to unixodbc API functions.
     *        This buffer contains the actual string data. Do not exceed the allocated capacity!
     */
    SQLWCHAR * data_pointer();

    /**
     * @brief Retrieve a pointer to a size buffer suitable for passing to unixodbc API functions.
     *        This buffer contains the number of significant bytes in the buffer returned by
     *        data_pointer().
     */
    signed short int * size_pointer();

    /**
     * @brief Conversion operator. Retrieve the buffered data as a string. Bad things will happen if
     *        the value of size_pointer is larger than the capacity!
     */
    operator std::u16string() const;

private:
    std::vector<SQLWCHAR> data_;
    signed short int used_size_;
};

} }

Use different header to be yet more compatible with Windows


#ifndef SHUTDOWN_I6F54URD

#define SHUTDOWN_I6F54URD

void ArchShutdown(void);

#endif /* end of include guard: SHUTDOWN_I6F54URD */

#ifndef SHUTDOWN_I6F54URD

#define SHUTDOWN_I6F54URD

void ArchBreak(void);
void ArchShutdown(void);

#endif /* end of include guard: SHUTDOWN_I6F54URD */

Add ArchBreak to the header.

Add ArchBreak to the header.


// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions 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.

#ifndef SURGSIM_FRAMEWORK_CONVERT_H
#define SURGSIM_FRAMEWORK_CONVERT_H

#include "SurgSim/Framework/Log.h"

/// \note HS-2013-dec-23 The gcc and msvc compilers seem to have different requirements when a template class
///       needs to be passed template parameters in a specialization, that extend the original template interface
///       gcc needs the template<> statement before the new template parameters, msvc does not like it at all.
#ifdef _GNUC_
#define SURGSIM_DOUBLE_SPECIALIZATION template<>
#else
#define SURGSIM_DOUBLE_SPECIALIZATION
#endif

namespace SurgSim
{
namespace Serialize
{
	/// Logger name for Serialization
	const std::string serializeLogger = "Serialization";

};
};

#endif // SURGSIM_FRAMEWORK_CONVERT_H

// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions 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.

#ifndef SURGSIM_FRAMEWORK_CONVERT_H
#define SURGSIM_FRAMEWORK_CONVERT_H

#include "SurgSim/Framework/Log.h"
#include <yaml-cpp/yaml.h>

/// \note HS-2013-dec-23 The gcc and msvc compilers seem to have different requirements when a template class
///       needs to be passed template parameters in a specialization, that extend the original template interface
///       gcc needs the template<> statement before the new template parameters, msvc does not like it at all.
#ifdef _GNUC_
#define SURGSIM_DOUBLE_SPECIALIZATION template<>
#else
#define SURGSIM_DOUBLE_SPECIALIZATION
#endif

namespace SurgSim
{
namespace Serialize
{
	/// Logger name for Serialization
	const std::string serializeLogger = "Serialization";

};
};

#endif // SURGSIM_FRAMEWORK_CONVERT_H

Add back yaml-cpp/yaml.h header file for convert<> class template.


/**
 * @file
 * @brief
 *
 * @date    29.03.2017
 * @author  Alex Kalmuk
 */
#include <unistd.h>
#include <util/log.h>
#include <drivers/i2c/i2c.h>

#include "gy_30.h"

#define GY30_ADDR       0x46

uint16_t gy_30_read_light_level(unsigned char id) {
	uint16_t level = 0;

	/* It would be better do not hang here but return error code */
	while (0 > i2c_bus_read(id, GY30_ADDR, (uint8_t *) &level, 2))
		;

	/* The actual value in lx is level / 1.2 */
	return (((uint32_t) level) * 5) / 6;
}

void gy_30_setup_mode(unsigned char id, uint8_t mode) {
	while (0 > i2c_bus_write(id, GY30_ADDR, &mode, 1))
		;

	/* Documentation says that we need to wait approximately 180 ms here.*/
	usleep(180000);

	log_debug("%s\n", "gy_30_setup_mode OK!\n");
}

/**
 * @file
 * @brief
 *
 * @date    29.03.2017
 * @author  Alex Kalmuk
 */
#include <unistd.h>
#include <util/log.h>
#include <drivers/i2c/i2c.h>

#include "gy_30.h"

/* http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf */
#define GY30_ADDR       0x23

uint16_t gy_30_read_light_level(unsigned char id) {
	uint16_t level = 0;

	/* It would be better do not hang here but return error code */
	while (0 > i2c_bus_read(id, GY30_ADDR, (uint8_t *) &level, 2))
		;

	/* The actual value in lx is level / 1.2 */
	return (((uint32_t) level) * 5) / 6;
}

void gy_30_setup_mode(unsigned char id, uint8_t mode) {
	while (0 > i2c_bus_write(id, GY30_ADDR, &mode, 1))
		;

	/* Documentation says that we need to wait approximately 180 ms here.*/
	usleep(180000);

	log_debug("%s\n", "gy_30_setup_mode OK!\n");
}

Fix gy-30 light sensor i2c address

drivers: Fix gy-30 light sensor i2c address


/// Umbrella header for the Hub Framework

#import "HUBManager.h"
#import "HUBComponent.h"
#import "HUBComponentModel.h"
#import "HUBComponentRegistry.h"
#import "HUBComponentFallbackHandler.h"

/// Umbrella header for the Hub Framework

#import "HUBManager.h"
#import "HUBComponent.h"
#import "HUBComponentModel.h"
#import "HUBComponentModelBuilder.h"
#import "HUBComponentImageData.h"
#import "HUBComponentImageDataBuilder.h"
#import "HUBComponentRegistry.h"
#import "HUBComponentFallbackHandler.h"

Add new API files to umbrella header

Add new API files to umbrella header


#ifndef PLUGIN_H_
#define PLUGIN_H_

#include "plugin_portable.h"

#include <windows.h>

// TODO use __stdcall
#define EXPORT_CALLING __cdecl
#define EXPORT __declspec(dllexport) EXPORT_CALLING

#include "common.h"

// just defined to make compilation work ; ignored
#define RTLD_DEFAULT NULL
#define RTLD_LOCAL   -1
#define RTLD_LAZY    -1

static inline void *dlopen(const char *name, int flags)
{
    // TODO use LoadLibraryEx() and flags ?
    return LoadLibrary(name);
}

static inline void *dlsym(void *handle, const char *name)
{
    FARPROC g = GetProcAddress(handle, name);
    void *h;
    *(FARPROC*)&h = g;
    return h;
}

static inline char *dlerror(void)
{
    static __thread char buf[1024];

    FormatMessage(
        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
        NULL,
        GetLastError(),
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR)&buf,
        sizeof buf, NULL);

    return buf;
}

static inline int dlclose(void *handle)
{
    return !FreeLibrary(handle);
}

#endif

#ifndef PLUGIN_H_
#define PLUGIN_H_

#include "plugin_portable.h"

#include <windows.h>

// TODO use __stdcall
#define EXPORT_CALLING __cdecl
#define EXPORT __declspec(dllexport) EXPORT_CALLING

#include "common.h"

// just defined to make compilation work ; ignored
#define RTLD_DEFAULT NULL
#define RTLD_LOCAL   -1
#define RTLD_LAZY    -1
#define RTLD_NOW     -1

static inline void *dlopen(const char *name, int flags)
{
    (void)flags;
    // TODO use LoadLibraryEx() and flags ?
    return LoadLibrary(name);
}

static inline void *dlsym(void *handle, const char *name)
{
    FARPROC g = GetProcAddress(handle, name);
    void *h;
    *(FARPROC*)&h = g;
    return h;
}

static inline char *dlerror(void)
{
    static __thread char buf[1024];

    FormatMessage(
        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
        NULL,
        GetLastError(),
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR)&buf,
        sizeof buf, NULL);

    return buf;
}

static inline int dlclose(void *handle)
{
    return !FreeLibrary(handle);
}

#endif

Mend Win32 build broken by 8e1c4386

Mend Win32 build broken by 8e1c4386


/**
 * @file
 *
 * @brief module for shutting down the gpg-agent
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

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

/**
 * @brief shutdown the gpg-agent
 * @retval 0 on success.
 * @retval -1 on error.
 */
int ELEKTRA_PLUGIN_FUNCTION (gpgQuitAgent) (void)
{
	// check if the gpg-connect-agent command is available
	int cmdAvailable = system ("command -v gpg-connect-agent");
	if (cmdAvailable != 0)
	{
		// nothing to do here
		return 0;
	}

	// try to gracefully shut down the gpg-agent
	int status = system ("gpg-connect-agent --quiet KILLAGENT /bye");
	if (status != 0)
	{
		// use the hammer
		int killStatus = system ("/bin/sh -c \"pgrep \'gpg-agent\' | xargs -d \'\\n\' \'kill\'\"");
		if (killStatus != 0)
		{
			return -1;
		}
	}
	return 0;
}

/**
 * @file
 *
 * @brief module for shutting down the gpg-agent
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

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

/**
 * @brief shutdown the gpg-agent
 * @retval 0 on success.
 * @retval -1 on error.
 */
int ELEKTRA_PLUGIN_FUNCTION (gpgQuitAgent) (void)
{
	// try to gracefully shut down the gpg-agent
	int status = system ("gpg-connect-agent --quiet KILLAGENT /bye");
	if (status != 0)
	{
		// use the hammer
		int killStatus = system ("/bin/sh -c \"pgrep \'gpg-agent\' | xargs -d \'\\n\' \'kill\'\"");
		if (killStatus != 0)
		{
			return -1;
		}
	}
	return 0;
}

Revert "tests: check if gpg-agent command exists in shutdown code"

This reverts commit 7e0ef169c36712bb49b291a227ebd1b0036e5c75.


/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2015 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#ifndef XENIA_BASE_PLATFORM_X11_H_
#define XENIA_BASE_PLATFORM_X11_H_

// NOTE: if you're including this file it means you are explicitly depending
// on Linux headers. Including this file outside of linux platform specific
// source code will break portability

#include "xenia/base/platform.h"

// Xlib is used only for GLX interaction, the window management and input
// events are done with gtk/gdk
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>

//Used for window management. Gtk is for GUI and wigets, gdk is for lower
//level events like key presses, mouse events, etc
#include <gtk/gtk.h>
#include <gdk/gdk.h>

#endif  // XENIA_BASE_PLATFORM_X11_H_

Add gtk and x11 headers to linux specific platform header


#ifndef HAL1_H
#define HAL1_H

// Configurable constants

int const MAIN_MOTOR_PWM_TOP = 255;
int const MAIN_MOTOR_BRAKE_SPEED = 120;
int const MAIN_MOTOR_MIN_SPEED = 150;
int const MAIN_MOTOR_MED_SPEED = 254;
int const MAIN_MOTOR_MAX_SPEED = 255;
int const MAGNET_OPEN_WAIT = 5;		// 10ths of a second

void init(void);

void main_motor_stop();
void main_motor_cw_open(uint8_t speed);
void main_motor_ccw_close(uint8_t speed);
void set_main_motor_speed(int speed);
int get_main_motor_speed();
void aux_motor_stop();
void aux_motor_cw_close();
void aux_motor_ccw_open();
void magnet_off();
void magnet_on();
bool door_nearly_open();
bool door_fully_open();
bool door_fully_closed();

bool sensor_proximity();
bool button_openclose();
bool button_stop();
bool main_encoder();
bool aux_outdoor_limit();
bool aux_indoor_limit();
bool door_nearly_closed();
bool aux_encoder();

#endif

Add function prototypes and ifndef wrapper


#import <Foundation/Foundation.h>
#ifdef __cplusplus
#include <memory>
#include <mx3/mx3.hpp>
#endif

@interface MX3Snapshot : NSObject
// adding this here allows you to include this file from non-objc++ files
// since it is using c++ types
#ifdef __cplusplus
- (instancetype)initWithSnapshot:(std::unique_ptr<mx3::SqlSnapshot>)snapshot;
#endif
- (NSString *) rowAtIndex:(NSUInteger)index;
- (NSUInteger) count;
- (void) dealloc;
@end

#import <Foundation/Foundation.h>
#ifdef __cplusplus
#include <memory>
#include <mx3/mx3.hpp>
#endif

@interface MX3Snapshot : NSObject
// adding this here allows you to include this file from non-objc++ files
// since it is using c++ types
#ifdef __cplusplus
- (instancetype)initWithSnapshot:(std::unique_ptr<mx3::SqlSnapshot>)snapshot;
#endif
- (NSString *) rowAtIndex:(NSUInteger)index;
- (NSUInteger) count;

@end

Remove dealloc from header as it is declared in NSObject


#pragma once

#if defined(_MSC_VER)
    #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5))
#endif

class WindowFeature {
public:
	WindowFeature();
	virtual ~WindowFeature();
	virtual void apply(double *windowImage, double *descriptorVector) = 0;
	unsigned int descriptorLengthPerWindow;
};

#pragma once

#if _MSC_VER < 1900
    #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5))
#endif

class WindowFeature {
public:
	WindowFeature();
	virtual ~WindowFeature();
	virtual void apply(double *windowImage, double *descriptorVector) = 0;
	unsigned int descriptorLengthPerWindow;
};

Fix a build error (Python 3.5)

Fix a build error (Python 3.5)

Thanks to karel.palecek@tul.cz for supplying the fix to this bug.


/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2005 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.02.00-k5"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	2
#define QLA_DRIVER_PATCH_VER	0
#define QLA_DRIVER_BETA_VER	0

/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2005 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.02.00-k6"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	2
#define QLA_DRIVER_PATCH_VER	0
#define QLA_DRIVER_BETA_VER	0

Update version number to 8.02.00-k6.

[SCSI] qla2xxx: Update version number to 8.02.00-k6.

Signed-off-by: Andrew Vasquez <67840a4977006af7f584bdc4c86d7243c1629cad@qlogic.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>


#include "port/oc_assert.h"

// TODO:
void
abort_impl()
{
}

#include "port/oc_assert.h"

// TODO:
void
abort_impl(void)
{
}

Declare void parameter for RIOT

Declare void parameter for RIOT

This is partially reverting:
 "Bring RIOT OS port up-to-date with RIOT OS upstream"

This reverts commit 0ed0f4425cffdd84317998efa8fe19eef561c2fa.

Without this change RIOT will fail to build:
  port/riot/abort.c:5:1:\
  error: old-style function definition [-Werror=old-style-definition]

Change-Id: Ie6b838452412c844503a004656b7aac7b20e5d55
Signed-off-by: Philippe Coval <ff46fec9739d31cce915aabcc3a7a2c00eee4d6c@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16497
Reviewed-by: Kishen Maloor <c62ddea3cd661a9268bff15f07fc2229cdc9ac02@intel.com>
Tested-by: Kishen Maloor <c62ddea3cd661a9268bff15f07fc2229cdc9ac02@intel.com>


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

Add stub for auditing in the tester

Add stub for auditing in the tester


#include "../../math/reinterpret.h"
#include <stdint.h>

static uint64_t magnitude_(uint64_t high, uint64_t low)
{
    if (high > 0x7FFF000000000000 || (high == 0x7FFF000000000000 && low))
        return high;

    if (high >= 0x43FF000000000000)
        return 0x7FF0000000000000;

    if (high >= 0x3C01000000000000)
        return ((high - 0x3C00000000000000) << 4 | low >> 60) + (((low >> 59 & 1) | low << 4) > 0x8000000000000000);

    if (high >= 0x3BCC000000000000) {
        double significand = reinterpret(double, (0x8000000000000000 | high << 15) >> 11 | low >> 60 | !!(low << 4));
        double coeff = reinterpret(double, ((high >> 48) - 0x3802) << 52);
        return reinterpret(uint64_t, significand * coeff);
    }
    return 0;
}

double __trunctfdf2(long double x)
{
    unsigned __int128 i = reinterpret(unsigned __int128, x);
    uint64_t high = i >> 64;

    return reinterpret(double, magnitude_(high & INT64_MAX, i) | (high & 0x8000000000000000));
}

Implement long double -> double

Implement long double -> double


#ifndef VAST_OPTION_HPP
#define VAST_OPTION_HPP

#include <cppa/option.hpp>

namespace vast {

/// An optional value of `T` with similar semantics as `std::optional`.
template <typename T>
class option : public cppa::option<T>
{
  typedef cppa::option<T> super;
public:
#ifdef VAST_HAVE_INHERTING_CONSTRUCTORS
  using super::option;
#else
  option() = default;

  option(T x)
    : super(std::move(x))
  {
  }

  template <typename T0, typename T1, typename... Ts>
  option(T0&& x0, T1&& x1, Ts&&... args)
    : super(std::forward<T0>(x0),
            std::forward<T1>(x1),
            std::forward<Ts>(args)...)
  {
  }

  option(const option&) = default;
  option(option&&) = default;
  option& operator=(option const&) = default;
  option& operator=(option&&) = default;
#endif

  T* operator->() const
  {
    CPPA_REQUIRE(valid());
    return &cppa::option<T>::get();
  }
};

} // namespace vast

#endif

#ifndef VAST_OPTION_HPP
#define VAST_OPTION_HPP

#include <cppa/option.hpp>

namespace vast {

/// An optional value of `T` with similar semantics as `std::optional`.
template <typename T>
class option : public cppa::option<T>
{
  typedef cppa::option<T> super;
public:
#ifdef VAST_HAVE_INHERTING_CONSTRUCTORS
  using super::option;
#else
  option() = default;

  option(T x)
    : super(std::move(x))
  {
  }

  template <typename T0, typename T1, typename... Ts>
  option(T0&& x0, T1&& x1, Ts&&... args)
    : super(std::forward<T0>(x0),
            std::forward<T1>(x1),
            std::forward<Ts>(args)...)
  {
  }

  option(const option&) = default;
  option(option&&) = default;
  option& operator=(option const&) = default;
  option& operator=(option&&) = default;
#endif

  constexpr T const* operator->() const
  {
    return &cppa::option<T>::get();
  }
};

} // namespace vast

#endif

Make operator-> constexpr and return a T const*.


#include "MMDB.h"
#include "tap.h"
#include <sys/stat.h>
#include <string.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif

int main(void)
{
    const char *version = MMDB_lib_version();
    ok(version != NULL, "MMDB_lib_version exists");
    ok(strcmp(version, PACKAGE_VERSION) == 0, "version is " PACKAGE_VERSION);
    done_testing();
}

#include "MMDB.h"
#include "tap.h"
#include <sys/stat.h>
#include <string.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif

int main(void)
{
    const char *version = MMDB_lib_version();
    ok(version != NULL, "MMDB_lib_version exists");
    if ( version )
        ok(strcmp(version, PACKAGE_VERSION) == 0, "version is " PACKAGE_VERSION);
    done_testing();
}

Check version string only if MMDB_lib_version != NULL


/** @file
  GUID for hardware error record variables.

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

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

  Module Name:  HardwareErrorVariable.h

  @par Revision Reference:
  GUID defined in UEFI 2.1.

**/

#ifndef _HARDWARE_ERROR_VARIABLE_GUID_H_
#define _HARDWARE_ERROR_VARIABLE_GUID_H_

#define EFI_HARDWARE_ERROR_VARIABLE \
  { \
    0x414E6BDD, 0xE47B, 0x47cc, {0xB2, 0x44, 0xBB, 0x61, 0x02, 0x0C, 0xF5, 0x16} \
  }

extern EFI_GUID gEfiHardwareErrorVariableGuid;

#endif

/** @file
  GUID for hardware error record variables.

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

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

  @par Revision Reference:
  GUID defined in UEFI 2.1.

**/

#ifndef _HARDWARE_ERROR_VARIABLE_GUID_H_
#define _HARDWARE_ERROR_VARIABLE_GUID_H_

#define EFI_HARDWARE_ERROR_VARIABLE \
  { \
    0x414E6BDD, 0xE47B, 0x47cc, {0xB2, 0x44, 0xBB, 0x61, 0x02, 0x0C, 0xF5, 0x16} \
  }

extern EFI_GUID gEfiHardwareErrorVariableGuid;

#endif

Remove "Module Name:" from include file headers.

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


/*
 * Copyright (c) 2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 * Author: John Fastabend <john.r.fastabend@intel.com>
 */

#ifndef _DCB_EVENT_H
#define _DCB_EVENT_H

enum dcbevent_notif_type {
	DCB_APP_EVENT = 1,
};

extern int register_dcbevent_notifier(struct notifier_block *nb);
extern int unregister_dcbevent_notifier(struct notifier_block *nb);
extern int call_dcbevent_notifiers(unsigned long val, void *v);

#endif

/*
 * Copyright (c) 2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 * Author: John Fastabend <john.r.fastabend@intel.com>
 */

#ifndef _DCB_EVENT_H
#define _DCB_EVENT_H

enum dcbevent_notif_type {
	DCB_APP_EVENT = 1,
};

#ifdef CONFIG_DCB
extern int register_dcbevent_notifier(struct notifier_block *nb);
extern int unregister_dcbevent_notifier(struct notifier_block *nb);
extern int call_dcbevent_notifiers(unsigned long val, void *v);
#else
static inline int
register_dcbevent_notifier(struct notifier_block *nb)
{
	return 0;
}

static inline int unregister_dcbevent_notifier(struct notifier_block *nb)
{
	return 0;
}

static inline int call_dcbevent_notifiers(unsigned long val, void *v)
{
	return 0;
}
#endif /* CONFIG_DCB */

#endif

Add stub routines for !CONFIG_DCB

dcb: Add stub routines for !CONFIG_DCB

To avoid ifdefs in the other code that supports DCB notifiers
add stub routines. This method seems popular in other net code
for example 8021Q.

Signed-off-by: John Fastabend <06228589568acf528fa1984e09626513a30b66ed@intel.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


#ifndef OSSL_CORE_COMMON_H_INCLUDE
#define OSSL_CORE_COMMON_H_INCLUDE

#include <nan.h>

#include "logger.h"
#include "scoped_ssl.h"
#include "excep.h"
#include "key_exp.h"
#include "digest.h"
#include "bn.h"
#include <openssl/bn.h>

#endif // OSSL_CORE_COMMON_H_INCLUDE

#ifndef OSSL_CORE_COMMON_H_INCLUDE
#define OSSL_CORE_COMMON_H_INCLUDE

#ifdef _WIN32
#define __WINCRYPT_H__
#endif

#include <nan.h>

#include "logger.h"
#include "scoped_ssl.h"
#include "excep.h"
#include "key_exp.h"
#include "digest.h"
#include "bn.h"
#include <openssl/bn.h>

#endif // OSSL_CORE_COMMON_H_INCLUDE

Disable __WINCRYPT_H__ headers for Windows


/***************************************************************************

getarg.h - Support routines for the giflib utilities

**************************************************************************/

#ifndef _GETARG_H
#define _GETARG_H

#include <stdbool.h>

#define VERSION_COOKIE " Version %d.%d, "

/***************************************************************************
 Error numbers as returned by GAGetArg routine:
***************************************************************************/
#define CMD_ERR_NotAnOpt  1    /* None Option found. */
#define CMD_ERR_NoSuchOpt 2    /* Undefined Option Found. */
#define CMD_ERR_WildEmpty 3    /* Empty input for !*? seq. */
#define CMD_ERR_NumRead   4    /* Failed on reading number. */
#define CMD_ERR_AllSatis  5    /* Fail to satisfy (must-'!') option. */

bool GAGetArgs(int argc, char **argv, char *CtrlStr, ...);
void GAPrintErrMsg(int Error);
void GAPrintHowTo(char *CtrlStr);

/******************************************************************************
 From qprintf.c
******************************************************************************/
extern bool GifNoisyPrint;
extern void GifQprintf(char *Format, ...);
extern void PrintGifError(void);

/* These used to live in the library header */
#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg)
#define GIF_EXIT(Msg)    { GIF_MESSAGE(Msg); exit(-3); }

#endif /* _GETARG_H */

/* end */

Fix a header that had failed to track dome changed locations.


//===-- AMDGPUAsmPrinter.h - Print AMDGPU assembly code -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief AMDGPU Assembly printer class.
//
//===----------------------------------------------------------------------===//

#ifndef AMDGPU_ASMPRINTER_H
#define AMDGPU_ASMPRINTER_H

#include "llvm/CodeGen/AsmPrinter.h"
#include <string>
#include <vector>

namespace llvm {

class AMDGPUAsmPrinter : public AsmPrinter {

public:
  explicit AMDGPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer);

  virtual bool runOnMachineFunction(MachineFunction &MF);

  virtual const char *getPassName() const {
    return "AMDGPU Assembly Printer";
  }

  /// \brief Emit register usage information so that the GPU driver
  /// can correctly setup the GPU state.
  void EmitProgramInfoR600(MachineFunction &MF);
  void EmitProgramInfoSI(MachineFunction &MF);

  /// Implemented in AMDGPUMCInstLower.cpp
  virtual void EmitInstruction(const MachineInstr *MI);

protected:
  bool DisasmEnabled;
  std::vector<std::string> DisasmLines, HexLines;
  size_t DisasmLineMaxLen;
};

} // End anonymous llvm

#endif //AMDGPU_ASMPRINTER_H

//===-- AMDGPUAsmPrinter.h - Print AMDGPU assembly code ---------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief AMDGPU Assembly printer class.
//
//===----------------------------------------------------------------------===//

#ifndef AMDGPU_ASMPRINTER_H
#define AMDGPU_ASMPRINTER_H

#include "llvm/CodeGen/AsmPrinter.h"
#include <string>
#include <vector>

namespace llvm {

class AMDGPUAsmPrinter : public AsmPrinter {

public:
  explicit AMDGPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer);

  virtual bool runOnMachineFunction(MachineFunction &MF);

  virtual const char *getPassName() const {
    return "AMDGPU Assembly Printer";
  }

  /// \brief Emit register usage information so that the GPU driver
  /// can correctly setup the GPU state.
  void EmitProgramInfoR600(MachineFunction &MF);
  void EmitProgramInfoSI(MachineFunction &MF);

  /// Implemented in AMDGPUMCInstLower.cpp
  virtual void EmitInstruction(const MachineInstr *MI);

protected:
  bool DisasmEnabled;
  std::vector<std::string> DisasmLines, HexLines;
  size_t DisasmLineMaxLen;
};

} // End anonymous llvm

#endif //AMDGPU_ASMPRINTER_H

Fix missing C++ mode comment

Fix missing C++ mode comment

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


/*
 * libaacs by Doom9 ppl 2009, 2010
 */

#ifndef AACS_H_
#define AACS_H_

#include <stdint.h>

#include "../file/configfile.h"

#define LIBAACS_VERSION "1.0"

typedef struct aacs AACS;
struct aacs {
    uint8_t pk[16], mk[16], vuk[16], vid[16];
    uint8_t *uks;           /* unit key array (size = 16 * num_uks, each key is
                             * at 16-byte offset)
                             */
    uint16_t num_uks;       /* number of unit keys */
    uint8_t iv[16];
    CONFIGFILE *kf;
};

AACS *aacs_open(const char *path, const char *keyfile_path);
void aacs_close(AACS *aacs);
int aacs_decrypt_unit(AACS *aacs, uint8_t *buf, uint32_t len, uint64_t offset);
uint8_t *aacs_get_vid(AACS *aacs);

#endif /* AACS_H_ */

/*
 * libaacs by Doom9 ppl 2009, 2010
 */

#ifndef AACS_H_
#define AACS_H_

#include "../file/configfile.h"

#include <stdint.h>

#define LIBAACS_VERSION "1.0"

typedef struct aacs AACS;
struct aacs {
    uint8_t pk[16], mk[16], vuk[16], vid[16];
    uint8_t *uks;           /* unit key array (size = 16 * num_uks, each key is
                             * at 16-byte offset)
                             */
    uint16_t num_uks;       /* number of unit keys */
    uint8_t iv[16];
    CONFIGFILE *kf;
};

AACS *aacs_open(const char *path, const char *keyfile_path);
void aacs_close(AACS *aacs);
int aacs_decrypt_unit(AACS *aacs, uint8_t *buf, uint32_t len, uint64_t offset);
uint8_t *aacs_get_vid(AACS *aacs);

#endif /* AACS_H_ */

Move inclusion of internal headers before system headers


// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 -disable-llvm-optzns -o %t %s
// RUN: FileCheck < %t %s

// Types with the may_alias attribute should be considered equivalent
// to char for aliasing.

typedef int __attribute__((may_alias)) aliasing_int;

void test0(aliasing_int *ai, int *i)
{
  *ai = 0;
  *i = 1;
}

// CHECK: store i32 0, i32* %tmp, !tbaa !1
// CHECK: store i32 1, i32* %tmp1, !tbaa !3

// CHECK: !0 = metadata !{metadata !"any pointer", metadata !1}
// CHECK: !1 = metadata !{metadata !"omnipotent char", metadata !2}
// CHECK: !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
// CHECK: !3 = metadata !{metadata !"int", metadata !1}

// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 -disable-llvm-optzns -o %t %s
// RUN: FileCheck < %t %s

// Types with the may_alias attribute should be considered equivalent
// to char for aliasing.

typedef int __attribute__((may_alias)) aliasing_int;

void test0(aliasing_int *ai, int *i)
{
  *ai = 0;
  *i = 1;
}

// CHECK: store i32 0, i32* %{{.*}}, !tbaa !1
// CHECK: store i32 1, i32* %{{.*}}, !tbaa !3

// CHECK: !0 = metadata !{metadata !"any pointer", metadata !1}
// CHECK: !1 = metadata !{metadata !"omnipotent char", metadata !2}
// CHECK: !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
// CHECK: !3 = metadata !{metadata !"int", metadata !1}

Generalize this test to work without instruction names.

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


//
//  synchronizer.h
//  P2PSP
//
//  This code is distributed under the GNU General Public License (see
//  THE_GENERAL_GNU_PUBLIC_LICENSE.txt for extending this information).
//  Copyright (C) 2016, the P2PSP team.
//  http://www.p2psp.org
//

#include <boost/format.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include "../lib/p2psp/src/util/trace.h"
#include <arpa/inet.h>
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
#include <ctime>
#include <fstream>
#include <string>
#include <tuple>
#include <vector>

namespace p2psp {

class Synchronizer {
public:
    Synchronizer();
    ~Synchronizer();

    const std::vector<std::string>* peer_list;

    void Run(int argc, const char* argv[]) throw(boost::system::system_error);  //Run the argument parser
    void PlayChunk();  //Play the chunk to the player
    void Synchronize(); //To get the offset from the first peer and synchronize the lists
    void ConnectToPeers(); //Connect the synchronizer with various peers
    };
}

//
//  synchronizer.h
//  P2PSP
//
//  This code is distributed under the GNU General Public License (see
//  THE_GENERAL_GNU_PUBLIC_LICENSE.txt for extending this information).
//  Copyright (C) 2016, the P2PSP team.
//  http://www.p2psp.org
//

#include <boost/format.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include "../lib/p2psp/src/util/trace.h"
#include <arpa/inet.h>
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
#include <ctime>
#include <fstream>
#include <string>
#include <tuple>
#include <vector>

namespace p2psp {

class Synchronizer {
public:
    Synchronizer();
    ~Synchronizer();

    const std::vector<std::string>* peer_list;
    boost::thread_group thread_group_;

    void Run(int argc, const char* argv[]) throw(boost::system::system_error);  //Run the argument parser
    void PlayChunk();  //Play the chunk to the player
    void Synchronize(); //To get the offset from the first peer and synchronize the lists
    void ConnectToPeers(std::string); //Connect the synchronizer with various peers
    };
}

Add thread group to manage threads

Add thread group to manage threads


/// \file
/// \brief Singleton design pattern
///
/// \author Peter 'png' Hille <peter@das-system-networks.de>
#ifndef SINGLETON_HH
#define SINGLETON_HH 1

#include <dsnutil/compiler_features.h>

namespace dsn {
/// \brief Template for singleton classes
///
/// This template can be used to implement the "singleton" design pattern
/// on any class.
template <class Derived>
class Singleton {
public:
    /// \brief Access singleton instance
    ///
    /// Returns a reference to the instance of this singleton.
    static dsnutil_cpp_DEPRECATED Derived& getInstance()
    {
        return instanceRef();
    }

    static Derived& instanceRef()
    {
        static Derived instance;
        return instance;
    }

    static Derived* instancePtr()
    {
        return &instanceRef();
    }

protected:
    /// \brief Default constructor
    ///
    /// \note This ctor is protected so that derived classes can implement
    /// their own logics for object initialization while still maintaining
    /// the impossibility of direct ctor calls!
    Singleton() {}

private:
    /// \brief Copy constructor
    ///
    /// \note This ctor is private to prevent multiple instances of the same
    /// singleton from being created through object assignments!
    Singleton(const Singleton&) {}
};
}

#endif // !SINGLETON_HH

/// \file
/// \brief Singleton design pattern
///
/// \author Peter 'png' Hille <peter@das-system-networks.de>
#ifndef SINGLETON_HH
#define SINGLETON_HH 1

#include <dsnutil/compiler_features.h>

namespace dsn {
/// \brief Template for singleton classes
///
/// This template can be used to implement the "singleton" design pattern
/// on any class.
template <class Derived>
class Singleton {
public:
    /// \brief Access singleton instance
    ///
    /// \return Reference to the instance of this singleton.
    static dsnutil_cpp_DEPRECATED Derived& getInstance()
    {
        return instanceRef();
    }

    /// \brief Access singleton instance (by reference)
    ///
    /// \return Reference to the initialized singleton instance
    static Derived& instanceRef()
    {
        static Derived instance;
        return instance;
    }

    /// \brief Access singleton instance (by pointer)
    ///
    /// \return Pointer to the initialized singleton instance
    static Derived* instancePtr()
    {
        return &instanceRef();
    }

protected:
    /// \brief Default constructor
    ///
    /// \note This ctor is protected so that derived classes can implement
    /// their own logics for object initialization while still maintaining
    /// the impossibility of direct ctor calls!
    Singleton() {}

private:
    /// \brief Copy constructor
    ///
    /// \note This ctor is private to prevent multiple instances of the same
    /// singleton from being created through object assignments!
    Singleton(const Singleton&) {}
};
}

#endif // !SINGLETON_HH

Add Doxygen comments for new Singleton methods


/*
 * The decimal number, 585 = 1001001001 (binary), is palindromic in both bases.
 * Find the sum of all numbers, less than 5 000 000, which are palindromic in
 * base 10 and base 2. (Please note that the palindromic number, in either base,
 * may not include leading zeros.)
 */

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

#define MAXIM 5000000

char * strrev(char number[]){
  int length, index=0, tmp;

  length = strlen(number)-1;

  while(index<length) {
    tmp = number[index];
    number[index] = number[length];
    number[length] = tmp;
    index++; length--;
  }

  return number;
}

int *to_base(int base, char repr[], int number) {
  int remainder, length;

  static char new_number[] = "";
  new_number[0] = '\0';

  while(number) {
    remainder = number % base;
    number /= base;

    length = strlen(new_number);
    new_number[length] = repr[remainder];
    new_number[length+1] = '\0';
  }

  return atoi(strrev(new_number));

}

int check_palindrom(int number) {

  return 1;
}

int generate_palindroms() {
  int number, sum=0;

  for(number=11; number<=MAXIM; number++){
    if (check_palindrom(number) && check_palindrom(to_base(2, "01", number))) {
      sum += number;
    }
  }

  return sum;
}

int main() {
  generate_palindroms();
  return 0;
}

Transform from base 10 in whatever base you want