Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
REFACTOR removed duplicates and created own file for this
void multiply_by_diagonal(const int rows, const int cols, double* restrict diagonal, double* restrict matrix) { /* * Multiply a matrix by a diagonal matrix (represented as a flat array * of n values). The diagonal structure is exploited (so that we use * n^2 ...
Clear screen before each cycle
#ifndef SCHED_H #define SCHED_H #include <Input.h> #include <Watch.h> #include <Display.h> #include <unistd.h> // for sleep() class Sched { public: Sched(Input* input, Watch* watch, Display* display) : input_(input) , watch_(watch) , display_(display) {} public: void run() { while(!shouldStop()) { ...
#ifndef SCHED_H #define SCHED_H #include <Input.h> #include <Watch.h> #include <Display.h> #include <unistd.h> // for sleep() #include <iostream> class Sched { public: Sched(Input* input, Watch* watch, Display* display) : input_(input) , watch_(watch) , display_(display) {} public: void run() { while(...
Add unit converter include to lammps dump writer
/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * 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 * * Unle...
/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * 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 * * Unle...
Merge changes allowing up to 128 elements per Guacamole instruction.
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Add contructor to initialize fetchGenerator correctly
//! \file WikiWalker.h #ifndef WIKIWALKER_H #define WIKIWALKER_H #include <string> #include "CurlWikiGrabber.h" #include "Walker.h" namespace WikiWalker { //! main "app" class class WikiWalker : public Walker { public: /*! given an URL, start collecting links * \param url start point for analysis ...
//! \file WikiWalker.h #ifndef WIKIWALKER_H #define WIKIWALKER_H #include <string> #include "CurlWikiGrabber.h" #include "Walker.h" namespace WikiWalker { //! main "app" class class WikiWalker : public Walker { public: //! Creates a new instance WikiWalker() : Walker(), fetchGenerator(false), grabbe...
Add priv_data field in DecodedFrame struct.
#ifndef __VIDEO_RX_H__ #define __VIDEO_RX_H__ #include "libavformat/avformat.h" typedef struct DecodedFrame { AVFrame* pFrameRGB; uint8_t *buffer; } DecodedFrame; typedef struct FrameManager { enum PixelFormat pix_fmt; void (*put_video_frame_rx)(uint8_t *data, int width, int height, int nframe); DecodedFrame* (...
#ifndef __VIDEO_RX_H__ #define __VIDEO_RX_H__ #include "libavformat/avformat.h" typedef struct DecodedFrame { AVFrame* pFrameRGB; uint8_t *buffer; void *priv_data; /* User private data */ } DecodedFrame; typedef struct FrameManager { enum PixelFormat pix_fmt; void (*put_video_frame_rx)(uint8_t *data, int width,...
Add C implementation for problem 10
#include <stdlib.h> #include <stdio.h> #include "utils.h" #define LIMIT 2000000 unsigned long solution(){ unsigned long n; unsigned long total_sum = 0L; n = 2L; while(n <= LIMIT){ if(is_prime(n) == 1){ total_sum = total_sum + n; } n += 1L; } return total_s...
CREATE ns_prefix/box/ didn't work right when namespace prefix existed.
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "mail-namespace.h" #include "commands.h" bool cmd_create(struct client_command_context *cmd) { struct mail_namespace *ns; const char *mailbox, *full_mailbox; bool directory; size_t len; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mai...
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "mail-namespace.h" #include "commands.h" bool cmd_create(struct client_command_context *cmd) { struct mail_namespace *ns; const char *mailbox, *full_mailbox; bool directory; size_t len; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mai...
Add git r done version of detail::raw_pointer_cast
/* * Copyright 2008-2009 NVIDIA Corporation * * 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...
Change swift_once_t to be actually pointer-sized on non-Darwin
//===--- Once.h - Runtime support for lazy initialization ------*- C++ -*--===// // // 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...
//===--- Once.h - Runtime support for lazy initialization ------*- C++ -*--===// // // 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 test where printf shouldn't invalidate pointer argument
#include <stdio.h> #include <assert.h> int main() { int x = 42; printf("&x = %p\n", &x); // doesn't invalidate x despite taking address assert(x == 42); return 0; }
Make this test suitable for optimized builds by avoiding the name.
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s #include <stdint.h> #define ldrex_func(p, rl, rh) \ __asm__ __volatile__( \ "ldrexd%[_rl], %[_rh], [%[_p]]" \ : [_rl] "=&r" (rl), [_rh] "=&r" (rh) \ : [_p] "p" (p) : "memory") int64_t foo(int64_t v, volati...
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s #include <stdint.h> #define ldrex_func(p, rl, rh) \ __asm__ __volatile__( \ "ldrexd%[_rl], %[_rh], [%[_p]]" \ : [_rl] "=&r" (rl), [_rh] "=&r" (rh) \ : [_p] "p" (p) : "memory") int64_t foo(int64_t v, volati...
Support amd64. Release 2.3.5. Replace crittercism sdk.(ver 4.3.7)
// // KRCloudSyncBlocks.h // CloudSync // // Created by allting on 12. 10. 19.. // Copyright (c) 2012년 allting. All rights reserved. // #ifndef CloudSync_KRCloudSyncBlocks_h #define CloudSync_KRCloudSyncBlocks_h @class KRSyncItem; typedef void (^KRCloudSyncStartBlock)(NSArray* syncItems); typedef void (^KRCloudS...
// // KRCloudSyncBlocks.h // CloudSync // // Created by allting on 12. 10. 19.. // Copyright (c) 2012년 allting. All rights reserved. // #ifndef CloudSync_KRCloudSyncBlocks_h #define CloudSync_KRCloudSyncBlocks_h @class KRSyncItem; typedef void (^KRCloudSyncStartBlock)(NSArray* syncItems); typedef void (^KRCloudS...
Switch to __cdecl till we get --kill-at to work
#ifndef PLUGIN_H_ #define PLUGIN_H_ #include <windows.h> #define EXPORT_CALLING __stdcall #define EXPORT __declspec(dllexport) EXPORT_CALLING #include "common.h" // just defined to make compilation work ; ignored #define RTLD_DEFAULT NULL #define RTLD_LOCAL -1 #define RTLD_LAZY -1 static inline void *dlopen(c...
#ifndef PLUGIN_H_ #define PLUGIN_H_ #include <windows.h> // TODO use __stdcall #define EXPORT_CALLING __cdecl #define EXPORT __declspec(dllexport) EXPORT_CALLING #include "common.h" // just defined to make compilation work ; ignored #define RTLD_DEFAULT NULL #define RTLD_LOCAL -1 #define RTLD_LAZY -1 static i...
Call this version what it is. Missed in earlier.
#ifndef _COMMON_H #define _COMMON_H #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #ifdef _LINUX #include <bsd/string.h> #endif #include <libxml/parser.h> #include <libxml/tree.h> #include <libxml/xmlsave.h> #include <libxml/encoding.h> #include <libxml/xmlstring.h>...
#ifndef _COMMON_H #define _COMMON_H #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #ifdef _LINUX #include <bsd/string.h> #endif #include <libxml/parser.h> #include <libxml/tree.h> #include <libxml/xmlsave.h> #include <libxml/encoding.h> #include <libxml/xmlstring.h>...
Change video bitrate to 2 Mbps
#ifndef PICAM_CONFIG_H #define PICAM_CONFIG_H #if defined(__cplusplus) extern "C" { #endif // Even if we specify 30 FPS, Raspberry Pi Camera provides slighly lower FPS. #define TARGET_FPS 30 #define GOP_SIZE TARGET_FPS #define H264_BIT_RATE 3000 * 1000 // 3 Mbps // 1600x900 is the upper limit if you don't use tunn...
#ifndef PICAM_CONFIG_H #define PICAM_CONFIG_H #if defined(__cplusplus) extern "C" { #endif // 1600x900 is the upper limit if you don't use tunnel from camera to video_encode. // 720p (1280x720) is good enough for most cases. #define WIDTH 1280 #define HEIGHT 720 // Even if we specify 30 FPS, Raspberry Pi Camera prov...
Add ARGV and ARGV_CONCAT macros
/* * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in * the LICENSE file in the root directory of this source tree. An * additional grant of patent rights can be found in the PATENTS file * in the same directory. * */ #pragma ...
/* * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in * the LICENSE file in the root directory of this source tree. An * additional grant of patent rights can be found in the PATENTS file * in the same directory. * */ #pragma ...
Use write(2) to display helptext.
// Copyright 2016, Jeffrey E. Bedard #include "xstatus.h" #include "config.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> static const char * helptext = "DESCRIPTION: Simple X toolbar for minimalistic" " window managers.\n" "USAGE: xstatus [-d DELAY][-f FILE][-h]\n" "\t-d DELAY Set delay between ...
// Copyright 2016, Jeffrey E. Bedard #include "xstatus.h" #include "config.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> static const char helptext[] = "DESCRIPTION: Simple X toolbar for minimalistic" " window managers.\n" "USAGE: xstatus [-d DELAY][-f FILE][-h]\n" "\t-d DELAY Set delay between ...
Revert "Changed macro to look specifically for NS_STRING_ENUM"
// // SDLMacros.h // SmartDeviceLink-iOS // // Created by Muller, Alexander (A.) on 10/17/16. // Copyright © 2016 smartdevicelink. All rights reserved. // #ifndef SDLMacros_h #define SDLMacros_h // Resolves issue of pre-xcode 8 versions due to NS_STRING_ENUM unavailability. #ifndef SDL_SWIFT_ENUM #if __has_at...
// // SDLMacros.h // SmartDeviceLink-iOS // // Created by Muller, Alexander (A.) on 10/17/16. // Copyright © 2016 smartdevicelink. All rights reserved. // #ifndef SDLMacros_h #define SDLMacros_h // Resolves issue of pre-xcode 8 versions due to NS_STRING_ENUM unavailability. #ifndef SDL_SWIFT_ENUM #if __has_at...
Move types declarations to new file
typedef struct { uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready uint8_t *Frame; //Response frame content } MODBUSResponseStatus; //Type containing information about frame that is set up at slave side typedef struct { uint8_t Address; uint16_t *Registers; uint16_t RegisterCount; MODBUSR...
Remove unnecessary const qualifier in function declaration
#pragma once #include "address.h" #include "options.h" #include "cartridge/cartridge.h" #include <vector> #include <memory> class Video; class CPU; class Serial; class Input; class Timer; class MMU { public: MMU(std::shared_ptr<Cartridge> inCartridge, CPU& inCPU, Video& inVideo, Input& input, Serial& serial, Ti...
#pragma once #include "address.h" #include "options.h" #include "cartridge/cartridge.h" #include <vector> #include <memory> class Video; class CPU; class Serial; class Input; class Timer; class MMU { public: MMU(std::shared_ptr<Cartridge> inCartridge, CPU& inCPU, Video& inVideo, Input& input, Serial& serial, Ti...
Include shannon.h instead of entropy.h
// Copyright 2016 ELIFE. All rights reserved. // Use of this source code is governed by a MIT // license that can be found in the LICENSE file. #pragma once #include <inform/dist.h> #include <inform/entropy.h> #include <inform/state_encoding.h> #include <inform/active_info.h> #include <inform/entropy_rate.h> #include...
// Copyright 2016 ELIFE. All rights reserved. // Use of this source code is governed by a MIT // license that can be found in the LICENSE file. #pragma once #include <inform/dist.h> #include <inform/shannon.h> #include <inform/state_encoding.h> #include <inform/active_info.h> #include <inform/entropy_rate.h> #include...
Add NXP LPC clock control driver
/* * Copyright (c) 2020, NXP * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_MCUX_LPC_SYSCON_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_MCUX_LPC_SYSCON_H_ #define MCUX_FLEXCOMM0_CLK 0 #define MCUX_FLEXCOMM1_CLK 1 #define MCUX_FLEXCOMM2_CLK 2 #define MCUX_FLEXCOMM3_CLK 3 #d...
Use gsl_rng_uniform instead of gsl_rng_get
// // RandomnessDelegate.h // jdemon // // Created by Mark Larus on 3/19/13. // Copyright (c) 2013 Kenyon College. All rights reserved. // #ifndef __jdemon__RandomnessDelegate__ #define __jdemon__RandomnessDelegate__ #include <gsl/gsl_rng.h> #include <stdexcept> namespace Randomness { class Delegate { pr...
// // RandomnessDelegate.h // jdemon // // Created by Mark Larus on 3/19/13. // Copyright (c) 2013 Kenyon College. All rights reserved. // #ifndef __jdemon__RandomnessDelegate__ #define __jdemon__RandomnessDelegate__ #include <gsl/gsl_rng.h> #include <stdexcept> namespace Randomness { class Delegate { pr...
Mark a test as unsupported on darwin.
// RUN: %clang_cfi -lm -o %t1 %s // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s // This test uses jump tables containing PC-relative references to external // symbols, which the Mach-O object writer does not currently support. // XFAIL: darwin #include <s...
// RUN: %clang_cfi -lm -o %t1 %s // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s // This test uses jump tables containing PC-relative references to external // symbols, which the Mach-O object writer does not currently support. // The test passes on i386 Da...
Add example for help output
#include <argparse.h> #include <stdio.h> int main(int argc, char **argv) { args *args = args_new(); args_add_option(args, option_new("f", "feature", "description of feature")); args_help(args, stdout); args_free(args); }
Add flags to stage Skia API changes
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
Add flag to stage api change
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
Remove texts for unserstanding to Wiki pages
#ifndef GPIOLIB_H #define GPIOLIB_H #define FORWARD 1 #define BACKWARD 0 namespace GPIO { int init(); //direction is either FORWARD or BACKWARD. speed can be an integer ranging from 0 to 100. int controlLeft(int direction,int speed); int controlRight(int direction,int speed); int stopLeft(); int stopRight(); ...
#ifndef GPIOLIB_H #define GPIOLIB_H #define FORWARD 1 #define BACKWARD 0 namespace GPIO { int init(); int controlLeft(int direction,int speed); int controlRight(int direction,int speed); int stopLeft(); int stopRight(); int resetCounter(); void getCounter(int *countLeft,int *countRight); int turnTo(int an...
Change uuid to char* from int for Windows
/* $Id: wUuid.h,v 1.1.2.2 2012/03/20 11:15:17 emmapollock Exp $ * * OpenMAMA: The open middleware agnostic messaging API * Copyright (C) 2011 NYSE Inc. * * 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...
/* $Id: wUuid.h,v 1.1.2.2 2012/03/20 11:15:17 emmapollock Exp $ * * OpenMAMA: The open middleware agnostic messaging API * Copyright (C) 2011 NYSE Inc. * * 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...
Maintain the legacy behavior for WebP loop count
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_TEST_UTILS 1 #define SK_BUILD_FOR_ANDROID_FRAMEWORK #define SK_DEFAULT_FONT_CACHE_LIMIT ...
Add prototypes of response-building functions
#define _SLAVEREGISTERS #include <inttypes.h> //Functions needed from other modules extern void MODBUSBuildException( uint8_t, uint8_t ); //Functions for parsing requests extern void MODBUSParseRequest03( union MODBUSParser *Parser ); extern void MODBUSParseRequest06( union MODBUSParser *Parser ); extern void MODBUS...
#define _SLAVEREGISTERS #include <inttypes.h> //Functions needed from other modules extern void MODBUSBuildException( uint8_t, uint8_t ); //Functions for parsing requests extern void MODBUSParseRequest03( union MODBUSParser *Parser ); extern void MODBUSParseRequest06( union MODBUSParser *Parser ); extern void MODBUS...
Remove unused include of <vector>
/************************************************* * Configuration Handling Header File * * (C) 1999-2007 Jack Lloyd * *************************************************/ #ifndef BOTAN_POLICY_CONF_H__ #define BOTAN_POLICY_CONF_H__ #include <botan/mutex.h> #include <string> #include <v...
/************************************************* * Configuration Handling Header File * * (C) 1999-2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_POLICY_CONF_H__ #define BOTAN_POLICY_CONF_H__ #include <botan/mutex.h> #include <string> #include <m...
Add CRC16 checksum calculation function
#include "modlib.h" uint16_t MODBUSSwapEndian( uint16_t Data ) { //Change big-endian to little-endian and vice versa unsigned char Swap; //Create 2 bytes long union union Conversion { uint16_t Data; unsigned char Bytes[2]; } Conversion; //Swap bytes Conversion.Data = Data; ...
#include "modlib.h" uint16_t MODBUSSwapEndian( uint16_t Data ) { //Change big-endian to little-endian and vice versa unsigned char Swap; //Create 2 bytes long union union Conversion { uint16_t Data; unsigned char Bytes[2]; } Conversion; //Swap bytes Conversion.Data = Data; ...
Fix header methods to be inline
#ifndef _INC_UTILS_H #define _INC_UTILS_H #include "basetypes.h" void *advancePtr(void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } const void *advancePtr(const void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } #endif//_INC_UTILS_H
#ifndef _INC_UTILS_H #define _INC_UTILS_H #include "basetypes.h" inline void *advancePtr(void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } inline const void *advancePtr(const void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } #endif//_INC_UTILS_H
Fix the handling of signedness, which caused a nasty bug
/* Bernstein's hash */ int djb_hash(const char* str, int len, int hash) { while (len--) { hash = (hash * 33) ^ *str++; } return hash; }
/* Bernstein's hash */ int djb_hash(const unsigned char* str, int len, int hash) { while (len--) { hash = (hash * 33) ^ *str++; } return hash; }
Document where our hash function comes from
int hashByteString(const char* str, int len) { int hash = 0; while (len--) { hash = (hash * 33) ^ *str++; } return hash; }
/* Bernstein's hash */ int hashByteString(const char* str, int len) { int hash = 0; while (len--) { hash = (hash * 33) ^ *str++; } return hash; }
Fix comment in header guard.
/* libcopy -- journal support * (c) 2011 Michał Górny * 2-clause BSD-licensed */ #pragma once #ifndef _ATOMIC_INSTALL_JOURNAL_H #define _ATOMIC_INSTALL_JOURNAL_H typedef struct ai_journal *journal_t; int ai_journal_create(const char *journal_path, const char *location); int ai_journal_open(const char *journal_pa...
/* libcopy -- journal support * (c) 2011 Michał Górny * 2-clause BSD-licensed */ #pragma once #ifndef _ATOMIC_INSTALL_JOURNAL_H #define _ATOMIC_INSTALL_JOURNAL_H typedef struct ai_journal *journal_t; int ai_journal_create(const char *journal_path, const char *location); int ai_journal_open(const char *journal_pa...
Use strlen instead of sizeof
#include <openssl/aes.h> #include <openssl/rand.h> #include <stdio.h> #include <string.h> #include "crypt.h" typedef unsigned char aes_t; void generate_bytes(aes_t *buf) { if (!RAND_bytes(buf, sizeof(buf))) { fprintf(stderr, "[!] Could not generate key"); } } aes_t *encrypt(char *plaintext, aes_t *k...
#include <openssl/aes.h> #include <openssl/rand.h> #include <stdio.h> #include <string.h> #include "crypt.h" typedef unsigned char aes_t; void generate_bytes(aes_t *buf) { if (!RAND_bytes(buf, sizeof(buf))) { fprintf(stderr, "[!] Could not generate key"); } } aes_t *encrypt(char *plaintext, aes_t *k...
Change parent of QFAppScriptDispatcherWrapper from QQuickItem to QObject
#ifndef QFAPPSCRIPTDISPATCHERWRAPPER_H #define QFAPPSCRIPTDISPATCHERWRAPPER_H #include <QQuickItem> #include <QPointer> #include "qfappdispatcher.h" class QFAppScriptDispatcherWrapper : public QQuickItem { Q_OBJECT public: QFAppScriptDispatcherWrapper(); QString type() const; void setType(const QStri...
#ifndef QFAPPSCRIPTDISPATCHERWRAPPER_H #define QFAPPSCRIPTDISPATCHERWRAPPER_H #include <QQuickItem> #include <QPointer> #include "qfappdispatcher.h" class QFAppScriptDispatcherWrapper : public QObject { Q_OBJECT public: QFAppScriptDispatcherWrapper(); QString type() const; void setType(const QString ...
Add file testing all forms of for loop
int sum = 0; void test_sum(){ if(sum == 45) printf("Ok!\n"); else printf("Wrong!\n"); sum = 0; } int main(){ int x; for(int x; x < 10; x++) sum += x; test_sum(); for(x = 0; x < 10; x++) sum += x; test_sum(); x = 0; for(;...
Allow .exe extension to ld to fix test with mingw.
// REQUIRES: clang-driver // REQUIRES: powerpc-registered-target // REQUIRES: nvptx-registered-target // // Verify that CUDA device commands do not get OpenMP flags. // // RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \ // RUN: | ...
// REQUIRES: clang-driver // REQUIRES: powerpc-registered-target // REQUIRES: nvptx-registered-target // // Verify that CUDA device commands do not get OpenMP flags. // // RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \ // RUN: | ...
Switch MACHINE to "pc98" on FreeBSD/pc98. Add copyright.
/*- * This file is in the public domain. */ /* $FreeBSD$ */ #include <i386/param.h>
/*- * Copyright (c) 2005 TAKAHASHI Yoshihiro. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list o...
Add missing 'empty' test program.
/* ==================================================================== Copyright (c) 2008 Ian Blumel. All rights reserved. This software is licensed as described in the file LICENSE, which you should have received as part of this distribution. ==================================================================== File...
Fix helpFindSign (floats don't have signs....)
#ifndef HELPER_H #define HELPER_H /*Helper function for calculating ABSOLUTE maximum of two floats Will return maximum absolute value (ignores sign) */ float helpFindMaxAbsFloat(float a, float b) { float aAbs = abs(a); float bAbs = abs(b); if (aAbs > bAbs) { return aAbs; } else { return bAbs; } } //Helper ...
#ifndef HELPER_H #define HELPER_H /*Helper function for calculating ABSOLUTE maximum of two floats Will return maximum absolute value (ignores sign) */ float helpFindMaxAbsFloat(float a, float b) { float aAbs = abs(a); float bAbs = abs(b); if (aAbs > bAbs) { return aAbs; } else { return bAbs; } } //Helper ...
Test we work with other, more complex types.
#include <stdio.h> #define SWAP(x, y) { \ typeof (x) tmp = y; \ y = x; \ x = tmp; \ } int main() { int a = 1; int b = 2; SWAP(a, b); printf("a: %d, b: %d\n", a, b); return 0; }
#include <stdio.h> #define SWAP(x, y) { \ typeof (x) tmp = y; \ y = x; \ x = tmp; \ } int main() { int a = 1; int b = 2; SWAP(a, b); printf("a: %d, b: %d\n", a, b); float arr[2] = {3.0, 4.0}; SWAP(arr[0], arr[1]); printf("arr[0]: ...
Create the display, free it at the end, exit with failure if the display doesn't open
/** * Phase 01 - Get a Window that works and can be closed. * * This code won't be structured very well, just trying to get stuff working. */ #include <stdlib.h> int main(int argc, char *argv[]) { return EXIT_SUCCESS; }
/** * Phase 01 - Get a Window that works and can be closed. * * This code won't be structured very well, just trying to get stuff working. */ #include <stdlib.h> #include <X11/Xlib.h> int main(int argc, char *argv[]) { Display *dpy = XOpenDisplay(NULL); if (dpy == NULL) { return EXIT_FAILURE; } XClos...
Disable warnings about insecure functions
// Copyright 2012-2014 UX Productivity Pty Ltd // // 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 ...
// Copyright 2012-2014 UX Productivity Pty Ltd // // 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 ...
Fix issue with mock method.
#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #define TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #include "gmock/gmock.h" #include "lib/queue_interface.h" namespace tachyon { namespace testing { // Mock class for queues. template <class T> class MockQueue : public QueueInterface<T> { public: MOCK_METHOD1_T(Enqueue, bool(const ...
#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #define TACHYON_TEST_UTILS_MOCK_QUEUE_H_ #include "gmock/gmock.h" #include "lib/queue_interface.h" namespace tachyon { namespace testing { // Mock class for queues. template <class T> class MockQueue : public QueueInterface<T> { public: MOCK_METHOD1_T(Enqueue, bool(const ...
Fix typo in empty struct test check
// RUN: %layout_check %s // RUN: %check %s struct A { }; // CHEKC: /warning: empty struct/ struct Containter { struct A a; }; struct Pre { int i; struct A a; int j; }; struct Pre p = { 1, /* warn */ 2 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct Pre q = { 1, {}, 2 }; main() { struct ...
// RUN: %layout_check %s // RUN: %check %s struct A { }; // CHECK: /warning: empty struct/ struct Container { struct A a; }; struct Pre { int i; struct A a; int j; }; struct Pre p = { 1, /* warn */ 2 }; // CHECK: /warning: missing {} initialiser for empty struct/ struct Pre q = { 1, {}, 2 }; main() { struct A...
Add missing egl pipe file
#include "target-helpers/inline_wrapper_sw_helper.h" #include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i915/drm/i915_drm_public.h" #include "i915/i915_public.h" static struct pipe_screen * create_screen(int fd) { struct brw_winsys_screen *bws; struct pipe_screen *sc...
Remove unnecessary default constructor from KytheProtoOutput
// Copyright 2017-2020 The Verible Authors. // // 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 o...
// Copyright 2017-2020 The Verible Authors. // // 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 o...
Split out get_offset(). Eliminated unnecessary call to strlen().
// Copyright 2016, Jeffrey E. Bedard #include "temperature.h" #include "config.h" #include "font.h" #include "util.h" #include <stdio.h> #include <string.h> // Returns x offset for next item uint16_t draw_temp(xcb_connection_t * xc, const uint16_t offset) { const uint8_t v = xstatus_system_value(XSTATUS_SYSFILE_TEMP...
// Copyright 2016, Jeffrey E. Bedard #include "temperature.h" #include "config.h" #include "font.h" #include "util.h" #include <stdio.h> static uint16_t get_offset(const uint16_t fw, const uint16_t offset, const uint8_t len) { return fw * len + offset + XSTATUS_CONST_WIDE_PAD + XSTATUS_CONST_PAD; } // Returns x off...
Make error domain constants mirror app return codes
// // CDZThingsHubErrorDomain.h // thingshub // // Created by Chris Dzombak on 1/14/14. // Copyright (c) 2014 Chris Dzombak. All rights reserved. // #import "CDZThingsHubApplication.h" extern NSString * const kThingsHubErrorDomain; typedef NS_ENUM(NSInteger, CDZErrorCode) { CDZErrorCodeConfigurationValidatio...
// // CDZThingsHubErrorDomain.h // thingshub // // Created by Chris Dzombak on 1/14/14. // Copyright (c) 2014 Chris Dzombak. All rights reserved. // #import "CDZThingsHubApplication.h" extern NSString * const kThingsHubErrorDomain; typedef NS_ENUM(NSInteger, CDZErrorCode) { CDZErrorCodeTestError = 0, CDZ...
Use the class property instead of getter method
// // IRLSizePrivate.h // IRLSize // // Created by Jeff Kelley on 6/29/16. // Copyright © 2016 Detroit Labs. All rights reserved. // #ifndef IRLSizePrivate_h #define IRLSizePrivate_h typedef float RawLengthMeasurement; // meters typedef struct { RawLengthMeasurement width; RawLengthMeasurement height; } ...
// // IRLSizePrivate.h // IRLSize // // Created by Jeff Kelley on 6/29/16. // Copyright © 2016 Detroit Labs. All rights reserved. // #ifndef IRLSizePrivate_h #define IRLSizePrivate_h typedef float RawLengthMeasurement; // meters typedef struct { RawLengthMeasurement width; RawLengthMeasurement height; } ...
Allow debug messages using GMATHML_DEBUG environment variable.
#include <gdomdebug.h> #include <glib/gprintf.h> static gboolean debug_enabled = FALSE; void gdom_debug (char const *format, ...) { va_list args; if (!debug_enabled) return; va_start (args, format); g_vprintf (format, args); g_printf ("\n"); va_end (args); } void gdom_debug_enable (void) { debug_enabled =...
#include <gdomdebug.h> #include <glib/gprintf.h> #include <stdlib.h> static gboolean debug_checked = FALSE; static gboolean debug_enabled = FALSE; static gboolean _is_debug_enabled () { const char *debug_var; if (debug_checked) return debug_enabled; debug_var = g_getenv ("GMATHML_DEBUG"); debug_enabled = deb...
Clean it up so it compiles cleanly and works for REMOTE_ONLY case.
/* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of libunwind. Copyright (c) 2003 Hewlett-Packard Co. Permission is hereby granted, free of charge, to any person obtaining a copy of this software a...
Add space between date and time
#pragma once #include <string> #if 0 int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } int Strnicmp(const char* str1, const char* str2, int count) { int d = 0; while (count > 0 && (d = toupper(*str2) - toupper...
#pragma once #include <string> #if 0 int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } int Strnicmp(const char* str1, const char* str2, int count) { int d = 0; while (count > 0 && (d = toupper(*str2) - toupper...
Add bye to exit words
#include "input.h" #include <ctype.h> #include <stdio.h> #include <string.h> void read_line(char *p) { if (fgets(p, MAX_SIZE, stdin) == NULL){ p[0] = '\0'; return; } remove_space(p); } int is_exit(const char* p) { const char* exit_words[] = { "exit", "quit", }; ...
#include "input.h" #include <ctype.h> #include <stdio.h> #include <string.h> void read_line(char *p) { if (fgets(p, MAX_SIZE, stdin) == NULL){ p[0] = '\0'; return; } remove_space(p); } int is_exit(const char* p) { const char* exit_words[] = { "exit", "quit", "b...
Modify : doc for color
// // UIColor+Speed.h // LYCategory // // CREATED BY LUO YU ON 26/10/2016. // COPYRIGHT © 2016 LUO YU. ALL RIGHTS RESERVED. // #import <UIKit/UIKit.h> @interface UIColor (Speed) - (UIColor *)colorWithR:(CGFloat)redValue G:(CGFloat)greenValue B:(CGFloat)blueValue; @end
// // UIColor+Speed.h // LYCategory // // CREATED BY LUO YU ON 26/10/2016. // COPYRIGHT © 2016 LUO YU. ALL RIGHTS RESERVED. // #import <UIKit/UIKit.h> @interface UIColor (Speed) /** generate color object with red-green-blue values @param redValue red color value, 0~255 @param greenValue green color value, 0~...
Print grey pixel value as unsigned
#include <stdio.h> #include "stb_image.c" #define FILENAME "wikipedia_barcode.png" int main(int argc, char **argv) { int width, height, bytes_per_pixel; unsigned char *data = stbi_load(FILENAME, &width, &height, &bytes_per_pixel, STBI_default); if (data) { // Run through every pixel and print its greyscal...
#include <stdio.h> #include "stb_image.c" #define FILENAME "wikipedia_barcode.png" int main(int argc, char **argv) { int width, height, bytes_per_pixel; unsigned char *data = stbi_load(FILENAME, &width, &height, &bytes_per_pixel, STBI_default); if (data) { // Run through every pixel and print its greyscal...
Add include guard to fix wincon compile.
/* PDCurses */ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ #endif #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ #endif #if defined(PDC_WIDE) && !defined(...
/* PDCurses */ #ifndef __PDC_WIN_H__ #define __PDC_WIN_H__ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ #endif #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings ...
Fix MISRA rule 8.5 in common code
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef BL2_H__ #define BL2_H__ struct entry_point_info; void bl2_main(void); struct entry_point_info *bl2_load_images(void); #endif /* BL2_H__ */
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef BL2_H__ #define BL2_H__ void bl2_main(void); #endif /* BL2_H__ */
Increase read and write buffer size per peer.
#ifndef CJET_CONFIG_H #define CJET_CONFIG_H #define SERVER_PORT \ 11122 #define LISTEN_BACKLOG \ 40 /* * It is somehow beneficial if this size is 32 bit aligned. */ #define MAX_MESSAGE_SIZE \ 256 /* Linux specific configs */ #define MAX_EPOLL_EVENTS \ 100 #endif
#ifndef CJET_CONFIG_H #define CJET_CONFIG_H #define SERVER_PORT \ 11122 #define LISTEN_BACKLOG \ 40 /* * It is somehow beneficial if this size is 32 bit aligned. */ #define MAX_MESSAGE_SIZE \ 512 /* Linux specific configs */ #define MAX_EPOLL_EVENTS \ 100 #endif
Fix recent test for more diverse environments.
// REQUIRES: arm-registered-target // RUN: %clang -target thumbv7-none-linux-gnueabihf \ // RUN: -mcpu=cortex-a8 -mfloat-abi=hard \ // RUN: -O3 -S -emit-llvm -o - %s | FileCheck %s #include <arm_neon.h> float32x2_t test_fma_order(float32x2_t accum, float32x2_t lhs, float32x2_t rhs) { return vfma_f32(accum, lhs,...
// REQUIRES: arm-registered-target // RUN: %clang_cc1 -triple thumbv7-none-linux-gnueabihf \ // RUN: -target-abi aapcs \ // RUN: -target-cpu cortex-a8 \ // RUN: -mfloat-abi hard \ // RUN: -ffreestanding \ // RUN: -O3 -S -emit-llvm -o - %s | FileCheck %s #include <arm_neon.h> float32x2_t test_fma_order(float...
Fix license statement in header comment and add SPDS identifier
#ifndef _TESTUTILS_H #define _TESTUTILS_H /* * tslib/tests/testutils.h * * Copyright (C) 2004 Michael Opdenacker <michaelo@handhelds.org> * * This file is placed under the LGPL. * * * Misc utils for ts test programs */ #define RESET "\033[0m" #define RED "\033[31m" #define GREEN "\033[32m" #define B...
#ifndef _TESTUTILS_H #define _TESTUTILS_H /* * tslib/tests/testutils.h * * Copyright (C) 2004 Michael Opdenacker <michaelo@handhelds.org> * * This file is placed under the GPL. * * SPDX-License-Identifier: GPL-2.0+ * * * Misc utils for ts test programs */ #define RESET "\033[0m" #define RED "\033[31...
Add boolean type so yacc productions can return a boolean value. Add parameter mode type so we can tag parameters as IN, OUT, or BOTH.
#define FUNC 1 #define PARAM 2 #define PTR_PARAM 3 struct token { int tok_type; char *val; }; struct node { int node_type; char *type_name; char *id; int is_ptr; int is_const; int is_mapped; int is_array; int extract; struct node *next; struct node *prev; }; union yystype { struct token tok; ...
#define FUNC 1 #define PARAM 2 #define PTR_PARAM 3 struct token { int tok_type; char *val; }; struct node { int node_type; char *type_name; char *id; int is_ptr; int is_const; int is_const_ptr; int is_mapped; int is_array; int in_param; int out_param; int extract; struct node *next; struct ...
Add test case for PR2001.
// RUN: clang --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t && // RUN: grep "ret i32" %t | count 1 && // RUN: grep "ret i32 1" %t | count 1 // PR2001 /* Test that the result of the assignment properly uses the value *in the bitfield* as opposed to the RHS. */ static int foo(int i) { struct { ...
Fix linker warnings in rendering tests
/*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $ Version: $Revision: 21985 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Inf...
/*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $ Version: $Revision: 21985 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Inf...
Use 0-padding for i386 and arm print format specifiers
#include <stdio.h> #include <stdarg.h> void print_address(const char *str, int n, ...) { fprintf(stderr, "%s", str); va_list ap; va_start(ap, n); while (n--) { void *p = va_arg(ap, void *); #if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) // On FreeBSD, the %p conversion specif...
#include <stdio.h> #include <stdarg.h> void print_address(const char *str, int n, ...) { fprintf(stderr, "%s", str); va_list ap; va_start(ap, n); while (n--) { void *p = va_arg(ap, void *); #if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) // On FreeBSD, the %p conversion specif...
Fix this test so it doesn't try to open a file to write to the source tree
// RUN: not %clang_cc1 -emit-llvm %s -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s // CHECK: error: Could not read profile: // CHECK-NOT: Assertion failed
// RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s // CHECK: error: Could not read profile: // CHECK-NOT: Assertion failed
Switch to use MICROPY_FLOAT_IMPL config define.
// options to control how Micro Python is built #define MICROPY_EMIT_CPYTHON (1) #define MICROPY_ENABLE_LEXER_UNIX (1) #define MICROPY_ENABLE_FLOAT (1) // type definitions for the specific machine #ifdef __LP64__ typedef long machine_int_t; // must be pointer size typedef unsigned long machine_uint_t...
// options to control how Micro Python is built #define MICROPY_EMIT_CPYTHON (1) #define MICROPY_ENABLE_LEXER_UNIX (1) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) // type definitions for the specific machine #ifdef __LP64__ typedef long machine_int_t; // must be pointer size typedef unsi...
Add `isEqualToFirebaseModel:` to public header
// // Created by Michael Kuck on 7/7/16. // Copyright (c) 2016 Michael Kuck. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @class FIRDatabaseReference; @class FIRDataSnapshot; //============================================================ //== Public Interface //=================...
// // Created by Michael Kuck on 7/7/16. // Copyright (c) 2016 Michael Kuck. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @class FIRDatabaseReference; @class FIRDataSnapshot; //============================================================ //== Public Interface //=================...
Put states inside the class
/**************************************************************************** * Copyright 2016 BlueMasters * * 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...
/**************************************************************************** * Copyright 2016 BlueMasters * * 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...
Remove redundant void argument lists
#ifndef __itkImageFilterMultipleOutputs_h #define __itkImageFilterMultipleOutputs_h #include "itkImageToImageFilter.h" namespace itk { template <class TImage> class ImageFilterMultipleOutputs : public ImageToImageFilter<TImage, TImage> { public: /** Standard class type alias. */ using Self = ImageFilterMultipleOu...
#ifndef __itkImageFilterMultipleOutputs_h #define __itkImageFilterMultipleOutputs_h #include "itkImageToImageFilter.h" namespace itk { template <class TImage> class ImageFilterMultipleOutputs : public ImageToImageFilter<TImage, TImage> { public: /** Standard class type alias. */ using Self = ImageFilterMultipleOu...
Add allclose function for testing
#pragma once #include <string> #include <sstream> #include <Eigen/Dense> std::string output_matrices(Eigen::MatrixXd expected, Eigen::MatrixXd actual) { std::stringstream ss; ss << "expected:\n" << expected << "\nactual:\n" << actual << std::endl; return ss.str(); }
#pragma once #include <string> #include <sstream> #include <Eigen/Dense> std::string output_matrices(Eigen::MatrixXd expected, Eigen::MatrixXd actual) { std::stringstream ss; ss << "expected:\n" << expected << "\nactual:\n" << actual << std::endl; return ss.str(); } /* * allclose() function to match nump...
Add an example of M_LET_IF
#include "m-core.h" // Stubs defined for the example. Real code will use soundio library. struct SoundIo { int x; }; struct SoundIoDevice { int x; }; struct SoundIoOutStream { int x; }; static struct SoundIo *soundio_create(void) { return (struct SoundIo *) malloc(sizeof(struct SoundIo)); } static void soundio_destro...
Fix for particle firmware v0.6.2
#include "application.h" #ifndef _INCL_MDNS #define _INCL_MDNS #include "Buffer.h" #include "Label.h" #include "Record.h" #include <map> #include <vector> #define MDNS_PORT 5353 #define BUFFER_SIZE 512 #define HOSTNAME "" class MDNS { public: bool setHostname(String hostname); bool addService(String protocol...
#include "application.h" #ifndef _INCL_MDNS #define _INCL_MDNS #include "Buffer.h" #include "Label.h" #include "Record.h" #include <map> #include <vector> #define MDNS_PORT 5353 #define BUFFER_SIZE 512 #define HOSTNAME "" class MDNS { public: bool setHostname(String hostname); bool addService(String protocol...
Add a test for caching an empty string
#include <string.h> #include "lib/minunit.h" #include "acacia.h" //#define TEST_KEY "abcd1111" #define TEST_KEY "abcdefghijklmnopqrstuvwxyz" #define TEST_VALUE "foo_bar_baz_111" MU_TEST(test_check) { struct Node *cache = cache_init(); cache_set(TEST_KEY, TEST_VALUE, cache); mu_check(strcmp(cache_get(TEST_KEY, cac...
#include <string.h> #include "lib/minunit.h" #include "acacia.h" #define TEST_KEY "abcdefghijklmnopqrstuvwxyz" #define TEST_VALUE "foo_bar_baz_111" MU_TEST(test_store_fetch_simple) { struct Node *cache = cache_init(); cache_set(TEST_KEY, TEST_VALUE, cache); mu_check(strcmp(cache_get(TEST_KEY, cache), TEST_VALUE) ...
Fix below warning by including "unistd.h" also
#include <signal.h> #include <stdio.h> #include <errno.h> #include <string.h> // Invokes a process, making sure that the state of the signal // handlers has all been set back to the unix default. int main(int argc, char **argv) { int i; sigset_t blockedsigs; struct sigaction action; // unblock all sig...
#include <signal.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> // Invokes a process, making sure that the state of the signal // handlers has all been set back to the unix default. int main(int argc, char **argv) { int i; sigset_t blockedsigs; struct sigaction action; ...
Remove getPlantName metohod & Add getPlant mathod
#ifndef LAND_H #define LAND_H #include <string> #include "Plant.h" class Land { public: ~Land(); const std::string getPlantName() const { return isStood_? plant_->getName() : "Empty"; } bool put(Plant & plant); bool getStood()const{return isStood_;} private: Plant * plant_ = nullptr; bool isStood...
#ifndef LAND_H #define LAND_H #include <string> #include "Plant.h" class Land { public: ~Land(); bool put(Plant & plant); bool getStood()const{return isStood_;} Plant & getPlant() { return *plant_; } const Plant & getPlant() const { return *plant_; } private: Plant * plant_ = nullptr; bool isStood_ =...
Define ODP_THREAD_WORKER and ODP_THREAD_CONTROL as in it's original enum, instead of mangling them.
/* Copyright (c) 2015, ENEA Software AB * Copyright (c) 2015, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __OFP_ODP_COMPAT__ #define __OFP_ODP_COMPAT__ #if ODP_VERSION == 102 #include "linux.h" #else #include "odp/helper/linux.h" #endif /* odp_version == 102 */ #if ODP_...
/* Copyright (c) 2015, ENEA Software AB * Copyright (c) 2015, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __OFP_ODP_COMPAT__ #define __OFP_ODP_COMPAT__ #if ODP_VERSION == 102 #include "linux.h" #else #include "odp/helper/linux.h" #endif /* odp_version == 102 */ #if ODP_...
Add conditional definition of PyMPI_MPI_Message and MPI_Message PyMPI_MPI_Message. This is needed for MPI_VERSION<3 and a recent version of mpi4py.
/***** Preamble block ********************************************************* * * This file is part of h5py, a Python interface to the HDF5 library. * * http://www.h5py.org * * Copyright 2008-2013 Andrew Collette and contributors * * License: Standard 3-clause BSD; see "license.txt" for full license terms * ...
/***** Preamble block ********************************************************* * * This file is part of h5py, a Python interface to the HDF5 library. * * http://www.h5py.org * * Copyright 2008-2013 Andrew Collette and contributors * * License: Standard 3-clause BSD; see "license.txt" for full license terms * ...
Use correct syntax, correct weak/strong for [__]strxfrm
/* * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #define L_strlcpy #define Wstrlcpy __strlcpy #include "wstring.c" strong_alias(__strlcpy, strlcpy) #ifdef __LOCALE_C_ONLY weak_alias(strlcpy, strxfrm) #endif #undef L_...
/* * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #define L_strlcpy #define Wstrlcpy __strlcpy #include "wstring.c" strong_alias(__strlcpy, strlcpy) #ifdef __LOCALE_C_ONLY weak_alias(__strlcpy, __strxfrm) strong_alias(...
Fix open() syscall in libk
#include <fcntl.h> #include <k/sys.h> int open(const char *path, int oflag, ...) { return MAKE_SYSCALL(open, path, oflag); } int fcntl(int fildes, int cmd, ...) { //FIXME for bash return MAKE_SYSCALL(unimplemented, "fcntl", false); }
#include <fcntl.h> #include <stdarg.h> #include <k/sys.h> int open(const char *path, int oflag, ...) { int mode = 0; if(oflag & O_CREAT) { va_list va; va_start(va, oflag); mode = va_arg(va, int); va_end(va); } return MAKE_SYSCALL(open, path, oflag, mode); } int fcntl(in...
Fix reference typed reply placeholder
// Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ #define BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ #import <Foundation/Foundation.h> #include <string> #include "base/mac/scoped...
// Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ #define BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ #import <Foundation/Foundation.h> #include <string> #include "base/mac/scoped...
Include float.h if present before defining math stuff
#ifndef AL_MATH_DEFS_H #define AL_MATH_DEFS_H #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f) #define F_TAU (6.28318530717958647692f) #ifndef FLT_EPSILON #define FLT_EPSILON (1.19209290e-07f) #endif #define DEG2RAD(x) ((ALfloat)(x) * (F_PI/180.0f)) #define RAD2DEG(x) ((ALfloat...
#ifndef AL_MATH_DEFS_H #define AL_MATH_DEFS_H #ifdef HAVE_FLOAT_H #include <float.h> #endif #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f) #define F_TAU (6.28318530717958647692f) #ifndef FLT_EPSILON #define FLT_EPSILON (1.19209290e-07f) #endif #define DEG2RAD(x) ((ALfloat)(x)...
Add missing header for -lh5- decoder.
/* Copyright (c) 2011, Simon Howard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIE...
Replace cast by safer access
/* 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://mozilla.org/MPL/2.0/. */ #include <haka/error.h> #include <haka/regexp_module.h> struct regexp_module *regexp_module_load(const char *modu...
/* 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://mozilla.org/MPL/2.0/. */ #include <haka/error.h> #include <haka/regexp_module.h> struct regexp_module *regexp_module_load(const char *modu...
Clean up the tickable definition.
// itickable.h // // Interface definition of an object that is updated during the tick cycle. // #ifndef DEMO_ITICKABLE_H #define DEMO_ITICKABLE_H namespace demo { namespace obj { class ITickable { public: // CONSTRUCTORS ~ITickable(); // MEMBER FUNCTIONS /** * Prepare for the next tick cycle...
// itickable.h // // Interface definition of an object that is updated during the tick cycle. // #ifndef DEMO_ITICKABLE_H #define DEMO_ITICKABLE_H namespace demo { namespace obj { class ITickable { public: // CONSTRUCTORS /** * Destruct the tickable. */ ~ITickable(); // MEMBER FUNCTIONS ...
Add an important info. for scatter datasource
@import UIKit; @protocol HYPScatterPlotDataSource; @class HYPScatterPoint; @class HYPScatterLabel; @interface HYPScatterPlot : UIView @property (nonatomic) UIColor *averageLineColor; @property (nonatomic) UIColor *xAxisColor; @property (nonatomic) UIColor *yAxisMidGradient; @property (nonatomic) UIColor *yAxisEndGr...
@import UIKit; @protocol HYPScatterPlotDataSource; @class HYPScatterPoint; @class HYPScatterLabel; @interface HYPScatterPlot : UIView @property (nonatomic) UIColor *averageLineColor; @property (nonatomic) UIColor *xAxisColor; @property (nonatomic) UIColor *yAxisMidGradient; @property (nonatomic) UIColor *yAxisEndGr...
Add missing extern "C" statements
#ifndef FLASH_WRITER_H #define FLASH_WRITER_H #include <stdint.h> #include <stddef.h> /** Unlocks the flash for programming. */ void flash_writer_unlock(void); /** Locks the flash */ void flash_writer_lock(void); /** Erases the flash page at given address. */ void flash_writer_page_erase(void *page); /** Writes d...
#ifndef FLASH_WRITER_H #define FLASH_WRITER_H #include <stdint.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /** Unlocks the flash for programming. */ void flash_writer_unlock(void); /** Locks the flash */ void flash_writer_lock(void); /** Erases the flash page at given address. */ void flash_write...
Improve compound literal test case.
// RUN: clang -checker-simple -verify %s int* f1() { int x = 0; return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}} } int* f2(int y) { return &y; // expected-warning{{Addre...
// RUN: clang -checker-simple -verify %s int* f1() { int x = 0; return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}} } int* f2(int y) { return &y; // expected-warning{{Addre...
Remove unnecessary fields in class.
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_enableSizeButton_clicked(); private: Ui::MainWindow *ui; ...
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_enableSizeButton_clicked(); private: Ui::MainWindow *ui; ...
Fix import in private HTMLNode header
// // HTMLNode+Private.h // HTMLKit // // Created by Iska on 20/12/15. // Copyright © 2015 BrainCookie. All rights reserved. // ///------------------------------------------------------ /// HTMLKit private header ///------------------------------------------------------ #import <HTMLKit/HTMLKit.h> /** Private H...
// // HTMLNode+Private.h // HTMLKit // // Created by Iska on 20/12/15. // Copyright © 2015 BrainCookie. All rights reserved. // ///------------------------------------------------------ /// HTMLKit private header ///------------------------------------------------------ #import "HTMLNode.h" /** Private HTML Nod...
Revert "No reason for readonly properties to be retained"
// // SGFeature.h // SimpleGeo // // Created by Seth Fitzsimmons on 11/14/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "SGPoint.h" @interface SGFeature : NSObject { NSString* featureId; SGPoint* geometry; NSDictionary* properties; NSString* rawBody; } @property (reado...
// // SGFeature.h // SimpleGeo // // Created by Seth Fitzsimmons on 11/14/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "SGPoint.h" @interface SGFeature : NSObject { NSString* featureId; SGPoint* geometry; NSDictionary* properties; NSString* rawBody; } @property (retai...
Replace malloc + memset with calloc
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <util.h> #include "trie.h" #define char_index(c) c - 97 trie * trie_init(void) { trie *t = emalloc(sizeof(*t)); memset(t, 0, sizeof(*t)); t->children = emalloc(R_SIZE * sizeof(*(t->children))); memset(t->children, 0, sizeof(*(t->children))); re...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <util.h> #include "trie.h" #define char_index(c) c - 97 trie * trie_init(void) { trie *t = emalloc(sizeof(*t)); memset(t, 0, sizeof(*t)); t->children = ecalloc(R_SIZE, sizeof(*(t->children))); return t; } void trie_insert(trie *t, const char *k...
Bump Cycles version to 1.11.0 (Blender 2.81)
/* * Copyright 2011-2016 Blender Foundation * * 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 ag...
/* * Copyright 2011-2016 Blender Foundation * * 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 ag...
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...
Fix jade version of class_loader not containing class_loader.hpp
#ifndef ROS_BOOT_H #define ROS_BOOT_H /// PROJECT #include <csapex/core/bootstrap_plugin.h> #include <csapex/core/core_fwd.h> #include <csapex/model/model_fwd.h> #include <csapex/msg/msg_fwd.h> #include <csapex/view/view_fwd.h> /// SYSTEM // clang-format off #include <csapex/utility/suppress_warnings_start.h> #includ...
#ifndef ROS_BOOT_H #define ROS_BOOT_H /// PROJECT #include <csapex/core/bootstrap_plugin.h> #include <csapex/core/core_fwd.h> #include <csapex/model/model_fwd.h> #include <csapex/msg/msg_fwd.h> #include <csapex/view/view_fwd.h> /// SYSTEM // clang-format off #include <csapex/utility/suppress_warnings_start.h> #if CLA...