#include "defs.h"

void locate_library_executable(int argc, char *argv[])
{
    DWORD l;
    char *endpath;
#ifdef DLL
	HANDLE dll;
#endif

    l = GetModuleFileName(NULL, executable_path, IMAGEDIR_MAX);
    if (l == 0 || l >= IMAGEDIR_MAX) fatal_error(FE_INFND, 0);

#ifdef DLL
    dll = GetModuleHandle(DLL_NAME);
    if (dll == NULL) fatal_error(FE_INFND, 0);

    l = GetModuleFileName(dll, library_path, IMAGEDIR_MAX);
    if (l == 0 || l >= IMAGEDIR_MAX) fatal_error(FE_INFND, 0);
#else
	strcpy(library_path, executable_path);
#endif /* DLL */

	strcpy(library_dir, library_path);

    endpath = strrchr(library_dir, '\\');
    if (endpath == NULL) fatal_error(FE_INFND, 0);
    endpath++;  /* include the \ */
    *endpath = 0;
}

#include "defs.h"

void locate_library_executable(int argc, char *argv[])
{
    DWORD l;
    char *endpath;
#ifdef DLL
	HANDLE dll;
#endif

    l = GetModuleFileName(NULL, executable_path, PATH_MAX);
    if (l == 0 || l >= PATH_MAX) fatal_error(FE_INFND, 0);

#ifdef DLL
    dll = GetModuleHandle(DLL_NAME);
    if (dll == NULL) fatal_error(FE_INFND, 0);

    l = GetModuleFileName(dll, library_path, PATH_MAX);
    if (l == 0 || l >= PATH_MAX) fatal_error(FE_INFND, 0);
#else
	strcpy(library_path, executable_path);
#endif /* DLL */

	strcpy(library_dir, library_path);

    endpath = strrchr(library_dir, '\\');
    if (endpath == NULL) fatal_error(FE_INFND, 0);
    endpath++;  /* include the \ */
    *endpath = 0;
}

Replace custom IMAGEDIR_MAX with PATH_MAX, ala 13616d1


#include <gtk/gtk.h>

GtkWidget *
gh_about_dialog_create ()
{
  GtkWidget *dialog;

  dialog = gtk_about_dialog_new ();

  static gchar const *title = "About ghighlighter";

  gtk_window_set_title (GTK_WINDOW (dialog), title);

  return dialog;
}

#include <gtk/gtk.h>

GtkWidget *
gh_about_dialog_create ()
{
  GtkWidget *dialog;

  dialog = gtk_about_dialog_new ();

  static gchar const *title = "About ghighlighter";
  static gchar const *program_name = "ghighlighter";

  gtk_window_set_title (GTK_WINDOW (dialog), title);
  gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (dialog), program_name);

  return dialog;
}

Set about dialog program name

Set about dialog program name


#ifndef FORK_PROCESS_H
#define FORK_PROCESS_H

#include "postgres.h"

extern pid_t fork_process(void);

#endif /* ! FORK_PROCESS_H */

Add missing identification comment, remove entirely inappropriate include of postgres.h.


//
//  BDSKOAIGroupServer.h
//  Bibdesk
//
//  Created by Christiaan Hofman on 1/1/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

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

@class BDSKServerInfo;

@interface BDSKOAIGroupServer : NSObject <BDSKSearchGroupServer>
{
    BDSKSearchGroup *group;
    BDSKServerInfo *serverInfo;
    NSString *searchTerm;
    NSString *resumptionToken;
    NSArray *sets;
    NSString *filePath;
    NSURLDownload *URLDownload;
    BOOL failedDownload;
    BOOL isRetrieving;
    BOOL needsReset;
    int availableResults;
    int fetchedResults;
}
- (void)setServerInfo:(BDSKServerInfo *)info;
- (BDSKServerInfo *)serverInfo;
- (void)setSearchTerm:(NSString *)string;
- (NSString *)searchTerm;
- (void)setSets:(NSArray *)newSets;
- (NSArray *)sets;
- (void)setResumptionToken:(NSString *)newResumptionToken;
- (NSString *)resumptionToken;
- (void)resetSearch;
- (void)fetchSets;
- (void)fetch;
- (void)startDownloadFromURL:(NSURL *)theURL;

@end

Add new header file. (or: xcode is stupid)


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

struct Config load_config(char *arquivo) {

}

struct Idioma load_idioma(char *idioma){
	char *local_idioma;
	int loaded;

	strcpy(local_idioma, "local aqui");
	strcat(local_idioma, idioma);
	strcat(local_idioma, ".conf");

	loaded = 1;
	while(loaded) {

		strcpy(local_idioma, "local aqui");
		strcat(local_idioma, idioma);
		strcat(local_idioma, ".conf");

		//Abre idioma
		FILE *arquivo = fopen(local_idioma, "r");

		if(file) {

			loaded = 0;
		}
		else {
			printf("Arquivo de idioma não localizado\n");
			printf("Will try to load the default language\n");

		}
	}
}

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

struct Config load_config(char *arquivo) {

}

void load_idioma(struct Idioma *idioma, char *key, char *content){

}

void clean_idioma(struct Idioma *idioma) {
	free(idioma);
}

Change functions to handle idioma

Change functions to handle idioma


//
//  PSTCKTransactionParams.h
//  Paystack
//

#import <Foundation/Foundation.h>
#import "PSTCKFormEncodable.h"
/**
 *  Representation of a user's credit card details. You can assemble these with information that your user enters and
 *  then create Paystack tokens with them using an PSTCKAPIClient. @see https://paystack.com/docs/api#cards
 */
@interface PSTCKTransactionParams : NSObject<PSTCKFormEncodable>

@property (nonatomic, copy, nonnull) NSString *email;
@property (nonatomic, nonnull) NSUInteger *amount;
@property (nonatomic, copy, nullable) NSString *reference;
@property (nonatomic, copy, nullable) NSString *subaccount;
@property (nonatomic, nullable) NSUInteger *transactionCharge;
@property (nonatomic, copy, nullable) NSString *bearer;
@property (nonatomic, copy, nullable) NSString *metadata;

@end

//
//  PSTCKTransactionParams.h
//  Paystack
//

#import <Foundation/Foundation.h>
#import "PSTCKFormEncodable.h"
/**
 *  Representation of a user's credit card details. You can assemble these with information that your user enters and
 *  then create Paystack tokens with them using an PSTCKAPIClient. @see https://paystack.com/docs/api#cards
 */
@interface PSTCKTransactionParams : NSObject<PSTCKFormEncodable>

@property (nonatomic, copy, nonnull) NSString *email;
@property (nonatomic) NSUInteger amount;
@property (nonatomic, copy, nullable) NSString *reference;
@property (nonatomic, copy, nullable) NSString *subaccount;
@property (nonatomic) NSUInteger transactionCharge;
@property (nonatomic, copy, nullable) NSString *bearer;
@property (nonatomic, copy, nullable) NSString *metadata;

@end

Make UInt safe on Transaction Params by not using pointer


/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);
	else if (mailbox_sync(mailbox, 0, 0, NULL) < 0)
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

CLOSE: Synchronize the mailbox after expunging messages to actually get them
expunged.


#include "emu.h"

static void
andflags_sr(unsigned res, uint16_t *sr)
{

	*sr &= ~(SR_V | 0xfe00);

	if (res & 0x8000)
		*sr |= SR_N;
	else
		*sr &= ~SR_N;
	if (res == 0) {
		*sr |= SR_Z;
		*sr &= ~SR_C;
	} else {
		*sr &= ~SR_Z;
		*sr |= SR_C;
	}
}

static void
addflags_sr(unsigned res, unsigned bw, uint16_t *sr)
{
	unsigned sz = 16;

	if (bw)
		sz = 8;

	if (bw == 0 && (res & 0x8000))
		*sr |= SR_N;
	else
		*sr &= ~SR_N;

	// #uctf never sets V. Only clear on arithmetic, though.
	*sr &= ~SR_V;
	*sr &= ~0xfe00;
#if 0
	if ((res & 0x8000) ^ (orig & 0x8000))
		*set |= SR_V;
#endif

	if ((res & ((1 << sz) - 1)) == 0)
		*sr |= SR_Z;
	else
		*sr &= ~SR_Z;

	if (res & (1 << sz))
		*sr |= SR_C;
	else
		*sr &= ~SR_C;
}

#include "trace_c.c"

void
inputs(unsigned idx, unsigned depthrem)
{

	if (depthrem == 0) {
		try();

		if (unlocked) {
			printf("Solved!\n");
			exit(0);
		}
		return;
	}

	for (unsigned i = 0; i < 256; i++) {
		Input[idx] = i;
		inputs(idx + 1, depthrem - 1);
	}
}

int
main(void)
{

	for (unsigned i = 1; i < 7; i++) {
		printf("Trying input len: %d\n", i);
		InputLen = i;
		inputs(0, i);
	}

	return 0;
}

Add basic depth-first bruter w/ traced C


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

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

Update Skia milestone to 88

Update Skia milestone to 88

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


#ifndef _GUM_GLYPH_STYLE_ID_H_
#define _GUM_GLYPH_STYLE_ID_H_

#include "gum/GlyphStyle.h"

#include <cu/cu_macro.h>
#include <cu/cu_stl.h>

namespace gum
{

class GlyphStyle;

class GlyphStyleID
{
public:
	int Gen(const GlyphStyle& style);

private:
	static int Hash(const GlyphStyle& style);

private:
	static const int HASH_CAP = 197;

private:
	int m_next_id;
	std::vector<std::pair<GlyphStyle, int> > m_hash[HASH_CAP];

 	std::pair<GlyphStyle, int> m_last;

	CU_SINGLETON_DECLARATION(GlyphStyleID)

}; // GlyphStyleID

}

#endif // _GUM_GLYPH_STYLE_ID_H_

#ifndef _GUM_GLYPH_STYLE_ID_H_
#define _GUM_GLYPH_STYLE_ID_H_

#include "gum/GlyphStyle.h"

#include <cu/cu_macro.h>
#include <cu/cu_stl.h>

namespace gum
{

class GlyphStyle;

class GlyphStyleID
{
public:
	int Gen(const GlyphStyle& style);

private:
	static int Hash(const GlyphStyle& style);

private:
	static const int HASH_CAP = 197;

private:
	int m_next_id;
	CU_VEC<std::pair<GlyphStyle, int> > m_hash[HASH_CAP];

