Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Disable secure function warnings via pragma
/*========================================================================= This file is part of the XIOT library. Copyright (C) 2008-2009 EDF R&D Author: Kristian Sons (xiot@actor3d.com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser...
/*========================================================================= This file is part of the XIOT library. Copyright (C) 2008-2009 EDF R&D Author: Kristian Sons (xiot@actor3d.com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser...
Change parent class from LinearAllocator to Allocator.
#include "LinearAllocator.h" #ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H class StackAllocator : public LinearAllocator { public: /* Allocation of real memory */ StackAllocator(const long totalSize); /* Frees all memory */ virtual ~StackAllocator(); /* Allocate virtual memory */ virtual void* Allocate(co...
#include "Allocator.h" #ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H class StackAllocator : public Allocator { protected: /* Offset from the start of the memory block */ std::size_t m_offset; public: /* Allocation of real memory */ StackAllocator(const long totalSize); /* Frees all memory */ virtual ~Stack...
Update with new lefty, fixing many bugs and supporting new features
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (...
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (...
Add the user stack module.
/* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0: * * stack_user.c * * Code which interfaces ocfs2 with fs/dlm and a userspace stack. * * Copyright (C) 2007 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of t...
Add callbacks for live query
// // AVSubscription.h // AVOS // // Created by Tang Tianyong on 15/05/2017. // Copyright © 2017 LeanCloud Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "AVQuery.h" #import "AVDynamicObject.h" NS_ASSUME_NONNULL_BEGIN @protocol AVSubscriptionDelegate <NSObject> @end @interface AVSubscri...
// // AVSubscription.h // AVOS // // Created by Tang Tianyong on 15/05/2017. // Copyright © 2017 LeanCloud Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "AVQuery.h" #import "AVDynamicObject.h" @class AVSubscription; NS_ASSUME_NONNULL_BEGIN @protocol AVSubscriptionDelegate <NSObject> - ...
Add missing Q_OBJECT to PassabilityAgent
#ifndef PASSABILITYAGENT_H #define PASSABILITYAGENT_H #include <QPointF> #include <QObject> #include "quickpather_global.h" class AbstractEntity; // Not pure abstract, because we want it to be usable in the Q_PROPERTY macro // and not force derived classes to multiply derive from it and QObject. class QUICKPATHERSH...
#ifndef PASSABILITYAGENT_H #define PASSABILITYAGENT_H #include <QPointF> #include <QObject> #include "quickpather_global.h" class AbstractEntity; // Not pure abstract, because we want it to be usable in the Q_PROPERTY macro // and not force derived classes to multiply derive from it and QObject. class QUICKPATHERSH...
Use my_sleep instead of nanosleep for portability
/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in t...
/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in t...
Fix ACPICA word-size types - u64 didn't match UINT64
#define ACPI_MACHINE_WIDTH 64 #define ACPI_SINGLE_THREADED #define ACPI_USE_LOCAL_CACHE #define ACPI_INLINE inline #define ACPI_USE_NATIVE_DIVIDE #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #ifdef ACPI_FULL_DEBUG #define ACPI_DEBUG_OUTPUT #define ACPI_DISASSEMBLER // Depends on threading support #define ACPI...
#define ACPI_MACHINE_WIDTH 64 #define ACPI_SINGLE_THREADED #define ACPI_USE_LOCAL_CACHE #define ACPI_INLINE inline #define ACPI_USE_NATIVE_DIVIDE #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #ifdef ACPI_FULL_DEBUG #define ACPI_DEBUG_OUTPUT #define ACPI_DISASSEMBLER // Depends on threading support #define ACPI...
Add virtual toString() to Matcher
#ifndef HAMCREST_MATCHER_H #define HAMCREST_MATCHER_H #include "selfdescribing.h" namespace Hamcrest { class Description; /** * A matcher over acceptable values. * A matcher is able to describe itself to give feedback when it fails. * * @see BaseMatcher */ template <typename T> class Matcher : public SelfDescr...
#ifndef HAMCREST_MATCHER_H #define HAMCREST_MATCHER_H #include "selfdescribing.h" namespace Hamcrest { class Description; /** * A matcher over acceptable values. * A matcher is able to describe itself to give feedback when it fails. * * @see BaseMatcher */ template <typename T> class Matcher : public SelfDescr...
Add missing parameter name in bd_is_plugin_available protype
#include <glib.h> #ifndef BD_LIB #define BD_LIB #include "plugins.h" #include "plugin_apis/lvm.h" gboolean bd_init (BDPluginSpec *force_plugins); gboolean bd_reinit (BDPluginSpec *force_plugins, gboolean replace); gchar** bd_get_available_plugin_names (); gboolean bd_is_plugin_available (BDPlugin); #endif /* BD_L...
#include <glib.h> #ifndef BD_LIB #define BD_LIB #include "plugins.h" #include "plugin_apis/lvm.h" gboolean bd_init (BDPluginSpec *force_plugins); gboolean bd_reinit (BDPluginSpec *force_plugins, gboolean replace); gchar** bd_get_available_plugin_names (); gboolean bd_is_plugin_available (BDPlugin plugin); #endif ...
Fix 'make distcheck' (homebrew acceptance test)
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * ht...
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * ht...
Add initial work on a commmon C interface.
#ifndef __MEMORY_ACCESS__ #define __MEMORY_ACCESS__ //TODO: File level documentations. //TODO: Define the different process_handle_t #define pid_t uint_t /** * This struct represents an error. * * error_number is the error as returned by the OS, 0 for no error. * description is a null-terminated string. **/ typ...
Use a spool directory under /tmp for testing purposes
#include <glib.h> #include <stdlib.h> #include <string.h> #include "../marquise.h" void test_init() { marquise_ctx *ctx = marquise_init("test"); g_assert_nonnull(ctx); } int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); g_test_add_func("/marquise_init/init", test_init); return g_test_run(); }
#include <glib.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include "../marquise.h" void test_init() { setenv("MARQUISE_SPOOL_DIR", "/tmp", 1); mkdir("/tmp/marquisetest", 0700); marquise_ctx *ctx = marquise_init("marquisetest"); g_assert_nonnull(ctx); } int main(int argc, char **argv) { g_t...
Set null byte in allocated data dir path
#include <stdlib.h> #include <pwd.h> #include <string.h> #include <sys/stat.h> #include <gtk/gtk.h> #include "gh-datastore.h" #include "gh-main-window.h" char * data_dir_path () { uid_t uid = getuid (); struct passwd *pw = getpwuid (uid); char *home_dir = pw->pw_dir; char *data_dir = "/.ghighlighter-c"; in...
#include <stdlib.h> #include <pwd.h> #include <string.h> #include <sys/stat.h> #include <gtk/gtk.h> #include "gh-datastore.h" #include "gh-main-window.h" char * data_dir_path () { uid_t uid = getuid (); struct passwd *pw = getpwuid (uid); char *home_dir = pw->pw_dir; char *data_dir = "/.ghighlighter-c"; in...
Remove trailing semicolons from macros
/** * @file * * @brief Some common functions operating on plugins. * * If you include this file you have full access to elektra's internals * and your test might not be ABI compatible with the next release. * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #include <tests_internal.h...
/** * @file * * @brief Some common functions operating on plugins. * * If you include this file you have full access to elektra's internals * and your test might not be ABI compatible with the next release. * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #include <tests_internal.h...
Fix include path so that make install doesn't screw it.
#include <link-grammar/link-features.h> LINK_BEGIN_DECLS void viterbi_parse(const char * sentence, Dictionary dict); LINK_END_DECLS
#include "../link-grammar/link-features.h" LINK_BEGIN_DECLS void viterbi_parse(const char * sentence, Dictionary dict); LINK_END_DECLS
Make Igor parser exception extend NSException
@interface DEIgorParserException : NSObject + (NSException *)exceptionWithReason:(NSString *)reason scanner:(NSScanner *)scanner; @end
@interface DEIgorParserException : NSException + (NSException *)exceptionWithReason:(NSString *)reason scanner:(NSScanner *)scanner; @end
Fix includes in chez022 test
#include <malloc.h> #include <string.h> typedef struct { int val; char* str; } Stuff; Stuff* mkThing() { static int num = 0; Stuff* x = malloc(sizeof(Stuff)); x->val = num++; x->str = malloc(20); strcpy(x->str,"Hello"); return x; } char* getStr(Stuff* x) { return x->str; } void f...
#include <stdlib.h> #include <stdio.h> #include <string.h> typedef struct { int val; char* str; } Stuff; Stuff* mkThing() { static int num = 0; Stuff* x = malloc(sizeof(Stuff)); x->val = num++; x->str = malloc(20); strcpy(x->str,"Hello"); return x; } char* getStr(Stuff* x) { retur...
Fix Travis for decoder tests
//!compile = {cc} {ccflags} -c -o {ofile} {infile} && {cc} {ccflags} -o {outfile} {ofile} {driver} ../libdbrew.a -I../include #include <stdio.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include "dbrew.h" int f1(int); // possible jump target int f2(int x) { return x; } int main() { // Decode...
//!compile = as -c -o {ofile} {infile} && {cc} {ccflags} -o {outfile} {ofile} {driver} ../libdbrew.a -I../include #include <stdio.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include "dbrew.h" int f1(int); // possible jump target int f2(int x) { return x; } int main() { // Decode the functio...
Add failing test without threadescape
// PARAM: --set ana.activated "['base','mallocWrapper','threadflag']" #include <pthread.h> int g = 10; void* t(void *v) { int* p = (int*) v; *p = 4711; } int main(void){ int l = 42; pthread_t tid; pthread_create(&tid, NULL, t, (void *)&l); pthread_join(tid, NULL); assert(l==42); //UNKNOWN! return 0...
FIx sound(..)modifier compaibility with old maps
#pragma once #include "augs/math/declare_math.h" #include "augs/audio/distance_model.h" struct sound_effect_modifier { // GEN INTROSPECTOR struct sound_effect_modifier real32 gain = 1.f; real32 pitch = 1.f; real32 max_distance = -1.f; real32 reference_distance = -1.f; real32 doppler_factor = 1.f; augs::distance...
#pragma once #include "augs/math/declare_math.h" #include "augs/audio/distance_model.h" struct sound_effect_modifier { // GEN INTROSPECTOR struct sound_effect_modifier real32 gain = 1.f; real32 pitch = 1.f; real32 max_distance = -1.f; real32 reference_distance = -1.f; real32 doppler_factor = 1.f; char repetitio...
Use new mul function in LabellerFrameData::project.
#ifndef SRC_FORCES_LABELLER_FRAME_DATA_H_ #define SRC_FORCES_LABELLER_FRAME_DATA_H_ #include <Eigen/Core> #include <iostream> namespace Forces { /** * \brief * * */ class LabellerFrameData { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW LabellerFrameData(double frameTime, Eigen::Matrix4f projection, ...
#ifndef SRC_FORCES_LABELLER_FRAME_DATA_H_ #define SRC_FORCES_LABELLER_FRAME_DATA_H_ #include "../eigen.h" #include <iostream> namespace Forces { /** * \brief * * */ class LabellerFrameData { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW LabellerFrameData(double frameTime, Eigen::Matrix4f projection, ...
Add fs-related structures and stub functions
/** * @file devfs_dvfs.c * @brief * @author Denis Deryugin <deryugin.denis@gmail.com> * @version 0.1 * @date 2015-09-28 */ /* This is stub */
/** * @file devfs_dvfs.c * @brief * @author Denis Deryugin <deryugin.denis@gmail.com> * @version 0.1 * @date 2015-09-28 */ #include <fs/dvfs.h> #include <util/array.h> static int devfs_destroy_inode(struct inode *inode) { return 0; } static int devfs_iterate(struct inode *next, struct inode *parent, struct di...
Make tokenized_sentence a structure (i.e., all fields public).
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If...
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If...
Add missing "expected warning". Add compound literal with empty initializer (just to test the analyzer handles it).
// 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...
Add SAFE_RZCALL to wrap calls that returns zero.
#ifndef SAFE_H #define SAFE_H #include "debug.h" #ifndef DISABLE_SAFE #define SAFE_STRINGIFY(x) #x #define SAFE_TOSTRING(x) SAFE_STRINGIFY(x) #define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": " #define SAFE_ASSERT(cond) do { \ if (!(cond)) { \ DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \ DEBUG_BREAK(!(c...
#ifndef SAFE_H #define SAFE_H #include "debug.h" #ifndef DISABLE_SAFE #define SAFE_STRINGIFY(x) #x #define SAFE_TOSTRING(x) SAFE_STRINGIFY(x) #define SAFE_AT __FILE__ ":" SAFE_TOSTRING(__LINE__) ": " #define SAFE_ASSERT(cond) do { \ if (!(cond)) { \ DEBUG_DUMP(0, "error: " SAFE_AT "%m"); \ DEBUG_BREAK(!(c...
Make parent protected so that the child can know their parents
//======================================================================= // Copyright Baptiste Wicht 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //=====================================================...
//======================================================================= // Copyright Baptiste Wicht 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //=====================================================...
Remove macros which now live in paging.h
#ifndef KMEM_H #define KMEM_H #include <stdbool.h> #include <stdint.h> #include <arch/x86/paging.h> #include <libk/kabort.h> #define KHEAP_PHYS_ROOT ((void*)0x100000) //#define KHEAP_PHYS_END ((void*)0xc1000000) #define KHEAP_END_SENTINEL (NULL) // 1 GB #define PHYS_MEMORY_SIZE (1*1024*1024*1024) #define KHEAP_BLOCK...
#ifndef KMEM_H #define KMEM_H #include <stdbool.h> #include <stdint.h> #include <arch/x86/paging.h> #include <libk/kabort.h> #define KHEAP_PHYS_ROOT ((void*)0x100000) //#define KHEAP_PHYS_END ((void*)0xc1000000) #define KHEAP_END_SENTINEL (NULL) #define KHEAP_BLOCK_SLOP 32 struct kheap_metadata { size_t size; ...
Replace BeIDE header by the Pe version
//================================================================== // MTextAddOn.h // Copyright 1996 Metrowerks Corporation, All Rights Reserved. //================================================================== // This is a proxy class used by Editor add_ons. It does not inherit from BView // but provides an ab...
// [zooey, 2005]: made MTextAddon really an abstract class //================================================================== // MTextAddOn.h // Copyright 1996 Metrowerks Corporation, All Rights Reserved. //================================================================== // This is a proxy class used by Editor add...
Fix a bug where we stomp on the : in a host:port in BK_SHOWPROC Also don't assume the socket connected.
#include "system.h" FILE * efopen(char *env) { char *t, *p; int port, sock; unless (t = getenv(env)) return (0); if (IsFullPath(t)) return (fopen(t, "a")); if ((p = strchr(t, ':')) && ((port = atoi(p+1)) > 0)) { *p = 0; sock = tcp_connect(t, port); return (fdopen(sock, "w")); } return (fopen(DEV_TTY, "w"...
#include "system.h" FILE * efopen(char *env) { char *t, *p; int port, sock; unless (t = getenv(env)) return (0); if (IsFullPath(t)) return (fopen(t, "a")); if ((p = strchr(t, ':')) && ((port = atoi(p+1)) > 0)) { *p = 0; sock = tcp_connect(t, port); *p = ':'; if (sock >= 0) return (fdopen(sock, "w")); } ...
Enable pruning losing captures in qsearch
#ifndef _CONFIG_H #define _CONFIG_H #define ENABLE_FUTILITY_DEPTH 1 // TODO: switch to at least 2 #define ENABLE_HISTORY 1 #define ENABLE_KILLERS 1 #define ENABLE_LMR 1 #define ENABLE_NNUE 0 #define ENABLE_NULL_MOVE_PRUNING 1 #define ENABLE_REVERSE_FUTILITY_DEPTH 1 // TODO: switch to at least 2 #define ENABLE_SEE_Q_...
#ifndef _CONFIG_H #define _CONFIG_H #define ENABLE_FUTILITY_DEPTH 1 // TODO: switch to at least 2 #define ENABLE_HISTORY 1 #define ENABLE_KILLERS 1 #define ENABLE_LMR 1 #define ENABLE_NNUE 0 #define ENABLE_NULL_MOVE_PRUNING 1 #define ENABLE_REVERSE_FUTILITY_DEPTH 1 // TODO: switch to at least 2 #define ENABLE_SEE_Q_...
Make the UIKit shim function properly available
//===--- UIKitOverlayShims.h ---===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See h...
//===--- UIKitOverlayShims.h ---===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See h...
Make square position and dimension accessible
#ifndef SQUARE_H_ #define SQUARE_H_ namespace flat2d { class Square { protected: int x, y, w, h; public: Square(int px, int py, int dim) : x(px), y(py), w(dim), h(dim) { } Square(int px, int py, int pw, int ph) : x(px), y(py), w(pw), h(ph) { } bool containsPoint(int, int) const; bool operator<(...
#ifndef SQUARE_H_ #define SQUARE_H_ namespace flat2d { class Square { protected: int x, y, w, h; public: Square(int px, int py, int dim) : x(px), y(py), w(dim), h(dim) { } Square(int px, int py, int pw, int ph) : x(px), y(py), w(pw), h(ph) { } bool containsPoint(int, int) const; bool operator<(...
Update wizzimote timer periph config
#ifndef PERIPH_CONF_H #define PERIPH_CONF_H #ifdef __cplusplus extern "C" { #endif /** * @brief Real Time Clock configuration */ #define RTC_NUMOF (1) #ifdef __cplusplus } #endif #endif /* PERIPH_CONF_H */
#ifndef PERIPH_CONF_H #define PERIPH_CONF_H #ifdef __cplusplus extern "C" { #endif /** * @brief Real Time Clock configuration * @{ */ #define RTC_NUMOF (1) /** @} */ /** * @brief Timer configuration * @{ */ #define TIMER_NUMOF (2U) #define TIMER_0_EN 1 #define TIMER_1_EN 1 ...
Add a header for hexagon shared library Change: 130671228
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 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 a...
Add solution to Exercise 1-2.
/* Experiment to find out what happened when printf's argument string contains * \c, where c is some character not listed above. */ #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { printf("\\a produces an audible or visual alert: \a\n"); printf("\\f produces a formfeed: \f\n"); printf(...
Add a test to make sure that we're lowering the shift amount correctly.
// RUN: %llvmgcc -mssse3 -S -o - %s | llc -mtriple=x86_64-apple-darwin | FileCheck %s #include <tmmintrin.h> int main () { #if defined( __SSSE3__ ) #define vec_rld_epi16( _a, _i ) ({ vSInt16 _t = _a; _t = _mm_alignr_epi8( _t, _t, _i ); /*return*/ _t; }) typedef int16_t vSInt16 __attribute__ ((__vector...
Fix invalid heap issues with load simulator
#include <Python.h> static PyObject * simulate_install(PyObject *self, PyObject *args) { long cpu_units; long mem_bytes; if (!PyArg_ParseTuple(args, "LL", &cpu_units, &mem_bytes)) { return NULL; } char *p; p = (char *) malloc(mem_bytes); int j = 0; for (long i = 0; i < cpu_un...
#include <Python.h> static PyObject * simulate_install(PyObject *self, PyObject *args) { long cpu_units; long mem_bytes; if (!PyArg_ParseTuple(args, "LL", &cpu_units, &mem_bytes)) { return NULL; } char *p; p = (char *) malloc(mem_bytes); int j = 0; for (long i = 0; i < cpu_un...
Add a utility method for aspect fill layouts (incomplete).
// // BCRectUtilities.h // MBTI // // Created by Seth Kingsley on 9/12/12. // Copyright (c) 2012 Bushido Coding. All rights reserved. // #import "BCMacros.h" static inline __attribute__((const)) CGRect BCRectAspectFit(CGRect containerRect, CGSize contentSize) { if (contentSize.width == 0) contentSize.width = 1...
Add : id number validation
// // NSString+Input.h // LYCategory // // Created by Rick Luo on 11/25/13. // Copyright (c) 2013 Luo Yu. All rights reserved. // #import <Foundation/Foundation.h> @interface NSString (Input) #pragma mark EMPTY - (BOOL)isEmpty; #pragma mark EMAIL - (BOOL)isEmail; #pragma mark SPACE - (NSString *)trimStartSp...
// // NSString+Input.h // LYCategory // // Created by Rick Luo on 11/25/13. // Copyright (c) 2013 Luo Yu. All rights reserved. // #import <Foundation/Foundation.h> @interface NSString (Input) #pragma mark EMPTY - (BOOL)isEmpty; #pragma mark EMAIL - (BOOL)isEmail; #pragma mark ID - (BOOL)isIDNumber; #pragma...
Update reference to IOperation to include Internal namespace
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <deque> #include <functional> #include "boost/variant.hpp" #include "task_typedefs.h" #include "internal/operation.h" namespace You { namespace DataStore { namespace UnitTests {} class Transaction; class DataStore { friend cl...
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <deque> #include <functional> #include "boost/variant.hpp" #include "task_typedefs.h" #include "internal/operation.h" namespace You { namespace DataStore { namespace UnitTests {} class Transaction; class DataStore { friend cl...
Fix typo in parser tests
#include "parser.h" #include "ast.h" #include "tests.h" void test_parse_number(); int main() { test_parse_number(); return 0; } struct token *make_token(enum token_type tk_type, char* str, double dbl, int number) { struct token *tk = malloc(sizeof(struct token)); tk->type = tk_type; if (t...
#include "parser.h" #include "ast.h" #include "tests.h" void test_parse_number(); int main() { test_parse_number(); return 0; } struct token *make_token(enum token_type tk_type, char* str, double dbl, int number) { struct token *tk = malloc(sizeof(struct token)); tk->type = tk_type; if (t...
Add a few macros to support InverterLayer on BASALT
#pragma once #include <pebble.h> #include "effects.h" //number of supported effects on a single effect_layer (must be <= 255) #define MAX_EFFECTS 4 // structure of effect layer typedef struct { Layer* layer; effect_cb* effects[MAX_EFFECTS]; void* params[MAX_EFFECTS]; uint8_t next_effect;...
#pragma once #include <pebble.h> #include "effects.h" //number of supported effects on a single effect_layer (must be <= 255) #define MAX_EFFECTS 4 // structure of effect layer typedef struct { Layer* layer; effect_cb* effects[MAX_EFFECTS]; void* params[MAX_EFFECTS]; uint8_t next_effect;...
Remove unneed inclusion of unistd.h
/* * libaacs by Doom9 ppl 2009, 2010 */ #ifndef AACS_H_ #define AACS_H_ #include <stdint.h> #include <unistd.h> #include "mkb.h" #include "../file/configfile.h" #define LIBAACS_VERSION "1.0" typedef struct aacs AACS; struct aacs { uint8_t pk[16], mk[16], vuk[16], vid[16]; uint8_t *uks; // unit ...
/* * libaacs by Doom9 ppl 2009, 2010 */ #ifndef AACS_H_ #define AACS_H_ #include <stdint.h> #include "mkb.h" #include "../file/configfile.h" #define LIBAACS_VERSION "1.0" typedef struct aacs AACS; struct aacs { uint8_t pk[16], mk[16], vuk[16], vid[16]; uint8_t *uks; // unit key array (size = 16...
Fix o_builtin_print and o_assign cases not breaking.
#include "lily_impl.h" #include "lily_symtab.h" #include "lily_opcode.h" static void builtin_print(lily_symbol *s) { if (s->val_type == vt_str) lily_impl_send_html(((lily_strval *)s->sym_value)->str); } void lily_vm_execute(lily_symbol *sym) { lily_symbol **regs; int *code, ci; regs = lily_im...
#include "lily_impl.h" #include "lily_symtab.h" #include "lily_opcode.h" static void builtin_print(lily_symbol *s) { if (s->val_type == vt_str) lily_impl_send_html(((lily_strval *)s->sym_value)->str); } void lily_vm_execute(lily_symbol *sym) { lily_symbol **regs; int *code, ci; regs = lily_im...
Fix for compiler error in r4154
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkStippleMaskFilter_DEFINED #define SkStippleMaskFilter_DEFINED #include "SkMaskFilter.h" /** * Simple MaskFilter that creates a screen door stipple pattern */ cla...
/* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkStippleMaskFilter_DEFINED #define SkStippleMaskFilter_DEFINED #include "SkMaskFilter.h" /** * Simple MaskFilter that creates a screen door stipple pattern */ cla...
Fix a bug in emulator persistent storage
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Persistence module for emulator */ #include <unistd.h> #include <stdio.h> #include <string.h> #define BUF_SIZE 1024 static void get_stora...
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Persistence module for emulator */ #include <unistd.h> #include <stdio.h> #include <string.h> #define BUF_SIZE 1024 static void get_stora...
Add missing import in umbrella header
@import Foundation; @import CoreData; FOUNDATION_EXPORT double SyncVersionNumber; FOUNDATION_EXPORT const unsigned char SyncVersionString[]; #import <Sync/SYNCPropertyMapper.h> #import <Sync/NSEntityDescription+SYNCPrimaryKey.h>
@import Foundation; @import CoreData; FOUNDATION_EXPORT double SyncVersionNumber; FOUNDATION_EXPORT const unsigned char SyncVersionString[]; #import <Sync/SYNCPropertyMapper.h> #import <Sync/NSEntityDescription+SYNCPrimaryKey.h> #import <Sync/NSManagedObject+SYNCPropertyMapperHelpers.h>
Fix return value of reevaluate in local search
#pragma once #include <cstddef> #include <utility> template <class Type, class Mut, class Eval, class Init> struct local_search { local_search(Mut &mutator, Eval &evaluator, Init &initializer) : _mutator(mutator) , _evaluator(evaluator) , _initializer(initializer) { _initializer.ap...
#pragma once #include <cstddef> #include <utility> template <class Type, class Mut, class Eval, class Init> struct local_search { local_search(Mut &mutator, Eval &evaluator, Init &initializer) : _mutator(mutator) , _evaluator(evaluator) , _initializer(initializer) { _initializer.ap...
Add convenient method to stub API responses
// // PKTStubs.h // PodioKit // // Created by Romain Briche on 30/01/14. // Copyright (c) 2014 Citrix Systems, Inc. All rights reserved. // #import <Foundation/Foundation.h> #import <OHHTTPStubs/OHHTTPStubs.h> void (^stubResponseFromFile)(NSString *, NSString *) = ^(NSString *path, NSString *responseFilename) { ...
Fix dependency generation crash test to run clang and clean up after itself.
// RUN: touch %t // RUN: chmod 0 %t // %clang -E -dependency-file bla -MT %t -MP -o %t -x c /dev/null // rdar://9286457
// RUN: touch %t // RUN: chmod 0 %t // RUN: not %clang_cc1 -E -dependency-file bla -MT %t -MP -o %t -x c /dev/null 2>&1 | FileCheck %s // RUN: rm -f %t // CHECK: error: unable to open output file // rdar://9286457
Clean up 1: Removed old comment and vs fixed some line endings.
#ifndef RPLNN_TEXTURE_H #define RPLNN_TEXTURE_H struct texture; /* Should create a version of this which doesn't malloc (basically just give memory block as a parameter). */ struct texture *texture_create(const char *file_name); void texture_destroy(struct texture **texture); /* Just create a stryct vec2_int textur...
#ifndef RPLNN_TEXTURE_H #define RPLNN_TEXTURE_H struct texture; /* Should create a version of this which doesn't malloc (basically just give memory block as a parameter). */ struct texture *texture_create(const char *file_name); void texture_destroy(struct texture **texture); void texture_get_info(struct texture *t...
Add additional nested struct redefinition test
// RUN: %ucc -fsyntax-only %s struct B { int i; }; struct Global { char *s; }; f() { struct A { int i; struct Global g; } a; struct B { int j, k; }; a.g.s = "hi"; struct B; struct B b; b.k = 3; { struct B x = { .k = 5 }; } } struct R { struct R *next; }; struct R r = { &r };
Declare size_t as unsigned long
/****************************************************************************** * Copyright (c) 2004, 2008 IBM Corporation * All rights reserved. * This program and the accompanying materials * are made available under the terms of the BSD License * which accompanies this distribution, and is available at * http:...
/****************************************************************************** * Copyright (c) 2004, 2008 IBM Corporation * All rights reserved. * This program and the accompanying materials * are made available under the terms of the BSD License * which accompanies this distribution, and is available at * http:...
Add g_autoptr() support for GParamSpec
/* * Copyright © 2015 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This libr...
/* * Copyright © 2015 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This libr...
Add solution for problem 10
/* * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. * * Find the sum of all the primes below two million. */ #include <stdio.h> #include <stdint.h> #include "euler.h" #define PROBLEM 10 int main(int argc, char **argv) { uint64_t sum = 0, number = 0; do { number++; if(is_prime(numb...
Add a return statement to spcTokenize.
#include <stdlib.h> #include <stdio.h> #include types.c #include <string.h> /* We can: Set something equal to something Function calls Function definitions Returning things -- delimiter '<' Printing things Iffing */ struct call parseCall(char* statement); struct function parseFunction(char* statemen...
#include <stdlib.h> #include <stdio.h> #include types.c #include <string.h> /* We can: Set something equal to something Function calls Function definitions Returning things -- delimiter '<' Printing things Iffing */ char* fixSpacing(char* code) { char* fixedCode = malloc(sizeof(char) * (strlen(cod...
Fix typo in message and add colors
#include <stdio.h> #include <ctype.h> #include "debug.h" #ifndef NDEBUG regex_t _comp; // Initialize the regular expression used for restricting debug output static void __attribute__ ((constructor)) premain() { if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED|REG_ICASE|REG_NOSUB)) die("mayb not a valid regexp: %s",...
#include <stdio.h> #include <ctype.h> #include "debug.h" #ifndef NDEBUG char *col[6] = { MAG, RED, YEL, CYN, BLU, GRN }; regex_t _comp; // Initialize the regular expression used for restricting debug output static void __attribute__ ((constructor)) premain() { if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED|REG_ICAS...
Use of vpiHandle requires inclusion of vpi_user.
// -*- c++ -*- /* Copyright 2019 Alain Dargelas 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...
// -*- c++ -*- /* Copyright 2019 Alain Dargelas 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...
Include vjConfig.h rather than mstring.h to get the basic_string implmentation.
#ifndef _VJ_DEVICE_INTERFACE_H_ #define _VJ_DEVICE_INTERFACE_H_ //: Base class for simplified interfaces // // Interfaces provide an easier way to access proxy objects from // within user applications. <br> <br> // // Users can simply declare a local interface variable and use it // as a smart_ptr for the proxy // //!...
#ifndef _VJ_DEVICE_INTERFACE_H_ #define _VJ_DEVICE_INTERFACE_H_ //: Base class for simplified interfaces // // Interfaces provide an easier way to access proxy objects from // within user applications. <br> <br> // // Users can simply declare a local interface variable and use it // as a smart_ptr for the proxy // //!...
Add sample C code for comparing serializations
#include <stdlib.h> #include <stdio.h> #include <dbus/dbus.h> void main(int argc, char* argv[]) { DBusMessage* m; dbus_uint32_t arg_a = 0x11223344; char arg_b = 0x42; const dbus_uint64_t array[] = {}; const dbus_uint64_t *arg_c = array; char arg_d = 0x23; char* wire; int len; m = dbus_message_new_...
Use standard smart pointers by default.
#ifndef SAUCE_MEMORY_H_ #define SAUCE_MEMORY_H_ #if SAUCE_STD_SMART_PTR #include <sauce/internal/memory/std.h> #elif SAUCE_STD_TR1_SMART_PTR #include <sauce/internal/memory/tr1.h> #elif SAUCE_BOOST_SMART_PTR #include <sauce/internal/memory/boost.h> #else #error Please define SAUCE_STD_SMART_PTR, SAUCE_STD_TR1_...
#ifndef SAUCE_MEMORY_H_ #define SAUCE_MEMORY_H_ #if SAUCE_STD_SMART_PTR #include <sauce/internal/memory/std.h> #elif SAUCE_STD_TR1_SMART_PTR #include <sauce/internal/memory/tr1.h> #elif SAUCE_BOOST_SMART_PTR #include <sauce/internal/memory/boost.h> #else #include <sauce/internal/memory/std.h> #endif #endif //...
Fix Win32 implementation of Now()
#ifndef WEBDRIVERXX_DETAIL_TIME_H #define WEBDRIVERXX_DETAIL_TIME_H #include "error_handling.h" #include "../types.h" #ifdef _WIN32 #include <windows.h> #else #include <time.h> #endif namespace webdriverxx { namespace detail { TimePoint Now() { #ifdef _WIN32 FILETIME time; ::GetSystemTimeAsFileTime(&time);...
#ifndef WEBDRIVERXX_DETAIL_TIME_H #define WEBDRIVERXX_DETAIL_TIME_H #include "error_handling.h" #include "../types.h" #ifdef _WIN32 #include <windows.h> #else #include <time.h> #endif namespace webdriverxx { namespace detail { TimePoint Now() { #ifdef _WIN32 FILETIME time; ::GetSystemTimeAsFileTime(&time);...
Move static function into macro to circumvent unused function waringn-erros.
#ifndef SRC_UTILS_CUDA_HELPER_H_ #define SRC_UTILS_CUDA_HELPER_H_ #include <cuda.h> #include <cuda_runtime.h> #include <iostream> #include <stdexcept> static void HandleError(cudaError_t error, const char *file, int line) { if (error != cudaSuccess) { printf("%s in %s at line %d\n", cudaGetErrorString(error)...
#ifndef SRC_UTILS_CUDA_HELPER_H_ #define SRC_UTILS_CUDA_HELPER_H_ #include <cuda.h> #include <cuda_runtime.h> #include <iostream> #include <stdexcept> #define HANDLE_ERROR(error) \ { \ ...
Update revno in config file
//--------------------------------------------------------------------------------------- // This file is part of the Lomse library. // Do not alter layout. Will affect CMakeLists.txt data extraction code // // | All values aligned here #define LOMSE_VERSION_MAJOR 0 #define LOMSE_VERSION_...
//--------------------------------------------------------------------------------------- // This file is part of the Lomse library. // Do not alter layout. Will affect CMakeLists.txt data extraction code // // | All values aligned here #define LOMSE_VERSION_MAJOR 0 #define LOMSE_VERSION_...
Use correct variable for number of tests
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
Debug label inline function bug
// ucc -g tim.c _Noreturn void abort() { __builtin_unreachable(); } void realloc() { int local = 5; abort(); }
Check that assignments to NMEM memory for some basic types
/* * Copyright (c) 2002-2004, Index Data * See the file LICENSE for details. * * $Id: tstnmem.c,v 1.2 2004-09-29 20:15:48 adam Exp $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <yaz/nmem.h> int main (int argc, char **arg...
/* * Copyright (c) 2002-2004, Index Data * See the file LICENSE for details. * * $Id: tstnmem.c,v 1.3 2005-01-05 10:29:42 adam Exp $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <yaz/nmem.h> int main (int argc, char **arg...
Use '--replace-whitespace' option for scsi_id
#define DEFAULT_GETUID "/lib/udev/scsi_id --whitelisted --device=/dev/%n" #define DEFAULT_UDEVDIR "/dev" #define DEFAULT_MULTIPATHDIR "/" LIB_STRING "/multipath" #define DEFAULT_SELECTOR "round-robin 0" #define DEFAULT_ALIAS_PREFIX "mpath" #define DEFAULT_FEATURES "0" #define DEFAULT_HWHANDLER "0" #define DEFAULT_MIN...
#define DEFAULT_GETUID "/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/%n" #define DEFAULT_UDEVDIR "/dev" #define DEFAULT_MULTIPATHDIR "/" LIB_STRING "/multipath" #define DEFAULT_SELECTOR "round-robin 0" #define DEFAULT_ALIAS_PREFIX "mpath" #define DEFAULT_FEATURES "0" #define DEFAULT_HWHANDLER "0...
Fix o_builtin_print and o_assign cases not breaking.
#include "lily_impl.h" #include "lily_symtab.h" #include "lily_opcode.h" static void builtin_print(lily_symbol *s) { if (s->val_type == vt_str) lily_impl_send_html(((lily_strval *)s->sym_value)->str); } void lily_vm_execute(lily_symbol *sym) { lily_symbol **regs; int *code, ci; regs = lily_im...
#include "lily_impl.h" #include "lily_symtab.h" #include "lily_opcode.h" static void builtin_print(lily_symbol *s) { if (s->val_type == vt_str) lily_impl_send_html(((lily_strval *)s->sym_value)->str); } void lily_vm_execute(lily_symbol *sym) { lily_symbol **regs; int *code, ci; regs = lily_im...
Make the struct bigger, to ensure it is returned by struct return.
// RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result} struct X { int m, n, o, p; }; struct X p(int n) { struct X c(int m) { struct X x; x.m = m; x.n = n; return x; } return c(n); }
// RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result} struct X { long m, n, o, p; }; struct X p(int n) { struct X c(int m) { struct X x; x.m = m; x.n = n; return x; } return c(n); }
Add octApron test where bigint is required
// SKIP PARAM: --sets ana.activated[+] octApron #include <assert.h> void main() { // requires bigint, not int64 unsigned long long x, y, z; if (x < y && y < z) { assert(x < y); assert(y < z); assert(x < z); if (18446744073709551612ull <= x && z <= 18446744073709551615ull) { assert(18446744...
Add platform names in orbit_platform.h
// // orbit_platforms.h // OrbitVM // // Created by Cesar Parent on 2016-11-14. // Copyright © 2016 cesarparent. All rights reserved. // #ifndef OrbitPlatforms_h #define OrbitPlatforms_h #if __STDC_VERSION__ >= 199901L #define ORBIT_FLEXIBLE_ARRAY_MEMB #else #define ORBIT_FLEXIBLE_ARRRAY_MEMB 0 #endif #endif ...
// // orbit_platforms.h // OrbitVM // // Created by Cesar Parent on 2016-11-14. // Copyright © 2016 cesarparent. All rights reserved. // #ifndef OrbitPlatforms_h #define OrbitPlatforms_h #ifdef _WIN32 #define ORBIT_PLATFORM "Windows" #elif __APPLE__ #include "TargetConditionals.h" #if TARGET_IPHONE_SIMULATOR #defi...
Define HAVE_RB_DEFINE_ALLOC_FUNC for postgres gem.
/* Stub file provided for C extensions that expect it. All regular * defines and prototypes are in ruby.h */ #define RUBY /* These are defines directly related to MRI C-API symbols that the * mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would * attempt to find by linking against libruby. Rubinius doe...
/* Stub file provided for C extensions that expect it. All regular * defines and prototypes are in ruby.h */ #define RUBY /* These are defines directly related to MRI C-API symbols that the * mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would * attempt to find by linking against libruby. Rubinius doe...
Fix warnings building with GCC 5
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 #define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) ({ \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ AcquireImagePixels(im, x, y, w, h, ex); \ _Pragma("GCC diagnostic pop") \ }) #else #define ACQUIRE_IMAGE_PIXEL...
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) #define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) ({ \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ AcquireImagePixels(im, x, y, w, h, ex); \ _Pragma("GCC diagnostic pop") \ }) #else #define...
Add search terms and authors section to enum
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionComments, StatsSectionTagsCategories, StatsSectionFol...
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionAuthors, StatsSectionSearchTerms, StatsSectionComment...
Add the stub for task graph
/// \file task_graph.h /// Defines the TaskGraph class /// \author A0112054Y #pragma once #ifndef YOU_QUERYENGINE_INTERNAL_TASK_GRAPH_H_ #define YOU_QUERYENGINE_INTERNAL_TASK_GRAPH_H_ #include <vector> #include "../api.h" namespace You { namespace QueryEngine { namespace Internal { /// Defines the task dependency g...
Add test for LSB-clearing in marquise_hash_identifier
#include <glib.h> #include <stdlib.h> #include <string.h> #include "../marquise.h" void test_hash_identifier() { const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,"; size_t id_len = strlen(id); uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len); g_assert_cmpint...
#include <glib.h> #include <stdlib.h> #include <string.h> #include "../marquise.h" void test_hash_identifier() { const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,"; size_t id_len = strlen(id); uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len); g_assert_cmpint...
Add 'env' in hopes of making this test pass on Windows.
#include "some_struct.h" void foo() { struct X x; x. // RUN: CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35) (parent: StructDecl 'X')
#include "some_struct.h" void foo() { struct X x; x. // RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35) (parent: StructDecl 'X')
Add the prototype for removePoint
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ #include <stdlib.h> #include <stdio.h> /** * Declaration Point structure * x - real wich is the abscisse of the point * y - real wich is the ordinate of the point */ typedef struct { double x; double y; }Point; /** * Declaration of the El...
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ #include <stdlib.h> #include <stdio.h> /** * Declaration Point structure * x - real wich is the abscisse of the point * y - real wich is the ordinate of the point */ typedef struct { double x; double y; }Point; /** * Declaration of the El...
Add sharable methods to header file
// ext/foo/foo_vector.h // Declarations for wrapped struct #ifndef FOO_VECTOR_H #define FOO_VECTOR_H #include <ruby.h> #include <math.h> // Ruby 1.8.7 compatibility patch #ifndef DBL2NUM #define DBL2NUM( dbl_val ) rb_float_new( dbl_val ) #endif void init_foo_vector( VALUE parent_module ); // This is the struct t...
// ext/foo/foo_vector.h // Declarations for wrapped struct #ifndef FOO_VECTOR_H #define FOO_VECTOR_H #include <ruby.h> #include <math.h> // Ruby 1.8.7 compatibility patch #ifndef DBL2NUM #define DBL2NUM( dbl_val ) rb_float_new( dbl_val ) #endif void init_foo_vector( VALUE parent_module ); // This is the struct t...
Clean up C Compiler warning about declaration of variables.
#ifdef USE_INSTANT_OSX #include "hitimes_interval.h" #include <mach/mach.h> #include <mach/mach_time.h> /* All this OSX code is adapted from http://developer.apple.com/library/mac/#qa/qa1398/_index.html */ /* * returns the conversion factor, this value is used to convert * the value from hitimes_get_current_instan...
#ifdef USE_INSTANT_OSX #include "hitimes_interval.h" #include <mach/mach.h> #include <mach/mach_time.h> /* All this OSX code is adapted from http://developer.apple.com/library/mac/#qa/qa1398/_index.html */ /* * returns the conversion factor, this value is used to convert * the value from hitimes_get_current_instan...
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...
Fix parameter names for svd.impute
/* r-svd-impute.h */ #ifndef _R_SVD_IMPUTE_H #define _R_SVD_IMPUTE_H SEXP R_svd_impute (SEXP xx, SEXP KK, SEXP tol, SEXP maxiter); #endif /* _R_SVD_IMPUTE_H */
/* r-svd-impute.h */ #ifndef _R_SVD_IMPUTE_H #define _R_SVD_IMPUTE_H SEXP R_svd_impute (SEXP x, SEXP k, SEXP tol, SEXP maxiter); #endif /* _R_SVD_IMPUTE_H */
Disable function exception specification warning only in cl (Visual Studio).
/** * machina * * Copyright (c) 2011, drmats * All rights reserved. * * https://github.com/drmats/machina */ #ifndef __PLATFORM_H_ #define __PLATFORM_H_ 1 #if defined(linux) || defined(__linux) || defined(__linux__) #undef __LINUX__ #define __LINUX__ 1 #endif #if defined(WIN32) || defined(_WIN32) #und...
/** * machina * * Copyright (c) 2011, drmats * All rights reserved. * * https://github.com/drmats/machina */ #ifndef __PLATFORM_H_ #define __PLATFORM_H_ 1 #if defined(linux) || defined(__linux) || defined(__linux__) #undef __LINUX__ #define __LINUX__ 1 #endif #if defined(WIN32) || defined(_WIN32) #und...
Fix msvc compile error and improve 64 bit compatibility
#include <Python.h> static PyObject* websocket_mask(PyObject* self, PyObject* args) { const char* mask; int mask_len; const char* data; int data_len; int i; if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, &data, &data_len)) { return NULL; } PyObject* result = PyBytes_Fro...
#define PY_SSIZE_T_CLEAN #include <Python.h> static PyObject* websocket_mask(PyObject* self, PyObject* args) { const char* mask; Py_ssize_t mask_len; const char* data; Py_ssize_t data_len; Py_ssize_t i; PyObject* result; char* buf; if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, ...
Add my name to the copyright notice.
/* Return the copyright string. This is updated manually. */ #include "Python.h" static char cprt[] = "Copyright (c) 2000 BeOpen.com.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 1991-1995 Stichting Mathematisch Ce...
/* Return the copyright string. This is updated manually. */ #include "Python.h" static char cprt[] = "\ Copyright (c) 2000, 2001 Guido van Rossum.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 2000 BeOpen.com.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\ A...
Fix shared_component build for Ozone platform.
// Copyright (c) 2013 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 OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_ #define OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_ namespace ui { class OzonePlatform; // Constructo...
// Copyright (c) 2013 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 OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_ #define OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_ #include "ozone/platform/ozone_export_wayland.h" n...
Add missing newline at end of file.
/* * Describes all ncp_lib kernel functions * * $FreeBSD$ */ #ifndef _NCP_MOD_H_ #define _NCP_MOD_H_ /* order of calls in syscall table relative to offset in system table */ #define NCP_SE(callno) (callno+sysentoffset) #define NCP_CONNSCAN NCP_SE(0) #define NCP_CONNECT NCP_SE(1) #define NCP_INTFN NCP_SE(2) #de...
/* * Describes all ncp_lib kernel functions * * $FreeBSD$ */ #ifndef _NCP_MOD_H_ #define _NCP_MOD_H_ /* order of calls in syscall table relative to offset in system table */ #define NCP_SE(callno) (callno+sysentoffset) #define NCP_CONNSCAN NCP_SE(0) #define NCP_CONNECT NCP_SE(1) #define NCP_INTFN NCP_SE(2) #de...
Fix build on OSX 10.9.
// 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 CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_ #define CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_ #include <OpenGL/CGLIOSurface.h> #include ...
// 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 CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_ #define CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_ #include <IOSurface/IOSurface.h> #include <...
Increase version to 1.46 in preparation for new release
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.45f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // incr...
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.46f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // incr...
Fix issue with static consts
#ifndef __parse_type_h__ #define __parse_type_h__ typedef enum { PARSE_TYPE_NONE, PARSE_TYPE_LOGICAL, PARSE_TYPE_CHARACTER, PARSE_TYPE_INTEGER, PARSE_TYPE_REAL, PARSE_TYPE_COMPLEX, PARSE_TYPE_BYTE, } parse_type_e; typedef struct { parse_type_e type; unsigned kind; unsigned count; } parse_type_t; s...
#ifndef __parse_type_h__ #define __parse_type_h__ typedef enum { PARSE_TYPE_NONE, PARSE_TYPE_LOGICAL, PARSE_TYPE_CHARACTER, PARSE_TYPE_INTEGER, PARSE_TYPE_REAL, PARSE_TYPE_COMPLEX, PARSE_TYPE_BYTE, } parse_type_e; typedef struct { parse_type_e type; unsigned kind; unsigned count; } parse_type_t; #...
Use A0 instead 10 as button down input PIN
#pragma once #include <core.h> #define DHT22_PIN 6 #define DHT22_SAMPLE_RATE 3000 #define TEMPORATURE_TARGET (204) #define HEATER_PIN 10 #define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently. // pin connect to 315/433 transmitter #define TRANSMIT_PIN 8 /...
#pragma once #include <core.h> #define DHT22_PIN 6 #define DHT22_SAMPLE_RATE 3000 #define TEMPORATURE_TARGET (204) #define HEATER_PIN 10 #define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently. // pin connect to 315/433 transmitter #define TRANSMIT_PIN 8 /...
Add test case for invariant generation for unions.
// PARAM: --set trans.activated[+] "assert" // Running the assert transformation on this test yields in code that is not compilable by gcc struct s { int a; int b; }; union u { struct s str; int i; }; int main(){ union u un; struct s* ptr; un.str.a = 1; un.str.b = 2; ptr = &un...
Add BOOL typedef becuase BOOLEAN is too verbose.
#ifndef CONSTANTS_H #define CONSTANTS_H #if !defined(__STDC__) && !defined(__cplusplus) #define const #endif /* Set up a boolean variable type. Since this definition could conflict with other reasonable definition of BOOLEAN, i.e. using an enumeration, it is conditional. */ #ifndef BOOLEAN_TYPE_DEFINED typedef i...
#ifndef CONSTANTS_H #define CONSTANTS_H #if !defined(__STDC__) && !defined(__cplusplus) #define const #endif /* Set up a boolean variable type. Since this definition could conflict with other reasonable definition of BOOLEAN, i.e. using an enumeration, it is conditional. */ #ifndef BOOLEAN_TYPE_DEFINED typedef i...
Fix wrong namespace in recently-added shim header.
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 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 a...
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 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 a...
Add cpp comment stripping bug
#ifdef GNU_VARIADIC # define FOO(args...) do { foo(args); } while (0) #else # define FOO(...) do { foo(__VA_ARGS__); } while (0) #endif #define BAR(x) FOO("x"); FOO(")"); void foo(char *a) { BAR(); }
Test case for returning structs by value (missing from previous checkin)
struct S { int a; }; struct S foo () { struct S s; int i; s.a = i; return s; } int main() { int u; u = foo().a; }
Add Hamming weigth in C
#include <stdint.h> int32_t NumberOfSetBits(int32_t i) { i = i - ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24; }
Clarify class comment for ExtensionMessageHandler.
// 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ #pragma once #include "...
// 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ #pragma once #include "...