Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Make usage of NSArray literals a little bit simpler in equal() | #import "Expecta.h"
EXPMatcherInterface(_equal, (id expected));
EXPMatcherInterface(equal, (id expected)); // to aid code completion
#define equal(expected) _equal(EXPObjectify((expected)))
| #import "Expecta.h"
EXPMatcherInterface(_equal, (id expected));
EXPMatcherInterface(equal, (id expected)); // to aid code completion
#define equal(...) _equal(EXPObjectify((__VA_ARGS__)))
|
Move some ProceduralMaze public methods to private | #ifndef __PROCEDURALMAZE_H__
#define __PROCEDURALMAZE_H__
#include "maze.h"
#include <map>
class ProceduralMaze
{
private:
int width;
int height;
public:
std::map<std::tuple<int, int>, int> grid;
ProceduralMaze(int width, int height);
void generate();
void clearGrid();
std::vector<std::tuple<int, in... | #ifndef __PROCEDURALMAZE_H__
#define __PROCEDURALMAZE_H__
#include "maze.h"
#include <map>
class ProceduralMaze
{
private:
int width;
int height;
std::map<std::tuple<int, int>, int> grid;
void clearGrid();
std::vector<std::tuple<int, int>> getAdjCells(std::tuple<int, int> center, Tile tile_state);
publi... |
Add 30 Days of Code Day 0 in C. | #include <stdio.h>
int main() {
// Declare a variable named 'input_string' to hold our input.
char input_string[105];
// Read a full line of input from stdin and save it to our variable, input_string.
scanf("%[^\n]", input_string);
// Print a string literal saying "Hello, World." to stdout using ... | |
Save each node in User Defined Functions | /*****************************************************************************
* PROGRAM NAME: CNodeO.h
* PROGRAMMER: Wei Sun wsun@vt.edu
* PURPOSE: Define the node object in user defined function
*****************************************************************************/
#ifndef COPASI_CNodeO
#define COPASI_CNodeO
... | |
Add test for unsigned array index. | // RUN: clang -checker-simple -verify %s &&
// RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
int data_array[10];
};
typedef struct {
int data;
} STYPE;
void g1(struct s* p);
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;... | // RUN: clang -checker-simple -verify %s &&
// RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
int data_array[10];
};
typedef struct {
int data;
} STYPE;
void g1(struct s* p);
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;... |
Fix width param name in put_video_frame_rx function pointer. | #ifndef __VIDEO_RX_H__
#define __VIDEO_RX_H__
#include "libavformat/avformat.h"
typedef struct DecodedFrame {
AVFrame* pFrameRGB;
uint8_t *buffer;
} DecodedFrame;
typedef struct FrameManager {
enum PixelFormat pix_fmt;
void (*put_video_frame_rx)(uint8_t *data, int with, int height, int nframe);
DecodedFrame* (*... | #ifndef __VIDEO_RX_H__
#define __VIDEO_RX_H__
#include "libavformat/avformat.h"
typedef struct DecodedFrame {
AVFrame* pFrameRGB;
uint8_t *buffer;
} DecodedFrame;
typedef struct FrameManager {
enum PixelFormat pix_fmt;
void (*put_video_frame_rx)(uint8_t *data, int width, int height, int nframe);
DecodedFrame* (... |
Add missing prototype for fake_writev(). | #ifndef CJET_PEER_TESTING_H
#define CJET_PEER_TESTING_H
#ifdef TESTING
#ifdef __cplusplus
extern "C" {
#endif
int fake_read(int fd, void *buf, size_t count);
int fake_send(int fd, void *buf, size_t count, int flags);
#ifdef __cplusplus
}
#endif
#define READ fake_read
#define SEND fake_send
#define WRITEV fake_writ... | #ifndef CJET_PEER_TESTING_H
#define CJET_PEER_TESTING_H
#ifdef TESTING
#ifdef __cplusplus
extern "C" {
#endif
int fake_read(int fd, void *buf, size_t count);
int fake_send(int fd, void *buf, size_t count, int flags);
int fake_writev(int fd, const struct iovec *iov, int iovcnt);
#ifdef __cplusplus
}
#endif
#define ... |
Add class for holding transmission interfaces. | ///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2013, PAL Robotics S.L.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must reta... | |
Make include guard more specific. | /*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2013 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the... | /*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2013 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the... |
Add nodoc for beta fields. | #if __has_include(<Braintree/BraintreeVenmo.h>)
#import <Braintree/BraintreeCore.h>
#else
#import <BraintreeCore/BraintreeCore.h>
#endif
/**
Contains information about a Venmo Account payment method
*/
@interface BTVenmoAccountNonce : BTPaymentMethodNonce
/**
The email associated with the Venmo account
*/
@propert... | #if __has_include(<Braintree/BraintreeVenmo.h>)
#import <Braintree/BraintreeCore.h>
#else
#import <BraintreeCore/BraintreeCore.h>
#endif
/**
Contains information about a Venmo Account payment method
*/
@interface BTVenmoAccountNonce : BTPaymentMethodNonce
/**
:nodoc:
The email associated with the Venmo account
*/... |
Add headers to request data | #ifndef APIMOCK_REQUESTDATA_H
#define APIMOCK_REQUESTDATA_H
#include <string>
namespace ApiMock {
struct RequestData {
enum HTTP_VERSION {
HTTP_1_1,
} httpVersion;
enum METHOD {
GET,
POST,
PUT,
DELETE,
} method;
std::string requestUri;
};
}
#endif | #ifndef APIMOCK_REQUESTDATA_H
#define APIMOCK_REQUESTDATA_H
#include <string>
#include <unordered_map>
namespace ApiMock {
struct RequestData {
enum HTTP_VERSION {
HTTP_1_1,
} httpVersion;
enum METHOD {
GET,
POST,
PUT,
DELETE,
} method;
std::string requestUri;
std::unordered_map<std::str... |
Fix grammar mistake in comment. | /*
* Generic NUMBBO runtime implementation.
*
* Other language interfaces might want to replace this so that memory
* allocation and error handling goes through the respective language
* runtime.
*/
#include <stdio.h>
#include <stdlib.h>
#include "numbbo.h"
void numbbo_error(const char *message) {
fprintf(... | /*
* Generic NUMBBO runtime implementation.
*
* Other language interfaces might want to replace this so that memory
* allocation and error handling go through the respective language
* runtime.
*/
#include <stdio.h>
#include <stdlib.h>
#include "numbbo.h"
void numbbo_error(const char *message) {
fprintf(st... |
Add solution to Exercise 1-5. | /* Modify the temperature conversion program to print the table in reverse
* order, that is, from 300 degrees to 0. */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
printf("F\tC\n=============\n");
float i;
for (i = 300; i >= 0; i -= 20) {
printf("%3.0f\t%5.1f\n", i, (5.0 / 9.0)... | |
Update Skia milestone to 106 | /*
* 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 105
#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 106
#endif
|
Update Skia milestone to 71 | /*
* 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 70
#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 71
#endif
|
Update Skia milestone to 63 | /*
* 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 62
#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 63
#endif
|
Make this test case more portable by removing its dependency on system header files. | // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region --verify %s
// Test if the 'storage' region gets properly initialized after it is cast to
// 'struct sockaddr *'.
#include <sys/types.h>
#include <sys/socket.h>
void f(int sock) {
struct sockaddr_storage storage;
struct sockaddr* sockaddr = (struct... | // RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref -analyzer-store=region --verify %s
// Test if the 'storage' region gets properly initialized after it is cast to
// 'struct sockaddr *'.
typedef unsigned char __uint8_t;
typedef unsigned int __uint32_t;
typedef __uint32_t __darwin_socklen_t;
typed... |
Use -target instead of triple and use FileCheck. | // RUN: %clang -### %s -c -o tmp.o -triple i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
| // RUN: %clang -### %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | FileCheck %s
// CHECK: "-cc1" {{.*}} "-mnoexecstack"
|
Test clang option for the Memory Tagging Extension | // RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+memtag %s 2>&1 | FileCheck %s
// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.5a+memtag %s 2>&1 | FileCheck %s
// CHECK: "-target-feature" "+mte"
// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+nomemtag %s 2>&1 | File... | |
Change definition of Image struct so all width/height fields are signed integers. Add fields to Image struct that deal with collision masking. | typedef struct
{
unsigned long long int width,height;
long long int handle_x,handle_y;
GLuint texture;
SDL_Surface *surface;
GLuint mask;
} Image;
void bb_fatal_error(char *msg);
| typedef struct
{
long long int width,height;
long long int width_frames,height_frames;
long long int handle_x,handle_y;
GLuint *textures;
SDL_Surface *surface;
GLuint mask_color;
unsigned long long int **masks;
unsigned long long int mask_width;
unsigned long long int mask_height;
} ... |
Add use_ino to see if it helps our rename replay bug. | /* $Id$ */
/*
* %PSC_START_COPYRIGHT%
* -----------------------------------------------------------------------------
* Copyright (c) 2006-2010, Pittsburgh Supercomputing Center (PSC).
*
* Permission to use, copy, and modify this software and its documentation
* without fee for personal use or non-commercial use ... | /* $Id$ */
/*
* %PSC_START_COPYRIGHT%
* -----------------------------------------------------------------------------
* Copyright (c) 2006-2010, Pittsburgh Supercomputing Center (PSC).
*
* Permission to use, copy, and modify this software and its documentation
* without fee for personal use or non-commercial use ... |
Add new typedef for values sent to setsockopt(). |
#ifndef AT_NETWORK_H
#define AT_NETWORK_H
// Under Windows, define stuff that we need
#ifdef _MSC_VER
#include <winsock.h>
#define MAXHOSTNAMELEN 64
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define MSG_WAITALL 0
typedef SOCKET Socket;
typedef int ... |
#ifndef AT_NETWORK_H
#define AT_NETWORK_H
// Under Windows, define stuff that we need
#ifdef _MSC_VER
#include <winsock.h>
#define MAXHOSTNAMELEN 64
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define MSG_WAITALL 0
typedef SOCKET Socket;
typedef int ... |
Add TODO to replace ratpoison. | /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Maps and raises the specified window id (integer).
*/
#include <X11/Xlib.h>
#include <stdlib.h>
int main(int argc, char** argv) {
if (a... | /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Maps and raises the specified window id (integer).
*/
/* TODO: use XResizeWindow to do the +1 width ratpoison hack.
* And at this point, we... |
Test to ensure that data layout is generated correctly for host platform. This is for PR1242. | // Testcase for PR1242
// RUN: %llvmgcc -c %s -o %t && lli --force-interpreter=1 %t
#include <stdlib.h>
#define NDIM 3
#define BODY 01
typedef double vector[NDIM];
typedef struct bnode* bodyptr;
// { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x
// double], double, \2 *, \2 * }
struct bnode {
... | |
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>
... |
Fix the run line for this test. | // RUN: clang -fsyntax-only %s
%:include <stdio.h>
%:ifndef BUFSIZE
%:define BUFSIZE 512
%:endif
void copy(char d<::>, const char s<::>, int len)
<%
while (len-- >= 0)
<%
d<:len:> = s<:len:>;
%>
%>
| // RUN: clang -fsyntax-only -verify < %s
%:include <stdio.h>
%:ifndef BUFSIZE
%:define BUFSIZE 512
%:endif
void copy(char d<::>, const char s<::>, int len)
<%
while (len-- >= 0)
<%
d<:len:> = s<:len:>;
%>
%>
|
Check error codes when sending. | #include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "nrf51.h"
#include "nrf_delay.h"
#include "error.h"
#include "gpio.h"
#include "led.h"
#include "radio.h"
void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
while (1)
{
for (uint8_t i = LED_START; i < LED_ST... | #include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "nrf51.h"
#include "nrf_delay.h"
#include "error.h"
#include "gpio.h"
#include "led.h"
#include "radio.h"
void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
while (1)
{
for (uint8_t i = LED_START; i < LED_ST... |
Add comment for why USDTHelper is static | #pragma once
#include <string>
#include <vector>
struct usdt_probe_entry
{
std::string path;
std::string provider;
std::string name;
int num_locations;
};
typedef std::vector<usdt_probe_entry> usdt_probe_list;
class USDTHelper
{
public:
static usdt_probe_entry find(int pid,
... | #pragma once
#include <string>
#include <vector>
struct usdt_probe_entry
{
std::string path;
std::string provider;
std::string name;
int num_locations;
};
typedef std::vector<usdt_probe_entry> usdt_probe_list;
// Note this class is fully static because bcc_usdt_foreach takes a function
// pointer callback w... |
Use strong storage for component local image | #import <UIKit/UIKit.h>
#import "HUBComponentImageData.h"
NS_ASSUME_NONNULL_BEGIN
/**
* Protocol defining the public API for a builder that builds image data objects
*
* This builder acts like a mutable model counterpart for `HUBComponentImageData`, with the key
* difference that they are not related by inher... | #import <UIKit/UIKit.h>
#import "HUBComponentImageData.h"
NS_ASSUME_NONNULL_BEGIN
/**
* Protocol defining the public API for a builder that builds image data objects
*
* This builder acts like a mutable model counterpart for `HUBComponentImageData`, with the key
* difference that they are not related by inher... |
Make this destructor virtual to placate GCC's warnings. | //===- PCHDeserializationListener.h - Decl/Type PCH Read Events -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===- PCHDeserializationListener.h - Decl/Type PCH Read Events -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Increase the delay before producing exception in the Monitor IDE test app | /* Monitor-IDE integration test
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "fr... | /* Monitor-IDE integration test
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "fr... |
Remove unused special case for Mac OS X | /*
* Copyright 2008 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.
*/
#ifndef SERVICE_RUNTIME_NACL_SYSCALL_H__
#define SERVICE_RUNTIME_NACL_SYSCALL_H__
#if !NACL_MACOSX || defined(NACL_STANDALONE)
extern int Na... | /*
* Copyright 2008 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.
*/
#ifndef SERVICE_RUNTIME_NACL_SYSCALL_H__
#define SERVICE_RUNTIME_NACL_SYSCALL_H__
extern int NaClSyscallSeg();
#endif
|
Include qtwebkitversion.h to work in newer qtwebkit | #include "SocketCommand.h"
class Version : public SocketCommand {
Q_OBJECT
public:
Version(WebPageManager *, QStringList &arguments, QObject *parent = 0);
virtual void start();
};
| #include "qtwebkitversion.h"
#include "SocketCommand.h"
class Version : public SocketCommand {
Q_OBJECT
public:
Version(WebPageManager *, QStringList &arguments, QObject *parent = 0);
virtual void start();
};
|
Add comment for recalled message | //
// AVIMRecalledMessage.h
// AVOS
//
// Created by Tang Tianyong on 26/06/2017.
// Copyright © 2017 LeanCloud Inc. All rights reserved.
//
#import "AVIMTypedMessage.h"
NS_ASSUME_NONNULL_BEGIN
@interface AVIMRecalledMessage : AVIMTypedMessage <AVIMTypedMessageSubclassing>
@end
NS_ASSUME_NONNULL_END
| //
// AVIMRecalledMessage.h
// AVOS
//
// Created by Tang Tianyong on 26/06/2017.
// Copyright © 2017 LeanCloud Inc. All rights reserved.
//
#import "AVIMTypedMessage.h"
NS_ASSUME_NONNULL_BEGIN
/**
This class is a type of messages that have been recalled by its sender.
*/
@interface AVIMRecalledMessage : AVIMT... |
Add test for octApron combine where arg vars conflict | // SKIP PARAM: --sets ana.activated[+] octApron
#include <assert.h>
int f(int x) {
return x + 1;
}
int g(int x) {
int y;
y = f(x);
assert(y == x + 1);
return x;
}
int main(void) {
int z, w;
w = g(z);
assert(z == w);
return 0;
}
| |
Add more rationale as to how this exception is different from others. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION... | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION... |
Add mpiCC source for MPI test | #include "mpi.h"
#include <stdio.h>
#include <math.h>
int main(int argc, char **argv) {
// Variables used per process
int myid, numprocs;
int myresult = 0;
// Global variables
int DATA_SIZE = argc;
int data[DATA_SIZE], result;
// Chunk control variables
int i, low, high, size;... | |
Fix ARC warning in demo project. | //
// SVProgressHUDAppDelegate.h
// SVProgressHUD
//
// Created by Sam Vermette on 27.03.11.
// Copyright 2011 Sam Vermette. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *__weak window;
ViewController *__weak v... | //
// SVProgressHUDAppDelegate.h
// SVProgressHUD
//
// Created by Sam Vermette on 27.03.11.
// Copyright 2011 Sam Vermette. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : NSObject <UIApplicationDelegate>
@property (strong, nonatomic) IBOutlet UIWindow *window;
@... |
Remove unnecessary member variable in SerializationOperation | #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATIONS_SERIALIZATION_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATIONS_SERIALIZATION_OPERATION_H_
#include "../operation.h"
namespace You {
namespace DataStore {
namespace Internal {
class SerializationOperation : public IOperation {
public:
/// Serialize task to... | #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATIONS_SERIALIZATION_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATIONS_SERIALIZATION_OPERATION_H_
#include "../operation.h"
namespace You {
namespace DataStore {
namespace Internal {
class SerializationOperation : public IOperation {
public:
/// Serialize task to... |
Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo builfarm member. | /* contrib/cube/cubedata.h */
#include "fmgr.h"
#define CUBE_MAX_DIM (100)
typedef struct NDBOX
{
int32 vl_len_; /* varlena header (do not touch directly!) */
unsigned int dim;
double x[1];
} NDBOX;
#define DatumGetNDBOX(x) ((NDBOX*)DatumGetPointer(x))
#define PG_GETARG_NDBOX(x) DatumGetNDBOX( PG_DETOAST_DATU... | /* contrib/cube/cubedata.h */
#define CUBE_MAX_DIM (100)
typedef struct NDBOX
{
int32 vl_len_; /* varlena header (do not touch directly!) */
unsigned int dim;
double x[1];
} NDBOX;
#define DatumGetNDBOX(x) ((NDBOX*)DatumGetPointer(x))
#define PG_GETARG_NDBOX(x) DatumGetNDBOX( PG_DETOAST_DATUM(PG_GETARG_DATUM(x... |
Add IWYU tags to headers TF is re-exporting. | /* Copyright 2015 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 2015 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 externs for use in C++ code | #ifndef __TINYARG_H__
#define __TINYARG_H__
struct tiny_args_t;
bool tiny_args_parse(struct tiny_args_t* args, int argc, const char* argv[]);
void tiny_args_add_bool(struct tiny_args_t** args,
char short_opt,
const char* long_opt,
bool* flag,
const char* desc);
void ... | #ifndef __TINYARG_H__
#define __TINYARG_H__
#ifdef __cplusplus
extern "C"
{
#endif
struct tiny_args_t;
bool tiny_args_parse(struct tiny_args_t* args, int argc, const char* argv[]);
void tiny_args_add_bool(struct tiny_args_t** args,
char short_opt,
const char* long_op... |
Change file header to C style | /**
* File: bool.h
* Author: Cindy Norris
*/
#define TRUE 1
#define FALSE 0
typedef int bool;
| /*
* File: bool.h
* Author: Cindy Norris
*/
#define TRUE 1
#define FALSE 0
typedef int bool;
|
Add einsum to the one file build | /*
* This file includes all the .c files needed for a complete multiarray module.
* This is used in the case where separate compilation is not enabled
*
* Note that the order of the includs matters
*/
#include "common.c"
#include "scalartypes.c"
#include "scalarapi.c"
#include "datetime.c"
#include "arraytypes.... | /*
* This file includes all the .c files needed for a complete multiarray module.
* This is used in the case where separate compilation is not enabled
*
* Note that the order of the includs matters
*/
#include "common.c"
#include "scalartypes.c"
#include "scalarapi.c"
#include "datetime.c"
#include "arraytypes.... |
Make sure TestRedefinitionsInInlines.py actually inlines. | #include <stdio.h>
void test1(int) __attribute__ ((always_inline));
void test2(int) __attribute__ ((always_inline));
void test2(int b) {
printf("test2(%d)\n", b); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"])
}
void test1(int a) {
printf("test1(%d)\n", a);
test2(a+1);... | #include <stdio.h>
inline void test1(int) __attribute__ ((always_inline));
inline void test2(int) __attribute__ ((always_inline));
void test2(int b) {
printf("test2(%d)\n", b); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"])
}
void test1(int a) {
printf("test1(%d)\n", a);
... |
Fix warnings in OpenViewCore module | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warr... | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warr... |
Remove prototypes for static methods | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _CPU_H_
#define _CPU_H_
#include <cpu/cache.h>
#include <cpu/divu.h>
#include <cpu/dmac.h>
#include <cpu/dual.h>
#include <cpu/endian.h>
#include <cpu/frt.h>
#include <cpu/instructions.h>
#inc... | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _CPU_H_
#define _CPU_H_
#include <cpu/cache.h>
#include <cpu/divu.h>
#include <cpu/dmac.h>
#include <cpu/dual.h>
#include <cpu/endian.h>
#include <cpu/frt.h>
#include <cpu/instructions.h>
#inc... |
Clone with/without VM sample working now | #define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int child_func(void* arg) {
return 0;
}
int main(int argc, char** argv) {
// Stack for child.
const int STACK_SIZE = 65536;
char* stack =... | #define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int child_func(void* arg) {
char* buf = (char*)arg;
strcpy(buf, "hello");
return 0;
}
int main(int argc, char** argv) {
// Stack for child... |
Change the sample to pass message from parent as well | // We have to define the _GNU_SOURCE to get access to clone(2) and the CLONE_*
// flags from sched.h
#define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int child_func(void* arg) {
char* buf = (cha... | // We have to define the _GNU_SOURCE to get access to clone(2) and the CLONE_*
// flags from sched.h
#define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int child_func(void* arg) {
char* buf = (cha... |
Use ++i instead of i++ | /* 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... |
Update Skia milestone to 87 | /*
* 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 86
#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 87
#endif
|
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 manual test where mine-W is more precise than mine-lazy due to extern global init top | // SKIP
#include <pthread.h>
#include <stdlib.h>
extern int optind ;
pthread_t hthread ;
void *signal_waiter(void *arg )
{
}
int main(int argc , char **argv )
{
pthread_create(& hthread, NULL, & signal_waiter, NULL);
if (optind >= argc) {
if (optind == argc) {
// mine-lazy priv should also read Unkn... | |
Update Skia milestone to 90 | /*
* 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 89
#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 90
#endif
|
Add the Async Log implementation | //
// AsyncLog.c
// Ctest
//
// Created by Yanjiu Huang on 3/24/14.
// Copyright (c) 2014 Yanjiu Huang. All rights reserved.
//
#include <stdio.h>
#include "AsyncLog.h"
void async_log_error(const char* format,...){
}
void async_log_debug(const char* format,...){
}
void async_log_info(const char* format,..... | //
// AsyncLog.c
// Ctest
//
// Created by Yanjiu Huang on 3/24/14.
// Copyright (c) 2014 Yanjiu Huang. All rights reserved.
//
#include <stdio.h>
#include <stdarg.h>
#include "AsyncLog.h"
void async_log_error(const char* format, ...){
va_list arg;
va_start(arg, format);
vfprintf(stderr, format,... |
Fix extra semicolor causing build failure | /*
This file is part of the kblog library.
Copyright (c) 2007 Christian Weilbach <christian_weilbach@web.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of t... | /*
This file is part of the kblog library.
Copyright (c) 2007 Christian Weilbach <christian_weilbach@web.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of t... |
Add missing EC28J60 arch definition file | /*
* Copyright (c) 2013, CETIC.
* 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 conditions a... | |
Add more files into gen-files | #ifndef __PLATFORM_H__
#define __PLATFORM_H__
#define BuildPlatform_NAME "x86_64-unknown-linux"
#define HostPlatform_NAME "x86_64-unknown-linux"
#define TargetPlatform_NAME "x86_64-unknown-linux"
#define x86_64_unknown_linux_BUILD 1
#define x86_64_unknown_linux_HOST 1
#define x86_64_unknown_linux_TARGET 1
#define... | |
Add anonymous nested struct test | // RUN: %ocheck 3 %s
struct nest {
union {
struct {
union {
int i;
};
};
};
};
int main()
{
struct nest n = {
.i = 2
};
n.i++;
return n.i;
}
| |
Fix link error when component=shared_library is set | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once
#include <vector>
#include "base/basictypes.h"
#inc... | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once
#include <vector>
#include "base/basictypes.h"
#inc... |
Add missing header guard and extern C block | /*
* Copyright (c) 2019 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This header exists solely to allow drivers meant for the native_posix board
* to be used directly in the nrf52_bsim board.
* Note that such reuse should be done with great care.
*
* The command line arguments parsing logic fro... | /*
* Copyright (c) 2019 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This header exists solely to allow drivers meant for the native_posix board
* to be used directly in the nrf52_bsim board.
* Note that such reuse should be done with great care.
*
* The command line arguments parsing logic fro... |
Remove silly import of UIKit | //
// Atomic.h
// Atomic
//
// Created by Adlai Holler on 12/5/15.
// Copyright © 2015 Adlai Holler. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for Atomic.
FOUNDATION_EXPORT double AtomicVersionNumber;
//! Project version string for Atomic.
FOUNDATION_EXPORT const unsigned char At... | //
// Atomic.h
// Atomic
//
// Created by Adlai Holler on 12/5/15.
// Copyright © 2015 Adlai Holler. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for Atomic.
FOUNDATION_EXPORT double AtomicVersionNumber;
//! Project version string for Atomic.
FOUNDATION_EXPORT const unsign... |
Fix 28/36 to actually be race free | #include <pthread.h>
#include "racemacros.h"
int g;
int *g1;
int *g2;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
pthread_mutex_lock(&mutex);
access(*g1);
pthread_mutex_lock(&mutex);
return NULL;
}
int main(void) {
g1 = g2 = &g;
create_threads(t);
assert_racefree(*g2)... | #include <pthread.h>
#include "racemacros.h"
int g;
int *g1;
int *g2;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
pthread_mutex_lock(&mutex);
access(*g1);
pthread_mutex_lock(&mutex);
return NULL;
}
int main(void) {
g1 = g2 = &g;
create_threads(t);
pthread_mutex_lock(&m... |
Add switch pin definitions, fix pin for backlight | #ifndef ADAPTERBOARD_H
#define ADAPTERBOARD_H
#include <RGBLed.h>
#define LED_R 13
#define LED_G 9
#define LED_B 10
#define BACKLIGHT_PIN 0
class AdapterBoard
{
public:
AdapterBoard();
void init();
void poll();
private:
RGBLed led;
Backlight backlight;
};
#endif
| #ifndef ADAPTERBOARD_H
#define ADAPTERBOARD_H
#include <RGBLed.h>
#define LED_R 13
#define LED_G 9
#define LED_B 10
#define BACKLIGHT_PIN 11
#define SW_ON 4
#define SW_UP 12
#define SW_DOWN 6
class AdapterBoard
{
public:
AdapterBoard();
void init();
void poll();
private:
RGBLed led;
Backligh... |
Add todo comment on at() functions. | //-----------------------------------------------------------------------------
// Element Access
//-----------------------------------------------------------------------------
template<class T>
T& matrix<T>::at( std::size_t row, std::size_t col ){
return data_.at(row*cols_+col);
}
template<class T>
const T& matri... | //-----------------------------------------------------------------------------
// Element Access
//-----------------------------------------------------------------------------
template<class T>
T& matrix<T>::at( std::size_t row, std::size_t col ){
// TODO throw if out of bounds
return data_.at(row*cols_+col);
}
... |
Move struct definition to header as it is reused in different cpp files | typedef struct Bundle Bundle;
struct Bundle {
MatrixServer* matrix;
Db* db;
int epfd;
int threadNo; //for init only, not used in the threads
std::string portNo; //for init only, not used in the threads
};
| |
Add BST inorder traversal function implementation | #include "bst.h"
static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);
struct BSTNode
{
BSTNode* left;
BSTNode* right;
BSTNode* p;
void* k;
};
struct BST
{
BSTNode* root;
};
BST* BST_Create(void)
{
BST* T = (BST* )malloc(sizeof(BST));
T->root = NULL;
return T;
}
BSTNode* BSTNode_Create(void* k)
{
BS... | #include "bst.h"
static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);
struct BSTNode
{
BSTNode* left;
BSTNode* right;
BSTNode* p;
void* k;
};
struct BST
{
BSTNode* root;
};
BST* BST_Create(void)
{
BST* T = (BST* )malloc(sizeof(BST));
T->root = NULL;
return T;
}
BSTNode* BSTNode_Create(void* k)
{
BS... |
Fix bug with . and .. | #include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char *dircat(char *d1, char *d2)
{
char *new = malloc(strlen(d1) + strlen(d2) + 2);
sprintf(new, "%s/%s", d1, d2);
return new;
}
void dirwalk(char *name, void (*func)(char *, void *), void *ctx)
{
DIR *dir = opendir(... | #include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char *dircat(char *d1, char *d2)
{
char *new = malloc(strlen(d1) + strlen(d2) + 2);
sprintf(new, "%s/%s", d1, d2);
return new;
}
void dirwalk(char *name, void (*func)(char *, void *), void *ctx)
{
DIR *dir = opendir(... |
Initialize X11 connection and root screen. | // vim:ts=4:sw=4:expandtab
#include <stdlib.h>
#include <stdio.h>
#include "randr.h"
#include "types.h"
#include "globals.h"
int main(void) {
// TODO
}
| // vim:ts=4:sw=4:expandtab
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "randr.h"
#include "types.h"
#include "globals.h"
xcb_connection_t *connection;
xcb_window_t root;
static void initialize(void) {
int display;
connection = xcb_connect(NUL... |
Adjust for new LLVM BinaryFormat library in r304864. | //===--- Dwarf.h - DWARF constants ------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... | //===--- Dwarf.h - DWARF constants ------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... |
Store image data in aligned_vector | // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_COMMON_IMAGE_BASE_H
#define VSNRAY_COMMOM_IMAGE_BASE_H 1
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>
#include <visionaray/pixel_format.h>
namespace visionaray
{
class i... | // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_COMMON_IMAGE_BASE_H
#define VSNRAY_COMMOM_IMAGE_BASE_H 1
#include <cstddef>
#include <cstdint>
#include <string>
#include <visionaray/aligned_vector.h>
#include <visionaray/pixel_format.h>
namespace ... |
Remove left-over from non-generic power control | #ifndef SYSMOBTS_UTILS_H
#define SYSMOBTS_UTILS_H
#include <stdint.h>
#include "femtobts.h"
struct gsm_bts_trx;
int band_femto2osmo(GsmL1_FreqBand_t band);
int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
int sysmobts_get_target_powe... | #ifndef SYSMOBTS_UTILS_H
#define SYSMOBTS_UTILS_H
#include <stdint.h>
#include "femtobts.h"
struct gsm_bts_trx;
int band_femto2osmo(GsmL1_FreqBand_t band);
int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
#endif
|
Make the alternative sha512 optional | /*
* mbedtls_device.h
*
* Copyright (C) 2018, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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
*... | /*
* mbedtls_device.h
*
* Copyright (C) 2018, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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
*... |
Add comment about unordered map |
#ifndef __CS_143__Router__
#define __CS_143__Router__
#include <string>
#include "Device.h"
class Router : public Device
{
public:
// Bellman-Ford
//void updateRouting(Packet);
// create static routing table
void addRouting(Packet);
// add a link to the router
void addLink(std::str... |
#ifndef __CS_143__Router__
#define __CS_143__Router__
#include <string>
#include "Device.h"
class Router : public Device
{
public:
// Bellman-Ford
//void updateRouting(Packet);
// create static routing table
void addRouting(Packet);
// add a link to the router
void addLink(std::str... |
Test run successful after libmesh update | /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
#ifndef DGOSPREY_REVISION_H
#define DGOSPREY_REVISION_H
#define DGOSPREY_REVISION "git commit 8603d37 on 2015-01-21"
#endif // DGOSPREY_REVISION_H
| /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
#ifndef DGOSPREY_REVISION_H
#define DGOSPREY_REVISION_H
#define DGOSPREY_REVISION "git commit 660a43d on 2015-02-09"
#endif // DGOSPREY_REVISION_H
|
Replace placeholder with required mask and index properties. | /*
* Copyright (C) 2016 Glyptodon, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, pub... | /*
* Copyright (C) 2016 Glyptodon, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, pub... |
Switch to non atomic properties | //
// TSKPinFailureReport.h
// TrustKit
//
// Created by Alban Diquet on 5/27/15.
// Copyright (c) 2015 Data Theorem. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TSKPinFailureReport : NSObject
@property (readonly) NSString *appBundleId;
@property (readonly) NSString *appVersion;
@propert... | //
// TSKPinFailureReport.h
// TrustKit
//
// Created by Alban Diquet on 5/27/15.
// Copyright (c) 2015 Data Theorem. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TSKPinFailureReport : NSObject
@property (readonly, nonatomic) NSString *appBundleId; // Not part of the HPKP spec
@property (... |
Replace include <map> with <unordered_map> | #ifndef __WORDCOUNTS_H__
#define __WORDCOUNTS_H__
#include <string>
#include <map>
#include <Rcpp.h>
typedef std::unordered_map<std::string, int> hashmap;
class WordCounts
{
private:
hashmap map;
public:
WordCounts();
~WordCounts();
void print();
Rcpp::DataFrame as_data_frame();
void add... | #ifndef __WORDCOUNTS_H__
#define __WORDCOUNTS_H__
#include <string>
#include <unordered_map>
#include <Rcpp.h>
typedef std::unordered_map<std::string, int> hashmap;
class WordCounts
{
private:
hashmap map;
public:
WordCounts();
~WordCounts();
void print();
Rcpp::DataFrame as_data_frame();
... |
Add a comment explaining why iconv needs a (void*) for its parameter. | #include "h_iconv.h"
// Wrapper functions, since iconv_open et al are macros in libiconv.
iconv_t h_iconv_open(const char *tocode, const char *fromcode) {
return iconv_open(tocode, fromcode);
}
void h_iconv_close(iconv_t cd) {
iconv_close(cd);
}
size_t h_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
... | #include "h_iconv.h"
// Wrapper functions, since iconv_open et al are macros in libiconv.
iconv_t h_iconv_open(const char *tocode, const char *fromcode) {
return iconv_open(tocode, fromcode);
}
void h_iconv_close(iconv_t cd) {
iconv_close(cd);
}
size_t h_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
... |
Fix number of buttons on the host and remove the placeholder macros | #ifndef WProgram_h
#define WProgram_h
#ifndef HOST_MIDIDUINO
#define HOST_MIDIDUINO
#endif
#define _BV(i) (1 << (i))
#define PSTR(s) (s)
#define GUI_NUM_ENCODERS 4
#define GUI_NUM_BUTTONS 4
#define BUTTON_PRESSED(i) false
#define BUTTON_RELEASED(i) false
#define BUTTON_DOWN(i) false
#define BUTTON_UP(i) true
#incl... | #ifndef WProgram_h
#define WProgram_h
#ifndef HOST_MIDIDUINO
#define HOST_MIDIDUINO
#endif
#define _BV(i) (1 << (i))
#define PSTR(s) (s)
#define GUI_NUM_ENCODERS 4
#define GUI_NUM_BUTTONS 8
#include <stdio.h>
void handleIncomingMidi();
#define BOARD_ID 0x89
#define SYSEX_BUF_SIZE 8192
#define setLed()
#define cl... |
Fix fatal typo in code guard | // @(#)root/sqlite:$Id$
// Author: o.freyermuth <o.f@cern.ch>, 01/06/2013
/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... | // @(#)root/sqlite:
// Author: o.freyermuth <o.f@cern.ch>, 01/06/2013
/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... |
Fix bug and solves the sequence | /**
https://www.urionlinejudge.com.br/judge/en/problems/view/1098
TODO:
Resolver a formatação da última impressão do loop.
Está:
I=2.0 J=3.0
I=2.0 J=4.0
I=2.0 J=5.0
Mas deveria estar:
I=2 J=3
I=2 J=4
I=2 J=5
*/
#include <stdio.h>
int main(){
double i, j;
i = 0;
do{
for (j = 1; j <= 3; j++){
if (i == (int... | /**
https://www.urionlinejudge.com.br/judge/en/problems/view/1098
*/
#include <stdio.h>
int main(){
int i, j;
float iR, jR;
for(i = 0; i <= 20; i += 2){
for (j = 10; j <= 30; j += 10){
iR = (float) i/10;
jR = (float) (i+j)/10;
if (i % 10) printf("I=%.1f J=%.1f\n", iR, jR);
else printf("I=%.0f J... |
Add rudimentary directory listing command | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program 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 Foundati... | |
Add stub for PDM sound filter | /**
* @file
* @brief
*
* @author Alexander Kalmuk
* @date 24.08.2018
*/
#include <assert.h>
#include <stm32f4_discovery.h>
#include <pdm_filter.h>
void PDM_Filter_Init(PDMFilter_InitStruct * Filter) {
assert(0);
}
int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut,
uint16_t MicGain, PDMFilter_... | |
Increase heapsize for mbedtls library | /*
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <debug.h>
/* mbed TLS headers */
#include <mbedtls/memory_buffer_alloc.h>
#include <mbedtls/platform.h>
/*
* mbed TLS heap
*/
#if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
#d... | /*
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <debug.h>
/* mbed TLS headers */
#include <mbedtls/memory_buffer_alloc.h>
#include <mbedtls/platform.h>
/*
* mbed TLS heap
*/
#if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
#d... |
Fix Unix domain socket headers for Fuchsia | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_SOCKET_BASE_FUCHSIA_H_
#define RUNTIME_BIN_SOCKET_BASE_FUCHSIA_H_
#if !defined(RUN... | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_SOCKET_BASE_FUCHSIA_H_
#define RUNTIME_BIN_SOCKET_BASE_FUCHSIA_H_
#if !defined(RUN... |
Add initial layout of hash map implementation | #ifndef JTL_HASH_MAP_H__
#define JTL_HASH_MAP_H__
#include <memory>
namespace jtl {
template <typename Key,
typename Value>
class HashMap {
struct MapNode {
MapNode(Key k, Value v) : key(k), value(v) {}
~MapNode() {
delete key;
delete value;
}
Key key;
Value value;
}; /... | |
Test that invoking longjmp with an argument of 0 causes setjmp to return 1 | /*
* Copyright 2010 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 <setjmp.h>
#include <stdio.h>
static jmp_buf buf;
int main(void) {
volatile int result = -1;
if (!setjmp(buf) ) {
result = ... | /*
* Copyright 2010 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 <setjmp.h>
#include <stdio.h>
#include "native_client/src/include/nacl_assert.h"
static jmp_buf buf;
int trysetjmp(int longjmp_arg... |
Update test case; VLA's are now supported. | // RUN: clang -verify -emit-llvm -o - %s
int f0(int x) {
int vla[x];
return vla[x-1]; // expected-error {{cannot compile this return inside scope with VLA yet}}
}
| // RUN: clang -verify -emit-llvm -o - %s
void *x = L"foo"; // expected-error {{cannot compile this wide string yet}}
|
Add test case for less-than comparision on enums. | //PARAM: --enable ana.int.enums --disable ana.int.def_exc
int main(){
int top = rand();
int x,y;
if(top){
x = 1;
} else{
x = 0;
}
assert(x<2);
return 0;
}
| |
Set header location depending on flags | #include <stdlib.h>
#include <stdio.h>
#include "../src/prompt.h"
int main(void)
{
for (;;)
{
char *line = prompt("> ");
if (line == NULL)
break;
printf("You wrote '%s'\n", line);
free(line);
}
prompt_free();
return 0;
}
| #include <stdlib.h>
#include <stdio.h>
#ifdef DEBUG
# include "../src/prompt.h"
#else
# include <prompt.h>
#endif
int main(void)
{
for (;;)
{
char *line = prompt("> ");
if (line == NULL)
break;
printf("You wrote '%s'\n", line);
free(line);
}
prompt_free();
return 0;
}
|
Add some beginning test functions (for jid.c). | /**
* xmp3 - XMPP Proxy
* Copyright (c) 2012 Drexel University
*
* @file jid_test.c
* Unit tests for JID functions.
*/
#include <test-dept.h>
#include <stdlib.h>
#include <stdio.h>
#include "jid.h"
void setup(void) {
}
void teardown(void) {
restore_function(&calloc);
}
static void* always_failing_calloc(... | |
Add failing test case for enums | // PARAM: --disable ana.int.interval --disable ana.int.def_exc --enable ana.int.enums
void main(){
int n = 1;
for (; n; n++) { // fixed point not reached here
}
return;
} | |
Add target description for KL26Z | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 re... | |
Change login logic, add 'l' cmd | #ifndef _LOGINWINDOW_H_
#define _LOGINWINDOW_H_
#include <string>
#include <iostream>
#include "window.h"
using namespace std;
class LoginWindow : public Window {
string name;
string pass;
public:
LoginWindow():Window("Login") {}
const string& getUsername() const {
return name;
}
con... | #ifndef _LOGINWINDOW_H_
#define _LOGINWINDOW_H_
#include <string>
#include <iostream>
#include "window.h"
using namespace std;
class LoginWindow : public Window {
string name;
string pass;
public:
LoginWindow():Window("Login") {}
const string& getUsername() const {
return name;
}
con... |
Add class comment for proton::bucketdb::RemoveBatchEntry. | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/document/base/globalid.h>
#include <vespa/document/bucket/bucketid.h>
#include <persistence/spi/types.h>
namespace proton::bucketdb {
class RemoveBatchEntry {
document::GlobalId... | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/document/base/globalid.h>
#include <vespa/document/bucket/bucketid.h>
#include <persistence/spi/types.h>
namespace proton::bucketdb {
/*
* Class containing meta data for a single d... |
Define 'unsigned long' as 'DWORD' for cross-platform | #ifndef _SYSTEMEMORY_H_
#define _SYSTEMEMORY_H_
#include "windows.h"
class SystemMemory
{
private:
MEMORYSTATUSEX memoryStat;
private:
int memoryCall();
public:
int getLoadPercent(int &val);
int getUsage(double &val);
int getTotalByte(DWORD &val);
int getFreeByte(DWORD &val);
};
#endif | #ifndef _SYSTEMEMORY_H_
#define _SYSTEMEMORY_H_
#include "windows.h"
typedef unsigned long DWORD;
class SystemMemory
{
private:
MEMORYSTATUSEX memoryStat;
private:
int memoryCall();
public:
int getLoadPercent(int &val);
int getUsage(double &val);
int getTotalByte(DWORD &val);
int getFreeByte(DWORD &val);... |
Move constant declarations to header file | #ifndef FINAL_SEQUENTIALSA_SA_H_
#define FINAL_SEQUENTIALSA_SA_H_
#endif // FINAL_SEQUENTIALSA_SA_H_
| #ifndef FINAL_SEQUENTIALSA_SA_H_
#define FINAL_SEQUENTIALSA_SA_H_
#define TEMPERATURE 100 /*Initial temperature*/
#define TEMPERATURE_DECREMENT 0.99 /*The amount by which teh temperature is decrement each iteration*/
#define TEMPERATURE_FINAL 0.01 /*The coolest temperature, time to stop*/
#define NUMBER_ITERATIONS 100... |
Add percentage class to main header | #ifndef _GMTK_H_
#define _GMTK_H_
#include "half.h"
#include "angle.h"
#include "vector.h"
#include "matrix.h"
#include "quaternion.h"
#endif//_GMTK_H_ | #ifndef _GMTK_H_
#define _GMTK_H_
#include "half.h"
#include "angle.h"
#include "percent.h"
#include "vector.h"
#include "matrix.h"
#include "quaternion.h"
#endif//_GMTK_H_ |
Disable Ctrl-C and Ctrl-Z (Ctrl-Y 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.