 	std::pair<GlyphStyle, int> m_last;

	CU_SINGLETON_DECLARATION(GlyphStyleID)

}; // GlyphStyleID

}

#endif // _GUM_GLYPH_STYLE_ID_H_

Revert "[FIXED] not use allocator, for async draw"

This reverts commit 3cce0321da141d1fb8689d826fd5f5235066c977.


// Test __llvm_profile_get_filename when the on-line merging mode is enabled.
//
// RUN: %clang_pgogen -dynamiclib -o %t.dso %p/Inputs/instrprof-get-filename-dso.c
// RUN: %clang_pgogen -o %t %s %t.dso
// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t

#include <string.h>

const char *__llvm_profile_get_filename(void);
extern const char *get_filename_from_DSO(void);

int main(int argc, const char *argv[]) {
  const char *filename1 = __llvm_profile_get_filename();
  const char *filename2 = get_filename_from_DSO();

  // Exit with code 1 if the two filenames are the same.
  return strcmp(filename1, filename2) == 0;
}

// Test __llvm_profile_get_filename when the on-line merging mode is enabled.
//
// RUN: %clang_pgogen -fPIC -shared -o %t.dso %p/../Inputs/instrprof-get-filename-dso.c
// RUN: %clang_pgogen -o %t %s %t.dso
// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t

#include <string.h>

const char *__llvm_profile_get_filename(void);
extern const char *get_filename_from_DSO(void);

int main(int argc, const char *argv[]) {
  const char *filename1 = __llvm_profile_get_filename();
  const char *filename2 = get_filename_from_DSO();

  // Exit with code 1 if the two filenames are the same.
  return strcmp(filename1, filename2) == 0;
}

[profile] Use -fPIC -shared in a test instead of -dynamiclib

This is more portable than -dynamiclib. Also, fix the path to an input
file that broke when the test was moved in r375315.

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


// RUN: %libomp-compile-and-run

/*
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720

Assertion failure at kmp_runtime.cpp(1715): nthreads > 0.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(1715).

The assertion fails even with OMP_NUM_THREADS=1. If the second task is removed,
everything runs to completion. If the "omp parallel for" directives are removed
from inside the tasks, once again everything runs fine.
*/

#define N 1024

int main() {
  #pragma omp task
  {
    #pragma omp parallel for
    for (int i = 0; i < N; i++)
      (void)0;
  }

  #pragma omp task
  {
    #pragma omp parallel for
    for (int i = 0; i < N; ++i)
      (void)0;
  }

  #pragma omp taskwait

  return 0;
}

// RUN: %libomp-compile-and-run

/*
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720

Assertion failure at kmp_runtime.cpp(1715): nthreads > 0.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(1715).

The assertion fails even with OMP_NUM_THREADS=1. If the second task is removed,
everything runs to completion. If the "omp parallel for" directives are removed
from inside the tasks, once again everything runs fine.
*/

#define N 1024

int main() {
  #pragma omp task
  {
    int i;
    #pragma omp parallel for
    for (i = 0; i < N; i++)
      (void)0;
  }

  #pragma omp task
  {
    int i;
    #pragma omp parallel for
    for (i = 0; i < N; ++i)
      (void)0;
  }

  #pragma omp taskwait

  return 0;
}

Convert test for PR36720 to c89

[test] Convert test for PR36720 to c89

GCC 4.8.5 defaults to this old C standard. I think we should make the
tests pass a newer -std=c99|c11 but that's too intrusive for now...

Differential Revision: https://reviews.llvm.org/D50084

git-svn-id: f99161ee8ccfe2101cbe1bdda2220bce2ed25485@338490 91177308-0d34-0410-b5e6-96231b3b80d8


//
//  main.c
//  Check if two strings are permutations by checking if they have identical character counts.
//
//  Created by Jack Zuban on 8/20/17.
//  Copyright © 2017 Jack Zuban. All rights reserved.
//

#include <stdio.h>
#include <stdbool.h>

bool areStringsHaveSameLength(char *str1, char *str2)
{
    while (*str1 && *str2) {
        str1++;
        str2++;
    }

    return (*str1 == '\0' && *str2 == '\0');
}

bool isPermutation(char *str1, char *str2)
{
    bool areStringsHaveSameLength(char *str1, char *str2);
    int charactersFrequency[127] = {};

    if (! areStringsHaveSameLength(str1, str2)) {
        return false;
    }

    while (*str1) {
        charactersFrequency[(int) *str1]++;
        str1++;
    }

    while (*str2) {
        charactersFrequency[(int) *str2]--;

        if (charactersFrequency[(int) *str2] < 0) {
            return false;
        }

        str2++;
    }

    return true;
}

int main(void) {
    bool isPermutation(char *str1, char *str2);
    char str1[80];
    char str2[80];

    printf("First string: ");
    fgets(str1, 79, stdin);

    printf("Second string: ");
    fgets(str2, 79, stdin);

    printf("Strings are: %s\n", isPermutation(str1, str2) ? "permutations." : "not permutations.");

    return 0;
}

Check if two strings are permutations by checking their character counts


//
// arch/x86_64/rsp/vmov.c
//
// This file is subject to the terms and conditions defined in
// 'LICENSE', which is part of this source code package.
//

#include "common.h"
#include "rsp/cpu.h"
#include "rsp/rsp.h"

__m128i rsp_vmov(struct rsp *rsp,
  unsigned src, unsigned e, unsigned dest, rsp_vect_t vt_shuffle) {
  uint16_t data;

  // Copy element into data
  memcpy(&data, (e & 0x7) + (uint16_t *)&vt_shuffle, sizeof(uint16_t));

  printf("src %d dest %d el %x data %x\n", src, dest, e, data);
  fflush(stdout);

  // Write out the upper part of the result.
  rsp->cp2.regs[dest].e[e & 0x7] = data;
  return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e);
}

//
// arch/x86_64/rsp/vmov.c
//
// This file is subject to the terms and conditions defined in
// 'LICENSE', which is part of this source code package.
//

#include "common.h"
#include "rsp/cpu.h"
#include "rsp/rsp.h"

__m128i rsp_vmov(struct rsp *rsp,
  unsigned src, unsigned e, unsigned dest, rsp_vect_t vt_shuffle) {
  uint16_t data;

  // Copy element into data
  memcpy(&data, (e & 0x7) + (uint16_t *)&vt_shuffle, sizeof(uint16_t));

  // Write out the upper part of the result.
  rsp->cp2.regs[dest].e[e & 0x7] = data;
  return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e);
}

Remove debug information from VMOV code

Remove debug information from VMOV code


/*-
 * Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifndef __SYS_REFCOUNT_H__
#define __SYS_REFCOUNT_H__

#include <machine/atomic.h>

static __inline void
refcount_init(volatile u_int *count, u_int value)
{

	*count = value;
}

static __inline void
refcount_acquire(volatile u_int *count)
{

	atomic_add_acq_int(count, 1);
}

static __inline int
refcount_release(volatile u_int *count)
{

	/* XXX: Should this have a rel membar? */
	return (atomic_fetchadd_int(count, -1) == 1);
}

#endif	/* ! __SYS_REFCOUNT_H__ */

Add a simple reference count API that is simply a thin wrapper API around
atomic operations on ints.

Reviewed by:	arch@
MFC after:	1 week


/* SPDX-License-Identifier: BSD-2-Clause */

#include <tilck/common/basic_defs.h>
#include <tilck/common/printk.h>

#include <tilck/kernel/sched.h>

#include "osl.h"
#include <3rd_party/acpi/acpi.h>
#include <3rd_party/acpi/acexcep.h>

static ACPI_TABLE_DESC acpi_tables[16];

void
early_init_acpi_module(void)
{
   ACPI_STATUS rc;

   rc = AcpiInitializeSubsystem();

   if (rc != AE_OK)
      panic("AcpiInitializeSubsystem() failed with: %d", rc);

   rc = AcpiInitializeTables(acpi_tables, 16, false);

   if (rc != AE_OK)
      panic("AcpiInitializeTables() failed with: %d", rc);
}

/* SPDX-License-Identifier: BSD-2-Clause */

#include <tilck/common/basic_defs.h>
#include <tilck/common/printk.h>

#include <tilck/kernel/sched.h>

#include "osl.h"
#include <3rd_party/acpi/acpi.h>
#include <3rd_party/acpi/acexcep.h>

void
early_init_acpi_module(void)
{
   ACPI_STATUS rc;

   rc = AcpiInitializeSubsystem();

   if (rc != AE_OK)
      panic("AcpiInitializeSubsystem() failed with: %d", rc);

   rc = AcpiInitializeTables(NULL, 0, true);

   if (rc != AE_OK)
      panic("AcpiInitializeTables() failed with: %d", rc);
}

[acpi] Make AcpiInitializeTables to dynamically alloc tables


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

#pragma once

#include <fizz/protocol/CertificateVerifier.h>

namespace quic::test {

class TestCertificateVerifier : public fizz::CertificateVerifier {
 public:
  ~TestCertificateVerifier() override = default;

  void verify(const std::vector<std::shared_ptr<const fizz::PeerCert>>&)
      const override {
    return;
  }

  [[nodiscard]] std::vector<fizz::Extension> getCertificateRequestExtensions()
      const override {
    return std::vector<fizz::Extension>();
  }
};

inline std::unique_ptr<fizz::CertificateVerifier>
createTestCertificateVerifier() {
  return std::make_unique<TestCertificateVerifier>();
}

} // namespace quic::test

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

#pragma once

#include <fizz/protocol/CertificateVerifier.h>

namespace quic::test {

class TestCertificateVerifier : public fizz::CertificateVerifier {
 public:
  ~TestCertificateVerifier() override = default;

  std::shared_ptr<const folly::AsyncTransportCertificate> verify(
      const std::vector<std::shared_ptr<const fizz::PeerCert>>& certs)
      const override {
    return certs.front();
  }

  [[nodiscard]] std::vector<fizz::Extension> getCertificateRequestExtensions()
      const override {
    return std::vector<fizz::Extension>();
  }
};

inline std::unique_ptr<fizz::CertificateVerifier>
createTestCertificateVerifier() {
  return std::make_unique<TestCertificateVerifier>();
}

} // namespace quic::test

Replace fizz server cert with leaf cert returned from verification

