Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add missing copyright in the other file.
void __cxa_finalize(void *d ); extern void __dso_handle; __attribute((destructor)) static void cleanup(void) { __cxa_finalize(&__dso_handle); }
/** * Copyright (c) 2012 David Chisnall. * This work was funded by TBricks. * * 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 * ri...
Remove unnecessary forward class declaration
// // PMPinboardService.h // Pinmarker // // Created by Kyle Stevens on 9/24/14. // Copyright (c) 2014 kilovolt42. All rights reserved. // @class PMBookmark; @interface PMPinboardService : NSObject + (void)requestAPITokenForAPIToken:(NSString *)token success:(void (^)(NSString *))success failure:(void (^)(NSErro...
// // PMPinboardService.h // Pinmarker // // Created by Kyle Stevens on 9/24/14. // Copyright (c) 2014 kilovolt42. All rights reserved. // @interface PMPinboardService : NSObject + (void)requestAPITokenForAPIToken:(NSString *)token success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure; + (voi...
Fix mistake in example benchmark that is supposed to be correct. The NaN and infinity cases were not considered.
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> #include "math.h" int main() { float a; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif float b = a - a; assert(sin(b) == 0.0f); return 0; }
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> #include "math.h" int main() { float a = 0.0f; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif if (isnan(a) || isinf(a)) { // assertion won't hold in these cases so exit early return 0; } float b = a - a; as...
Add parsers header to root header
// // TrailsKit.h // TrailsKit // // Created by Mike Mertsock on 1/1/13. // Copyright (c) 2013 Esker Apps. All rights reserved. // #ifndef TrailsKit_TrailsKit_h #define TrailsKit_TrailsKit_h #import "TrailsKitGeometry.h" #import "TKGPXPolylineMapper.h" #import "TrailsKitUI.h" #import "TrailsKitTypes.h" #endif
// // TrailsKit.h // TrailsKit // // Created by Mike Mertsock on 1/1/13. // Copyright (c) 2013 Esker Apps. All rights reserved. // #ifndef TrailsKit_TrailsKit_h #define TrailsKit_TrailsKit_h #import "TrailsKitGeometry.h" #import "TrailsKitParsers.h" #import "TrailsKitTypes.h" #import "TrailsKitUI.h" #endif
REMOVE commented out START_WITHOUT_MENU so we start with a menu
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> #define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<Game...
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> //#define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<Ga...
Improve user info name consistency
@import CoreData; static NSString * const HYPPropertyMapperCustomRemoteKey = @"mapper.remote.key"; @interface NSManagedObject (HYPPropertyMapper) - (void)hyp_fillWithDictionary:(NSDictionary *)dictionary; - (NSDictionary *)hyp_dictionary; @end
@import CoreData; static NSString * const HYPPropertyMapperCustomRemoteKey = @"hyper.remoteKey"; @interface NSManagedObject (HYPPropertyMapper) - (void)hyp_fillWithDictionary:(NSDictionary *)dictionary; - (NSDictionary *)hyp_dictionary; @end
Update driver version to 5.02.00-k19
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k18"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k19"
Add missing FFMPEG_ prefix to multiple inclusion guard.
/* * AVC helper functions for muxers * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either *...
/* * AVC helper functions for muxers * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either *...
Set trm inherit signals by default
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: ...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: ...
Make this easier to compile
#include "cycy/stdio.h" int puts(const char * string) { int i = 0; while (string[i] != NULL) { putchar(string[i++]); } putc('\n'); return i + 1; }
#include "cycy/stdio.h" int puts(const char * string) { int i = 0; while (string[i] != NULL) { putchar(string[i]); i = i + 1; } putc('\n'); return i + 1; }
Add tests for ugly ternary operator
/* name: TEST041 description: Test for bug parsing ternary operators output: test041.c:36: error: type mismatch in conditional expression F1 I G2 F1 main { \ A3 I i A4 P p S6 foo M7 I i A8 S6 foo A3 A3 #I0 !I #W0 #W0 ?W gI :I A4 A3 #I0 !I #P0 #P0 ?P :P A4 A3 #I0 !I #P0 #P0 ?P :P A4 A3 #I0 !I #P0 #P0 ?P :P test041.c...
Fix invalid return value in API test
/*=== *** test1 (duk_safe_call) inherited value top at end: 0 ==> rc=0, result='undefined' ===*/ static duk_ret_t my_constructor(duk_context *ctx) { return 1; } static duk_ret_t test1(duk_context *ctx) { duk_push_global_object(ctx); duk_push_c_function(ctx, my_constructor, 0); /* constructor (function) */ duk_p...
/*=== *** test1 (duk_safe_call) inherited value top at end: 0 ==> rc=0, result='undefined' ===*/ static duk_ret_t my_constructor(duk_context *ctx) { return 0; } static duk_ret_t test1(duk_context *ctx) { duk_push_global_object(ctx); duk_push_c_function(ctx, my_constructor, 0); /* constructor (function) */ duk_p...
Add in a mechanism for interacting with the RMC llvm pass.
#ifndef RMC_CORE_H #define RMC_CORE_H #include "atomic.h" #ifdef HAS_RMC #error "no you don't" #else /* Dummy version that should work. */ #define XEDGE(x, y) do { } while (0) #define VEDGE(x, y) do { } while (0) /* Just stick a visibility barrier after every label. This isn't good * or anything, but it probably wo...
#ifndef RMC_CORE_H #define RMC_CORE_H #include "atomic.h" #ifdef HAS_RMC /* We signal our labels and edges to our LLVM pass in a *really* hacky * way to avoid needing to modify the frontend. Labelled statements * are wrapped in two goto labels to force them into their own basic * block (labelled statements don't...
Add a greater-than-or-equal-to-zero assert to LOOKUP().
#ifndef MISC_H #define MISC_H #include <stdlib.h> #include <stdio.h> #include <assert.h> #include "types.h" #define ARR_LEN(a) (sizeof(a) / sizeof(a[0])) #define LOOKUP(key, table) (assert(key < ARR_LEN(table)), table[key]) static inline void* xmalloc(size_t s) { void* p = malloc(s); if (!p) { perror("malloc")...
#ifndef MISC_H #define MISC_H #include <stdlib.h> #include <stdio.h> #include <assert.h> #include "types.h" #define ARR_LEN(a) (sizeof(a) / sizeof(a[0])) #define LOOKUP(key, table) (assert(key < ARR_LEN(table)), \ assert(key >= 0), \ table[key]) static inline...
Test for arithmetic on pointer to vla
// RUN: %check -e %s void init(int (*p)[]) { p[0][0] = 1; // CHECK: error: arithmetic on pointer to incomplete type int[] }
Add link to explanation of what we mean by zombie The person triaging / debugging a zombie crash may never have heard of this before.
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #pragma once #import <Foundation/Foundation.h> // Yo...
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #pragma once #import <Foundation/Foundation.h> // Yo...
Use ofstreamTS to avoid touching the .gen.cc, .gen.h output if unchanged.
// emitcode.h see license.txt for copyright and terms of use // track state of emitted code so I can emit #line too #ifndef EMITCODE_H #define EMITCODE_H #include <fstream.h> // ofstream #include "str.h" // stringBuffer #include "srcloc.h" // SourceLoc class EmitCode : public stringB...
// emitcode.h see license.txt for copyright and terms of use // track state of emitted code so I can emit #line too #ifndef EMITCODE_H #define EMITCODE_H #include "str.h" // stringBuffer #include "srcloc.h" // SourceLoc #include "ofstreamts.h" // ofstreamTS class EmitCode : public stringB...
Add extern "C" wrapper to main header, for C++
#ifndef __INSECT_H__ #define __INSECT_H__ #include "insect/crawler.h" #include "insect/records.h" /* basic file API */ #include "insect/file/stat.h" #ifdef USE_THREADS #include "insect/concurrent/thread.h" #endif /* USE_THREADS */ #endif /* __INSECT_H__ */
#ifndef __INSECT_H__ #define __INSECT_H__ #ifdef __cplusplus extern "C" { #endif /* C++ */ #include "insect/crawler.h" #include "insect/records.h" /* basic file API */ #include "insect/file/stat.h" #ifdef USE_THREADS #include "insect/concurrent/thread.h" #endif /* USE_THREADS */ #ifdef __cplusplus } /* extern "C" ...
Remove unused code, keep in bx.
/* * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS) * * This file is part of libbitcoin. * * libbitcoin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Fou...
/* * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS) * * This file is part of libbitcoin. * * libbitcoin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Fou...
Add packed attribute to Config
#pragma once #include <Arduino.h> #include "stepper.h" enum StepMode : uint8_t { StepHalf = 1, StepFull = 2, StepBoth = 3 }; enum BrakeMode : uint8_t { BrakeNone = 0, BrakeAlways = 1, BrakeSmart = 2 }; struct Config { StepMode stepMode; BrakeMode brakeMode; uint32_t tickTime; uint32_t homeTime; uint3...
#pragma once #include <Arduino.h> #include "stepper.h" enum StepMode : uint8_t { StepHalf = 1, StepFull = 2, StepBoth = 3 }; enum BrakeMode : uint8_t { BrakeNone = 0, BrakeAlways = 1, BrakeSmart = 2 }; struct Config { StepMode stepMode; BrakeMode brakeMode; uint32_t tickTime; uint32_t homeTime; uint3...
Test for arithmetic on pointer to vla
// RUN: %check -e %s void init(int (*p)[]) { p[0][0] = 1; // CHECK: error: arithmetic on pointer to incomplete type int[] }
Clean up converting float to double
# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */ # define DEG_TO_RAD 0.0174532925199433 /* PI/180 */ VALUE mgrs_to_lat_long(VALUE klass) { VALUE mgrs_grid = rb_iv_get(klass, "@grid"); char* grid = StringValuePtr(mgrs_grid); double lat, lng; Convert_MGRS_To_Geodetic(grid, &lat, &lng); VALUE lat_lng_ar...
# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */ # define DEG_TO_RAD 0.0174532925199433 /* PI/180 */ VALUE mgrs_to_lat_long(VALUE klass) { VALUE mgrs_grid = rb_iv_get(klass, "@grid"); char* grid = StringValuePtr(mgrs_grid); double lat, lng; Convert_MGRS_To_Geodetic(grid, &lat, &lng); VALUE lat_lng_arr...
Fix ugly pointer return bug
#include "syshead.h" #include "tcp_socket.h" #define MAX_TCP_SOCKETS 128 static int cur_fd = 3; static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS]; void init_tcp_sockets() { memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS); } struct tcp_socket *alloc_tcp_socket() { struct tcp_socket *so...
#include "syshead.h" #include "tcp_socket.h" #define MAX_TCP_SOCKETS 128 static int cur_fd = 3; static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS]; void init_tcp_sockets() { memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS); } struct tcp_socket *alloc_tcp_socket() { struct tcp_socket *so...
Rebuild with alias -- trying to fix commit error message
// // CMIDISequence+Debug.h // CMIDI // // Created by CHARLES GILLINGHAM on 9/20/15. // Copyright (c) 2015 CharlesGillingham. All rights reserved. // #import "CMIDISequence.h" @interface CMIDISequence (Debug) + (BOOL) testWithMessageList: (NSArray *) msgs; + (BOOL) testWithMIDIFile: (NSURL *) fileName; @end
Correct name of read_mostly section.
#ifndef _ASM_CRIS_ARCH_CACHE_H #define _ASM_CRIS_ARCH_CACHE_H #include <arch/hwregs/dma.h> /* A cache-line is 32 bytes. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_SHIFT 5 #define __read_mostly __attribute__((__section__(".data.read_mostly"))) void flush_dma_list(dma_descr_data *descr); void flush_dma_descr(dma_d...
#ifndef _ASM_CRIS_ARCH_CACHE_H #define _ASM_CRIS_ARCH_CACHE_H #include <arch/hwregs/dma.h> /* A cache-line is 32 bytes. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_SHIFT 5 #define __read_mostly __attribute__((__section__(".data..read_mostly"))) void flush_dma_list(dma_descr_data *descr); void flush_dma_descr(dma_...
Update version number to 8.02.01-k6.
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.02.01-k5" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 1 #define...
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.02.01-k6" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 1 #define...
Fix up the embarassing mess of path seeding. Yikes. :(
/* Path handling. This was copied from Lua, with some minor adjustments. The biggest one is the lack of Windows support, because I don't have my Windows box setup for Lily yet (I'd rather make sure Windows works all at once). */ #define LILY_MAJOR "0" #define LILY_MINOR "13" #define LILY_VERSION_DIR LILY_MA...
/* Path handling. This was copied from Lua, with some minor adjustments. The biggest one is the lack of Windows support, because I don't have my Windows box setup for Lily yet (I'd rather make sure Windows works all at once). */ #define LILY_MAJOR "0" #define LILY_MINOR "13" #define LILY_VER...
Throw a more useful exceptoin when proxy connection fails.
#ifndef __HTTP_TUNNEL_H__ #define __HTTP_TUNNEL_H__ // Copyright (c) 2009 - Decho Corp. #include "auth.h" namespace HTTP { template <class T> Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target) { Request requestHeaders; requestHeaders.requestLine.method = CONNE...
#ifndef __HTTP_TUNNEL_H__ #define __HTTP_TUNNEL_H__ // Copyright (c) 2009 - Decho Corp. #include "auth.h" namespace HTTP { template <class T> Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target) { Request requestHeaders; requestHeaders.requestLine.method = CONNE...
Return a QStringList wrapper instead of a python list in Converter::toPython.
namespace Shiboken { inline bool Converter<QStringList>::isConvertible(PyObject* pyObj) { return StdListConverter<QStringList>::isConvertible(pyObj); } inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj) { return StdListConverter<QStringList>::toCpp(pyObj); } inline PyObject* Converter<QStringLi...
namespace Shiboken { inline bool Converter<QStringList>::isConvertible(PyObject* pyObj) { return StdListConverter<QStringList>::isConvertible(pyObj); } inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj) { return StdListConverter<QStringList>::toCpp(pyObj); } inline PyObject* Converter<QStringLi...
Make the UIAlertView unit test header consistent.
// // UIAlertViewBlocksKitTest.h // BlocksKit // // Created by Zachary Waldowski on 12/20/11. // Copyright (c) 2011 Dizzy Technology. All rights reserved. // #import <GHUnitIOS/GHUnit.h> #import "BlocksKit/BlocksKit.h" @interface UIAlertViewBlocksKitTest : GHTestCase @end
// // UIAlertViewBlocksKitTest.h // BlocksKit Unit Tests // #import <GHUnitIOS/GHUnit.h> #import "BlocksKit/BlocksKit.h" @interface UIAlertViewBlocksKitTest : GHTestCase - (void)testInit; - (void)testAddButtonWithHandler; - (void)testSetCancelButtonWithHandler; - (void)testDelegationBlocks; @end
Change the spec (comment) of th_validate()
/* * $Id: thinp.h,v 1.2 2001-05-17 17:58:56 thep Exp $ * thinp.h - Thai string input sequence filtering * Created: 2001-05-17 */ #ifndef THAI_THINP_H #define THAI_THINP_H #include <thai/thailib.h> BEGIN_CDECL /* * strictness of input sequence checking, according to WTT 2.0 */ typedef enum { ISC_PASSTHROUG...
/* * $Id: thinp.h,v 1.3 2001-05-17 18:15:04 thep Exp $ * thinp.h - Thai string input sequence filtering * Created: 2001-05-17 */ #ifndef THAI_THINP_H #define THAI_THINP_H #include <thai/thailib.h> BEGIN_CDECL /* * strictness of input sequence checking, according to WTT 2.0 */ typedef enum { ISC_PASSTHROUG...
Fix imports for React Native 0.48.x.
#if __has_include("RCTBridgeModule.h") #import "RCTBridgeModule.h" #else #import <React/RCTBridgeModule.h> #endif #if __has_include("RCTEventEmitter.h") #import "RCTEventEmitter.h" #else #import <React/RCTEventEmitter.h> #endif @interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule> @end
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #else #import "RCTBridgeModule.h" #endif #if __has_include(<React/RCTEventEmitter.h>) #import <React/RCTEventEmitter.h> #else #import "RCTEventEmitter.h" #endif @interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule> @end
Update the version number to 0.9 for a beta build.
#ifndef CLIENTVERSION_H #define CLIENTVERSION_H // // client versioning and copyright year // // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 8 #define CLIENT_VERSION_REVISION 6 #define CLIENT_VERSION_BUILD ...
#ifndef CLIENTVERSION_H #define CLIENTVERSION_H // // client versioning and copyright year // // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_BUILD ...
Add a test for checking that custom diagnostic visitors are working.
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-output=text -verify %s // This file is for testing enhanced diagnostics produced by the default BugReporterVisitors. int getPasswordAndItem() { int err = 0; int *password; // expected-note {{Variable ...
Add a small C header file to wrap our assembly.
struct gcm_args { unsigned char* plaintext; unsigned int plain_len; unsigned char* additional_data; unsigned int additional_data_len; unsigned char* iv; unsigned char* expanded_key_ptr; unsigned char* ciphertext_ptr; unsigned char* tag_ptr; unsigned char* tmp_ptr; // Should point to a buffer of...
Add missing file from OptimizeARC => LLVMPasses transition.
//===--- LLVMARCOpts.h - LLVM level ARC Opts Utility Declarations ---------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LI...
Add a real test case for bitfield.
#include <check.h> #include "bitfield.h" START_TEST (test_foo) { fail_unless(1 == 2); } END_TEST Suite* bitfieldSuite(void) { Suite* s = suite_create("bitfield"); TCase *tc_core = tcase_create("core"); tcase_add_test(tc_core, test_foo); suite_add_tcase(s, tc_core); return s; } int main(void)...
#include <check.h> #include <stdint.h> #include "bitfield.h" START_TEST (test_size) { uint8_t data = 0xFF; fail_unless(getBitField(&data, 0, 4) == 0xF); } END_TEST Suite* bitfieldSuite(void) { Suite* s = suite_create("bitfield"); TCase *tc_core = tcase_create("core"); tcase_add_test(tc_core, test_...
Add swap counting in bubbleSort
/* Author: Dan Wilder * * School: University of Missouri - St. Louis * Semester: Fall 2015 * Class: CS 3130 - Design and Analysis of Algorithms * Instructor: Galina N. Piatnitskaia */ #include "sort_algorithms.h" void swap(int *x, int *y) { int temp = *x; *x = *y *y = temp; } void bubbleS...
/* Author: Dan Wilder * * School: University of Missouri - St. Louis * Semester: Fall 2015 * Class: CS 3130 - Design and Analysis of Algorithms * Instructor: Galina N. Piatnitskaia */ #include "sort_algorithms.h" void swap(int *x, int *y) { int temp = *x; *x = *y *y = temp; } void bubbleS...
Add allocation helper macro ARCH_CACHE_BYTES()
#ifndef ARCH_CACHE_H #define ARCH_CACHE_H 1 #include "uuid.h" #include "record.h" #define ARCH_CACHE_MIN 31 typedef struct arch_cache_bucket { arch_uuid_t uuid; arch_record_t *record; struct arch_cache_bucket *next; } arch_cache_bucket_t; typedef struct arch_cache { struct arch_cache *old; size_t size, entr...
#ifndef ARCH_CACHE_H #define ARCH_CACHE_H 1 #include "uuid.h" #include "record.h" #define ARCH_CACHE_MIN 31 typedef struct arch_cache_bucket { arch_uuid_t uuid; arch_record_t *record; struct arch_cache_bucket *next; } arch_cache_bucket_t; typedef struct arch_cache { struct arch_cache *old; size_t size, entr...
Move CreateWindow undef to make its purpose more clear
#pragma once #include <ionMath.h> #include "CWindow.h" #undef CreateWindow enum class EWindowType { Fullscreen, Windowed }; class CWindowManager : public Singleton<CWindowManager>, public IEventListener { public: void Init(); void PollEvents(); bool ShouldClose() const; bool Run(); ...
#pragma once #include <ionMath.h> #include "CWindow.h" enum class EWindowType { Fullscreen, Windowed }; class CWindowManager : public Singleton<CWindowManager>, public IEventListener { public: void Init(); void PollEvents(); bool ShouldClose() const; bool Run(); #undef CreateWindo...
Add an empty initialize implementation in order to avoid the compilation error
/****************************************************************************** * This file is part of the Gluon Development Platform * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * Li...
/****************************************************************************** * This file is part of the Gluon Development Platform * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * Li...
Include ButtonNode in header file
#pragma once #include "misc/welcome.hpp" #include "misc/ota.hpp" #include "Bme280Node.hpp" #include "ContactNode.hpp" #include "DHT22Node.hpp" #include "RelayNode.hpp"
#pragma once #include "misc/welcome.hpp" #include "misc/ota.hpp" #include "Bme280Node.hpp" #include "ButtonNode.hpp" #include "ContactNode.hpp" #include "DHT22Node.hpp" #include "RelayNode.hpp"
Implement generic check of bitvec_to_int()
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" int main( int argc, char **argv ) { vartype bv[] = {0,1,0,1}; if (bitvec_to_int( bv, 4 ) != 0xA) { ERRPRINT( "bitvec_to_int( [0,1,0,1], 4) != 0xA" )...
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include <assert.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" void print_arr( FILE *fp, vartype *arr, int len ) { int k; assert( len > 0 ); fprintf( fp, "[" ); for (k = 0; k < len; k++) { ...
Add function to combine multiple hash digests.
#ifndef VAST_UTIL_HASH_COMBINE_H #define VAST_UTIL_HASH_COMBINE_H #include <cstddef> namespace vast { namespace util { // Hashes 128-bit input down to 64 bits. // @note Taken from Google's CityHash; licence: MIT inline size_t hash_128_to_64(size_t upper, size_t lower) { static size_t const k_mul = 0x9ddfea08eb382d...
Fix -march= name for x86-64.
// RUN: %llvmgcc %s -c -Os -m32 -emit-llvm -o - | llc -march=x86 -mtriple=i386-apple-darwin10 | FileCheck %s -check-prefix=DARWIN32 // RUN: %llvmgcc %s -c -Os -m64 -emit-llvm -o - | llc -march=x86_64 -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64 extern void func(const char *, const char *); voi...
// RUN: %llvmgcc %s -c -Os -m32 -emit-llvm -o - | llc -march=x86 -mtriple=i386-apple-darwin10 | FileCheck %s -check-prefix=DARWIN32 // RUN: %llvmgcc %s -c -Os -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64 extern void func(const char *, const char *); voi...
Add missing include; fixes build break
namespace opencog { // This type is returned from the agent_finder_api when loading a python module // containing agents or requests struct requests_and_agents_t { std::vector<std::string> agents; std::vector<std::string> requests; std::vector<std::string> req_summary; std::vector<std::string> req_desc...
#include <opencog/atomspace/AtomSpace.h> namespace opencog { // This type is returned from the agent_finder_api when loading a python module // containing agents or requests struct requests_and_agents_t { std::vector<std::string> agents; std::vector<std::string> requests; std::vector<std::string> req_sum...
Implement Exercise 5-10 for multiplication
#include <stdio.h> #include <ctype.h> #include <stdlib.h> // Exercise 5-11 #define MAX 1000 int pop(void); void push(int n); int main(int argc, char *argv[]) { while (--argc > 0 && argv++ != NULL) { printf("%s\n", *argv); if(*argv[0] == '+') { push(pop() + pop()); } else if(*argv[0] == ...
#include <stdio.h> #include <ctype.h> #include <stdlib.h> // Exercise 5-11 #define MAX 1000 int pop(void); void push(int n); int main(int argc, char *argv[]) { while (--argc > 0 && argv++ != NULL) { printf("%s\n", *argv); if(*argv[0] == '+') { push(pop() + pop()); } else if(*argv[0] == ...
Add Resharper printf argument type checking and formatting to Log()
#ifndef _LOG_H #define _LOG_H #include "_global.h" void Log(const char* format, ...); #endif
#ifndef _LOG_H #define _LOG_H #include "_global.h" #if defined(__RESHARPER__) #define PRINTF_ATTR(FormatIndex, FirstToCheck) \ [[gnu::format(printf, FormatIndex, FirstToCheck)]] #elif defined(__GNUC__) #define PRINTF_ATTR(FormatIndex, FirstToCheck) \ __attribute__((format(printf, FormatIndex, FirstT...
Write usage() message on stderr.
#define _XOPEN_SOURCE 500 #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "arg.h" char *argv0; void usage() { printf("usage: %s [-t usec] [-F]\n", argv0); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { char buffer; size_t nread; useconds_t useconds = 1000000; // default 1 second...
#define _XOPEN_SOURCE 500 #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "arg.h" char *argv0; void usage() { fprintf(stderr, "usage: %s [-t usec] [-F]\n", argv0); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { char buffer; size_t nread; useconds_t useconds = 1000000; // default...
Add character string comment test
int main() { // Issue: 3: error: empty character constant ''; // Issue: 6: error: multiple characters in character constant 'ab'; }
int main() { // Issue: 3: error: empty character constant ''; // Issue: 6: error: multiple characters in character constant 'ab'; // Issue: 9: error: multiple characters in character constant '/*'; }
Add macros for min and max
#ifndef __EULER__ #define __EULER__ #define KNRM "\x1B[0m" #define KRED "\x1B[31m" #define KGRN "\x1B[32m" int check(int, int, int); void error(const char *str); #endif
#ifndef __EULER__ #define __EULER__ #define KNRM "\x1B[0m" #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) int check(int, int, int); void error(const char *str); #endif
Remove inclusion of a non-existing header file
#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "spellutil.h" #include "dictionary.h" typedef struct word_count { int value; } count; int parse_file(const char *filename, spell_hashtable *table) { FILE *file = fopen(filename, "r"); int _errno; char *line = NULL;...
#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "spellutil.h" typedef struct word_count { int value; } count; int parse_file(const char *filename, spell_hashtable *table) { FILE *file = fopen(filename, "r"); int _errno; char *line = NULL; size_t len = 0; ...
Remove conditional branch in IRQ handler
#include <irq.h> void irq_enable() { __asm__ __volatile__ ( "mrs r0, cpsr\n" "bic r0, r0, #0x80\n" "msr cpsr, r0\n" ); } void irq_disable() { __asm__ __volatile__ ( "mrs r0, cpsr\n" "orr r0, #0xc0\n" "msr cpsr, r0\n" ); } void handler_swi() { uart0_send("In SWI!\n"); irq_enable(); } void handler_i...
#include <irq.h> #include <uart.h> void (*pl190_isr_vectors[IRQ_COUNT])(void) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uart0_irq_handler, 0, 0, 0 }; void irq_enable() { __asm__ __volatile__ ( "mrs r0, cpsr\n" "bic r0, r0, #0x80\n" "msr cpsr, r0\n" ); } void irq_disable() { __asm__ __volatile__ ( "mrs ...
Update test case for llvm summary format changes in D17592.
// RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s // CHECK: <FUNCTION_SUMMARY_BLOCK // CHECK-NEXT: <PERMODULE_ENTRY // CHECK-NEXT: <PERMODULE_ENTRY // CHECK-NEXT: </FUNCTION_SUMMARY_BLOCK __attribute__((noinline)) void foo() {} int main() { foo(); }
// RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s // CHECK: <GLOBALVAL_SUMMARY_BLOCK // CHECK-NEXT: <PERMODULE // CHECK-NEXT: <PERMODULE // CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK __attribute__((noinline)) void foo() {} int main() { foo(); }
Add Gradient* codec header to all-codecs header
#pragma once #include "AbsWrapperCodec.h" #include "AddWrapperCodec.h" #include "BillowWrapperCodec.h" #include "BlendWrapperCodec.h" #include "CacheWrapperCodec.h" #include "CheckerboardWrapperCodec.h" #include "ClampWrapperCodec.h" #include "ConstWrapperCodec.h" #include "CornerCombinerBaseWrapperCodec.h" #include "...
#pragma once #include "AbsWrapperCodec.h" #include "AddWrapperCodec.h" #include "BillowWrapperCodec.h" #include "BlendWrapperCodec.h" #include "CacheWrapperCodec.h" #include "CheckerboardWrapperCodec.h" #include "ClampWrapperCodec.h" #include "ConstWrapperCodec.h" #include "CornerCombinerBaseWrapperCodec.h" #include "...
Revert 75430 because it's causing failures in dom_checker_tests. : Increase the minimum interval for timers on background tabs to reduce their CPU consumption.
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_ #define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_ namespace webkit_glue { // Chromium sets the minimum interval timeou...
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_ #define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_ namespace webkit_glue { // Chromium sets the minimum interval timeou...
Clean up test, use proper structuring functions
#include "openflow_flowtable.h" #include "mut.h" #include <stdint.h> #include "common_def.h" extern void openflow_flowtable_set_defaults(void); extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2, uint8_t ip_len); TESTSUITE_BEGIN TEST_BEGIN("Flowtable Modification") openflow_flowtabl...
#include "openflow_flowtable.h" #include "mut.h" #include <stdint.h> #include "common_def.h" extern void openflow_flowtable_set_defaults(void); extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2, uint8_t ip_len); TESTSUITE_BEGIN TEST_BEGIN("Flowtable Modification") openflow_flowtabl...
Add some synchronization modes to reflection view along with a context menu.
#pragma once #include <QtGui/QMouseEvent> #include <QtGui/QPaintEvent> #include <QtWidgets/QWidget> #include "binaryninjaapi.h" #include "dockhandler.h" #include "uitypes.h" class ContextMenuManager; class DisassemblyContainer; class Menu; class ViewFrame; class BINARYNINJAUIAPI ReflectionView: public QWidget, publ...
#pragma once #include <QtGui/QMouseEvent> #include <QtGui/QPaintEvent> #include <QtWidgets/QWidget> #include "binaryninjaapi.h" #include "dockhandler.h" #include "uitypes.h" class ContextMenuManager; class DisassemblyContainer; class Menu; class ViewFrame; class BINARYNINJAUIAPI ReflectionView: public QWidget, publ...
Print exceptions to console if exist.
/* * driver - driver for loading mruby source code */ #include <stdio.h> #include "mruby.h" #include "mruby/compile.h" #include "mruby/irep.h" /* The generated mruby bytecodes are stored in this array */ extern const char app_irep[]; int webruby_internal_run(mrb_state* mrb) { mrb_load_irep(mrb, app_irep); ret...
/* * driver - driver for loading mruby source code */ #include <stdio.h> #include "mruby.h" #include "mruby/compile.h" #include "mruby/irep.h" /* The generated mruby bytecodes are stored in this array */ extern const char app_irep[]; static int check_and_print_errors(mrb_state* mrb) { if (mrb->exc) { mrb_p(...
Add milliseconds to timeval test
#include <stdlib.h> #include <time.h> #include <detest/detest.h> #include <disco/time.h> void test_zero_milliseconds_to_timeval() { size_t milliseconds = 0; struct timeval t = milliseconds_to_timeval(milliseconds); expect(t.tv_sec == 0 && t.tv_usec == 0); } void test_one_millisecond_to_timeval() { ...
#include <stdlib.h> #include <time.h> #include <detest/detest.h> #include <disco/time.h> void test_zero_milliseconds_to_timeval() { size_t milliseconds = 0; struct timeval t = milliseconds_to_timeval(milliseconds); expect(t.tv_sec == 0 && t.tv_usec == 0); } void test_one_millisecond_to_timeval() { ...
Fix wrong pins header from being included, add mask to DAC control register
/* * This file is part of GreatFET */ #include "usb_api_dac.h" #include "usb.h" #include "usb_queue.h" #include "usb_endpoint.h" #include <stddef.h> #include <greatfet_core.h> #include <dac.h> #include <pins_greatfet.h> usb_request_status_t usb_vendor_request_dac_set( usb_endpoint_t* const endpoint, const usb_tr...
/* * This file is part of GreatFET */ #include "usb_api_dac.h" #include "usb.h" #include "usb_queue.h" #include "usb_endpoint.h" #include <stddef.h> #include <greatfet_core.h> #include <dac.h> #include <pins.h> usb_request_status_t usb_vendor_request_dac_set( usb_endpoint_t* const endpoint, const usb_transfer_st...
Add terminal to common widgets
/** * @file BlynkWidgets.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ #include "WidgetLED.h" #include "WidgetLCD.h" //#include <WidgetTerminal.h> // No Print....
/** * @file BlynkWidgets.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ #include "WidgetLED.h" #include "WidgetLCD.h" #include "WidgetTerminal.h" #include "Widg...
Fix mispelled separate compilation macro.
#ifndef _NPY_PRIVATE_BUFFER_H_ #define _NPY_PRIVATE_BUFFER_H_ #ifdef NPY_ENABLE_MULTIPLE_COMPILATION extern NPY_NO_EXPORT PyBufferProcs array_as_buffer; #else NPY_NO_EXPORT PyBufferProcs array_as_buffer; #endif #endif
#ifndef _NPY_PRIVATE_BUFFER_H_ #define _NPY_PRIVATE_BUFFER_H_ #ifdef NPY_ENABLE_SEPARATE_COMPILATION extern NPY_NO_EXPORT PyBufferProcs array_as_buffer; #else NPY_NO_EXPORT PyBufferProcs array_as_buffer; #endif #endif
Fix for include path slighlty incorrect
/* Copyright (c) 2008, Stig Brautaset. 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 of conditions and the foll...
/* Copyright (c) 2008, Stig Brautaset. 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 of conditions and the foll...
Add virtual functions to handle mouse movments and Resize
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef GAME_STATE_MANAGER_H #define GAME_STATE_MANAGER_H namespace Common { class GameStateManagerBase { public: virtual bool Initialize() = 0; virtual vo...
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef GAME_STATE_MANAGER_H #define GAME_STATE_MANAGER_H namespace Common { class GameStateManagerBase { public: virtual bool Initialize() = 0; virtual vo...
Fix missing namespace qualification in classify macros
#pragma once /// Tags the current test case if the specified condition is true. If any tags /// are specified after the condition, those will be used. Otherwise, a string /// version of the condition itself will be used as the tag. #define RC_CLASSIFY(condition, ...) \ do {...
#pragma once /// Tags the current test case if the specified condition is true. If any tags /// are specified after the condition, those will be used. Otherwise, a string /// version of the condition itself will be used as the tag. #define RC_CLASSIFY(condition, ...) \ do {...
Add include required to compile on linux.
/** Copyright (c) 2017 Ryan Porter You may use, distribute, or modify this code under the terms of the MIT license. */ #ifndef POLY_CHECKSUM_H #define POLY_CHECKSUM_H // based on code found at http://www.relisoft.com/science/CrcOptim.html class PolyChecksum { public: PolyChecksum(...
/** Copyright (c) 2017 Ryan Porter You may use, distribute, or modify this code under the terms of the MIT license. */ #ifndef POLY_CHECKSUM_H #define POLY_CHECKSUM_H #include <cstddef> // based on code found at http://www.relisoft.com/science/CrcOptim.html class PolyChecksum { public: ...
Fix bizarre bug in "altitude [climb|descend]"
#include "input.h" #include "command.h" TreeNode curNode; char curPlane, extra; void initializeInput() { initializeCommands(); curPlane = 0; } void handleInput(char ch, AtcsoData *data, WINDOW *msgWin) { if (!curPlane) { if (ch >= 'a' && ch <= 'z') { curPlane = ch; curNode...
#include "input.h" #include "command.h" TreeNode curNode; char curPlane, extra; void initializeInput() { initializeCommands(); curPlane = 0; } void handleInput(char ch, AtcsoData *data, WINDOW *msgWin) { if (!curPlane) { if (ch >= 'a' && ch <= 'z') { curPlane = ch; curNode...
Add AGPLv3 legalese boilerplate to the source files.
#include <stdio.h> #include <config.h> int main(void) { puts("This is " PACKAGE_STRING); return 0; }
/* This file is part of nsafepass Copyright 2015 Sergey Kvachonok nsafepass is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any lat...
Test program for the pad factory
#include <gst/gst.h> static GstCapsFactory mpeg2dec_sink_caps = { "mpeg2deccaps", "video/mpeg", "mpegtype", GST_PROPS_LIST ( GST_PROPS_INT(1), GST_PROPS_INT(2) ), NULL }; static GstCapsFactory mpeg2dec_src_caps = { "name", "video/raw", "fourcc", GST_PROPS_LIS...
Update compilation instructions for minimal C example.
/* Minimal C SDL example. This code is in the public domain. Compile with: gcc `sdl2-config --cflags` `sdl2-config --libs` minc.c */ #include <unistd.h> #include <assert.h> #include <stdio.h> #include "SDL.h" int main(int argc, char** argv) { assert (SDL_Init(SDL_INIT_VIDEO) == 0); SDL_Window *w = ...
/* Minimal C SDL example. This code is in the public domain. Compile with: gcc -o minc minc.c `sdl2-config --cflags --libs` */ #include <unistd.h> #include <assert.h> #include <stdio.h> #include "SDL.h" int main(int argc, char** argv) { assert (SDL_Init(SDL_INIT_VIDEO) == 0); SDL_Window *w = SD...
Test case to use the correct Cmp mode
char glob = -1; int main(void) { char x = 126; while (x > 0) { x++; printf("%d\n", x); if (x == -125) break; } return 0; }
Change test to get rid of gcc warning
int puts(const char *); int noop(void); int foo(char *list[5]) { puts(list[0]); puts(list[1]); return sizeof(list); } int prints(int n, ...) { return n; } char s1[] = "Hello"; char *s2 = "World"; int main() { int size = 0; char *words[2]; words[0] = s1; words[1] = s2; size = foo(words); size = size + si...
int puts(const char *); int noop(void); int foo(char *list[5]) { puts(list[0]); puts(list[1]); return sizeof(list[6]); } int prints(int n, ...) { return n; } char s1[] = "Hello"; char *s2 = "World"; int main() { int size = 0; char *words[2]; words[0] = s1; words[1] = s2; size = foo(words); size = size +...
Split buffer overflow test case into two test cases, removing out logic that was commented out.
// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; extern kernel_tea_cheese_t _wonky_gesticulate_cheese; // This test case exercises the ElementRegion::getRValueType() logic. void foo( void ) { kernel_tea...
// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; extern kernel_tea_cheese_t _wonky_gesticulate_cheese; // This test case exercises the ElementRegion::getRValueType() logic. void test1( void ) { kernel_te...
Add constants for outer join states in executor.
/*------------------------------------------------------------------------- * * execdefs.h * * * * Copyright (c) 1994, Regents of the University of California * * $Id: execdefs.h,v 1.4 1999/02/13 23:21:22 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef EX...
/*------------------------------------------------------------------------- * * execdefs.h * * * * Copyright (c) 1994, Regents of the University of California * * $Id: execdefs.h,v 1.5 1999/02/23 07:37:31 thomas Exp $ * *------------------------------------------------------------------------- */ #ifndef EXE...
Fix path in header file
// Copyright 2015. All Rights Reserved. // Author: pxtian2008@gmail.com (Xiaotian Pei) #ifndef EXAMPLES_COREUTILS_WC_MOCK_H_ #define EXAMPLES_COREUTILS_WC_MOCK_H_ #include "examples/coreutils/wc.h" #include "third_party/gmock/gmock.h" namespace coreutils { class MockFile : public File { public: MOCK_METHOD2(Open...
// Copyright 2015. All Rights Reserved. // Author: pxtian2008@gmail.com (Xiaotian Pei) #ifndef EXAMPLES_COREUTILS_WC_MOCK_H_ #define EXAMPLES_COREUTILS_WC_MOCK_H_ #include "examples/wc.h" #include "third_party/gmock/gmock.h" namespace coreutils { class MockFile : public File { public: MOCK_METHOD2(Open, bool(con...
Make ScopedOleInitializer work on windows if you aren't including build_config already.
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_APP_SCOPED_OLE_INITIALIZER_H_ #define CHROME_APP_SCOPED_OLE_INITIALIZER_H_ // Wraps OLE initialization in a cross-platform class meant...
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_APP_SCOPED_OLE_INITIALIZER_H_ #define CHROME_APP_SCOPED_OLE_INITIALIZER_H_ #include "base/logging.h" #include "build/build_config.h" ...
Add two classes [as yet unused] needed for upcoming IDB Blob support.
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WebBlobInfo_h #define WebBlobInfo_h #include "WebCommon.h" #include "WebString.h" namespace blink { class WebBlobInfo { public: WebBlobInfo...
Fix conflicting IPC command type constants with i3's
#ifndef _SWAY_IPC_H #define _SWAY_IPC_H #define event_mask(ev) (1 << (ev & 0x7F)) enum ipc_command_type { IPC_COMMAND = 0, IPC_GET_WORKSPACES = 1, IPC_SUBSCRIBE = 2, IPC_GET_OUTPUTS = 3, IPC_GET_TREE = 4, IPC_GET_MARKS = 5, IPC_GET_BAR_CONFIG = 6, IPC_GET_VERSION = 7, IPC_GET_INPUTS = 8, IPC_GET_CLIPBOARD =...
#ifndef _SWAY_IPC_H #define _SWAY_IPC_H #define event_mask(ev) (1 << (ev & 0x7F)) enum ipc_command_type { // i3 command types - see i3's I3_REPLY_TYPE constants IPC_COMMAND = 0, IPC_GET_WORKSPACES = 1, IPC_SUBSCRIBE = 2, IPC_GET_OUTPUTS = 3, IPC_GET_TREE = 4, IPC_GET_MARKS = 5, IPC_GET_BAR_CONFIG = 6, IPC_GE...
Change test model define prefix
// // TETestModels.h // FLUX // // Created by Alex Faizullov on 10/28/16. // Copyright © 2016 Alexey Fayzullov. All rights reserved. // #import <Foundation/Foundation.h> #import <FLUX/FLXStore.h> #define te_defineStoreTestDouble(name) \ \ @interface name : FLXStore <NSObject *> \ \ @end \ \ @implementation name \...
// // TETestModels.h // FLUX // // Created by Alex Faizullov on 10/28/16. // Copyright © 2016 Alexey Fayzullov. All rights reserved. // #import <Foundation/Foundation.h> #import <FLUX/FLXStore.h> #define flx_defineStoreTestDouble(name) \ \ @interface name : FLXStore <NSObject *> \ \ @end \ \ @implementation name ...
Add platform include to installations header
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
Fix Puzzle board .h file reference
// // Sudoku 9by9 Solver and Analyzer // #include "Sudoku9by9Board.h" class Sudoku9by9SolverAnalyzer { private: Sudoku9by9Board *board_ptr; int number_of_solutions; public: Sudoku9by9SolverAnalyzer(); Sudoku9by9SolverAnalyzer(Sudoku9by9Board *board_ptr); bool NextTryOrBackTrack(int i, int j, bool backtrack); vo...
// // Sudoku 9by9 Solver and Analyzer // #include "Sudoku9by9PuzzleBoard.h" class Sudoku9by9SolverAnalyzer { private: Sudoku9by9Board *board_ptr; int number_of_solutions; public: Sudoku9by9SolverAnalyzer(); Sudoku9by9SolverAnalyzer(Sudoku9by9Board *board_ptr); bool NextTryOrBackTrack(int i, int j, bool backtrack...
Change arguments order in HTML Element initializer for convenience
// // HTMLElement.h // HTMLKit // // Created by Iska on 05/10/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> #import "HTMLNamespaces.h" #import "HTMLNode.h" @interface HTMLElement : HTMLNode @property (nonatomic, assign, readonly) HTMLNamespace htmlNamespace; @p...
// // HTMLElement.h // HTMLKit // // Created by Iska on 05/10/14. // Copyright (c) 2014 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> #import "HTMLNamespaces.h" #import "HTMLNode.h" @interface HTMLElement : HTMLNode @property (nonatomic, assign, readonly) HTMLNamespace htmlNamespace; @p...
Change getbuiltin interface to get the name as an object.
/*********************************************************** Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted,...
/*********************************************************** Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted,...
Add beginning of what will become files shared between runtime and compiler.
#ifndef BFC_TYPES_H #define BFC_TYPES_H #ifndef __cplusplus # include <stdint.h> #else # include <cstdint> #endif typedef bfc_cell uint8_t; #endif /* !BFC_TYPES_H */
Make mapper init function protected
#ifndef MAPPER_H #define MAPPER_H #include <cstdint> #include <vector> #include <CartMemory.h> #include <Mirroring.h> class Mapper { public: Mapper(CartMemory mem) : cartMemory(mem) { init(); }; Mirroring getMirroring() { return cartMemory.mirroring; }; virtual void init() { }; virtual uint8_t readPr...
#ifndef MAPPER_H #define MAPPER_H #include <cstdint> #include <vector> #include <CartMemory.h> #include <Mirroring.h> class Mapper { public: Mapper(CartMemory mem) : cartMemory(mem) { init(); }; Mirroring getMirroring() { return cartMemory.mirroring; }; virtual uint8_t readPrg(uint16_t addr) { }; vir...
Simplify loop body of memcpy
#include <stddef.h> void* memcpy(void* restrict destination, const void* restrict source, size_t length) { char* restrict dst = destination; const char* restrict src = source; /* I know this is naive, but compiler will optimized this because we have restrict. */ for (; length; --length) { ...
#include <stddef.h> void* memcpy(void* restrict destination, const void* restrict source, size_t length) { char* restrict dst = destination; const char* restrict src = source; /* I know this is naive, but compiler will optimized this because we have restrict. */ for (; length; --length) *dst++...
Include some comments about each method
#include <Arduino.h> class MotorShield { public: MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin, uint8_t rightSpeedPin, uint8_t rightDirPin); void init(); void forward(); void backward(); void stop(); void fullSpeed(); void stopLeft(); void stopRight(); uint8_t...
#include <Arduino.h> class MotorShield { public: MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin, uint8_t rightSpeedPin, uint8_t rightDirPin); // Initialization method. Must be called in Arduino's setup() function. void init(); // Makes left and right motors go in the forward dir...
Remove unimplemented line of code
#include <truth/panic.h> #include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/slab.h> #include <truth/heap.h> #include <truth/physical_allocator.h> string Logo = str("\n" " _.-.\n" " .-. `) | .-.\n" " _.'`. ....
#include <truth/panic.h> #include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/slab.h> #include <truth/heap.h> #include <truth/physical_allocator.h> string Logo = str("\n" " _.-.\n" " .-. `) | .-.\n" " _.'`. ....
Use Qt types for integers
/* * Application configuration */ #pragma once #include <QtCore> typedef struct { QString type; quint64 frequency; qint64 nco; qint64 transverter; unsigned int rate; unsigned int decimation; unsigned int bandwidth; int freq_corr_...
/* * Application configuration */ #pragma once #include <QtCore> typedef struct { QString type; quint64 frequency; qint64 nco; qint64 transverter; quint32 rate; quint32 decimation; quint32 bandwidth; qint32 freq_corr_ppb; } device_config_t; typedef...
Update comment of selection sort to include time complexity precisely
#ifndef INCLUDE_ALGORITHMS_SELECTION_SORT_H_ #define INCLUDE_ALGORITHMS_SELECTION_SORT_H_ #include <stddef.h> #include <vector> #include <functional> #include "sort_interface.h" /* This class implements sorting of elements using selection sort algorithm The time complexity to sort is quadratic and is insensitive to in...
#ifndef INCLUDE_ALGORITHMS_SELECTION_SORT_H_ #define INCLUDE_ALGORITHMS_SELECTION_SORT_H_ #include <stddef.h> #include <vector> #include <functional> #include "sort_interface.h" /* This class implements sorting of elements using selection sort algorithm The time complexity to sort is quadratic (N2/4) and is insensitiv...
Fix bug in shape yaml emit
#pragma once #include "geometry.h" #include "yaml_utils.h" #include <vector> #include <boost/shared_ptr.hpp> #include <librevenge/librevenge.h> namespace libpagemaker { class PMDPage { std::vector<boost::shared_ptr<PMDLineSet> > m_shapes; public: PMDPage() : m_shapes() { } void addShape(boost::shared_ptr<PM...
#pragma once #include "geometry.h" #include "yaml_utils.h" #include <vector> #include <boost/shared_ptr.hpp> #include <librevenge/librevenge.h> namespace libpagemaker { class PMDPage { std::vector<boost::shared_ptr<PMDLineSet> > m_shapes; public: PMDPage() : m_shapes() { } void addShape(boost::shared_ptr<PM...
Fix "lt", "gt" & "eq"-selectors declarations
// // CSSStructuralPseudoSelector.h // HTMLKit // // Created by Iska on 11/10/15. // Copyright © 2015 BrainCookie. All rights reserved. // @class CSSSelector; NS_ASSUME_NONNULL_BEGIN extern CSSSelector * rootSelector(); extern CSSSelector * emptySelector(); extern CSSSelector * parentSelector(); extern CSSSelec...
// // CSSStructuralPseudoSelector.h // HTMLKit // // Created by Iska on 11/10/15. // Copyright © 2015 BrainCookie. All rights reserved. // @class CSSSelector; NS_ASSUME_NONNULL_BEGIN extern CSSSelector * rootSelector(); extern CSSSelector * emptySelector(); extern CSSSelector * parentSelector(); extern CSSSelec...
Add rlc/debug to parameter list
// 3GPP LTE RLC: 4G Radio Link Control protocol interface // Parameters for RLC AM const char *const rlc_parameter_names[] = { /* RLC mode AM/UM/TM */ "rlc/mode", /* AM */ "maxRetxThreshold", "amWindowSize", "pollPDU", "pollByte", "t-StatusProhibit", "t-PollRetransmit", /* AM & UM */ "t-Reorderi...
// 3GPP LTE RLC: 4G Radio Link Control protocol interface // Parameters for RLC AM const char *const rlc_parameter_names[] = { /* RLC mode AM/UM/TM */ "rlc/mode", "rlc/debug", /* AM */ "maxRetxThreshold", "amWindowSize", "pollPDU", "pollByte", "t-StatusProhibit", "t-PollRetransmit", /* AM & UM *...
Improve style and naming conventions
#ifndef COMMON_H_INCLUDED #define COMMON_H_INCLUDED #include <string> #include <vector> #include <numeric> #include <iostream> #include "../include/Console.h" // Common functions and data to share across all files. namespace Common { void ClearScreen(); int input(); void ColourPrint(std::string, Console...
#ifndef COMMON_H_INCLUDED #define COMMON_H_INCLUDED #include <string> #include <vector> #include <numeric> #include <iostream> #include "../include/Console.h" // Common functions and data to share across all files. namespace Common { void ClearScreen(); int input(); void ColourPrint(std::string, Console...
Test code quality for variable length array references.
// RUN: %llvmgcc -S %s -o - | grep {getelementptr i32} extern void f(int *); int e(int m, int n) { int x[n]; f(x); return x[m]; }
Add type arguments support :)
#import <Foundation/Foundation.h> #import "NSObject+BlockObservation.h" @interface KVOMutableArray : NSMutableArray<NSFastEnumeration, NSMutableCopying, NSCoding, NSCopying> - (NSMutableArray*)arr; - (instancetype)init; - (instancetype)initWithMutableArray:(NSMutableArray*)array NS_DESIGNATED_INITIALIZER; - (BOOL)is...
#import <Foundation/Foundation.h> #import "NSObject+BlockObservation.h" @interface KVOMutableArray<ObjectType> : NSMutableArray<NSFastEnumeration, NSMutableCopying, NSCoding, NSCopying> - (NSMutableArray*)arr; - (instancetype)init; - (instancetype)initWithMutableArray:(NSMutableArray*)array NS_DESIGNATED_INITIALIZER...
Revert 167434 - build fix
// 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 CHROME_BROWSER_UI_AURA_CHROME_BROWSER_MAIN_EXTRA_PARTS_AURA_H_ #define CHROME_BROWSER_UI_AURA_CHROME_BROWSER_MAIN_EXTRA_PARTS_AURA_H_ #includ...
// 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 CHROME_BROWSER_UI_AURA_CHROME_BROWSER_MAIN_EXTRA_PARTS_AURA_H_ #define CHROME_BROWSER_UI_AURA_CHROME_BROWSER_MAIN_EXTRA_PARTS_AURA_H_ #includ...
Add BBAAPIError code for 409 conflict
// // BBAAPIErrors.h // BBAAPI // // Created by Owen Worley on 11/08/2014. // Copyright (c) 2014 Blinkbox Books. All rights reserved. // NS_ENUM(NSInteger, BBAAPIError) { /** * Used when needed parameter is not supplied to the method * or when object is supplied but it has wrong type or * fo...
// // BBAAPIErrors.h // BBAAPI // // Created by Owen Worley on 11/08/2014. // Copyright (c) 2014 Blinkbox Books. All rights reserved. // NS_ENUM(NSInteger, BBAAPIError) { /** * Used when needed parameter is not supplied to the method * or when object is supplied but it has wrong type or * fo...
Include a couple more important headers.
#include "main.h" #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <errno.h> #include <cstdio>
#include "main.h" #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <netdb.h> #include <resolv.h> #include <errno.h> #include <cstdio>