Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix "No new line at end of file" warning. | // AnalyticsUtils.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#define SEGStringize_helper(x) #x
#define SEGStringize(x) @SEGStringize_helper(x)
NSURL *SEGAnalyticsURLForFilename(NSString *filename);
// Async Utils
dispatch_queue_t seg_dispatch_queue_create_specific(con... | // AnalyticsUtils.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#define SEGStringize_helper(x) #x
#define SEGStringize(x) @SEGStringize_helper(x)
NSURL *SEGAnalyticsURLForFilename(NSString *filename);
// Async Utils
dispatch_queue_t seg_dispatch_queue_create_specific(con... |
Add space, commit to main | //
// MapAnnotationList.h
// GrizSpace
//
// Created by Kevin Scott on 3/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MapAnnotation.h"
@interface MapAnnotationList : NSObject
{
//int currentAnnotationIndex; //the currently selected annotati... | //
// MapAnnotationList.h
// GrizSpace
//
// Created by Kevin Scott on 3/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MapAnnotation.h"
@interface MapAnnotationList : NSObject
{
//int currentAnnotationIndex; //the currently selected annotat... |
Test for animation which hasn't been implemented yet. |
//main
void cog_init();
void cog_mainloop();
void cog_destroy();
|
//main
void cog_init();
void cog_mainloop();
void cog_destroy();
//anim
typedef struct cog_sprite
{
}cog_sprite;
cog_sprite* cog_add_anim(char* animimg, int milliseconds, ...);
void cog_play_anim(cog_sprite* sprite);
|
Allow building executable without any project code. | #include <stdio.h>
#include <stdint.h>
#if PROJECT == 1
# include "project_1.h"
#else
# error Unsupported project number in PROJECT macro. Valid values: 1
#endif
int main(int argc, char **argv)
{
printf("Hello, world!\n");
# if PROJECT == 1
project_1_report();
# endif
return 0;
}
| #include <stdio.h>
#include <stdint.h>
#if PROJECT == 0
# // NOTE(bja, 2017-02): Building main with no project code.
#elif PROJECT == 1
# include "project_1.h"
#else
# error "Unsupported project number in PROJECT macro. Valid values: 0, 1"
#endif
int main(int argc, char **argv)
{
printf("Hello, world!\n"... |
Make mocked functions take std::string to allow == compare | #ifndef __EVIL_TEST_SYSCALLS_MOCK_H
#define __EVIL_TEST_SYSCALLS_MOCK_H
#include <gmock/gmock.h>
#include <string>
#include <stack>
#include "os/syscalls.h"
namespace evil {
class SyscallsMock
{
private:
static thread_local std::stack<SyscallsMock *> _instance_stack;
public:
SyscallsMock() { _instance_sta... | #ifndef __EVIL_TEST_SYSCALLS_MOCK_H
#define __EVIL_TEST_SYSCALLS_MOCK_H
#include <gmock/gmock.h>
#include <string>
#include <stack>
#include "os/syscalls.h"
namespace evil {
class SyscallsMock
{
private:
static thread_local std::stack<SyscallsMock *> _instance_stack;
public:
SyscallsMock() { _instance_sta... |
Move BankingMode enum from base class to MBC1 | #pragma once
#include <vector>
#include "types.h"
class MemoryBankController
{
public:
MemoryBankController() = delete;
MemoryBankController(const std::vector<u8> &rom, std::vector<u8> &ram) : rom(rom), ram(ram) {}
virtual ~MemoryBankController() {}
virtual u8 get8(uint address) const = 0;
virtual void set... | #pragma once
#include <vector>
#include "types.h"
class MemoryBankController
{
public:
MemoryBankController() = delete;
MemoryBankController(const std::vector<u8> &rom, std::vector<u8> &ram) : rom(rom), ram(ram) {}
virtual ~MemoryBankController() {}
virtual u8 get8(uint address) const = 0;
virtual void set... |
Add third_party/ prefix to ppapi include for checkdeps. | // 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 WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#include "ppapi/c/pp_var.h"
#define PPB_PRIVATE_INTERFACE "PPB... | // 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 WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#include "third_party/ppapi/c/pp_var.h"
#define PPB_PRIVATE_IN... |
Use provided byteorder convertions on GLIBC systems | #ifndef JAGUAR_HELPER_H_
#define JAGUAR_HELPER_H_
#include <boost/detail/endian.hpp>
#include <stdint.h>
#include "jaguar_api.h"
#ifdef BOOST_LITTLE_ENDIAN
#define htole16(x) x
#define htole32(x) x
#define le16toh(x) x
#define le32toh(x) x
#elif BOOST_BIG_ENDIAN
#error big endian architectures are unsupported
#else
#... | #ifndef JAGUAR_HELPER_H_
#define JAGUAR_HELPER_H_
#include <boost/detail/endian.hpp>
#include <stdint.h>
#include "jaguar_api.h"
#ifndef __GLIBC__
# ifdef BOOST_LITTLE_ENDIAN
# define htole16(x) x
# define htole32(x) x
# define le16toh(x) x
# define le32toh(x) x
# elif BOOST_BIG_ENDIAN
# error big endian archite... |
Add TrackedValue to test/support. Thanks to Louis Dionne | #ifndef SUPPORT_TRACKED_VALUE_H
#define SUPPORT_TRACKED_VALUE_H
#include <cassert>
struct TrackedValue {
enum State { CONSTRUCTED, MOVED_FROM, DESTROYED };
State state;
TrackedValue() : state(State::CONSTRUCTED) {}
TrackedValue(TrackedValue const& t) : state(State::CONSTRUCTED) {
assert(t.st... | |
Fix nasty sign propagation bug on gcc and 32 bit architectures. | #include "ruby.h"
#include "narray.h"
VALUE na_address(VALUE self) {
struct NARRAY *ary;
void * ptr;
VALUE ret;
GetNArray(self,ary);
ptr = ary->ptr;
ret = ULL2NUM( (unsigned long long int) ptr);
return ret;
}
void Init_narray_ffi_c() {
ID id;
VALUE klass;
id = rb_intern("NArray");
klass = rb_co... | #include "ruby.h"
#include "narray.h"
VALUE na_address(VALUE self) {
struct NARRAY *ary;
void * ptr;
VALUE ret;
GetNArray(self,ary);
ptr = ary->ptr;
ret = ULL2NUM( sizeof(ptr) == 4 ? (unsigned long long int) (unsigned long int) ptr : (unsigned long long int) ptr );
return ret;
}
void Init_narray_ffi_c(... |
Add compile option for sqlite db upgrades. | /* Uncomment to compile with tcpd/libwrap support. */
//#define WITH_WRAP
/* Compile with database upgrading support? If disabled, mosquitto won't
* automatically upgrade old database versions. */
//#define WITH_DB_UPGRADE
/* Compile with memory tracking support? If disabled, mosquitto won't track
* heap memory usa... | /* Uncomment to compile with tcpd/libwrap support. */
//#define WITH_WRAP
/* Compile with database upgrading support? If disabled, mosquitto won't
* automatically upgrade old database versions. */
//#define WITH_DB_UPGRADE
/* Compile with memory tracking support? If disabled, mosquitto won't track
* heap memory usa... |
Fix per Noris Datum's E-Mail. | #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass *, cons... | #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
virtual ~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass... |
Support notifications for SD cards. | #define SOCK_PATH "/var/run/devd.pipe"
#define REGEX "subsystem=CDEV type=(CREATE|DESTROY) cdev=(da[0-9]+[a-z]+[0-9]?[a-z]?)"
| #define SOCK_PATH "/var/run/devd.pipe"
#define REGEX "subsystem=CDEV type=(CREATE|DESTROY) cdev=((da|mmcsd)[0-9]+[a-z]+[0-9]?[a-z]?)"
|
Add this header back, its existance is an SVR4-ELF tradition. Our ELF hints bits are still a seperate file. | /*-
* Copyright (c) 1997 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of co... | |
Check size of unsigned long | /*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H
#... | /*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H
#... |
Add compact mode for phone landscape orientation | //
// constants.h
// AESTextEncryption
//
// Created by Evgenii Neumerzhitckii on 21/02/2015.
// Copyright (c) 2015 Evgenii Neumerzhitckii. All rights reserved.
//
#define aesCompactHeight 400
#define aesPasswordTopMargin 11
#define aesPasswordTopMargin_compact 4
#define aesMessageTopMargin 10
#define aesMessage... | //
// Created by Evgenii Neumerzhitckii on 21/02/2015.
// Copyright (c) 2015 Evgenii Neumerzhitckii. All rights reserved.
//
#define aesCompactHeight 400
#define aesPasswordTopMargin 11
#define aesPasswordTopMargin_compact 4
#define aesMessageTopMargin 10
#define aesMessageTopMargin_compact 0
#define aesPasswordH... |
Add lorito_pmc_init to the proper header. | #include "lorito.h"
#ifndef LORITO_INTERP_H_GUARD
#define LORITO_INTERP_H_GUARD
Lorito_Ctx *
lorito_ctx_init(Lorito_Ctx *next_ctx, Lorito_Codeseg *codeseg);
Lorito_Interp *
lorito_init();
int
lorito_run(Lorito_Interp *interp);
#endif /* LORITO_INTERP_H_GUARD */
| #include "lorito.h"
#ifndef LORITO_INTERP_H_GUARD
#define LORITO_INTERP_H_GUARD
Lorito_Ctx *
lorito_ctx_init(Lorito_Ctx *next_ctx, Lorito_Codeseg *codeseg);
Lorito_PMC *
lorito_pmc_init(Lorito_Interp *interp, int size);
Lorito_Interp *
lorito_init();
int
lorito_run(Lorito_Interp *interp);
#endif /* LORITO_INTERP_... |
Make sure callbacks are called for user events | #include "pocl_cl.h"
#include "pocl_timing.h"
CL_API_ENTRY cl_int CL_API_CALL
POname(clSetUserEventStatus)(cl_event event ,
cl_int execution_status )
CL_API_SUFFIX__VERSION_1_1
{
/* Must be a valid user event */
POCL_RETURN_ERROR_COND((event == NULL), CL_INVALID_EVENT);
POCL_RETUR... | #include "pocl_cl.h"
#include "pocl_timing.h"
CL_API_ENTRY cl_int CL_API_CALL
POname(clSetUserEventStatus)(cl_event event ,
cl_int execution_status )
CL_API_SUFFIX__VERSION_1_1
{
/* Must be a valid user event */
POCL_RETURN_ERROR_COND((event == NULL), CL_INVALID_EVENT);
POCL_RETUR... |
Fix a warning in the new DWARFheader. Add a new line at the end of the file. | //===-- DWARFRelocMap.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===-- DWARFRelocMap.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Handle the name collision (with WinSock.h) for NO_ADDRESS | // Machine types
typedef unsigned char Byte; /* 8 bits */
typedef unsigned short SWord; /* 16 bits */
typedef unsigned int DWord; /* 32 bits */
typedef unsigned int dword; /* 32 bits */
typedef unsigned int Word; /* 32 bits */
typedef unsigned int ADDRESS; /* 32-bit unsigned */
#define STD_SIZE... | /*
* types.h: some often used basic type definitions
* $Revision$
*/
#ifndef __TYPES_H__
#define __TYPES_H__
// Machine types
typedef unsigned char Byte; /* 8 bits */
typedef unsigned short SWord; /* 16 bits */
typedef unsigned int DWord; /* 32 bits */
typedef unsigned int dword; /* 32 bits */
typedef unsig... |
Add override keyword to overridden method | #pragma once
#include "bpftrace.h"
#include "log.h"
#include "pass_manager.h"
#include "visitors.h"
namespace bpftrace {
namespace ast {
class NodeCounter : public Visitor
{
public:
void Visit(Node &node)
{
count_++;
Visitor::Visit(node);
}
size_t get_count()
{
return count_;
};
private:
s... | #pragma once
#include "bpftrace.h"
#include "log.h"
#include "pass_manager.h"
#include "visitors.h"
namespace bpftrace {
namespace ast {
class NodeCounter : public Visitor
{
public:
void Visit(Node &node) override
{
count_++;
Visitor::Visit(node);
}
size_t get_count()
{
return count_;
};
pri... |
Add warning test for -mgpopt option. | // REQUIRES: mips-registered-target
// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt 2>&1 | FileCheck -check-prefix=IMPLICIT %s
// IMPLICIT: warning: ignoring '-mgpopt' option as it cannot be used with the implicit usage of-mabicalls
// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt -mabicalls 2>&1 | FileCh... | |
Convert also 0x80..0x9f characters to '?' | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if ((unsigned char)*p < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
fo... | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if (((unsigned char)*p & 0x7f) < 32)
break;
}
str_append_n(dest, src, (size_t)(p - s... |
Hide internal function declaration on ES2 builds. | #ifndef Magnum_Implementation_maxTextureSize_h
#define Magnum_Implementation_maxTextureSize_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of... | #ifndef Magnum_Implementation_maxTextureSize_h
#define Magnum_Implementation_maxTextureSize_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of... |
Subtract one old school sector | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <getopt.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include "utils.h"
#include "logSpeed.h"
int keepRunning = 1;
int main(... | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <getopt.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include "utils.h"
#include "logSpeed.h"
int keepRunning = 1;
int main(... |
Add fakes for common test cases |
#ifndef GLOBAL_FAKES_H_
#define GLOBAL_FAKES_H_
#include "../fff3.h"
void global_void_func(void);
DECLARE_FAKE_VOID_FUNC0(global_void_func);
#endif /* GLOBAL_FAKES_H_ */
|
#ifndef GLOBAL_FAKES_H_
#define GLOBAL_FAKES_H_
#include "../fff3.h"
//// Imaginary production code header file ///
void voidfunc1(int);
void voidfunc2(char, char);
long longfunc0();
enum MYBOOL { FALSE = 899, TRUE };
struct MyStruct {
int x;
int y;
};
enum MYBOOL enumfunc();
struct MyStruct structfunc();... |
Fix this up per llvm-gcc r109819. | // RUN: not %llvmgcc -std=gnu99 %s -S |& grep "error: alignment for"
int foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
return 4;
}
| // RUN: %llvmgcc_only -std=gnu99 %s -S |& grep "warning: alignment for"
int foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
return 4;
}
|
Update C header to match capi.rs function names. | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef _MP4PARSE_RUST_H
#define _MP4PARSE_RUST_H
#ifdef __cplusplus
extern "C" {
#endif
struct mp4parse_state;
s... | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef _MP4PARSE_RUST_H
#define _MP4PARSE_RUST_H
#ifdef __cplusplus
extern "C" {
#endif
struct mp4parse_state;
s... |
Set default values for Cell members. | #ifndef RWTE_COORDS_H
#define RWTE_COORDS_H
struct Cell
{
int row, col;
inline bool operator==(const Cell& other) const
{
return row == other.row && col == other.col;
}
inline bool operator!=(const Cell& other) const
{
return row != other.row || col != other.col;
}
in... | #ifndef RWTE_COORDS_H
#define RWTE_COORDS_H
struct Cell
{
int row = 0;
int col = 0;
inline bool operator==(const Cell& other) const
{
return row == other.row && col == other.col;
}
inline bool operator!=(const Cell& other) const
{
return row != other.row || col != other.co... |
Change update_period to 15 seconds | const char *field_sep = " \u2022 ";
const char *time_fmt = "%x %I:%M %p";
const int update_period = 90;
char *
loadavg(void)
{
double avgs[3];
if (getloadavg(avgs, 3) < 0) {
perror("getloadavg");
exit(1);
}
return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
}
char *
prettytime(void)
{
return... | const char *field_sep = " \u2022 ";
const char *time_fmt = "%x %I:%M %p";
const int update_period = 15;
char *
loadavg(void)
{
double avgs[3];
if (getloadavg(avgs, 3) < 0) {
perror("getloadavg");
exit(1);
}
return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
}
char *
prettytime(void)
{
return... |
Update adapter version number to 6.4.3.0 | //
// Copyright © 2019 Google. All rights reserved.
//
static NSString *const kGADMAdapterVungleVersion = @"6.4.2.1";
static NSString *const kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const kGADMAdapterVungleErrorDomain ... | //
// Copyright © 2019 Google. All rights reserved.
//
static NSString *const kGADMAdapterVungleVersion = @"6.4.3.0";
static NSString *const kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const kGADMAdapterVungleErrorDomain ... |
Add helper functions to safely release Windows COM resources, and arrays of COM resources. | //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angleutils.h: Common ANGLE utilities.
#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_
// A macro to disallow the copy c... | //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angleutils.h: Common ANGLE utilities.
#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_
// A macro to disallow the copy c... |
Reduce history size to 32 buckets | #ifndef _CONFIG_H_
#define _CONFIG_H_
#define DEBUG 0
#define BADGE_MINIMUM_ID 3000 /* Inclusive */
#define BADGE_MAXIMUM_ID 8000 /* Inclusive */
#define HISTORY_WINDOW_SIZE 128
/** Optionally workaround a bug whereby sequence IDs are
* not held constant within a burst of identical packets
*
* Set to ... | #ifndef _CONFIG_H_
#define _CONFIG_H_
#define DEBUG 0
#define BADGE_MINIMUM_ID 3000 /* Inclusive */
#define BADGE_MAXIMUM_ID 8000 /* Inclusive */
#define HISTORY_WINDOW_SIZE 32
/** Optionally workaround a bug whereby sequence IDs are
* not held constant within a burst of identical packets
*
* Set to 0... |
Raise maximum groups in chtest to the same number used in ch-run. | /* Try to drop the last supplemental group, and print a message to stdout
describing what happened. */
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define NGROUPS_MAX 32
int main()
{
int group_ct;
gid_t groups[NGROUPS_MAX];
group_ct = getgroups(NGROU... | /* Try to drop the last supplemental group, and print a message to stdout
describing what happened. */
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define NGROUPS_MAX 128
int main()
{
int group_ct;
gid_t groups[NGROUPS_MAX];
group_ct = getgroups(NGRO... |
Add OSX-specific macro to the list of platforms detected as UNIX | /*
Copyright 2016 Andreas Bjerkeholt
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 writing, software
... | /*
Copyright 2016 Andreas Bjerkeholt
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 writing, software
... |
Add an unused interface for storing thumbnails. This is to replace the history system's thumbnail storage. | // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_THUMBNAIL_STORE_H_
#define CHROME_BROWSER_THUMBNAIL_STORE_H_
#include <vector>
#include "base/file_path.h"
class GURL;
class... | |
Implement Exercise 5-10 for addition, subtraction, and division | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
// Exercise 5-11
#define MAX 1000
int pop(void);
void push(int n);
int main(int argc, char *argv[])
{
while (--argc > 0 && argv++ != NULL)
{
printf("%s\n", *argv);
if(*argv[0] == '+')
{
push(pop() + pop());
}
else if(*argv[0] == ... | |
Add a wrapper for Team ids | #ifndef MUE__TEAMS_H
#define MUE__TEAMS_H
#include <iostream>
#include "config.h"
namespace mue {
class Team {
private:
Team_id _id;
Team() {}
public:
Team(Team_id id)
: _id(id)
{}
inline bool operator<(const Team& other) const { return _id < other._id; }
inline bool operator>(const Team& othe... | |
Add explanation to the regression test 02 44 | // PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>
int main(void) {
int *r = malloc(5 * sizeof(int));
r[3] = 2;
assert(r[4] == 2);
} | // PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>
int main(void) {
int *r = malloc(5 * sizeof(int));
r[3] = 2;
assert(r[4] == 2);
(* Here we only test our implementation. Concretely, accessing the uninitialised r[4] is undefined behavio... |
Remove a duplicate and unused macro | #ifndef _AL_ERROR_H_
#define _AL_ERROR_H_
#include "alMain.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ALboolean TrapALError;
ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
#define SET_ERROR_AND_RETURN(ctx, err) do { \
alSetError((ctx), (err)); \
return; ... | #ifndef _AL_ERROR_H_
#define _AL_ERROR_H_
#include "alMain.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ALboolean TrapALError;
ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
#ifdef __cplusplus
}
#endif
#endif
|
Add test case for <rdar://problem/8177927> (which triggered an assertion failure in SemaChecking). | // RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3459
struct bar {
char n[1];
};
struct foo {
char name[(int)&((struct bar *)0)->n];
char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}}
};
// PR3430
struct s {
struct st {
int v;
} *ts;
};
struct st;
int foo() {
stru... | // RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3459
struct bar {
char n[1];
};
struct foo {
char name[(int)&((struct bar *)0)->n];
char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}}
};
// PR3430
struct s {
struct st {
int v;
} *ts;
};
struct st;
int foo() {
stru... |
Make this file more BSD-like |
#ifndef _TERMCAP_H
#define _TERMCAP_H 1
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <sys/cdefs.h>
extern char PC;
extern char *UP;
extern char *BC;
extern short ospeed;
extern int tgetent __P((char *, const char *));
extern int tgetflag __P((const char *));
extern int tgetnum __P((const cha... | #ifndef _TERMCAP_H
#define _TERMCAP_H 1
#include <sys/cdefs.h>
__BEGIN_DECLS
extern char PC;
extern char *UP;
extern char *BC;
extern short ospeed;
extern int tgetent __P((char *, const char *));
extern int tgetflag __P((const char *));
extern int tgetnum __P((const char *));
extern char *tgetstr __P((const char *,... |
Remove references to NS...Edge in enum | //
// INPopoverControllerDefines.h
// Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//
typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
INPopoverArrowDirectionUndefined = 0,
INPopoverArrowDirectionLeft = NSMaxXEdge,
INPopoverArrowDirectionRight = NSMinXEdge,
INPopoverArrowDirectionUp = NSM... | //
// INPopoverControllerDefines.h
// Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//
typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
INPopoverArrowDirectionUndefined = 0,
INPopoverArrowDirectionLeft,
INPopoverArrowDirectionRight,
INPopoverArrowDirectionUp,
INPopoverArrowDirectionDown
}... |
Change 'unsigned character' type variables to 'uint8_t' | #include "modlib.h"
uint16_t MODBUSSwapEndian( uint16_t Data )
{
//Change big-endian to little-endian and vice versa
unsigned char Swap;
//Create 2 bytes long union
union Conversion
{
uint16_t Data;
unsigned char Bytes[2];
} Conversion;
//Swap bytes
Conversion.Data = Data;
... | #include "modlib.h"
uint16_t MODBUSSwapEndian( uint16_t Data )
{
//Change big-endian to little-endian and vice versa
uint8_t Swap;
//Create 2 bytes long union
union Conversion
{
uint16_t Data;
uint8_t Bytes[2];
} Conversion;
//Swap bytes
Conversion.Data = Data;
Swap = C... |
Add the missing PNaCl atomicops support. | // Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistri... | |
Fix main exiting with error code on error-less run | #include <stdio.h>
#include <stdlib.h>
#include "http/http.h"
int main(int argc, char *argv[])
{
http_sock *sock = open_http();
if (sock == NULL)
goto cleanup;
// TODO: print port then fork
uint32_t port = get_port_number(sock);
printf("%u\n", port);
while (1) {
http_conn *conn = accept_conn(sock);
if (... | #include <stdio.h>
#include <stdlib.h>
#include "http/http.h"
int main(int argc, char *argv[])
{
http_sock *sock = open_http();
if (sock == NULL)
goto cleanup;
// TODO: print port then fork
uint32_t port = get_port_number(sock);
printf("%u\n", port);
while (1) {
http_conn *conn = accept_conn(sock);
if (... |
Change blink program to use pb4 since that's the pin the test LED is wired to on my programming board | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
// A simple blinky program for ATtiny85
// Connect red LED at pin 2 (PB3)
//
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// set PB3 to be o... | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
// A simple blinky program for ATtiny85
// Connect red LED at pin 3 (PB4)
//
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// set PB4 to be o... |
Fix stupid error for Linux build. | // 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_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#incl... | // 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_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#incl... |
Fix splint error src/pcsc-wirecheck-dist.c:19:164: Body of if clause of if statement is empty | /*
* Copyright (C) 2007
* Jacob Berkman
* Copyright (C) 2008
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*/
#ifndef LASSERT_H
#define LASSERT_H
#include <stdio.h>
#include <stdlib.h>
#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif
#define LASSERT(cond) ... | /*
* Copyright (C) 2007
* Jacob Berkman
* Copyright (C) 2008
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*/
#ifndef LASSERT_H
#define LASSERT_H
#include <stdio.h>
#include <stdlib.h>
#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif
#define LASSERT(cond) ... |
Update to new bookkeeping array format. | void
delput(float x, float *a, int *l)
{
/* put value in delay line. See delset. x is float */
*(a + (*l)++) = x;
if(*(l) >= *(l+1)) *l -= *(l+1);
}
| /* put value in delay line. See delset. x is float */
void
delput(float x, float *a, int *l)
{
int index = l[0];
a[index] = x;
l[0]++;
if (l[0] >= l[2])
l[0] -= l[2];
}
|
Make constructor for taking in curl code as the first argument | #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAI... | #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAI... |
Use TWO_PI constant instead of literal | #pragma once
#include <array>
class WaveShape {
public:
static const unsigned int granularity = 12;
static const int16_t size = 1 << granularity;
std::array<int16_t, size> table = {{0}};
};
inline WaveShape MkSineWaveShape() {
WaveShape waveShape;
for(unsigned int i = 0; i < WaveShape::size;... | #pragma once
#include <array>
#include <polar/math/constants.h>
class WaveShape {
public:
static const unsigned int granularity = 12;
static const int16_t size = 1 << granularity;
std::array<int16_t, size> table = {{0}};
};
inline WaveShape MkSineWaveShape() {
WaveShape waveShape;
for(unsign... |
Add explicit cast from (const char []) to (SQLCHAR *) | #include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>
SQLLEN nullDataHDBC = SQL_NULL_DATA;
int sqlSucceeded(SQLRETURN ret) {
return SQL_SUCCEEDED(ret);
}
void *getSqlOvOdbc3(void) {
return (void *)SQL_OV_ODBC3;
}
SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
return SQLTables(st... | #include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>
SQLLEN nullDataHDBC = SQL_NULL_DATA;
int sqlSucceeded(SQLRETURN ret) {
return SQL_SUCCEEDED(ret);
}
void *getSqlOvOdbc3(void) {
return (void *)SQL_OV_ODBC3;
}
SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
return SQLTables(st... |
Add leaf checks to SHA CPUID checks | /**
* cpuid.c
*
* Checks if CPU has support of SHA instructions
*
* @author kryukov@frtk.ru
* @version 4.0
*
* For Putty AES NI project
* http://putty-aes-ni.googlecode.com/
*/
#ifndef SILENT
#include <stdio.h>
#endif
#if defined(__clang__) || defined(__GNUC__)
#include <cpuid.h>
static int CheckCPUsupport... | /**
* cpuid.c
*
* Checks if CPU has support of SHA instructions
*
* @author kryukov@frtk.ru
* @version 4.0
*
* For Putty AES NI project
* http://putty-aes-ni.googlecode.com/
*/
#ifndef SILENT
#include <stdio.h>
#endif
#if defined(__clang__) || defined(__GNUC__)
#include <cpuid.h>
static int CheckCPUsupport... |
Define the type of marking flags as unsigned int. | /**
* See Copyright Notice in picrin.h
*/
#ifndef GC_H__
#define GC_H__
#if defined(__cplusplus)
extern "C" {
#endif
enum pic_gc_mark {
PIC_GC_UNMARK = 0,
PIC_GC_MARK
};
union header {
struct {
union header *ptr;
size_t size;
enum pic_gc_mark mark : 1;
} s;
long alignment[2];
};
struct heap... | /**
* See Copyright Notice in picrin.h
*/
#ifndef GC_H__
#define GC_H__
#if defined(__cplusplus)
extern "C" {
#endif
#define PIC_GC_UNMARK 0
#define PIC_GC_MARK 1
union header {
struct {
union header *ptr;
size_t size;
unsigned int mark : 1;
} s;
long alignment[2];
};
struct heap_page {
union... |
Update Skia milestone to 64 | /*
* 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 63
#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 64
#endif
|
Fix documentation comment to match actual params. | /*
* Copyright (C) 2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__
#include "common.h"
#include "types.h"
#include "indexe... | /*
* Copyright (C) 2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__
#include "common.h"
#include "types.h"
#include "indexe... |
Fix for totally bogus interface declaration | //
// SocketIOJSONSerialization.h
// v0.22 ARC
//
// based on
// socketio-cocoa https://github.com/fpotter/socketio-cocoa
// by Fred Potter <fpotter@pieceable.com>
//
// using
// https://github.com/square/SocketRocket
// https://github.com/stig/json-framework/
//
// reusing some parts of
// /socket.io/socket.... | //
// SocketIOJSONSerialization.h
// v0.22 ARC
//
// based on
// socketio-cocoa https://github.com/fpotter/socketio-cocoa
// by Fred Potter <fpotter@pieceable.com>
//
// using
// https://github.com/square/SocketRocket
// https://github.com/stig/json-framework/
//
// reusing some parts of
// /socket.io/socket.... |
Fix error result handling in os.rmdir() | /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z... | /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z... |
Hide internal methods using friend class specifier | #ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H
#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>
class InotifyEventLoop;
class InotifyTree;
class InotifyService {
public:
InotifyService(std::string path);
~InotifyService();
void create(... | #ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H
#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>
class InotifyEventLoop;
class InotifyTree;
class InotifyService {
public:
InotifyService(std::string path);
~InotifyService();
private:
voi... |
Allow registering builtin dict drivers multiple times. | /* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
void dict_drivers_register_builtin(void)
{
dict_driver_register(&dict_driver_client);
dict_driver_register(&dict_driver_file);
dict_driver_register(&dict_driver_fs);
dict_driver_register(&dict_d... | /* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
static int refcount = 0;
void dict_drivers_register_builtin(void)
{
if (refcount++ > 0)
return;
dict_driver_register(&dict_driver_client);
dict_driver_register(&dict_driver_file);
dict_driver... |
Add code to do basic image resizing | /**
* http://www.compuphase.com/graphic/scale.htm
*/
void ScaleLine(int *Target, int *Source, int SrcWidth, int TgtWidth)
{
int NumPixels = TgtWidth;
int IntPart = SrcWidth / TgtWidth;
int FractPart = SrcWidth % TgtWidth;
int E = 0;
while (NumPixels-- > 0) {
*Target++ = *Source;
Source += IntPart;... | |
Reimplement no-op version of DLOG to avoid C++ compiler warning | #pragma once
#include <iostream>
// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace evmjit
{
std::ostream& getLogStream(char const* _channel);
}
}
#define DLOG(CHANNEL) ::dev::evmjit::getLo... | #pragma once
#include <iostream>
// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace evmjit
{
std::ostream& getLogStream(char const* _channel);
}
}
#define DLOG(CHANNEL) ::dev::evmjit::getLo... |
Change TDCHits array size from 100 to 50 | #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 100
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[M... | #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 50
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[MA... |
Remove printf for testing with check50 | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
// constant
#define ALPHA_NUM 26
int main(int argc, char *argv[]) {
// check argument number and argument key to be greater than -1
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage (k >= 0):\n./caesar k \n");
... | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
// constant
#define ALPHA_NUM 26
int main(int argc, char *argv[]) {
// check argument number and argument key to be greater than -1
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage (k >= 0):\n./caesar k \n");
... |
Add variable name to namespace binding | #ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H
#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif
#ifdef __cplusplus
#define Z_ENUM_CLASS(ns, n) enum class n
#else
#define Z_ENUM_CLASS(ns, n) enum ns ## _ ## n
#endif
#ifdef __cplusplus
#de... | #ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H
#ifdef __cplusplus
#define Z_VAR(ns, n) n
#else
#define Z_VAR(ns, n) ns ## _ ## n
#endif
#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif
#ifdef __cplusplus
#define Z_ENUM_CLASS(ns, n) enum ... |
Add template helper functions for std::map | /**
* @file Map.h
* @ingroup Utils
* @brief Template helper functions for std::map
*
* Copyright (c) 2017 Sebastien Rombauts (sebastien.rombauts@gmail.com)
*
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
* or copy at http://opensource.org/licenses/MIT)
*/
#pragma once
#incl... | |
Use hue instead of color. | #ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE
#include <inttypes.h>
#include <config.h>
#include <FastLED.h>
typedef struct note_range_t {
uint16_t start;
uint16_t end;
} note_range_t;
class Note {
public:
Note(CRGB aColor, uint16_t order, uint16_t ledCount);
void setColor(CRGB aColor);
private:
CRGB ... | #ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE
#include <inttypes.h>
#include <config.h>
#include <Arduino.h>
typedef struct note_range_t {
uint16_t start;
uint16_t end;
} note_range_t;
class Note {
public:
Note(uint8_t aHue, uint16_t order, uint16_t ledCount);
void setHue(uint8_t aHue);
uint8_t hue();
... |
Use static memory for mem pointers | #include "common/time.h"
#include <stdio.h>
#include <stdlib.h>
static const double BENCHMARK_TIME = 5.0;
static const int NUM_ALLOCS = 1000000;
int main(int argc, const char** argv) {
printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
fflush(stdout);
double best_time = 1e9;
... | #include "common/time.h"
#include <stdio.h>
#include <stdlib.h>
static const double BENCHMARK_TIME = 5.0;
#define NUM_ALLOCS 1000000
static void* s_addresses[NUM_ALLOCS];
int main(int argc, const char** argv) {
printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
fflush(stdout);
... |
Disable Ctrl-V (and Ctrl-O on macOS) | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios... | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios... |
Add List Search 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);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
#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 *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int f(v... |
Debug check analysis for both sides. | #include <stdio.h>
#include "forsyth.h"
int main(int argc, char* argv[])
{
FILE * stream;
int FEN_status;
if (argc < 2)
FEN_status = load_FEN(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
);
else
FEN_status = load_FEN(argv[1]);
#if defined(TEST_MATE_I... | #include <stdio.h>
#include "forsyth.h"
#include "check.h"
int main(int argc, char* argv[])
{
FILE * stream;
int FEN_status;
if (argc < 2)
FEN_status = load_FEN(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
);
else
FEN_status = load_FEN(argv[1]);
#if... |
Fix compilation on Linux / Windows | // This is a queue that can be accessed from multiple threads safely.
//
// It's not well optimized, and requires obtaining a lock every time you check for a new value.
#pragma once
#include <mutex>
#include <optional>
#include <queue>
template <class T>
class SynchronizedQueue {
std::condition_variable cv_;
... | // This is a queue that can be accessed from multiple threads safely.
//
// It's not well optimized, and requires obtaining a lock every time you check for a new value.
#pragma once
#include <condition_variable>
#include <mutex>
#include <optional>
#include <queue>
template <class T>
class SynchronizedQueue {
st... |
Fix gcc global reg extension test to work. | #include <stdio.h>
int c;
__thread int d;
register int R1 __asm__ ("%" "i5");
int main(void)
{
c = 3;
R1 = 5;
d = 4;
printf("C: %d\n", c);
printf("D: %d\n", d);
printf("R1: %d\n", R1);
R1 *= 2;
printf("R1: %d\n", R1);
return 0;
}
| #include <stdio.h>
int c;
__thread int d;
register int R1 __asm__ ("%" "r15");
int main(void)
{
c = 3;
R1 = 5;
d = 4;
printf("C: %d\n", c);
printf("D: %d\n", d);
printf("R1: %d\n", R1);
R1 *= 2;
printf("R1: %d\n", R1);
return 0;
}
|
Remove broken helper for message blocks | /*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
*
* 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... | /*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
*
* 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... |
Fix code in header documentation | #import <Foundation/Foundation.h>
#import <Foundation/NSEnumerator.h>
#import "BSNullabilityCompat.h"
NS_ASSUME_NONNULL_BEGIN
/**
* A BSPropertySet represents the set of a Class' properties that will be injected into class instances after
* the instances are created.
*
* If a
*/
@interface BSPropertySet : NSObj... | #import <Foundation/Foundation.h>
#import <Foundation/NSEnumerator.h>
#import "BSNullabilityCompat.h"
NS_ASSUME_NONNULL_BEGIN
/**
* A BSPropertySet represents the set of a Class' properties that will be injected into class instances after
* the instances are created.
*
* If a
*/
@interface BSPropertySet : NSObj... |
Add missing header for printf | // Copyright(c) 2016 artopantone.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <kompositum/visitor.h>
namespace Kompositum {
class Printer : public Visitor {
public:
void visit(Leaf* leaf) override {
doIndentation();
printf("- Leaf (%lu)\n", lea... | // Copyright(c) 2016 artopantone.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <kompositum/visitor.h>
#include <cstdio>
namespace Kompositum {
class Printer : public Visitor {
public:
void visit(Leaf* leaf) override {
doIndentation();
printf("- ... |
Change back to real-length pomodoros and breaks | // ----------------------------------------------------------------------------
// pomodoro_config - Defines the parameters for various pomodoro technique bits
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------... | // ----------------------------------------------------------------------------
// pomodoro_config - Defines the parameters for various pomodoro technique bits
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------... |
Disable attempt to generate dictionary for private classes | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ function Roo* ;
#pragma link C++ class RooLinkedList- ;
#pragma link C++ class RooRealVar- ;
#pragma link C++ class RooAbsBinning- ;
#pragma link off class RooErrorHandler ;
#pragma link C++ c... | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ function Roo* ;
#pragma link C++ class RooLinkedList- ;
#pragma link C++ class RooRealVar- ;
#pragma link C++ class RooAbsBinning- ;
#pragma link off class RooErrorHandler ;
#endif
|
Fix case sensitivity issue with the rename dialog | #pragma once
#include <QtWidgets/QDialog>
#include "binaryninjaapi.h"
#include "uitypes.h"
class BINARYNINJAUIAPI TextDialog: public QDialog
{
Q_OBJECT
QWidget* m_parent;
QString m_title;
QString m_msg;
QStringList m_options;
Qt::WindowFlags m_flags;
QString m_qSettingsListName;
int m_historySize;
QString m_... | #pragma once
#include <QtWidgets/QDialog>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QLabel>
#include "binaryninjaapi.h"
#include "uitypes.h"
#include "binaryninjaapi.h"
class BINARYNINJAUIAPI TextDialog: public QDialog
{
Q_OBJECT
QString m_qSettingsListName;
int m_historySize;
QString m_historyEntry;
Q... |
Add version number and get rid if a.out name. | typedef struct {
int cluster; /* Condor Cluster # */
int proc; /* Condor Proc # */
int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */
uid_t uid; /* Execute job under this UID */
gid_t gid; /* Execute job under this pid */
pid_t virt_pid; /* PVM virt pid of this process */
int soft_ki... | typedef struct {
int version_num; /* version of this structure */
int cluster; /* Condor Cluster # */
int proc; /* Condor Proc # */
int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */
uid_t uid; /* Execute job under this UID */
gid_t gid; /* Execute job under this gid */
pid_t virt_pid... |
Add header file with declarations for NT timers | #pragma once
#include <minwindef.h>
//#include <ntstatus.h>
// Can't include ntdef.h because it clashes with winnt.h
//#include <ntdef.h>
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
typedef void* POBJECT_ATTRIBUTES;
typedef enum _TIMER_TYPE {
NotificationTimer,
SynchronizationTimer
} TIMER_TYPE;
#pra... | |
Enable to replace "new" operator | #if defined(_MSC_VER) && !defined(NDEBUG) && defined(_CRTDBG_MAP_ALLOC) && !defined(MSVCDBG_H)
#define MSVCDBG_H
/*!
* @file msvcdbg.h
* @brief Memory debugger for msvc
* @author koturn
*/
#include <crtdbg.h>
static void
__msvc_init_memory_check__(void);
#pragma section(".CRT$XCU", read)
__declspec(allocate(".C... | #if defined(_MSC_VER) && !defined(NDEBUG) && defined(_CRTDBG_MAP_ALLOC) && !defined(MSVCDBG_H)
#define MSVCDBG_H
/*!
* @file msvcdbg.h
* @brief Memory debugger for msvc
* @author koturn
*/
#include <crtdbg.h>
#define MSVCDBG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#ifdef MSVCDBG_REPLACE_NEW
# define new MSVC... |
Use Q_SIGNALS / Q_EMIT macros instead of signals / emit | #pragma once
#include <QtWidgets/QLabel>
class BINARYNINJAUIAPI ClickableLabel: public QLabel
{
Q_OBJECT
public:
ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); }
signals:
void clicked();
protected:
void mouseReleaseEvent(QMouseEvent* event) override { if (e... | #pragma once
#include <QtWidgets/QLabel>
class BINARYNINJAUIAPI ClickableLabel: public QLabel
{
Q_OBJECT
public:
ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); }
Q_SIGNALS:
void clicked();
protected:
void mouseReleaseEvent(QMouseEvent* event) override { if ... |
Convert the embedded test to the bitmap API | #include <hwloc.h>
#include <stdio.h>
/* The body of the test is in a separate .c file and a separate
library, just to ensure that hwloc didn't force compilation with
visibility flags enabled. */
int do_test(void)
{
mytest_hwloc_topology_t topology;
unsigned depth;
hwloc_cpuset_t cpu_set;
/* Ju... | #include <hwloc.h>
#include <stdio.h>
/* The body of the test is in a separate .c file and a separate
library, just to ensure that hwloc didn't force compilation with
visibility flags enabled. */
int do_test(void)
{
mytest_hwloc_topology_t topology;
unsigned depth;
hwloc_bitmap_t cpu_set;
/* Ju... |
Remove some unused classes and methods. | /*
Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/
#ifndef PARSER_H
#define PARSER_H
#include <QStringList>
#include "token.h"
#include "node.h"
namespace Grantlee
{
class AbstractNodeFactory;
class TagLibraryInterface;
class Filter;
}
class ParserPrivate;
namespace Grantlee
{
class GRANTLEE_EXPORT... | /*
Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/
#ifndef PARSER_H
#define PARSER_H
#include <QStringList>
#include "token.h"
#include "node.h"
namespace Grantlee
{
class Filter;
}
class ParserPrivate;
namespace Grantlee
{
class GRANTLEE_EXPORT Parser : public QObject
{
Q_OBJECT
public:
Parser(... |
Add missing file needed for arm to compile | /* Wrapper around clone system call.
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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 ... | |
Fix warning of non-virtual destructor | #ifndef FORMAT_H
#define FORMAT_H
#include <cstddef>
#include <cstring> // memmove
class Format
{
public:
Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};
virtual size_t Leanify(size_t size_leanified = 0)
{
if (size_leanified)
{
memmove(fp - size_leanified, fp, s... | #ifndef FORMAT_H
#define FORMAT_H
#include <cstddef>
#include <cstring> // memmove
class Format
{
public:
Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};
virtual ~Format() {};
virtual size_t Leanify(size_t size_leanified = 0)
{
if (size_leanified)
{
memmove(... |
Add newline at the end of the file. | /********************************************************************
* *
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENS... | /********************************************************************
* *
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENS... |
Add new abstract animation class | #pragma once
#include "MeterWnd.h"
class Animation {
public:
Animation(MeterWnd &meterWnd) :
_meterWnd(meterWnd) {
}
virtual bool Animate() = 0;
virtual void Reset() = 0;
protected:
MeterWnd &_meterWnd;
}; | |
Use pragma once instead of ifdef | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
| #pragma once
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
|
Add HW_LED_STATUS pin to Zero 2W board | #define MICROPY_HW_BOARD_NAME "Raspberry Pi Zero 2W"
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14)
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15)
| #define MICROPY_HW_BOARD_NAME "Raspberry Pi Zero 2W"
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
#define MICROPY_HW_LED_STATUS (&pin_GPIO29)
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14)
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15)
|
Add header guards. Properly name function. | #include "kputs.c"
void abort(void)
{
// TODO: Add proper kernel panic.
kputs("Kernel Panic! abort()\n");
while ( 1 ) { }
}
| #ifndef KABORT_C
#define KABORT_C
#include "kputs.c"
void kabort(void)
{
// TODO: Add proper kernel panic.
kputs("Kernel Panic! abort()\n");
while ( 1 ) { }
}
#endif
|
Add GCC diagnostic warning macros | /**************************************************************************
*
* Copyright 2013-2014 RAD Game Tools and Valve Software
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to d... | |
Fix format ptr from unsigned int to unsigned long | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* replace_format_ptr.c :+: :+: :+: ... | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* replace_format_ptr.c :+: :+: :+: ... |
Update lab3 skeleton code to properly source ACLK from VLO | /* Based on msp430g2xx3_wdt_02.c from the TI Examples */
#include <msp430.h>
int main(void)
{
WDTCTL = WDT_ADLY_250; // WDT 250ms, ACLK, interval timer
IE1 |= WDTIE; // Enable WDT interrupt
P1DIR |= BIT0; // Set P1.0 to outp... | /* Based on msp430g2xx3_wdt_02.c from the TI Examples */
#include <msp430.h>
int main(void)
{
BCSCTL3 |= LFXT1S_2; // ACLK = VLO
WDTCTL = WDT_ADLY_250; // WDT 250ms, ACLK, interval timer
IE1 |= WDTIE; // Enable WDT interrupt
... |
Define convenient ISR function pointer type | #pragma once
extern void _service_interrupt(void);
extern void isr0(void);
extern void isr1(void);
extern void isr2(void);
extern void isr3(void);
extern void isr4(void);
extern void isr5(void);
extern void isr6(void);
extern void isr7(void);
extern void isr8(void);
extern void isr9(void);
extern void isr10(void);
ex... | #pragma once
extern void _service_interrupt(void);
typedef void (*isr_f)(void);
extern void isr0(void);
extern void isr1(void);
extern void isr2(void);
extern void isr3(void);
extern void isr4(void);
extern void isr5(void);
extern void isr6(void);
extern void isr7(void);
extern void isr8(void);
extern void isr9(void)... |
Make function parameter names consistent between header and impl. | /* Copyright 2022 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 2022 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 buffer overflow safety to CDISPLAY | #pragma once
#include <sched.h> /* sched_getcpu() */
#include <stdio.h> /* printf() */
/**
**************************************************************************
* \brief
* preprocessor conditional printf formatter output
*
* \details
* Input arguments are equivalent to printf. referrence printf man... | #pragma once
#include <sched.h> /* sched_getcpu() */
#include <stdio.h> /* printf() */
/**
**************************************************************************
* \brief
* preprocessor conditional printf formatter output
*
* \details
* Input arguments are equivalent to printf. referrence printf man... |
Add line break after import | #import <Foundation/Foundation.h>
#define API_VERSION "1"
#define BASE_URL "https://www.cine.io/api/"
#define SDK_VERSION "0.6.1"
#define USER_AGENT "cineio-ios"
extern NSString* const BaseUrl;
extern NSString* const UserAgent;
| #import <Foundation/Foundation.h>
#define API_VERSION "1"
#define BASE_URL "https://www.cine.io/api/"
#define SDK_VERSION "0.6.1"
#define USER_AGENT "cineio-ios"
extern NSString* const BaseUrl;
extern NSString* const UserAgent;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.