Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Solve The Greatest in c | #include <stdio.h>
#include <stdlib.h>
int main() {
int a, b, c, m;
while (scanf("%d %d %d", &a, &b, &c) != EOF) {
m = (a + b + abs(a - b)) / 2;
m = (m + c + abs(m - c)) / 2;
printf("%d eh o maior\n", m);
}
}
| |
Fix json additional fetch in frontpage | //
// RAPRedditLinks.h
// redditAPI
//
// Created by Woudini on 2/3/15.
// Copyright (c) 2015 Hi Range. All rights reserved.
//
#ifndef redditAPI_RAPRedditLinks_h
#define redditAPI_RAPRedditLinks_h
#define RAPRedditLimit_10_typePrefix_Link_ @"?limit=10?&after=t3_%@"
#define RAPSubredditNew @"r/%@/new.json?limit=1... | //
// RAPRedditLinks.h
// redditAPI
//
// Created by Woudini on 2/3/15.
// Copyright (c) 2015 Hi Range. All rights reserved.
//
#ifndef redditAPI_RAPRedditLinks_h
#define redditAPI_RAPRedditLinks_h
#define RAPRedditLimit_10_typePrefix_Link_ @".json?limit=10?&after=t3_%@"
#define RAPSubredditNew @"r/%@/new.json?li... |
Add list to contain hotkey info | #pragma once
#include "afxwin.h"
#include "afxcmn.h"
class Hotkeys : public CPropertyPage {
DECLARE_DYNAMIC(Hotkeys)
public:
Hotkeys();
virtual ~Hotkeys();
// Dialog Data
enum { IDD = IDD_HOTKEYS };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog(... | #pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include <vector>
#include "HotkeyInfo.h"
class Hotkeys : public CPropertyPage {
DECLARE_DYNAMIC(Hotkeys)
public:
Hotkeys();
virtual ~Hotkeys();
enum { IDD = IDD_HOTKEYS };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInit... |
Add transaction main key definitions | /*
* waysome - wayland based window manager
*
* Copyright in alphabetical order:
*
* Copyright (C) 2014-2015 Julian Ganz
* Copyright (C) 2014-2015 Manuel Messner
* Copyright (C) 2014-2015 Marcel Müller
* Copyright (C) 2014-2015 Matthias Beyer
* Copyright (C) 2014-2015 Nadja Sommerfeld
*
* This file is part o... | |
Remove backwards compatible macro RTC_EXPORT from sdk/. | /*
* Copyright 2016 The WebRTC 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 in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing ... | /*
* Copyright 2016 The WebRTC 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 in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing ... |
Add ref counting to Git class | #include "include/cef_base.h"
#include "include/cef_v8.h"
namespace v8_extensions {
class Git : public CefV8Handler {
public:
Git();
virtual bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefR... | #include "include/cef_base.h"
#include "include/cef_v8.h"
namespace v8_extensions {
class Git : public CefV8Handler {
public:
Git();
virtual bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefR... |
Use assert_int_equal not assert_true where possible | #include <stdlib.h>
#include "seatest.h"
static void test_abs (void)
{
// abs
assert_true(abs(0) == 0);
assert_true(abs(1) == 1);
assert_true(abs(INT_MAX) == INT_MAX);
assert_true(abs(-1) == 1);
// labs
assert_true(labs(0) == 0);
assert_true(labs(1) == 1);
assert_true(labs(LONG_MAX)... | #include <stdlib.h>
#include "seatest.h"
static void test_abs (void)
{
// abs
assert_int_equal(0, abs(0));
assert_int_equal(1, abs(1));
assert_int_equal(INT_MAX, abs(INT_MAX));
assert_int_equal(1, abs(-1));
// labs
assert_true(labs(0) == 0);
assert_true(labs(1) == 1);
assert_true(la... |
Add a missing policy_export include | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#define COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#incl... | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#define COMPONENTS_POLICY_CORE_COMMON_POLICY_PROVIDER_ANDROID_DELEGATE_H_
#incl... |
Handle network traffic in main loop | /**
* @file debug.h
* @brief Initializer and main loop of EthShield
*
* \copyright Copyright 2013 /Dev. All rights reserved.
* \license This project is released under MIT license.
*
* @author Ferdi van der Werf <efcm@slashdev.nl>
* @since 0.1.0
*/
// Speed of micro-controller (20.0 MHz)
#ifndef F_CPU
#define ... | /**
* @file debug.h
* @brief Initializer and main loop of EthShield
*
* \copyright Copyright 2013 /Dev. All rights reserved.
* \license This project is released under MIT license.
*
* @author Ferdi van der Werf <efcm@slashdev.nl>
* @since 0.1.0
*/
// Speed of micro-controller (20.0 MHz)
#ifndef F_CPU
#define ... |
Refactor Problem 1's solution in C | #include <stdio.h>
#define RANGE 1000
unsigned int count_divisibility(unsigned int divisor) {
int count = 0;
for ( int i = 1 ; i < RANGE ; i++ ) {
if ( i % divisor == 0 ) {
count++;
}
}
return count;
}
// Use the identity n(n+1)/2 to calculate the sum
unsigned int calcul... | #include <stdio.h>
#define RANGE 1000
unsigned short count_divisibility(unsigned short divisor) {
int count = 0;
count = (RANGE - 1) / divisor;
return count;
}
// Use the identity n(n+1)/2 to calculate the sum
unsigned int calculate_divisibility_sum(unsigned short number, unsigned short count) {
un... |
Drop support for Windows 7. | #pragma once
#define NTDDI_VERSION 0x06010000
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#include <ShellScalingApi.h>
#include <Shlobj.h>
#include <ShObjIdl.h>
#include <Windows.h>
#include <wrl.h>
#undef min
#undef max
#include <algorithm>
#include <unordered_map>
namespace WRL
{
using namespace Microsoft... | #pragma once
#define NTDDI_VERSION 0x0A000007 // NTDDI_WIN10_19H1
#define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10
#define WINVER 0x0A00
#include <ShellScalingApi.h>
#include <Shlobj.h>
#include <ShObjIdl.h>
#include <Windows.h>
#include <wrl.h>
#undef min
#undef max
#include <algorithm>
#include <unordered_map>
... |
Move to syslog, minor exit bug on usbbridge | //
// Created by cyber on 15.08.19.
//
#ifndef DRONEBRIDGE_DB_COMMON_H
#define DRONEBRIDGE_DB_COMMON_H
#endif //DRONEBRIDGE_DB_COMMON_H
| |
Use QueryPerformanceCounter() timer instead of GetTickCount() | /* Copyright (C) 2012-2013 Zeex
*
* 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 i... | /* Copyright (C) 2012-2013 Zeex
*
* 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 i... |
Convert our own check of OPENSSL_NO_DEPRECATED | /*
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/lice... | /*
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/lice... |
Include Allegro header so we can use 'bool'. | #ifndef T3F_VIEW_H
#define T3F_VIEW_H
/* structure holds information about a 3D viewport usually used to represent
one player's screen, split screen games will have multiple viewports */
typedef struct
{
/* offset of viewport */
float offset_x;
float offset_y;
float width;
float height;
/* vanishing point... | #ifndef T3F_VIEW_H
#define T3F_VIEW_H
#include <allegro5/allegro5.h>
/* structure holds information about a 3D viewport usually used to represent
one player's screen, split screen games will have multiple viewports */
typedef struct
{
/* offset of viewport */
float offset_x;
float offset_y;
float width;
floa... |
Fix MSVC error C2133 : unknown size of multi-dimensional static const arrays (despite supposed support of C99). Have not confirmed if this breaks anything yet. |
/* encrypted keys */
static const uint32_t internal_device_number = 0;
static const uint8_t internal_dk_list[][21] = {
{
},
};
static const uint8_t internal_pk_list[][16] = {
{
},
};
static const uint8_t internal_hc_list[][112] = {
{
},
};
/* customize this function to "hide" the keys in the binary */... |
/* encrypted keys */
static const uint32_t internal_device_number = 0;
static const uint8_t internal_dk_list[][21] = {
{ 0 },
};
static const uint8_t internal_pk_list[][16] = {
{ 0 },
};
static const uint8_t internal_hc_list[][112] = {
{ 0 },
};
/* customize this function to "hide" the keys in the binary */... |
Mark functions as override if they override | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef MOCKSOCKET_H
#define MOCKSOCKET_H
#include <Arcus/Socket.h> //Inheriting from this to be able to swap this socket in the tested class.
#include <deque> //History of sent and received messages.
namespace cura... | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef MOCKSOCKET_H
#define MOCKSOCKET_H
#include <Arcus/Socket.h> //Inheriting from this to be able to swap this socket in the tested class.
#include <deque> //History of sent and received messages.
namespace cura... |
Add LOGFN macro to header. | #ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H
# ifndef ECORE_X_RANDR_1_2
# define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
# endif
# ifndef ECORE_X_RANDR_1_3
# define ECORE_X_RANDR_1_3 ((1 << 16) | 3)
# endif
# ifndef E_RANDR_12
# define E_RANDR_12 (e_randr_screen_info.rrvd_info.randr_info_12)
# endif
EAPI extern E_Module... | #ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H
# define LOGFNS 1
# ifdef LOGFNS
# include <stdio.h>
# define LOGFN(fl, ln, fn) printf("-CONF-RANDR: %25s: %5i - %s\n", fl, ln, fn);
# else
# define LOGFN(fl, ln, fn)
# endif
# ifndef ECORE_X_RANDR_1_2
# define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
# endif
# ifndef ECORE_... |
Remove another unused private member variable | //===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------... | //===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------... |
Use the member strings since their types on concrete | #ifndef CPR_AUTH_H
#define CPR_AUTH_H
#include <string>
namespace cpr {
class Authentication {
public:
Authentication(const std::string& username, const std::string& password) :
username_{username}, password_{password}, auth_string_{username + ":" + password} {}
const char* Get... | #ifndef CPR_AUTH_H
#define CPR_AUTH_H
#include <string>
namespace cpr {
class Authentication {
public:
Authentication(const std::string& username, const std::string& password) :
username_{username}, password_{password}, auth_string_{username_ + ":" + password_} {}
const char* G... |
Use protothread library which included in RabirdToolkitThirdParties | #ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#include <pt.h>
class RCoRoutineRunner
{
public:
RCoRoutineRunner();
virtual
~RCoRoutineRunner();
virtual char
run();
public:
struct pt mPt;
};
#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
| #ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#include <pt/pt.h>
class RCoRoutineRunner
{
public:
RCoRoutineRunner();
virtual
~RCoRoutineRunner();
virtual char
run();
public:
struct pt mPt;
};
#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658... |
Repair on Twin Primes.Homework 2 completed.Stefan Iliev 26 10V | #include<stdio.h>
int main()
{
int printed_numb=0;
int x;
int prev_number=2;
int number=2;
int flag;
while(printed_numb<10)
{
flag=0;
for(x=2;x<=number/2;x++)
{
if(number%x==0)
{
flag=1;
break;
}
}
if(flag=0)
{
if(number==prev_number+2)
{
printf("%d - ",prev_number);
printf("... | #include<stdio.h>
int main()
{
int printed_numb=0;
int x;
int prev_number=2;
int number=2;
int flag;
while(printed_numb<10)
{
flag=0;
for(x=2;x<=number/2;x++)
{
if(number%x==0)
{
flag=1;
break;
}
}
if(flag==0)
{
if(number==prev_number+2)
{
printf("%d - ",prev_number);
printf(... |
Add an empty iic test case | /* Copyright (c) 2013, laborer (laborer@126.com)
* Licensed under the BSD 2-Clause License.
*/
#include "common.h"
#include "iic.h"
#include "uart.h"
void welcome(void)
{
uart_baudrate();
uart_init();
uart_putstr("c51drv\n");
}
void main(void) {
welcome();
while (1);
}
| |
Create db table for subscriptions. | #include <sqlite3.h>
#include <stdio.h>
static sqlite3 *db;
int _mqtt_db_create_tables(void);
int mqtt_db_open(const char *filename)
{
if(sqlite3_open(filename, &db) != SQLITE_OK){
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
return 1;
}
return _mqtt_db_create_tables();
}
int mqtt_db_close(void)
{
s... | #include <sqlite3.h>
#include <stdio.h>
static sqlite3 *db;
int _mqtt_db_create_tables(void);
int mqtt_db_open(const char *filename)
{
if(sqlite3_open(filename, &db) != SQLITE_OK){
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
return 1;
}
return _mqtt_db_create_tables();
}
int mqtt_db_close(void)
{
s... |
Fix invalid read in pseudo observer test | #include <telepathy-logger/channel-factory-internal.h>
#include <telepathy-logger/observer-internal.h>
static gint factory_counter = 0;
static TplChannel *
mock_factory (const gchar *chan_type,
TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props,
TpAccount *tp_acc, GError **error)
{
fact... | #include <telepathy-logger/channel-factory-internal.h>
#include <telepathy-logger/observer-internal.h>
static gint factory_counter = 0;
static TplChannel *
mock_factory (const gchar *chan_type,
TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props,
TpAccount *tp_acc, GError **error)
{
fact... |
Fix compile errors with different integer-types | //
// include/guard_overflow.h
// tbd
//
// Created by inoahdev on 12/29/18.
// Copyright © 2018 - 2019 inoahdev. All rights reserved.
//
#ifndef GUARD_OVERFLOW_H
#define GUARD_OVERFLOW_H
#include <stdint.h>
#define guard_overflow_add(left_in, right) _Generic((left_in), \
uint32_t *: __builtin_uadd_overflow,... | //
// include/guard_overflow.h
// tbd
//
// Created by inoahdev on 12/29/18.
// Copyright © 2018 - 2019 inoahdev. All rights reserved.
//
#ifndef GUARD_OVERFLOW_H
#define GUARD_OVERFLOW_H
#include <stdint.h>
#define guard_overflow_add(left_in, right) \
__builtin_add_overflow(*left_in, right, left_in)
#defin... |
Fix broken kernel headers preventing ARM build | #ifndef _ROOT_DEV_H_
#define _ROOT_DEV_H_
#include <linux/major.h>
enum {
Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
Root_RAM0 = MKDEV(RAMDISK_MAJOR, 0),
Root_RAM1 = MKDEV(RAMDISK_MAJOR, 1),
Root_FD0 = MKDEV(FLOPPY_MAJOR, 0),
Root_HDA1 = MKDEV(IDE0_MAJOR, 1),
Root_HDA2 = MKDEV(IDE0_MAJOR, 2),
Root_SDA1 = MKDEV(SCSI... | #ifndef _ROOT_DEV_H_
#define _ROOT_DEV_H_
#include <linux/major.h>
#include <linux/types.h>
#include <linux/kdev_t.h>
enum {
Root_NFS = MKDEV(UNNAMED_MAJOR, 255),
Root_RAM0 = MKDEV(RAMDISK_MAJOR, 0),
Root_RAM1 = MKDEV(RAMDISK_MAJOR, 1),
Root_FD0 = MKDEV(FLOPPY_MAJOR, 0),
Root_HDA1 = MKDEV(IDE0_MAJOR, 1),
Root_H... |
Add documentation for the defines and variables. | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Fix libressl patch python 3.6 | --- Modules/_ssl.c.orig
+++ Modules/_ssl.c
@@ -99,7 +99,8 @@ struct py_ssl_library_code {
/* Include generated data (error codes) */
#include "_ssl_data.h"
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
+ (!defined(LIBRESSL_VERSION... | $OpenBSD: patch-Modules__ssl_c,v 1.2 2018/03/17 22:30:04 sthen Exp $
XXX maybe the second hunk can go away now we have auto-init, I'm not sure
exactly what python's lock protects
Index: Modules/_ssl.c
--- Modules/_ssl.c.orig
+++ Modules/_ssl.c
@@ -99,7 +99,8 @@ struct py_ssl_library_code {
/* Include generated data ... |
Add missing file for the MPI test. | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int
main (int argc, char *argv[])
{
int rank, size, length;
char name[BUFSIZ];
MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
MPI_Comm_size (MPI_COMM_WORLD, &size);
MPI_Get_processor_name (name, &length);
printf ("%s: hello world ... | |
Add void to empty function parameter | #define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyObject* websocket_mask(PyObject* self, PyObject* args) {
const char* mask;
Py_ssize_t mask_len;
const char* data;
Py_ssize_t data_len;
Py_ssize_t i;
PyObject* result;
char* buf;
if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, ... | #define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyObject* websocket_mask(PyObject* self, PyObject* args) {
const char* mask;
Py_ssize_t mask_len;
const char* data;
Py_ssize_t data_len;
Py_ssize_t i;
PyObject* result;
char* buf;
if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, ... |
Remove OSVersion check of import "UIStepper+FlatUI.h" | //
// FlatUIKit.h
// FlatUI
//
// Created by Keisuke Kimura on 6/8/13.
// Copyright (c) 2013 Keisuke Kimura. All rights reserved.
//
#ifndef FlatUI_FlatUIKit_h
#define FlatUI_FlatUIKit_h
#ifndef __IPHONE_5_0
#error "FlatUIKit uses features only available in iOS SDK 5.0 and later."
#endif
#if TARGET_OS_IPHONE
#im... | //
// FlatUIKit.h
// FlatUI
//
// Created by Keisuke Kimura on 6/8/13.
// Copyright (c) 2013 Keisuke Kimura. All rights reserved.
//
#ifndef FlatUI_FlatUIKit_h
#define FlatUI_FlatUIKit_h
#ifndef __IPHONE_5_0
#error "FlatUIKit uses features only available in iOS SDK 5.0 and later."
#endif
#if TARGET_OS_IPHONE
#im... |
Add asserts to C sum of even squares | int sum_of_even_squares(int* a, unsigned int length) {
int total = 0;
for (unsigned int i = 0; i < length; i++) {
if (a[i] % 2 == 0) {
total += a[i] * a[i];
}
}
return total;
}
| int sum_of_even_squares(int* a, unsigned int length) {
int total = 0;
for (unsigned int i = 0; i < length; i++) {
if (a[i] % 2 == 0) {
total += a[i] * a[i];
}
}
return total;
}
#include <assert.h>
static int a[] = {7, 3, -8, 4, 1, 0, 11, 2};
int main() {
assert(sum_of_... |
Use __SIZE_TYPE__ instead of rt_size_t in minilibc. | #ifndef __TYPES_H__
#define __TYPES_H__
#include <rtthread.h>
typedef long off_t;
typedef rt_size_t size_t;
typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
typedef rt_uint8_t u_char;
typedef rt_uint16_t u_short;
typedef rt_ubase_t u_int;
typedef rt_uint32_t u_long;
typed... | #ifndef __TYPES_H__
#define __TYPES_H__
#include <rtthread.h>
typedef long off_t;
typedef __SIZE_TYPE__ size_t;
typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
typedef rt_uint8_t u_char;
typedef rt_uint16_t u_short;
typedef rt_ubase_t u_int;
typedef rt_uint32_t u_long;
t... |
Add high and low in iterative | /*
* CIS 314 Fall 2015 Lab 1
* Assigned project
*
* This program reads a sorted array from a file and finds a requested number
* using recursive or iterative binary search. The array is read from a file
* defined by FILE_NAME, which should be written as the number of elements
* followed by the elements ... | /*
* CIS 314 Fall 2015 Lab 1
* Assigned project
*
* This program reads a sorted array from a file and finds a requested number
* using recursive or iterative binary search. The array is read from a file
* defined by FILE_NAME, which should be written as the number of elements
* followed by the elements ... |
Set C linkage for win32 [v]asprintf | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2014 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://ww... | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2014 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://ww... |
Add new class to track OSD assets | #pragma once
#pragma comment(lib, "gdiplus.lib")
#include <Windows.h>
#include <gdiplus.h>
#include <vector>
#include "../MeterWnd/Meter.h"
class OSDSkin {
public:
OSDSkin(Gdiplus::Bitmap *background, Gdiplus::Bitmap *mask,
std::vector<Meter *> meters, std::vector<HICON> iconset) :
background(backgr... | |
Fix for checking if the database is loaded | /*
OpenLieroX
reader for IpToCountry database
code under LGPL
by Albert Zeyer and Dark Charlie
*/
#ifndef __IPTOCOUNTRY_H__
#define __IPTOCOUNTRY_H__
#include <string>
#include "SmartPointer.h"
#include "InternDataClass.h"
#include "GeoIPDatabase.h"
struct SDL_Surface;
typedef GeoRecord IpInfo;
INTERNDATA_C... | /*
OpenLieroX
reader for IpToCountry database
code under LGPL
by Albert Zeyer and Dark Charlie
*/
#ifndef __IPTOCOUNTRY_H__
#define __IPTOCOUNTRY_H__
#include <string>
#include "SmartPointer.h"
#include "InternDataClass.h"
#include "GeoIPDatabase.h"
struct SDL_Surface;
typedef GeoRecord IpInfo;
INTERNDATA_C... |
Address issues found by LGTM | #include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
#include "log.h"
#include "globals.h"
void my_log(int priority, const char *format, ...)
{
va_list ap;
va_start(ap, format);
#ifndef MINIMALISTIC_BUILD
if (globals.no_syslog) {
#endif
time_t now;
struct tm* timeinfo;
char timestring... | #include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
#include "log.h"
#include "globals.h"
void my_log(int priority, const char *format, ...)
{
va_list ap;
va_start(ap, format);
#ifndef MINIMALISTIC_BUILD
if (globals.no_syslog) {
#endif
time_t now;
struct tm timeinfo;
char timestring[... |
Revert "Remove public headers from umbrella header" | #import <Foundation/Foundation.h>
//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;
//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];
#import <Quick/QuickSpec.h> | #import <Foundation/Foundation.h>
//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;
//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];
// In this header, you should import all the public headers of your framework using statements like #i... |
Add typedef block with return value | //
// BlockExamples.h
// ObjcNullability
//
// Created by Bryan Luby on 5/21/15.
// Copyright (c) 2015 Bryan Luby. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^TestBlock)(NSString * __nonnull stuff);
typedef void(^TestBlock2)(NSString * __nullable otherStuff);
NS_ASSUME_NONNULL_BEGIN
t... | //
// BlockExamples.h
// ObjcNullability
//
// Created by Bryan Luby on 5/21/15.
// Copyright (c) 2015 Bryan Luby. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^TestBlock)(NSString * __nonnull stuff);
typedef void(^TestBlock2)(NSString * __nullable otherStuff);
NS_ASSUME_NONNULL_BEGIN
t... |
Support code for Storable.hs - defines teh read/writeFooOffPtr functions. | #include "HsFFI.h"
void writeIntOffPtr(HsPtr arg1, HsInt arg2, HsInt arg3)
{
((typeof(arg3)*)arg1)[arg2] = arg3;
}
HsInt readIntOffPtr(HsPtr arg1, HsInt arg2)
{
return ((typeof(readIntOffPtr(arg1,arg2))*)arg1)[arg2];
}
void writeCharOffPtr(HsPtr arg1, HsInt arg2, HsChar arg3)
{
((typeof(arg3)*)arg1)[arg2] = ar... | |
Mark run() as pure virtual function | #ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#include <pt/pt.h>
class RCoRoutineRunner
{
public:
RCoRoutineRunner();
virtual
~RCoRoutineRunner();
virtual char
run();
public:
struct pt mPt;
};
#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658... | #ifndef __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#define __INCLUDED_ECE554E80AF211E7AA6EA088B4D1658C
#include <pt/pt.h>
class RCoRoutineRunner
{
public:
RCoRoutineRunner();
virtual
~RCoRoutineRunner();
virtual char
run() = 0;
public:
struct pt mPt;
};
#endif // __INCLUDED_ECE554E80AF211E7AA6EA088B4D... |
Add some comments to compiler.h | /* Copyright (c) 2016 PaddlePaddle 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 ag... | /* Copyright (c) 2016 PaddlePaddle 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 ag... |
Remove option argument for transmit mode | // Copyright 2016 Mitchell Kember. Subject to the MIT License.
#include "translate.h"
#include "transmit.h"
#include "util.h"
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
setup_util(argv[0]);
// Initialize options to default values.
int mode = 'e';
int time_unit = 0;
// Get command... | // Copyright 2016 Mitchell Kember. Subject to the MIT License.
#include "translate.h"
#include "transmit.h"
#include "util.h"
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
setup_util(argv[0]);
// Initialize the default mode.
int mode = 'e';
// Get command line options.
int c;
exter... |
Correct usage message option list. | #include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>
#include "choices.h"
#include "config.h"
#include "io.h"
#include "ui.h"
void usage();
void version();
int
main(int argc,char **argv)
{
int ch;
struct choices *cs;
while ((ch = getopt(argc, argv, "hv")) != -1)
switch (ch) {
case... | #include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>
#include "choices.h"
#include "config.h"
#include "io.h"
#include "ui.h"
void usage();
void version();
int
main(int argc,char **argv)
{
int ch;
struct choices *cs;
while ((ch = getopt(argc, argv, "hv")) != -1)
switch (ch) {
case... |
Create code to test timer |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
return 0;
}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "timer.h"
#include "ports.h"
int main(int argc, char *argv[]) {
int prt, time;
mach_port_t port;
tcp_timer_t timer;
char buffer[4096];
typeinfo_t tpinfo;
timer_message_t* msg = (timer_message_t*)buffer;
mach_port_allocate... |
Add header with PIMPL helper macros | /* +---------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| http://www.mrpt.org/ |
| ... | |
Add API for NVRAM devices with byte level erase. | /*
* Copyright (C) 2015 Eistec AB
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @defgroup nvram Non-volatile RAM
* @ingroup drivers
* @brief Non-volatile RAM interf... | |
Add macros that provide an iterator wrapper | #ifndef BALL_CONCEPT_STDITERATORWRAPPER_H
#define BALL_CONCEPT_STDITERATORWRAPPER_H
#define IteratorWrapper(type)\
template<typename T>\
class type##IteratorWrapper\
{\
public:\
type##IteratorWrapper(T* c) : container_(c) {}\
type##Iterator begin() { return container_->begin##type(); }\
type##Iterator en... | |
Update testcase for r283948 (NFC) | // Make sure instrumentation data from available_externally functions doesn't
// get thrown out and are emitted with the expected linkage.
// RUN: %clang_cc1 -O2 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage-available_externally.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s
// CHECK: @__pr... | // Make sure instrumentation data from available_externally functions doesn't
// get thrown out and are emitted with the expected linkage.
// RUN: %clang_cc1 -O2 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage-available_externally.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s
// CHECK: @__pr... |
Fix number of peripheral vectors for stm32f401xE | /* mbed Microcontroller Library - cmsis_nvic
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
*
* CMSIS-style functionality to support dynamic vectors
*/
#ifndef MBED_CMSIS_NVIC_H
#define MBED_CMSIS_NVIC_H
#include <stdint.h>
#if defined(STM32F407xx)
#define MCU_NUM_PERIPH_VECTORS 82
#elif defined(ST... | /* mbed Microcontroller Library - cmsis_nvic
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
*
* CMSIS-style functionality to support dynamic vectors
*/
#ifndef MBED_CMSIS_NVIC_H
#define MBED_CMSIS_NVIC_H
#include <stdint.h>
#if defined(STM32F401xE) || defined(STM32F407xx)
#define MCU_NUM_PERIPH_VEC... |
Add a stupid test (skipped) where goblint crashes. | // SKIP: Low Priority -- this compiles with warnings, but goblint crashes.
#include <pthread.h>
int data[10];
void *t_fun(int i) {
int *x = &data[i];
return NULL;
}
int main() {
pthread_t id;
int n = 0;
pthread_create(&id, NULL, t_fun, (int*) n);
return 0;
}
| |
Correct off-by-one error in os_find_self on Linux | #define _XOPEN_SOURCE 500
#include "os_common.h"
#include <unistd.h>
#include <stdlib.h>
char *os_find_self(const char *argv0)
{
(void)argv0;
// PATH_MAX (used by readlink(2)) is not necessarily available
size_t size = 2048, used = 0;
char *path = NULL;
do {
size *= 2;
path = reall... | #define _XOPEN_SOURCE 500
#include "os_common.h"
#include <unistd.h>
#include <stdlib.h>
char *os_find_self(const char *argv0)
{
(void)argv0;
// PATH_MAX (used by readlink(2)) is not necessarily available
size_t size = 2048, used = 0;
char *path = NULL;
do {
size *= 2;
path = reall... |
Move discovery reply packet construction to the correct file | // homerun.h
// HDHomeRun Wrapper
#include <stdint.h>
#include "libhdhomerun.h"
#ifndef HOMERUN_H
#define HOMERUN_H
int verifyHomerunTuner(int);
struct hdhomerun_discover_device_t getValidDevice();
#endif
| // network.h
// hdpirun
//
// HDHomeRun wrapper. Wraps library functionality for use
//
// Author: Robbie Duncan
// Copyright: Copyright (c) 2016 Robbie Duncan
// License: See LICENSE
//
#include <stdint.h>
#include "libhdhomerun.h"
//
#ifndef HOMERUN_H
#define HOMERUN_H
int verifyHomerunTuner(int);
//
// Constructs a... |
Rename MBArtist to MbArtist to make it compile. | /* Get artist by id.
*
* Usage:
* getartist 'artist id'
*
* $Id$
*/
#include <stdio.h>
#include <musicbrainz3/mb_c.h>
int
main(int argc, char **argv)
{
MBQuery query;
MBArtist artist;
char data[256];
if (argc < 2) {
printf("Usage: getartist 'artist id'\n");
return 1;
}
mb_webservice_init();
... | /* Get artist by id.
*
* Usage:
* getartist 'artist id'
*
* $Id$
*/
#include <stdio.h>
#include <musicbrainz3/mb_c.h>
int
main(int argc, char **argv)
{
MbQuery query;
MbArtist artist;
char data[256];
if (argc < 2) {
printf("Usage: getartist 'artist id'\n");
return 1;
}
mb_webservice_init();
... |
Use platform stdint.h and standard size_t printf format in newer versions of MSVC | /*******************************************************************************
* Copyright 2014 Trevor Robinson
*
* 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.apach... | /*******************************************************************************
* Copyright 2014 Trevor Robinson
*
* 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.apach... |
Add flash writer code for STM32F3. |
#include <libopencm3/stm32/flash.h>
#include "flash_writer.h"
#include <stdio.h>
void flash_writer_unlock(void)
{
flash_unlock();
}
void flash_writer_lock(void)
{
flash_lock();
}
void flash_writer_page_erase(void *page)
{
flash_wait_for_last_operation();
FLASH_CR |= FLASH_CR_PER;
FLASH_AR = (ui... | |
Add setHeader to HTTPRequest API | #pragma once
namespace Halley
{
class HTTPResponse {
public:
virtual ~HTTPResponse() {}
virtual int getResponseCode() const = 0;
virtual const Bytes& getBody() const = 0;
};
class HTTPRequest {
public:
virtual ~HTTPRequest() {}
virtual void setPostData(const String& contentType, const Bytes& data) = 0... | #pragma once
namespace Halley
{
class HTTPResponse {
public:
virtual ~HTTPResponse() {}
virtual int getResponseCode() const = 0;
virtual const Bytes& getBody() const = 0;
};
class HTTPRequest {
public:
virtual ~HTTPRequest() {}
virtual void setPostData(const String& contentType, const Bytes& data) = 0... |
Use periods, not semicolons between Copyright and All Rights Reserved. | /* Return the copyright string. This is updated manually. */
#include "Python.h"
static char cprt[] =
"Copyright (c) 2000 BeOpen.com; All Rights Reserved.\n\
Copyright (c) 1995-2000 Corporation for National Research Initiatives;\n\
All Rights Reserved.\n\
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amst... | /* Return the copyright string. This is updated manually. */
#include "Python.h"
static char cprt[] =
"Copyright (c) 2000 BeOpen.com. All Rights Reserved.\n\
Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\
All Rights Reserved.\n\
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Ams... |
Add BSD 3-clause open source header | #ifndef _EVENT_H_
#define _EVENT_H_
#include "dataStackEntry.h"
typedef struct event Event;
Event *ev_create(char *name, char *eventData, unsigned long nAUs);
Event *ev_reference(Event *event);
void ev_release(Event *event);
char *ev_data(Event *event);
char *ev_topic(Event *event);
int ev_theData(Event *event,... | #ifndef _EVENT_H_
#define _EVENT_H_
/*
* Copyright (c) 2013, Court of the University of Glasgow
* All rights reserved.
* 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 retain ... |
Remove macOS header from Win32 impl | // LAF OS Library
// Copyright (C) 2018-2020 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_WIN_COLOR_SPACE_H_INCLUDED
#define OS_WIN_COLOR_SPACE_H_INCLUDED
#pragma once
#include "os/color_space.h"
#ifdef __OBJC__
#include <Coco... | // LAF OS Library
// Copyright (C) 2018-2021 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_WIN_COLOR_SPACE_H_INCLUDED
#define OS_WIN_COLOR_SPACE_H_INCLUDED
#pragma once
#include "os/color_space.h"
#include <vector>
namespace o... |
Fix formatting to match libdispatch coding style. | /*
* Copyright (c) 2013-2016 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* 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/lic... | /*
* Copyright (c) 2013-2016 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* 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/lic... |
Make the header more descriptive | #ifndef __RXE_H
#define __RXE_H
#define MAXBYTES 8
#define MAXBITS 64
void encrypt(char*, char *, char *);
void decrypt(char*, char *, char *);
#endif /* !__RXE_H */
| #ifndef __RXE_H
#define __RXE_H
#define MAXBYTES 8
#define MAXBITS MAXBYTES*8
void encrypt(char* in, char *out, char *key);
void decrypt(char* in, char *out, char *key);
#endif /* !__RXE_H */
|
Revert "limozeen: Refine the BRD_ID check" | /* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "common.h"
#include "sku.h"
#include "system.h"
#include "usbc_ppc.h"
void board_hibernate(void)
{
int i;
if (!board_is_clamshell()) {... | /* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "common.h"
#include "sku.h"
#include "system.h"
#include "usbc_ppc.h"
void board_hibernate(void)
{
int i;
if (!board_is_clamshell()) {... |
Use jstreams namespace in macro definition (not everybody uses the "using" keyword. | #include "analyzerfactoryfactory.h"
#ifdef STRIGI_IMPORT_API
#ifdef WIN32
#define STRIGI_PLUGIN_API __declspec(dllexport)
#else
#define STRIGI_PLUGIN_API
#endif
#else
#error "You should add STRIGI_IMPORT_API to the top of you plugin, you should not include this header if your code is not a plugin"
#endif
#def... | #include "analyzerfactoryfactory.h"
#ifdef STRIGI_IMPORT_API
#ifdef WIN32
#define STRIGI_PLUGIN_API __declspec(dllexport)
#else
#define STRIGI_PLUGIN_API
#endif
#else
#error "You should add STRIGI_IMPORT_API to the top of you plugin, you should not include this header if your code is not a plugin"
#endif
#def... |
Add primitive array to library header. | /*
* BPFoundationExtensions.h
* BPFoundation
*
* Created by Jon Olson on 7/9/09.
* Copyright 2009 Ballistic Pigeon, LLC. All rights reserved.
*
*/
#ifndef _BPFOUNDATION_EXTENSIONS_H_
#define _BPFOUNDATION_EXTENSIONS_H_
#import "NSArray+BPFoundationExtensions.h"
#import "NSMutableArray+BPFoundationExtension... | /*
* BPFoundationExtensions.h
* BPFoundation
*
* Created by Jon Olson on 7/9/09.
* Copyright 2009 Ballistic Pigeon, LLC. All rights reserved.
*
*/
#ifndef _BPFOUNDATION_EXTENSIONS_H_
#define _BPFOUNDATION_EXTENSIONS_H_
#import "NSArray+BPFoundationExtensions.h"
#import "NSMutableArray+BPFoundationExtension... |
Add Duff's Device adaptation to test suite | int printf(const char *, ...);
/* "Duff's Device", adapted from
* https://groups.google.com/forum/#!msg/net.lang.c/3KFq-67DzdQ/TKl64DiBAGYJ
*/
void send(short *to, short *from, int count) {
int n = (count + 7)/8;
switch (count % 8) {
case 0: do { *to += *from++;
case 7: *to += *from++;
... | |
Implement faster inverse square root function | #include <pal.h>
/**
*
* Calculates the inverse square root of the input vector 'a'.
*
* @param a Pointer to input vector
*
* @param c Pointer to output vector
*
* @param n Size of 'a' and 'c' vector.
*
* @param p Number of processor to use (task parallelism)
*
* @param team Team to work w... | #include <pal.h>
/**
*
* Calculates the inverse square root of the input vector 'a'.
*
* This function uses a method of computing the inverse square root
* made popular by the Quake 3 source code release. Chris Lomont has
* provided an exhaustive analysis here:
* http://www.lomont.org/Math/Papers/2003/InvSqrt.... |
Reimplement InsertPointGuard to avoid LLVM ABI incompatibility. | #pragma once
#include "preprocessor/llvm_includes_start.h"
#include <llvm/IR/IRBuilder.h>
#include "preprocessor/llvm_includes_end.h"
namespace dev
{
namespace eth
{
namespace jit
{
class RuntimeManager;
/// Base class for compiler helpers like Memory, GasMeter, etc.
class CompilerHelper
{
protected:
CompilerHelpe... | #pragma once
#include "preprocessor/llvm_includes_start.h"
#include <llvm/IR/IRBuilder.h>
#include "preprocessor/llvm_includes_end.h"
namespace dev
{
namespace eth
{
namespace jit
{
class RuntimeManager;
/// Base class for compiler helpers like Memory, GasMeter, etc.
class CompilerHelper
{
protected:
CompilerHelpe... |
Rename the implementation pointer to respect naming convention | #ifndef ENTRY_H
#define ENTRY_H
#include <string>
#include <memory>
namespace diaryengine {
class Entry
{
public:
Entry();
~Entry();
void setTitle(std::string title);
std::string title();
private:
struct Implementation;
std::unique_ptr<Implementation> inside_;
};
}... | #ifndef ENTRY_H
#define ENTRY_H
#include <string>
#include <memory>
namespace diaryengine {
class Entry
{
public:
Entry();
~Entry();
void setTitle(std::string title);
std::string title();
private:
struct Implementation;
std::unique_ptr<Implementation> _inside;
};
}... |
Fix incorrect reporting of successful parsing. On branch master Your branch is ahead of 'github/master' by 3 commits. (use "git push" to publish your local commits) | /*!
@file main.c
@brief A simple test program for the C library code.
*/
#include "stdio.h"
#include "verilog_parser.h"
int main(int argc, char ** argv)
{
if(argc < 2)
{
printf("ERROR. Please supply at least one file path argument.\n");
return 1;
}
else
{
int F = 0;
... | /*!
@file main.c
@brief A simple test program for the C library code.
*/
#include "stdio.h"
#include "verilog_parser.h"
int main(int argc, char ** argv)
{
if(argc < 2)
{
printf("ERROR. Please supply at least one file path argument.\n");
return 1;
}
else
{
int F = 0;
... |
Make sure stdout is flushed before trapping in panic | #include <stdarg.h>
#include <stdio.h>
#include <whitgl/logging.h>
#define LOG_BUFFER_MAX (256)
char _buffer[LOG_BUFFER_MAX];
void whitgl_logit(const char *file, const int line, const char *str, ...)
{
va_list args;
va_start(args, str);
vsnprintf(_buffer, LOG_BUFFER_MAX, str, args);
printf("%24s:%03d %s\n", fil... | #include <stdarg.h>
#include <stdio.h>
#include <whitgl/logging.h>
#define LOG_BUFFER_MAX (256)
char _buffer[LOG_BUFFER_MAX];
void whitgl_logit(const char *file, const int line, const char *str, ...)
{
va_list args;
va_start(args, str);
vsnprintf(_buffer, LOG_BUFFER_MAX, str, args);
printf("%24s:%03d %s\n", fil... |
Remove unnecessarily public method from interface | //
// NSManagedObject+JSONHelpers.h
//
// Created by Saul Mora on 6/28/11.
// Copyright 2011 Magical Panda Software LLC. All rights reserved.
//
#import <CoreData/CoreData.h>
extern NSString * const kMagicalRecordImportCustomDateFormatKey;
extern NSString * const kMagicalRecordImportDefaultDateFormatString;
extern... | //
// NSManagedObject+JSONHelpers.h
//
// Created by Saul Mora on 6/28/11.
// Copyright 2011 Magical Panda Software LLC. All rights reserved.
//
#import <CoreData/CoreData.h>
extern NSString * const kMagicalRecordImportCustomDateFormatKey;
extern NSString * const kMagicalRecordImportDefaultDateFormatString;
extern... |
Fix typo in umbrella header | //
// TLLayoutTransitioning.h
// TLLayoutTransitioning
//
// Created by Tim Moose on 6/29/15.
// Copyright (c) 2015 Tractable Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TLLayoutTransitioning.
FOUNDATION_EXPORT double TLLayoutTransitioningVersionNumber;
//! Project versio... | //
// TLLayoutTransitioning.h
// TLLayoutTransitioning
//
// Created by Tim Moose on 6/29/15.
// Copyright (c) 2015 Tractable Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TLLayoutTransitioning.
FOUNDATION_EXPORT double TLLayoutTransitioningVersionNumber;
//! Project versio... |
Mend improper use of readlink(2) | #include <unistd.h>
#include <limits.h>
char *os_find_self(void)
{
// Using PATH_MAX is generally bad, but that's what readlink() says it uses.
size_t size = PATH_MAX;
char *path = malloc(size);
if (readlink("/proc/self/exe", path, size) == 0) {
return path;
} else {
free(path);
... | #include <unistd.h>
#include <stdlib.h>
char *os_find_self(void)
{
// PATH_MAX (used by readlink(2)) is not necessarily available
size_t size = 4096;
char *path = malloc(size);
size_t used = readlink("/proc/self/exe", path, size);
// need strictly less than size, or else we probably truncated
i... |
Create an "include all" header for the project | // Copyright 2016 ELIFE. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
#pragma once
#include <inform/dist.h>
#include <inform/entropy.h>
#include <inform/state_encoding.h>
#include <inform/time_series.h>
| |
Make Fragaria's text view delegate protocol compatible with NSTextViewDelegate. | //
// MGSFragariaTextViewDelegate.h
// Fragaria
//
// Created by Jim Derry on 2/22/15.
//
//
/**
* This protocol defines an interface for delegates that wish
* to receive notifications from Fragaria's text view.
**/
#pragma mark - MGSFragariaTextViewDelegate Protocol
@protocol MGSFragariaTextViewDelegate <NSOb... | //
// MGSFragariaTextViewDelegate.h
// Fragaria
//
// Created by Jim Derry on 2/22/15.
//
//
/**
* This protocol defines an interface for delegates that wish
* to receive notifications from Fragaria's text view.
**/
#pragma mark - MGSFragariaTextViewDelegate Protocol
@protocol MGSFragariaTextViewDelegate <NSTe... |
Print N before computing F(N) | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "weecrypt.h"
void print_factorial(unsigned n);
int
main(void)
{
char buf[512];
mpi_t fib;
mpi_init(fib);
while (printf("Enter N: ") &&
fgets(buf, sizeof(buf), stdin)) {
unsigned n = (unsigned)strtoul(buf, NULL, 10);
if (!n)
break;
... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "weecrypt.h"
void print_factorial(unsigned n);
int
main(void)
{
char buf[512];
mpi_t fib;
mpi_init(fib);
while (printf("Enter N: ") &&
fgets(buf, sizeof(buf), stdin)) {
unsigned n = (unsigned)strtoul(buf, NULL, 10);
if (!n)
break;
... |
Include windows.h (indirectly) in all files | // Copyright 2012-2014 UX Productivity Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... | // Copyright 2012-2014 UX Productivity Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... |
Remove use of compatibility macros in Cygwin-specific code. | /**************************************************************************/
/* */
/* OCaml */
/* */
/* ... | /**************************************************************************/
/* */
/* OCaml */
/* */
/* ... |
Simplify and fix test case | // SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Eotvos Lorand University, Budapest, Hungary
#include "test.h"
fake_cmd_t t4p4s_testcase_test[][RTE_MAX_LCORE] = {
{
// table lookup hits
{FAKE_PKT, 0, 1, FDATA("AA00"), 200, 123, FDATA("AA22")},
// table lookup misses
{FAKE_P... | // SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Eotvos Lorand University, Budapest, Hungary
#include "test.h"
fake_cmd_t t4p4s_testcase_test[][RTE_MAX_LCORE] =
SINGLE_LCORE(
// table lookup hits
FAST(1, 123, INOUT("AA00", "AA22")),
WAIT_FOR_CTL,
WAIT_FOR_CTL,
WAIT_... |
Define a standard header for plug-ins | /* $Id$ */
/* Copyright (c) 2008-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System libSystem */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, vers... | /* $Id$ */
/* Copyright (c) 2008-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System libSystem */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, vers... |
Mark ContiguousMemoryRange::size as const. am: f2c28cd765 am: 1b5ab79b0b | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
Fix calling conventions around CUDA. | #ifndef PRIMITIV_C_CUDA_DEVICE_H_
#define PRIMITIV_C_CUDA_DEVICE_H_
#include <primitiv/c/define.h>
#include <primitiv/c/device.h>
/**
* Creates a new Device object.
* @param device_id ID of the physical GPU.
* @param device Pointer to receive a handler.
* @return Status code.
* @remarks The random number generat... | #ifndef PRIMITIV_C_CUDA_DEVICE_H_
#define PRIMITIV_C_CUDA_DEVICE_H_
#include <primitiv/c/define.h>
#include <primitiv/c/device.h>
/**
* Creates a new Device object.
* @param device_id ID of the physical GPU.
* @param device Pointer to receive a handler.
* @return Status code.
* @remarks The random number generat... |
Add MZBlurEffectAdapter.h to umbrella header | //
// MZFormSheetPresentationControllerFramework.h
// MZFormSheetPresentationControllerFramework
//
#import <UIKit/UIKit.h>
//! Project version number for MZFormSheetPresentation.
FOUNDATION_EXPORT double MZFormSheetPresentationControllerVersionNumber;
//! Project version string for MZFormSheetPresentation.
FOUNDA... | //
// MZFormSheetPresentationControllerFramework.h
// MZFormSheetPresentationControllerFramework
//
#import <UIKit/UIKit.h>
//! Project version number for MZFormSheetPresentation.
FOUNDATION_EXPORT double MZFormSheetPresentationControllerVersionNumber;
//! Project version string for MZFormSheetPresentation.
FOUNDA... |
Revert "Added moreItems boolean to data model for a group" | #import <Foundation/Foundation.h>
@interface StatsGroup : NSObject
@property (nonatomic, strong) NSArray *items; // StatsItem
@property (nonatomic, assign) BOOL moreItemsExist;
@property (nonatomic, copy) NSString *titlePrimary;
@property (nonatomic, copy) NSString *titleSecondary;
@property (nonatomic, s... | #import <Foundation/Foundation.h>
@interface StatsGroup : NSObject
@property (nonatomic, strong) NSArray *items; // StatsItem
@property (nonatomic, copy) NSString *titlePrimary;
@property (nonatomic, copy) NSString *titleSecondary;
@property (nonatomic, strong) NSURL *iconUrl;
@end
|
Remove unnecessary constructor from NotificationObserver. | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#pragma once
#include "content/common... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_OBSERVER_H_
#pragma once
#include "content/common... |
Replace direct video memory access with cputc() for character output. | /*
* Challenger 1P Hello World Program for cc65.
*/
#include <conio.h>
#define VIDEO_RAM_START ((char *) 0xd000)
int main()
{
static const char hello_world[] = "Hello world!";
int scrpos;
const char *cp;
clrscr();
for (cp = hello_world, scrpos = 0x083; *cp; scrpos += 1, cp +... | /*
* Challenger 1P Hello World Program for cc65.
*/
#include <conio.h>
#define VIDEO_RAM_START ((char *) 0xd000)
int main()
{
static const char hello_world[] = "Hello world!\n";
const char *cp;
unsigned int i;
clrscr();
for (cp = hello_world; *cp; cp += 1)
{
cp... |
Add 1160 solution, but it can be improved! | /**
https://www.urionlinejudge.com.br/judge/en/problems/view/1160
TODO:
Test this conjecture:
Since f(x) is the number of inhabitants as a function of x years, such f is a function defined in natural numbers.
Then f(x) = rx/100 + s, such that r and s are real (floating) constants,
where r is the growing hate p... | |
Add parentheses to make example clearer. | #include <stdio.h>
typedef struct {
int *x;
int **y;
} inner ;
typedef struct {
int *g;
inner in[3];
} outer;
int *ep;
int main(int argc, char *argv[])
{
outer o;
int z = 5;
int zzz;
printf("%d\n" , z);
ep = &z;
o.in[2].x = ep;
*o.in[2].x = 3;
printf("%d\n" , z);... | #include <stdio.h>
typedef struct {
int *x;
int **y;
} inner ;
typedef struct {
int *g;
inner in[3];
} outer;
int *ep;
int main(int argc, char *argv[])
{
outer o;
int z = 5;
int zzz;
printf("%d\n" , z);
ep = &z;
o.in[2].x = ep;
*(o.in[2].x) = 3;
printf("%d\n" , z... |
Remove duplicate members so this compiles again | //
// GrowlBezelWindowView.h
// Display Plugins
//
// Created by Jorge Salvador Caffarena on 09/09/04.
// Copyright 2004 Jorge Salvador Caffarena. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "GrowlNotificationView.h"
@interface GrowlBezelWindowView : GrowlNotificationView {
NSImage *icon;
NSString... | //
// GrowlBezelWindowView.h
// Display Plugins
//
// Created by Jorge Salvador Caffarena on 09/09/04.
// Copyright 2004 Jorge Salvador Caffarena. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "GrowlNotificationView.h"
@interface GrowlBezelWindowView : GrowlNotificationView {
NSImage *icon;
NSString... |
Add last file of main filter framework | /*
* filter registration
* copyright (c) 2008 Vitor Sessak
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (a... | |
Add missing newlines to DSFYDEBUG() calls | #include <spotify/api.h>
#include "debug.h"
#include "sp_opaque.h"
SP_LIBEXPORT(const char *) sp_user_canonical_name(sp_user *user) {
DSFYDEBUG("FIXME: Not yet implemented");
return "not-yet-implemented";
}
SP_LIBEXPORT(const char *) sp_user_display_name(sp_user *user) {
DSFYDEBUG("FIXME: Not yet implemented");... | #include <spotify/api.h>
#include "debug.h"
#include "sp_opaque.h"
SP_LIBEXPORT(const char *) sp_user_canonical_name(sp_user *user) {
DSFYDEBUG("FIXME: Not yet implemented\n");
return "not-yet-implemented";
}
SP_LIBEXPORT(const char *) sp_user_display_name(sp_user *user) {
DSFYDEBUG("FIXME: Not yet implemented\... |
Make |ZoneVector| constructor to take const reference. | // Copyright 2014 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELANG_BASE_ZONE_VECTOR_H_
#define ELANG_BASE_ZONE_VECTOR_H_
#include <vector>
#include "elang/base/zone.h"
#include "elang/base/zone_allocator.h"
name... | // Copyright 2014 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELANG_BASE_ZONE_VECTOR_H_
#define ELANG_BASE_ZONE_VECTOR_H_
#include <vector>
#include "elang/base/zone.h"
#include "elang/base/zone_allocator.h"
name... |
Fix compilation on posix platforms | #include <time.h>
#include "clock.h"
#include "clock_type.h"
extern int clock_init(struct Clock **clockp, struct Allocator *allocator)
{
struct timespec res;
if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
/* unknown clock or insufficient resolution */
... | #include <time.h>
#include "clock.h"
#include "clock_type.h"
extern int clock_init(struct SPDR_Clock **clockp, struct SPDR_Allocator *allocator)
{
struct timespec res;
if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
/* unknown clock or insufficient resolution */... |
Work around incompatibility of warn_unused_result on one machine. | #include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */
/* Initially we put data to stdout. */
int cur_out = 1;
/* Put data to current output. */
void putd(const char *data, unsigned long len)
{
(void)write(cur_out,data,len);
}
void put(const char *data)
{
putd(d... | #include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */
/* Initially we put data to stdout. */
int cur_out = 1;
/* Put data to current output. */
void putd(const char *data, unsigned long len)
{
ssize_t n = write(cur_out,data,len);
(void)n;
}
void put(const char *... |
Convert from double to signed data type for reference hamming distance. | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
namespace vespalib::eval {
inline double hamming_distance(double a, double b) {
uint8_t x = (uint8_t) a;
uint8_t y = (uint8_t) b;
return __builtin_popcount(x ^ y);
}
}
| // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
namespace vespalib::eval {
inline double hamming_distance(double a, double b) {
uint8_t x = (uint8_t) (int8_t) a;
uint8_t y = (uint8_t) (int8_t) b;
return __builtin_popcount(x ^ y);
}
}
|
Fix comment at top of file to match file name. | /* File: connection.h
*
* Description: See "md.h"
*
* Comments: See "notice.txt" for copyright and license information.
*
*/
#ifndef __MD5_H__
#define __MD5_H__
#include "psqlodbc.h"
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#define MD5_ODBC
#define FRONTEND
#endif
#define MD5_PASSWD_LEN 35
/*... | /* File: md5.h
*
* Description: See "md5.c"
*
* Comments: See "notice.txt" for copyright and license information.
*
*/
#ifndef __MD5_H__
#define __MD5_H__
#include "psqlodbc.h"
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#define MD5_ODBC
#define FRONTEND
#endif
#define MD5_PASSWD_LEN 35
/* From ... |
Move file closer out from public. | #pragma once
#include <memory>
#include <cstdio> // fopen, fclose
#include <openssl/evp.h>
#include <openssl/ec.h>
namespace JWTXX
{
namespace Utils
{
struct FileCloser
{
void operator()(FILE* fp) { fclose(fp); }
};
typedef std::unique_ptr<FILE, FileCloser> FilePtr;
struct EVPKeyDeleter
{
void operator()(... | #pragma once
#include <memory>
#include <cstdio> // fopen, fclose
#include <openssl/evp.h>
#include <openssl/ec.h>
namespace JWTXX
{
namespace Utils
{
struct EVPKeyDeleter
{
void operator()(EVP_PKEY* key) { EVP_PKEY_free(key); }
};
typedef std::unique_ptr<EVP_PKEY, EVPKeyDeleter> EVPKeyPtr;
struct EVPMDCTXDel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.