Summary: Added code to return the leaf cert after successfully verification of the server cert. The returned cert is then used for replacing the server cert.

Reviewed By: AjanthanAsogamoorthy

Differential Revision: D35898220

fbshipit-source-id: 8f542471a711d5aa62d0aad4c1d12b10c2209744


#ifdef _WIN32
#define LIB_FUNC __declspec(dllimport)
#else
#define LIB_FUNC
#endif

void LIB_FUNC printBuildType();

#ifdef _WIN32
#define LIB_FUNC __declspec(dllexport)
#else
#define LIB_FUNC
#endif

void LIB_FUNC printBuildType();

Use correct syntax for windows DLL export


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

#include "net/spdy/spdy_framer.h"

namespace net {

class HttpResponseInfo;
class HttpRequestInfo;

// Convert a SpdyHeaderBlock into an HttpResponseInfo.
// |headers| input parameter with the SpdyHeaderBlock.
// |info| output parameter for the HttpResponseInfo.
// Returns true if successfully converted.  False if there was a failure
// or if the SpdyHeaderBlock was invalid.
bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
                               HttpResponseInfo* response);

// Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from
// a HttpRequestInfo block.
void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
                                      spdy::SpdyHeaderBlock* headers,
                                      bool direct);

}  // namespace net

#endif  // NET_SPDY_SPDY_HTTP_UTILS_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 NET_SPDY_SPDY_HTTP_UTILS_H_
#define NET_SPDY_SPDY_HTTP_UTILS_H_
#pragma once

#include "net/spdy/spdy_framer.h"

namespace net {

class HttpResponseInfo;
struct HttpRequestInfo;

// Convert a SpdyHeaderBlock into an HttpResponseInfo.
// |headers| input parameter with the SpdyHeaderBlock.
// |info| output parameter for the HttpResponseInfo.
// Returns true if successfully converted.  False if there was a failure
// or if the SpdyHeaderBlock was invalid.
bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
                               HttpResponseInfo* response);

// Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from
// a HttpRequestInfo block.
void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
                                      spdy::SpdyHeaderBlock* headers,
                                      bool direct);

}  // namespace net

#endif  // NET_SPDY_SPDY_HTTP_UTILS_H_

Change forward declaration of HttpRequestInfo from class to struct to
fix build breakage.

BUG=none
TEST=none

git-svn-id: http://src.chromium.org/svn/trunk/src@59584 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: cb97ca6c3e6d589f6d40ad33fdc8afb7a19c6999


// SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.activated[-] threadJoins --enable ana.apron.threshold_widening --set ana.apron.privatization protection --enable ana.apron.strengthening
// Fig 5a from Miné 2014
// Example for join strengthening
#include <pthread.h>
#include <stdio.h>

int x;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int top;
  while(top) {
    pthread_mutex_lock(&mutex);
    if(x<100) {
      x++;
    }
    pthread_mutex_unlock(&mutex);
  }
  return NULL;
}

int main(void) {
  int top, top2;

  pthread_t id;
  pthread_t id2;
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_create(&id2, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex);
  assert(x <= 100);
  pthread_mutex_unlock(&mutex);
  return 0;
}

Add example that needs Apron heterogeneous join strengthening


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

// Declare functions
void get_input();

// Global variables
char text_input[32];
int running = 1;

// Main Section
int main() {

  while (running == 1) {
    if (strcmp(text_input, "q") == 0) {
      running = 0;
      printf("Goodbye!\n");
    }
    else {
      get_input();
      printf("The message is %s\n", text_input);
    }
  }

  return 0;

}

// Define functions
void get_input() {

  // Get the string
  printf("Please enter a number or (q) to quit\n");
  fgets(text_input, 32, stdin);

  // Get the length of the string
  int length = strlen(text_input) -1;

  // Remove the newline at the end of the string if it existss
  if (text_input[length] == '\n') {
    text_input[length] = '\0';
  }
}

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

// Declare functions
void get_input();
int is_valid_number();

// Global variables
char text_input[32];
int running = 1;

// Main Section
int main() {

  while (running == 1) {
    if (strcmp(text_input, "q") == 0) {
      running = 0;
      printf("Goodbye!\n");
    }
    else {
      get_input();
      if(is_valid_number() == 0) {
        printf("The message is %s\n", text_input);
      }
    }
  }

  return 0;

}

// Define functions
void get_input() {

  // Get the string
  printf("Please enter a number or (q) to quit\n");
  fgets(text_input, 32, stdin);

  // Get the length of the string
  int length = strlen(text_input) -1;

  // Remove the newline at the end of the string if it existss
  if (text_input[length] == '\n') {
    text_input[length] = '\0';
  }

}

// Check if string is a valid number
int is_valid_number() {

  char *ptr;
  long number;
  number = strtol(text_input, &ptr, 10);

  if (strlen(ptr) == 0) {
    return 0;
  } else {
    printf("Not a valid number\n");
    return 1;
  }

}

Create function to check if text_input is a valid number


/**
 * @file utils.h
 * @brief Storj utilities.
 *
 * Helper utilities
 */
#ifndef STORJ_UTILS_H
#define STORJ_UTILS_H

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include <stdbool.h>

#ifdef _WIN32
#include <windows.h>
#include <time.h>

ssize_t pread(int fd, void *buf, size_t count, uint64_t offset);
#else
#include <sys/time.h>
#endif

int hex2str(unsigned length, uint8_t *data, char *buffer);

void print_int_array(uint8_t *array, unsigned length);

int str2hex(unsigned length, char *data, uint8_t *buffer);

char *str_concat_many(int count, ...);

void random_buffer(uint8_t *buf, size_t len);

uint64_t shard_size(int hops);

uint64_t get_time_milliseconds();

void memset_zero(void *v, size_t n);

#endif /* STORJ_UTILS_H */

/**
 * @file utils.h
 * @brief Storj utilities.
 *
 * Helper utilities
 */
#ifndef STORJ_UTILS_H
#define STORJ_UTILS_H

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include <stdbool.h>

#ifdef _WIN32
#include <windows.h>
#include <time.h>
#include <io.h>

ssize_t pread(int fd, void *buf, size_t count, uint64_t offset);
#else
#include <sys/time.h>
#endif

int hex2str(unsigned length, uint8_t *data, char *buffer);

void print_int_array(uint8_t *array, unsigned length);

int str2hex(unsigned length, char *data, uint8_t *buffer);

char *str_concat_many(int count, ...);

void random_buffer(uint8_t *buf, size_t len);

uint64_t shard_size(int hops);

uint64_t get_time_milliseconds();

void memset_zero(void *v, size_t n);

#endif /* STORJ_UTILS_H */

Include io.h for mingw builds

Include io.h for mingw builds


/* headers */
#include <stdlib.h>
#include <time.h>

#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"

/* main body function */
int main(int argc, char ** argv)
{
    int L; /* square lattice size */
    double p; /* occupation probability of each lattice site */
    int *lattice; /* lattice array */

    /* read input arguments; if none provided fallback to default values */
    if (argc == 3) {
        L = atoi(argv[1]);
        p = atof(argv[2]);
    } else {
        L = 10;
        p = 0.4;
    }

    /* initialize random number generator seed */
    srand(time(NULL));

    /* allocate lattice */
    lattice = allocate_lattice(L, L);

    /* populate lattice with given probability */
    populate_lattice(p, lattice, L, L);

    /* print the generated lattice for visualization */
    print_lattice(lattice, L, L, 1);

    /* label clusters and print result */
    label_clusters(lattice, L, L);
    print_lattice(lattice, L, L, 1);

    /* free memory before leaving */
    free(lattice);

    return 0;
}

/* headers */
#include <stdlib.h>
#include <time.h>

#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"

/* main body function */
int main(int argc, char ** argv)
{
    int L; /* square lattice size */
    double p; /* occupation probability of each lattice site */
    int *lattice; /* lattice array */
    unsigned int random_seed; /* random number generator seed */

    /* read input arguments; if none provided fallback to default values */
    if (argc == 3 || argc == 4) {
        L = atoi(argv[1]);
        p = atof(argv[2]);
        if (argc == 4) {
            random_seed = atoi(argv[3]);
        } else {
            random_seed = (unsigned int)time(NULL);
        }
    } else {
        L = 10;
        p = 0.4;
        random_seed = (unsigned int)time(NULL);
    }

    /* initialize random number generator seed */
    srand(random_seed);

    /* allocate lattice */
    lattice = allocate_lattice(L, L);

    /* populate lattice with given probability */
    populate_lattice(p, lattice, L, L);

    /* print the generated lattice for visualization */
    print_lattice(lattice, L, L, 1);

    /* label clusters and print result */
    label_clusters(lattice, L, L);
    print_lattice(lattice, L, L, 1);

    /* free memory before leaving */
    free(lattice);

    return 0;
}

[percolation] Allow passing RNG seed as program argument


/*
 * Hello World Program
 * 2013-05-27
 */

#include <stdio.h>

int
main()
{
	printf("Hello, World!\g");
	return 0;
}

/*
 * Hello World Program
 * 2013-05-27
 */

#include <stdio.h>

int
main()
{
	printf("Hello, World!\n");
	return 0;
}

Add the BSD make build machinery

Add the BSD make build machinery


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

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

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

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_REDUCE_OPLIST_SPLITTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS

  // Staging flags
  #define SK_LEGACY_PATH_ARCTO_ENDPOINT
  #define SK_SUPPORT_LEGACY_MATRIX_IMAGEFILTER

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_AAA_CHOICE

  #define SK_DISABLE_DAA  // skbug.com/6886

#endif // SkUserConfigManual_DEFINED

Add flag to stage api change

Add flag to stage api change

Test: make

Bug: 178700363
Change-Id: I8b22d1436260eafca1819e3210b4bea559be7142


/*-
 * Copyright (c) 2001 Jake Burkholder.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifndef	_MACHINE_CLOCK_H_
#define	_MACHINE_CLOCK_H_

extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;

extern int adjkerntz;
extern int wall_cmos_clock;

#endif /* !_MACHINE_CLOCK_H_ */

/*-
 * Copyright (c) 2001 Jake Burkholder.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifndef	_MACHINE_CLOCK_H_
#define	_MACHINE_CLOCK_H_

extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;

#endif /* !_MACHINE_CLOCK_H_ */

Remove two variables which are handled MI now.


