Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add User-Agent to prevent from blocked by Douban.fm
// main.c // Main Program for HWP Media Center // // Author : Weipeng He <heweipeng@gmail.com> // Copyright (c) 2014, All rights reserved. #include "utils.h" #include <stdio.h> #include <curl/curl.h> size_t write_data(void *buffer, size_t size, size_t nmemb, void *dstr) { d_string* str = (d_string*) dstr; dstr_n...
// main.c // Main Program for HWP Media Center // // Author : Weipeng He <heweipeng@gmail.com> // Copyright (c) 2014, All rights reserved. #include "utils.h" #include <stdio.h> #include <curl/curl.h> size_t write_data(void *buffer, size_t size, size_t nmemb, void *dstr) { d_string* str = (d_string*) dstr; dstr_n...
Return the Module being materialized to avoid always calling getModule().
//===-- llvm/ModuleProvider.h - Interface for module providers --*- C++ -*-===// // // This file provides an abstract interface for loading a module from some // place. This interface allows incremental or random access loading of // functions from the file. This is useful for applications like JIT compilers // or in...
//===-- llvm/ModuleProvider.h - Interface for module providers --*- C++ -*-===// // // This file provides an abstract interface for loading a module from some // place. This interface allows incremental or random access loading of // functions from the file. This is useful for applications like JIT compilers // or in...
Allow other operating systems that use X11 to use it
/* Copyright [2013-2018] [Aaron Springstroh, Minimal Graphics Library] 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 ...
/* Copyright [2013-2018] [Aaron Springstroh, Minimal Graphics Library] 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 ...
Remove not needed property_get function form cutils stubs
/* * Copyright (C) 2006 The Android Open Source Project * * 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 app...
/* * Copyright (C) 2006 The Android Open Source Project * * 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 app...
Enforce IPC data sharing with MPU
#include "../../libtock/tock.h" #include <stdio.h> #define IPC_DRIVER 0x4c static void rot13_callback(int pid, int len, int arg2, void* ud) { char* buf = (char*)arg2; int length = buf[0]; if (length > len - 1) { length = len - 1; } buf++; for (int i = 0; i < len; ++i) { if (buf[i] >= 'a' && buf[i]...
#include <tock.h> #define IPC_DRIVER 0x4c struct rot13_buf { int8_t length; char buf[31]; }; static void rot13_callback(int pid, int len, int buf, void* ud) { struct rot13_buf *rb = (struct rot13_buf*)buf; int length = rb->length; if (length > len - 1) { length = len - 1; } for (int i = 0; i < leng...
Increase the size of the memory pool frame
#include <libsccmn.h> #include <openssl/rand.h> #include <sys/mman.h> #define FRAME_SIZE (3*4096) #define MEMPAGE_SIZE (4096) void _logging_init(void); void _frame_init(struct frame * this, uint8_t * data, size_t capacity, struct frame_pool_zone * zone);
#include <libsccmn.h> #include <openssl/rand.h> #include <sys/mman.h> // Frame size should be above 16kb, which is a maximum record size of 16kB for SSLv3/TLSv1 // See https://www.openssl.org/docs/manmaster/ssl/SSL_read.html #define FRAME_SIZE (5*4096) #define MEMPAGE_SIZE (4096) void _logging_init(void); void _fram...
Fix the first (sic!) Segmentation fault
// vim: sw=4 ts=4 et : #include "config.h" // Parser for win_ section conf_t win_conf(char *key) { conf_t rc; rc.ival = 0; (void)key; return rc; } // Prefixes for config sections/subsections with parser pointers struct conf_prefix { char *prefix; conf_t (*parser)(char *); } pr_global[] = { ...
// vim: sw=4 ts=4 et : #include "config.h" #include "itmmorgue.h" // Parser for win_ section conf_t win_conf(char *key) { conf_t rc; // TODO implement real parser if (key == strstr(key, "area_y")) rc.ival = 3; if (key == strstr(key, "area_x")) rc.ival = 2; if (key == strstr(key, "area_max_y")) rc....
Enable reverse futility at depth 1
#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 0 // TODO: switch to at least 2 #define ENABLE_TT_CUT...
#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_TT_CUT...
Allow passing an event loop to XapianServer
#ifndef XAPIAND_INCLUDED_SERVER_H #define XAPIAND_INCLUDED_SERVER_H #include <ev++.h> #include "threadpool.h" #include "database.h" const int XAPIAND_HTTP_PORT_DEFAULT = 8880; const int XAPIAND_BINARY_PORT_DEFAULT = 8890; class XapiandServer : public Task { private: ev::dynamic_loop loop; ev::sig sig; ev::asyn...
#ifndef XAPIAND_INCLUDED_SERVER_H #define XAPIAND_INCLUDED_SERVER_H #include <ev++.h> #include "threadpool.h" #include "database.h" const int XAPIAND_HTTP_PORT_DEFAULT = 8880; const int XAPIAND_BINARY_PORT_DEFAULT = 8890; class XapiandServer : public Task { private: ev::dynamic_loop dynamic_loop; ev::loop_ref *...
Update Skia milestone to 91
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 90 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 91 #endif
Increment version to clean things up
/* * Paramer.h * * Created on: Aug 20, 2015 * Author: fsedlaze */ #ifndef PARAMER_H_ #define PARAMER_H_ #include <string.h> #include <string> #include <vector> #include <stdlib.h> #include <iostream> #include <ctime> class Parameter { private: Parameter() { min_freq=-1; version ="1.0.4"; } ~Param...
/* * Paramer.h * * Created on: Aug 20, 2015 * Author: fsedlaze */ #ifndef PARAMER_H_ #define PARAMER_H_ #include <string.h> #include <string> #include <vector> #include <stdlib.h> #include <iostream> #include <ctime> class Parameter { private: Parameter() { min_freq=-1; version ="1.0.5"; } ~Param...
Set default debug level to none.
/** * This file is part of the librailcan library. * * Copyright (C) 2015 Reinder Feenstra <reinderfeenstra@gmail.com> * * 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 * v...
/** * This file is part of the librailcan library. * * Copyright (C) 2015 Reinder Feenstra <reinderfeenstra@gmail.com> * * 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 * v...
Copy end of string in xstrdup
#include <stdlib.h> #include <string.h> #include <stdint.h> #include "cc.h" static void out_of_memory(void) { /* TODO: deal with out of memory errors */ error("out of memory"); } void * xmalloc(size_t size) { register void *p = malloc(size); if (!p) out_of_memory(); return p; } void * xcalloc(size_t nmem...
#include <stdlib.h> #include <string.h> #include <stdint.h> #include "cc.h" static void out_of_memory(void) { /* TODO: deal with out of memory errors */ error("out of memory"); } void * xmalloc(size_t size) { register void *p = malloc(size); if (!p) out_of_memory(); return p; } void * xcalloc(size_t nmem...
Test null statements. Just because.
int main(void) { int i = 0; while (1) { if (i == 42) break; i += 1; } return i; }
int main(void) { int i = 0;;; while (1) { if (i == 42) break; i += 1; } return i; }
Add a file that should have been added with changeset: 3564:36fb63a6d3b7
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * ...
Use better header for std::pair.
#pragma once #include <algorithm> #include "Types.h" class CGsCachedArea { public: typedef uint64 DirtyPageHolder; enum { MAX_DIRTYPAGES_SECTIONS = 8, MAX_DIRTYPAGES = sizeof(DirtyPageHolder) * 8 * MAX_DIRTYPAGES_SECTIONS }; CGsCachedArea(); void SetArea(uint32 psm, uint32 bufPtr, uint32 bufW...
#pragma once #include <utility> #include "Types.h" class CGsCachedArea { public: typedef uint64 DirtyPageHolder; enum { MAX_DIRTYPAGES_SECTIONS = 8, MAX_DIRTYPAGES = sizeof(DirtyPageHolder) * 8 * MAX_DIRTYPAGES_SECTIONS }; CGsCachedArea(); void SetArea(uint32 psm, uint32 bufPtr, uint32 bufWid...
Fix compile ui.shell, fckng non-standard behaviour
#ifndef STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H #define STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H // Copyright (c) 2011 - 2017, GS Group, https://github.com/GSGroup // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, // provided that th...
#ifndef STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H #define STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H // Copyright (c) 2011 - 2017, GS Group, https://github.com/GSGroup // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, // provided that th...
Set Type A1 retimer to unknown
/* Copyright 2021 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. */ #include "base_fw_config.h" #include "board_fw_config.h" bool board_is_convertible(void) { return 1; } bool board_has_kblight(void) { return (g...
/* Copyright 2021 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. */ #include "base_fw_config.h" #include "board_fw_config.h" bool board_is_convertible(void) { return 1; } bool board_has_kblight(void) { return (g...
Define helper to send perf events for socket context
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* Copyright Authors of Cilium */ #ifndef __BPF_HELPERS_SOCK__ #define __BPF_HELPERS_SOCK__ #include <linux/bpf.h> #include "helpers.h" /* Only used helpers in Cilium go below. */ /* Events for user space */ static int BPF_FUNC_REMAP(sock_event_output, ...
Add test for large unsigned long constants in expressions
// PARAM: --enable ana.int.def_exc --disable ana.int.interval #include<assert.h> // Some unsigned long constant that is larger than 2^63-1 #define SIZE_MAX 18446744073709551615UL int foo(){ int top; int a = 3; if (top < SIZE_MAX / (8 * sizeof(int))){ // parts of the expression errorneously evaluate to bott...
Hide global data symbols related to signal tables
#ifndef __POSIX_SIGNAL_SIGTABLES_H typedef struct { int signal; char *name; } Signal; typedef struct { int len; int items[]; } SignalVector; extern const Signal signals[]; extern const int nsigs; extern int max_signum; #define SIGOFFSET(SIG) ((SIG) - 1) void InitSignalTables (void); SignalVector*...
#ifndef __POSIX_SIGNAL_SIGTABLES_H typedef struct { int signal; char *name; } Signal; typedef struct { int len; int items[]; } SignalVector; MODULE_SCOPE const Signal signals[]; MODULE_SCOPE const int nsigs; MODULE_SCOPE int max_signum; #define SIGOFFSET(SIG) ((SIG) - 1) void InitSignalTables (voi...
Fix a warning that causes compile error in G++
// Submission #3365787 #include <stdio.h> #define MAXN 8 #define TRUE 1 #define FALSE 0 int len; unsigned char used[MAXN] = { FALSE }; char s[MAXN], generated[MAXN]; void dfs(int depth) { if (depth == len) puts(generated); else { int i; for (i = 0; i < len; ++i) if (!used[i]) { use...
// Submission #3365787 #include <stdio.h> #include <string.h> #define MAXN 8 #define TRUE 1 #define FALSE 0 int len; unsigned char used[MAXN] = { FALSE }; char s[MAXN], generated[MAXN]; void dfs(int depth) { if (depth == len) puts(generated); else { int i; for (i = 0; i < len; ++i) if (!used[i...
Move function declarations outside of the if-block
#ifndef _AL_THUNK_H_ #define _AL_THUNK_H_ #include "config.h" #include "AL/al.h" #include "AL/alc.h" #ifdef __cplusplus extern "C" { #endif #if (SIZEOF_VOIDP > SIZEOF_UINT) void alThunkInit(void); void alThunkExit(void); ALuint alThunkAddEntry(ALvoid * ptr); void alThunkRemoveEntry(ALuint index); ALvoid *alThunkLo...
#ifndef _AL_THUNK_H_ #define _AL_THUNK_H_ #include "config.h" #include "AL/al.h" #include "AL/alc.h" #ifdef __cplusplus extern "C" { #endif void alThunkInit(void); void alThunkExit(void); ALuint alThunkAddEntry(ALvoid * ptr); void alThunkRemoveEntry(ALuint index); ALvoid *alThunkLookupEntry(ALuint index); #if (SIZ...
Remove leading underscores as part of style clean up
// abort.h // hdpirun // // Utility header to abort the program on an unrecoverable error. Prints the message (printf format) and closes any open resources // // Author: Robbie Duncan // Copyright: Copyright (c) 2016 Robbie Duncan // License: See LICENSE // #import "log.h" #import <stdio.h> #ifndef ABORT_H #define ABO...
// abort.h // hdpirun // // Utility header to abort the program on an unrecoverable error. Prints the message (printf format) and closes any open resources // // Author: Robbie Duncan // Copyright: Copyright (c) 2016 Robbie Duncan // License: See LICENSE // #import "log.h" #import <stdio.h> #ifndef ABORT_H #define ABO...
Add new template for bench on c
#include <stdio.h> #include <time.h> static long n = 10000; int main(int argc, char* argv[]) { long i; clock_t t; t = clock(); for (i = 0; i < n; ++i) { {{_cursor_}} } printf("%ld\n", clock() - t); return 0; }
Update driver version to 5.02.00-k12
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k11"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k12"
Fix MSVC error C2133 : unknown size of multi-dimensional static const arrays (despite supposed support of C99). Have not confirmed if this breaks anything yet.
/* encrypted keys */ static const uint32_t internal_device_number = 0; static const uint8_t internal_dk_list[][21] = { { }, }; static const uint8_t internal_pk_list[][16] = { { }, }; static const uint8_t internal_hc_list[][112] = { { }, }; /* customize this function to "hide" the keys in the binary */...
/* encrypted keys */ static const uint32_t internal_device_number = 0; static const uint8_t internal_dk_list[][21] = { { 0 }, }; static const uint8_t internal_pk_list[][16] = { { 0 }, }; static const uint8_t internal_hc_list[][112] = { { 0 }, }; /* customize this function to "hide" the keys in the binary */...
Change /version output to be more like -version
#include "server/bedrock.h" #include "server/command.h" void command_version(struct bedrock_client *client, int bedrock_attribute_unused argc, const char bedrock_attribute_unused **argv) { command_reply(client, "Bedrock version %d.%d%s Compiled on %s %s.", BEDROCK_VERSION_MAJOR, BEDROCK_VERSION_MINOR, BEDROCK_VERSION...
#include "server/bedrock.h" #include "server/command.h" void command_version(struct bedrock_client *client, int bedrock_attribute_unused argc, const char bedrock_attribute_unused **argv) { command_reply(client, "Bedrock version %d.%d%s, built on %s %s.", BEDROCK_VERSION_MAJOR, BEDROCK_VERSION_MINOR, BEDROCK_VERSION_E...
Remove volatile from test (decl_equal doesn't check properly for now)
int f(int x[static volatile /*const*/ 10]) { return *++x; } main() { int x[5]; x[1] = 2; f(x); //int y[1]; //int *y; //#define y (void *)0 //pipe(y); }
int f(int x[static /*const*/ 10]) { return *++x; } main() { int x[5]; x[1] = 2; f(x); //int y[1]; //int *y; //#define y (void *)0 //pipe(y); }
Reword this comment. Don't mention outs(), as that's not what this code is actually testing for.
//===- SystemUtils.h - Utilities to do low-level system stuff ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
//===- SystemUtils.h - Utilities to do low-level system stuff ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Use final for virtual methods on private impl of mbgl::View
#ifndef QMAPBOXGL_P_H #define QMAPBOXGL_P_H #include <mbgl/map/map.hpp> #include <mbgl/map/view.hpp> #include <mbgl/storage/default_file_source.hpp> namespace mbgl { class Map; class FileSource; } // namespace mbgl class QOpenGLContext; class QMapboxGLPrivate : public mbgl::View { public: explicit QMapboxGLP...
#ifndef QMAPBOXGL_P_H #define QMAPBOXGL_P_H #include <mbgl/map/map.hpp> #include <mbgl/map/view.hpp> #include <mbgl/storage/default_file_source.hpp> namespace mbgl { class Map; class FileSource; } // namespace mbgl class QOpenGLContext; class QMapboxGLPrivate : public mbgl::View { public: explicit QMapboxGLP...
Add a test case for PR1086
// RUN: %llvmgcc -S %s -o - | llvm-as | llc -march=c | \ // RUN: grep '(unsigned short' int Z = -1; int test(unsigned short X, short Y) { return X+Y+Z; }
Choose between value and const reference type
///\file /****************************************************************************** The MIT License(MIT) Embedded Template Library. Copyright(c) 2014 jwellbelove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to ...
Fix illegal (double underscore) include guard.
#ifndef SIMHASH_TOKENIZERS__UTIL_H #define SIMHASH_TOKENIZERS__UTIL_H #include <string.h> namespace Simhash { struct Strspn { /* Return the length of the token starting at last */ const char* operator()(const char* last) { size_t s = strspn(last, "abcdefghijklmnopqrstuv...
#ifndef SIMHASH_TOKENIZERS_STRSPN_H #define SIMHASH_TOKENIZERS_STRSPN_H #include <string.h> namespace Simhash { struct Strspn { /* Return the length of the token starting at last */ const char* operator()(const char* last) { size_t s = strspn(last, "abcdefghijklmnopqrst...
Remove comment that is no longer applicable
/* * This file is covered by the Internet Software Consortium (ISC) License * Reference: ../License.txt * * __nohang_waitpid is linked directly into Synth but it's related to synthexec * so let's keep the C files together. * return: * 0 when process is still running * 1 when process exited normally * ...
/* * This file is covered by the Internet Software Consortium (ISC) License * Reference: ../License.txt * * __nohang_waitpid is linked directly into Synth but it's related to synthexec * so let's keep the C files together. * return: * 0 when process is still running * 1 when process exited normally * ...
Increment version number to 1.41
#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.40f;
#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.41f;
Use rand instead of arc4random (linux doesn't support it)
#include "redislite.h" #include <string.h> static void test_add_key(redislite *db) { int rnd = arc4random(); char key[14]; sprintf(key, "%d", rnd); int size = strlen(key); redislite_insert_key(db, key, size, 0); } int main() { redislite *db = redislite_open_database("test.db"); int i; for (i=0; i < 100; i++)...
#include "redislite.h" #include <string.h> static void test_add_key(redislite *db) { int rnd = rand(); char key[14]; sprintf(key, "%d", rnd); int size = strlen(key); redislite_insert_key(db, key, size, 0); } int main() { redislite *db = redislite_open_database("test.db"); int i; for (i=0; i < 100; i++) tes...
Remove unused members in fqindexedarray structure
/* * Copyright 2017 Brandon Yannoni * * 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 agree...
/* * Copyright 2017 Brandon Yannoni * * 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 agree...
Add delegate for profile view controller.
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @class ProfileViewController; @protocol MainDelegate <NSObject> - (void)dismissViewController:(MainViewController *)mainViewController...
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @class ProfileViewController; @protocol MainDelegate <NSObject> - (void)dismissViewController:(ProfileViewController *)mainViewControl...
Remove partial availability warning by adding API_AVAILABLE.
// // VYNFCNDEFPayloadParser.h // VYNFCKit // // Created by Vince Yuan on 7/8/17. // Copyright © 2017 Vince Yuan. All rights reserved. // // This source code is licensed under the MIT-style license found in the // LICENSE file in the root directory of this source tree. // #import <Foundation/Foundation.h> @clas...
// // VYNFCNDEFPayloadParser.h // VYNFCKit // // Created by Vince Yuan on 7/8/17. // Copyright © 2017 Vince Yuan. All rights reserved. // // This source code is licensed under the MIT-style license found in the // LICENSE file in the root directory of this source tree. // #import <Foundation/Foundation.h> @clas...
Implement dirty unallocatable memory mapped alloc.
char* file_to_buffer(const char *filename) { struct stat sb; stat(filename, &sb); char *buffer = (char*) malloc(sb.st_size * sizeof(char)); FILE *f = fopen(filename, "rb"); assert(fread((void*) buffer, sizeof(char), sb.st_size, f)); fclose(f); return buffer; }
char* file_to_buffer(const char *filename) { struct stat sb; stat(filename, &sb); char *buffer = (char*) malloc(sb.st_size * sizeof(char)); FILE *f = fopen(filename, "rb"); assert(fread((void*) buffer, sizeof(char), sb.st_size, f)); fclose(f); return buffer; } void* mmalloc(size_t sz, char ...
Define HAVE_SIGACTION to 1 in Xcode build
//===-- Config.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
//===-- Config.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Fix double / float mismatch
#pragma once #include "Vector3.h" typedef Vector3 Color; class Material { public: Material(); virtual ~Material(); void setColor(Color& color); Color getColor(void) const; void setDiffuse(double diffuse); double getDiffuse(void) const; void setReflection(double refl); double GetReflection(void) const; do...
#pragma once #include "Vector3.h" typedef Vector3 Color; class Material { public: Material(); virtual ~Material(); void setColor(Color& color); Color getColor(void) const; void setDiffuse(double diffuse); double getDiffuse(void) const; void setReflection(double refl); double GetReflection(void) const; do...
Use ANSI sequences to ensure line clearing
#include <stdio.h> #include <stdlib.h> #include <string.h> #define STTY "/bin/stty " const char RAW[] = STTY "raw"; const char COOKED[] = STTY "cooked"; const char default_str[] = "I AM AN IDIOT "; int main(int argc, char **argv) { system(RAW); const char *str; if ( argc == 2 ) str = argv[1]; else s...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define STTY "/bin/stty " const char RAW[] = STTY "raw"; const char COOKED[] = STTY "cooked"; const char default_str[] = "I AM AN IDIOT "; int main(int argc, char **argv) { system(RAW); const char *str; if ( argc == 2 ) str = argv[1]; else s...
Define sql5_export so that things compile.
/* * The contents of this file are subject to the MonetDB Public License * Version 1.1 (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.monetdb.org/Legal/MonetDBLicense * * Software distributed under the License is distributed...
/* * The contents of this file are subject to the MonetDB Public License * Version 1.1 (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.monetdb.org/Legal/MonetDBLicense * * Software distributed under the License is distributed...
Remove ctor and dtor of IOperation to make it a pure virtual class
#pragma once #ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_ #define YOU_DATASTORE_INTERNAL_OPERATION_H_ #include <unordered_map> #include "../task_typedefs.h" namespace You { namespace DataStore { /// A pure virtual class of operations to be put into transaction stack class IOperation { public: /// The constructor //...
#pragma once #ifndef YOU_DATASTORE_INTERNAL_OPERATION_H_ #define YOU_DATASTORE_INTERNAL_OPERATION_H_ #include <unordered_map> #include "../task_typedefs.h" namespace You { namespace DataStore { /// A pure virtual class of operations to be put into transaction stack class IOperation { public: /// Executes the operat...
Add automation for arduino board selection for compilation
#ifndef __ACONFIG_H_ #define __ACONFIG_H_ /* This must be before alphabetically before all other files that reference these settings for the compiler to work * or you may get vtable errors. */ /* This section is for devices and their configuration. IF you have not setup you pins with the * standard configuration of...
#ifndef __ACONFIG_H_ #define __ACONFIG_H_ /* This must be before alphabetically before all other files that reference these settings for the compiler to work * or you may get vtable errors. */ /* This section is for devices and their configuration. IF you have not setup you pins with the * standard configuration of...
Add Timer implementation for C++.
#ifndef TIMER_H #define TIMER_H #include <stdio.h> #include <stdlib.h> #include <sys/time.h> using namespace std; class Timer { private: timeval startTime; public: void start(){ gettimeofday(&startTime, NULL); } double stop(){ timeval endTime; long seconds, useconds; ...
Include ltdl.h if we have it.
/* * The LLVM Compiler Infrastructure * * This file was developed by the LLVM research group and is distributed under * the University of Illinois Open Source License. See LICENSE.TXT for details. * ****************************************************************************** * * Descript...
/* * The LLVM Compiler Infrastructure * * This file was developed by the LLVM research group and is distributed under * the University of Illinois Open Source License. See LICENSE.TXT for details. * ****************************************************************************** * * Descript...
Fix compiler warning about redundant comma
/* * socketcan/can/raw.h * * Definitions for raw CAN sockets * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * */ #ifndef CAN_RAW_H #define CAN_RAW_H #i...
/* * socketcan/can/raw.h * * Definitions for raw CAN sockets * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * */ #ifndef CAN_RAW_H #define CAN_RAW_H #i...
Use EGA color constant for background
#ifndef APRTERM_H #define APRTERM_H #include <SDL2/SDL.h> #ifndef VERSION #define VERSION "UNKNOWN" #endif /* VERSION */ #ifndef RESOURCE_DIR #define RESOURCE_DIR "." #endif /* RESOURCE_DIR */ /* Font info */ #define FONT_FILE "vga8x16.png" #define CHAR_WIDTH 8 #define CHAR_HEIGHT 16 #define FONT_COLS 32 #defi...
#ifndef APRTERM_H #define APRTERM_H #include <SDL2/SDL.h> #ifndef VERSION #define VERSION "UNKNOWN" #endif /* VERSION */ #ifndef RESOURCE_DIR #define RESOURCE_DIR "." #endif /* RESOURCE_DIR */ /* Font info */ #define FONT_FILE "vga8x16.png" #define CHAR_WIDTH 8 #define CHAR_HEIGHT 16 #define FONT_COLS 32 #defi...
Add move assignment method to Optional<>
/* * * Copyright 2019 gRPC 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 or agree...
/* * * Copyright 2019 gRPC 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 or agree...
Fix MIPS template in master
/** * @file * * @date Mar 21, 2013 * @author: Anton Bondarev */ struct sleepq; struct event; void sched_wake_all(struct sleepq *sq) { } int sched_sleep_ms(struct sleepq *sq, unsigned long timeout) { return 0; } int sched_sleep_locked_ms(struct sleepq *sq, unsigned long timeout) { return 0; } int sched_sle...
/** * @file * * @date Mar 21, 2013 * @author: Anton Bondarev */ struct sleepq; struct event; void sched_wake_all(struct sleepq *sq) { } int sched_sleep(struct sleepq *sq, unsigned long timeout) { return 0; } int sched_sleep_locked(struct sleepq *sq, unsigned long timeout) { return 0; }
Add List Node creation function declaration
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); #endif
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); ListNode* ListNode_Create(void *); #endif
Add qstr - query string utility
// ** QueryString // // This program reads chars from stdin without echo and put to stdout. // #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <termios.h> int main(int argc, char * args[]) { struct termios old_tio, new_tio; unsigned char c; /* get the terminal settings for stdin */ tcgetattr(...
Comment out the code to subclass CairoContext
#ifdef HAVE_CONFIG_H # include "config.h" #endif #include <Python.h> #include <pygobject.h> #include <pango/pangocairo.h> #include <pycairo.h> void pycluttercairo_register_classes (PyObject *d); void pycluttercairo_add_constants (PyObject *module, const gchar *strip_prefix); extern PyMethodDef pycluttercairo_functi...
#ifdef HAVE_CONFIG_H # include "config.h" #endif #include <Python.h> #include <pygobject.h> #include <pango/pangocairo.h> #include <pycairo.h> void pycluttercairo_register_classes (PyObject *d); void pycluttercairo_add_constants (PyObject *module, const gchar *strip_prefix); extern PyMethodDef pycluttercairo_functi...
Add example that should work
// SKIP PARAM: --set solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','apron','escape']" --set ana.path_sens[+] threadflag --set ana.base.privatization none --set ana.apron.privatization mutex-meet-tid // Copy of 45 01 for apron #include <pthread.h> #include <assert.h> #include <stdio.h> ...
Change ordering of fields in DayPeriod
// Copyright 2015 Malcolm Inglis <http://minglis.id.au> // // This file is part of Libtime. // // Libtime is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the // Free Software Foundation, either version 3 of the License, or (at your...
// Copyright 2015 Malcolm Inglis <http://minglis.id.au> // // This file is part of Libtime. // // Libtime is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the // Free Software Foundation, either version 3 of the License, or (at your...
Add links to related react-native-macos issues
// Most (if not all) of this file could probably go away once react-native-macos's version of RCTUIKit.h makes its way upstream. // https://github.com/microsoft/react-native-macos/issues/242 #if !TARGET_OS_OSX #import <UIKit/UIKit.h> #define RNSVGColor UIColor #define RNSVGPlatformView UIView #define RNSVGTextView U...
// Most (if not all) of this file could probably go away once react-native-macos's version of RCTUIKit.h makes its way upstream. // https://github.com/microsoft/react-native-macos/issues/242 #if !TARGET_OS_OSX #import <UIKit/UIKit.h> #define RNSVGColor UIColor #define RNSVGPlatformView UIView #define RNSVGTextView U...
Remove BTM_DEF_LOCAL_NAME define. product model name is used as default
/* * Copyright 2013 The Android Open Source Project * * 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 applica...
/* * Copyright 2013 The Android Open Source Project * * 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 applica...
Fix state definition for UriEndPointElement
#ifndef __KMS_URI_END_POINT_STATE_H__ #define __KMS_URI_END_POINT_STATE_H__ G_BEGIN_DECLS typedef enum { KMS_URI_END_POINT_STATE_STOP, KMS_URI_END_POINT_STATE_START, KMS_URI_END_POINT_STATE_PLAY } KmsUriEndPointState; G_END_DECLS #endif /* __KMS_URI_END_POINT_STATE__ */
#ifndef __KMS_URI_END_POINT_STATE_H__ #define __KMS_URI_END_POINT_STATE_H__ G_BEGIN_DECLS typedef enum { KMS_URI_END_POINT_STATE_STOP, KMS_URI_END_POINT_STATE_START, KMS_URI_END_POINT_STATE_PAUSE } KmsUriEndPointState; G_END_DECLS #endif /* __KMS_URI_END_POINT_STATE__ */
Remove extra warning in typedef/init/func test
// RUN: %check -e %s typedef int f(void) // CHECK: error: typedef storage on function { return 3; } typedef char c = 3; // CHECK: error: initialised typedef main() { int *p = (__typeof(*p))0; // CHECK: !/warn/ for(int _Alignas(long) x = 0; x; x++); // CHECK: !/warn/ return f(); // CHECK: !/warn/ }
// RUN: %check -e %s typedef int f(void) // CHECK: error: typedef storage on function { return 3; } typedef char c = 3; // CHECK: error: initialised typedef main() { int *p = (__typeof(*p))0; // can't check here - we think p is used uninit for(int _Alignas(long) x = 0; x; x++); // CHECK: !/warn/ return f(); //...
Disable negative test in shadowcallstack.
// RUN: %clang_scs -D INCLUDE_RUNTIME %s -o %t // RUN: %run %t // RUN: %clang_scs %s -o %t // RUN: not --crash %run %t // Basic smoke test for the runtime #include "libc_support.h" #ifdef INCLUDE_RUNTIME #include "minimal_runtime.h" #else #define scs_main main #endif int scs_main(void) { scs_fputs_stdout("In mai...
// RUN: %clang_scs %s -o %t // RUN: %run %t // Basic smoke test for the runtime #include "libc_support.h" #include "minimal_runtime.h" int scs_main(void) { scs_fputs_stdout("In main.\n"); return 0; }
Remove extraneous header file comment
// // CSCustomBanner.h // CommuteStream // // Created by David Rogers on 5/3/14. // Copyright (c) 2014 CommuteStream. All rights reserved. // #import <Foundation/Foundation.h> #import "GADCustomEventBanner.h" #import "GADCustomEventBannerDelegate.h" #import "GADBannerView.h" #import "GADBannerViewDelegate.h" #impo...
#import <Foundation/Foundation.h> #import "GADCustomEventBanner.h" #import "GADCustomEventBannerDelegate.h" #import "GADBannerView.h" #import "GADBannerViewDelegate.h" #import "CSNetworkEngine.h" @interface CSCustomBanner : NSObject <GADCustomEventBanner, GADBannerViewDelegate, UIGestureRecognizerDelegate> { GADBa...
Use GModule instead of libdl to load unit test symbols
#include <config.h> #include <dlfcn.h> #include <test-fixtures/test-unit.h> int main (int argc, char **argv) { const CoglUnitTest *unit_test; int i; if (argc != 2) { g_printerr ("usage %s UNIT_TEST\n", argv[0]); exit (1); } /* Just for convenience in case people try passing the wrapper ...
#include <config.h> #include <gmodule.h> #include <test-fixtures/test-unit.h> int main (int argc, char **argv) { GModule *main_module; const CoglUnitTest *unit_test; int i; if (argc != 2) { g_printerr ("usage %s UNIT_TEST\n", argv[0]); exit (1); } /* Just for convenience in case peopl...
Add support for wrapping a shared_ptr to a const
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_PYTHON_PYTHON_WRAP_CONST_SHARED_PTR_H #define VISTK_PYTHON_PYTHON_WRAP_CONST_SH...
Change TestString score to signed int
#include<stdint.h> #include<string> #include<stdexcept> #include<vector> // styled according to the Google C++ Style guide // https://google.github.io/styleguide/cppguide.html struct TestString { std::string s; uint8_t key; uint32_t score; }; TestString CreateTestString(std::string input_string, uint8_t input_key...
#include<stdint.h> #include<string> #include<stdexcept> #include<vector> // styled according to the Google C++ Style guide // https://google.github.io/styleguide/cppguide.html struct TestString { std::string s; uint8_t key; int32_t score; }; TestString CreateTestString(std::string input_string, uint8_t input_key)...
Add regression test where mine-lazy used to crash due to multiple paths
#include <pthread.h> struct options { unsigned short number_of_threads ; unsigned short cur_threads ; }; struct flags { unsigned char debug ; }; struct options o ; struct flags f ; int cleaner_start(void) { // make unknown int r; o.cur_threads = r; o.number_of_threads = r; f.debug = r; return 0...
Correct locaiton of msado15 for x64 dev platform
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> // TODO: reference additional headers your program requires here #include <io.h> #...
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> // TODO: reference additional headers your program requires here #include <io.h> #...
Increase size of section buffer
#ifndef DSMCC_TS_H #define DSMCC_TS_H #include <stdint.h> #define DSMCC_TSPARSER_BUFFER_SIZE (4096 + 188) struct dsmcc_tsparser_buffer { uint16_t pid; int si_seen; int in_section; int cont; uint8_t data[DSMCC_TSPARSER_BUFFER_SIZE]; struct dsmcc_tsparser_buffer *next; }; #endif
#ifndef DSMCC_TS_H #define DSMCC_TS_H #include <stdint.h> #define DSMCC_TSPARSER_BUFFER_SIZE 8192 struct dsmcc_tsparser_buffer { uint16_t pid; int si_seen; int in_section; int cont; uint8_t data[DSMCC_TSPARSER_BUFFER_SIZE]; struct dsmcc_tsparser_buffer *next; }; #endif
Change SAMpling Rate to 44.1K, ready for wav playing
#ifndef __SETTING_H__ #define __SETTING_H__ #define DITHERING_AMP 768; #define BUFFER_NUM 4 #define STAGE_NUM 4 #define SAMPLE_NUM 256 #define SAMPLE_MAX 2047 #define SAMPLING_RATE 45 /* In Kilo Hz, Make Sure it can divide 45000*/ #define SAMPLE_PERIOD (1.0f / SAMPLING_RATE) #define Q_1 1048576 #define Q_MULT_SHIF...
#ifndef __SETTING_H__ #define __SETTING_H__ #define DITHERING_AMP 768; #define BUFFER_NUM 4 #define STAGE_NUM 4 #define SAMPLE_NUM 256 #define SAMPLE_MAX 2047 #define SAMPLING_RATE 44.1 /* In Kilo Hz, Make Sure it can divide 45000*/ #define SAMPLE_PERIOD (1.0f / SAMPLING_RATE) #define Q_1 1048576 #define Q_MULT_SH...
Add general library header file for user convenience
/* liblightmodbus - a lightweight, multiplatform Modbus library Copyright (C) 2017 Jacek Wieczorek <mrjjot@gmail.com> This file is part of liblightmodbus. Liblightmodbus 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...
Add conversion from OpenSim array to vector
//__________________________________________________________________________ // Author(s): Claudio Pizzolato - October 2013 // email: claudio.pizzolato@griffithuni.edu.au // // DO NOT REDISTRIBUTE WITHOUT PERMISSION //__________________________________________________________________________ // #ifndef ArrayConverter...
Declare option "+" for TTreePlayer
/* @(#)root/treeplayer:$Name: $:$Id: LinkDef.h,v 1.1.1.1 2000/05/16 17:00:44 rdm Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * ...
/* @(#)root/treeplayer:$Name: $:$Id: LinkDef.h,v 1.2 2000/07/06 17:20:52 brun Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * ...
Debug info for init dunction.
/* This file is part of libcapwap. libcapwap 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 3 of the License, or (at your option) any later version. libcapwap is distribut...
/* This file is part of libcapwap. libcapwap 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 3 of the License, or (at your option) any later version. libcapwap is distribut...
Increase the sampling rate to 200khz
#ifndef __SETTING_H__ #define __SETTING_H__ #define BUFFER_NUM 4 #define STAGE_NUM 4 #define SAMPLE_NUM 256 #define SAMPLE_MAX 2047 #define SAMPLING_RATE 100 /* In Kilo Hz, Make Sure it can divide 45000*/ #define SAMPLE_PREIOD 1 / SAMPLE_RATE #define BLOCK_PREIOD SAMPLE_NUM / SAMPLING_RATE #define DELAY_BANK(x) DE...
#ifndef __SETTING_H__ #define __SETTING_H__ #define BUFFER_NUM 4 #define STAGE_NUM 4 #define SAMPLE_NUM 256 #define SAMPLE_MAX 2047 #define SAMPLING_RATE 200 /* In Kilo Hz, Make Sure it can divide 45000*/ #define SAMPLE_PREIOD 1 / SAMPLE_RATE #define BLOCK_PREIOD SAMPLE_NUM / SAMPLING_RATE #define DELAY_BANK(x) DE...
Add ammo and score fields to the player object
// // WulfGame/Game/Player.h // Copyright (C) 2012 Lexi Robinson // This code is freely available under the MIT licence. // #pragma once #include <glm/glm.hpp> #include "WulfConstants.h" #include "Game/InputManager.h" #include "Game/Constants.h" #include "Game/Entity.h" #include "Map/Map.h" namespace Wulf { class Pla...
// // WulfGame/Game/Player.h // Copyright (C) 2012 Lexi Robinson // This code is freely available under the MIT licence. // #pragma once #include <glm/glm.hpp> #include "WulfConstants.h" #include "Game/InputManager.h" #include "Game/Constants.h" #include "Game/Entity.h" #include "Map/Map.h" namespace Wulf { class Pla...
Add program to print whole words on new line
#include <stdio.h> #define IN 1 /* inside a word */ #define OUT 0 /* outside a word */ /* print words on a new line */ int main() { int state = OUT; int c = 0; int nl = 0; int nw = 0; int nc = 0; while ((c = getchar()) != EOF) { ++nc; if (c == '\n') { ++nl; ...
Use __i386__ instead of i386 in an ifdef.
/* $NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $ */ /* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. */ #ifndef _IEEEFP_H_ #define _IEEEFP_H_ #include <sys/cdefs.h> #include <machine/ieeefp.h> #ifdef i386 #include <machine/floatingpoint.h> #else extern fp_rnd fpgetround __P((void)); exter...
/* $NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $ */ /* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. */ #ifndef _IEEEFP_H_ #define _IEEEFP_H_ #include <sys/cdefs.h> #include <machine/ieeefp.h> #ifdef __i386__ #include <machine/floatingpoint.h> #else /* !__i386__ */ extern fp_rnd fpgetroun...
Add example where it is better to keep last expression
// PARAM: --sets solver td3 --enable ana.int.interval --disable ana.int.trier --disable exp.fast_global_inits --sets exp.partition-arrays.keep-expr "last" --enable exp.partition-arrays.enabled --set ana.activated "['base','expRelation','octagon']" void main(void) { example1(); } void example1(void) { int a[42];...
Update CWOS boot welcome messages
#include <uart.h> #include <irq.h> void cwos_boot() { uart_init(); uart0_send("Hello CWOS World\n"); irq_enable(); trigger_swi(); while (1) { } }
#include <uart.h> #include <irq.h> void cwos_boot() { uart_init(); uart0_send("Hello CWOS World\n"); uart0_send("Press any key to see echo:\n"); irq_enable(); while (1) { } }
Fix clang warning in tests for Chrome OS
// 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_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ #pragma once #include <string> ...
// 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_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_USER_MANAGER_H_ #pragma once #include <string> ...
Reduce jitter on network communication by enabling NO_DELAY, but still make large packets within a update cycle.
#ifndef SP2_IO_NETWORK_SOCKET_BASE_H #define SP2_IO_NETWORK_SOCKET_BASE_H #include <io/network/socketBase.h> #include <SFML/System/NonCopyable.hpp> namespace sp { namespace io { namespace network { class SocketBase : sf::NonCopyable { public: void setBlocking(bool blocking); void setNoDelay(bool no_delay);...
#ifndef SP2_IO_NETWORK_SOCKET_BASE_H #define SP2_IO_NETWORK_SOCKET_BASE_H #include <io/network/socketBase.h> #include <SFML/System/NonCopyable.hpp> namespace sp { namespace io { namespace network { class SocketBase : sf::NonCopyable { public: void setBlocking(bool blocking); void setTimeout(int millisecond...
Fix a chicken-and-egg problem: this files implements SSP support, so we cannot compile it with -fstack-protector[-all] flags (or it will self-recurse); this is ensured in sys/conf/files. This OTOH means that checking for defines __SSP__ and __SSP_ALL__ to determine if we should be compiling the support is impossible (w...
#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/libkern.h> #if defined(__SSP__) || defined(__SSP_ALL__) long __stack_chk_guard[8] = {}; void __stack_chk_fail(void); void __stack_chk_fail(void) { panic("stack ov...
#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/libkern.h> long __stack_chk_guard[8] = {}; void __stack_chk_fail(void); void __stack_chk_fail(void) { panic("stack overflow detected; backtrace may be corrupted")...
Add test for 0x00E0 (clear screen)
#include <assert.h> #include "../src/chip8.c" void test_clear_screen(void) { int i; chip8_t * chip8 = chip8_new(); chip8->memory[0x200] = 0x00; chip8->memory[0x201] = 0xE0; chip8_fetch_current_opcode(chip8); chip8_decode_current_opcode(chip8); i = 0; while (i < 64 * 32) { assert(chip8->memory[i+...
Use CLOCK_MONOTONIC as default timer clock to align with kenel events.
//----------------------------------- // Copyright Pierric Gimmig 2013-2017 //----------------------------------- #pragma once #include "BaseTypes.h" #include "Platform.h" #include "Utils.h" //----------------------------------------------------------------------------- typedef uint64_t TickType; //-----------------...
//----------------------------------- // Copyright Pierric Gimmig 2013-2017 //----------------------------------- #pragma once #include "BaseTypes.h" #include "Platform.h" #include "Utils.h" //----------------------------------------------------------------------------- typedef uint64_t TickType; //-----------------...
Add comment to test linking it back to the original Bugzilla PR.
// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i686-pc-linux-gnu int printf(char const*,...); void percentm(void) { printf("%m"); }
// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i686-pc-linux-gnu // PR 4142 - support glibc extension to printf: '%m' (which prints strerror(errno)). int printf(char const*,...); void percentm(void) { printf("%m"); }
Fix C file coding style
struct Inner { int x; }; struct Outer { struct Inner inner_embed; struct Inner* inner_var; }; void modify_via_outer(struct Outer* s) { s->inner_embed.x = 10; s->inner_var->x = 15; } void modify_inner(struct Inner* s) { s->x = 5; }
typedef struct Inner { int x; } Inner; typedef struct Outer { struct Inner inner_embed; struct Inner* inner_var; } Outer; void modify_via_outer(Outer* s) { s->inner_embed.x = 10; s->inner_var->x = 15; } void modify_inner(Inner* s) { s->x = 5; }
Send the "* BYE Logging out" before closing mailbox.
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_logout(struct client *client) { client_send_line(client, "* BYE Logging out"); if (client->mailbox != NULL) { /* this could be done at client_disconnect() as well, but eg. mbox rewrite takes a while so the waiting is ...
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "commands.h" int cmd_logout(struct client *client) { client_send_line(client, "* BYE Logging out"); o_stream_uncork(client->output); if (client->mailbox != NULL) { /* this could be done at client_disconnect() as well, but eg. mbox rewrite ...
Reduce the cost of getting the thread pointer by one jump on x86-64
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <errno.h> #include "native_client/src/untrusted/irt/irt.h" #include "native_client/src/untrusted/nacl/syscall_bindings_trampolin...
/* * Copyright (c) 2012 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <errno.h> #include "native_client/src/untrusted/irt/irt.h" #include "native_client/src/untrusted/nacl/syscall_bindings_trampolin...
Allow user to override default Xorg server binary
#ifndef XORGGTEST_DEFINES #define XORGGTEST_DEFINES #define DEFAULT_XORG_LOGFILE "/tmp/Xorg.GTest.log" #define DEFAULT_XORG_SERVER "Xorg" #define DEFAULT_DISPLAY 133 #endif
#ifndef XORGGTEST_DEFINES #define XORGGTEST_DEFINES #define DEFAULT_XORG_LOGFILE "/tmp/Xorg.GTest.log" #define DEFAULT_DISPLAY 133 /* Allow user to override default Xorg server*/ #ifndef DEFAULT_XORG_SERVER #define DEFAULT_XORG_SERVER "Xorg" #endif #endif
Use int, not ParseErrorType, to allow -1
// Copyright 2016 Mitchell Kember. Subject to the MIT License. #ifndef PARSE_H #define PARSE_H #include "error.h" #include "expr.h" // ParseResult contains the result of parsing text. The 'expr' field has a // meaningful value if and only if 'err_type' is -1. struct ParseResult { size_t chars_read; struct Expressi...
// Copyright 2016 Mitchell Kember. Subject to the MIT License. #ifndef PARSE_H #define PARSE_H #include "error.h" #include "expr.h" // ParseResult contains the result of parsing text. The 'expr' field has a // meaningful value if and only if 'err_type' is -1. struct ParseResult { size_t chars_read; // number o...
Make including malloc on MacOS compatible
#pragma once #include <fstream> #include <string> #include <cerrno> #include <clocale> #include <vector> #include <iostream> #include <stdlib.h> #include <malloc.h> #include <memory.h> #define _USE_MATH_DEFINES #include <math.h> #include <cairo.h> #include <gtkmm.h> #include <gtkmm/application.h> #include <gtkmm/windo...
#pragma once #include <fstream> #include <string> #include <cerrno> #include <clocale> #include <vector> #include <iostream> #include <stdlib.h> #ifdef __APPLE__ #include <stdlib.h> #else #include <malloc.h> #endif #include <memory.h> #define _USE_MATH_DEFINES #include <math.h> #include <cairo.h> #include <gtkmm.h> #i...
Fix possible invalid write on Windows-specific `strtok_r` stub
/* * public domain strtok_r() by Charlie Gordon * * from comp.lang.c 9/14/2007 * * http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684 * * (Declaration that it's public domain): * http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c */ #include <string.h> #ifdef __MING...
/* * public domain strtok_r() by Charlie Gordon * * from comp.lang.c 9/14/2007 * * http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684 * * (Declaration that it's public domain): * http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c */ #include <string.h> #ifdef __MING...
Add the blank line at the end of file to pass ICC compiler.
/** @file Page fault handler that does nothing. Copyright (c) 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may...
/** @file Page fault handler that does nothing. Copyright (c) 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may...
Remove annoying debug log message
#include <arch/x64/interrupts.h> #include <arch/x64/pic.h> #include <arch/x64/port.h> #include <truth/interrupts.h> #include <truth/log.h> #include <truth/scheduler.h> #define Timer_IRQ_Number 0x20 #define Timer_Magic_Number 1193180 #define Timer_Chan_0 0x40 #define Timer_Chan_1 0x41 #define Timer_Chan_2 0x42 #defin...
#include <arch/x64/interrupts.h> #include <arch/x64/pic.h> #include <arch/x64/port.h> #include <truth/interrupts.h> #include <truth/log.h> #include <truth/scheduler.h> #define Timer_IRQ_Number 0x20 #define Timer_Magic_Number 1193180 #define Timer_Chan_0 0x40 #define Timer_Chan_1 0x41 #define Timer_Chan_2 0x42 #defin...
Modify session id and first test of logger
#include <errno.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> FILE* logfile; void init() { // Change the umask so we can write to log files umask(0); // We should initialize and open log files here logfile = fopen("./creddit.log", "a"); if (logfile == NULL) { print...
#include <errno.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> FILE* logfile; void init() { // Change the umask so we can write to log files umask(0); // We should initialize and open log files here logfile = fopen("./creddit.log", "a"); if (logfile == NULL) { print...
Fix english language for new line length
#include "num2words.h" const Language LANG_ENGLISH = { .hours = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve" }, .phrases = { "*$1 o'clock ", "five past *$1 ", "ten past *$1 ", "quarter past *$1...
#include "num2words.h" const Language LANG_ENGLISH = { .hours = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve" }, #ifdef PBL_PLATFORM_CHALK .phrases = { "*$1 o'clock ", "five past *$1 ", "ten past *$...
Use __VA_ARGS__ for better portability
/* $Id$ */ #ifndef __log_h__ #define __log_h__ #include "internal.h" #define UNSHIELD_LOG_LEVEL_LOWEST 0 #define UNSHIELD_LOG_LEVEL_ERROR 1 #define UNSHIELD_LOG_LEVEL_WARNING 2 #define UNSHIELD_LOG_LEVEL_TRACE 3 #define UNSHIELD_LOG_LEVEL_HIGHEST 4 #ifdef __cplusplus extern "C" { #endif void _unshi...
/* $Id$ */ #ifndef __log_h__ #define __log_h__ #include "internal.h" #define UNSHIELD_LOG_LEVEL_LOWEST 0 #define UNSHIELD_LOG_LEVEL_ERROR 1 #define UNSHIELD_LOG_LEVEL_WARNING 2 #define UNSHIELD_LOG_LEVEL_TRACE 3 #define UNSHIELD_LOG_LEVEL_HIGHEST 4 #ifdef __cplusplus extern "C" { #endif void _unshi...
Add line length example from chapter 1-9
// // Created by matti on 14.9.2015. // #include <stdio.h> #define MAXLINE 1000 int getnewline(char line[], int maxline); void copy(char to[], char from[]); main() { int len; int max; char line[MAXLINE]; char longest[MAXLINE]; max = 0; while ((len = getnewline(line, MAXLINE)) > 0) { ...