//
//  AFNetworkingWebApiClient.h
//  WebApiClient
//
//  Created by Matt on 12/08/15.
//  Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import "WebApiClientSupport.h"

NS_ASSUME_NONNULL_BEGIN

@protocol AFURLResponseSerialization;

/**
 Implementation of @c WebApiClient using AFNetworking with NSURLSessionManager.

 @b Note: the @c blockingRequestAPI:withPathVariables:parameters:data:maximumWait:error: method uses
          background threads to complete the HTTP request. It simply blocks the calling thread and
          waits for the background work to complete.
 */
@interface AFNetworkingWebApiClient : WebApiClientSupport

/** A URL response serialization object to use. This will default to one that accepts any type of data. */
@property (nonatomic, strong) id<AFURLResponseSerialization> responseSerializer;

/** An array of active task identifiers, as @c NSNumber instances. */
@property (nonatomic, readonly) NSArray *activeTaskIdentifiers;

/**
 Get a route associated with an active task identifer.

 @param identifier The @c NSURLSessionTask identifier to get the route for.
 @return The route associated with the identifier, or @c nil if not available.
 @see activeTaskIdentifiers
 */
- (id<WebApiRoute>)routeForActiveTaskIdentifier:(NSUInteger)identifier;

@end

NS_ASSUME_NONNULL_END

//
//  AFNetworkingWebApiClient.h
//  WebApiClient
//
//  Created by Matt on 12/08/15.
//  Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import "WebApiClientSupport.h"

NS_ASSUME_NONNULL_BEGIN

@protocol AFURLResponseSerialization;

/**
 Implementation of @c WebApiClient using AFNetworking with NSURLSessionManager.

 @b Note: the @c blockingRequestAPI:withPathVariables:parameters:data:maximumWait:error: method uses
          background threads to complete the HTTP request. It simply blocks the calling thread and
          waits for the background work to complete.
 */
@interface AFNetworkingWebApiClient : WebApiClientSupport

/** A URL response serialization object to use. This will default to one that accepts any type of data. */
@property (nonatomic, strong) id<AFURLResponseSerialization> responseSerializer;

/** An array of active task identifiers, as @c NSNumber instances. */
@property (nonatomic, readonly) NSArray<NSNumber *> *activeTaskIdentifiers;

/**
 Get a route associated with an active task identifer.

 @param identifier The @c NSURLSessionTask identifier to get the route for.
 @return The route associated with the identifier, or @c nil if not available.
 @see activeTaskIdentifiers
 */
- (id<WebApiRoute>)routeForActiveTaskIdentifier:(NSUInteger)identifier;

@end

NS_ASSUME_NONNULL_END

Add generic definition to identifier array.


// Copyright (c) 2016 LEGOAnimal22

#include <stdio.h>
#include <inttypes.h>
#include "electron.h"

int main() {
  printf("Periodic Table by LEGOAnimal22\n");

  electron_config carbon = create_electron_config(6);
  printf("%d, %d, %d, %d\n", carbon.atomic_number, carbon.highest_energy_level, carbon.valence_electrons, carbon.charge);

  electron_config gold = create_electron_config(79);
  printf("%d, %d, %d, %d\n", gold.atomic_number, gold.highest_energy_level, gold.valence_electrons, gold.charge);

  electron_config radon = create_electron_config(86);
  printf("%d, %d, %d, %d\n", radon.atomic_number, radon.highest_energy_level, radon.valence_electrons, radon.charge);

  // (((atomic_number - 54) > 2) ? 2 : (atomic_number - 54)) + ((atomic_number > 80) ? (atomic_number - 80) : 0)
  printf("%d\n", (((86 - 54) > 2) ? 2 : (86 - 54)));
  printf("%d\n", ((86 > 80) ? (86 - 80) : 0));

  return 1;
}

// Copyright (c) 2016 LEGOAnimal22

#include <stdio.h>
#include <inttypes.h>
#include "electron.h"

int main() {
  printf("Periodic Table by LEGOAnimal22\n");

  electron_config carbon = create_electron_config(6);
  printf("%d, %d, %d, %d\n", carbon.atomic_number, carbon.highest_energy_level, carbon.valence_electrons, carbon.charge);

  electron_config gold = create_electron_config(79);
  printf("%d, %d, %d, %d\n", gold.atomic_number, gold.highest_energy_level, gold.valence_electrons, gold.charge);

  electron_config radon = create_electron_config(86);
  printf("%d, %d, %d, %d\n", radon.atomic_number, radon.highest_energy_level, radon.valence_electrons, radon.charge);

  // (((atomic_number - 54) > 2) ? 2 : (atomic_number - 54)) + ((atomic_number > 80) ? (atomic_number - 80) : 0)
  unsigned int x = 86;
  printf("%d\n", (((x - 54) > 2) ? 2 : (x - 54)));
  printf("%d\n", ((x > 80) ? (x - 80) : 0));
  printf("%d\n", (((x - 54) > 2) ? 2 : (x - 54)) + ((x > 80) ? (x - 80) : 0));

  return 1;
}

Test level 6 with a variable instead of a constant


// RUN: %llvmgcc -S %s -o - | grep load | grep "4 x float" | not grep "align 4"
// RUN: %llvmgcc -S %s -o - | grep load | grep "4 x float" | grep "align 16"
// PR3432
// rdar://6536377

typedef float __m128 __attribute__ ((__vector_size__ (16)));

typedef union
{
  int i[4];
  float f[4];
  __m128 v;
} u_t;

__m128 t(u_t *a) {
  return a->v;
}

Add a test case for Chris lvalue alignment fixes.

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


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

inherit LIB_VERB;

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

void main(object actor, mapping roles)
{
	object user;

	user = query_user();

	if (user->query_class() < 3) {
		send_out("You do not have sufficient access rights to reset the clone manager.\n");
		return;
	}

	CLONED->discover_clones();
}

Add command to separately reset the clone manager


#include "stdint.h"
#include "stdio.h"
#include "Spec_Lib_Print.h"

void Spec_Lib_Print_print_bytes(uint32_t len, uint8_t* buffer) {
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer[i]);
  }
  printf("\n");
}

void Spec_Lib_Print_print_compare(uint32_t len, uint8_t* buffer1, uint8_t* buffer2) {
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer1[i]);
  }
  printf("\n");
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer2[i]);
  }
  printf("\n");
}

void Spec_Lib_Print_print_compare_display(uint32_t len, uint8_t* buffer1, uint8_t* buffer2) {
  Spec_Lib_Print_print_compare(len, buffer1, buffer2);
  int res = 1;
  for (int i = 0; i < len; i++) {
    res |= buffer1[i] ^ buffer2[i];
  }
  if (res) {
    printf("Success !\n");
  } else {
    printf("Failure !\n");
  }
  printf("\n");
}

#include "stdint.h"
#include "stdio.h"
#include "Spec_Lib_Print.h"

void Spec_Lib_Print_print_bytes(uint32_t len, uint8_t* buffer) {
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer[i]);
  }
  printf("\n");
}

void Spec_Lib_Print_print_compare(uint32_t len, uint8_t* buffer1, uint8_t* buffer2) {
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer1[i]);
  }
  printf("\n");
  for (int i = 0; i < len; i++){
    printf("%02x ", buffer2[i]);
  }
  printf("\n");
}

void Spec_Lib_Print_print_compare_display(uint32_t len, uint8_t* buffer1, uint8_t* buffer2) {
  Spec_Lib_Print_print_compare(len, buffer1, buffer2);
  int res = 0;
  for (int i = 0; i < len; i++) {
    res |= buffer1[i] ^ buffer2[i];
  }
  if (res = 0) {
    printf("Success !\n");
  } else {
    printf("Failure !\n");
  }
  printf("\n");
}

Fix typo in the Print_compare_and_display function


//
//  SecretConstant.example.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define Client_id       @"Get the client id from server"
#define Client_secret   @"Get the client secret from server"
#define UMENG_APPKEY    @"Set up UMEng App Key"
#define UMENG_QQ_ID     @"Set up qq id"
#define UMENG_QQ_APPKEY @"Set up qq appkey"
#define WX_APP_ID       @"Set up weixin app id"
#define WX_APP_SECRET   @"Set up weixin app secret"
#define TRACKING_ID     @"Set up google anlytics tracking id"

//
//  SecretConstant.example.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define Client_id       @"kHOugsx4dmcXwvVbmLkd"
#define Client_secret   @"PuuFCrF94MloSbSkxpwS"
#define UMENG_APPKEY    @"Set up UMEng App Key"
#define UMENG_QQ_ID     @"Set up qq id"
#define UMENG_QQ_APPKEY @"Set up qq appkey"
#define WX_APP_ID       @"Set up weixin app id"
#define WX_APP_SECRET   @"Set up weixin app secret"
#define TRACKING_ID     @"Set up google anlytics tracking id"

Change client id and client secret default value


// __COMPDB_ENTRY: The contents of this compilation database entry.
// Should be a string literal.
// __COMPDB_SYMNAME: ATM I can't think of a way to generate a unique symbol
// name, so just force the TU to provide it.
__attribute__((section(".llvm.compdb")))
extern const char __COMPDB_SYMNAME[] = "<<<COMPDB:" __COMPDB_ENTRY ">>>";

// The following macros should be defined on entry to this file:
// __COMPDB_ENTRY:
//   The contents of this compilation database entry.  Should be a string
//   literal.
// __COMPDB_SYMNAME:
//   ATM I can't think of a way to generate a unique symbol name, so just
//   force it to be passed in.
__attribute__((section(".llvm.compdb")))
extern const char __COMPDB_SYMNAME[] = "<<<COMPDB:" __COMPDB_ENTRY ">>>";

Make this file a bit prettier.

Make this file a bit prettier.


#pragma once

#include "chainerx/array.h"
#include "chainerx/kernel.h"