#include <stdio.h>
#include "ot.h"
#include "otdecode.h"

int main(int argc, const char * argv[])
{
    char buf[1024];
    fputs("Operation 1: ", stdout);
    fgets(buf, 1024, stdin);

    char p[64];
    ot_op* op = ot_new_op(0, p);
    ot_decode_err err = ot_decode(op, buf);
    if (err != OT_ERR_NONE) {
        puts("Error when decoding JSON.");
        return err;
    }

    char buf2[1024];
    fputs("Operation 2: ", stdout);
    fgets(buf2, 1024, stdin);

    ot_op* op2 = ot_new_op(0, p);
    err = ot_decode(op2, buf2);
    if (err != OT_ERR_NONE) {
        puts("Error when decoding JSON.");
        return err;
    }

    ot_op* composed = ot_compose(op, op2);
    char* snapshot = ot_snapshot(composed);
    puts("Composed: ");
    puts(snapshot);

    return 0;
}

#include <stdio.h>
#include "ot.h"
#include "compose.h"
#include "otdecode.h"

int main(int argc, const char * argv[])
{
    char buf[1024];
    fputs("Operation 1: ", stdout);
    fgets(buf, 1024, stdin);

    char p[64];
    ot_op* op = ot_new_op(0, p);
    ot_decode_err err = ot_decode(op, buf);
    if (err != OT_ERR_NONE) {
        puts("Error when decoding JSON.");
        return err;
    }

    char buf2[1024];
    fputs("Operation 2: ", stdout);
    fgets(buf2, 1024, stdin);

    ot_op* op2 = ot_new_op(0, p);
    err = ot_decode(op2, buf2);
    if (err != OT_ERR_NONE) {
        puts("Error when decoding JSON.");
        return err;
    }

    ot_op* composed = ot_compose(op, op2);
    char* snapshot = ot_snapshot(composed);
    puts("Composed: ");
    puts(snapshot);

    return 0;
}

Add compose header to CLI

Add compose header to CLI


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

#include <math.h>
int main()
{
    double sinTable[256];

#pragma omp parallel for
    for(int n=0; n<256; ++n)
        sinTable[n] = sin(2 * M_PI * n / 256);

    // the table is now initialized
}

// RUN: clang -fopenmp -c -g -emit-llvm %s -o %t.1.bc
// RUN: opt -instnamer %t.1.bc -o %t.bc
// RUN: llvm-epp %t.bc -o %t.profile
// RUN: clang -fopenmp -v %t.epp.bc -o %t-exec -lepp-rt -lpthread -lm 2> %t.compile
// RUN: %t-exec > %t.log
// RUN: llvm-epp -p=%t.profile %t.bc 2> %t.decode
// RUN: diff -aub %t.profile %s.txt

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

#include <math.h>
int main()
{
    double sinTable[256];

#pragma omp parallel for
    for(int n=0; n<256; ++n)
        sinTable[n] = sin(2 * M_PI * n / 256);

    // the table is now initialized
}

// RUN: clang -fopenmp -c -g -emit-llvm %s -o %t.1.bc
// RUN: opt -instnamer %t.1.bc -o %t.bc
// RUN: llvm-epp %t.bc -o %t.profile
// RUN: clang -fopenmp -v %t.epp.bc -o %t-exec -lepp-rt -lpthread -lm 2> %t.compile
// RUN: OMP_NUM_THREADS=4 %t-exec > %t.log
// RUN: llvm-epp -p=%t.profile %t.bc 2> %t.decode
// RUN: diff -aub %t.profile %s.txt

Fix test case 11 to set the number of omp threads and make it portable


/* A simple Lua module to suspend this process. */
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <lua.h>
#include <lauxlib.h>

int l_kill(lua_State *L)
{
    /* Send ourselves the terminal stop signal, equivalent to normally
     * pressing ^Z. */
    kill(0, SIGTSTP);

    return 0;
}

/* The module's functions */
struct luaL_Reg functions[] = {
    { "kill", l_kill },
    { 0, 0 },
};

/* Called when importing this module */
int luaopen_kill(lua_State *L)
{
    luaL_newlib(L, functions);

    return 1;
}

/* A simple Lua module to suspend this process. */
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <lua.h>
#include <lauxlib.h>

int l_kill(lua_State *L)
{
    /* Send ourselves the terminal stop signal, equivalent to normally
     * pressing ^Z. */
    kill(0, SIGTSTP);

    /* We may have been restored after a window change; pretend we've
     * received a WINCH. */
    kill(0, SIGWINCH);

    return 0;
}

/* The module's functions */
struct luaL_Reg functions[] = {
    { "kill", l_kill },
    { 0, 0 },
};

/* Called when importing this module */
int luaopen_kill(lua_State *L)
{
    luaL_newlib(L, functions);

    return 1;
}

Handle the terminal resizing while suspended, by sending ourselves a SIGWINCH after restoring.


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

#include <account/paths.h>
#include <text/paths.h>
#include <game/paths.h>

inherit LIB_RAWVERB;

void main(object actor, string args)
{
	object first;
	object obj;
	object proxy;

	if (query_user()->query_class() < 3) {
		send_out("Only an administrator can nuke a subsystem\n");
		return;
	}

	first = KERNELD->first_link(args);

	if (!first) {
		send_out(args + " owns no objects.\n");
		return;
	}

	proxy = PROXYD->get_proxy(query_user()->query_name());

	do {
		proxy->destruct_object(first);
	} while (first = KERNELD->first_link(args));
}

Add command to nuke all objects owned by a specific owner


#include <sys/stat.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>

static long posix(const char path[static 1])
{
    struct stat metadata;

    assert(!stat(path, &metadata));

    return metadata.st_size;
}

static long standard(const char path[static 1])
{
    FILE* stream = fopen(path, "rb");

    fseek(stream, 0, SEEK_END);
    long position = ftell(stream);

    fclose(stream);
    return position;
}

int main(void)
{
    const char path[] = "metallic.a";

    assert(posix(path) == standard(path));
    assert(!errno);
}

Test standard C interface for ll?seek

Test standard C interface for ll?seek


/*
 * Copyright (C) 2014, Galois, Inc.
 * This sotware is distributed under a standard, three-clause BSD license.
 * Please see the file LICENSE, distributed with this software, for specific
 * terms and conditions.
 */
#ifndef MINLIBC_STDLIB_H
#define MINLIBC_STDLIB_H

#define NULL            0
#define EXIT_SUCCESS    0
#define EXIT_FAILURE    1

typedef unsigned long int size_t;

double    atof(const char *nptr);
int       atoi(const char *nptr);
long int  strtol(const char *nptr, char **endptr, int base);

char     *getenv(const char *name);
void      abort(void);
void      exit(int status);

void     *malloc(size_t size);
void     *realloc(void *ptr, size_t size);
void     *calloc(size_t nmemb, size_t size);
void      free(void *ptr);

int       mkstemp(char *template);

void     *bsearch(const void *, const void *, size_t, size_t,
                  int (*)(const void *, const void *));

int       putenv(char *str);
int       unsetenv(const char *name);

#endif

/*
 * Copyright (C) 2014, Galois, Inc.
 * This sotware is distributed under a standard, three-clause BSD license.
 * Please see the file LICENSE, distributed with this software, for specific
 * terms and conditions.
 */
#ifndef MINLIBC_STDLIB_H
#define MINLIBC_STDLIB_H

#define NULL            0
#define EXIT_SUCCESS    0
#define EXIT_FAILURE    1

typedef unsigned long int size_t;

double    atof(const char *nptr);
int       atoi(const char *nptr);
long int  strtol(const char *nptr, char **endptr, int base);

char     *getenv(const char *name);
void      abort(void);
void      exit(int status);

void     *malloc(size_t size);
void     *realloc(void *ptr, size_t size);
void     *calloc(size_t nmemb, size_t size);
void      free(void *ptr);

int       mkstemp(char *template);

void     *bsearch(const void *, const void *, size_t, size_t,
                  int (*)(const void *, const void *));

int       putenv(char *str);
int       unsetenv(const char *name);

int       abs(int j);

#endif

Add a prototype for abs().

Add a prototype for abs().


#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);
	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */

#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	std::vector<StreamType::type> getStreams(const Joinable& joinable);

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);

	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
	void unjoin(const JoinableImpl& to, const StreamType::type stream);

	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);

	std::vector<Joinable> &getJoinees(const StreamType::type stream);
	std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */

Add methods to joinable to handle streams


#ifndef PROPOSER_H
#define PROPOSER_H

#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>
#include "proctor/detector.h"
#include "proctor/database_entry.h"

namespace pcl
{

  namespace proctor
  {

    struct Candidate {
      std::string id;
      float votes;
    };

    class Proposer {
      public:
        typedef boost::shared_ptr<Proposer> Ptr;
        typedef boost::shared_ptr<const Proposer> ConstPtr;

        typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr;
        typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr;

        Proposer()
        {}

        void
        setDatabase(const DatabasePtr database)
        {
          database_ = database;
        }

        virtual void
        getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0;

        virtual void
        selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output);

      protected:
        DatabasePtr database_;
    };

  }
}

#endif

#ifndef PROPOSER_H
#define PROPOSER_H

#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>
#include "proctor/detector.h"
#include "proctor/database_entry.h"

namespace pcl
{

  namespace proctor
  {

    struct Candidate {
      std::string id;
      double votes;
    };

    class Proposer {
      public:
        typedef boost::shared_ptr<Proposer> Ptr;
        typedef boost::shared_ptr<const Proposer> ConstPtr;

        typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr;
        typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr;

        Proposer()
        {}

        void
        setDatabase(const DatabasePtr database)
        {
          database_ = database;
        }

        virtual void
        getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0;

        virtual void
        selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output);

      protected:
        DatabasePtr database_;
    };

  }
}

#endif

Change votes to use double.

Change votes to use double.

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@4320 a9d63959-f2ad-4865-b262-bf0e56cfafb6


