Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Make these a bit more correct | //
// Copyright 2013 Jeff Bush
//
// 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 t... | //
// Copyright 2013 Jeff Bush
//
// 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 t... |
Add a codec for Tileset | #pragma once
#include <spotify/json.hpp>
#include "Tileset.h"
using namespace spotify::json::codec;
namespace spotify
{
namespace json
{
template<>
struct default_codec_t<Tileset>
{
static object_t<Tileset> codec()
{
auto codec = object<Tileset>();
codec.required("resolution", &Tileset::res... | |
Define data types for structured command handling | #ifndef LACO_COMMANDS_H
#define LACO_COMMANDS_H
struct LacoState;
/**
* Gets passed ever line to see if it matches one of the REPL command. If it
* does, that command will be executed.
*/
void laco_handle_command(struct LacoState* laco, char* line);
#endif /* LACO_COMMANDS_H */
| #ifndef LACO_COMMANDS_H
#define LACO_COMMANDS_H
struct LacoState;
typedef void (*LacoHandler)(struct LacoState* laco, const char** arguments);
struct LacoCommand {
const char** matches;
LacoHandler handler;
};
/**
* Gets passed ever line to see if it matches one of the REPL command. If it
* does, that command... |
Verify array of colors is contigous | /*
* Copyright (C) 2015 Luke San Antonio
* All rights reserved.
*/
#pragma once
#include "glad/glad.h"
#include "../texture.h"
namespace game { namespace gfx { namespace gl
{
struct GL_Texture : public Texture
{
void allocate_(Vec<int> const&, Image_Format) noexcept override;
inline void blit_data_(Volu... | /*
* Copyright (C) 2015 Luke San Antonio
* All rights reserved.
*/
#pragma once
#include "glad/glad.h"
#include "../texture.h"
namespace game { namespace gfx { namespace gl
{
struct GL_Texture : public Texture
{
void allocate_(Vec<int> const&, Image_Format) noexcept override;
inline void blit_data_(Volu... |
Adjust declaration for taskstats io call | #ifndef DISK_H
#define DISK_H
#include "../process/process.h"
#ifdef __i386__
#define IOPRIO_GET 290
#elif __x86_64__
#define IOPRIO_GET 252
#endif
#define IOPRIO_WHO_PROCESS 1
#define IOPRIO_CLASS_SHIFT (13)
#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
#define PRIOLEN 8
char *filesystem_type(void)... | #ifndef DISK_H
#define DISK_H
#include <stdint.h>
#include "../process/process.h"
#ifdef __i386__
#define IOPRIO_GET 290
#elif __x86_64__
#define IOPRIO_GET 252
#endif
#define IOPRIO_WHO_PROCESS 1
#define IOPRIO_CLASS_SHIFT (13)
#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
#define PRIOLEN 8
char *f... |
Remove deprecated function and use class to define a Point | #pragma once
struct Point{
double x,y;
Point();
/*
first double input param: x coordinate.
second double input param: y coordinate.
*/
Point(double,double);
bool operator<(Point)const;
bool operator==(Point)const;
};
double dist(Point a,Point b); | #pragma once
class Point{
public:
double x,y;
Point();
/*
first double input param: x coordinate.
second double input param: y coordinate.
*/
Point(double,double);
bool operator<(Point)const;
bool operator==(Point)const;
};
|
Change another float to double. | #include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
int id;
bionet_node_t *node;
bionet_value_get_float(value, &data);
if(data < 0 || data > 255)
return;
node = bionet_reso... | #include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
int id;
bionet_node_t *node;
bionet_value_get_double(value, &data);
if(data < 0 || data > 255)
return;
node = bionet_res... |
Use the new assert() macro | #include <assert.h>
#include "fnv_1a.h"
uint128_t fnv_1a(const void * restrict const buf,
const size_t len,
const size_t skip_pos,
const size_t skip_len)
{
assert((skip_pos <= len) && (skip_pos + skip_len <= len));
... | #include "fnv_1a.h"
#include "debug.h"
uint128_t fnv_1a(const void * restrict const buf,
const size_t len,
const size_t skip_pos,
const size_t skip_len)
{
assert((skip_pos <= len) && (skip_pos + skip_len <= len),
... |
Update outdated comments in the XML parser header | //
// RKXMLParser.h
//
// Created by Jeremy Ellison on 2011-02-28.
// Copyright 2011 RestKit
//
// 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/license... | //
// RKXMLParser.h
//
// Created by Jeremy Ellison on 2011-02-28.
// Copyright 2011 RestKit
//
// 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/license... |
Update Skia milestone to 59 | /*
* 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 58
#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 59
#endif
|
Restructure implementation and documentation of DATA/libbad_data_t | /**
* @file include/libbad_base.h
* @author Bryce Davis
* @date 19 November 2015
* @brief Header file for internal libbad declarations
* @copyright Copyright (c) 2015, Bryce Davis. Released under the MIT License.
* See LICENSE.txt for details.
*/
#ifndef _LIBBAD_BASE_H
#define _LIBBAD... | /**
* @file include/libbad_base.h
* @author Bryce Davis
* @date 19 November 2015
* @brief Header file for internal libbad declarations
* @copyright Copyright (c) 2015, Bryce Davis. Released under the MIT License.
* See LICENSE.txt for details.
*/
#ifndef _LIBBAD_BASE_H
#define _LIBBAD... |
Make an abstract DataValue class, and implement Double and IntegerValues | #include <vector>
#include <map>
#include <string>
using namespace std;
#ifndef OBJECTS_H
#define OBJECTS_H
union DataValue {
string val_s;
long int val_i;
float val_f;
double val_d;
};
typedef map<string, DataValue> DataMap;
typedef map<string, DataValue>::iterator DataIterator;
class DataInstance {... | #ifndef OBJECTS_H
#define OBJECTS_H
#include <vector>
#include <map>
#include <string>
using namespace std;
class IntDataValue : public DataValue
{
private:
public:
IntDataValue(int val): value(val);
void compareWith(DataValue &I) {
if(I.value < this->value) return -1;
else if(I.value == this->valu... |
Replace all user modules with token | // email=foo@bar.com
// branch=master
#ifndef __USER_MODULES_H__
#define __USER_MODULES_H__
#define LUA_USE_BUILTIN_STRING // for string.xxx()
#define LUA_USE_BUILTIN_TABLE // for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work
// #... | // email=foo@bar.com
// branch=master
#ifndef __USER_MODULES_H__
#define __USER_MODULES_H__
#define LUA_USE_BUILTIN_STRING // for string.xxx()
#define LUA_USE_BUILTIN_TABLE // for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work
// #... |
Add a test forgotten in r339088. | // RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_ana... | |
Make sh4 build works again adding a temporary work-around iby redefining __always_inline to inline until gcc 4.x.x will get fixed. | /* We can't use the real errno in ldso, since it has not yet
* been dynamicly linked in yet. */
#include "sys/syscall.h"
extern int _dl_errno;
#undef __set_errno
#define __set_errno(X) {(_dl_errno) = (X);}
| /* We can't use the real errno in ldso, since it has not yet
* been dynamicly linked in yet. */
#include "sys/syscall.h"
extern int _dl_errno;
#undef __set_errno
#define __set_errno(X) {(_dl_errno) = (X);}
#warning !!! __always_inline redefined waiting for the fixed gcc
#ifdef __always_inline
#undef __always_inline
#d... |
Make a few things `inline`. | #pragma once
#include "../../includes.h"
namespace MOSS { namespace Interrupts {
void disable_hw_int(void) {
__asm__ __volatile__("cli");
}
void enable_hw_int(void) {
__asm__ __volatile__("sti");
}
/*void fire(int n) {
//Adapted from http://www.brokenthorn.com/Resources/OSDev15.html
//Self-mo... | #pragma once
#include "../../includes.h"
namespace MOSS { namespace Interrupts {
inline void disable_hw_int(void) {
__asm__ __volatile__("cli");
}
inline void enable_hw_int(void) {
__asm__ __volatile__("sti");
}
/*inline void fire(int n) {
//Adapted from http://www.brokenthorn.com/Resources/OSD... |
Add mode_t typedef when missing | /*!
* Filename: zt_path.h
* Description: path utils
*
* Author: Jason L. Shiffer <jshiffer@zerotao.org>
* Copyright:
* Copyright (C) 2010-2011, Jason L. Shiffer.
* See file COPYING for details
*/
#ifndef _ZT_PATH_
#define _ZT_PATH_
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif /* HAVE_SYS_STA... | /*!
* Filename: zt_path.h
* Description: path utils
*
* Author: Jason L. Shiffer <jshiffer@zerotao.org>
* Copyright:
* Copyright (C) 2010-2011, Jason L. Shiffer.
* See file COPYING for details
*/
#ifndef _ZT_PATH_
#define _ZT_PATH_
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
# else
typedef unsig... |
Add some minor cleanups to the lease code. | #include "system.h"
#include "sccs.h"
#include "logging.h"
extern int test_release;
extern unsigned build_timet;
int
version_main(int ac, char **av)
{
char buf[100];
float exp;
if (ac == 2 && streq("--help", av[1])) {
system("bk help version");
return (0);
}
if (sccs_cd2root(0, 0) == -1) {
getMsg("versio... | #include "system.h"
#include "sccs.h"
#include "logging.h"
extern int test_release;
extern unsigned build_timet;
int
version_main(int ac, char **av)
{
char buf[100];
float exp;
if (ac == 2 && streq("--help", av[1])) {
system("bk help version");
return (0);
}
lease_check(0); /* disable lease check */
if (sc... |
Add `sys/types.h` include for `pid_t`. | #ifndef THEFT_CALL_INTERNAL_H
#define THEFT_CALL_INTERNAL_H
#include "theft_call.h"
#include "theft_bloom.h"
#include <assert.h>
#include <unistd.h>
#include <sys/wait.h>
#include <poll.h>
#include <signal.h>
#include <errno.h>
static enum theft_trial_res
theft_call_inner(struct theft_run_info *run_info, void **args... | #ifndef THEFT_CALL_INTERNAL_H
#define THEFT_CALL_INTERNAL_H
#include "theft_call.h"
#include "theft_bloom.h"
#include <assert.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <poll.h>
#include <signal.h>
#include <errno.h>
static enum theft_trial_res
theft_call_inner(struct theft_run_info... |
Add stub for windows file authentication 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... | |
Add macro to identify apple mac os x as unix | #ifndef NWG_COMMON_SOCKET_INCLUDE_H_
#define NWG_COMMON_SOCKET_INCLUDE_H_
#ifdef __unix__
#include <netinet/in.h>
#include <sys/socket.h>
#endif /* __unix__ */
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typedef int socklen_t;
#undef FD_SETSIZE
#define FD_SETSIZE 2048
#endif /* _WIN32 */
#include <fcnt... | #ifndef NWG_COMMON_SOCKET_INCLUDE_H_
#define NWG_COMMON_SOCKET_INCLUDE_H_
#if !defined(__unix__) && (defined(__APPLE__) && defined(__MACH__))
#define __unix__ 1
#endif
#ifdef __unix__
#include <netinet/in.h>
#include <sys/socket.h>
#endif /* __unix__ */
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typede... |
Change -ffp-contract=fast test to run on Aarch64 | // RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=powerpc-apple-darwin10 -S -o - %s | FileCheck %s
// REQUIRES: powerpc-registered-target
float fma_test1(float a, float b, float c) {
// CHECK: fmadds
float x = a * b;
float y = x + c;
return y;
}
| // RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - %s | FileCheck %s
// REQUIRES: aarch64-registered-target
float fma_test1(float a, float b, float c) {
// CHECK: fmadd
float x = a * b;
float y = x + c;
return y;
}
|
Fix duplicate React library import error conflict w/certain pods | //
// OAuthManager.h
//
// Created by Ari Lerner on 5/31/16.
// Copyright © 2016 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif
#if __has_include("RCTLinkingManager.h")
... | //
// OAuthManager.h
//
// Created by Ari Lerner on 5/31/16.
// Copyright © 2016 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif
#if __has_include(<React/RCTLinkingManage... |
Add Task 02 for Homework 02 | #include <stdio.h>
#include <string.h>
#define MAX_LENGTH 400
char* find(char*, char);
int main() {
char input[MAX_LENGTH], symbol, *found;
fgets(input, MAX_LENGTH + 1, stdin);
scanf("%c", &symbol);
found = find(input, symbol);
printf("%d", (int)(found ? found - input : -1));
... | |
Fix circular reference but in uart_init() | #include <mikoto/char_driver.h>
#include <mikoto/uart.h>
static int uart_write(const char *s);
static struct char_driver_operations uart_ops = {
.write = uart_write,
};
static struct char_driver uart_driver = {
.name = "UART",
};
void uart_init(void)
{
struct char_driver *uart = get_uart_driver_instance();
uart... | #include <mikoto/char_driver.h>
#include <mikoto/uart.h>
static int uart_write(const char *s);
static struct char_driver_operations uart_ops = {
.write = uart_write,
};
static struct char_driver uart_driver = {
.name = "UART",
};
static void
uart_init(void)
{
uart_driver.ops = &uart_ops;
}
struct char_driver *... |
Add default config for USB OTG HS peripheral | /*
* Copyright (C) 2019 Koen Zandberg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_stm32
* @{
*
* @file
* @brief Common configuration for STM... | |
Update to the API change of a while ago. | #ifdef NO_PORT
#include "mono/interpreter/interp.h"
MonoPIFunc
mono_create_trampoline (MonoMethod *method)
{
g_error ("Unsupported arch");
return NULL;
}
void *
mono_create_method_pointer (MonoMethod *method)
{
g_error ("Unsupported arch");
return NULL;
}
#endif
| #ifdef NO_PORT
#include "mono/interpreter/interp.h"
MonoPIFunc
mono_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
{
g_error ("Unsupported arch");
return NULL;
}
void *
mono_create_method_pointer (MonoMethod *method)
{
g_error ("Unsupported arch");
return NULL;
}
#endif
|
Add a missing override from r167851. Hopefully this unbreaks the CrOS Clang build. | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#include "ui/message_center/message_view.h"
#include "ui/... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#include "ui/message_center/message_view.h"
#include "ui/... |
Add A0 as alias to pot pin. | #include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_POTENTIOMETER), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH), MP_ROM_PTR(&pin_PA07) },
};
MP_DEFINE_CONST_DICT(bo... | #include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_POTENTIOMETER), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_TOU... |
Add description of the `chrono::fea` namespace | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of t... | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of t... |
Add prototype for property set command | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 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 newline after printing flake | /*
*****************************************************************************
* ___ _ _ _ _
* / _ \ __ _| |_| |__(_) |_ ___
* | (_) / _` | / / '_ \ | _(_-<
* \___/\__,_|_\_\_.__/_|\__/__/
* Copyright (c) 201... | /*
*****************************************************************************
* ___ _ _ _ _
* / _ \ __ _| |_| |__(_) |_ ___
* | (_) / _` | / / '_ \ | _(_-<
* \___/\__,_|_\_\_.__/_|\__/__/
* Copyright (c) 201... |
Add serialization to Node class. | #ifndef SRC_NODE_H_
#define SRC_NODE_H_
#include "./render_data.h"
/**
* \brief
*
*
*/
class Node
{
public:
virtual ~Node()
{
}
virtual void render(const RenderData &renderData) = 0;
protected:
Node()
{
}
};
#endif // SRC_NODE_H_
| #ifndef SRC_NODE_H_
#define SRC_NODE_H_
#include "./render_data.h"
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
/**
* \brief
*
*
*/
class Node
{
public:
virtual ~Node()
{
}
virtual void render(const RenderData &renderD... |
Add a small bit of documentation | //
// HLSTextView.h
// CoconutKit
//
// Created by Samuel Défago on 03.11.11.
// Copyright (c) 2011 Hortis. All rights reserved.
//
// TODO: - move automatically with the keyboard
// - dismiss when tapping outside
@interface HLSTextView : UITextView
/**
* The text to be displayed when the text view is emp... | //
// HLSTextView.h
// CoconutKit
//
// Created by Samuel Défago on 03.11.11.
// Copyright (c) 2011 Hortis. All rights reserved.
//
/**
* Lightweight UITextView subclass providing more functionalities
*/
@interface HLSTextView : UITextView
/**
* The text to be displayed when the text view is empty. Default is ... |
Make sgi port compile again. | /* $OpenBSD: iockbcvar.h,v 1.3 2010/12/03 18:29:56 shadchin Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
*
* 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 al... | /* $OpenBSD: iockbcvar.h,v 1.4 2010/12/04 11:23:43 jsing Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
*
* 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 c... |
Use keysym to keycode mapping in C | ////////////////////////////////////////////////////////////////////////////////
#ifdef __linux__
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>
Display *fakekey_dis;
void fakekey_init(void) {
fakekey_dis = XOpenDisplay(NULL);
}
void fakekey_press(int code)... | ////////////////////////////////////////////////////////////////////////////////
#ifdef __linux__
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>
Display *fakekey_dis;
void fakekey_init(void) {
fakekey_dis = XOpenDisplay(NULL);
}
void fakekey_press(int keysy... |
Fix too big timeout in long poller. | #ifndef TGBOT_TGLONGPOLL_H
#define TGBOT_TGLONGPOLL_H
#include "tgbot/Bot.h"
#include "tgbot/Api.h"
#include "tgbot/EventHandler.h"
namespace TgBot {
/**
* @brief This class handles long polling and updates parsing.
*
* @ingroup net
*/
class TgLongPoll {
public:
TgLongPoll(const Api* api, const EventHandler... | #ifndef TGBOT_TGLONGPOLL_H
#define TGBOT_TGLONGPOLL_H
#include "tgbot/Bot.h"
#include "tgbot/Api.h"
#include "tgbot/EventHandler.h"
namespace TgBot {
/**
* @brief This class handles long polling and updates parsing.
*
* @ingroup net
*/
class TgLongPoll {
public:
TgLongPoll(const Api* api, const EventHandler... |
Change hook level parameter name to hookRange | //
// MOAspects.h
// MOAspects
//
// Created by Hiromi Motodera on 2015/03/15.
// Copyright (c) 2015年 MOAI. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, MOAspectsPosition)
{
MOAspectsPositionBefore,
MOAspectsPositionAfter
};
typedef NS_ENUM(NSInteger, MOAspectsHook... | //
// MOAspects.h
// MOAspects
//
// Created by Hiromi Motodera on 2015/03/15.
// Copyright (c) 2015年 MOAI. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, MOAspectsPosition)
{
MOAspectsPositionBefore,
MOAspectsPositionAfter
};
typedef NS_ENUM(NSInteger, MOAspectsHook... |
Reset default settings to stock kit configuration |
#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"
// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#defin... |
#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"
// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#defin... |
Make eth header fields unsigned | struct eth_hdr
{
unsigned char dst_mac[6];
unsigned char src_mac[6];
short ethertype;
char* payload;
};
struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);
| #ifndef ETHERNET_H_
#define ETHERNET_H_
#include <linux/if_ether.h>
struct eth_hdr
{
unsigned char dst_mac[6];
unsigned char src_mac[6];
unsigned short ethertype;
unsigned char* payload;
};
struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);
#endif
|
Add a newline after printing the lattice | #include "io_helpers.h"
#include <stdio.h>
void print_lattice(int * lattice, int rows, int columns, int with_borders)
{
int i, j;
for (i = 0; i < rows; i++) {
if (with_borders) {
for (j = 0; j < columns; j++) {
printf("------");
}
printf("-\n");
... | #include "io_helpers.h"
#include <stdio.h>
void print_lattice(int * lattice, int rows, int columns, int with_borders)
{
int i, j;
for (i = 0; i < rows; i++) {
if (with_borders) {
for (j = 0; j < columns; j++) {
printf("------");
}
printf("-\n");
... |
Add test case where array is passed to unknown function. | #include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#define LENGTH 10
typedef struct arr {
int *ptrs[LENGTH];
} arr_t;
// int mutate_array(arr_t a){
// int t = rand();
// for(int i=0; i<LENGTH; i++) {
// *(a.ptrs[i]) = t;
// }
// }
int main(){
arr_t a;
int xs[LENGTH];
for... | |
Fix missing include under OSX | #ifndef SEQUENCINGRUNWIDGET_H
#define SEQUENCINGRUNWIDGET_H
#include <QWidget>
#include "NGSD.h"
namespace Ui {
class SequencingRunWidget;
}
class SequencingRunWidget : public QWidget
{
Q_OBJECT
public:
SequencingRunWidget(QWidget* parent, QString run_id);
~SequencingRunWidget();
signals:
void openProcessedSam... | #ifndef SEQUENCINGRUNWIDGET_H
#define SEQUENCINGRUNWIDGET_H
#include <QWidget>
#include <QAction>
#include "NGSD.h"
namespace Ui {
class SequencingRunWidget;
}
class SequencingRunWidget : public QWidget
{
Q_OBJECT
public:
SequencingRunWidget(QWidget* parent, QString run_id);
~SequencingRunWidget();
signals:
vo... |
Update utility functions to work with pyp-topics. | #ifndef DICT_H_
#define DICT_H_
#include <cassert>
#include <cstring>
#include <tr1/unordered_map>
#include <string>
#include <vector>
#include <boost/functional/hash.hpp>
#include "wordid.h"
class Dict {
typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map;
public:
Dict() : b0_("... | #ifndef DICT_H_
#define DICT_H_
#include <cassert>
#include <cstring>
#include <tr1/unordered_map>
#include <string>
#include <vector>
#include <boost/functional/hash.hpp>
#include "wordid.h"
class Dict {
typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map;
public:
Dict() : b0_(... |
Include stdlib for free and realloc | #ifndef ABUF_H
#define ABUF_H
#include <string.h>
#define ABUF_INIT { NULL, 0}
struct abuf{
char *b;
int len;
};
void abAppend(struct abuf*, const char*, int);
void abFree(struct abuf*);
#endif
| #ifndef ABUF_H
#define ABUF_H
#include <stdlib.h>
#include <string.h>
#define ABUF_INIT { NULL, 0}
struct abuf{
char *b;
int len;
};
void abAppend(struct abuf*, const char*, int);
void abFree(struct abuf*);
#endif
|
Add a note about error checking, fix description and include stdio.h . | /*
scan: Esitmate length of a mpeg file and compare to length from exact scan.
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
#include "mpg123.h"
int main(int argc, char *... | /*
scan: Estimate length (sample count) of a mpeg file and compare to length from exact scan.
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
/* Note the lack of error check... |
Use the new throw function | #pragma once
#include <string> // std::string
#include <sqlite3.h>
#include <system_error> // std::error_code, std::system_error
#include "error_code.h"
namespace sqlite_orm {
namespace internal {
inline sqlite3 *open_db(std::string const&filename)
{
sqlite3 *result {nullptr};
if(... | #pragma once
#include <string> // std::string
#include <sqlite3.h>
#include <system_error> // std::error_code, std::system_error
#include "error_code.h"
namespace sqlite_orm {
namespace internal {
inline sqlite3 *open_db(std::string const&filename)
{
sqlite3 *result {nullptr}... |
Define new number for new exposure rate calc | /* $Id: Output_def.h,v 1.16 2007-10-18 20:30:58 phruksar Exp $ */
#ifndef _OUTPUT_DEF_H
#define _OUTPUT_DEF_H
#define OUTFMT_HEAD 0
#define OUTFMT_UNITS 1
#define OUTFMT_COMP 2
#define OUTFMT_NUM 4
#define OUTFMT_ACT 8
#define OUTFMT_HEAT 16
#define OUTFMT_ALPHA 32
#define OUTFMT_BETA 64... | /* $Id: Output_def.h,v 1.17 2008-07-31 18:08:50 phruksar Exp $ */
#ifndef _OUTPUT_DEF_H
#define _OUTPUT_DEF_H
#define OUTFMT_HEAD 0
#define OUTFMT_UNITS 1
#define OUTFMT_COMP 2
#define OUTFMT_NUM 4
#define OUTFMT_ACT 8
#define OUTFMT_HEAT 16
#define OUTFMT_ALPHA 32
#define OUTFMT_BETA 64... |
Add stdlib.h to header. Needed for size_t | /**
* Copyright (c) 2013-2014 Tomas Dzetkulic
* Copyright (c) 2013-2014 Pavol Rusnak
*
* 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
... | /**
* Copyright (c) 2013-2014 Tomas Dzetkulic
* Copyright (c) 2013-2014 Pavol Rusnak
*
* 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
... |
Set copy/move constructors to deleted | #ifndef SCANNER_H
#define SCANNER_H
#include <QString>
#include <QChar>
#include <QVector>
#include "token.h"
/**
* @class Scanner
* @brief Class representing a scanner (lexical analyzer). It takes a file path as input and generates tokens, either lazily or as a QVector.
*/
class Scanner
{
public:
Scanner(cons... | #ifndef SCANNER_H
#define SCANNER_H
#include <QString>
#include <QChar>
#include <QVector>
#include "token.h"
/**
* @class Scanner
* @brief Class representing a scanner (lexical analyzer). It takes a file path as input and generates tokens, either lazily or as a QVector.
*/
class Scanner
{
public:
Scanner(cons... |
Add documentation for new stp_theme property | //
// UINavigationBar+Stripe_Theme.h
// Stripe
//
// Created by Jack Flintermann on 5/17/16.
// Copyright © 2016 Stripe, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "STPTheme.h"
NS_ASSUME_NONNULL_BEGIN
/**
* This allows quickly setting the appearance of a `UINavigationBar` to match your applic... | //
// UINavigationBar+Stripe_Theme.h
// Stripe
//
// Created by Jack Flintermann on 5/17/16.
// Copyright © 2016 Stripe, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "STPTheme.h"
NS_ASSUME_NONNULL_BEGIN
/**
* This allows quickly setting the appearance of a `UINavigationBar` to match your applic... |
Make the modulus visible in Modular_Reducer | /*
* Modular Reducer
* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_MODULAR_REDUCER_H__
#define BOTAN_MODULAR_REDUCER_H__
#include <botan/numthry.h>
namespace Botan {
/*
* Modular Reducer
*/
class BOTAN_DLL Modular_Reducer
{
public:
BigInt reduce(const B... | /*
* Modular Reducer
* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_MODULAR_REDUCER_H__
#define BOTAN_MODULAR_REDUCER_H__
#include <botan/numthry.h>
namespace Botan {
/*
* Modular Reducer
*/
class BOTAN_DLL Modular_Reducer
{
public:
const BigInt& get_mod... |
Test case for some AVX builtins. Patch by Syoyo Fujita! | // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s
// Don't include mm_malloc.h, it's system specific.
#define __MM_MALLOC_H
#include <immintrin.h>
//
// Test LLVM IR codegen of cmpXY instructions
//
__m128d test_cmp_pd(__m128d a, __m128d b) {
// Expects that... | |
Add in path field in board_t | #ifndef DASHBOARD_H
#define DASHBOARD_H
#include <sys/types.h>
#include "src/process/process.h"
typedef struct {
char *fieldbar;
int max_x;
int max_y;
int prev_x;
int prev_y;
proc_t *process_list;
} board_t;
void print_usage(void);
char set_sort_option(char *opt);
void dashboard_mainl... | #ifndef DASHBOARD_H
#define DASHBOARD_H
#include <sys/types.h>
#include "src/process/process.h"
#define STAT_PATHMAX 32
typedef struct {
uid_t euid;
int max_x;
int max_y;
int prev_x;
int prev_y;
char path[STAT_PATHMAX];
char *fieldbar;
long memtotal;
proc_t *process_list;
} boar... |
Add 'DiscreteImput' Modbus data type | #define _MASTERTYPES
#include <inttypes.h>
//Declarations for master types
typedef enum
{
Register = 0,
Coil = 1
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)
typedef struct
{
uint8_t Address; //Device address
uint8_t Function; //Function called, in which exception occured
uint8_t Co... | #define _MASTERTYPES
#include <inttypes.h>
//Declarations for master types
typedef enum
{
Register = 0,
Coil = 1,
DiscreteInput = 2
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)
typedef struct
{
uint8_t Address; //Device address
uint8_t Function; //Function called, in which exception... |
Remove dependency to node_events.h. Because it removed from Node since v0.5.2 | #ifndef __TAGGER_H__
#define __TAGGER_H__
#include <v8.h>
#include <node.h>
#include <node_events.h>
#include <mecab.h>
#include <stdio.h>
using namespace v8;
namespace MeCabBinding {
class Tagger : node::ObjectWrap {
public:
static void Initialize(const Handle<Object> target);
bool initialized();
const ch... | #ifndef __TAGGER_H__
#define __TAGGER_H__
#include <v8.h>
#include <node.h>
#include <mecab.h>
#include <stdio.h>
using namespace v8;
namespace MeCabBinding {
class Tagger : node::ObjectWrap {
public:
static void Initialize(const Handle<Object> target);
bool initialized();
const char* Parse(const char* inp... |
Remove strong declaration from primitive type | //
// RNSoundPlayer
//
// Created by Johnson Su on 2018-07-10.
//
#import <React/RCTBridgeModule.h>
#import <AVFoundation/AVFoundation.h>
#import <React/RCTEventEmitter.h>
@interface RNSoundPlayer : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
@property (nonatomic, strong) AVAudioPlayer *player;
@proper... | //
// RNSoundPlayer
//
// Created by Johnson Su on 2018-07-10.
//
#import <React/RCTBridgeModule.h>
#import <AVFoundation/AVFoundation.h>
#import <React/RCTEventEmitter.h>
@interface RNSoundPlayer : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
@property (nonatomic, strong) AVAudioPlayer *player;
@proper... |
Add comment to public QUID functions | #ifndef QUID_H_INCLUDED
#define QUID_H_INCLUDED
#define UIDS_PER_TICK 1024 /* Generate identifiers per tick interval */
#define EPOCH_DIFF 11644473600LL /* Conversion needed for EPOCH to UTC */
#define RND_SEED_CYCLE 4096 /* Generate new random seed after interval */
/*
* Identifier structure
*/
struct quid ... | #ifndef QUID_H_INCLUDED
#define QUID_H_INCLUDED
#define UIDS_PER_TICK 1024 /* Generate identifiers per tick interval */
#define EPOCH_DIFF 11644473600LL /* Conversion needed for EPOCH to UTC */
#define RND_SEED_CYCLE 4096 /* Generate new random seed after interval */
/*
* Identifier structure
*/
struct quid ... |
Make offset a protected var. | #include "Allocator.h"
#ifndef LINEARALLOCATOR_H
#define LINEARALLOCATOR_H
class LinearAllocator : public Allocator {
private:
/* Offset from the start of the memory block */
long m_offset;
public:
/* Allocation of real memory */
LinearAllocator(const long totalSize);
/* Frees all memory */
virtual ~LinearAllo... | #include "Allocator.h"
#ifndef LINEARALLOCATOR_H
#define LINEARALLOCATOR_H
class LinearAllocator : public Allocator {
protected:
/* Offset from the start of the memory block */
long m_offset;
public:
/* Allocation of real memory */
LinearAllocator(const long totalSize);
/* Frees all memory */
virtual ~LinearAl... |
Update year in a copyright notice | /*************************************************************************
* Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* Author: Danilo Pi... | /*************************************************************************
* Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* Author: Danilo Pi... |
Fix the value of MCOUNT_INSN_OFFSET | #ifndef __ASM_SH_FTRACE_H
#define __ASM_SH_FTRACE_H
#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
#ifndef __ASSEMBLY__
extern void mcount(void);
#define MCOUNT_ADDR ((long)(mcount))
#ifdef CONFIG_DYNAMIC_FTRACE
#define CALLER_ADDR ((long)(ftrace_caller))
#define STUB_ADDR ((l... | #ifndef __ASM_SH_FTRACE_H
#define __ASM_SH_FTRACE_H
#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
#ifndef __ASSEMBLY__
extern void mcount(void);
#define MCOUNT_ADDR ((long)(mcount))
#ifdef CONFIG_DYNAMIC_FTRACE
#define CALL_ADDR ((long)(ftrace_call))
#define STUB_ADDR ((long)... |
Change noreturn attribute tests into static asserts | // RUN: %ocheck 0 %s
_Noreturn void exit(int);
void g(int i)
{
}
int f(int p)
{
(p == 5 ? exit : g)(2);
// this shouldn't be thought of as unreachable
return 7;
}
main()
{
f(4);
return 0;
}
| // RUN: %ucc -fsyntax-only %s
_Noreturn void exit(int);
__attribute((noreturn)) void exit2(int);
void g(int i);
_Static_assert(
!__builtin_has_attribute(g, noreturn),
"");
_Static_assert(
__builtin_has_attribute(exit, noreturn),
"");
_Static_assert(
__builtin_has_attribute(exit2, noreturn),
"");
_Stati... |
Include board_arm_def.h through the platform's header | /*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <board_arm_def.h>
#include <console.h>
#include <debug.h>
#include <errno.h>
#include <norflash.h>
#include <platform.h>
#include <stdint.h>
/*
* ARM co... | /*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <console.h>
#include <debug.h>
#include <errno.h>
#include <norflash.h>
#include <platform.h>
#include <platform_def.h>
#include <stdint.h>
/*
* ARM com... |
Add protocol for view to return readable properties dictionary (CLURecordableProperties) for View Structure recordable module | //
// CLUViewRecordableProperties.h
// Clue
//
// Created by Ahmed Sulaiman on 5/27/16.
// Copyright © 2016 Ahmed Sulaiman. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol CLUViewRecordableProperties <NSObject>
@required
- (NSMutableDictionary *)clue_viewPropertiesDictionary;
@end
| |
Revert "Remove const from ThreadChecker in NullAudioPoller." | /*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... | /*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... |
Return type of tellg() is implementation defined | #include <string>
#include <fstream>
#ifndef LOADER
#define LOADER
namespace lyrics
{
using std::string;
using std::istream;
class Loader
{
public:
bool Load( const string name, char *&data, unsigned int &size )
{
using std::ifstream;
using std::ios;
using std::ios_base;
ifstream input( name, i... | #include <string>
#include <fstream>
#ifndef LOADER
#define LOADER
namespace lyrics
{
using std::string;
using std::istream;
class Loader
{
public:
bool Load( const string name, char *&data, unsigned int &size )
{
using std::ifstream;
using std::ios;
using std::ios_base;
ifstream input( name, i... |
Fix default LUT size and precision for expander | /**
* \file GainExpanderFilter.h
*/
#ifndef ATK_DYNAMIC_GAINEXPANDERFILTER_H
#define ATK_DYNAMIC_GAINEXPANDERFILTER_H
#include <vector>
#include <ATK/Dynamic/GainFilter.h>
#include "config.h"
namespace ATK
{
/**
* Gain "expander". Computes a new amplitude/volume gain based on threshold, slope and the power o... | /**
* \file GainExpanderFilter.h
*/
#ifndef ATK_DYNAMIC_GAINEXPANDERFILTER_H
#define ATK_DYNAMIC_GAINEXPANDERFILTER_H
#include <vector>
#include <ATK/Dynamic/GainFilter.h>
#include "config.h"
namespace ATK
{
/**
* Gain "expander". Computes a new amplitude/volume gain based on threshold, slope and the power o... |
Add c program for shutting down the board. | /**
* Main Program to shutdown the raspberry pi. This process needs to be run as root to allow this.
* All this program does is to run the shutdown command. If the process has the setuid bit enabled and belongs to root this should work.
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdl... | |
Use FOUNDATION_EXTERN for global variable | //
// FLEXNetworkObserver.h
// Derived from:
//
// PDAFNetworkDomainController.h
// PonyDebugger
//
// Created by Mike Lewis on 2/27/12.
//
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. l... | //
// FLEXNetworkObserver.h
// Derived from:
//
// PDAFNetworkDomainController.h
// PonyDebugger
//
// Created by Mike Lewis on 2/27/12.
//
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. l... |
Rename namespaces in scheduler mock. | /**
* @file testUtils.h
* @author Konrad Zemek
* @copyright (C) 2014 ACK CYFRONET AGH
* @copyright This software is released under the MIT license cited in 'LICENSE.txt'
*/
#ifndef VEILHELPERS_SCHEDULER_MOCK_H
#define VEILHELPERS_SCHEDULER_MOCK_H
#include "scheduler.h"
#include <gmock/gmock.h>
class MockSched... | /**
* @file testUtils.h
* @author Konrad Zemek
* @copyright (C) 2014 ACK CYFRONET AGH
* @copyright This software is released under the MIT license cited in 'LICENSE.txt'
*/
#ifndef ONEHELPERS_SCHEDULER_MOCK_H
#define ONEHELPERS_SCHEDULER_MOCK_H
#include "scheduler.h"
#include <gmock/gmock.h>
class MockSchedul... |
Declare 'strerror' so that we can use it with errno. | /* ===-- string.h - stub SDK header for compiler-rt -------------------------===
*
* 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.
*
* ===---------------------------------------... | /* ===-- string.h - stub SDK header for compiler-rt -------------------------===
*
* 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.
*
* ===---------------------------------------... |
Add C version of broadcast client | #include <arpa/inet.h>
#include <errno.h>
#include <sys/socket.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <unistd.h>
#define BROADCAST_ADDRESS "255.255.255.255"
void print_error(const char* message) {
size_t message_length = strlen(message);
... | |
Add tests for K&R-style functions. | // Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.
#include "test.h"
#ifdef __8cc__
#pragma disable_warning
#endif
void testmain(void) {
print("K&R");
expect(3, no_declaration());
}
int no_declaration() {
return 3;
}
| |
Use strcmp instead of checking for pointer | #include "argparse.h"
args *args_new() {
args *args = NULL;
args = malloc(sizeof(args));
if (!args)
return NULL;
args->opts = NULL;
args->operandsc = 0;
args->operands = NULL;
return args;
}
void args_free(args *args) {
if (args->opts)
option_free(args->opts);
a... | #include "argparse.h"
args *args_new() {
args *args = NULL;
args = malloc(sizeof(args));
if (!args)
return NULL;
args->opts = NULL;
args->operandsc = 0;
args->operands = NULL;
return args;
}
void args_free(args *args) {
if (args->opts)
option_free(args->opts);
a... |
Allow for further room in the return enum | #ifndef NANOTIME_H
#define NANOTIME_H
#include <time.h>
#ifdef __MACH__
#define NANO extern
#else
#define NANO
#endif
typedef enum {
NANO_FAILURE = -1,
NANO_SUCCESS = 0
} nano_return_t;
#define NANO_EXPECTED(X) X == NANO_SUCCESS
#define NANO_UNEXPECTED(X) X == NANO_FAILURE
NANO nano_return_t nano_second(unsigned l... | #ifndef NANOTIME_H
#define NANOTIME_H
#include <time.h>
#ifdef __MACH__
#define NANO extern
#else
#define NANO
#endif
typedef enum {
NANO_FAILURE = -1,
NANO_SUCCESS = 0
} nano_return_t;
#define NANO_EXPECTED(X) (X) == NANO_SUCCESS
#define NANO_UNEXPECTED(X) (X) != NANO_SUCCESS
NANO nano_return_t nano_second(unsign... |
Fix for solaris: declare tigetnum | // @(#)root/editline:$Id$
// Author: Axel Naumann, 2009
/*************************************************************************
* Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... | // @(#)root/editline:$Id$
// Author: Axel Naumann, 2009
/*************************************************************************
* Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... |
Add possibility to disable tests. | #include <CuTest.h>
#include <stdio.h>
#include <util.h>
CuSuite* StrUtilGetSuite();
CuSuite* make_regex_suite();
CuSuite* make_csv_suite();
void RunAllTests(void)
{
CuString *output = CuStringNew();
CuSuite* suite = CuSuiteNew();
CuSuiteAddSuite(suite, StrUtilGetSuite());
CuSuiteAddSuite(suite, make... | #include <CuTest.h>
#include <stdio.h>
#include <util.h>
CuSuite* StrUtilGetSuite();
CuSuite* make_regex_suite();
CuSuite* make_csv_suite();
void RunAllTests(void)
{
CuString *output = CuStringNew();
CuSuite* suite = CuSuiteNew();
#if 1
CuSuiteAddSuite(suite, StrUtilGetSuite());
CuSuiteAddSuite(suite... |
Remove time_dep test for now - it is too dependent on exact conditions. | #include "unity.h"
#include <math.h>
#include <stdlib.h>
#include "quac.h"
#include "operators.h"
#include "solver.h"
#include "dm_utilities.h"
#include "quantum_gates.h"
#include "petsc.h"
#include "tests.h"
void test_timedep(void)
{
double *populations;
int num_pop;
/* Initialize QuaC */
timedep_test(&popul... | #include "unity.h"
#include <math.h>
#include <stdlib.h>
#include "quac.h"
#include "operators.h"
#include "solver.h"
#include "dm_utilities.h"
#include "quantum_gates.h"
#include "petsc.h"
#include "tests.h"
void test_timedep(void)
{
double *populations;
int num_pop;
/* Initialize QuaC */
timedep_test(&popul... |
Fix test case to not fail due to imprecison of analysis | //PARAM: --enable ana.int.interval --enable ana.int.enums --exp.privatization "write"
#include<pthread.h>
// Test case that shows how avoiding reading integral globals can reduce the number of solver evaluations.
// Avoiding to evaluate integral globals when setting them reduced the number of necessary evaluations fr... | //PARAM: --enable ana.int.interval --enable ana.int.enums --exp.privatization "write"
#include<pthread.h>
// Test case that shows how avoiding reading integral globals can reduce the number of solver evaluations.
// Avoiding to evaluate integral globals when setting them reduced the number of necessary evaluations fr... |
Fix a build break on Windows X86. | /* *****************************************************************
*
* Copyright 2017 Microsoft
*
*
* 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/LIC... | /* *****************************************************************
*
* Copyright 2017 Microsoft
*
*
* 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/LIC... |
Remove C Nokia notice that actually remained from the copyright boilerplate | /*
* ga-error.h - Header for Avahi error types
* Copyright (C) 2005 Collabora Ltd.
* Copyright (C) 2005 Nokia Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
... | /*
* ga-error.h - Header for Avahi error types
* Copyright (C) 2005 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at you... |
Remove gen from loadable code | #include "csdl.h"
#include <math.h>
void tanhtable(FUNC *ftp, FGDATA *ff)
{
MYFLT *fp = ftp->ftable;
MYFLT range = ff->e.p[5];
double step = (double)range/(ff->e.p[3]);
int i;
double x;
for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
*fp++ = (MYFLT)tanh(x);
}
static void gentune(FUNC *f... | #include "csdl.h"
#include <math.h>
void tanhtable(FUNC *ftp, FGDATA *ff)
{
MYFLT *fp = ftp->ftable;
MYFLT range = ff->e.p[5];
double step = (double)range/(ff->e.p[3]);
int i;
double x;
for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
*fp++ = (MYFLT)tanh(x);
}
static NGFENS localfgens[]... |
Add struct declaration bug - GCC mismatch with Clang | struct A
{
int i;
};
int main(void)
{
struct B
{
struct A;
struct A a;
};
struct B b;
b.a.i = 3;
return b.a.i;
}
| |
Add testcase missed from r181527. | // RUN: %clang -fsyntax-only %s
#ifdef __STDC_HOSTED__
#include <tgmath.h>
float f;
double d;
long double l;
float complex fc;
double complex dc;
long double complex lc;
// creal
_Static_assert(sizeof(creal(f)) == sizeof(f), "");
_Static_assert(sizeof(creal(d)) == sizeof(d), "");
_Static_assert(sizeof(creal(l)) =... | |
Check for filenames and numbers to detect possible problems with asan_symbolize.py on -fPIE binaries. | #include <stdlib.h>
int main() {
char *x = (char*)malloc(10 * sizeof(char));
free(x);
return x[5];
}
// CHECK: heap-use-after-free
// CHECKSLEEP: Sleeping for 1 second
// CHECKSTRIP-NOT: #0 0x{{.*}} ({{[/].*}})
| #include <stdlib.h>
int main() {
char *x = (char*)malloc(10 * sizeof(char));
free(x);
return x[5];
}
// CHECK: heap-use-after-free
// CHECK: free
// CHECK: main{{.*}}use-after-free.c:4
// CHECK: malloc
// CHECK: main{{.*}}use-after-free.c:3
// CHECKSLEEP: Sleeping for 1 second
// CHECKSTRIP-NOT: #0 0x{{.*}} ({{[... |
Add a processor-agnostic file to include the relevant processor-specific callout and callback support for the ALien plugin. | /*
* xabicc.c - platform-agnostic root for ALien call-outs and callbacks.
*
* Support for Call-outs and Call-backs from the IA32ABI Plugin.
* The plgin is misnamed. It should be the AlienPlugin, but its history
* dictates otherwise.
*/
#if i386|i486|i586|i686
# include "ia32abicc.c"
#elif powerpc|ppc
# include ... | |
Increment FW_BUILD. Initial release for kl26z_nrf51822_if with CDC support | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 re... | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 re... |
Read UART faster to prevent buffer overflows | #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 "QGrou... | #ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H
#include <QString>
/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 5
/** @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 "QGrou... |
Add c pointer basic example | #include <stdio.h>
int main()
{
/* hi this is a multi-line comment
hi.
*/
// single-line comment
printf ("Hello world!\n"); // this works too
// some vars and control flow
int numDaysInYear = 365;
printf ("days per year: %d\n", numDaysInYear);
if (numDaysInYear == 366) {
printf ("Seems rea... | #include <stdio.h>
int main()
{
/* hi this is a multi-line comment
hi.
*/
// single-line comment
printf ("Hello world!\n"); // this works too
// some vars and control flow
int numDaysInYear = 365;
printf ("days per year: %d\n", numDaysInYear);
if (numDaysInYear == 366) {
printf ("Seems rea... |
Apply patch for C standards compliance: "All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined." (That's from ISO/IEC 9899:TC2 final committee draft, section 6.2.7.) | /* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* *
* Copyright (... | /* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* *
* Copyright (... |
Add comment for doxygen for namespace | //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions. Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===---------------------------------------------------------------------... | //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions. Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===---------------------------------------------------------------------... |
Allow getting raw pointer from MaybeRef | #pragma once
#include <gsl/gsl>
namespace Halley {
// Note: it's important that this class has the same layout and binary structure as a plain pointer
template <typename T>
class MaybeRef {
public:
MaybeRef() : pointer(nullptr) {}
MaybeRef(T* pointer) : pointer(pointer) {}
Mayb... | #pragma once
#include <gsl/gsl>
namespace Halley {
// Note: it's important that this class has the same layout and binary structure as a plain pointer
template <typename T>
class MaybeRef {
public:
MaybeRef() : pointer(nullptr) {}
MaybeRef(T* pointer) : pointer(pointer) {}
Mayb... |
Add some missing definitions for mingw.org | /*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_mingw_compat__
#define INCLUDE_mingw_compat__
#if defined(__MINGW32__)
#undef stat
#if... | /*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_mingw_compat__
#define INCLUDE_mingw_compat__
#if defined(__MINGW32__)
#undef stat
#if... |
Remove prototypes for static methods | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _CPU_H_
#define _CPU_H_
#include <cpu/cache.h>
#include <cpu/divu.h>
#include <cpu/dmac.h>
#include <cpu/dual.h>
#include <cpu/endian.h>
#include <cpu/frt.h>
#include <cpu/instructions.h>
#inc... | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _CPU_H_
#define _CPU_H_
#include <cpu/cache.h>
#include <cpu/divu.h>
#include <cpu/dmac.h>
#include <cpu/dual.h>
#include <cpu/endian.h>
#include <cpu/frt.h>
#include <cpu/instructions.h>
#inc... |
Make module^p and b^module modules | #pragma once
#include <noise/noise.h>
#include <cmath>
// This is similar to noise::module::Exp.
// However, no rescaling is performed,
// and no attempt is made to guard against invalid operations.
// Make sure the range of the source module
// is compatible with the base of the exponential!
// This module names its ... | |
Add missing VoidPtr implementation from last commit. | /*
* Appcelerator Kroll - licensed under the Apache Public License 2
* see LICENSE in the root folder for details on the license.
* Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
*/
#ifndef _KR_VOID_PTR_OBJECT_H_
#define _KR_VOID_PTR_OBJECT_H_
#include "../kroll.h"
namespace kroll
{
/**
* An objec... | |
Convert module-based imports to relative | #import <Foundation/Foundation.h>
#import <Nimble/NMBExceptionCapture.h>
#import <Nimble/DSL.h>
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
| #import <Foundation/Foundation.h>
#import "NMBExceptionCapture.h"
#import "DSL.h"
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
|
Enable serialise packet for Cata | /*
Copyright (c) 2014-2018 AscEmu Team <http://www.ascemu.org>
This file is released under the MIT license. See README-MIT for more information.
*/
#pragma once
#include <cstdint>
#include "ManagedPacket.h"
namespace AscEmu { namespace Packets
{
class SmsgWeather : public ManagedPacket
{
#if VERSION_STRING !... | /*
Copyright (c) 2014-2018 AscEmu Team <http://www.ascemu.org>
This file is released under the MIT license. See README-MIT for more information.
*/
#pragma once
#include <cstdint>
#include "ManagedPacket.h"
namespace AscEmu { namespace Packets
{
class SmsgWeather : public ManagedPacket
{
public:
... |
Add default implementations of IXmlDeserializing methods. | #ifndef QTXXML_IXMLDESERIALIZING_H
#define QTXXML_IXMLDESERIALIZING_H
#include "xmlglobal.h"
#include <QtCore>
QTX_BEGIN_NAMESPACE
class IXmlDeserializing
{
public:
virtual ~IXmlDeserializing() {};
virtual IXmlDeserializing *deserializeXmlStartElement(XmlDeserializer *deserializer, const QStringRef... | #ifndef QTXXML_IXMLDESERIALIZING_H
#define QTXXML_IXMLDESERIALIZING_H
#include "xmlglobal.h"
#include <QtCore>
QTX_BEGIN_NAMESPACE
class IXmlDeserializing
{
public:
virtual ~IXmlDeserializing() {};
virtual IXmlDeserializing *deserializeXmlStartElement(XmlDeserializer * deserializer, const QStringRe... |
Add a very simple example which uses FastCGI, a stripped down version of one given by Mike Tsao. | /**
* Copyright 2006 Mike Tsao. All rights reserved.
*
* Hello World using FastCGI and ClearSilver.
*/
#include "ClearSilver.h"
#include <string>
#include <fcgi_stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <syslog.h>
static bool quit = false;
static int cs_printf(void *ctx, const char *s, va_list ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.