namespace chainerx {

class SinhKernel : public Kernel {
public:
    static const char* name() { return "Sinh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class CoshKernel : public Kernel {
public:
    static const char* name() { return "Cosh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class TanhKernel : public Kernel {
public:
    static const char* name() { return "Tanh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class ArcsinhKernel : public Kernel {
public:
    static const char* name() { return "Archsinh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class ArccoshKernel : public Kernel {
public:
    static const char* name() { return "Arccosh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

}  // namespace chainerx

#pragma once

#include "chainerx/array.h"
#include "chainerx/kernel.h"

namespace chainerx {

class SinhKernel : public Kernel {
public:
    static const char* name() { return "Sinh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class CoshKernel : public Kernel {
public:
    static const char* name() { return "Cosh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class TanhKernel : public Kernel {
public:
    static const char* name() { return "Tanh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class ArcsinhKernel : public Kernel {
public:
    static const char* name() { return "Arcsinh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

class ArccoshKernel : public Kernel {
public:
    static const char* name() { return "Arccosh"; }

    virtual void Call(const Array& x, const Array& out) = 0;
};

}  // namespace chainerx

Fix a typo in a kernel name

Fix a typo in a kernel name


//
//  refract/ElementInserter.h
//  librefract
//
//  Created by Jiri Kratochvil on 17/06/15.
//  Copyright (c) 2015 Apiary Inc. All rights reserved.
//
#ifndef REFRACT_ELEMENTINSERTER_H
#define REFRACT_ELEMENTINSERTER_H

#include <iterator>

namespace refract
{

    // Forward declarations of Elements
    struct IElement;

    template <typename T>
    struct ElementInsertIterator : public std::iterator<std::output_iterator_tag, void, void, void, void> {
        T& element;
        ElementInsertIterator(T& element) : element(element) {}

        ElementInsertIterator& operator=(refract::IElement* e) {
            element.push_back(e);
            return *this;
        }

        ElementInsertIterator& operator++() {
            return *this;
        }

        ElementInsertIterator& operator*() {
            return *this;
        }

    };

    template <typename T>
    ElementInsertIterator<T> ElementInserter(T& element) {
        return ElementInsertIterator<T>(element);
    }

}; // namespace refract

#endif // #ifndef REFRACT_ELEMENTINSERTER_H

//
//  refract/ElementInserter.h
//  librefract
//
//  Created by Jiri Kratochvil on 17/06/15.
//  Copyright (c) 2015 Apiary Inc. All rights reserved.
//
#ifndef REFRACT_ELEMENTINSERTER_H
#define REFRACT_ELEMENTINSERTER_H

#include <iterator>

namespace refract
{

    // Forward declarations of Elements
    struct IElement;

    template <typename T>
    struct ElementInsertIterator : public std::iterator<std::output_iterator_tag, void, void, void, void> {
        T& element;

        ElementInsertIterator(T& element) : element(element) {}

        ElementInsertIterator(const ElementInsertIterator& other) : element(other.element) {}

        ElementInsertIterator& operator=(const ElementInsertIterator& other) {
            element = other.element;
            return *this;
        }

        ElementInsertIterator& operator=(refract::IElement* e) {
            element.push_back(e);
            return *this;
        }

        ElementInsertIterator& operator=(const refract::IElement* e) {
            element.push_back(e);
            return *this;
        }

        ElementInsertIterator& operator++() {
            return *this;
        }

        ElementInsertIterator& operator*() {
            return *this;
        }

    };

    template <typename T>
    ElementInsertIterator<T> ElementInserter(T& element) {
        return ElementInsertIterator<T>(element);
    }

}; // namespace refract

#endif // #ifndef REFRACT_ELEMENTINSERTER_H

Add copy c-tor and assign operator to ElementInsertIterator


/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_
#define TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_

#include "tensorflow/core/platform/threadpool_interface.h"

namespace tensorflow {
namespace thread {

struct ThreadPoolOptions {
  // If not null, use this threadpool to schedule inter-op operation
  thread::ThreadPoolInterface* inter_op_threadpool;

  // If not null, use this threadpool to schedule intra-op operation
  thread::ThreadPoolInterface* intra_op_threadpool;
};

}  // namespace thread
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_

/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_
#define TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_

#include "tensorflow/core/platform/threadpool_interface.h"

namespace tensorflow {
namespace thread {

struct ThreadPoolOptions {
  // If not null, use this threadpool to schedule inter-op operation
  thread::ThreadPoolInterface* inter_op_threadpool = nullptr;

  // If not null, use this threadpool to schedule intra-op operation
  thread::ThreadPoolInterface* intra_op_threadpool = nullptr;
};

}  // namespace thread
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_THREADPOOL_OPTIONS_H_

Initialize the inter and intra-op thread pool pointers in ThreadPoolOptions to nullptr. Otherwise, they may have arbitrary values.

PiperOrigin-RevId: 294833933
Change-Id: I95ff98f6a7fe308c59f1c8bf7e1b25f4c68223dc


// Make sure instrumentation data from available_externally functions doesn't
// get thrown out and are emitted with the expected linkage.
// RUN: %clang_cc1 -O2 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage-available_externally.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s

// CHECK: @__profc_foo = linkonce_odr hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
// CHECK: @__profd_foo = linkonce_odr hidden global {{.*}} i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0){{.*}}, section "__DATA,__llvm_prf_data", align 8
inline int foo(void) { return 1; }

int main(void) {
  return foo();
}

// Make sure instrumentation data from available_externally functions doesn't
// get thrown out and are emitted with the expected linkage.
// RUN: %clang_cc1 -O2 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage-available_externally.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s

// CHECK: @__profc_foo = linkonce_odr hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
// CHECK: @__profd_foo = linkonce_odr hidden global {{.*}} i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0){{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8
inline int foo(void) { return 1; }

int main(void) {
  return foo();
}

Update testcase for r283948 (NFC)

[Profile] Update testcase for r283948 (NFC)

Old: "__DATA,__llvm_prf_data"
New: "__DATA,__llvm_prf_data,regular,live_support"

This should fix the following bot failure:

  http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55158

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


// rdar://10588825

// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only

// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only

#ifndef HEADER
#define HEADER

#define SKATA

#define __stdcall
#define STDCALL __stdcall

void STDCALL Foo(void);

#else

void STDCALL Foo(void)
{
}

#endif

// rdar://10588825

// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only

// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only

#ifndef HEADER
#define HEADER

#define __stdcall
#define STDCALL __stdcall

void STDCALL Foo(void);

#else

void STDCALL Foo(void)
{
}

#endif

[PCH] Remove extraneous line in the test that was mistakenly copied.

No functionality change.

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


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

#define LINE_BUF_SIZE  1024
#define LENGTH(array)  (sizeof(array) / sizeof((array)[0]))

int
main(void)
{
  static char line[LINE_BUF_SIZE];

  while (fgets(line, sizeof(line), stdin) != NULL) {
    int a, b;
    if (sscanf(line, "%d %d", &a, &b) != 2) {
      fputs("sscanf: Convert error\n", stderr);
      return EXIT_FAILURE;
    }
    <+CURSOR+>
  }
  return EXIT_SUCCESS;
}

Add a programming contest template for C


// RUN: %clang -fsyntax-only %s 2>&1 | FileCheck %s
// REQUIRES: crash-recovery
// XFAIL: mingw32,win32

#pragma clang __debug parser_crash
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
// CHECK-NEXT: {{.*}}: note: diagnostic msg: {{.*}}.c

// RUN: rm %T/crash-report-*.c %T/crash-report-*.sh
// RUN: TMP=%T %clang -fsyntax-only %s -DFOO=BAR 2>&1 | FileCheck %s
// RUN: FileCheck --check-prefix=CHECKSRC %s < %T/crash-report-*.c
// RUN: FileCheck --check-prefix=CHECKSH %s < %T/crash-report-*.sh
// REQUIRES: crash-recovery
// XFAIL: mingw32,win32

#pragma clang __debug parser_crash
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
// CHECK-NEXT: note: diagnostic msg: {{.*}}.c
FOO
// CHECKSRC: FOO
// CHECKSH: -D FOO=BAR

Improve crash reporting test coverage.

Improve crash reporting test coverage.

This adds validation that the
* repro source is only rewrite-includes processed, not fully preprocessed.
* repro script contains macro definitions (-DFOO=BAR).

Based on suggestions/help by Matt Beaumont-Gay.

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


// RUN: %clang -O1 -fexperimental-new-pass-manager -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
extern int a[16];
int b = 0;
int foo(void) {
#pragma unroll
  for (int i = 0; i < 16; ++i)
    a[i] = b += 2;
  return b;
}
// CHECK-NOT: br i1

// RUN: %clang -O1 -fexperimental-new-pass-manager -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
// RUN: %clang -O1 -fno-experimental-new-pass-manager -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
extern int a[16];
int b = 0;
int foo(void) {
#pragma unroll
  for (int i = 0; i < 16; ++i)
    a[i] = b += 2;
  return b;
}
// CHECK-NOT: br i1

Add -fno-experimental-pass-manager to make clear which pass manager
we're running and to make flipping the default not regress testing.

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


Release notes for i3 v3.γ
-----------------------------

This is the third version (3.γ, transcribed 3.c) of i3. It is considered stable.

This release contains many small improvements like using keysymbols in the
configuration file, named workspaces, borderless windows, an IPC interface
etc. (see below for a complete list of changes)

Thanks for this release go out to bapt, badboy, Atsutane, tsdh, xeen, mxf,
and all other people who reported bugs/made suggestions.

Special thanks go to steckdenis, yellowiscool and farvardin who designed a logo
for i3.

A list of changes follows:

  * Implement a reload command
  * Implement keysymbols in configuration file
  * Implement assignments of workspaces to screens
  * Implement named workspaces
  * Implement borderless/1-px-border windows
  * Implement command to focus screens
  * Implement IPC via unix sockets
  * Correctly render decoration of floating windows
  * Map floating windows requesting (0x0) to center of their leader/workspace
  * Optimization: Render stack windows on pixmaps to reduce flickering
  * Optimization: Directly position new windows to their final position
  * Bugfix: Repeatedly try to find screens if none are available
  * Bugfix: Correctly redecorate clients when changing focus
  * Bugfix: Don’t crash when clients reconfigure themselves
  * Bugfix: Fix screen wrapping
  * Bugfix: Fix selecting a different screen with your mouse when not having
    any windows on the current workspace
  * Bugfix: Correctly unmap stack windows and don’t re-map them too early
  * Bugfix: Allow switching layout if there are no clients in the this container
  * Bugfix: Set WM_STATE_WITHDRAWN when unmapping, unmap windows when
    destroying
  * Bugfix: Don’t hide assigned clients to inactive but visible workspaces

-- Michael Stapelberg, 2009-08-19

Add release notes for 3.γ

Add release notes for 3.γ


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

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

int main(int argc, char **argv, char **env) {
  int count = 0;
  char **ptr;

  for (ptr = environ; *ptr != NULL; ptr++) {
    count++;
  }
  printf("%i environment variables\n", count);
  for (ptr = environ; *ptr != NULL; ptr++) {
    printf("%s\n", *ptr);
  }

  assert(env == environ);

  return 0;
}

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

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

/*
 * In the glibc dynamic linking case, CommandSelLdrTestNacl
 * passes LD_LIBRARY_PATH in the environment for tests.
 * Ignore this variable for purposes of this test.
 */
static bool skip_env_var(const char *envstring) {
#ifdef __GLIBC__
  static const char kLdLibraryPath[] = "LD_LIBRARY_PATH=";
  if (!strncmp(envstring, kLdLibraryPath, sizeof(kLdLibraryPath) - 1))
    return true;
#endif
  return false;
}

int main(int argc, char **argv, char **env) {
  int count = 0;
  char **ptr;

  for (ptr = environ; *ptr != NULL; ptr++) {
    if (!skip_env_var(*ptr))
      count++;
  }
  printf("%i environment variables\n", count);
  for (ptr = environ; *ptr != NULL; ptr++) {
    if (!skip_env_var(*ptr))
      puts(*ptr);
  }

  assert(env == environ);

  return 0;
}

Make environment_variables test ignore LD_LIBRARY_PATH for glibc

This test pumps specific values through sel_ldr with -E and then
tests that the entire environment seen by the untrusted program
is exactly that list, using a golden file.  CommandSelLdrTestNacl
uses -E to pass LD_LIBRARY_PATH to the nexe for new (ARM) glibc.
So that variable's presence in environ is not a bug.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3068
TEST= trybots + scons platform=arm --nacl_glibc run_env_var_test_irt
R=phosek@chromium.org, mseaborn@chromium.org

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


/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_

#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"

namespace xla {

class ScatterExpander : public HloModulePass {
 public:
  absl::string_view name() const override { return "scatter_expander"; }
  StatusOr<bool> Run(HloModule* module) override;

 private:
  StatusOr<HloInstruction*> ExpandScatter(HloInstruction* scatter);
};

}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_

/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_

#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"

namespace xla {

class ScatterExpander : public HloModulePass {
 public:
  absl::string_view name() const override { return "scatter_expander"; }
  StatusOr<bool> Run(HloModule* module) override;

 protected:
  StatusOr<HloInstruction*> ExpandScatter(HloInstruction* scatter);
};

}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_SCATTER_EXPANDER_H_

[XLA] Make ScatterExpander methods 'protected' to enable overriding them in a subclass.

PiperOrigin-RevId: 217914138


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

#ifndef XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_
#define XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_

#include "xwalk/application/browser/application_system.h"

namespace xwalk {
class DBusManager;
}

namespace xwalk {
namespace application {

class ApplicationServiceProviderLinux;

class ApplicationSystemLinux : public ApplicationSystem {
 public:
  explicit ApplicationSystemLinux(RuntimeContext* runtime_context);
  virtual ~ApplicationSystemLinux();

  DBusManager& dbus_manager();

 private:
  scoped_ptr<ApplicationServiceProviderLinux> service_provider_;
  scoped_ptr<DBusManager> dbus_manager_;

  DISALLOW_COPY_AND_ASSIGN(ApplicationSystemLinux);
};

}  // namespace application
}  // namespace xwalk

#endif  // XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_

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

#ifndef XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_
#define XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_

#include "xwalk/application/browser/application_system.h"

namespace xwalk {
class DBusManager;
}

namespace xwalk {
namespace application {

class ApplicationServiceProviderLinux;

class ApplicationSystemLinux : public ApplicationSystem {
 public:
  explicit ApplicationSystemLinux(RuntimeContext* runtime_context);
  virtual ~ApplicationSystemLinux();

  DBusManager& dbus_manager();

 private:
  scoped_ptr<DBusManager> dbus_manager_;
  scoped_ptr<ApplicationServiceProviderLinux> service_provider_;

  DISALLOW_COPY_AND_ASSIGN(ApplicationSystemLinux);
};

}  // namespace application
}  // namespace xwalk

#endif  // XWALK_APPLICATION_BROWSER_APPLICATION_SYSTEM_LINUX_H_

Fix crash when shutting down

[Application][D-Bus] Fix crash when shutting down

DBusManager owns the Bus connection and was being destroyed before the
service provider that uses it.

TEST=Loaded xwalk --run-as-service and xwalkctl <APP_ID> then closed the
window. The first process should not crash but exit cleanly.


//
//  _RXDelegateProxy.h
//  RxCocoa
//
//  Created by Krunoslav Zaher on 7/4/15.
//  Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface _RXDelegateProxy : NSObject

@property (nonatomic, assign, readonly) id _forwardToDelegate;

-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate;

-(BOOL)hasWiredImplementationForSelector:(SEL)selector;

-(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments;

@end

//
//  _RXDelegateProxy.h
//  RxCocoa
//
//  Created by Krunoslav Zaher on 7/4/15.
//  Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface _RXDelegateProxy : NSObject

@property (nonatomic, weak, readonly) id _forwardToDelegate;

-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate;

-(BOOL)hasWiredImplementationForSelector:(SEL)selector;

-(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments;

@end

Change _forwardToDelegate to weak reference


#pragma once

#include "../TKernel/Precompiled.h"
#include "../TKMath/Precompiled.h"

#include "Standard.hxx"
#include "Aspect.hxx"
#include "Aspect_Handle.hxx"
#include "Image.hxx"
#include "SelectBasics.hxx"

#pragma once

#include "../TKernel/Precompiled.h"
#include "../TKMath/Precompiled.h"

#include "Standard.hxx"
#include "Aspect.hxx"
#include "Aspect_Handle.hxx"
#include "SelectBasics.hxx"

Fix precompiled headers, Image.hxx has been removed from OCCT 6.7.0


/** Exercise 1.19
 * Write a function reverse(s) that reverses the character string s. Use it to
 * write a program that reverses its input a line at a time.
 */
#include <stdio.h>

#define BUFSIZE 1024

int _getline(char[], int);
void reverse(char[], int);

main() {
    char line[BUFSIZE];
    int length;

    while ((length = _getline(line, BUFSIZE)) > 0) {
        if (line[length-1] == '\n') {
            length--;
        }
        reverse(line, length);
        printf("%s", line);
    }

    return 0;
}

int _getline(char s[], int lim) {
    int c, i;

    for (i=0; i<lim-1 && (c=getchar())!=EOF && c != '\n'; ++i) {
        s[i] = c;
    }
    if (c == '\n') {
        s[i] = c;
        ++i;
    }
    s[i] = '\0';
    return i;
}

void reverse(char s[], int size) {
    if (size < 2) {
        return;
    }

    int i, j;
    char tmp;

    for (i = 0, j = size - 1; i < size/2; ++i, --j) {
        tmp = s[i];
        s[i] = s[j];
        s[j] = tmp;
    }
}

Add solution for exercise 19.

Add solution for exercise 19.


//
//  Hauth.h
//  Hauth
//
//  Created by Rizwan Sattar on 11/7/15.
//  Copyright © 2015 Rizwan Sattar. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for Hauth.
FOUNDATION_EXPORT double HauthVersionNumber;

//! Project version string for Hauth.
FOUNDATION_EXPORT const unsigned char HauthVersionString[];

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

//
//  Hauth.h
//  Hauth
//
//  Created by Rizwan Sattar on 11/7/15.
//  Copyright © 2015 Rizwan Sattar. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for Hauth.
FOUNDATION_EXPORT double HauthVersionNumber;

//! Project version string for Hauth.
FOUNDATION_EXPORT const unsigned char HauthVersionString[];

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

// NOTE: In Xcode 7.1, if two frameworks have the same module name ("Hauth"),
// then sometimes one of the frameworks (in my case, tvOS) doesn't compile correctly,
// complaining of the inclusion of "non-modular headers". So make these
// non modular import calls here.
#import "HauthStreamsController.h"
#import "HauthClient.h"
#import "HauthServer.h"
//#import <Hauth/HauthStreamsController.h>
//#import <Hauth/HauthClient.h>
//#import <Hauth/HauthServer.h>

Use "" imports instead of <> in main fmwk header

Xcode 7.1 seems to be having issues with the framework being the same module name and existing as 2 different targets (one tvOS, and one iOS). It complains in the tvOS app that the framework includes 'non-modular' headers in the framework. Changing it to quotes for now seems to fix this. Let's revisit with Xcode 7.2


#ifdef __linux__
# define _GNU_SOURCE
# include <bsd/stdlib.h>
# include <grp.h>
int	setresgid(gid_t, gid_t, gid_t);
int	setresuid(gid_t, gid_t, gid_t);
#endif

#ifdef __FreeBSD__
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <resolv.h>
#endif

/*
 * Require libbsd's stdlib.h for arc4random() etc.
 * Require <grp.h> for setgroups().
 */
#ifdef __linux__
# define _GNU_SOURCE
# include <bsd/stdlib.h>
# include <grp.h>
#endif

/*
 * Neither Linux nor Apple have this.
 */
#if defined(__linux__) || defined(__APPLE__)
# include <unistd.h>
int	setresgid(gid_t, gid_t, gid_t);
int	setresuid(gid_t, gid_t, gid_t);
#endif

/*
 * FreeBSD goop.
 */
#ifdef __FreeBSD__
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <resolv.h>
#endif

Document goop and have both Linux and Mac OS X define setresuid et al.


//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2016 Luis Barrancos, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#ifndef AS_MAYA_TRANSFORM_HELPERS_H
#define AS_MAYA_TRANSFORM_HELPERS_H

int outside_place3d_volume(
    point surface_point,
    int wrap,
    float blend,
    output float blend_factor)
{
    int outside = 0;
    blend_factor = 0.0;

    if (!wrap || blend)
    {
        if (!wrap)
        {
            // Default placement box bottom = (-1,-1,-1), top = (1,1,1), Δ=2.
            if (surface_point[0] < -1 || surface_point[0] > 1 ||
                surface_point[1] < -1 || surface_point[1] > 1 ||
                surface_point[2] < -1 || surface_point[2] > 1)
            {
                outside = 1;
            }
            else if (blend)
            {
                float min_distance = 1.0e+19;

                for (int i = 0; i < 3; ++i)
                {
                    min_distance = min(min_distance, min(
                        abs(surface_point[i] - 1),
                        abs(surface_point[i] + 1)));
                }
                blend_factor = min_distance * 0.5; // Δ=2
            }
        }
    }
    return outside;
}

#endif // AS_MAYA_TRANSFORM_HELPERS_H

Add placement3d node auxiliary functions


#import <CareKit/CareKit.h>

@interface CMHMutedEventUpdater : NSObject

- (instancetype)initWithCarePlanStore:(OCKCarePlanStore *)store
                                event:(OCKCarePlanEvent *)event
                               result:(OCKCarePlanEventResult *)result
                                state:(OCKCarePlanEventState)state;

- (NSError *_Nullable)performUpdate;

@end

#import <CareKit/CareKit.h>

@interface CMHMutedEventUpdater : NSObject

- (_Nonnull instancetype)initWithCarePlanStore:(OCKCarePlanStore *_Nonnull)store
                                         event:(OCKCarePlanEvent *_Nonnull)event
                                        result:(OCKCarePlanEventResult *_Nullable)result
                                         state:(OCKCarePlanEventState)state;

- (NSError *_Nullable)performUpdate;

@end

Add Nullability annotations to the event updater class


class ThreadPoolThread;

class ThreadPool {
	public:
		ThreadPool();
		ThreadPool(int nthread);
		ThreadPool(int nthread, size_t maxqueue);
		~ThreadPool();

		void Add(std::function<void()> func);
		void Flush();

		void Execute();

		size_t GetCount();
		size_t GetHWCount();

	protected:
		void Init(int nthread, size_t maxqueue);

	private:
		std::atomic<uint64_t> m_totalqueued;
		std::atomic<uint64_t> m_totalexecuted;
		Queue<std::function<void()> > m_queue;
		std::list<ThreadPoolThread *> m_threads;
};

Convert from tabs -> spaces

Convert from tabs -> spaces


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

  @file         main.c

  @author       Stephen Brennan

  @date         Created Thursday, 12 September 2013

  @brief        Run tests on the libstephen library.

  @copyright    Copyright (c) 2013-2015, Stephen Brennan.  Released under the
                Revised BSD License.  See the LICENSE.txt file for details.

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

#include <stdio.h>

#include "libstephen/base.h"
#include "tests.h"

/**
   Main test function
 */
int main(int argc, char ** argv)
{
  linked_list_test();
  array_list_test();
  hash_table_test();
  bit_field_test();
  iter_test();
  list_test();
  args_test();
  charbuf_test();
  log_test();
  string_test();
  fsm_test();
  fsm_io_test();
  regex_test();
  regex_search_test();
  // return args_test_main(argc, argv);
}

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

  @file         main.c

  @author       Stephen Brennan

  @date         Created Thursday, 12 September 2013

  @brief        Run tests on the libstephen library.

  @copyright    Copyright (c) 2013-2015, Stephen Brennan.  Released under the
                Revised BSD License.  See the LICENSE.txt file for details.

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

#include <stdio.h>

#include "libstephen/base.h"
#include "libstephen/log.h"
#include "tests.h"

/**
   Main test function
 */
int main(int argc, char ** argv)
{
  sl_set_level(NULL, LEVEL_INFO);
  linked_list_test();
  array_list_test();
  hash_table_test();
  bit_field_test();
  iter_test();
  list_test();
  args_test();
  charbuf_test();
  string_test();
  fsm_test();
  fsm_io_test();
  regex_test();
  regex_search_test();
  log_test();
  // return args_test_main(argc, argv);
}

Set log level in tests.

Set log level in tests.


/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef CONFIG_H
#define CONFIG_H 1

#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>

#else

#if !defined(__cplusplus) && !defined(linux) && !defined(__GNUC__)
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif

#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS
#endif

#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/resource.h>
#include <sys/uio.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/mman.h>
#include <pwd.h>
#include <sys/time.h>
#include <signal.h>

#endif

/* Common section */
#include <stdlib.h>
#include <inttypes.h>
#include <sys/types.h>

#include <platform/platform.h>

#endif

/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef CONFIG_H
#define CONFIG_H 1

#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>

#else

#if !defined(__cplusplus) && !defined(linux) && !defined(__GNUC__)
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif

#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS
#endif

#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/resource.h>
#include <sys/uio.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/mman.h>
#include <pwd.h>
#include <sys/time.h>
#include <signal.h>
#include <inttypes.h>

#endif

/* Common section */
#include <stdlib.h>
#include <sys/types.h>

#include <platform/platform.h>

#endif

Fix build problem on W2008 in /xp /x86 /release mode

Change-Id: I1d51e4f9b1e0ae9f6df28a22bf13a5ab6bf55ab8
Reviewed-on: http://review.couchbase.org/28476
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>


// RUN: %check --only -e %s -Wno-incompatible-pointer-types '-DERROR(...)=__VA_ARGS__'
// RUN: %ucc -fsyntax-only %s '-DERROR(...)=' -Wno-incompatible-pointer-types -Wno-arith-funcptr

enum { false };

__attribute((weak)) void w();
void f();

ERROR(int shortcircuit_weak_1 = w && 1;) // CHECK: error: global scalar initialiser not constant
ERROR(int shortcircuit_weak_2 = w && 0;) // CHECK: error: global scalar initialiser not constant
ERROR(int shortcircuit_weak_3 = 1 && w;) // CHECK: error: global scalar initialiser not constant
_Static_assert((0 && w) == false, "");

ERROR(int shortcircuit_weak_5 = w || 1;) // CHECK: error: global scalar initialiser not constant
ERROR(int shortcircuit_weak_6 = w || 0;) // CHECK: error: global scalar initialiser not constant
_Static_assert(1 || w, "");
ERROR(int shortcircuit_weak_8 = 0 || w;) // CHECK: error: global scalar initialiser not constant

_Static_assert(f && 1, "");
_Static_assert((f && 0) == false, "");
_Static_assert(1 && f, "");
_Static_assert((0 && f) == false, "");

_Static_assert(f || 1, "");
_Static_assert(f || 0, "");
_Static_assert(1 || f, "");
_Static_assert(0 || f, "");

// ---------

void (*arith_fptr_1)() = f + 2; // CHECK: warning: arithmetic on function pointer 'void (*)()'
void (*arith_fptr_2)() = w + 2; // CHECK: warning: arithmetic on function pointer 'void (*)()'

_Static_assert(!&f == false, "");
ERROR(int arith_2 = !&w;) // CHECK: error: global scalar initialiser not constant
_Static_assert(!f == false, "");
ERROR(int arith_4 = !w;) // CHECK: error: global scalar initialiser not constant
_Static_assert((0 == f) == false, "");
ERROR(int arith_6 = 0 == w;) // CHECK: error: global scalar initialiser not constant
_Static_assert(0 != f, "");
ERROR(int arith_8 = 0 != w;) // CHECK: error: global scalar initialiser not constant
_Static_assert((f == w) == false, "");
_Static_assert(f != w, "");
_Static_assert((f - f) == false, "");
_Static_assert((w - w) == false, "");
ERROR(int arith_13 = f - w;) // CHECK: error: global scalar initialiser not constant
ERROR(int arith_14 = w - f;) // CHECK: error: global scalar initialiser not constant

Test constant-folding of weak identifiers


// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2003 University of Stuttgart, 2004-2005 Brown University
// Contact: Jurgen P. Schulze, jschulze@ucsd.edu
//
// This file is part of Virvo.
//
// Virvo is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#ifndef VV_SERVERMONDIALOG_H
#define VV_SERVERMONDIALOG_h

#include <QDialog>

class Ui_ServerMonDialog;

class vvServerMonDialog : public QDialog
{
  Q_OBJECT
public:
  vvServerMonDialog(QWidget* parent = 0);
  ~vvServerMonDialog();
private:
  Ui_ServerMonDialog* ui;
};

#endif

// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2003 University of Stuttgart, 2004-2005 Brown University
// Contact: Jurgen P. Schulze, jschulze@ucsd.edu
//
// This file is part of Virvo.
//
// Virvo is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#ifndef VV_SERVERMONDIALOG_H
#define VV_SERVERMONDIALOG_H

#include <QDialog>

class Ui_ServerMonDialog;

class vvServerMonDialog : public QDialog
{
  Q_OBJECT
public:
  vvServerMonDialog(QWidget* parent = 0);
  ~vvServerMonDialog();
private:
  Ui_ServerMonDialog* ui;
};

#endif

Fix typo in header guard

Fix typo in header guard


#ifndef EVOLUTION_H
#define EVOLUTION_H

#include "fitness.h"

#define POPULATION_SIZE     50
#define TOURNAMENT_SIZE     5

// Evolution
class EVOLUTION
{
public:
  int crossover(int **newPop,
                int **pop,
                int index,
                int tournament1,
                int tournament2,
                FITNESS Fitness);
  int tournamentSelection(int **population, FITNESS Fitness);
  int evolve(int **population, FITNESS Fitness);

};

#endif

#ifndef EVOLUTION_H
#define EVOLUTION_H

#include "fitness.h"
#include "population.h"

#define POPULATION_SIZE     50
#define TOURNAMENT_SIZE     5

// Evolution
class EVOLUTION
{
public:
  int crossover(int **newPop,
                int **pop,
                int index,
                int tournament1,
                int tournament2,
                FITNESS Fitness);
  int tournamentSelection(int **population, FITNESS Fitness);
  int evolve(int **population, FITNESS Fitness);

};

#endif

Update include to header file 'population.h'


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

#ifndef PPAPI_C_PPB_FIND_H_
#define PPAPI_C_PPB_FIND_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_stdint.h"

#define PPB_FIND_INTERFACE "PPB_Find;1"

typedef struct _ppb_Find {
  // Updates the number of find results for the current search term.  If
  // there are no matches 0 should be passed in.  Only when the plugin has
  // finished searching should it pass in the final count with finalResult set
  // to true.
  void NumberOfFindResultsChanged(PP_Instance instance,
                                  int32_t total,
                                  bool final_result);

  // Updates the index of the currently selected search item.
  void SelectedFindResultChanged(PP_Instance instance,
                                 int32_t index);

} PPB_Find;

#endif  // PPAPI_C_PPB_FIND_H_

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

#ifndef PPAPI_C_PPB_FIND_H_
#define PPAPI_C_PPB_FIND_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_stdint.h"

#define PPB_FIND_INTERFACE "PPB_Find;1"

typedef struct _ppb_Find {
  // Updates the number of find results for the current search term.  If
  // there are no matches 0 should be passed in.  Only when the plugin has
  // finished searching should it pass in the final count with finalResult set
  // to true.
  void (*NumberOfFindResultsChanged)(PP_Instance instance,
                                     int32_t total,
                                     bool final_result);

  // Updates the index of the currently selected search item.
  void (*SelectedFindResultChanged)(PP_Instance instance,
                                    int32_t index);

} PPB_Find;

#endif  // PPAPI_C_PPB_FIND_H_

Structure member should be function pointer

BUG=none
TEST=compiles

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


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

#ifndef UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

#include "ui/message_center/message_view.h"
#include "ui/message_center/notification_list.h"

namespace views {
class ImageView;
}

namespace message_center {

// A comprehensive message view.
class BaseFormatView : public MessageView {
 public:
  BaseFormatView(NotificationList::Delegate* list_delegate,
                 const NotificationList::Notification& notification);
  virtual ~BaseFormatView();

  // MessageView
  virtual void SetUpView() OVERRIDE;

  // views::ButtonListener
  virtual void ButtonPressed(views::Button* sender,
                             const ui::Event& event) OVERRIDE;

 protected:
  BaseFormatView();

  DISALLOW_COPY_AND_ASSIGN(BaseFormatView);
};

}  // namespace message_center

#endif // UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

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

#ifndef UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

#include "ui/message_center/message_view.h"
#include "ui/message_center/notification_list.h"

namespace views {
class ImageView;
}

namespace message_center {

// A comprehensive message view.
class BaseFormatView : public MessageView {
 public:
  BaseFormatView(NotificationList::Delegate* list_delegate,
                 const NotificationList::Notification& notification);
  virtual ~BaseFormatView();

  // MessageView
  virtual void SetUpView() OVERRIDE;

  // views::ButtonListener
  virtual void ButtonPressed(views::Button* sender, const ui::Event& event);

 protected:
  BaseFormatView();

  DISALLOW_COPY_AND_ASSIGN(BaseFormatView);
};

}  // namespace message_center

#endif // UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

Revert 167593 - Add an OVERRIDE keyword
This change adds an OVERRIDE keyword to the BaseFormatView::ButtonPressed function to fix a build break on the "Linux ChromiumOS (Clang dbg)" bot.

The CL this tries to fix is broken. Reverting the fix, so I can revert the CL

TBR=miket
BUG=none
TEST=fix builds on the "Linux ChromiumOS (Clang dbg)" bot and the "Linux Chromium OS ASAN Builder" bot.
Review URL: https://codereview.chromium.org/11410077

TBR=hbono@chromium.org
Review URL: https://codereview.chromium.org/11363241

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


/// \file
/// \brief This header contains functionality needed for serializing and deserealizing to/from a stream
#pragma once

#include <ISerializable.h>
#include <IStorage.h>

#include <iostream>

/// Contains all the functionality provided by the library.
namespace simpson
{

/// Serialize object to ostream
std::ostream& operator<<(std::ostream& outStream, simpson::ISerializable& obj);
/// Deserialize object from istream
std::istream& operator>>(std::istream& inStream, simpson::ISerializable* obj);

} // simpson

/// \file
/// \brief This header contains functionality needed for serializing and deserealizing to/from a stream
#pragma once

#include "ISerializable.h"
#include "IStorage.h"

#include <iostream>

/// Contains all the functionality provided by the library.
namespace simpson
{

/// Serialize object to ostream
std::ostream& operator<<(std::ostream& outStream, simpson::ISerializable& obj);
/// Deserialize object from istream
std::istream& operator>>(std::istream& inStream, simpson::ISerializable* obj);

} // simpson

Replace include <> with ""

Replace include <> with ""


#ifndef CONST_H
#define CONST_H

#include <cmath>
#include <cstdlib>

typedef unsigned long long uint64;

namespace Const
{
constexpr int HASH_BASE = 31415927;

constexpr double EPS = 1e-6;
constexpr double PI = M_PI;

inline int randUInt()
{
#ifdef _WIN32
    return (rand() << 15) | rand();
#else
    return rand();
#endif
}

inline uint64 randUInt64()
{
#ifdef _WIN32
    return (((((1ll * rand() << 15) | rand()) << 15) | rand()) << 15) | rand();
#else
    return (1ll * rand() << 31) | rand();
#endif
}

inline double randDouble()
{
#ifdef _WIN32
    return 1.0 * randUInt() / (1 << 20);
#else
    return 1.0 * rand() / RAND_MAX;
#endif
}
}

#endif // CONST_H

#ifndef CONST_H
#define CONST_H

#include <cmath>
#include <cstdlib>

typedef unsigned long long uint64;

namespace Const
{
constexpr int HASH_BASE = 31415927;

constexpr double EPS = 1e-6;
constexpr double PI = M_PI;

inline int randUInt()
{
#ifdef _WIN32
    return (rand() << 15) | rand();
#else
    return rand();
#endif
}

inline uint64 randUInt64()
{
#ifdef _WIN32
    return (((((1ll * rand() << 15) | rand()) << 15) | rand()) << 15) | rand();
#else
    return (1ll * rand() << 31) | rand();
#endif
}

inline double randDouble()
{
#ifdef _WIN32
    return 1.0 * randUInt() / (1 << 30);
#else
    return 1.0 * rand() / RAND_MAX;
#endif
}
} // namespace Const

#endif // CONST_H

Fix randDouble() bug on windows

Fix randDouble() bug on windows


// Copyright (c) 2016 Brian Barto
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the MIT License. See LICENSE for more details.

#include <string.h>
#include "config.h"

// Static Variables
static char payload[PAYLOAD_SIZE + 1];

void inputpayload_init(void) {
	memset(payload, 0, sizeof(PAYLOAD_SIZE + 1));
}

void inputpayload_set(char *data) {
	strncpy(payload, data, PAYLOAD_SIZE);
}

char *inputpayload_get(void) {
	return payload;
}

void inputpayload_parse(char *data) {
	strncpy(payload, data + COMMAND_SIZE, PAYLOAD_SIZE);
}

// Copyright (c) 2016 Brian Barto
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the MIT License. See LICENSE for more details.

#include <string.h>
#include "config.h"

// Static Variables
static char payload[PAYLOAD_SIZE + 1];

void inputpayload_init(void) {
	memset(payload, 0, sizeof(PAYLOAD_SIZE + 1));
}

void inputpayload_set(char *data) {
	strncpy(payload, data, PAYLOAD_SIZE);
}

char *inputpayload_get(void) {
	return payload;
}

void inputpayload_parse(char *data) {
	if (strlen(data) > COMMAND_SIZE)
		strncpy(payload, data + COMMAND_SIZE, PAYLOAD_SIZE);
	else
		memset(payload, 0, sizeof(PAYLOAD_SIZE + 1));
}

Make sure we don't increment data array past it's length when parsing payload

	modified:   src/modules/inputpayload.c


#include "gameboy.h"
#include "memory.h"

u8 select_rom_bank(u8 value)
{
	u8 ret = value & 0x1F;
	switch (mode) {
	case ROM:
		break;
	case MBC1:
		switch (ret) {
		case 0:
		case 0x20:
		case 0x40:
		case 0x60:
			break;
		default:
			ret -= 1;
		}
	}

	return ret;
}

u8 select_ram_bank(u8 value)
{
	return (value & 0x03);
}

u8 enable_ram(u8 value)
{
	u8 ram_enable;

	ram_enable = ((value & 0x0A) != 0x0A) ? 0 : 1;

	return ram_enable;
}

#include "gameboy.h"
#include "memory.h"

u8 select_rom_bank(u8 value)
{
	u8 ret = value & 0x1F;
	switch (mode) {
	case ROM:
		break;
	case MBC1:
		switch (ret) {
		case 0:
		case 0x20:
		case 0x40:
		case 0x60:
			break;
		default:
			ret -= 1;
		}
	}

	return ret;
}

u8 select_ram_bank(u8 value)
{
	return (value & 0x03);
}

u8 enable_ram(u8 value)
{
	return ((value & 0x0A) != 0x0A) ? 0 : 1;
}

Simplify return of ram_enable value

Simplify return of ram_enable value


// RUN: env RC_DEBUG_OPTIONS=1 %clang -ccc-host-triple i386-apple-darwin9 -g -Os %s  -emit-llvm -S -o - | FileCheck %s
// <rdar://problem/7256886>

// CHECK: !1 = metadata !{
// CHECK: -g -Os
// CHECK: -mmacosx-version-min=10.5.0
// CHECK: [ DW_TAG_compile_unit ]

int x;

// RUN: env RC_DEBUG_OPTIONS=1 %clang -ccc-host-triple i386-apple-darwin9 -g -Os %s  -emit-llvm -S -o - | FileCheck %s
// <rdar://problem/7256886>

// CHECK: !0 = metadata !{
// CHECK: -g -Os
// CHECK: -mmacosx-version-min=10.5.0
// CHECK: [ DW_TAG_compile_unit ]

int x;

Update metadata id number in string compare check.

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


/* global_setup.h
 *  Copyright: (When this is determined...it will go here)
 *  CVS Info
 *     $Id$
 *  Overview:
 *      Contains declarations of global data and the functions
 *      that initialize that data.
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_GLOBAL_SETUP_H_GUARD)
#define PARROT_GLOBAL_SETUP_H_GUARD

#include "parrot/config.h"

/* Needed because this might get compiled before pmcs have been built */
void Parrot_PerlUndef_class_init(INTVAL);
void Parrot_PerlInt_class_init(INTVAL);
void Parrot_PerlNum_class_init(INTVAL);
void Parrot_PerlString_class_init(INTVAL);
void Parrot_PerlArray_class_init(INTVAL);
void Parrot_PerlHash_class_init(INTVAL);
void Parrot_ParrotPointer_class_init(INTVAL);
void Parrot_IntQueue_class_init(INTVAL);

void
init_world(void);

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

/* global_setup.h
 *  Copyright: (When this is determined...it will go here)
 *  CVS Info
 *     $Id$
 *  Overview:
 *      Contains declarations of global data and the functions
 *      that initialize that data.
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_GLOBAL_SETUP_H_GUARD)
#define PARROT_GLOBAL_SETUP_H_GUARD

#include "parrot/config.h"

/* Needed because this might get compiled before pmcs have been built */
void Parrot_PerlUndef_class_init(INTVAL);
void Parrot_PerlInt_class_init(INTVAL);
void Parrot_PerlNum_class_init(INTVAL);
void Parrot_PerlString_class_init(INTVAL);
void Parrot_Array_class_init(INTVAL);
void Parrot_PerlArray_class_init(INTVAL);
void Parrot_PerlHash_class_init(INTVAL);
void Parrot_ParrotPointer_class_init(INTVAL);
void Parrot_IntQueue_class_init(INTVAL);

void
init_world(void);

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

Patch from Jonathan Stowe to prototype Parrot_Array_class_init

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@980 d31e2699-5ff4-0310-a27c-f18f2fbe73fe


#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

/** Base48 entry widget validator.
   Corrects near-miss characters and refuses characters that are no part of base48.
 */
class BitcoinAddressValidator : public QValidator
{
    Q_OBJECT

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

    State validate(QString &input, int &pos) const;

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

/** Base58 entry widget validator.
   Corrects near-miss characters and refuses characters that are not part of base58.
 */
class BitcoinAddressValidator : public QValidator
{
    Q_OBJECT

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

    State validate(QString &input, int &pos) const;

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

Fix typo in a comment: it's base58, not base48.


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

int main()
{
    int userInput = 0;
    unsigned long number = 0;
    while(1)
    {
        printf("Please enter a number between 1 and 6:");
        scanf("%d", &userInput);
        unsigned long incrementor = 0;
        switch(userInput)
        {
        case 1:
            incrementor += 5;
            break;
        case 2:
            incrementor += 9;
            break;
        case 3:
            incrementor += 18;
            break;
        case 4:
            incrementor += 34;
            break;
        case 5:
            incrementor += 59;
            break;
        case 6:
            incrementor += 95;
            break;
        default:
            printf("You have inputed incorrect number!\n");
        }
        number += incrementor;
        printf("Current number : %d \n", number);
    }
    return 0;
}

Make a program that is incrementing a variable with number based on user input using the following data: If user inputs - increments with : 1 - 5 2 - 9 3 - 18 4 - 34 5 - 59 6 - 95


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

#ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

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

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

#endif  // !BUILDING_CEF_SHARED

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

#ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_
#define CEF_LIBCEF_DLL_CEF_MACROS_H_
#pragma once

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

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

#endif  // !BUILDING_CEF_SHARED

#endif  // CEF_LIBCEF_DLL_CEF_MACROS_H_

Remove duplicate content in file.

Remove duplicate content in file.

git-svn-id: 07c9500005b9a5ecd02aa6a59d3db90a097b7e72@1734 5089003a-bbd8-11dd-ad1f-f1f9622dbc98


#include <stdlib.h>

#include "avl.h"

/*
 *
 *
 * forward declarations
 *
 *
 */

static void
destroy_subtree(
    struct avl_el* node //!< A node to destroy
);

/*
 *
 *
 * interface implementation
 *
 *
 */

struct avl*
avl_alloc(void) {
    return calloc(1, sizeof(struct avl));
}

int
avl_destroy(
    struct avl* avl //!< The avl tree
) {
    if (avl && avl->root) {
        destroy_subtree(avl->root);
    }
    free(avl);
    return 1;
}

/*
 *
 *
 * implementation of internal functions
 *
 *
 */

static void
destroy_subtree(
    struct avl_el* node //!< A node to destroy
) {
    if (node->l) {
        destroy_subtree(node->l);
    }
    if (node->r) {
        destroy_subtree(node->r);
    }

    free(node);
}

#include <stdlib.h>

#include "avl.h"

/*
 *
 *
 * forward declarations
 *
 *
 */

static void
destroy_subtree(
    struct avl_el* node //!< A node to destroy
);

/**
 * Rotate a node counter-clockwise
 *
 * @return new root or NULL, if the rotation could not be performed
 */
static struct avl_el*
rotate_left(
    struct avl_el* node //!< The node to rotate
);

/**
 * Rotate a node clockwise
 *
 * @return new root or NULL, if the rotation could not be performed
 */
static struct avl_el*
rotate_right(
    struct avl_el* node //!< The node to rotate
);

/*
 *
 *
 * interface implementation
 *
 *
 */

struct avl*
avl_alloc(void) {
    return calloc(1, sizeof(struct avl));
}

int
avl_destroy(
    struct avl* avl //!< The avl tree
) {
    if (avl && avl->root) {
        destroy_subtree(avl->root);
    }
    free(avl);
    return 1;
}

/*
 *
 *
 * implementation of internal functions
 *
 *
 */

static void
destroy_subtree(
    struct avl_el* node //!< A node to destroy
) {
    if (node->l) {
        destroy_subtree(node->l);
    }
    if (node->r) {
        destroy_subtree(node->r);
    }

    free(node);
}

static struct avl_el*
rotate_left(
    struct avl_el* node
) {
    return 0;
}

static struct avl_el*
rotate_right(
    struct avl_el* node
) {
    return 0;
}

Add declaration and stubs for rotations

Add declaration and stubs for rotations


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

#ifndef GrSlug_DEFINED
#define GrSlug_DEFINED

#include "include/private/chromium/Slug.h"

// TODO: Update Chrome to use sktext::gpu classes and remove these
using GrTextReferenceFrame = sktext::gpu::TextReferenceFrame;
using GrSlug = sktext::gpu::Slug;

#endif  // GrSlug_DEFINED

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

#ifndef GrSlug_DEFINED
#define GrSlug_DEFINED

#include "include/private/chromium/Slug.h"

// TODO: Update Chrome to use sktext::gpu classes and remove these
using GrSlug = sktext::gpu::Slug;

#endif  // GrSlug_DEFINED

Fix compile error on chrome bots

Fix compile error on chrome bots

Change-Id: Ie1d94106a741a9cc51dfd13813f143374392489a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543516
Commit-Queue: Herb Derby <9e12a3d2bbf73546e47cc9958f6ba8f3215b7eaf@google.com>
Reviewed-by: Greg Daniel <39df0a804564ccb6cf75f18db79653821f37c1c5@google.com>


/*
 * Copyright 2014 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkBlitRow_opts_SSE4_DEFINED
#define SkBlitRow_opts_SSE4_DEFINED

#include "SkBlitRow.h"

/* Check if we are able to build assembly code, GCC/AT&T syntax.
 * Had problems with LLVM-GCC 4.2.
 * MemorySanitizer cannot handle assembly code.
 */
#if (defined(__clang__) || (defined(__GNUC__) && !defined(SK_BUILD_FOR_MAC))) \
    && !defined(MEMORY_SANITIZER)
extern "C" void S32A_Opaque_BlitRow32_SSE4_asm(SkPMColor* SK_RESTRICT dst,
                                               const SkPMColor* SK_RESTRICT src,
                                               int count, U8CPU alpha);

#define SK_ATT_ASM_SUPPORTED
#endif

#endif

/*
 * Copyright 2014 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkBlitRow_opts_SSE4_DEFINED
#define SkBlitRow_opts_SSE4_DEFINED

#include "SkBlitRow.h"

/* Check if we are able to build assembly code, GCC/AT&T syntax:
 *  1) Clang and GCC are generally OK.  OS X's old LLVM-GCC 4.2 can't handle it;
 *  2) We're intentionally not linking this in even when supported (Clang) on Windows;
 *  3) MemorySanitizer cannot instrument assembly at all.
 */
#if /* 1)*/ (defined(__clang__) || (defined(__GNUC__) && !defined(SK_BUILD_FOR_MAC))) \
    /* 2)*/ && !defined(SK_BUILD_FOR_WIN)                                             \
    /* 3)*/ && !defined(MEMORY_SANITIZER)
extern "C" void S32A_Opaque_BlitRow32_SSE4_asm(SkPMColor* SK_RESTRICT dst,
                                               const SkPMColor* SK_RESTRICT src,
                                               int count, U8CPU alpha);

#define SK_ATT_ASM_SUPPORTED
#endif

#endif

Exclude Clang on Windows too.  Comment this up a bit.

BUG=391016
R=tomhudson@chromium.org, mtklein@google.com, rnk@chromium.org, thakis@chromium.org

Author: mtklein@chromium.org

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


#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);

# endif
#endif

#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_monitors_create(Evas_Object *obj);

# endif
#endif

Add header function for monitors_create.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84126


#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int main() {
  int fd1, fd2;
  fd1 = open("f1", O_RDWR);
  fd2 = open("f1", O_RDWR);

  lseek(fd1, -5, SEEK_END);
  lseek(fd2, 4, SEEK_SET);

  write(fd1, "xyzw", 4);
  write(fd2, "12", 2);

  char buff[10];
  int count;
  lseek(fd1, 0, SEEK_SET);
  while (count = read(fd1, buff, 10))
    write(1, buff, count);

  close(fd1);
  close(fd2);

  return 0;
}

Add old file from week2

Add old file from week2


#ifndef STREAMSREGISTRY_H
#define STREAMSREGISTRY_H

namespace TailProduce {

    class Stream;

    class StreamsRegistry {
      public:
        struct StreamsRegistryEntry {
            // The pointer to an instance of the stream is owned by TailProduce framework.
            // * For static frameworks (streams list is fully available at compile time),
            //   these pointers point to existing, statically initialized, members
            //   of the instance of cover TailProduce class.
            // * For dynamic frameworks, they point to dynamically allocated instances
            //   of per-stream implementations, which are also owned by the instance
            //   of the cover TailProduce class.
            const Stream* impl;
            std::string name;
            std::string entry_type;
            std::string order_key_type;
        };
        std::vector<StreamsRegistryEntry> streams;
        std::set<std::string> names;

        void Add(TailProduce::Stream* impl,
                 const std::string& name,
                 const std::string& entry_type,
                 const std::string& order_key_type) {
            if (names.find(name) != names.end()) {
                LOG(FATAL) << "Attempted to register the '" << name << "' stream more than once.";
            }
            names.insert(name);
            streams.push_back(StreamsRegistryEntry{impl, name, entry_type, order_key_type});
        }
    };

    struct Stream {
        Stream(StreamsRegistry& registry,
               const std::string& stream_name,
               const std::string& entry_type_name,
               const std::string& order_key_type_name) {
            registry.Add(this, stream_name, entry_type_name, order_key_type_name);
        }
    };

};

#endif

#ifndef STREAMSREGISTRY_H
#define STREAMSREGISTRY_H

namespace TailProduce {

    class Stream;

    class StreamsRegistry {
      public:
        struct StreamsRegistryEntry {
            // The pointer to an instance of the stream is owned by TailProduce framework.
            // * For static frameworks (streams list is fully available at compile time),
            //   these pointers point to existing, statically initialized, members
            //   of the instance of cover TailProduce class.
            // * For dynamic frameworks, they point to dynamically allocated instances
            //   of per-stream implementations, which are also owned by the instance
            //   of the cover TailProduce class.
            const Stream* impl;
            std::string name;
            std::string entry_type;
            std::string order_key_type;
        };
        std::vector<StreamsRegistryEntry> streams;
        std::set<std::string> names;

        void Add(TailProduce::Stream* impl,
                 const std::string& name,
                 const std::string& entry_type,
                 const std::string& order_key_type) {
            if (names.find(name) != names.end()) {
                LOG(FATAL) << "Attempted to register the '" << name << "' stream more than once.";
            }
            names.insert(name);
            streams.push_back(StreamsRegistryEntry{impl, name, entry_type, order_key_type});
        }
    };
};

#endif

Remove redundantly declared Stream object


#ifndef ELKENUMS_H
#define ELKENUMS_H

/** ElkEnums contains various enumerations useful in ELK, such as real/imag component definitions in
 * Kernels, BCs, etc.
 */

namespace elk
{
enum ComponentEnum
{
  REAL,
  IMAGINARY
};
} // namespace elk

#endif // ELKENUMS_H

#pragma once

/** ElkEnums contains various enumerations useful in ELK, such as real/imag component definitions in
 * Kernels, BCs, etc.
 */

namespace elk
{
enum ComponentEnum
{
  REAL,
  IMAGINARY
};
} // namespace elk

Convert utils to pragma once

Convert utils to pragma once

refs #21085


/**
 * @file
 * @brief
 *
 * @date 26.02.13
 * @author Alexander Lapshin
 */

#include <embox/test.h>
#include <stdlib.h>

EMBOX_TEST_SUITE("standard library");

TEST_CASE("Check strtod function") {
    test_assert_equal(0,   (int) atof("0.0"));
    test_assert_equal(10,  (int) (10 * atof("1.0")));
    test_assert_equal(-10, (int) (10 * atof("-1.0")));
    test_assert_equal(11,  (int) (10 * atof("1.1")));
    test_assert_equal(11,  (int) (100 * atof("0.11")));
    test_assert_equal(-11, (int) (10 * atof("-1.1")));
    test_assert_equal(-110,(int) atof("-1.1E+2"));
    test_assert_equal(-1, (int) (100 * atof("-0.1e-1")));
    test_assert_equal(10,  (int) atof("0.1E2"));
}

Add test for strtod function

Add test for strtod function


#include "pair.h"

pair new_pair( const char c, const int freq ) {
    pair p;

    p.c = c;
    p.freq = freq;

    return p;
}

int compare_freq( const void *a, const void *b ) {
    const pair *ia = ( const pair * ) a;
    const pair *ib = ( const pair * ) b;
    return ib->freq - ia->freq;
}

#include "pair.h"

pair new_pair( const char c, const int freq ) {
    pair p;

    p.c = c;
    p.freq = freq;

    return p;
}

int compare_freq( const void *a, const void *b ) {
    const pair *ia = ( const pair * ) a;
    const pair *ib = ( const pair * ) b;
    return ia->freq - ib->freq;
}

Fix character frequency map to be sorted in ascending order


// 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_MATH_PARTICLESSHAPE_INL_H
#define SURGSIM_MATH_PARTICLESSHAPE_INL_H

namespace SurgSim
{
namespace Math
{

template <class V>
ParticlesShape::ParticlesShape(const SurgSim::DataStructures::Vertices<V>& other) :
	DataStructures::Vertices<DataStructures::EmptyData>(other)
{
	update();
}

template <class V>
ParticlesShape& ParticlesShape::operator=(const SurgSim::DataStructures::Vertices<V>& other)
{
	DataStructures::Vertices<DataStructures::EmptyData>::operator=(other);
	update();
	return *this;
}

}; // namespace Math
}; // namespace SurgSim

#endif

// This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, 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_MATH_PARTICLESSHAPE_INL_H
#define SURGSIM_MATH_PARTICLESSHAPE_INL_H

namespace SurgSim
{
namespace Math
{

template <class V>
ParticlesShape::ParticlesShape(const SurgSim::DataStructures::Vertices<V>& other) :
	DataStructures::Vertices<DataStructures::EmptyData>(other),
	m_radius(0.0)
{
	update();
}

template <class V>
ParticlesShape& ParticlesShape::operator=(const SurgSim::DataStructures::Vertices<V>& other)
{
	DataStructures::Vertices<DataStructures::EmptyData>::operator=(other);
	update();
	return *this;
}

}; // namespace Math
}; // namespace SurgSim

#endif

Fix uninitialed member variable in ParticlesShape

The radius was uninitialized when using the ParticlesShape copy
constructor that takes another Vertices type.


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

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE()                                   \
  rtc::Fatal(__FILE__, __LINE__, "unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

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

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// Trigger a fatal error (which aborts the process and prints an error
// message). FATAL_ERROR_IF may seem a lot like assert, but there's a crucial
// difference: it's always "on". This means that it can be used to check for
// regular errors that could actually happen, not just programming errors that
// supposedly can't happen---but triggering a fatal error will kill the process
// in an ugly way, so it's not suitable for catching errors that might happen
// in production.
#define FATAL_ERROR(msg) do { rtc::Fatal(__FILE__, __LINE__, msg); } while (0)
#define FATAL_ERROR_IF(x) do { if (x) FATAL_ERROR("check failed"); } while (0)

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE() FATAL_ERROR("unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

Define convenient FATAL_ERROR() and FATAL_ERROR_IF() macros

R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16079004

Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 0fa6366ed15f48b3ec227987f21f339180fb4936


/*
<License>
Copyright 2015 Virtium Technology

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.
</License>
*/
#ifndef __ErrorCodes_h__
#define __ErrorCodes_h__

namespace vtStor
{

enum eErrorCode
{
    None = 0,
    Unknown,
    Memory,
    Io,
};

enum eOnErrorBehavior
{
    Stop = 0,
    Continue,
};

}

#endif __ErrorCodes_h__

/*
<License>
Copyright 2015 Virtium Technology

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.
</License>
*/
#ifndef __ErrorCodes_h__
#define __ErrorCodes_h__

namespace vtStor
{

enum eErrorCode
{
    None = 0,
    Unknown,
    Memory,
    Io,
    Timeout,
    NoSupport,
    Invalid,
};

enum eOnErrorBehavior
{
    Stop = 0,
    Continue,
};

}

#endif __ErrorCodes_h__

Add enum values: Timeout, Invalid, NoSupport to eErrorCode


#ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_

// TODO: Move logging to OrbitBase once we have clearer plans for such module.

#include <cstdio>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"

#define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

#define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

#pragma clang diagnostic pop

#endif  // ORBIT_LINUX_TRACING_LOGGING_H_

#ifndef ORBIT_LINUX_TRACING_LOGGING_H_
#define ORBIT_LINUX_TRACING_LOGGING_H_

// TODO: Move logging to OrbitBase once we have clearer plans for such module.

#include <cstdio>

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif

#define LOG(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)

#define ERROR(format, ...) LOG("Error: " format, ##__VA_ARGS__)

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#endif  // ORBIT_LINUX_TRACING_LOGGING_H_

Disable clang diagnostics pragma on windows

Use clang diagnostics pragma only if it project is compiled with clang.

Bug: http://b/150575491
Test: ninja


/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <unordered_map>
#include <string>
#include <vector>

template <class T> class RingBuffer
{
private:
    int currentIdx = 0;
    int count;
    std::vector<T> data;
public:
    RingBuffer(int fixedSize) : count(fixedSize), data(count) {}

    const T& at(int i) {
        return data[(currentIdx - (i % count) + count) % count];
    }

    void add(const T& newValue) {
        currentIdx = (currentIdx + 1) % count;
        data[currentIdx] = newValue;
    }

    T oldest() {
        return data[(currentIdx + 1) % count];
    }
};

template <class T> class RecentlyUsedCache
{
private:
    RingBuffer<T> keysByAge = RingBuffer<T>(1000);
public:
    std::unordered_map<std::string, T> data;

    void add(const std::string& key, const T& value) {
        std::string old = keysByAge.oldest();
        if (!old.empty()) {
            keysByAge.data.erase(old);
        }
        keysByAge[key] = value;
    }
};

/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <unordered_map>
#include <string>
#include <vector>

template <class T> class RingBuffer
{
private:
    int currentIdx = 0;
    int count;
    std::vector<T> data;
public:
    RingBuffer(int fixedSize) : count(fixedSize), data(count) {}

    const T& at(int i) {
        return data[(currentIdx - (i % count) + count) % count];
    }

    void add(const T& newValue) {
        currentIdx = (currentIdx + 1) % count;
        data[currentIdx] = newValue;
    }

    T oldest() {
        return data[(currentIdx + 1) % count];
    }

    void clear() {
        data = std::vector<T>(count);
    }
};

template <class T> class RecentlyUsedCache
{
private:
    RingBuffer<T> keysByAge = RingBuffer<T>(1000);
public:
    std::unordered_map<std::string, T> data;

    void add(const std::string& key, const T& value) {
        std::string old = keysByAge.oldest();
        if (!old.empty()) {
            keysByAge.data.erase(old);
        }
        keysByAge[key] = value;
    }

    void clear() {
        data.clear();
        keysByAge.clear();
    }
};

Add clear() functions to cache

Add clear() functions to cache


//
//  IRHTTPJSONOperation.h
//  IRKit
//
//  Created by Masakazu Ohtsuka on 2013/12/02.
//
//

#import "ISHTTPOperation.h"

@interface IRHTTPJSONOperation : ISHTTPOperation

@end

//
//  IRHTTPJSONOperation.h
//  IRKit
//
//  Created by Masakazu Ohtsuka on 2013/12/02.
//
//

// #import "ISHTTPOperation.h"
@import ISHTTPOperation;

@interface IRHTTPJSONOperation : ISHTTPOperation

@end

Fix again error: include of non-modular header inside framework module


//
//  CLuceneSearchService.h
//  BRFullTextSearch
//
//  Created by Matt on 6/28/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import <Foundation/Foundation.h>

#import "BRSearchService.h"

@interface CLuceneSearchService : NSObject <BRSearchService>

// after this many updates, perform an optimize for faster searches
@property (nonatomic) NSInteger indexUpdateOptimizeThreshold;

// the bundle to load resources such as stop words from; defaults to [NSBundle mainBundle];
// the resource must be named "stop-words.txt"
@property (nonatomic, strong) NSBundle *bundle;

// the default language to use for text analyzers; defaults to "en"
@property (nonatomic, strong ) NSString *defaultAnalyzerLanguage;

- (id)initWithIndexPath:(NSString *)indexPath;

// can call to reset the cached lucene::search::Searcher, to pick up changes to the index;
// only thread safe if called from the main thread; only needed if after indexing you need
// to search immediately from the main thread before the searcher is automatically reset on
// the next main thread run loop execution.
- (void)resetSearcher;

// the NSUserDefaults key used to track the number of index updates between optimizations
- (NSString *)userDefaultsIndexUpdateCountKey;

@end

//
//  CLuceneSearchService.h
//  BRFullTextSearch
//
//  Implementation of BRSearchService using CLucene. When indexing, only NSString, or
//  NSArray/NSSet with NSString values, are supported as field values.
//
//  Created by Matt on 6/28/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import <Foundation/Foundation.h>

#import "BRSearchService.h"

@interface CLuceneSearchService : NSObject <BRSearchService>

// after this many updates, perform an optimize for faster searches
@property (nonatomic) NSInteger indexUpdateOptimizeThreshold;

// the bundle to load resources such as stop words from; defaults to [NSBundle mainBundle];
// the resource must be named "stop-words.txt"
@property (nonatomic, strong) NSBundle *bundle;

// the default language to use for text analyzers; defaults to "en"
@property (nonatomic, strong ) NSString *defaultAnalyzerLanguage;

- (id)initWithIndexPath:(NSString *)indexPath;

// can call to reset the cached lucene::search::Searcher, to pick up changes to the index;
// only thread safe if called from the main thread; only needed if after indexing you need
// to search immediately from the main thread before the searcher is automatically reset on
// the next main thread run loop execution.
- (void)resetSearcher;

// the NSUserDefaults key used to track the number of index updates between optimizations
- (NSString *)userDefaultsIndexUpdateCountKey;

@end

Add note on supported field value types.


#pragma once

#include "framework/stage.h"
#include "framework/includes.h"
#include "ufopaediaentry.h"

namespace OpenApoc
{

class UfopaediaCategory : public Stage // , public std::enable_shared_from_this<UfopaediaCategory>
{
  private:
	Form *menuform;
	StageCmd stageCmd;

	void SetCatOffset(int Direction);

  public:
	UString ID;
	UString Title;
	UString BodyInformation;
	UString BackgroundImageFilename;
	std::vector<std::shared_ptr<UfopaediaEntry>> Entries;

	int ViewingEntry;

	UfopaediaCategory(Framework &fw, tinyxml2::XMLElement *Element);
	~UfopaediaCategory();

	// Stage control
	virtual void Begin() override;
	virtual void Pause() override;
	virtual void Resume() override;
	virtual void Finish() override;
	virtual void EventOccurred(Event *e) override;
	virtual void Update(StageCmd *const cmd) override;
	virtual void Render() override;
	virtual bool IsTransition() override;

	void SetTopic(int Index);
	void SetupForm();

	void SetPrevCat();
	void SetNextCat();
};
}; // namespace OpenApoc

#pragma once

#include "framework/stage.h"
#include "framework/includes.h"
#include "ufopaediaentry.h"

namespace OpenApoc
{

class UfopaediaCategory : public Stage // , public std::enable_shared_from_this<UfopaediaCategory>
{
  private:
	Form *menuform;
	StageCmd stageCmd;

	void SetCatOffset(int Direction);

  public:
	UString ID;
	UString Title;
	UString BodyInformation;
	UString BackgroundImageFilename;
	std::vector<std::shared_ptr<UfopaediaEntry>> Entries;

	unsigned int ViewingEntry;

	UfopaediaCategory(Framework &fw, tinyxml2::XMLElement *Element);
	~UfopaediaCategory();

	// Stage control
	virtual void Begin() override;
	virtual void Pause() override;
	virtual void Resume() override;
	virtual void Finish() override;
	virtual void EventOccurred(Event *e) override;
	virtual void Update(StageCmd *const cmd) override;
	virtual void Render() override;
	virtual bool IsTransition() override;

	void SetTopic(int Index);
	void SetupForm();

	void SetPrevCat();
	void SetNextCat();
};
}; // namespace OpenApoc

Fix unsigned/signed comparison in UfopaediaCategory::EventOccurred


#ifndef AL_BACKENDS_BASE_H
#define AL_BACKENDS_BASE_H

#include "alMain.h"

struct ALCbackendVtable;

typedef struct ALCbackend {
    const struct ALCbackendVtable *vtbl;

    ALCdevice *mDevice;
} ALCbackend;

struct ALCbackendVtable {
    void (*const Destruct)(ALCbackend *state);

    ALCenum (*const open)(ALCbackend*, const ALCchar*);
    void (*const close)(ALCbackend*);

    ALCboolean (*reset)(ALCbackend*);
    ALCboolean (*start)(ALCbackend*);
    void (*stop)(ALCbackend*);

    ALint64 (*getLatency)(ALCbackend*);

    void (*const Delete)(ALCbackend *state);
};

#define DEFINE_ALCBACKEND_VTABLE(T)                                           \
static void T##_ALCbackend_Destruct(ALCbackend *obj)                          \
{ T##_Destruct(STATIC_UPCAST(T, ALCbackend, obj)); }                          \
static ALCenum T##_ALCbackend_open(ALCbackend *obj, const ALCchar *p1)        \
{ return T##_open(STATIC_UPCAST(T, ALCbackend, obj), p1); }                   \
static void T##_ALCbackend_close(ALCbackend *obj)                             \
{ T##_close(STATIC_UPCAST(T, ALCbackend, obj)); }                             \
static ALCboolean T##_ALCbackend_reset(ALCbackend *obj)                       \
{ return T##_reset(STATIC_UPCAST(T, ALCbackend, obj)); }                      \
static ALCboolean T##_ALCbackend_start(ALCbackend *obj)                       \
{ return T##_start(STATIC_UPCAST(T, ALCbackend, obj)); }                      \
static void T##_ALCbackend_stop(ALCbackend *obj)                              \
{ T##_stop(STATIC_UPCAST(T, ALCbackend, obj)); }                              \
static ALint64 T##_ALCbackend_getLatency(ALCbackend *obj)                     \
{ return T##_getLatency(STATIC_UPCAST(T, ALCbackend, obj)); }                 \
static void T##_ALCbackend_Delete(ALCbackend *obj)                            \
{ T##_Delete(STATIC_UPCAST(T, ALCbackend, obj)); }                            \
                                                                              \
static const struct ALCbackendVtable T##_ALCbackend_vtable = {                \
    T##_ALCbackend_Destruct,                                                  \
                                                                              \
    T##_ALCbackend_open,                                                      \
    T##_ALCbackend_close,                                                     \
    T##_ALCbackend_reset,                                                     \
    T##_ALCbackend_start,                                                     \
    T##_ALCbackend_stop,                                                      \
    T##_ALCbackend_getLatency,                                                \
                                                                              \
    T##_ALCbackend_Delete,                                                    \
}

#endif /* AL_BACKENDS_BASE_H */

Add missing header to git

Add missing header to git


/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2010 NorthScale, 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 CONFIG_STATIC_H
#define CONFIG_STATIC_H 1

/* The intention of this file is to avoid cluttering the code with #ifdefs */
#include <event.h>

#if !defined(_EVENT_NUMERIC_VERSION) || _EVENT_NUMERIC_VERSION < 0x02000000
typedef int evutil_socket_t;
#endif

#ifndef DEFAULT_ERRORLOG
#define DEFAULT_ERRORLOG ERRORLOG_STDERR
#endif

#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN > 1
#define ENDIAN_BIG 1
#else
#define ENDIAN_LITTLE 1
#endif

#endif

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2010 NorthScale, 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 CONFIG_STATIC_H
#define CONFIG_STATIC_H 1

/* The intention of this file is to avoid cluttering the code with #ifdefs */
#include <event.h>

#if (!defined(_EVENT_NUMERIC_VERSION) || _EVENT_NUMERIC_VERSION < 0x02000000) && !defined(WIN32)
typedef int evutil_socket_t;
#endif

#ifndef DEFAULT_ERRORLOG
#define DEFAULT_ERRORLOG ERRORLOG_STDERR
#endif

#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN > 1
#define ENDIAN_BIG 1
#else
#define ENDIAN_LITTLE 1
#endif

#endif

Fix event test for win32

Fix event test for win32

Change-Id: I74011ed8cdebaf1771bbaadf4c1eba559f240448
Reviewed-on: http://review.couchbase.org/34772
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>