/*
    KDE2 compatibility for KDE Alarm Daemon and KDE Alarm Daemon GUI.

    This file is part of the KDE alarm daemon.
    Copyright (c) 2001 David Jarvie <software@astrojar.org.uk>

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

    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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/

#ifndef AD_COMPAT_H
#define AD_COMPAT_H

// Compatibility with KDE 2.2
#include <qglobal.h>
#if QT_VERSION < 300
	#define QPtrList         QList
	#define QPtrListIterator QListIterator
#endif
#include <kapp.h>
#if KDE_VERSION < 290
   #define Alarm KOAlarm
#endif

#endif

/*
    KDE2 compatibility for KDE Alarm Daemon and KDE Alarm Daemon GUI.

    This file is part of the KDE alarm daemon.
    Copyright (c) 2001 David Jarvie <software@astrojar.org.uk>

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

    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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/

#ifndef AD_COMPAT_H
#define AD_COMPAT_H

// Compatibility with KDE 2.2
#include <qglobal.h>
#if QT_VERSION < 300
	#define QPtrList         QList
	#define QPtrListIterator QListIterator
#endif
#include <kapp.h>
#if KDE_VERSION < 290
   #define Alarm KOAlarm
   #define uid   VUID
#endif

#endif

Adjust for changes in libkcal

Adjust for changes in libkcal

svn path=/trunk/kdepim/; revision=133733


#ifndef __OPENRISC_VMLINUX_H_
#define __OPENRISC_VMLINUX_H_

#ifdef CONFIG_BLK_DEV_INITRD
extern char __initrd_start, __initrd_end;
extern char __initramfs_start;
#endif

extern u32 __dtb_start[];

#endif

#ifndef __OPENRISC_VMLINUX_H_
#define __OPENRISC_VMLINUX_H_

#ifdef CONFIG_BLK_DEV_INITRD
extern char __initrd_start, __initrd_end;
#endif

extern u32 __dtb_start[];

#endif

openrisc: Remove unused declaration of __initramfs_start

Signed-off-by: Geert Uytterhoeven <0da414d9d963da4039c2a0525b1844228075aa58@linux-m68k.org>
Signed-off-by: Jonas Bonn <35a2c6fae61f8077aab61faa4019722abf05093c@southpole.se>


/*
name: TEST039
description: Test of integer constants
comments: This test is done for z80 sizes
output:
F1	I
G2	F1	main
{
\
A3	I	i
A4	N	u
A5	W	l
A6	Z	ul
A7	Q	ll
A8	O	ull
	A3	#I1	:I
	A3	#I1	:I
	A4	#N1	:N
	A4	#N1	:N
	A5	#W1	:W
	A5	#W0	:W
	A4	#N0	:N
	A6	#Z1	:Z
	A5	#W1	:W
	A7	#Q0	:Q
	A6	#Z0	:Z
	A8	#O1	:O
	A8	#O1	:O
	r	#I0
}
*/

int
main(void)
{
	int i;
	unsigned u;
	long l;
	unsigned long ul;
	long long ll;
	unsigned long long ull;

	i = 1;
	i = 1u;
	u = 1u;
	u = 1;
	l = 1l;
	l = 0xFFFF + 1;
	u = 0xFFFF + 1;
	ul = 1ul;
	l = 1ul;
	ll = 0xFFFFFFFF + 1;
	ul = 0xFFFFFFFF + 1;
	ull = 1lul;
	ull = 1;
	return 0;
}

Add test for integer constants

Add test for integer constants

There are some ugly rules in C99 about the type of integer
constants, and this test try to check them.


//
//  GCMDeviceInfo.h
//  GCMCocoaExtensions
//
//  Created by Jerry Hsu on 11/26/13.
//  Copyright (c) 2013 GameChanger. All rights reserved.
//

#import <Foundation/Foundation.h>

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define IOS7_OR_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
#define PRE_IOS7 SYSTEM_VERSION_LESS_THAN(@"7.0")

@interface GCMDeviceInfo : NSObject

+ (BOOL)isRetinaDisplay;
+ (BOOL)iPad;

@end

//
//  GCMDeviceInfo.h
//  GCMCocoaExtensions
//
//  Created by Jerry Hsu on 11/26/13.
//  Copyright (c) 2013 GameChanger. All rights reserved.
//

#import <Foundation/Foundation.h>

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define IOS7_OR_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
#define PRE_IOS7 SYSTEM_VERSION_LESS_THAN(@"7.0")

#define IOS8_OR_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")
#define PRE_IOS8 SYSTEM_VERSION_LESS_THAN(@"8.0")

@interface GCMDeviceInfo : NSObject

+ (BOOL)isRetinaDisplay;
+ (BOOL)iPad;

@end

Add macros to check for iOS 8

Add macros to check for iOS 8


/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#include <Echo.h>
#include <string.h>

void b__init(void) {
}

char * b_echo_string(char *s) {
    return strdup(s);
}

int b_echo_int(int i) {
    return i;
}

float b_echo_float(float f) {
    return f;
}

double b_echo_double(double d) {
    return d;
}

int b_echo_mix(double d) {
    return d;
}

int b_echo_parameter(int pin, int *pout) {
    *pout = pin;
    return pin;
}

void b_increment_parameter(int *x) {
    *x = *x + 1;
}

/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#include <Echo.h>
#include <string.h>

void b__init(void) {
}

char * b_echo_string(const char *s) {
    return strdup(s);
}

int b_echo_int(int i) {
    return i;
}

float b_echo_float(float f) {
    return f;
}

double b_echo_double(double d) {
    return d;
}

int b_echo_mix(double d) {
    return d;
}

int b_echo_parameter(int pin, int *pout) {
    *pout = pin;
    return pin;
}

void b_increment_parameter(int *x) {
    *x = *x + 1;
}

Adjust RPC parameter qualification for CAmkES changes.


#ifndef	LIBTRADING_FAST_FEED_H
#define	LIBTRADING_FAST_FEED_H

#include "libtrading/proto/fast_session.h"

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

struct fast_feed {
	struct fast_session	*session;
	struct fast_session_cfg	cfg;

	u64			recv_num;
	char			xml[128];
	char			lip[32];
	char			sip[32];
	char			ip[32];
	bool			active;
	int			port;
};

static inline int socket_setopt(int sockfd, int level, int optname, int optval)
{
	return setsockopt(sockfd, level, optname, (void *) &optval, sizeof(optval));
}

static inline struct fast_message *fast_feed_recv(struct fast_feed *feed, int flags)
{
	return fast_session_recv(feed->session, flags);
}

int fast_feed_close(struct fast_feed *feed);
int fast_feed_open(struct fast_feed *feed);

#endif	/* LIBTRADING_FAST_FEED_H */

#ifndef	LIBTRADING_FAST_FEED_H
#define	LIBTRADING_FAST_FEED_H

#include "libtrading/proto/fast_session.h"

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

struct fast_feed {
	struct fast_session	*session;
	struct fast_session_cfg	cfg;

	u64			recv_num;
	char			xml[128];
	char			lip[32];
	char			sip[32];
	char			ip[32];
	bool			active;
	int			port;
};

static inline int socket_setopt(int sockfd, int level, int optname, int optval)
{
	return setsockopt(sockfd, level, optname, (void *) &optval, sizeof(optval));
}

static inline struct fast_message *fast_feed_recv(struct fast_feed *feed, int flags)
{
	if (feed->session->reset)
		fast_session_reset(feed->session);

	return fast_session_recv(feed->session, flags);
}

int fast_feed_close(struct fast_feed *feed);
int fast_feed_open(struct fast_feed *feed);

#endif	/* LIBTRADING_FAST_FEED_H */

FAST: Reset a session if implicit reset option is set

Signed-off-by: Marat Stanichenko <146c4a279a7427b2cc19a19b6130cbb7ee404ab1@gmail.com>
Signed-off-by: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>


#ifndef CERT_SUBMISSION_HANDLER_H
#define CERT_SUBMISSION_HANDLER_H

#include <string>

#include "base/macros.h"
#include "log/cert_checker.h"
#include "proto/ct.pb.h"
#include "proto/serializer.h"
#include "util/status.h"

// Parse incoming submissions, do preliminary sanity checks and pass them
// through cert checker.
// Prepare for signing by parsing the input into an appropriate
// log entry structure.
class CertSubmissionHandler {
 public:
  // Does not take ownership of the cert_checker.
  explicit CertSubmissionHandler(const cert_trans::CertChecker* cert_checker);

  // These may change |chain|.
  // TODO(pphaneuf): These could return StatusOr<ct::LogEntry>.
  util::Status ProcessX509Submission(cert_trans::CertChain* chain,
                                     ct::LogEntry* entry) const;
  util::Status ProcessPreCertSubmission(cert_trans::PreCertChain* chain,
                                        ct::LogEntry* entry) const;

  // For clients, to reconstruct the bytestring under the signature
  // from the observed chain. Does not check whether the entry
  // has valid format (i.e., does not check length limits).
  static bool X509ChainToEntry(const cert_trans::CertChain& chain,
                               ct::LogEntry* entry);

  const std::multimap<std::string, const cert_trans::Cert*>& GetRoots() const {
    return cert_checker_->GetTrustedCertificates();
  }

 private:
  const cert_trans::CertChecker* const cert_checker_;

  DISALLOW_COPY_AND_ASSIGN(CertSubmissionHandler);
};

#endif

#ifndef CERT_SUBMISSION_HANDLER_H
#define CERT_SUBMISSION_HANDLER_H

#include <string>

#include "base/macros.h"
#include "log/cert_checker.h"
#include "proto/ct.pb.h"
#include "proto/serializer.h"
#include "util/status.h"

// Parse incoming submissions, do preliminary sanity checks and pass them
// through cert checker.
// Prepare for signing by parsing the input into an appropriate
// log entry structure.
class CertSubmissionHandler {
 public:
  // Does not take ownership of the cert_checker.
  explicit CertSubmissionHandler(const cert_trans::CertChecker* cert_checker);

  // These may change |chain|.
  // TODO(pphaneuf): These could return StatusOr<ct::LogEntry>.
  util::Status ProcessX509Submission(cert_trans::CertChain* chain,
                                     ct::LogEntry* entry) const;
  util::Status ProcessPreCertSubmission(cert_trans::PreCertChain* chain,
                                        ct::LogEntry* entry) const;

  // For clients, to reconstruct the bytestring under the signature
  // from the observed chain. Does not check whether the entry
  // has valid format (i.e., does not check length limits).
  static bool X509ChainToEntry(const cert_trans::CertChain& chain,
                               ct::LogEntry* entry);

 private:
  const cert_trans::CertChecker* const cert_checker_;

