Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix CPP issue on OS X | #include "gtk2hs_macros.h"
#include <gtksourceview/gtksourcebuffer.h>
#if GTK_MAJOR_VERSION < 3
#include <gtksourceview/gtksourceiter.h>
#endif
#include <gtksourceview/gtksourcelanguage.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcestyle.h>
#include <gtksourceview/gtksourcestyl... | #ifdef __BLOCKS__
#undef __BLOCKS__
#endif
#include "gtk2hs_macros.h"
#include <gtksourceview/gtksourcebuffer.h>
#if GTK_MAJOR_VERSION < 3
#include <gtksourceview/gtksourceiter.h>
#endif
#include <gtksourceview/gtksourcelanguage.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcesty... |
Increase version to 1.48 in preparation for new release | #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.47f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// incr... | #pragma once
// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.48f;
// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// incr... |
Create Binary Tree Maximum Path Sum.c | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
int max_v(int a, int b) {
return a > b ? a : b;
}
int max_value;
int DFS(struct TreeNode* root) {
int left_sum, right_sum;
int sum;
if (root == NULL... | |
Remove hyphens from dutch greetings as per recommendation from @eddyh | #include "num2words.h"
// Language strings for Dutch
const Language LANG_DUTCH = {
.hours = {
"een",
"twee",
"drie",
"vier",
"vijf",
"zes",
"zeven",
"acht",
"negen",
"tien",
"elf",
"twaalf"
},
.phrases = {
"*$1 uur ",
"vijf over *$1 ",
"tien over *$1 ",
"kwart over *$1 ",
"tien vo... | #include "num2words.h"
// Language strings for Dutch
const Language LANG_DUTCH = {
.hours = {
"een",
"twee",
"drie",
"vier",
"vijf",
"zes",
"zeven",
"acht",
"negen",
"tien",
"elf",
"twaalf"
},
.phrases = {
"*$1 uur ",
"vijf over *$1 ",
"tien over *$1 ",
"kwart over *$1 ",
"tien vo... |
Add setting for MSAA sample count | // Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include "CompileConfig.h"
namespace ouzel
{
struct Settings
{
video::Renderer::Driver driver =
#if defined(OUZEL_PLATFORM_OSX) || defined(OUZEL_PLATFORM_IOS) || defined(OUZEL_PLATFORM_TVOS) || defined(OUZEL... | // Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include "CompileConfig.h"
namespace ouzel
{
struct Settings
{
video::Renderer::Driver driver =
#if defined(OUZEL_PLATFORM_OSX) || defined(OUZEL_PLATFORM_IOS) || defined(OUZEL_PLATFORM_TVOS) || defined(OUZEL... |
Use C99 __func__ instead of __FUNCTION__ when not compiling with Visual C++. | /**
* Touhou Community Reliant Automatic Patcher
* Main DLL
*
* ----
*
* Logging functions.
* Log to both a file and, if requested, an on-screen console.
*
* As of now, we do not enforce char strings to be in UTF-8.
*/
#pragma once
/// ---------------
/// Standard output
/// ---------------
// Bas... | /**
* Touhou Community Reliant Automatic Patcher
* Main DLL
*
* ----
*
* Logging functions.
* Log to both a file and, if requested, an on-screen console.
*
* As of now, we do not enforce char strings to be in UTF-8.
*/
#pragma once
/// ---------------
/// Standard output
/// ---------------
// Bas... |
Prepare function added for Robot modules. | /*
* File: robots.h
* Author: m79lol
*
*/
#ifndef ROBOT_MODULE_H
#define ROBOT_MODULE_H
#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2
class Robot {
protected:
Robot() {}
public:
virtual FunctionResult* executeFunctio... | /*
* File: robots.h
* Author: m79lol
*
*/
#ifndef ROBOT_MODULE_H
#define ROBOT_MODULE_H
#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2
typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;
class Robot {... |
Add definitions for block headers. | // Copyright (c) 2012-2013, the scalloc Project Authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.
#ifndef SCALLOC_BLOCK_HEADER_H_
#define SCALLOC_BLOCK_HEADER_H_
#include "common.h"
#include "freel... | |
Add test for octApron combine where forgetting lval is too imprecise | // SKIP PARAM: --sets ana.activated[+] octApron
#include <assert.h>
int f(int x) {
return x + 1;
}
int main(void) {
int y, z;
z = y;
y = f(y);
// local is: y == z
// fun is: #ret == x' + 1
// fun args subst (x' -> y) is: #ret == y + 1
// local forget y is: top
// fun forget y is: top
// fun subs... | |
Fix the documentation main page | /** \file
* This file only exists to contain the front-page of the documentation
*/
/** \mainpage Documentation of the API if the Tiramisu Compiler
*
* Tiramisu provides few classes to enable users to represent their program:
* - The \ref tiramisu::function class: a function in Tiramisu is equivalent to a functio... | /** \file
* This file only exists to contain the front-page of the documentation
*/
/** \mainpage Documentation of the API if the Tiramisu Compiler
*
* Tiramisu provides few classes to enable users to represent their program:
* - The \ref tiramisu::function class: a function in Tiramisu is equivalent to a functio... |
Add guard code to prevent from relocating vector table | /* mbed Microcontroller Library
* Copyright (c) 2015-2017 Nuvoton
*
* 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 requir... | /* mbed Microcontroller Library
* Copyright (c) 2015-2017 Nuvoton
*
* 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 requir... |
Add the mini offset utility class | #ifndef EMULATOR_REGISTER_H
#define EMULATOR_REGISTER_H
#include <cstdint>
template <typename T>
class Register {
public:
Register() {};
void set(const T new_value) { val = new_value; };
T value() const { return val; };
void increment() { val += 1; };
void decrement() { val -= 1; };
private:
... | #ifndef EMULATOR_REGISTER_H
#define EMULATOR_REGISTER_H
#include <cstdint>
template <typename T>
class Register {
public:
Register() {};
void set(const T new_value) { val = new_value; };
T value() const { return val; };
void increment() { val += 1; };
void decrement() { val -= 1; };
private:
... |
Add a wrapper lib for common functions | /*
* Copyright (c) 2013 Thomas Adam <thomas@xteddy.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND T... | |
Make the constructor for the Lesson 10 explicit | //
// Created by monty on 23/11/15.
//
#ifndef LESSON02_GLES2LESSON_H
#define LESSON02_GLES2LESSON_H
namespace odb {
class GLES2Lesson {
void fetchShaderLocations();
void setPerspective();
void prepareShaderProgram();
void clearBuffers();
void resetTransformMatrices()... | //
// Created by monty on 23/11/15.
//
#ifndef LESSON02_GLES2LESSON_H
#define LESSON02_GLES2LESSON_H
namespace odb {
class GLES2Lesson {
void fetchShaderLocations();
void setPerspective();
void prepareShaderProgram();
void clearBuffers();
void resetTransformMatrices()... |
Fix MSVC error C2133 : unknown size of multi-dimensional static const arrays (despite supposed support of C99). Have not confirmed if this breaks anything yet. |
/* encrypted keys */
static const uint32_t internal_device_number = 0;
static const uint8_t internal_dk_list[][21] = {
{
},
};
static const uint8_t internal_pk_list[][16] = {
{
},
};
static const uint8_t internal_hc_list[][112] = {
{
},
};
/* customize this function to "hide" the keys in the binary */... |
/* encrypted keys */
static const uint32_t internal_device_number = 0;
static const uint8_t internal_dk_list[][21] = {
{ 0 },
};
static const uint8_t internal_pk_list[][16] = {
{ 0 },
};
static const uint8_t internal_hc_list[][112] = {
{ 0 },
};
/* customize this function to "hide" the keys in the binary */... |
Remove dbg_trace from non-debug builds | #include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "const.h"
extern void logop(int32_t, int32_t);
extern void dbg_trace(void);
#define dbg_log(...) { if(DEBUG) { printf(__VA_ARGS__); } }
#define dbg_assert(condition) { if(DEBUG) { if(!(condition)) dbg_log(#condition); assert(con... | #include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "const.h"
extern void logop(int32_t, int32_t);
extern void dbg_trace(void);
#define dbg_log(...) { if(DEBUG) { printf(__VA_ARGS__); } }
#define dbg_trace(...) { if(DEBUG) { dbg_trace(__VA_ARGS__); } }
#define dbg_assert(conditio... |
Fix inline static local warning | // RUN: %check %s
// extern
extern inline int f()
{
static int i;
return i++;
}
// static
static inline int h()
{
static int i;
return i++;
}
// neither
inline int g()
{
static int i; // CHECK: warning: static variable in pure-inline function - may differ per file
return i++;
}
// neither, but const
inline in... | // RUN: %check %s
// extern
extern inline int f()
{
static int i;
return i++;
}
// static
static inline int h()
{
static int i;
return i++;
}
// neither
inline int g()
{
static int i; // CHECK: warning: mutable static variable in pure-inline function - may differ per file
return i++;
}
// neither, but const
i... |
Change from 3drobotics to diydrones for COMPANYNAME | #ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H
#include <QString>
/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9
/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "APM P... | #ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H
#include <QString>
/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9
/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "APM P... |
Fix typo in tab removal | #ifndef RADIOMULT_H
#define RADIOMULT_H
#include "NdbMF.h"
/* ========= NdbRadioMult ============ */
class NdbRad ioMult : public NdbMF
{
protected:
public:
NdbRadioMult()
: NdbMF(9, "Multiplicities for radioactive nuclide production") {}
~NdbRadioMult() {}
ClassDef(NdbRadioMult,1)
}; // NdbRadioMul... | #ifndef RADIOMULT_H
#define RADIOMULT_H
#include "NdbMF.h"
/* ========= NdbRadioMult ============ */
class NdbRadioMult : public NdbMF
{
protected:
public:
NdbRadioMult()
: NdbMF(9, "Multiplicities for radioactive nuclide production") {}
~NdbRadioMult() {}
ClassDef(NdbRadioMult,1)
}; // NdbRadioMult
... |
Add a missing atomic include | // Copyright (c) 2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_MODALOVERLAY_H
#define BITCOIN_QT_MODALOVERLAY_H
#include <QDateTime>
#include <QWidget>
//! The required del... | // Copyright (c) 2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_MODALOVERLAY_H
#define BITCOIN_QT_MODALOVERLAY_H
#include <QDateTime>
#include <QWidget>
#include <atomic>
//... |
Fix type for spilled arguments | #ifndef _INCLUDE_VM_INTERNAL_H
#define _INCLUDE_VM_INTERNAL_H
#include "vm.h"
#include "defs.h"
#include "heap.h"
typedef struct {
vm_value reg[num_regs];
int return_address;
int result_register;
//TODO type for this should be heap_address
int spilled_arguments; // Used for over-saturated calls.
} stack_f... | #ifndef _INCLUDE_VM_INTERNAL_H
#define _INCLUDE_VM_INTERNAL_H
#include "vm.h"
#include "defs.h"
#include "heap.h"
typedef struct {
vm_value reg[num_regs];
int return_address;
int result_register;
heap_address spilled_arguments; // Used for over-saturated calls.
} stack_frame ;
typedef struct {
stack_f... |
Add stub for windows socket implementation. | /*
*The MIT License (MIT)
*
* Copyright (c) <2017> <Stephan Gatzka>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, co... | |
Declare gVERSION global as 'extern'. | /*
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
* Copyright (c) 2014 Intel Corporation.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
const char* gVERSION;
const char* gVERSION_SHORT;
#ifdef __cplusplus
}
#endif
| /*
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
* Copyright (c) 2014 Intel Corporation.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
extern const char* gVERSION;
extern const char* gVERSION_SHORT;
#ifdef __cplusplus
}
#endif
|
Add slight tolerance for image differences to visual test macro. | #import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"
/**
* @function WMFSnapshotVerifyView
*
* Verify correct appearance of a given view.
*
* Search all folder suffixes, use default naming conventions.
*
* @param view The view to verify.
*/
#define WMFSnapshotVerifyVi... | #import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"
/**
* @function WMFSnapshotVerifyView
*
* Verify correct appearance of a given view.
*
* Search all folder suffixes, use default naming conventions.
*
* @param view The view to verify.
*/
#define WMFSnapshotVerifyVi... |
Add ecommerce protocol to ga | // GoogleAnalyticsIntegration.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#import "SEGAnalyticsIntegration.h"
@interface SEGGoogleAnalyticsIntegration : SEGAnalyticsIntegration
@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) BOOL valid;
@propert... | // GoogleAnalyticsIntegration.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#import "SEGAnalyticsIntegration.h"
#import "SEGEcommerce.h"
@interface SEGGoogleAnalyticsIntegration : SEGAnalyticsIntegration <SEGEcommerce>
@property(nonatomic, copy) NSString *name;
@property(... |
Add time_left and is_active to the proc struct | //
// process.h
// Project3
//
// Created by Stratton Aguilar on 7/3/14.
// Copyright (c) 2014 Stratton Aguilar. All rights reserved.
//
#ifndef Project3_process_h
#define Project3_process_h
typedef struct {
int processNum;
int arrivalTime;
int lifeTime;
int memReq;
} PROCESS;
#endif
| //
// process.h
// Project3
//
// Created by Stratton Aguilar on 7/3/14.
// Copyright (c) 2014 Stratton Aguilar. All rights reserved.
//
#ifndef Project3_process_h
#define Project3_process_h
typedef struct {
int processNum;
int arrivalTime;
int lifeTime;
int memReq;
int time_left;
int is_... |
Remove cost from empty ammoboxes till they can be recycled | ["Box_T_NATO_Wps_F",5,0,0],
["Box_T_NATO_WpsSpecial_F",5,0,0], | ["Box_T_NATO_Wps_F",0,0,0],
["Box_T_NATO_WpsSpecial_F",0,0,0], |
Fix signature of clock_init for posix | #include <time.h>
#include "clock.h"
#include "clock_type.h"
extern int clock_init(struct SPDR_Clock **clockp, struct SPDR_Allocator *allocator)
{
struct timespec res;
if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
/* unknown clock or insufficient resolution */... | #include <time.h>
#include "clock.h"
#include "clock_type.h"
extern int clock_init(struct SPDR_Clock **clockp,
struct SPDR_Allocator *allocator)
{
struct timespec res;
if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
/* unknown clock or insu... |
Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros | #ifndef STRACE_XLAT_H
struct xlat {
unsigned int val;
const char *str;
};
# define XLAT(val) { (unsigned)(val), #val }
# define XLAT_PAIR(val, str) { (unsigned)(val), str }
# define XLAT_END { 0, 0 }
#endif
| #ifndef STRACE_XLAT_H
struct xlat {
unsigned int val;
const char *str;
};
# define XLAT(val) { (unsigned)(val), #val }
# define XLAT_PAIR(val, str) { (unsigned)(val), str }
# define XLAT_TYPE(type, val) { (type)(val), #val }
# define XLAT_TYPE_PAIR(val, str) { (type)(val), str }
# define XLAT_END { ... |
Change default values to -1. | /*
* BDSup2Sub++ (C) 2012 Adam T.
* Based on code from BDSup2Sub by Copyright 2009 Volker Oth (0xdeadbeef)
* and Copyright 2012 Miklos Juhasz (mjuhasz)
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtai... | /*
* BDSup2Sub++ (C) 2012 Adam T.
* Based on code from BDSup2Sub by Copyright 2009 Volker Oth (0xdeadbeef)
* and Copyright 2012 Miklos Juhasz (mjuhasz)
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtai... |
Add the missing Token Space Guid | /** @file
GUID for IntelFrameworkModulePkg PCD Token Space
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the... | |
Fix build break from bad merge | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included file, hence no include guard.
// Inclusion of all message files present in the system. Keep this file
// up-to-date when adding ... | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included file, hence no include guard.
// Inclusion of all message files present in the system. Keep this file
// up-to-date when adding ... |
Set size to zero on reset. Else getting the size is incorrect, and later when checking in get() it would pass the check and you'd access a NULL ptr. | /*
* Copyright (C) 2013 Klaus Reimer (k@ailis.de)
* See COPYING file for copying conditions
*/
#include "DeviceList.h"
#include "Device.h"
void setDeviceList(JNIEnv* env, libusb_device** list, int size, jobject object)
{
SET_POINTER(env, list, object, "deviceListPointer");
jclass cls = (*env)->GetObjectCl... | /*
* Copyright (C) 2013 Klaus Reimer (k@ailis.de)
* See COPYING file for copying conditions
*/
#include "DeviceList.h"
#include "Device.h"
void setDeviceList(JNIEnv* env, libusb_device** list, int size, jobject object)
{
SET_POINTER(env, list, object, "deviceListPointer");
jclass cls = (*env)->GetObjectCl... |
Make the extern for adv_mcode match the reality: it's u_int8_t, but probably unendiansafely used as u_int16_t. | /*
* Exported interface to downloadable microcode for AdvanSys SCSI Adapters
*
* $FreeBSD$
*
* Obtained from:
*
* Copyright (c) 1995-1999 Advanced System Products, Inc.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that... | /*
* Exported interface to downloadable microcode for AdvanSys SCSI Adapters
*
* $FreeBSD$
*
* Obtained from:
*
* Copyright (c) 1995-1999 Advanced System Products, Inc.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that... |
Add regression test where TD3 aborting with self-dependency and fixed switch to Narrow is unsound | #include <pthread.h>
int myglobal;
void *t_fun(void *arg) {
myglobal=1; // RACE!
return NULL;
}
int main(void) {
pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);
myglobal = myglobal+1; // RACE!
return 0;
}
| |
Add missing close for file descriptor | /* Exercise 5-2 */
#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"
int main (int argc, char *argv[]) {
if (argc != 2) {
usageErr("%s filename", argv[0]);
}
int fd = open(argv[1], O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
if (fd == -1) { errExit("open"); }
char s[] = "abc... | /* Exercise 5-2 */
#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"
int main (int argc, char *argv[]) {
if (argc != 2) {
usageErr("%s filename", argv[0]);
}
int fd = open(argv[1], O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
if (fd == -1) { errExit("open"); }
char s[] = "abc... |
Use GModule instead of libdl to load unit test symbols | #include <config.h>
#include <dlfcn.h>
#include <test-fixtures/test-unit.h>
int
main (int argc, char **argv)
{
const CoglUnitTest *unit_test;
int i;
if (argc != 2)
{
g_printerr ("usage %s UNIT_TEST\n", argv[0]);
exit (1);
}
/* Just for convenience in case people try passing the wrapper
... | #include <config.h>
#include <gmodule.h>
#include <test-fixtures/test-unit.h>
int
main (int argc, char **argv)
{
GModule *main_module;
const CoglUnitTest *unit_test;
int i;
if (argc != 2)
{
g_printerr ("usage %s UNIT_TEST\n", argv[0]);
exit (1);
}
/* Just for convenience in case peopl... |
Add missing header pragma directive | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Disable warnings emitted by protoc generated files
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#include "feed.pb.h"
#include "visiting.pb.h"
#include "maintenance.pb.... | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
// Disable warnings emitted by protoc generated files
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#include "feed.pb.h"
#include "visiting.pb.h"
#include "m... |
Make ScopedOleInitializer work on windows if you aren't including build_config already. | // 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... | // 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"
... |
Support to read and extract information from /proc/<pid>/maps | /* gp-proc.c -- Information extracted from /proc
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 ... | |
Convert bricks to a std::vector | /*
The Breakout class holds all of the game logic. It is derived from the QWidget class to allow it to display in a Qt window.
It handles all input events, game updates, and painting events. It also handles the current game state.
*/
#ifndef BREAKOUT_H
#define BREAKOUT_H
#include "ball.h"
#include "brick.h"
#i... | /*
The Breakout class holds all of the game logic. It is derived from the QWidget class to allow it to display in a Qt window.
It handles all input events, game updates, and painting events. It also handles the current game state.
*/
#ifndef BREAKOUT_H
#define BREAKOUT_H
#include "ball.h"
#include "brick.h"
#i... |
Add macro for DLL exportation | /*!
* @brief Template C-header file
*
* This is a template C-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
#if defined(_MSC_VER)
# define <+FILE_CAPITAL+>_DLLEXPORT __declspec(dllexport)
#elif defined(__GNUC__... | /*!
* @brief Template C-header file
*
* This is a template C-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
#if defined(_MSC_VER)
# define <+FILE_CAPITAL+>_DLLEXPORT __declspec(dllexport)
#elif defined(__GNUC__... |
Adjust SimpleJoinCount constructor argument type. | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/eval/eval/tensor_function.h>
namespace vespalib::eval {
/**
* Tensor function that will count the number of cells in the result
* of a join between two tensors with full mapped ove... | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/eval/eval/tensor_function.h>
namespace vespalib::eval {
/**
* Tensor function that will count the number of cells in the result
* of a join between two tensors with full mapped ove... |
Add flag to stage api change am: f83df73740 | /*
* 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 ... | /*
* 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 ... |
Add setup code for initial centroids | //
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
... | //
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
enum cluster_id {
Adam,
Bob,
Charley,
David,
Edward,
km_num_cluster_ids_
};
void set_initial_cluster_centroids(km_pointlis... |
Multiply now member of class - link errors when included in multiple cpp files | /*
Copyright 2011 Michael Fortin
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 wri... | /*
Copyright 2011 Michael Fortin
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 wri... |
Add forgotted notification observer header. | // 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_COMMON_NOTIFICATION_OBSERVER_H_
#define CHROME_COMMON_NOTIFICATION_OBSERVER_H_
class NotificationDetails;
class NotificationSo... | |
Fix build on OS X. | #ifndef __TIME_MACH_H__
#define __TIME_MACH_H__
#include "config.h" // macros, bool, uint[XX]_t
#include <mach/clock.h> // clock_serv_t, mach_timespec_t, etc.
#include <mach/mach.h> // mach_port_deallocate
static inline uint64_t get_time(void)
{
static float adj_const = 0.0F;
// Cache the value (it doesn't change... | #ifndef __TIME_MACH_H__
#define __TIME_MACH_H__
#include "config.h" // macros, bool, uint[XX]_t
#include <mach/clock.h> // clock_serv_t, mach_timespec_t, etc.
#include <mach/mach.h> // mach_port_deallocate
#include <mach/mach_time.h>
static inline uint64_t get_time(void)
{
static float adj_const = 0.0F;
// Cache ... |
Fix crash due to uninitialised pointer when displaying a dialog | #pragma once
#include <nanogui/screen.h>
#include <nanogui/window.h>
#include <nanogui/theme.h>
class EditorGUI;
class Structure;
class DialogWindow : public nanogui::Window {
public:
DialogWindow(EditorGUI *screen, nanogui::Theme *theme);
nanogui::Window *getWindow() { return this; }
Structure *structure() { re... | #pragma once
#include <nanogui/screen.h>
#include <nanogui/window.h>
#include <nanogui/theme.h>
class EditorGUI;
class Structure;
class DialogWindow : public nanogui::Window {
public:
DialogWindow(EditorGUI *screen, nanogui::Theme *theme);
nanogui::Window *getWindow() { return this; }
Structure *structure() { re... |
Solve build error in presubmit | // Copyright (c) 2020 The Orbit 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 ORBIT_CAPTURE_GGP_CLIENT_ORBIT_CAPTURE_GGP_CLIENT_H_
#define ORBIT_CAPTURE_GGP_CLIENT_ORBIT_CAPTURE_GGP_CLIENT_H_
#include <string>
#include <ve... | // Copyright (c) 2020 The Orbit 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 ORBIT_CAPTURE_GGP_CLIENT_ORBIT_CAPTURE_GGP_CLIENT_H_
#define ORBIT_CAPTURE_GGP_CLIENT_ORBIT_CAPTURE_GGP_CLIENT_H_
#include <memory>
#include <st... |
Remove the static keyword from the _CLC_INLINE macro | #define _CLC_OVERLOAD __attribute__((overloadable))
#define _CLC_DECL
#define _CLC_DEF __attribute__((always_inline))
#define _CLC_INLINE __attribute__((always_inline)) static inline
| #define _CLC_OVERLOAD __attribute__((overloadable))
#define _CLC_DECL
#define _CLC_DEF __attribute__((always_inline))
#define _CLC_INLINE __attribute__((always_inline)) inline
|
Use the inline exponential function. | #include <pal.h>
/*
* sinh z = (exp z - exp(-z)) / 2
*/
static inline float _p_sinh(const float z)
{
float exp_z;
p_exp_f32(&z, &exp_z, 1);
return 0.5f * (exp_z - 1.f / exp_z);
}
/**
*
* Calculates the hyperbolic sine of the vector 'a'. Angles are specified
* in radians.
*
* @param a Pointer to... | #include <pal.h>
#include "p_exp.h"
/*
* sinh z = (exp z - exp(-z)) / 2
*/
static inline float _p_sinh(const float z)
{
float exp_z = _p_exp(z);
return 0.5f * (exp_z - 1.f / exp_z);
}
/**
*
* Calculates the hyperbolic sine of the vector 'a'. Angles are specified
* in radians.
*
* @param a Pointer ... |
Fix indentation by using tabs only | #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/ethernet.h>
#include <unistd.h>
#include <arpa/inet.h>
// The default size is enought to hold a whole ethernet frame (< 1524 bytes)
#ifndef PACKET_BUFFER_SIZE
#define PACKET_BUFFER_SIZE 2048
#endif
static void print_p... | #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/ethernet.h>
#include <unistd.h>
#include <arpa/inet.h>
// The default size is enought to hold a whole ethernet frame (< 1524 bytes)
#ifndef PACKET_BUFFER_SIZE
#define PACKET_BUFFER_SIZE 2048
#endif
static void print_p... |
Put all pin information in a single header. | #ifndef Pins_h
#define Pins_h
/*Motor pins*/
int PWMA = 9;
int AIN1 = 8;
int AIN2 = 7;
int PWMB = 10;
int BIN1 = 4;
int BIN2 = 5;
int STDBY = 6;
/*Encoder pins*/
int channelA = 3; //TX = 3
int channelB = 2; //RX = 2
/*Radio pins*/
int CE = A1; //pro micro
int CS = A0; //pro micro
//int CE = 3; //nano
//int CS = 2;... | |
Add modifying article link iterator typedef | #ifndef _ARTICLE_H
#define _ARTICLE_H
#include <string>
#include <vector>
/*!
* represents a Wikipedia (Mediawiki) and its links
*/
class Article
{
public:
typedef std::vector<Article*> ArticleLinkStorage;
typedef std::vector<Article*>::const_iterator ArticleLinkIterator;
/*! Create a n... | #ifndef _ARTICLE_H
#define _ARTICLE_H
#include <string>
#include <vector>
/*!
* represents a Wikipedia (Mediawiki) and its links
*/
class Article
{
public:
//! representation of links to other articles
typedef std::vector<Article*> ArticleLinkStorage;
//! representation of iterator over ... |
Add a newline to the end of our log messages | #include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
void rsp_log(char* format, ...)
{
char without_ms[64];
char with_ms[64];
struct timeval tv;
struct tm *tm;
gettimeofday(&tv, NULL);
if ((tm = localtime(&tv... | #include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
void rsp_log(char* format, ...)
{
char without_ms[64];
char with_ms[64];
struct timeval tv;
struct tm *tm;
gettimeofday(&tv, NULL);
if ((tm = localtime(&tv... |
Remove the need for a header and specify a triple so that the type sizes make sense. | // RUN: %clang -S -emit-llvm %s -o /dev/null
// XFAIL: mingw,win32
#include <setjmp.h>
sigjmp_buf B;
int foo() {
sigsetjmp(B, 1);
bar();
}
| // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o /dev/null
#define _JBLEN ((9 * 2) + 3 + 16)
typedef int sigjmp_buf[_JBLEN + 1];
int sigsetjmp(sigjmp_buf env, int savemask);
sigjmp_buf B;
int foo() {
sigsetjmp(B, 1);
bar();
}
|
Add example of suppressing clang -Wcast-align | #include <stdio.h>
#include <stdlib.h>
struct dummy {
double d;
};
int main(int argc, char *argv[]) {
struct dummy *d;
char *p;
(void) argc; (void) argv;
/* This causes a warning with clang -Wcast-align:
*
* clang_cast_align.c:13:6: warning: cast from 'char *' to 'struct dummy *' increases required alignme... | |
Read file passed as argv[1] | int main()
{
return 0;
}
| #include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
const char usage[] = "Usage: %s <filenname>\n";
#define READ_SIZE 2048
int main(int argc, char *argv[])
{
if (argc != 2) {
printf(usage, argv[0]);
return 1;
}
//FILE *file = fopen(argv[1], "r");
int fd = open(argv[1], O_RDONLY);
char buf[READ_SIZE];... |
Declare panic function as noreturn | #ifndef KERN_DIAG
#define KERN_DIAG
#include <stdarg.h>
void panic(const char* diagnostic_message, ...);
void shutdown() __attribute__((noreturn));
extern void hang_machine() __attribute__((noreturn));
#ifdef DEBUG
#define assert(x) if (!(x)) panic("Assertion failed: " __FILE__ ":%u: " #x, __LINE__)
#else
#define a... | #ifndef KERN_DIAG
#define KERN_DIAG
#include <stdarg.h>
void panic(const char* diagnostic_message, ...) __attribute__((noreturn));
void shutdown() __attribute__((noreturn));
extern void hang_machine() __attribute__((noreturn));
#ifdef DEBUG
#define assert(x) if (!(x)) panic("Assertion failed: " __FILE__ ":%u: " #x,... |
Fix "Out of memory? mmap failed" for files larger than 4GB on Windows | #include "../git-compat-util.h"
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
HANDLE hmap;
void *temp;
size_t len;
struct stat st;
uint64_t o = offset;
uint32_t l = o & 0xFFFFFFFF;
uint32_t h = (o >> 32) & 0xFFFFFFFF;
if (!fstat(fd, &st))
len = xsize_t(st.st_size);
... | #include "../git-compat-util.h"
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
HANDLE hmap;
void *temp;
off_t len;
struct stat st;
uint64_t o = offset;
uint32_t l = o & 0xFFFFFFFF;
uint32_t h = (o >> 32) & 0xFFFFFFFF;
if (!fstat(fd, &st))
len = st.st_size;
else
di... |
Check that the first and third characters, s and u, are accessed with an alignment of 2 not 1. | // RUN: %llvmgcc -S %s -o - | grep "align 2" | count 6
struct A { char s, t, u, v; short a; };
void q() { struct A a, b; a = b; }
| |
Remove unused header, switch header to fwd decl | /****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC ... | /****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC ... |
Add dedicated macros to indicate hot and cold execution paths. | /*
* 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)
*/
#ifndef _UTILS_ASSUME_H
#define _UTILS_ASSUME_H
#include <utils/builtin.h>
/* This... | /*
* 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)
*/
#ifndef _UTILS_ASSUME_H
#define _UTILS_ASSUME_H
#include <utils/attribute.h>
#inclu... |
Allow LIBCXXABI_SINGLE_THREADED to be defined by build scripts | //===----------------------------- config.h -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//
// Defines macros used within the libc++a... | //===----------------------------- config.h -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//
// Defines macros used within the libc++a... |
Fix naming concern from previous commit. Buddy: Sam | // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
#pragma once
#include "IInteriorStreamingDialogView.h"
#include "InteriorsExplorerViewIncludes.h"
#include "AndroidNativeState.h"
namespace ExampleApp
{
namespace InteriorsExplorer
{
namespace View
{
class InteriorStreamingDi... | // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
#pragma once
#include "IInteriorStreamingDialogView.h"
#include "InteriorsExplorerViewIncludes.h"
#include "AndroidNativeState.h"
namespace ExampleApp
{
namespace InteriorsExplorer
{
namespace View
{
class InteriorStreamingDi... |
Support variant 'normal' and don't expect xboard to send colors | #ifndef _CECP_FEATURES_H
#define _CECP_FEATURES_H
#include <stdio.h>
/* Features of the Chess Engine Communication Protocol supported by this program */
const char *cecp_features[] =
{
"done=0",
"usermove=1",
"time=0",
"draw=0",
"sigint=0",
"analyze=0",
"variants=\"\"",
"name=0",
"... | #ifndef _CECP_FEATURES_H
#define _CECP_FEATURES_H
#include <stdio.h>
/* Features of the Chess Engine Communication Protocol supported by this program */
const char *cecp_features[] =
{
"done=0",
"usermove=1",
"time=0",
"draw=0",
"sigint=0",
"analyze=0",
"variants=\"normal\"",
"colors=0... |
Add missing definition for TESS_API | ///////////////////////////////////////////////////////////////////////
// File: platform.h
// Description: Place holder
//
// (C) Copyright 2006, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a... | ///////////////////////////////////////////////////////////////////////
// File: platform.h
// Description: Place holder
//
// (C) Copyright 2006, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a... |
Revert "[Hexagon] Test passes for hexagon target now that the backend correctly generates relocations." | // RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/body1.c
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/body2.c
// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s
// expected-no-diagnostics
| // XFAIL: hexagon
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/body1.c
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/body2.c
// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s
// expected-no-diagnostics
|
Change the way _EXPORT macros look, app_list edition | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_APP_LIST_APP_LIST_EXPORT_H_
#define UI_APP_LIST_APP_LIST_EXPORT_H_
#pragma once
// Defines APP_LIST_EXPORT so that functionality implement... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_APP_LIST_APP_LIST_EXPORT_H_
#define UI_APP_LIST_APP_LIST_EXPORT_H_
#pragma once
// Defines APP_LIST_EXPORT so that functionality implement... |
Add missing extern "C" declaration to header | #ifndef MYPAINTTESTSURFACE_H
#define MYPAINTTESTSURFACE_H
#include <mypaint-surface.h>
typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);
int
mypaint_test_surface_run(int argc, char **argv,
MyPaintTestsSurfaceFactory surface_factory,
gchar *title, ... | #ifndef MYPAINTTESTSURFACE_H
#define MYPAINTTESTSURFACE_H
#include <mypaint-surface.h>
#include <mypaint-glib-compat.h>
G_BEGIN_DECLS
typedef MyPaintSurface * (*MyPaintTestsSurfaceFactory)(gpointer user_data);
int
mypaint_test_surface_run(int argc, char **argv,
MyPaintTestsSurfaceFactory surfa... |
Fix argument order in mp_exch | #include <tommath.h>
#ifdef BN_MP_EXCH_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberge... | #include <tommath.h>
#ifdef BN_MP_EXCH_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberge... |
Change dump buttons and add hold button | void dc_dump() {
if (vexRT[Btn7U])
dump_set(-127);
else if (vexRT[Btn7D])
dump_set(127);
else
dump_set(0);
}
| void dc_dump() {
if (vexRT[Btn6U])
dump_set(-127);
else if (vexRT[Btn6D])
dump_set(127);
else if (vexRT[Btn5U])
dump_set(-15);
else
dump_set(0);
}
|
Put a lock around kalloc* | #include <stddef.h>
#include <kernel/port/heap.h>
#include <kernel/port/units.h>
#include <kernel/port/stdio.h>
#include <kernel/port/panic.h>
/* round_up returns `n` rounded to the next value that is zero
* modulo `align`. */
static uintptr_t round_up(uintptr_t n, uintptr_t align) {
if (n % align) {
return n + (a... | #include <stddef.h>
#include <kernel/port/heap.h>
#include <kernel/port/units.h>
#include <kernel/port/stdio.h>
#include <kernel/port/panic.h>
#include <kernel/arch/lock.h>
static mutex_t heap_lock;
/* round_up returns `n` rounded to the next value that is zero
* modulo `align`. */
static uintptr_t round_up(uintptr_... |
Fix header defines based on ARC version | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8))
#define PT_DISPATCH_RETAIN_RELEASE 1
#endif
#if !defined(PT_DISPAT... | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8))
#define PT_DISPATCH_RETAIN_RELEASE 1
#endif
#if (!defined(PT_DISPA... |
Add bitmap test case which reveals a bug | /**
* @file
*
* @date Oct 21, 2013
* @author Eldar Abusalimov
*/
#include <embox/test.h>
#include <util/bitmap.h>
EMBOX_TEST_SUITE("util/bitmap test");
#define TEST_BITMAP_SZ 100
TEST_CASE() {
BITMAP_DECL(bitmap, TEST_BITMAP_SZ);
bitmap_clear_all(bitmap, TEST_BITMAP_SZ);
test_assert_equal(bitmap_find_firs... | /**
* @file
*
* @date Oct 21, 2013
* @author Eldar Abusalimov
*/
#include <embox/test.h>
#include <string.h>
#include <util/bitmap.h>
EMBOX_TEST_SUITE("util/bitmap test");
#define TEST_ALINGED_SZ 64
#define TEST_UNALINGED_SZ 100
TEST_CASE("aligned size with red zone after an array") {
BITMAP_DECL(bitmap,... |
Make this test not rely on a backend being registered. | // REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -S -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -fno-lax-vector-conversions -S -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-... | // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -emit-llvm -fno-lax-vector-conversions -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffre... |
Add throw() declaration to avoid dead code coverage | #ifndef BigFix_Error_h
#define BigFix_Error_h
#include <exception>
#include <stddef.h>
namespace BigFix
{
class Error : public std::exception
{
public:
template <size_t n>
explicit Error( const char ( &literal )[n] )
: m_what( literal )
{
}
virtual const char* what() const throw();
private:
const c... | #ifndef BigFix_Error_h
#define BigFix_Error_h
#include <exception>
#include <stddef.h>
namespace BigFix
{
class Error : public std::exception
{
public:
template <size_t n>
explicit Error( const char ( &literal )[n] ) throw()
: m_what( literal )
{
}
virtual const char* what() const throw();
private:
... |
Add RadioHead nRF24 node 'driver' skeleton | /*
* This file is part of the KNOT Project
*
* Copyright (c) 2015, CESAR. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright... | |
Add random array and struct test code for SCA. | // RUN: clang -checker-simple -verify %s
struct s {};
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;
q = &d;
}
| // RUN: clang -checker-simple -verify %s
struct s {
int data;
int data_array[10];
};
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;
q = &d;
q->data = 3;
d.data_array[9] = 17;
}
|
Add member variable for brightness controller | // Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
#include "OSD.h"
class BrightnessOSD : public OSD {
public:
BrightnessOSD();
virtual void Hide();
virtual void ProcessHotkeys(HotkeyInfo &hki);
private:
MeterWnd _mWnd;
... | // Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
#include "OSD.h"
class BrightnessOSD : public OSD {
public:
BrightnessOSD();
virtual void Hide();
virtual void ProcessHotkeys(HotkeyInfo &hki);
private:
MeterWnd _mWnd;
... |
Add vector add/sub/mul/div by scalar tests (PR27085) | // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// PR27085
typedef unsigned char uchar4 __attribute__ ((vector_size (4)));
// CHECK: @add2
// CHECK: add <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2>
uchar4 add2(uchar4 v)
{
return v + 2;
}
// CHECK: @sub2
// CHECK: sub <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2>
u... | |
Add missing @protocol forward declaration | //
// GITRepo+Protected.h
// CocoaGit
//
// Created by Geoffrey Garside on 05/08/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
@interface GITRepo ()
- (NSString*)objectPathFromHash:(NSString*)hash;
- (NSData*)dataWithContentsOfHash:(NSString*)hash;
- (void)extractFromData:(NSData*)data
... | //
// GITRepo+Protected.h
// CocoaGit
//
// Created by Geoffrey Garside on 05/08/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
@protocol GITObject;
@interface GITRepo ()
- (NSString*)objectPathFromHash:(NSString*)hash;
- (NSData*)dataWithContentsOfHash:(NSString*)hash;
- (void)extractFromData:(N... |
Improve and document CSV::Writer interface | #ifndef _CSVWRITER_H_
#define _CSVWRITER_H_
#include <string>
#include <istream>
#include <stdexcept>
namespace CSV {
class Writer {
public:
static const char CSV_SEP = '|';
Writer(std::ostream& output);
Writer operator<< (const std::string& data);
Writer... | #ifndef _CSVWRITER_H_
#define _CSVWRITER_H_
#include <string>
#include <istream>
#include <stdexcept>
namespace CSV {
class Writer {
public:
static const char CSV_SEP = ',';
/**
* Construct a CSV::Writer that uses ',' as value separator.
*/
Wr... |
Add TODO to replace downloadTimeoutSeconds property with session config timeout. | /*
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | /*
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
Add own versions of _countof and ZeroMemory | #pragma once
#ifdef _MSC_VER
#define SL_CALL __vectorcall
#else
#define SL_CALL
#endif
| #pragma once
#include <string>
#if 0
int Stricmp(const char* str1, const char* str2) {
int d;
while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) {
str1++;
str2++;
}
return d;
}
int Strnicmp(const char* str1, const char* str2, int count) {
int d = 0;
while (count > 0 && (d = toupper(*str2) - toupper... |
Check static locals aren't duplicated when inlined | // RUN: %ocheck 0 %s
// RUN: %check %s
__attribute((always_inline))
inline void *f(unsigned size)
{
static char malloc_buf[16]; // CHECK: warning: mutable static variable in pure-inline function - may differ per file
static void *ptr = malloc_buf; // CHECK: warning: mutable static variable in pure-inline function - ... | |
ADD definition again to start without menu | #ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#include "GameState.h"
#include "StartState.h"
#include "LevelSelectState.h"
#include <vector>
//#define START_WITHOUT_MENU
class GameStateHandler
{
private:
std::vector<GameState*> m_stateStack;
std::vector<Ga... | #ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#include "GameState.h"
#include "StartState.h"
#include "LevelSelectState.h"
#include <vector>
#define START_WITHOUT_MENU
class GameStateHandler
{
private:
std::vector<GameState*> m_stateStack;
std::vector<Game... |
Add useful Altivec types, taken from with permission from x264 authors | /*
* Copyright (c) 2006 Guillaume Poirier <gpoirier@mplayerhq.hu>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License,... | |
Add bell curve random number generator | /*
* 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 Foundati... | /*
* 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 Foundati... |
Add definitions for the GPIO memory port configurations | /* linux/arch/arm/plat-s3c64xx/include/mach/regs-gpio-memport.h
*
* Copyright 2008 Openmoko, Inc.
* Copyright 2008 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
* http://armlinux.simtec.co.uk/
*
* S3C64XX - GPIO memory port register definitions
*/
#ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_MEMPORT_H
#d... | |
Update files, Alura, Introdução a C - Parte 2, Aula 2.4 | #include <stdio.h>
int main() {
char palavrasecreta[20];
sprintf(palavrasecreta, "MELANCIA");
int acertou = 0;
int enforcou = 0;
do {
// comecar o nosso jogo!!
} while(!acertou && !enforcou);
}
| #include <stdio.h>
#include <string.h>
int main() {
char palavrasecreta[20];
sprintf(palavrasecreta, "MELANCIA");
int acertou = 0;
int enforcou = 0;
do {
char chute;
scanf("%c", &chute);
for(int i = 0; i < strlen(palavrasecreta); i++) {
if(palavrasecreta[i] == chute) {
printf("A... |
Fix warning: implicit declaration of function memset | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include "daemon.h"
void daemon_exit_handler(int sig)
{
//Here we release resources
#ifdef DAEMON_PID_FILE_NAME
unlink(DAEMON_PID_FILE_NAME);
#endif
_exit(EXIT_FAILURE);
}
void init_signals(voi... | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include "daemon.h"
void daemon_exit_handler(int sig)
{
//Here we release resources
#ifdef DAEMON_PID_FILE_NAME
unlink(DAEMON_PID_FILE_NAME);
#endif
_exit(EXIT_FAILURE);
}
v... |
Add a test file for matrix functions | #include <stdio.h>
#include <stdlib.h>
#include "matrix.h"
int main() {
matrix *a = new_matrix(3, 4);
int i; for (i = 0; i < a->rows; i++) {
int j; for (j = 0; j < a->cols; j++) {
a->contents[i][j] = i * a->cols + j;
}
}
print_matrix(a);
printf("\n\n");
matrix *b =... | |
Use explicit constructor for File to resolve template deductions | #ifndef CPR_MULTIPART_H
#define CPR_MULTIPART_H
#include <initializer_list>
#include <string>
#include <vector>
#include "defines.h"
namespace cpr {
struct File {
template <typename StringType>
File(StringType&& filepath) : filepath{CPR_FWD(filepath)} {}
std::string filepath;
};
struct Part {
Part(... | #ifndef CPR_MULTIPART_H
#define CPR_MULTIPART_H
#include <initializer_list>
#include <string>
#include <vector>
#include "defines.h"
namespace cpr {
struct File {
template <typename StringType>
explicit File(StringType&& filepath) : filepath{CPR_FWD(filepath)} {}
std::string filepath;
};
struct Part {
... |
Fix case of an include to support crossplatform compilation. | #include "telit_HE910.h"
namespace openxc {
namespace server_task {
void openxc::server_task::firmwareCheck(TelitDevice* device);
void openxc::server_task::flushDataBuffer(TelitDevice* device);
void openxc::server_task::commandCheck(TelitDevice* device);
}
} | #include "telit_he910.h"
namespace openxc {
namespace server_task {
void openxc::server_task::firmwareCheck(TelitDevice* device);
void openxc::server_task::flushDataBuffer(TelitDevice* device);
void openxc::server_task::commandCheck(TelitDevice* device);
}
}
|
Align free agents (team index 255) with the rest | #include <stdio.h>
#include "player_key.h"
bool_t key_is_goalie(player_key_t *key)
{
return key->position == 'G';
}
void show_key_player(player_key_t *key, size_t ofs_key)
{
size_t i;
printf("T: %2u NO: %2u POS: %c NAME: %-15s %-15s",
key->team, key->jersey, key->position, key->first, key->last);
p... | #include <stdio.h>
#include "player_key.h"
bool_t key_is_goalie(player_key_t *key)
{
return key->position == 'G';
}
void show_key_player(player_key_t *key, size_t ofs_key)
{
size_t i;
printf("T: %3u NO: %2u POS: %c NAME: %-15s %-15s",
key->team, key->jersey, key->position, key->first, key->last);
p... |
Fix bug in timer comparison | /*
Copyright (C) 2015 George White <stonehippo@gmail.com>, All rights reserved.
See https://raw.githubusercontent.com/stonehippo/sploder/master/LICENSE.txt for license details.
*/
// ******************* Timing helpers *******************
void startTimer(long &timer) {
timer = millis();
}
boolean isTimerExpired(... | /*
Copyright (C) 2015 George White <stonehippo@gmail.com>, All rights reserved.
See https://raw.githubusercontent.com/stonehippo/sploder/master/LICENSE.txt for license details.
*/
// ******************* Timing helpers *******************
void startTimer(long &timer) {
timer = millis();
}
boolean isTimerExpired(... |
Switch version numbers to 0.8.1.99 | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
// Set to ... | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 99
// Set to... |
Add missing definition for include guard | #ifndef CCSPEC_H_
#include "ccspec/expectation_target.h"
#include "ccspec/matcher.h"
#include "ccspec/matchers.h"
#endif // CCSPEC_H_
| #ifndef CCSPEC_H_
#define CCSPEC_H_
#include "ccspec/expectation_target.h"
#include "ccspec/matcher.h"
#include "ccspec/matchers.h"
#endif // CCSPEC_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.