Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Create String subsystem to handle all string related stuff
/* * 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 static function to convert NPN strings to an enum.
// Copyright (c) 2006-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 NET_SOCKET_SSL_CLIENT_SOCKET_H_ #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ #include "net/socket/client_socket.h" namespace net { class SS...
// Copyright (c) 2006-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 NET_SOCKET_SSL_CLIENT_SOCKET_H_ #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ #include "net/socket/client_socket.h" namespace net { class SS...
Fix HelloWorld attach test for Linux kernels with ptrace ancestor lockdown.
#include <stdio.h> int main(int argc, char const *argv[]) { printf("Hello world.\n"); // Set break point at this line. if (argc == 1) return 0; // Waiting to be attached by the debugger, otherwise. char line[100]; while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached... ...
#include <stdio.h> #if defined(__linux__) #include <sys/prctl.h> #endif int main(int argc, char const *argv[]) { #if defined(__linux__) // Immediately enable any ptracer so that we can allow the stub attach // operation to succeed. Some Linux kernels are locked down so that // only an ancestor process c...
Remove double include of a file
#ifndef MODINCLUDE_H #define MODINCLUDE_H #include "../main.h" class ConfigReader; class ModuleInterface; // forward-declare so it can be used in modules and server #include "../connection.h" // declare other classes that use it #include "../modules.h" #include "../config.h" #include "../modules.h" #endif
#ifndef MODINCLUDE_H #define MODINCLUDE_H #include "../main.h" class ConfigReader; class ModuleInterface; // forward-declare so it can be used in modules and server #include "../connection.h" // declare other classes that use it #include "../modules.h" #include "../config.h" #endif
Include stdlib.h for malloc not to bail
#include "lb_vector.h" Vector lb_create_vector(Scalar* data, unsigned int length) { Vector v; v.data = data; v.length = length; return v; } Vector lb_allocate_vector(unsigned int length) { Scalar* ptr = (Scalar*)malloc(sizeof(Scalar) * length); return lb_create_vector(ptr, length); } // Result = Vector dot Vec...
#include <stdlib.h> #include "lb_vector.h" Vector lb_create_vector(Scalar* data, unsigned int length) { Vector v; v.data = data; v.length = length; return v; } Vector lb_allocate_vector(unsigned int length) { Scalar* ptr = (Scalar*)malloc(sizeof(Scalar) * length); return lb_create_vector(ptr, length); } // Res...
Fix AConfigurationEvent dup() return value
#ifndef _ANDROIDCONFIGURATIONEVENT_H_ #define _ANDROIDCONFIGURATIONEVENT_H_ #include <ConfigurationEvent.h> #include <android/native_window.h> class AndroidConfigurationEvent : public ConfigurationEvent { public: AndroidConfigurationEvent(double _timestamp, ANativeWindow * _window) : ConfigurationEvent(_timestamp...
#ifndef _ANDROIDCONFIGURATIONEVENT_H_ #define _ANDROIDCONFIGURATIONEVENT_H_ #include <ConfigurationEvent.h> #include <android/native_window.h> class AndroidConfigurationEvent : public ConfigurationEvent { public: AndroidConfigurationEvent(double _timestamp, ANativeWindow * _window) : ConfigurationEvent(_timestamp...
Fix typo in a comment: it's base58, not base48.
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base48 entry widget validator. Corrects near-miss characters and refuses characters that are no part of base48. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVali...
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base58 entry widget validator. Corrects near-miss characters and refuses characters that are not part of base58. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVal...
Increase the number of pthread keys available to the IRT
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <errno.h> #include <pthread.h> #include <unistd.h> #include "native_client/src/untrusted/nacl/tls.h" /* * libstdc++ makes mini...
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <errno.h> #include <pthread.h> #include <unistd.h> #include "native_client/src/untrusted/nacl/tls.h" /* * libstdc++ makes mini...
Use stdlib and return EXIT_SUCCESS
/* Copyright © 2018 Atlas Engineer LLC. Use of this file is governed by the license that can be found in LICENSE. */ #include <gtk/gtk.h> #include "server.h" int main(int argc, char *argv[]) { // TODO: Use GtkApplication? gtk_init(&argc, &argv); // TODO: Start the xmlrpc server first? If GUI is started, then we ...
/* Copyright © 2018 Atlas Engineer LLC. Use of this file is governed by the license that can be found in LICENSE. */ #include <gtk/gtk.h> #include <stdlib.h> #include "server.h" int main(int argc, char *argv[]) { // TODO: Use GtkApplication? gtk_init(&argc, &argv); // TODO: Start the xmlrpc server first? If GUI ...
Fix class vs struct declaration.
/* * CECPQ1 (x25519 + NewHope) * (C) 2016 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_CECPQ1_H__ #define BOTAN_CECPQ1_H__ #include <botan/secmem.h> #include <botan/newhope.h> namespace Botan { struct CECPQ1_key { secure_vector<uint8_t> m_x25519; newhope...
/* * CECPQ1 (x25519 + NewHope) * (C) 2016 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_CECPQ1_H__ #define BOTAN_CECPQ1_H__ #include <botan/secmem.h> #include <botan/newhope.h> namespace Botan { class CECPQ1_key { public: secure_vector<uint8_t> m_x2...
Allow ban manager to save state
/* keeps track of bans */ mapping username_bans; mapping ip_bans; static void create() { username_bans = ([ ]); } void ban_username(string username) { ACCESS_CHECK(GAME()); if (username_bans[username]) { error("Username already banned"); } username_bans[username] = 1; } void unban_username(string username)...
#include <kotaka/privilege.h> /* keeps track of bans */ mapping username_bans; private void save(); private void restore(); static void create() { username_bans = ([ ]); restore(); } void ban_username(string username) { ACCESS_CHECK(GAME()); if (username == "admin") { error("Cannot ban admin"); } if (use...
Initialize double variable before use.
#include "GRT/GRT.h" #include "istream.h" using namespace GRT; // Normalize by dividing each dimension by the total magnitude. // Also add the magnitude as an additional feature. vector<double> normalize(vector<double> input) { double magnitude; for (int i = 0; i < input.size(); i++) magnitude += (input[...
#include "GRT/GRT.h" #include "istream.h" using namespace GRT; // Normalize by dividing each dimension by the total magnitude. // Also add the magnitude as an additional feature. vector<double> normalize(vector<double> input) { double magnitude = 0.0; for (int i = 0; i < input.size(); i++) magnitude += (inpu...
Delete argument names of function
#ifndef LOG_H #define LOG_H #include <string> #include <iostream> #include <SFML/Graphics.hpp> inline void Log(std::string str) { std::cout << "[" << __LINE__ << "] " << __FUNCTION__ << " : " << str << std::endl; } inline void LogFnStart() { Log("Entered"); } inline void LogFnEnd() { Log("Finished"); } inline v...
#ifndef LOG_H #define LOG_H #include <string> #include <iostream> #include <SFML/Graphics.hpp> inline void Log(std::string str) { std::cout << "[" << __LINE__ << "] " << __FUNCTION__ << " : " << str << std::endl; } inline void LogFnStart() { Log("Entered"); } inline void LogFnEnd() { Log("Finished"); } inline v...
Use override specifier for EquivBlueprint destructor.
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "blueprint.h" #include <vespa/searchlib/fef/matchdatalayout.h> namespace search::queryeval { class EquivBlueprint : public ComplexLeafBlueprint { private: FieldSpecBaseList _fi...
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "blueprint.h" #include <vespa/searchlib/fef/matchdatalayout.h> namespace search::queryeval { class EquivBlueprint : public ComplexLeafBlueprint { private: FieldSpecBaseList _fi...
Add example which outputs log to a file.
#include <stdio.h> #include <string.h> #include "zf_log.h" #define LOG_FILENAME "test.log" FILE *log_file; static void log_file_write(zf_log_output_ctx *ctx) { *ctx->p = '\n'; fwrite(ctx->buf, 1, (ctx->p + 1) - ctx->buf, log_file); fflush(log_file); } int main(int argc, char *argv[]) { log_file = ...
Adjust parameter defaults to give pleasant result
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // // This file is part of the LibreOffice project. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozi...
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // // This file is part of the LibreOffice project. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozi...
Fix compile error on CentOS
typedef uint64_t msgid_t; typedef uint64_t msec_t; typedef uint64_t usec_t;
#pragma once typedef uint64_t msgid_t; typedef uint64_t msec_t; typedef uint64_t usec_t;
Synchronize logging to stderr and stdout in debug mode
#pragma once #include <string> #include <iostream> #include <fstream> #include <exception> #include <boost/format.hpp> using boost::format; class LogFile { public: LogFile(); explicit LogFile(const std::string& filename); ~LogFile(); void open(const std::string& filename); void close(); temp...
#pragma once #include <string> #include <iostream> #include <fstream> #include <exception> #include <boost/format.hpp> using boost::format; class LogFile { public: LogFile(); explicit LogFile(const std::string& filename); ~LogFile(); void open(const std::string& filename); void close(); temp...
Add a test for aarch64 target CPU names.
// Ensure we support the various CPU names. // // RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a35 -verify %s // RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a53 -verify %s // RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a57 -verify %s // RUN: %clang_cc1...
Add header to allow reusing native_posix drivers
/* * Copyright (c) 2019 Oticon A/S * * SPDX-License-Identifier: Apache-2.0 */ /** * This header exists solely to allow drivers meant for the native_posix board * to be used directly in the nrf52_bsim board. * Note that such reuse should be done with great care. * * The command line arguments parsing logic fro...
Add const in newly-added file.
/****************************************************************/ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* All contents are licensed under LGPL V2.1 */ /* See LICENSE for full restrictions ...
/****************************************************************/ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* All contents are licensed under LGPL V2.1 */ /* See LICENSE for full restrictions ...
Support loading vec3s from JSON objects or arrays
/* * Copyright (C) 2015 Luke San Antonio * All rights reserved. */ #pragma once #include "rapidjson/document.h" #include "glm/glm.hpp" namespace redc { inline glm::vec3 vec3_from_js_object(rapidjson::Value const& v) noexcept { return glm::vec3{v["x"].GetDouble(),v["y"].GetDouble(),v["z"].GetDouble()}; } ...
/* * Copyright (C) 2015 Luke San Antonio * All rights reserved. */ #pragma once #include "rapidjson/document.h" #include "glm/glm.hpp" namespace redc { inline glm::vec3 vec3_from_js_object(rapidjson::Value const& v) noexcept { return glm::vec3{v["x"].GetDouble(),v["y"].GetDouble(),v["z"].GetDouble()}; } ...
Add some more common ports and pins
#pragma once #ifndef __AVR_ARCH__ #include <unistd.h> #define _BV(bit) (1<<(bit)) inline void _delay_ms(int ms) { usleep(ms*1000); } inline void _delay_us(int us) { usleep(us); } extern unsigned char UCSR0B; extern unsigned char DDRB; extern unsigned char DDRD; extern unsigned char PINB; extern unsigned char PIND;...
#pragma once #ifndef __AVR_ARCH__ #include <unistd.h> #define _BV(bit) (1<<(bit)) inline void _delay_ms(int ms) { usleep(ms*1000); } inline void _delay_us(int us) { usleep(us); } extern unsigned char UCSR0A; extern unsigned char UCSR0B; extern unsigned char UCSR0C; extern unsigned char UBRR0H; extern unsigned char...
Add EXTMultimethod to umbrella header
/* * extobjc.h * extobjc * * Created by Justin Spahr-Summers on 2010-11-09. * Released into the public domain. */ #import "EXTADT.h" #import "EXTAspect.h" #import "EXTBlockMethod.h" #import "EXTBlockTarget.h" #import "EXTConcreteProtocol.h" #import "EXTDispatchObject.h" #import "EXTFinalMethod.h" #import "EX...
/* * extobjc.h * extobjc * * Created by Justin Spahr-Summers on 2010-11-09. * Released into the public domain. */ #import "EXTADT.h" #import "EXTAspect.h" #import "EXTBlockMethod.h" #import "EXTBlockTarget.h" #import "EXTConcreteProtocol.h" #import "EXTDispatchObject.h" #import "EXTFinalMethod.h" #import "EX...
Include sql_config.h always so that we get HAVE_TERMIOS_H, so that the password doesn't get echoed.
#ifndef _MEM_H_ #define _MEM_H_ #include <config.h> #ifdef _MSC_VER #include <sql_config.h> #endif #include <stdio.h> #include <assert.h> #ifdef HAVE_MALLOC_H #include <malloc.h> #endif #define NEW( type ) (type*)malloc(sizeof(type) ) #define NEW_ARRAY( type, size ) (type*)malloc((size)*sizeof(type)) #define RE...
#ifndef _MEM_H_ #define _MEM_H_ #include <config.h> #include <sql_config.h> #include <stdio.h> #include <assert.h> #ifdef HAVE_MALLOC_H #include <malloc.h> #endif #define NEW( type ) (type*)malloc(sizeof(type) ) #define NEW_ARRAY( type, size ) (type*)malloc((size)*sizeof(type)) #define RENEW_ARRAY( type,ptr,siz...
Add the future file for common interfaces
/* EFL-Egueb Egueb based EFL extensions * Copyright (C) 2013 - 2014 Jorge Luis Zapata * * 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 y...
Add names for ID space boundaries.
#ifndef VAST_ALIASES_H #define VAST_ALIASES_H #include <cstdint> namespace vast { /// Uniquely identifies a VAST event. using event_id = uint64_t; /// Uniquely identifies a VAST type. using type_id = uint64_t; } // namespace vast #endif
#ifndef VAST_ALIASES_H #define VAST_ALIASES_H #include <cstdint> #include <limits> namespace vast { /// Uniquely identifies a VAST event. using event_id = uint64_t; /// The smallest possible event ID. static constexpr event_id min_event_id = 1; /// The largest possible event ID. static constexpr event_id max_event...
Add simple function to interact with pgsql APIs, and make something for the NQP bits to export
#include "postgres.h" #include "executor/spi.h" #include "commands/trigger.h" #include "fmgr.h" #include "access/heapam.h" #include "utils/syscache.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(plparrot_call_handler); Datum plparrot_call_handler(PG_FUNCTION_ARGS) ...
#include "postgres.h" #include "executor/spi.h" #include "commands/trigger.h" #include "fmgr.h" #include "access/heapam.h" #include "utils/syscache.h" #include "catalog/pg_proc.h" #include "catalog/pg_type.h" PG_MODULE_MAGIC; Datum plparrot_call_handler(PG_FUNCTION_ARGS); void plparrot_elog(int level, char *message)...
Fix out of bounds writes during charset conversion
#include <errno.h> #include "readstat.h" #include "readstat_iconv.h" #include "readstat_convert.h" readstat_error_t readstat_convert(char *dst, size_t dst_len, const char *src, size_t src_len, iconv_t converter) { /* strip off spaces from the input because the programs use ASCII space * padding even with non...
#include <errno.h> #include "readstat.h" #include "readstat_iconv.h" #include "readstat_convert.h" readstat_error_t readstat_convert(char *dst, size_t dst_len, const char *src, size_t src_len, iconv_t converter) { /* strip off spaces from the input because the programs use ASCII space * padding even with non...
Add new file that was forgotten.
#ifndef HALIDE_BUF_SIZE_H #define HALIDE_BUF_SIZE_H // TODO: in new buffer_t, add an inline method to do this and kill this file. // Compute the total amount of memory we'd need to allocate on gpu to // represent a given buffer (using the same strides as the host // allocation). WEAK size_t buf_size(const buffer_t *b...
Add new attributes to Visit class
// // MRSVisit.h // OpenMRS-iOS // // Created by Parker Erway on 12/2/14. // Copyright (c) 2014 Erway Software. All rights reserved. // #import <Foundation/Foundation.h> @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nonatomic, strong) NSString *UUID; @property (non...
// // MRSVisit.h // OpenMRS-iOS // // Created by Parker Erway on 12/2/14. // Copyright (c) 2014 Erway Software. All rights reserved. // #import <Foundation/Foundation.h> #import "MRSLocation.h" @class MRSVisitType; @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nona...
Change int to unsigned int
#ifndef __TIMER_H__ #define __TIMER_H__ #include "SDL/include/SDL.h" class SimpleTimer { public: SimpleTimer() { pausedTicks = 0, runTicks = 0; running = false; } void Start() { running = true; runTicks = SDL_GetTicks(); } void Stop() { if(running) { running = false; pausedTicks = SDL_GetT...
#ifndef __TIMER_H__ #define __TIMER_H__ #include "SDL/include/SDL.h" class SimpleTimer { public: SimpleTimer() { pausedTicks = 0, runTicks = 0; running = false; } void Start() { running = true; runTicks = SDL_GetTicks(); } int Stop() { if(running) { running = false; return pausedTicks = SD...
Fix generic singleton accessor syntax.
#ifndef DTKSINGLETON_H #define DTKSINGLETON_H #include <QtCore/QMutex> template <class T> class dtkSingleton { public: static T& instance(void) { static QMutex mutex; if(!s_instance) { mutex.lock(); if(!s_instance) s_in...
#ifndef DTKSINGLETON_H #define DTKSINGLETON_H #include <QtCore/QMutex> template <class T> class dtkSingleton { public: static T& instance(void) { static QMutex mutex; if(!s_instance) { mutex.lock(); if(!s_instance) s_in...
Handle null terminator in string reverse
#include <stdio.h> #include <stdlib.h> #include <assert.h> int main() { // Read string from a file FILE* file_ptr = fopen("test.txt", "r"); if (file_ptr == NULL) return 1; char* string = malloc(256); fscanf(file_ptr, "%s", string); // Solution int length = sprintf(string, "%s", string); i...
#include <stdio.h> #include <stdlib.h> void reverse(char* string) { char* back = string; char tmp; while(*back) ++back; // Move from the null terminator --back; while (string < back) { char tmp = *string; *string = *back; *back = tmp; ++string; --back; } } int main() { //...
Remove some leftover null pointer vars
#ifndef _POINTER_H #define _POINTER_H #ifdef __cplusplus extern "C" { #endif #include "AbstractMemory.h" extern void rbffi_Pointer_Init(VALUE moduleFFI); extern void rbffi_NullPointer_Init(VALUE moduleFFI); extern VALUE rbffi_Pointer_NewInstance(void* addr); extern VALUE rbffi_PointerClass; extern VALUE rbffi_NullP...
/* * Copyright (c) 2008, 2009, Wayne Meissner * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list ...
Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source
// Due to ln -sf: // REQUIRES: shell // RUN: rm -rf %t.real // RUN: mkdir -p %t.real // RUN: cd %t.real // RUN: ln -sf %clang test-clang // RUN: cd .. // Important to remove %t.fake: If it already is a symlink to %t.real when // `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself, // forming a cycl...
// Due to ln -sf: // REQUIRES: shell // RUN: mkdir -p %t.real // RUN: cd %t.real // RUN: ln -sf %clang test-clang // RUN: cd .. // If %.fake already is a symlink to %t.real when `ln -sf %t.real %t.fake` // runs, then that would symlink %t.real to itself, forming a cycle. // The `-n` flag prevents this. // RUN: ln -sfn ...
Add comments for filter enums
extern void denoise(void*, int, const uint32_t *in, uint32_t *out, int h, int w); extern void *kernelInit(void); extern void kernelFinalize(void*); enum { SPATIAL, TEMPORAL_AVG, KNN, AKNN, ADAPTIVE_TEMPORAL_AVG, DIFF, SOBEL, MOTION, };
extern void denoise(void*, int, const uint32_t *in, uint32_t *out, int h, int w); extern void *kernelInit(void); extern void kernelFinalize(void*); enum { // "Real" filters SPATIAL, TEMPORAL_AVG, ADAPTIVE_TEMPORAL_AVG, KNN, AKNN, // Helpers DIFF, SOBEL, MOTION, NFILTERS, };
Call different stuff for the assembler/disassembler.
/* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> Released under the terms of the MIT License. See LICENSE for details. */ #include <stdlib.h> #include "src/config.h" #include "src/logging.h" #include "src/rom.h" /* Main function. */ int main(int argc, char *argv[]) { Config *config; RO...
/* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> Released under the terms of the MIT License. See LICENSE for details. */ #include <stdlib.h> #include "src/config.h" #include "src/logging.h" #include "src/rom.h" /* Main function. */ int main(int argc, char *argv[]) { Config *config; in...
Fix warning in header disabling some warnings (sigh)
#ifndef PWARNINGS_H #define PWARNINGS_H #if defined(_MSC_VER) /* Needed when flagging code in or out and more. */ #pragma warning(disable: 4127) /* conditional expression is constant */ /* happens also in MS's own headers. */ #pragma warning(disable: 4668) /* preprocessor name not defined */ /* MSVC does not respect d...
#ifndef PWARNINGS_H #define PWARNINGS_H #if defined(_MSC_VER) /* Needed when flagging code in or out and more. */ #pragma warning(disable: 4127) /* conditional expression is constant */ /* happens also in MS's own headers. */ #pragma warning(disable: 4668) /* preprocessor name not defined */ /* MSVC does not respect d...
Define compatibility macros for __ types unless DIRECTFB_NO_CRUFT is defined.
#ifndef __DFB_TYPES_H__ #define __DFB_TYPES_H__ #ifdef USE_KOS #include <sys/types.h> typedef uint8 u8; typedef uint16 u16; typedef uint32 u32; typedef uint64 u64; typedef sint8 s8; typedef sint16 s16; typedef sint32 s32; typedef sint64 s64; #else #include <stdint.h> typedef uint8_t u8; typedef uint16_t u16; ty...
#ifndef __DFB_TYPES_H__ #define __DFB_TYPES_H__ #ifdef USE_KOS #include <sys/types.h> typedef uint8 u8; typedef uint16 u16; typedef uint32 u32; typedef uint64 u64; typedef sint8 s8; typedef sint16 s16; typedef sint32 s32; typedef sint64 s64; #else #include <stdint.h> typedef uint8_t u8; typedef uint16_t u16; ty...
Make example a bit more advanced
int test(int a, int b, int c, int d, int e); typedef (*funcCall)(); short array = {0x61c1}; int main() { ((funcCall)array)(); return test(1, 2, 3, 4, 5); } int test(int a, int b, int c, int d, int e) { return (e + (a + b + c) * a / d) + (a * 6); }
int test(int a, int b, int c, int d, int e); typedef (*funcCall)(); short array = {0x61c1}; int main() { ((funcCall)array)(); int some_var = 3; int ret = test(1, 2, 3, 4, 5); return some_var + ret; } int foo(int a) { return 9 + a; } int test(int a, int b, int c, int d, int e) { a = foo(a); return ((a + ...
Fix simple example delegate's protocol compliance.
// // FragariaAppDelegate.h // Fragaria // // Created by Jonathan on 30/04/2010. // Copyright 2010 mugginsoft.com. All rights reserved. // #import <Cocoa/Cocoa.h> #import <MGSFragaria/MGSFragariaTextViewDelegate.h> #import <MGSFragaria/SMLSyntaxColouringDelegate.h> @class SMLTextView; @class MGSFragaria; @class M...
// // FragariaAppDelegate.h // Fragaria // // Created by Jonathan on 30/04/2010. // Copyright 2010 mugginsoft.com. All rights reserved. // #import <Cocoa/Cocoa.h> #import <MGSFragaria/MGSFragariaTextViewDelegate.h> #import <MGSFragaria/SMLSyntaxColouringDelegate.h> #import <MGSFragaria/MGSDragOperationDelegate.h> ...
Add IPOLICE_FLAGS: DONT_REMOVE, bump RTPP_SW_VERSION forward.
#define RTPP_SW_VERSION "rel.20140506110718"
/* IPOLICE_FLAGS: DONT_REMOVE */ #define RTPP_SW_VERSION "rel.20160514172346"
Add unit tests for utils.c functions.
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <glib.h> #include "cem/utils.h" static void test_set_periodic_multiple_of_4(void) { const int len = 12; int array[12] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; int expected[12] = {6, 7, 8, 3, 4, 5, 6, 7, 8, 3, 4, 5}; apply_periodic_bou...
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...
Reformat comment into Doxygen comment for file.
#ifndef HALIDE_TOOLS_IMAGE_H #define HALIDE_TOOLS_IMAGE_H /* This allows code that relied on halide_image.h and Halide::Tools::Image to continue to work with newer versions of Halide where HalideBuffer.h and Halide::Buffer are the way to work with data. Besides mapping Halide::Tools::Image to Halide::Buffer, it defi...
#ifndef HALIDE_TOOLS_IMAGE_H #define HALIDE_TOOLS_IMAGE_H /** \file * * This allows code that relied on halide_image.h and * Halide::Tools::Image to continue to work with newer versions of * Halide where HalideBuffer.h and Halide::Buffer are the way to work * with data. * * Besides mapping Halide::Tools::Image ...
Fix this test to not rely on the path but to use the configured llvm-gcc instead.
// RUN: llvm-gcc %s -o - -S -emit-llvm -O3 | grep {i8 sext} // PR1513 struct s{ long a; long b; }; void f(struct s a, char *b, char C) { }
// RUN: %llvmgcc %s -o - -S -emit-llvm -O3 | grep {i8 sext} // PR1513 struct s{ long a; long b; }; void f(struct s a, char *b, char C) { }
Remove my name from xcode's auto gen header template
// // PINRemoteImageMacros.h // PINRemoteImage // // Created by Brian Dorfman on 10/15/15. // Copyright © 2015 Pinterest. All rights reserved. // #ifndef PINRemoteImageMacros_h #define PINRemoteImageMacros_h #define PINRemoteImageLogging 0 #if PINRemoteImageLogging #define PINLog(args...) NSLog(arg...
// // PINRemoteImageMacros.h // PINRemoteImage // #ifndef PINRemoteImageMacros_h #define PINRemoteImageMacros_h #define PINRemoteImageLogging 0 #if PINRemoteImageLogging #define PINLog(args...) NSLog(args) #else #define PINLog(args...) #endif #if __has_include(<FLAnimatedImage/FLAnimatedImage.h>) #d...
Fix header to be the same as cpp
/* Manages interaction with the buttons */ #ifndef BUTTON_H #define BUTTON_H const unsigned char BUTTON_NONE = 100; bool button_isPressed(int buttonNumber); void button_wait(int buttonNumber); void button_ISR(); #endif
/* Manages interaction with the buttons */ #ifndef BUTTON_H #define BUTTON_H #include <Arduino.h> const unsigned char BUTTON_NONE = 100; bool button_isPressed(uint8_t buttonNumber); void button_wait(uint8_t buttonNumber); void button_ISR(); #endif
Make error constants unsigned longs.
/* -------------------------------------------------------------------------- * Name: errors.h * Purpose: Error type and constants * ----------------------------------------------------------------------- */ #ifndef ERRORS_H #define ERRORS_H typedef unsigned long int error; #define error_OK 0 ...
/* -------------------------------------------------------------------------- * Name: errors.h * Purpose: Error type and constants * ----------------------------------------------------------------------- */ #ifndef ERRORS_H #define ERRORS_H typedef unsigned long int error; /* Generic errors */ #define error_...
Change type from `char*` to `const char*`
#include "util.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "laco.h" static inline void ignore_extra(const char chr, char** string_ptr) { if(*string_ptr == NULL) return; while(**string_ptr == chr) { *string_ptr += 1; } } /* External API */ void laco_kill(LacoState* laco, int st...
#include "util.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "laco.h" static inline void ignore_extra(const char chr, char** string_ptr) { if(*string_ptr == NULL) return; while(**string_ptr == chr) { *string_ptr += 1; } } /* External API */ void laco_kill(LacoState* laco, int st...
Make this test pretend to be on a darwin host.
// RUN: %clang -### -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40201 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s // RUN: %clang -### -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -c...
// RUN: %clang -### -ccc-host-triple i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40201 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s // RUN: %clang -### -ccc-host-triple i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_...
Put functions related to translation of predicates in separate file.
#ifndef __PLASP__PDDL__TRANSLATION__PREDICATE_H #define __PLASP__PDDL__TRANSLATION__PREDICATE_H #include <plasp/output/Formatting.h> #include <plasp/pddl/expressions/DerivedPredicate.h> #include <plasp/pddl/expressions/Predicate.h> #include <plasp/pddl/expressions/PredicateDeclaration.h> #include <plasp/pddl/translati...
Add SfieldFD class and TIPS3 and TIPS4 classes to phase_field app
# ifndef COMMONPARAMS_H # define COMMONPARAMS_H struct CommonParams{ int nx,ny,nz; int NX,NY,NZ; int rank; int np; int xOff; int iskip; int jskip; int kskip; int nstep; int numOutputs; double dx,dy,dz; double LX,LY,LZ; double dt; }; # endif // COMMONPARAMS_H
# ifndef COMMONPARAMS_H # define COMMONPARAMS_H struct CommonParams{ int nx,ny,nz; int NX,NY,NZ; int rank; int np; int nbrL; int nbrR; int xOff; int iskip; int jskip; int kskip; int nstep; int numOutputs; double dx,dy,dz; double LX,LY,LZ; double dt; }; # endif // COMMO...
Apply fixes required to work with VS 2015 Community.
#ifndef KAI_CONFIG_COMPILER_H # define KAI_CONFIG_COMPILER_H # # if defined(BOOST_MSVC) # define KAI_COMPILER_MSVC # endif # # undef KAI_HAVE_PRAGMA_ONCE # # ifdef KAI_COMPILER_MSVC # ifndef KAI_HAVE_PRAGMA_ONCE # define KAI_HAVE_PRAGMA_ONCE # endif # endif // KAI_COMPILER_MSVC #endif // KAI_CONFIG_COMPILER_H /...
#ifndef KAI_CONFIG_COMPILER_H # define KAI_CONFIG_COMPILER_H # # if defined(BOOST_MSVC) # define KAI_COMPILER_MSVC # endif # # undef KAI_HAVE_PRAGMA_ONCE #pragma warning (disable: 4458 4456) # # ifdef KAI_COMPILER_MSVC # ifndef KAI_HAVE_PRAGMA_ONCE # define KAI_HAVE_PRAGMA_ONCE # endif # endif // KAI_COMPILER...
Remove test case dependancy on platform headers.
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=region // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=basic #include <fcntl.h> void test_open(const char *path) { int fd; fd = open(path, O_RDONLY); // no-warning if (!fd) close(fd); fd = open(path, O_CREAT);...
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=region // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=basic #ifndef O_CREAT #define O_CREAT 0x0200 #define O_RDONLY 0x0000 #endif int open(const char *, int, ...); void test_open(const char *path) { int fd; fd = open(...
Include the rapidcheck header at top-level
#pragma once #include <sstream> #include <rapidcheck.h> #include <catch.hpp> namespace rc { /// For use with `catch.hpp`. Use this function wherever you would use a /// `SECTION` for convenient checking of properties. /// /// @param description A description of the property. /// @param testable The object that...
Add Chapter 27, Try This
/* Chapter 27, Try This: test cat(), find and remove performance error, add comments */ #include<stdlib.h> #include<string.h> #include<stdio.h> struct A { int x; }; char* cat(const char* id, const char* addr) { int len_id = strlen(id); /* so it has to be calculated only once */ int sz = len_i...
Document the mini pack format.
// This will load a lorito bytecode file into a lorito codeseg
// This will load a lorito bytecode file into a lorito codeseg // Since this is temporary, and we'll end up throwing it away in favor of // integrating with parrot's packfile format, this will be real simple. // // Integer: segment type (0 = code, 1 = data) // Integer: Size of segement name // String: segment nam...
Enable interval analysis for test
int main() { unsigned int top; unsigned int start = 0; unsigned int count = 0; if(start + count > top) { return 1; } return 0; }
// PARAM: --enable ana.int.interval int main() { unsigned int top; unsigned int start = 0; unsigned int count = 0; if(start + count > top) { return 1; } return 0; }
Use 16-byte stack alignment on Windows, if using SSE
#ifndef _hashable_siphash_h #define _hashable_siphash_h #include <stdint.h> typedef uint64_t u64; typedef uint32_t u32; typedef uint16_t u16; typedef uint8_t u8; #define SIPHASH_ROUNDS 2 #define SIPHASH_FINALROUNDS 4 u64 hashable_siphash(int, int, u64, u64, const u8 *, size_t); u64 hashable_siphash24(u64, u64, cons...
#ifndef _hashable_siphash_h #define _hashable_siphash_h #include <stdint.h> typedef uint64_t u64; typedef uint32_t u32; typedef uint16_t u16; typedef uint8_t u8; #define SIPHASH_ROUNDS 2 #define SIPHASH_FINALROUNDS 4 u64 hashable_siphash(int, int, u64, u64, const u8 *, size_t); u64 hashable_siphash24(u64, u64, cons...
Add some EXPORT qualifiers for msvc
#ifndef HALIDE_CPLUSPLUS_MANGLE_H #define HALIDE_CPLUSPLUS_MANGLE_H /** \file * * A simple function to get a C++ mangled function name for a function. */ #include <string> #include "IR.h" #include "Target.h" namespace Halide { namespace Internal { /** Return the mangled C++ name for a function. * The target par...
#ifndef HALIDE_CPLUSPLUS_MANGLE_H #define HALIDE_CPLUSPLUS_MANGLE_H /** \file * * A simple function to get a C++ mangled function name for a function. */ #include <string> #include "IR.h" #include "Target.h" namespace Halide { namespace Internal { /** Return the mangled C++ name for a function. * The target par...
Add read and execute command from stdin demo
#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include <string.h> #define MAXLINE 4096 int main(int argc, char *argv[]) { char buf[MAXLINE]; pid_t pid; int status; printf("%% "); while (fgets(buf, MAXLINE, stdin) != NULL) { buf[strlen(buf) - 1] = 0; ...
Add function to convert MoveMak to mask vector
#ifndef VolViz_Geometry_h #define VolViz_Geometry_h #include "Types.h" namespace VolViz { enum MoveMask : uint8_t { None = 0x00, X = 0x01, Y = 0x02, Z = 0x04, All = 0x07 }; struct GeometryDescriptor { bool movable{true}; Color color{Colors::White()}; }; struct AxisAlignedPlaneDescriptor : public Geom...
#ifndef VolViz_Geometry_h #define VolViz_Geometry_h #include "Types.h" namespace VolViz { enum MoveMask : uint8_t { None = 0x00, X = 0x01, Y = 0x02, Z = 0x04, All = 0x07 }; inline Vector3f maskToUnitVector(MoveMask mask) noexcept { Vector3f v = Vector3f::Zero(); auto maskRep = static_cast<uint8_t>(mas...
Fix compilation on FreeBSD 10.3 with default compiler
#ifndef __HIREDIS_FMACRO_H #define __HIREDIS_FMACRO_H #if defined(__linux__) #define _BSD_SOURCE #define _DEFAULT_SOURCE #endif #if defined(__CYGWIN__) #include <sys/cdefs.h> #endif #if defined(__sun__) #define _POSIX_C_SOURCE 200112L #else #if !(defined(__APPLE__) && defined(__MACH__)) #define _XOPEN_SOURCE 600 #en...
#ifndef __HIREDIS_FMACRO_H #define __HIREDIS_FMACRO_H #if defined(__linux__) #define _BSD_SOURCE #define _DEFAULT_SOURCE #endif #if defined(__CYGWIN__) #include <sys/cdefs.h> #endif #if defined(__sun__) #define _POSIX_C_SOURCE 200112L #else #if !(defined(__APPLE__) && defined(__MACH__)) && !(defined(__FreeBSD__)) #d...
Fix header paths in FoundationAdditions umbrella header
#import "FoundationAdditions/TDTLog.h" #import "FoundationAdditions/TDTAssert.h" #import "FoundationAdditions/TDTSuppressPerformSelectorLeakWarning.h" #import "FoundationAdditions/NSArray+TDTFunctionalAdditions.h" #import "FoundationAdditions/NSSet+TDTFunctionalAdditions.h" #import "FoundationAdditions/TDTObjectOrDefau...
#import "FoundationAdditions/TDTLog.h" #import "FoundationAdditions/TDTAssert.h" #import "FoundationAdditions/TDTSuppressPerformSelectorLeakWarning.h" #import "FoundationAdditions/NSArray+TDTFunctionalAdditions.h" #import "FoundationAdditions/NSSet+TDTFunctionalAdditions.h" #import "FoundationAdditions/TDTObjectOrDefau...
Add test packet data and fix invalid serial_close call
#include "hardware/packet.h" #include "serial.h" void btoa(int num, char *buf, int digits) { int shift = digits - 1; int current = pow(2, shift); char digit[2]; while (current > 0) { sprintf(digit, "%d", ((num & current) >> shift) & 1); strncat(buf, digit, 1); shift--; ...
#include "hardware/packet.h" #include "serial.h" void btoa(int num, char *buf, int digits) { int shift = digits - 1; int current = pow(2, shift); char digit[2]; while (current > 0) { sprintf(digit, "%d", ((num & current) >> shift) & 1); strncat(buf, digit, 1); shift--; ...
Add initial implementation of new VFS header
/* @author Denis Deryugin * @date 17 Mar 2015 * * Dumb VFS */ #ifndef _DVFS_H_ #define _DVFS_H_ #include <fs/file_system.h> #include <util/dlist.h> /***************** New VFS prototype *****************/ #define DENTRY_NAME_LEN 16 #define FS_NAME_LEN 16 struct super_block; struct inode; struct dentry; st...
Remove startup delay and messages
#include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "deps/util.h" #include "deps/rcswitch.h" #define PIN_RC PB2 #include "deps/softuart.h" #include "packet.h" int main(void) { // initialize serial softuart_init(); // enable interrupts sei(); delay_ms(1000); sof...
#include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "deps/util.h" #include "deps/rcswitch.h" #define PIN_RC PB2 #include "deps/softuart.h" #include "packet.h" int main(void) { // initialize serial softuart_init(); // enable interrupts sei(); // enable the rc switch ...
Add header for including messaging module.
/**************************************************************************** ** ** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This...
Make bitfield signs explicitly signed (detected by Semmle).
/* * Copyright 2015-2016 Yury Gribov * * Use of this source code is governed by MIT license that can be * found in the LICENSE.txt file. */ #ifndef FLAGS_H #define FLAGS_H enum CheckFlags { CHECK_BASIC = 1 << 0, CHECK_REFLEXIVITY = 1 << 1, CHECK_SYMMETRY = 1 << 2, CHECK_TRANSITIVITY = 1 << 3...
/* * Copyright 2015-2016 Yury Gribov * * Use of this source code is governed by MIT license that can be * found in the LICENSE.txt file. */ #ifndef FLAGS_H #define FLAGS_H enum CheckFlags { CHECK_BASIC = 1 << 0, CHECK_REFLEXIVITY = 1 << 1, CHECK_SYMMETRY = 1 << 2, CHECK_TRANSITIVITY = 1 << 3...
Add test where octApron assert should refine
// SKIP PARAM: --sets ana.activated[+] apron #include <assert.h> void main() { int x, y, z; // TODO: make these asserts after distinction __goblint_commit(x < y); // U NKNOWN! (refines) __goblint_commit(y < z); // U NKNOWN! (refines) __goblint_commit(3 <= x); // U NKNOWN! (refines) __goblint_commit(z <= ...
Initialize FixedVector's member in its null constructor to eliminate a Wall warning.
#pragma once template <typename T, unsigned int N> struct FixedVector { T data[N]; __host__ __device__ FixedVector() { } __host__ __device__ FixedVector(T init) { for(unsigned int i = 0; i < N; i++) data[i] = init; } __host__ __device__ FixedVector operato...
#pragma once template <typename T, unsigned int N> struct FixedVector { T data[N]; __host__ __device__ FixedVector() : data() { } __host__ __device__ FixedVector(T init) { for(unsigned int i = 0; i < N; i++) data[i] = init; } __host__ __device__ FixedVecto...
Remove spammy hello world from account system
/* * 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...
/* * 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...
Rename buffer.h to buffer_helper.h, part II
/** \file * * \brief Inclusion of all utility function headers * * \date Created: Jul 12, 2014 * \date Modified: $Date$ * * \authors mauro <mauro@iis.ee.ethz.ch> * * \version $Revision$ */ #ifndef LINALG_UTILITIES_UTILITIES_H_ #define LINALG_UTILITIES...
/** \file * * \brief Inclusion of all utility function headers * * \date Created: Jul 12, 2014 * \date Modified: $Date$ * * \authors mauro <mauro@iis.ee.ethz.ch> * * \version $Revision$ */ #ifndef LINALG_UTILITIES_UTILITIES_H_ #define LINALG_UTILITIES...
Fix detection of lib if we use `-Werror`
/** * @file * * @brief tests if compilation works (include and build paths set correct, etc...) * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) * */ #include <openssl/evp.h> int main (void) { EVP_CIPHER_CTX * opensslSpecificType; return 0; }
/** * @file * * @brief tests if compilation works (include and build paths set correct, etc...) * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) * */ #include <openssl/evp.h> EVP_CIPHER_CTX * nothing (void) { return NULL; } int main (void) { nothing (); return 0; }
Fix the powerpc clock from the tbr.
/* * * SOS Source Code * __________________ * * [2009] - [2013] Samuel Steven Truscott * All Rights Reserved. */ #include "time_manager.h" #include "kernel/kernel_assert.h" #include "time.h" static int64_t __time_system_time_ns; static __clock_device_t * __time_system_clock; void __time_initialise(void) { ...
/* * * SOS Source Code * __________________ * * [2009] - [2013] Samuel Steven Truscott * All Rights Reserved. */ #include "time_manager.h" #include "kernel/kernel_assert.h" #include "time.h" static uint64_t __time_system_time_ns; static __clock_device_t * __time_system_clock; void __time_initialise(void) { ...
Add testcase: retain precision when negating unsigned value
#include <assert.h> #include <stdio.h> int main(){ unsigned int x = 1; unsigned int y = -x; assert(y == 4294967295); printf("y: %u\n", y); return 0; }
Add mergedOperationsQueue and mergeQueue to ensure correctness of file being modified
#pragma once #ifndef YOU_DATASTORE_INTERNAL_INTERNAL_TRANSACTION_H_ #define YOU_DATASTORE_INTERNAL_INTERNAL_TRANSACTION_H_ #include <memory> #include <boost/ptr_container/ptr_deque.hpp> #include "operation.h" namespace You { namespace DataStore { namespace UnitTests { class DataStoreApiTest; } namespace Internal { ...
#pragma once #ifndef YOU_DATASTORE_INTERNAL_INTERNAL_TRANSACTION_H_ #define YOU_DATASTORE_INTERNAL_INTERNAL_TRANSACTION_H_ #include <memory> #include <boost/ptr_container/ptr_deque.hpp> #include "operation.h" namespace You { namespace DataStore { namespace UnitTests { class DataStoreApiTest; } namespace Internal { ...
Prepare the header for stand-alone usage.
//===--- TokenKinds.h - Token Kinds Interface -------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/L...
//===--- TokenKinds.h - Token Kinds Interface -------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/L...
Disable Microsoft extensions to fix failure on Windows.
// RUN: clang-cc %s -Eonly 2>&1 | grep error #define COMM1 / ## / COMM1
// RUN: clang-cc %s -Eonly -fms-extensions=0 2>&1 | grep error #define COMM1 / ## / COMM1
Add paralellism with race conditions to omp
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "bmp.h" const int image_width = 512; const int image_height = 512; const int image_size = 512*512; const int color_depth = 255; int main(int argc, char** argv){ if(argc != 3){ printf("Useage: %s image n_threads\n", argv[0]); exit...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "bmp.h" const int image_width = 512; const int image_height = 512; const int image_size = 512*512; const int color_depth = 255; int main(int argc, char** argv){ if(argc != 3){ printf("Useage: %s image n_threads\n", argv[0]); exit...
Remove unused struct tm elements
/****************************************************************************** * Copyright (c) 2004, 2008 IBM Corporation * All rights reserved. * This program and the accompanying materials * are made available under the terms of the BSD License * which accompanies this distribution, and is available at * http:...
/****************************************************************************** * Copyright (c) 2004, 2008 IBM Corporation * All rights reserved. * This program and the accompanying materials * are made available under the terms of the BSD License * which accompanies this distribution, and is available at * http:...
Add return type in definition of init_audio_tx function.
#ifndef __AUDIO_TX_H__ #define __AUDIO_TX_H__ #include <stdint.h> init_audio_tx(const char* outfile, int codec_id, int sample_rate, int bit_rate, int payload_type); int put_audio_samples_tx(int16_t* samples, int n_samples); int finish_audio_tx(); #endif /* __AUDIO_TX_H__ */
#ifndef __AUDIO_TX_H__ #define __AUDIO_TX_H__ #include <stdint.h> int init_audio_tx(const char* outfile, int codec_id, int sample_rate, int bit_rate, int payload_type); int put_audio_samples_tx(int16_t* samples, int n_samples); int finish_audio_tx(); #endif /* __AUDIO_TX_H__ */
Fix digest oop for C++17.
#pragma once #include <memory> #include <string> #ifdef __cpp_lib_string_view #include <string_view> #endif namespace oop { class Digest { public: virtual ~Digest() {} virtual void update(const void* data, int len) = 0; #ifdef __cpp_lib_string_view void update(std::string_view str) { update(str.data(), str.le...
#pragma once #include <memory> #include <string> #ifdef __cpp_lib_string_view #include <string_view> #endif namespace oop { class Digest { public: virtual ~Digest() {} virtual void update(const void* data, int len) = 0; #ifdef __cpp_lib_string_view void update(std::string_view str) { update(str.data(), ...
Fix one curly brace placement in test code
// Copyright (c) 2017 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 QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ #include "net/third_party/quiche/src/quic/platform/api/qu...
// Copyright (c) 2017 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 QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ #include "net/third_party/quiche/src/quic/platform/api/qu...
Revert change to rr_wait name
/** * rr_impl.c * * Implementation of functionality specific to round-robin scheduling. */ #include "rr_impl.h" void rr_wake_worker(thread_info_t *info) { // TODO } void rr_wait_for_worker(sched_queue_t *queue) { // TODO }
/** * rr_impl.c * * Implementation of functionality specific to round-robin scheduling. */ #include "rr_impl.h" void rr_wake_worker(thread_info_t *info) { // TODO } void rr_wait(sched_queue_t *queue) { // TODO }
Fix comment on shouldSkipAuthorization property
/* Copyright (c) 2011 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...
/* Copyright (c) 2011 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...
Remove unneeded static member decls; mark c'tor, d'tor as deleted.
//--------------------------------------------------------------------*- C++ -*- // CLING - the C++ LLVM-based InterpreterG :) // author: Axel Naumann <axel@cern.ch> // // This file is dual-licensed: you can choose to license it under the University // of Illinois Open Source License or the GNU Lesser General Public L...
//--------------------------------------------------------------------*- C++ -*- // CLING - the C++ LLVM-based InterpreterG :) // author: Axel Naumann <axel@cern.ch> // // This file is dual-licensed: you can choose to license it under the University // of Illinois Open Source License or the GNU Lesser General Public L...
Test mutexEvents based deadlock with failing locks
// PARAM: --set ana.activated[+] deadlock --enable sem.lock.fail #include <pthread.h> #include <stdio.h> int g1, g2; pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; void *t1(void *arg) { pthread_mutex_lock(&mutex1); pthread_mutex_lock(&mutex2); // DEADLOCK ...
Add newline to the end of the umbrella header
#import <Foundation/Foundation.h> //! Project version number for Expecta. FOUNDATION_EXPORT double ExpectaVersionNumber; //! Project version string for Expecta. FOUNDATION_EXPORT const unsigned char ExpectaVersionString[]; #import <Expecta/ExpectaObject.h> #import <Expecta/ExpectaSupport.h> #import <Expecta/EXPMatch...
#import <Foundation/Foundation.h> //! Project version number for Expecta. FOUNDATION_EXPORT double ExpectaVersionNumber; //! Project version string for Expecta. FOUNDATION_EXPORT const unsigned char ExpectaVersionString[]; #import <Expecta/ExpectaObject.h> #import <Expecta/ExpectaSupport.h> #import <Expecta/EXPMatch...
Fix order of property attributes
// // Copyright (c) 2015 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 agre...
// // Copyright (c) 2015 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 agre...
Include the header in the source file
#include <imageloader.h> #include "context.h" #include <stdio.h> #include <stdarg.h> void print_to_log(ImgloadContext ctx, ImgloadLogLevel level, const char* format, ...) { if (!ctx->log.handler) { return; } if (level < ctx->log.minLevel) { return; } char buffer[1024]; va_list args; va_start(args, fo...
#include <imageloader.h> #include "log.h" #include "context.h" #include <stdio.h> #include <stdarg.h> void print_to_log(ImgloadContext ctx, ImgloadLogLevel level, const char* format, ...) { if (!ctx->log.handler) { return; } if (level < ctx->log.minLevel) { return; } char buffer[1024]; va_list args; ...
Add solution for problem 7
#include <stdio.h> #include "euler.h" #define PROBLEM 7 #define ANSWER 104743 int is_prime(int num) { if(num < 2) { return 0; } else if(num == 2) { return 1; } for(int y = 2; y < num; y++) { if(num % y == 0) { return 0; } } return 1; } int main(in...
Make this a proper forwarding header rather than a duplication what's under pagespeed/util/
/* * Copyright 2012 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...
/* * Copyright 2012 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...
Increase VM_PHYSSEG_MAX, necessary for systems with non-contiguous memory (such as 2E and 3A systems).
/* $OpenBSD: vmparam.h,v 1.3 2011/03/23 16:54:35 pirofti Exp $ */ /* public domain */ #ifndef _MACHINE_VMPARAM_H_ #define _MACHINE_VMPARAM_H_ #define VM_PHYSSEG_MAX 2 /* Max number of physical memory segments */ #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST #include <mips64/vmparam.h> #endif /* _MACHINE_VMPARAM_H_ */...
/* $OpenBSD: vmparam.h,v 1.4 2014/03/27 21:58:13 miod Exp $ */ /* public domain */ #ifndef _MACHINE_VMPARAM_H_ #define _MACHINE_VMPARAM_H_ #define VM_PHYSSEG_MAX 3 /* Max number of physical memory segments */ #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST #include <mips64/vmparam.h> #endif /* _MACHINE_VMPARAM_H_ */
Make file utils tests valgrind-kosher
#include "minunit.h" #include <terror/file_utils.h> #include <assert.h> char *test_getlines() { bstring str = bfromcstr("one\ntwo\nthree\nfour\nfive\n"); struct bstrList *file = bsplit(str, '\n'); DArray *lines = getlines(file, 2, 4); mu_assert(DArray_count(lines) == 3, "Wrong number of lines."); mu_assert...
#include "minunit.h" #include <terror/file_utils.h> #include <assert.h> char *test_getlines() { bstring str = bfromcstr("one\ntwo\nthree\nfour\nfive\n"); struct bstrList *file = bsplit(str, '\n'); DArray *lines = getlines(file, 2, 4); bstring two = bfromcstr("two"); bstring three = bfromcstr("three"); bs...
Add example that gets more precise when the location is not part of the TID
// SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.activated[+] threadJoins --sets ana.apron.privatization mutex-meet-tid --disable ana.thread.include-loc #include <pthread.h> #include <assert.h> int g = 10; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void *t_benign(void *arg) ...
Add header for standard instruments.
#include <MozziGuts.h> #include <Oscil.h> #include <ADSR.h> #include <mozzi_midi.h> #include <tables/sin2048_int8.h> #define applyGain(v, g) ((v * g) >> 8) class MalariaInstrument { public: MalariaInstrument() {}; virtual void noteOn(byte note, byte velocity); virtual void noteOff(byte note, byte velocity);...
Add stdio to this file becasue we use FILE.
// Copyright (c) 2006-2008 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 BASE_SCOPED_HANDLE_H_ #define BASE_SCOPED_HANDLE_H_ #include "base/basictypes.h" #if defined(OS_WIN) #include "base/scoped_handle_win.h...
// Copyright (c) 2006-2008 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 BASE_SCOPED_HANDLE_H_ #define BASE_SCOPED_HANDLE_H_ #include <stdio.h> #include "base/basictypes.h" #if defined(OS_WIN) #include "base...