  DISALLOW_COPY_AND_ASSIGN(CertSubmissionHandler);
};

#endif

Remove the unused CertSubmissionHandler::GetRoots method.


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2012 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k1"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2012 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k2"

Update driver version to 5.03.00-k2

[SCSI] qla4xxx: Update driver version to 5.03.00-k2

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


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

int a;
int main() {
    a = 5;
    int *p = &a;
    change(p);
    assert(a - 6 == 0);
    return 0;
}

Add an octagn test for handling pointers


//
//  SZSmartAlertUtils.h
//  SocializeSDK
//
//  Created by Nathaniel Griswold on 6/4/12.
//  Copyright (c) 2012 Socialize, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SZSmartAlertUtils : NSObject

+ (BOOL)isAvailable;
+ (BOOL)handleNotification:(NSDictionary*)userInfo __attribute__((deprecated("Please use `openNotification:` (which unconditionally opens the notification), instead")));
+ (BOOL)isSocializeNotification:(NSDictionary*)userInfo;
+ (void)registerDeviceToken:(NSData*)deviceToken;
+ (BOOL)openNotification:(NSDictionary*)userInfo;

@end

//
//  SZSmartAlertUtils.h
//  SocializeSDK
//
//  Created by Nathaniel Griswold on 6/4/12.
//  Copyright (c) 2012 Socialize, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SZSmartAlertUtils : NSObject

+ (BOOL)isAvailable;
+ (BOOL)handleNotification:(NSDictionary*)userInfo; // __attribute__((deprecated("Please use `openNotification:` (which unconditionally opens the notification), instead")));
+ (BOOL)isSocializeNotification:(NSDictionary*)userInfo;
+ (void)registerDeviceToken:(NSData*)deviceToken;
+ (BOOL)openNotification:(NSDictionary*)userInfo;

@end

Remove a deprecation for minor-minor release


/*
 * Copyright (C) 2015 Luke San Antonio
 * All rights reserved.
 */
#pragma once
#include "rapidjson/document.h"
#include "glm/glm.hpp"
namespace redc
{
  inline glm::vec3 vec3_from_js(rapidjson::Value const& v) noexcept
  {
    return glm::vec3{v["x"].GetDouble(),v["y"].GetDouble(),v["z"].GetDouble()};
  }
}

/*
 * Copyright (C) 2015 Luke San Antonio
 * All rights reserved.
 */
#pragma once
#include "rapidjson/document.h"
#include "glm/glm.hpp"
namespace redc
{
  inline glm::vec3 vec3_from_js_object(rapidjson::Value const& v) noexcept
  {
    return glm::vec3{v["x"].GetDouble(),v["y"].GetDouble(),v["z"].GetDouble()};
  }
  inline glm::vec3 vec3_from_js_array(rapidjson::Value const& v) noexcept
  {
    return glm::vec3{v[0].GetDouble(),v[1].GetDouble(),v[2].GetDouble()};
  }
}

Update / add vec3 => JSON functions

Update / add vec3 => JSON functions

Add support for array vectors like this [0.2, 12.5, 4.1]


#ifndef LOG2_H
#define LOG2_H

template <typename T>
#ifdef __GNUC__
__attribute__((const))
#endif
static bool IsPowerOfTwo(const T& x)
{
    return (x & (x - 1)) == 0;
}

template<typename T>
#ifdef __GNUC__
__attribute__((const))
#endif
static inline unsigned ilog2(T n)
{
    // returns the first power of two equal to
    // or greater than n. For example ilog2(1) = 0, ilog2(4) = 2, ilog2(5) = 3
    unsigned l = 0;
    T r = 1;
    while (r < n)
    {
        l++;
        r *= 2;
    }
    return l;
}

#endif

#ifndef LOG2_H
#define LOG2_H

template <typename T>
#ifdef __GNUC__
__attribute__((const))
#endif
static inline bool IsPowerOfTwo(T x)
{
    return (x & (x - 1)) == 0;
}

template<typename T>
#ifdef __GNUC__
__attribute__((const))
#endif
static inline unsigned ilog2(T n)
{
    // returns the first power of two equal to
    // or greater than n. For example ilog2(1) = 0, ilog2(4) = 2, ilog2(5) = 3
    unsigned l = 0;
    T r = 1;
    while (r < n)
    {
        l++;
        r *= 2;
    }
    return l;
}

#endif

Work around an optimization bug in IsPowerOfTwo.


#pragma once

#include <cstdint>

using uint = unsigned int;

using u8 = uint8_t;
using u16 = uint16_t;
using s8 = int8_t;

const int GAMEBOY_WIDTH = 160;
const int GAMEBOY_HEIGHT = 144;

const int CLOCK_RATE = 4194304;

enum class Color {
    Color0, /* White */
    Color1, /* Light gray */
    Color2, /* Dark gray */
    Color3, /* Black */
};

struct Noncopyable {
    Noncopyable &operator=(const Noncopyable &) = delete;
    Noncopyable(const Noncopyable &) = delete;
    Noncopyable() = default;
};

#pragma once

#include <cstdint>

using uint = unsigned int;

using u8 = uint8_t;
using u16 = uint16_t;
using s8 = int8_t;

const int GAMEBOY_WIDTH = 160;
const int GAMEBOY_HEIGHT = 144;

const int CLOCK_RATE = 4194304;

enum class Color {
    Color0, /* White */
    Color1, /* Light gray */
    Color2, /* Dark gray */
    Color3, /* Black */
};

struct Noncopyable {
    Noncopyable& operator=(const Noncopyable&) = delete;
    Noncopyable(const Noncopyable&) = delete;
    Noncopyable() = default;
};

Align & and * to the left always

Align & and * to the left always


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

// FIXME: printf is not intercepted on Windows yet.
// XFAIL: windows-msvc

#include <stdio.h>
int main() {
#ifdef _MSC_VER
  // FIXME: The test raises a dialog even though it's XFAILd.
  return 42;
#endif
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile int n[1];
  printf("%c %d %.3f %s%n\n", c, x, f, s, &n[1]);
  return 0;
  // Check that %n is sanitized.
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
  // CHECK-OFF: 0 12 1.239 34
}

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

// FIXME: printf is not intercepted on Windows yet.
// XFAIL: windows-msvc

// New Bionic rejects %n
// https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336
// UNSUPPORTED: android

#include <stdio.h>
int main() {
#ifdef _MSC_VER
  // FIXME: The test raises a dialog even though it's XFAILd.
  return 42;
#endif
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile int n[1];
  printf("%c %d %.3f %s%n\n", c, x, f, s, &n[1]);
  return 0;
  // Check that %n is sanitized.
  // CHECK-ON: stack-buffer-overflow
  // CHECK-ON-NOT: 0 12 1.239 34
  // CHECK-OFF: 0 12 1.239 34
}

[asan] Disable test incompatible with new Android

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


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

#ifndef CRYPTO_OPENSSL_BIO_STRING_H_
#define CRYPTO_OPENSSL_BIO_STRING_H_

#include <string>

#include "crypto/crypto_export.h"

// From <openssl/bio.h>
typedef struct bio_st BIO;

namespace crypto {

// Creates a new BIO that can be used with OpenSSL's various output functions,
// and which will write all output directly into |out|. This is primarily
// intended as a utility to reduce the amount of copying and separate
// allocations when performing extensive string modifications or streaming
// within OpenSSL.
//
// Note: |out| must remain valid for the duration of the BIO.
BIO* CRYPTO_EXPORT BIO_new_string(std::string* out);

}  // namespace crypto

#endif  // CRYPTO_OPENSSL_BIO_STRING_H_

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

#ifndef CRYPTO_OPENSSL_BIO_STRING_H_
#define CRYPTO_OPENSSL_BIO_STRING_H_

#include <string>

#include "crypto/crypto_export.h"

// From <openssl/bio.h>
typedef struct bio_st BIO;

namespace crypto {

// Creates a new BIO that can be used with OpenSSL's various output functions,
// and which will write all output directly into |out|. This is primarily
// intended as a utility to reduce the amount of copying and separate
// allocations when performing extensive string modifications or streaming
// within OpenSSL.
//
// Note: |out| must remain valid for the duration of the BIO.
CRYPTO_EXPORT BIO* BIO_new_string(std::string* out);

}  // namespace crypto

#endif  // CRYPTO_OPENSSL_BIO_STRING_H_

Fix component build with gcc 4.6 on Android.

CRYPTO_EXPORT macro has to be before the non-void return type.

BUG=None
TBR=rsleevi@chromium.org

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

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


//
//  PathKit.h
//  PathKit
//
//  Created by Kyle Fuller on 20/11/2014.
//  Copyright (c) 2014 Cocode. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for PathKit.
FOUNDATION_EXPORT double PathKitVersionNumber;

//! Project version string for PathKit.
FOUNDATION_EXPORT const unsigned char PathKitVersionString[];

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

Remove useless comment from umbrella header


struct A
{
	struct B
	{
		int i, j;
	} b, c;
};

f(struct B *b)
{
	struct A fine = {
		.b = *b // XXX: should be no missing braces warning
	};

	struct A bad = {
		.b = { *b }
	};

}

Copy init brace conformance example, for structs


#include <stdlib.h>
#include <glib.h>

#include "bmi/bmi_cem.h"

static void test_bmi_initialize(void) {
  BMI_Model *model = (BMI_Model *)malloc(sizeof(BMI_Model));
  int status;

  register_bmi_cem(model);

  status = model->initialize(NULL, &(model->self));

  g_assert_cmpint(status, ==, BMI_SUCCESS);
}

static void test_bmi_update(void) {
  BMI_Model *model = (BMI_Model *)malloc(sizeof(BMI_Model));
  int status;

  register_bmi_cem(model);

  status = model->initialize(NULL, &(model->self));
  g_assert_cmpint(status, ==, BMI_SUCCESS);

  status = model->update(&(model->self));
  g_assert_cmpint(status, ==, BMI_SUCCESS);
}

int main(int argc, char* argv[]) {
  g_test_init(&argc, &argv, NULL);
  g_test_add_func("/bmi/initialize", &test_bmi_initialize);
  // g_test_add_func("/bmi/update", &test_bmi_update);

  return g_test_run();
}

#include <stdlib.h>
#include <glib.h>

#include "bmi/bmi_cem.h"

static void test_bmi_initialize(void) {
  BMI_Model *model = (BMI_Model *)malloc(sizeof(BMI_Model));
  int status;

  register_bmi_cem(model);

  status = model->initialize(NULL, &(model->self));

  g_assert_cmpint(status, ==, BMI_SUCCESS);
}

static void test_bmi_update(void) {
  BMI_Model *model = (BMI_Model *)malloc(sizeof(BMI_Model));
  int status;

  register_bmi_cem(model);

  status = model->initialize(NULL, &(model->self));
  g_assert_cmpint(status, ==, BMI_SUCCESS);

  status = model->update(&(model->self));
  g_assert_cmpint(status, ==, BMI_SUCCESS);
}

int main(int argc, char* argv[]) {
  g_test_init(&argc, &argv, NULL);
  g_test_add_func("/bmi/initialize", &test_bmi_initialize);
  g_test_add_func("/bmi/update", &test_bmi_update);

  return g_test_run();
}

Add test for update function.

Add test for update function.


/*
 * Definitions used by low-level trap handlers
 *
 * Copyright (C) 2008 Michal Simek
 * Copyright (C) 2007 - 2008 PetaLogix
 * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License. See the file COPYING in the main directory of this
 * archive for more details.
 */

#ifndef _ASM_MICROBLAZE_ENTRY_H
#define _ASM_MICROBLAZE_ENTRY_H

#include <asm/percpu.h>
#include <asm/ptrace.h>

/*
 * These are per-cpu variables required in entry.S, among other
 * places
 */

#define PER_CPU(var) per_cpu__##var

# ifndef __ASSEMBLY__
DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
DECLARE_PER_CPU(unsigned int, SYSCALL_SAVE); /* Saved syscall number */
# endif /* __ASSEMBLY__ */

#endif /* _ASM_MICROBLAZE_ENTRY_H */

/*
 * Definitions used by low-level trap handlers
 *
 * Copyright (C) 2008 Michal Simek
 * Copyright (C) 2007 - 2008 PetaLogix
 * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License. See the file COPYING in the main directory of this
 * archive for more details.
 */

#ifndef _ASM_MICROBLAZE_ENTRY_H
#define _ASM_MICROBLAZE_ENTRY_H

#include <asm/percpu.h>
#include <asm/ptrace.h>

/*
 * These are per-cpu variables required in entry.S, among other
 * places
 */

#define PER_CPU(var) per_cpu__##var

# ifndef __ASSEMBLY__
DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
# endif /* __ASSEMBLY__ */

#endif /* _ASM_MICROBLAZE_ENTRY_H */

microblaze: Remove unneded per cpu SYSCALL_SAVE variable

Signed-off-by: Michal Simek <3a191dd2be46e826fee926d532b136ed65cb5318@monstr.eu>


#ifndef SRC_KEYBORD_LAYOUT_OBSERVER_H_
#define SRC_KEYBORD_LAYOUT_OBSERVER_H_

#include "nan.h"

using namespace v8;  // NOLINT

class KeyboardLayoutObserver : public node::ObjectWrap {
 public:
  static void Init(Handle<Object> target);
  void HandleKeyboardLayoutChanged();

 private:
  KeyboardLayoutObserver(NanCallback *callback);
  ~KeyboardLayoutObserver();
  static NAN_METHOD(New);
  static NAN_METHOD(GetCurrentKeyboardLayout);

  NanCallback *callback;
};

#endif  // SRC_KEYBORD_LAYOUT_OBSERVER_H_

#ifndef SRC_KEYBORD_LAYOUT_OBSERVER_H_
#define SRC_KEYBORD_LAYOUT_OBSERVER_H_

#include "nan.h"

using namespace v8;  // NOLINT

class KeyboardLayoutObserver : public node::ObjectWrap {
 public:
  static void Init(Handle<Object> target);
  void HandleKeyboardLayoutChanged();

 private:
  KeyboardLayoutObserver(NanCallback *callback);
  ~KeyboardLayoutObserver();
  static NAN_METHOD(New);
  static NAN_METHOD(GetCurrentKeyboardLayout);
  static NAN_METHOD(GetInstalledKeyboardLayouts);

  NanCallback *callback;
};

#endif  // SRC_KEYBORD_LAYOUT_OBSERVER_H_

Add our new method to get the list of installed layouts


@interface UIPanGestureRecognizer (Private)

@property (setter=_setHysteresis:) BOOL _hysteresis;

@end

@interface UIPanGestureRecognizer (Private)

@property (setter=_setHysteresis:) CGFloat _hysteresis;
@property (assign, nonatomic) BOOL failsPastMaxTouches;

@end

[UIKit] Fix UIPanGestureRecognizer property type; add property


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

#ifndef CHROME_APP_SCOPED_OLE_INITIALIZER_H_
#define CHROME_APP_SCOPED_OLE_INITIALIZER_H_

// Wraps OLE initialization in a cross-platform class meant to be used on the
// stack so init/uninit is done with scoping. This class is ok for use by
// non-windows platforms; it just doesn't do anything.

#if defined(OS_WIN)

#include <ole2.h>

class ScopedOleInitializer {
 public:
  ScopedOleInitializer() {
    int ole_result = OleInitialize(NULL);
    DCHECK(ole_result == S_OK);
  }
  ~ScopedOleInitializer() {
    OleUninitialize();
  }
};

#else

class ScopedOleInitializer {
 public:
  // Empty, this class does nothing on non-win32 systems. Empty ctor is
  // necessary to avoid "unused variable" warning on gcc.
  ScopedOleInitializer() { }
};

#endif

#endif  // CHROME_APP_SCOPED_OLE_INITIALIZER_H_

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

#ifndef CHROME_APP_SCOPED_OLE_INITIALIZER_H_
#define CHROME_APP_SCOPED_OLE_INITIALIZER_H_

#include "base/logging.h"
#include "build/build_config.h"

// Wraps OLE initialization in a cross-platform class meant to be used on the
// stack so init/uninit is done with scoping. This class is ok for use by
// non-windows platforms; it just doesn't do anything.

#if defined(OS_WIN)

#include <ole2.h>

class ScopedOleInitializer {
 public:
  ScopedOleInitializer() {
    int ole_result = OleInitialize(NULL);
    DCHECK(ole_result == S_OK);
  }
  ~ScopedOleInitializer() {
    OleUninitialize();
  }
};

#else

class ScopedOleInitializer {
 public:
  // Empty, this class does nothing on non-win32 systems. Empty ctor is
  // necessary to avoid "unused variable" warning on gcc.
  ScopedOleInitializer() { }
};

#endif

#endif  // CHROME_APP_SCOPED_OLE_INITIALIZER_H_

Make ScopedOleInitializer work on windows if you aren't including
build_config already.

BUG=none
TEST=none

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@8835 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


// RUN: %ucc -o %t %s
// RUN: %ocheck 0 %t
// RUN: %t | %output_check 'Hello 5 2.3' 'Hello 5 2.3'

// should run without segfaulting
main()
{
	printf("Hello %d %.1f\n",
			5,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3); // this causes an infinite loop in glibc's printf()

	printf("Hello %d %.1f\n",
			5,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,
			2.3,  // this causes an infinite loop in glibc's printf()
			2.3); // and this causes a crash

	// suspect the bug is to do with double alignment when passed as stack arguments

	return 0;
}

Format strings and more through test for stack floats


/* 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_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_H_
#define TENSORFLOW_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_H_

#include <jni.h>

#include <string>

#include "tensorflow_lite_support/cc/text/tokenizers/tokenizer.h"
#include "tensorflow_lite_support/cc/utils/jni_utils.h"

namespace tflite {
namespace support {

jobjectArray nativeTokenize(JNIEnv* env, jlong handle, jstring jtext);

jintArray nativeConvertTokensToIds(JNIEnv* env, jlong handle,
                                   jobjectArray jtokens);

}  // namespace support
}  // namespace tflite

#endif  // TENSORFLOW_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_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_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_H_
#define TENSORFLOW_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_H_

#include <jni.h>

#include "tensorflow_lite_support/cc/text/tokenizers/tokenizer.h"
#include "tensorflow_lite_support/cc/utils/jni_utils.h"

namespace tflite {
namespace support {

jobjectArray nativeTokenize(JNIEnv* env, jlong handle, jstring jtext);

jintArray nativeConvertTokensToIds(JNIEnv* env, jlong handle,
                                   jobjectArray jtokens);

}  // namespace support
}  // namespace tflite

#endif  // TENSORFLOW_LITE_SUPPORT_CC_TEXT_TOKENIZERS_TOKENIZER_JNI_LIB_H_

Remove unused STL string include

Remove unused STL string include

PiperOrigin-RevId: 433365283


/*
 *  Copyright 2008 Markus Prinz
 *  Released unter an MIT licence
 *
 */

#include <ruby.h>

VALUE crbCoreMidi;

void Init_rbcoremidi (void)
{
  // Add the initialization code of your module here.
}

/*
 *  Copyright 2008 Markus Prinz
 *  Released unter an MIT licence
 *
 */

#include <ruby.h>
#include <CoreMIDI/CoreMIDI.h>

VALUE callback_proc = Qnil;

MIDIPortRef inPort = NULL;
MIDIClientRef client = NULL;

static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon)
{

}

void Init_rbcoremidi (void)
{
  // Add the initialization code of your module here.
}

Add skeleton for callback and a few global vars


//
//  StravaKitOSX.h
//  StravaKitOSX
//
//  Created by Elmar Tampe on 04/12/14.
//
//

#import <UIKit/UIKit.h>

//! Project version number for StravaKitOSX.
FOUNDATION_EXPORT double StravaKitOSXVersionNumber;

//! Project version string for StravaKitOSX.
FOUNDATION_EXPORT const unsigned char StravaKitOSXVersionString[];

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

//
//  StravaKit.h
//  StravaKit
//
//  Created by Elmar Tampe on 04/12/14.
//
//

#import <UIKit/UIKit.h>

//! Project version number for StravaKit.
FOUNDATION_EXPORT double StravaKitVersionNumber;

//! Project version string for StravaKit.
FOUNDATION_EXPORT const unsigned char StravaKitVersionString[];

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

Fix the naming of the var's to match the actual naming.


/* Standard libraries */
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    int distance, n_ciclists, uniforme;

    if (argc != 4) {
        fprintf(stderr, "USAGE: %s d n [v|u]\n", argv[0]);
        return EXIT_FAILURE;
    }

    distance   = atoi(argv[1]);
    n_ciclists = atoi(argv[2]);

    if (argv[3][1] != '\0') {
        fprintf(stderr, "3rd argument must be 'u' or 'v'\n");
        return EXIT_FAILURE;
    }

    switch (argv[3][0]) {
        case 'u': uniforme = 1; break;
        case 'v': uniforme = 0; break;
        default:
            fprintf(stderr, "3rd argument must be 'u' or 'v'\n");
            return EXIT_FAILURE;
    }

    printf("d:%d n:%d uniforme:%d\n", distance, n_ciclists, uniforme);

    return EXIT_SUCCESS;
}

Create file and read options

Create file and read options


#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"

#define MY_UUID { 0x78, 0x1D, 0x21, 0x66, 0x09, 0x09, 0x4F, 0x9C, 0x88, 0xFD, 0x89, 0x9B, 0x04, 0xBF, 0x5E, 0x32 }
PBL_APP_INFO(MY_UUID,
             "Template App", "Your Company",
             1, 0, /* App version */
             DEFAULT_MENU_ICON,
             APP_INFO_STANDARD_APP);

Window window;

void handle_init(AppContextRef ctx) {

  window_init(&window, "Window Name");
  window_stack_push(&window, true /* Animated */);
}

void pbl_main(void *params) {
  PebbleAppHandlers handlers = {
    .init_handler = &handle_init
  };
  app_event_loop(params, &handlers);
}

#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"

#define MY_UUID { 0x78, 0x1D, 0x21, 0x66, 0x09, 0x09, 0x4F, 0x9C, 0x88, 0xFD, 0x89, 0x9B, 0x04, 0xBF, 0x5E, 0x32 }

PBL_APP_INFO(MY_UUID,
             "Pomade", "Jon Speicher",
             0, 1, /* App version */
             DEFAULT_MENU_ICON,
             APP_INFO_STANDARD_APP);

Window window;

void handle_init(AppContextRef ctx) {
  window_init(&window, "Pomade");
  window_stack_push(&window, true /* Animated */);
}

void pbl_main(void *params) {
  PebbleAppHandlers handlers = {
    .init_handler = &handle_init
  };
  app_event_loop(params, &handlers);
}

Change version, app and window name

Change version, app and window name


/*-
 * Copyright (c) 2004 David E. O'Brien
 * Copyright (c) 2004 Andrey A. Chernov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifdef __GNUC__
#warning "<gnuregex.h> has been replaced by <gnu/regex.h>"
#endif
#include <gnu/regex.h>

/*-
 * Copyright (c) 2004 David E. O'Brien
 * Copyright (c) 2004 Andrey A. Chernov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifdef __GNUC__
#warning "Use -I/usr/include/gnu and <regex.h> instead of <gnuregex.h>"
#endif
#include <gnu/regex.h>

Change warning hint to be more useful

Change warning hint to be more useful


//
// Non-interactive test runner just produces register traces and memory dumps
//

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <stdarg.h>
#include "core.h"
#include "debug_info.h"

void runNonInteractive(Core *core)
{
	int i;

	enableTracing(core);
	runQuantum(core);
}

//
// Non-interactive test runner just produces register traces and memory dumps
//

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <stdarg.h>
#include "core.h"
#include "debug_info.h"

void runNonInteractive(Core *core)
{
	int i;

	enableTracing(core);
	for (i = 0; i < 20; i++)
	{
		if (!runQuantum(core))
			break;
	}
}

Make emulator run for a little longer in non-interactive mode


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

#ifndef IGNORE_H
#define IGNORE_H

#define SVN_DIR_PROP_BASE "/dir-prop-base"
#define SVN_DIR ".svn"
#define SVN_PROP_IGNORE "svn:ignore"

struct ignores {
    char **names; /* Non-regex ignore lines. Sorted so we can binary search them. */
    size_t names_len;
    char **regexes; /* For patterns that need fnmatch */
    size_t regexes_len;
    struct ignores *parent;
};
typedef struct ignores ignores;

ignores *root_ignores;

extern const char *evil_hardcoded_ignore_files[];
extern const char *ignore_pattern_files[];

ignores *init_ignore(ignores *parent);
void cleanup_ignore(ignores *ig);

void add_ignore_pattern(ignores *ig, const char* pattern);

void load_ignore_patterns(ignores *ig, const char *ignore_filename);
void load_svn_ignore_patterns(ignores *ig, const char *path);

int ackmate_dir_match(const char* dir_name);

int filename_filter(struct dirent *dir);

#endif

#ifndef IGNORE_H
#define IGNORE_H

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

#define SVN_DIR_PROP_BASE "/dir-prop-base"
#define SVN_DIR ".svn"
#define SVN_PROP_IGNORE "svn:ignore"

struct ignores {
    char **names; /* Non-regex ignore lines. Sorted so we can binary search them. */
    size_t names_len;
    char **regexes; /* For patterns that need fnmatch */
    size_t regexes_len;
    struct ignores *parent;
};
typedef struct ignores ignores;

ignores *root_ignores;

extern const char *evil_hardcoded_ignore_files[];
extern const char *ignore_pattern_files[];

ignores *init_ignore(ignores *parent);
void cleanup_ignore(ignores *ig);

void add_ignore_pattern(ignores *ig, const char* pattern);

void load_ignore_patterns(ignores *ig, const char *ignore_filename);
void load_svn_ignore_patterns(ignores *ig, const char *path);

int ackmate_dir_match(const char* dir_name);

int filename_filter(struct dirent *dir);

#endif

Put ifndef at the top.

Put ifndef at the top.


#ifndef SETTINGS_DOCK_H
#define SETTINGS_DOCK_H

#include <QStringList>
#include <QWidget>
#include "dock.h"

namespace Ui
{
	class SettingsDock;
}

class Profile;
class QEvent;
class QSettings;

class SettingsDock : public Dock
{
	Q_OBJECT

	public:
		explicit SettingsDock(Profile *profile, QWidget *parent);
		~SettingsDock() override;

	protected:
		void changeEvent(QEvent *event) override;
		void saveSettings();

	public slots:
		void reset();

	protected slots:
		void chooseFolder();
		void save();
		void updateCompleters();

	private:
		Ui::SettingsDock *ui;
		Profile *m_profile;
		QSettings *m_settings;
		QStringList m_lineFilename_completer;
		QStringList m_lineFolder_completer;
};

#endif // SETTINGS_DOCK_H

#ifndef SETTINGS_DOCK_H
#define SETTINGS_DOCK_H

#include <QStringList>
#include <QWidget>
#include "dock.h"

namespace Ui
{
	class SettingsDock;
}

class Profile;
class QEvent;
class QSettings;

class SettingsDock : public Dock
{
	Q_OBJECT

	public:
		explicit SettingsDock(Profile *profile, QWidget *parent);
		~SettingsDock() override;

	protected:
		void changeEvent(QEvent *event) override;

	public slots:
		void reset();

	protected slots:
		void chooseFolder();
		void save();
		void saveSettings();
		void updateCompleters();

	private:
		Ui::SettingsDock *ui;
		Profile *m_profile;
		QSettings *m_settings;
		QStringList m_lineFilename_completer;
		QStringList m_lineFolder_completer;
};

#endif // SETTINGS_DOCK_H

Fix broken connection in quick settings dock


#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>

static struct nf_hook_ops nfho;

unsigned int hook_func(unsigned int hooknum,
	struct sk_buff *skb,
	const struct net_device *in,
	const struct net_device *out,
	int (*okfn)(struct sk_buff *))
{
	return NF_DROP;
}

int init_module() {
	nfho.hook = hook_func;
	nfho.hooknum = NF_INET_PRE_ROUTING;
	nfho.pf = PF_INET;
	nfho.priority = NF_IP_PRI_FIRST;

	nf_register_hook(&nfho);
	return 0;
}

void cleanup_module() {
	nf_unregister_hook(&nfho);
}

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>

static struct nf_hook_ops nfho;

unsigned int hook_func(unsigned int hooknum,
	struct sk_buff *skb,
	const struct net_device *in,
	const struct net_device *out,
	int (*okfn)(struct sk_buff *))
{
    socket_buff = skb;

    if (!socket_buff) {
        return NF_ACCEPT;
    } else {
        ip_header = (stuct iphdr *)skb_network_header(socket_buff); // Network header

        // Drop all ICMP packets
        if (ip_header->protocol == IPPROTO_ICMP) {
            return NF_DROP;
        }
    }
}

int init_module() {
	nfho.hook = hook_func;
	nfho.hooknum = NF_INET_PRE_ROUTING;
	nfho.pf = PF_INET;
	nfho.priority = NF_IP_PRI_FIRST;

	nf_register_hook(&nfho);
	return 0;
}

void cleanup_module() {
	nf_unregister_hook(&nfho);
}

Set hook to block all ICMP packets

Set hook to block all ICMP packets


#ifndef ARGPARSE_ArgObject_HDR
#define ARGPARSE_ArgObject_HDR

#include <string>

namespace ArgParse {
	class ArgObject {
		public:
			typedef int Accept_t;
			static const Accept_t No;
			static const Accept_t WithArg;
			static const Accept_t WithoutArg;

			ArgObject();
			virtual ~ArgObject();

			virtual Accept_t AcceptsArgument(std::string arg) = 0;
			virtual int PassArgument(std::string arg, std::string opt, bool with_opt) = 0;

			virtual bool IsReady() = 0;

			virtual std::string GetHelpText() = 0;
	};
}

#endif

#ifndef ARGPARSE_ArgObject_HDR
#define ARGPARSE_ArgObject_HDR

#include <string>

namespace ArgParse {
	class ArgObject {
		public:
			typedef int Accept_t;
			static const Accept_t No;
			static const Accept_t WithArg;
			static const Accept_t WithoutArg;

			ArgObject();
			virtual ~ArgObject();

			virtual Accept_t AcceptsArgument(std::string arg) __attribute__((warn_unused_result)) = 0;
			virtual int PassArgument(std::string arg, std::string opt, bool with_opt) __attribute__((warn_unused_result)) = 0;

			virtual bool IsReady() __attribute__((warn_unused_result)) = 0;

			virtual std::string GetHelpText() = 0;
	};
}

#endif

Add warn_unused_result to the ArgParse functions

Which return a value.