commit
stringlengths 40
40
| old_file
stringlengths 4
112
| new_file
stringlengths 4
112
| old_contents
stringlengths 0
2.05k
| new_contents
stringlengths 28
3.9k
| subject
stringlengths 17
736
| message
stringlengths 18
4.78k
| lang
stringclasses 1
value | license
stringclasses 13
values | repos
stringlengths 7
111k
|
---|---|---|---|---|---|---|---|---|---|
c0346b75f26d982b0d8bf5c062b7a728025100a8 | include/truth/cpu.h | include/truth/cpu.h | #pragma once
#include <truth/types.h>
// The state of the CPU before an interrupt occurs.
struct cpu_state;
// Interrupt Service Routine function signature.
// ISRs with this signature are installed to a dispatch table.
typedef void (isr_f)(struct cpu_state *);
/* Install an interrupt handler.
* The handler will have the interrupt number @num, and when triggered it will
* execute @function. If @privileged is set to false, the interrupt will be
* able to be raised by ring 3 code. If false, it will only be able to be
* raised by ring 0 code. @return 0 if the interrupt is successfully installed
* and -1 if that interrupt number has already been registered.
*/
int install_interrupt(uint8_t num, isr_f function);
// Sets up CPU interrupt tables and initializes interrupts
void interrupts_init(void);
// Disable interrupts
extern void disable_interrupts(void);
// Enable interrupts
extern void enable_interrupts(void);
// Halt CPU
extern void halt(void);
// Gets the CPU time step counter value
extern uint64_t cpu_time(void);
| #pragma once
#include <truth/types.h>
// Halt CPU.
extern void halt(void);
// Gets the CPU time step counter value.
extern uint64_t cpu_time(void);
// Puts CPU into sleep state until awoken by interrupt.
void cpu_sleep_state(void);
| Remove stuff moved to interrupts header | Remove stuff moved to interrupts header
| C | mit | iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth |
53b42b54aa7cac4b9b5dc47bb86308f5bec07a0b | lab5.c | lab5.c | /* lab5.c: Employee records */
#include <stdio.h>
#include <string.h>
struct Employee {
char last[16];
char first[11];
char title[16];
int salary;
};
int main() {
struct Employee employees[BUFSIZ];
for (int i = 0; i < BUFSIZ; i++) {
printf("Enter the last name: ");
fflush(stdout); /* To keep cursor on same line as prompt */
gets(employees[i].last);
if (strlen(employees[i].last) > 0) {
printf("Enter the first name: ");
fflush(stdout);
gets(employees[i].first);
printf("Enter the job title: ");
fflush(stdout);
gets(employees[i].title);
printf("Enter the salary: ");
fflush(stdout);
scanf("%d", &employees[i].salary);
getchar(); /* eat newline */
} else {
for (int j = 0; j < i; j++) {
printf("%s %s, %s (%d)\n", employees[j].first, employees[j].last, employees[j].title, employees[j].salary);
}
break;
}
}
} | Store employee information in an array of structs | Store employee information in an array of structs
| C | mit | sookoor/Learn-C-the-Hard-Way,sookoor/Learn-C-the-Hard-Way,sookoor/Learn-C-the-Hard-Way |
|
94cdb6e58f3407127089a412824180475bceb4e7 | src/distributed.c | src/distributed.c | #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "distributed.h"
#include "stddefines.h"
void shm_init() {
int fd;
/* Map the shmem region */
fd = open(SHM_DEV, O_RDWR);
CHECK_ERROR(fd < 0);
shm_base = mmap(SHM_LOC, SHM_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 1*getpagesize());
CHECK_ERROR(shm_base == MAP_FAILED);
}
| #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "distributed.h"
#include "stddefines.h"
void shm_init() {
int fd;
/* Map the shmem region */
fd = open(SHM_DEV, O_RDWR);
CHECK_ERROR(fd < 0);
shm_base = mmap(SHM_LOC, SHM_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 1*getpagesize());
CHECK_ERROR(shm_base != SHM_LOC);
}
| Check that the mmap goes in the right place. | Check that the mmap goes in the right place.
| C | bsd-3-clause | adamwg/elastic-phoenix,adamwg/elastic-phoenix,adamwg/elastic-phoenix |
cc5d35670b3192f6f6741f569016c1167549fc9a | ring_distance.c | ring_distance.c | /* Author: Matjaž <[email protected]> matjaz.it
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <stdio.h> /* Allows usage of printf() */
#include <stdbool.h> /* Allows usage of booleans */
#include <stdlib.h> /* Allows usage of abs() */
struct oriented_arc_struct {
int lenght;
bool clockwise;
};
typedef struct oriented_arc_struct oriented_arc;
int circumference = 12;
int start_point;
int end_point;
oriented_arc arc;
char hrule[50] = "\t+-------+-----+----------+------------------+\n";
char header[50] = "\t| Start | End | Distance | Direction |\n";
char ring[100] = "\
\t\t 12\n\
\t\t 11 1\n\
\t\t 10 \\ 2\n\
\t\t 9 o--- 3\n\
\t\t 8 4\n\
\t\t 7 5\n\
\t\t 6\n";
oriented_arc min_ring_distance(int circumference, int start_point, int end_point) {
int distance_1 = end_point - start_point;
oriented_arc arc_1 = {abs(distance_1), (distance_1 >= 0) ? true : false};
oriented_arc arc_2 = {circumference - arc_1.lenght, !arc_1.clockwise};
if (arc_1.lenght <= arc_2.lenght) {
return arc_1;
} else {
return arc_2;
}
}
int main() {
printf("%s", ring);
printf("%s", hrule);
printf("%s", header);
printf("%s", hrule);
for (start_point = 1; start_point <= circumference; start_point++) {
for (end_point = 1; end_point <= circumference; end_point++) {
arc = min_ring_distance(circumference,
start_point, end_point);
printf("\t| %4i |%4i | %4i | %s |\n",
start_point, end_point,
arc.lenght, arc.clockwise ? " Clockwise " : "Counterclockwise");
}
printf("%s", hrule);
}
}
| Add ring oriented distance calculator | Add ring oriented distance calculator
| C | unknown | MatjazDev/Utilz,TheMatjaz/Utilz,MatjazDev/Utilz,TheMatjaz/Utilz |
|
3e34f2f419583aa78b515b3027fb204b89202c92 | include/8cc.h | include/8cc.h | #define _LP64 1
#define __8cc__ 1
#define __ELF__ 1
#define __LP64__ 1
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
#define __SIZEOF_LONG__ 8
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_SIZE_T__ 8
#define __STDC_HOSTED__ 1
#define __STDC_NO_ATOMICS__ 1
#define __STDC_NO_COMPLEX__ 1
#define __STDC_NO_THREADS__ 1
#define __STDC_NO_VLA__ 1
#define __STDC_VERSION__ 201112L
#define __STDC__ 1
#define __amd64 1
#define __amd64__ 1
#define __gnu_linux__ 1
#define __linux 1
#define __linux__ 1
#define __unix 1
#define __unix__ 1
#define __x86_64 1
#define __x86_64__ 1
#define linux 1
| #define _LP64 1
#define __8cc__ 1
#define __ELF__ 1
#define __LP64__ 1
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
#define __SIZEOF_LONG__ 8
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_SIZE_T__ 8
#define __STDC_HOSTED__ 1
#define __STDC_NO_ATOMICS__ 1
#define __STDC_NO_COMPLEX__ 1
#define __STDC_NO_THREADS__ 1
#define __STDC_NO_VLA__ 1
#define __STDC_VERSION__ 201112L
#define __STDC__ 1
#define __amd64 1
#define __amd64__ 1
#define __gnu_linux__ 1
#define __linux 1
#define __linux__ 1
#define __unix 1
#define __unix__ 1
#define __x86_64 1
#define __x86_64__ 1
#define linux 1
#define __restrict restrict
#define __restrict__ restrict
| Define __restrict__ and __restrict as synonyms for restrict. | Define __restrict__ and __restrict as synonyms for restrict.
C99/C11 defines only restrict, but popular compilers including GCC
define these synonyms (so that you can use __restrict in C++, in
which restrict keyword is not a part of the language standard).
| C | mit | andrewchambers/8cc,andrewchambers/8cc,vastin/8cc,nobody1986/8cc,jtramm/8cc,8l/8cc,cpjreynolds/8cc,rui314/8cc,vastin/8cc,cpjreynolds/8cc,rui314/8cc,gergo-/8cc,rui314/8cc,rui314/8cc,nobody1986/8cc,jtramm/8cc,8l/8cc,andrewchambers/8cc,vastin/8cc,abc00/8cc,8l/8cc,gergo-/8cc,gergo-/8cc,jtramm/8cc,abc00/8cc,abc00/8cc,jtramm/8cc,andrewchambers/8cc,8l/8cc,abc00/8cc,cpjreynolds/8cc,vastin/8cc,nobody1986/8cc,nobody1986/8cc,cpjreynolds/8cc |
0ed96ecba988c837a0e9d51085809ca6a9cf0a3b | src/lily_pkg_core.c | src/lily_pkg_core.c | /**
library core
Psuedo root of all pre-registered modules.
This is a fake module created to link together all of the modules that are
automatically loaded in the interpreter.
Except for the `builtin` module, all modules listed here can be imported from
any file inside of the interpreter. This is unlike other modules, which are
loaded using relative paths. These modules can be imported like `import sys`,
then used like `print(sys.argv)`.
The `builtin` module is unique because the classes, enums, and functions are the
foundation of the interpreter. Instead of requiring it to be imported, the
contents of `builtin` are instead available without a namespace.
*/
/**
PackageFiles
lily_pkg_builtin.c
lily_pkg_random.c
lily_pkg_sys.c
lily_pkg_time.c
*/
| Add 'core' pseudo package for docgen to target. | Add 'core' pseudo package for docgen to target.
| C | mit | jesserayadkins/lily,jesserayadkins/lily,jesserayadkins/lily,FascinatedBox/lily,FascinatedBox/lily,FascinatedBox/lily,FascinatedBox/lily |
|
bc62ff6ea6705bc68e2993fd2ee06c1f4ecf2c93 | Plugins/Drift/Source/RapidJson/Public/JsonUtils.h | Plugins/Drift/Source/RapidJson/Public/JsonUtils.h | // Copyright 2015-2017 Directive Games Limited - All Rights Reserved
#pragma once
#include "JsonArchive.h"
#include "IHttpRequest.h"
#include "Core.h"
#include "Interfaces/IHttpRequest.h"
RAPIDJSON_API DECLARE_LOG_CATEGORY_EXTERN(JsonUtilsLog, Log, All);
class RAPIDJSON_API JsonUtils
{
public:
template<class T>
static bool ParseResponse(FHttpResponsePtr response, T& parsed)
{
const auto respStr = response->GetContentAsString();
bool success = JsonArchive::LoadObject(*respStr, parsed);
if (!success)
{
UE_LOG(JsonUtilsLog, Error, TEXT("Failed to parse json response '%s'"), *respStr);
}
return success;
}
};
| // Copyright 2015-2017 Directive Games Limited - All Rights Reserved
#pragma once
#include "JsonArchive.h"
#include "IHttpRequest.h"
#include "Core.h"
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
RAPIDJSON_API DECLARE_LOG_CATEGORY_EXTERN(JsonUtilsLog, Log, All);
class RAPIDJSON_API JsonUtils
{
public:
template<class T>
static bool ParseResponse(FHttpResponsePtr response, T& parsed)
{
const auto respStr = response->GetContentAsString();
bool success = JsonArchive::LoadObject(*respStr, parsed);
if (!success)
{
UE_LOG(JsonUtilsLog, Error, TEXT("Failed to parse json response '%s'"), *respStr);
}
return success;
}
};
| Fix another Linux build error | Fix another Linux build error
- Was missing #include statements
| C | mit | dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin |
bcccfa6cd2b6e4335b479bdfc137567fd5585f37 | OctoKit/OCTClient+Activity.h | OctoKit/OCTClient+Activity.h | //
// OCTClient+Activity.h
// OctoKit
//
// Created by Piet Brauer on 14.02.14.
// Copyright (c) 2014 GitHub. All rights reserved.
//
#import "OCTClient.h"
@class RACSignal;
@class OCTRepository;
@interface OCTClient (Activity)
// Check if the user starred the `repository`.
//
// repository - The repository used to check the starred status. Cannot be nil.
//
// Returns a signal, which will send completed on success. If the client
// is not `authenticated`, the signal will error immediately.
- (RACSignal *)hasUserStarredRepository:(OCTRepository *)repository;
// Star the given `repository`
//
// repository - The repository to star. Cannot be nil.
//
// Returns a signal, which will send completed on success. If the client
// is not `authenticated`, the signal will error immediately.
- (RACSignal *)starRepository:(OCTRepository *)repository;
// Unstar the given `repository`
//
// repository - The repository to unstar. Cannot be nil.
//
// Returns a signal, which will send completed on success. If the client
// is not `authenticated`, the signal will error immediately.
- (RACSignal *)unstarRepository:(OCTRepository *)repository;
@end
| //
// OCTClient+Activity.h
// OctoKit
//
// Created by Piet Brauer on 14.02.14.
// Copyright (c) 2014 GitHub. All rights reserved.
//
#import "OCTClient.h"
@class RACSignal;
@class OCTRepository;
@interface OCTClient (Activity)
// Check if the user starred the `repository`.
//
// repository - The repository used to check the starred status. Cannot be nil.
//
// Returns a signal, which will send a NSNumber valued @YES or @NO.
// If the client is not `authenticated`, the signal will error immediately.
- (RACSignal *)hasUserStarredRepository:(OCTRepository *)repository;
// Star the given `repository`
//
// repository - The repository to star. Cannot be nil.
//
// Returns a signal, which will send completed on success. If the client
// is not `authenticated`, the signal will error immediately.
- (RACSignal *)starRepository:(OCTRepository *)repository;
// Unstar the given `repository`
//
// repository - The repository to unstar. Cannot be nil.
//
// Returns a signal, which will send completed on success. If the client
// is not `authenticated`, the signal will error immediately.
- (RACSignal *)unstarRepository:(OCTRepository *)repository;
@end
| Change documentation to fit return of NSNumber | Change documentation to fit return of NSNumber | C | mit | CHNLiPeng/octokit.objc,jonesgithub/octokit.objc,cnbin/octokit.objc,leichunfeng/octokit.objc,jonesgithub/octokit.objc,cnbin/octokit.objc,CleanShavenApps/octokit.objc,Acidburn0zzz/octokit.objc,wrcj12138aaa/octokit.objc,Palleas/octokit.objc,daemonchen/octokit.objc,CHNLiPeng/octokit.objc,GroundControl-Solutions/octokit.objc,phatblat/octokit.objc,Palleas/octokit.objc,daukantas/octokit.objc,xantage/octokit.objc,wrcj12138aaa/octokit.objc,yeahdongcn/octokit.objc,leichunfeng/octokit.objc,daukantas/octokit.objc,phatblat/octokit.objc,daemonchen/octokit.objc,xantage/octokit.objc,GroundControl-Solutions/octokit.objc,Acidburn0zzz/octokit.objc |
b43db0113a50f2999a6e93eaf8dbc1e6b89a60ff | Pod/Classes/BCBalancedMultilineLabel.h | Pod/Classes/BCBalancedMultilineLabel.h | #import <UIKit/UIKit.h>
@interface BCBalancedMultilineLabel : UILabel
@end
| #import <UIKit/UIKit.h>
/**
* A simple label subclass that draws itself such that each of its
* lines have as close to the same length as possible. It can be
* used anywhere that you could use an ordinary `UILabel` by simply
* changing the instantiated class.
*/
@interface BCBalancedMultilineLabel : UILabel
@end
| Add Appledoc to the header | Add Appledoc to the header | C | mit | briancroom/BCBalancedMultilineLabel |
4d4804f71ce6dbfe3ad2e9a5110d516732c0ba90 | src/glcontext_nsgl.h | src/glcontext_nsgl.h | /*
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#if BX_PLATFORM_OSX
namespace bgfx { namespace gl
{
struct SwapChainGL;
struct GlContext
{
GlContext()
: m_context(0)
{
}
void create(uint32_t _width, uint32_t _height);
void destroy();
void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
uint64_t getCaps() const;
SwapChainGL* createSwapChain(void* _nwh);
void destroySwapChain(SwapChainGL* _swapChain);
void swap(SwapChainGL* _swapChain = NULL);
void makeCurrent(SwapChainGL* _swapChain = NULL);
void import();
bool isValid() const
{
return 0 != m_context;
}
void* m_view;
void* m_context;
};
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX
#endif // BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
| /*
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#if BX_PLATFORM_OSX
namespace bgfx { namespace gl
{
struct SwapChainGL;
struct GlContext
{
GlContext()
: m_context(0)
, m_view(0)
{
}
void create(uint32_t _width, uint32_t _height);
void destroy();
void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
uint64_t getCaps() const;
SwapChainGL* createSwapChain(void* _nwh);
void destroySwapChain(SwapChainGL* _swapChain);
void swap(SwapChainGL* _swapChain = NULL);
void makeCurrent(SwapChainGL* _swapChain = NULL);
void import();
bool isValid() const
{
return 0 != m_context;
}
void* m_view;
void* m_context;
};
} /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX
#endif // BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
| Set m_view to 0 in GlContext ctor | Set m_view to 0 in GlContext ctor
| C | bsd-2-clause | jpcy/bgfx,andr3wmac/bgfx,mendsley/bgfx,mmicko/bgfx,jdryg/bgfx,LWJGL-CI/bgfx,jdryg/bgfx,attilaz/bgfx,emoon/bgfx,Synxis/bgfx,elmindreda/bgfx,LWJGL-CI/bgfx,andr3wmac/bgfx,Synxis/bgfx,aonorin/bgfx,kondrak/bgfx,emoon/bgfx,septag/bgfx,bkaradzic/bgfx,v3n/bgfx,jpcy/bgfx,fluffyfreak/bgfx,andr3wmac/bgfx,LWJGL-CI/bgfx,MikePopoloski/bgfx,mmicko/bgfx,v3n/bgfx,fluffyfreak/bgfx,jdryg/bgfx,jdryg/bgfx,Synxis/bgfx,kondrak/bgfx,elmindreda/bgfx,fluffyfreak/bgfx,bkaradzic/bgfx,attilaz/bgfx,0-wiz-0/bgfx,v3n/bgfx,fluffyfreak/bgfx,jpcy/bgfx,LWJGL-CI/bgfx,elmindreda/bgfx,MikePopoloski/bgfx,MikePopoloski/bgfx,0-wiz-0/bgfx,kondrak/bgfx,attilaz/bgfx,bkaradzic/bgfx,mmicko/bgfx,emoon/bgfx,mendsley/bgfx,septag/bgfx,mendsley/bgfx,aonorin/bgfx,septag/bgfx,bkaradzic/bgfx,aonorin/bgfx,jpcy/bgfx,0-wiz-0/bgfx |
d85029a098a5ce56fd948e5f1811fe8f9ad8abcb | test/ut_logassert.c | test/ut_logassert.c | #define UTL_MAIN
#include "utl.h"
int main(int argc, char *argv[])
{
logopen("t_logassert.log","w");
logassert(5>10);
logassert(utl_ret(0));
logcheck(3/utl_ret(0) == 0);
logclose();
}
| Check that logassert() fails properly | Check that logassert() fails properly
| C | mit | rdentato/clibutl,rdentato/clibutl,rdentato/clibutl |
|
b3ccbaf655e28b48384a8955398d248384558b45 | lottie-ios/Classes/PublicHeaders/Lottie.h | lottie-ios/Classes/PublicHeaders/Lottie.h | //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
@import Foundation;
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];
#import "LOTAnimationTransitionController.h"
#import "LOTAnimationView.h"
#endif /* Lottie_h */
| //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];
#import "LOTAnimationTransitionController.h"
#import "LOTAnimationView.h"
#endif /* Lottie_h */
| Fix @import compatibility with .mm files | Fix @import compatibility with .mm files
| C | apache-2.0 | airbnb/lottie-ios,airbnb/lottie-ios,airbnb/lottie-ios |
e08359cf14f005a532f37470aed8be8aea03ac43 | tests/test-progs/test/arm/randmem1.c | tests/test-progs/test/arm/randmem1.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
void nop( int delay ){
int tmp,i;
for( i=0; i<delay; i++ )
tmp = i + tmp;
}
int main(int argc, char **argv) {
int SEED = 2;
int MEM_SIZE = 1024 * 1024; // *32 bits (number of ints)
int DURATION = 6 * 1000 * 1000; //us
int DELAY_OPS = 1000; //us between mem requests
int count = 0;
int opt;
while( ( opt = getopt( argc, argv, "s:d:p:" ) ) != -1 ){
switch( opt ){
case 's':
MEM_SIZE = 1024 * 1024 * atoi(optarg); // *32 MB
break;
case 'd':
DURATION = atoi(optarg); // seconds
break;
case 'p':
DELAY_OPS = atoi(optarg); // us
break;
default:
break;
}
}
int * mem = ( int* ) malloc( sizeof( int ) * MEM_SIZE );
int elapsed = 0;
int tmp;
srand( SEED );
while( elapsed < DURATION ){
int read_addr = count % MEM_SIZE;
tmp = mem[read_addr];
elapsed += DELAY_OPS;
count += 16;
//nop(DELAY_OPS);
}
}
| Add a benchmark for higher memory intensity | Add a benchmark for higher memory intensity
| C | bsd-3-clause | aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/DynamicCache,aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/GEM5_DRAMSim2,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/DiamondCache,aferr/TimingCompartments,xiaoyaozi5566/DiamondCache,aferr/LatticeMemCtl,aferr/TemporalPartitioningMemCtl,aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/DiamondCache,aferr/LatticeMemCtl,xiaoyaozi5566/GEM5_DRAMSim2,aferr/LatticeMemCtl,aferr/LatticeMemCtl,xiaoyaozi5566/DynamicCache,aferr/TimingCompartments,aferr/TimingCompartments,aferr/LatticeMemCtl,xiaoyaozi5566/DiamondCache,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/DiamondCache,aferr/LatticeMemCtl,xiaoyaozi5566/GEM5_DRAMSim2,aferr/TimingCompartments,aferr/TimingCompartments,xiaoyaozi5566/GEM5_DRAMSim2,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/DiamondCache,xiaoyaozi5566/GEM5_DRAMSim2,aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/GEM5_DRAMSim2,xiaoyaozi5566/DiamondCache,aferr/LatticeMemCtl,aferr/LatticeMemCtl,aferr/TimingCompartments,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/GEM5_DRAMSim2,xiaoyaozi5566/DiamondCache,aferr/LatticeMemCtl,xiaoyaozi5566/DiamondCache,xiaoyaozi5566/DynamicCache,aferr/TemporalPartitioningMemCtl,aferr/TimingCompartments,aferr/TimingCompartments,aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/GEM5_DRAMSim2,aferr/TemporalPartitioningMemCtl,aferr/TemporalPartitioningMemCtl,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/DynamicCache,xiaoyaozi5566/GEM5_DRAMSim2,xiaoyaozi5566/DynamicCache,aferr/TimingCompartments |
|
621ada7f40cd797549e88c474311ff9ebc288c5e | examples/example1.c | examples/example1.c | #include "../failing_allocs.h"
#include <assert.h>
#include <stdlib.h>
USE_FAILING_ALLOCS
typedef struct{
int* some_ints;
size_t count;
} Container;
Container* Container_create(size_t count)
{
Container* new_container = calloc(1, sizeof(Container));
if(!new_container) goto error;
new_container->some_ints = malloc(5 * sizeof(int));
if(!new_container->some_ints) goto error;
int* new_ints = realloc(new_container->some_ints,
count * sizeof(int));
if(!new_ints) goto error;
new_container->some_ints = new_ints;
new_container->count = count;
return new_container;
error:
if(new_container) {
if(new_container->some_ints) free(new_container->some_ints);
free(new_container);
}
return NULL;
}
void Container_delete(Container* container)
{
if(container) {
if(container->some_ints) free(container->some_ints);
free(container);
}
}
int main(void)
{
int i = 0;
for(i = 0; i < 10; i++) {
Container* container = Container_create(100);
if(!container) continue;
assert(container->count == 100);
Container_delete(container);
}
FREE_FAILING_ALLOCS
return 0;
}
| Add an example of code that uses failing_allocs. | Add an example of code that uses failing_allocs.
| C | mit | mckinsel/failing_allocs,mckinsel/failing_allocs |
|
9bfa112e81a0dc6dfec4697c3f5e4014a60073bf | applications/plugins/SofaPython/PythonCommon.h | applications/plugins/SofaPython/PythonCommon.h | #ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H
// This header simply includes Python.h, taking care of platform-specific stuff
// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must include Python.h before any
// standard headers are included."
#if defined(_MSC_VER) && defined(_DEBUG)
// undefine _DEBUG since we want to always link agains the release version of
// python and pyconfig.h automatically links debug version if _DEBUG is defined.
// ocarre: no we don't, in debug on Windows we cannot link with python release, if we want to build SofaPython in debug we have to compile python in debug
//# undef _DEBUG
# include <Python.h>
//# define _DEBUG
#elif defined(__APPLE__) && defined(__MACH__)
# include <Python/Python.h>
#else
# include <Python.h>
#endif
#endif
| #ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H
// This header simply includes Python.h, taking care of platform-specific stuff
// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must include Python.h before any
// standard headers are included."
#if defined(_WIN32)
# define MS_NO_COREDLL // deactivate pragma linking on Win32 done in Python.h
#endif
#if defined(_MSC_VER) && defined(_DEBUG)
// undefine _DEBUG since we want to always link agains the release version of
// python and pyconfig.h automatically links debug version if _DEBUG is defined.
// ocarre: no we don't, in debug on Windows we cannot link with python release, if we want to build SofaPython in debug we have to compile python in debug
//# undef _DEBUG
# include <Python.h>
//# define _DEBUG
#elif defined(__APPLE__) && defined(__MACH__)
# include <Python/Python.h>
#else
# include <Python.h>
#endif
#endif
| Disable auto linking on windows so that CMake settings are not overriden. | Disable auto linking on windows so that CMake settings are not overriden.
Former-commit-id: 3e43e87772ab712bab8778502c22411288f0eb31 | C | lgpl-2.1 | hdeling/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa,hdeling/sofa,FabienPean/sofa,hdeling/sofa,hdeling/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa,Anatoscope/sofa,hdeling/sofa,hdeling/sofa,hdeling/sofa,Anatoscope/sofa,hdeling/sofa,Anatoscope/sofa,hdeling/sofa,hdeling/sofa,FabienPean/sofa,Anatoscope/sofa,FabienPean/sofa |
4aaa5c8f5777910ace7d4c65908d42f16f446c30 | ProvisionQL/Shared.h | ProvisionQL/Shared.h | #include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <QuickLook/QuickLook.h>
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <Security/Security.h>
#import <NSBezierPath+IOS7RoundedRect.h>
static NSString * const kPluginBundleId = @"com.FerretSyndicate.ProvisionQL";
static NSString * const kDataType_ipa = @"com.apple.itunes.ipa";
static NSString * const kDataType_app = @"com.apple.application-bundle";
static NSString * const kDataType_ios_provision = @"com.apple.mobileprovision";
static NSString * const kDataType_ios_provision_old = @"com.apple.iphone.mobileprovision";
static NSString * const kDataType_osx_provision = @"com.apple.provisionprofile";
#define SIGNED_CODE 0
NSImage *roundCorners(NSImage *image);
NSImage *imageFromApp(NSURL *URL, NSString *dataType, NSString *fileName);
NSString *mainIconNameForApp(NSDictionary *appPropertyList);
int expirationStatus(NSDate *date, NSCalendar *calendar);
| #include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <QuickLook/QuickLook.h>
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <Security/Security.h>
#import <NSBezierPath+IOS7RoundedRect.h>
static NSString * const kPluginBundleId = @"com.ealeksandrov.ProvisionQL";
static NSString * const kDataType_ipa = @"com.apple.itunes.ipa";
static NSString * const kDataType_app = @"com.apple.application-bundle";
static NSString * const kDataType_ios_provision = @"com.apple.mobileprovision";
static NSString * const kDataType_ios_provision_old = @"com.apple.iphone.mobileprovision";
static NSString * const kDataType_osx_provision = @"com.apple.provisionprofile";
#define SIGNED_CODE 0
NSImage *roundCorners(NSImage *image);
NSImage *imageFromApp(NSURL *URL, NSString *dataType, NSString *fileName);
NSString *mainIconNameForApp(NSDictionary *appPropertyList);
int expirationStatus(NSDate *date, NSCalendar *calendar);
| Set bundle identifier constant to be identical to Info.plist | Set bundle identifier constant to be identical to Info.plist
| C | mit | ealeksandrov/ProvisionQL,ealeksandrov/ProvisionQL,ealeksandrov/ProvisionQL |
a5eb8bfdc1affa6d2330484800808c4d34f23103 | ui/expandablegroup.h | ui/expandablegroup.h | #pragma once
#include "uitypes.h"
#include <QtWidgets/QToolButton>
#include <QtCore/QParallelAnimationGroup>
#include <QtWidgets/QScrollArea>
#include <QtCore/QPropertyAnimation>
class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
Q_OBJECT
private:
QToolButton* m_button;
QParallelAnimationGroup* m_animation;
QScrollArea* m_content;
int m_duration = 100;
private Q_SLOTS:
void toggled(bool expanded);
public:
explicit ExpandableGroup(
QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false);
void setupAnimation(QLayout* contentLayout);
void setTitle(const QString& title) { m_button->setText(title); }
void toggle(bool expanded);
};
| #pragma once
#include "uitypes.h"
#include <QtWidgets/QLabel>
#include <QtWidgets/QToolButton>
#include <QtCore/QParallelAnimationGroup>
#include <QtWidgets/QScrollArea>
#include <QtCore/QPropertyAnimation>
class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
Q_OBJECT
private:
QToolButton* m_button;
QLabel* m_title;
QParallelAnimationGroup* m_animation;
QScrollArea* m_content;
int m_duration = 100;
private Q_SLOTS:
void toggled(bool expanded);
public:
explicit ExpandableGroup(QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false);
void setupAnimation(QLayout* contentLayout);
void setTitle(const QString& title) { m_title->setText(title); }
void toggle(bool expanded);
};
| Fix UI arrow artifact in Cross References and Search widgets. | Fix UI arrow artifact in Cross References and Search widgets.
| C | mit | Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api |
d12700eb6db3cef72602f80f7f6225d43c58f6b5 | include/sdl_image.h | include/sdl_image.h | /*
The MIT License (MIT)
Copyright (c) 2016 tagener-noisu
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, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef SDL_IMAGE_WRAPPER_H
#define SDL_IMAGE_WRAPPER_H 1
//-------------------------------------------------------------------
#include <SDL_image.h>
#include "wrapper/exceptions.h"
//-------------------------------------------------------------------
namespace SDL {
namespace IMG {
static_assert(SDL_IMAGE_MAJOR_VERSION == 2,
"Only version 2.x of SDL_image is supported");
template<class ErrorHandler =Throw>
class SdlImage {
ErrorHandler handle_error;
public:
SdlImage(int flags =0) {
if ((IMG_Init(flags) & flags) != flags)
handle_error(SDL_GetError());
}
~SdlImage() {
IMG_Quit();
}
};
template<>
class SdlImage<NoChecking> {
int st;
public:
SdlImage(int flags =0) :st {IMG_Init(flags)} {}
int state() const { return st; }
~SdlImage() {
IMG_Quit();
}
};
using SafeSdlImage = SdlImage<Throw>;
using UnsafeSdlImage = SdlImage<NoChecking>;
//-------------------------------------------------------------------
inline SDL_Surface* Load(const char* file) {
return IMG_Load(file);
}
} // namespace
} // namespace
//-------------------------------------------------------------------
#endif
| Add wrapper for SDL2_image lib | Add wrapper for SDL2_image lib
| C | mit | tagener-noisu/cxx_sdl |
|
60b33a957f46e635909e45b24d5de0c242994bef | pebble/src/common.c | pebble/src/common.c | /***
* Multi Timer
* Copyright © 2013 Matthew Tole
*
* common.c
***/
#include <pebble.h>
#include "libs/xprintf.h"
void uppercase(char* str) {
char* point = str;
while (*point != '\0') {
if (*point >= 97 && *point <= 122) {
*point -= 32;
}
point += 1;
}
}
int patoi(char* str) {
long num;
xatoi(&str, &num);
return (int)num;
}
void timer_duration_str(int duration, bool showHours, char* str, int str_len) {
int hours = duration / 3600;
int minutes = (duration % 3600) / 60;
int seconds = (duration % 3600) % 60;
if (showHours) {
snprintf(str, str_len, "%02d:%02d:%02d", hours, minutes, seconds);
}
else {
snprintf(str, str_len, "%02d:%02d", minutes, seconds);
}
} | /***
* Multi Timer
* Copyright © 2013 Matthew Tole
*
* common.c
***/
#include <pebble.h>
#include "libs/xprintf.h"
void uppercase(char* str) {
char* point = str;
while (*point != '\0') {
if (*point >= 97 && *point <= 122) {
*point -= 32;
}
point += 1;
}
}
int patoi(char* str) {
long num;
xatoi(&str, &num);
return (int)num;
}
void timer_duration_str(int duration, bool showHours, char* str, int str_len) {
int hours = duration / 3600;
int minutes = (showHours ? (duration % 3600) : duration) / 60;
int seconds = (showHours ? (duration % 3600) : duration) % 60;
if (showHours) {
snprintf(str, str_len, "%02d:%02d:%02d", hours, minutes, seconds);
}
else {
snprintf(str, str_len, "%02d:%02d", minutes, seconds);
}
} | Fix bug in rendering of timer duration. | Fix bug in rendering of timer duration.
| C | mit | ThiagoVinicius/multi-timer,sdoo12/multi-timer,sdoo12/multi-timer,ThiagoVinicius/multi-timer,smallstoneapps/multi-timer,ThiagoVinicius/multi-timer,ThiagoVinicius/multi-timer,smallstoneapps/multi-timer,smallstoneapps/multi-timer,sdoo12/multi-timer,smallstoneapps/multi-timer,smallstoneapps/multi-timer,ThiagoVinicius/multi-timer |
7a6f9bd873ea97f9a5e129e5ef6cc12ea216f9cb | EnumeratorKit/Core/NSArray+EKFlatten.h | EnumeratorKit/Core/NSArray+EKFlatten.h | //
// NSArray+EKFlatten.h
// EnumeratorKit
//
// Created by Adam Sharp on 23/07/13.
// Copyright (c) 2013 Adam Sharp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NSArray+EKEnumerable.h"
/**
* Extends NSArray with a single method `-flatten` to recursively
* build a single-level array with all objects from all child arrays.
*/
@interface NSArray (EKFlatten)
/**
* Recursively builds a new array by adding all objects from all child
* arrays. The order of children is preserved. For example:
*
* [@[@[@1, @2], @3] flatten] // => @[@1, @2, @3]
*
* and
*
* @[@1, @[@2, @[@3, @4]], @5, @[@6]] // => @[@1, @2, @3, @4, @5, @6]
*/
- (NSArray *)flatten;
@end
| //
// NSArray+EKFlatten.h
// EnumeratorKit
//
// Created by Adam Sharp on 23/07/13.
// Copyright (c) 2013 Adam Sharp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NSArray+EKEnumerable.h"
/**
Extends NSArray with a single method `-flatten` to recursively build a
single-level array with all objects from all child arrays.
*/
@interface NSArray (EKFlatten)
/**
Recursively builds a new array by adding all objects from all child
arrays. The order of children is preserved. For example:
[@[@[@1, @2], @3] flatten] // => @[@1, @2, @3]
and
@[@1, @[@2, @[@3, @4]], @5, @[@6]] // => @[@1, @2, @3, @4, @5, @6]
*/
- (NSArray *)flatten;
@end
| Improve [NSArray flatten] doc formatting | Improve [NSArray flatten] doc formatting
| C | mit | sharplet/EnumeratorKit |
bdde085c7d376ce0aff368249164c9ee504eba97 | src/ipc/ipc.h | src/ipc/ipc.h | #ifndef IPC_H
#define IPC_H
#include "../process/process.h"
void current_fds(proc_t *proc);
#endif
| #ifndef IPC_H
#define IPC_H
int current_fds(char *pidstr);
#endif
| Adjust declaration for returning int | Adjust declaration for returning int
| C | mit | tijko/dashboard |
c02fc5091d062d255e43bd69c419d29693b7494e | include/ActionBar.h | include/ActionBar.h | #ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_
#include <InputElement.h>
#include <Command.h>
#include <FWPlatform.h>
class ActionBar : public Element {
public:
ActionBar() { }
bool isA(const std::string & className) override {
if (className == "ActionBar") return true;
return Element::isA(className);
}
protected:
void initialize(FWPlatform * _platform) override {
Element::initialize(_platform);
Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
sendCommand(c);
}
};
#endif
| #ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_
#include <InputElement.h>
#include <Command.h>
#include <FWPlatform.h>
class ActionBar : public Element {
public:
ActionBar() { }
ActionBar(const char * _title) : title(_title) { }
bool isA(const std::string & className) override {
if (className == "ActionBar") return true;
return Element::isA(className);
}
protected:
void initialize(FWPlatform * _platform) override {
Element::initialize(_platform);
Command c(Command::CREATE_ACTIONBAR, getParentInternalId(), getInternalId());
c.setTextValue(title);
sendCommand(c);
}
const char * title;
};
#endif
| Add constructor with title attached | Add constructor with title attached | C | mit | Sometrik/framework,Sometrik/framework,Sometrik/framework |
63234eb83899ecedd935ecebde76e7776b59012e | Analytics/SEGAnalyticsUtils.h | Analytics/SEGAnalyticsUtils.h | // AnalyticsUtils.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#define SEGStringize_helper(x) #x
#define SEGStringize(x) @SEGStringize_helper(x)
NSURL *SEGAnalyticsURLForFilename(NSString *filename);
// Async Utils
dispatch_queue_t seg_dispatch_queue_create_specific(const char *label, dispatch_queue_attr_t attr);
BOOL seg_dispatch_is_on_specific_queue(dispatch_queue_t queue);
void seg_dispatch_specific(dispatch_queue_t queue, dispatch_block_t block, BOOL waitForCompletion);
void seg_dispatch_specific_async(dispatch_queue_t queue, dispatch_block_t block);
void seg_dispatch_specific_sync(dispatch_queue_t queue, dispatch_block_t block);
// Logging
void SEGSetShowDebugLogs(BOOL showDebugLogs);
void SEGLog(NSString *format, ...);
// JSON Utils
NSDictionary *SEGCoerceDictionary(NSDictionary *dict);
NSString *SEGIDFA();
NSString *SEGEventNameForScreenTitle(NSString *title); | // AnalyticsUtils.h
// Copyright (c) 2014 Segment.io. All rights reserved.
#import <Foundation/Foundation.h>
#define SEGStringize_helper(x) #x
#define SEGStringize(x) @SEGStringize_helper(x)
NSURL *SEGAnalyticsURLForFilename(NSString *filename);
// Async Utils
dispatch_queue_t seg_dispatch_queue_create_specific(const char *label, dispatch_queue_attr_t attr);
BOOL seg_dispatch_is_on_specific_queue(dispatch_queue_t queue);
void seg_dispatch_specific(dispatch_queue_t queue, dispatch_block_t block, BOOL waitForCompletion);
void seg_dispatch_specific_async(dispatch_queue_t queue, dispatch_block_t block);
void seg_dispatch_specific_sync(dispatch_queue_t queue, dispatch_block_t block);
// Logging
void SEGSetShowDebugLogs(BOOL showDebugLogs);
void SEGLog(NSString *format, ...);
// JSON Utils
NSDictionary *SEGCoerceDictionary(NSDictionary *dict);
NSString *SEGIDFA();
NSString *SEGEventNameForScreenTitle(NSString *title);
| Fix "No new line at end of file" warning. | Fix "No new line at end of file" warning.
| C | mit | djfink-carglass/analytics-ios,graingert/analytics-ios,dbachrach/analytics-ios,string-team/analytics-ios,vinod1988/analytics-ios,jtomson-mdsol/analytics-ios,jlandon/analytics-ios,vinod1988/analytics-ios,ldiqual/analytics-ios,jonathannorris/analytics-ios,graingert/analytics-ios,ldiqual/analytics-ios,abodo-dev/analytics-ios,abodo-dev/analytics-ios,string-team/analytics-ios,cfraz89/analytics-ios,djfink-carglass/analytics-ios,cfraz89/analytics-ios,hzalaz/analytics-ios,rudywen/analytics-ios,operator/analytics-ios,operator/analytics-ios,segmentio/analytics-ios,jtomson-mdsol/analytics-ios,orta/analytics-ios,vinod1988/analytics-ios,string-team/analytics-ios,jlandon/analytics-ios,hzalaz/analytics-ios,dbachrach/analytics-ios,cfraz89/analytics-ios,orta/analytics-ios,lumoslabs/analytics-ios,hzalaz/analytics-ios,segmentio/analytics-ios,jlandon/analytics-ios,jtomson-mdsol/analytics-ios,orta/analytics-ios,jonathannorris/analytics-ios,operator/analytics-ios,dcaunt/analytics-ios,dcaunt/analytics-ios,lumoslabs/analytics-ios,rudywen/analytics-ios,rudywen/analytics-ios,dbachrach/analytics-ios,djfink-carglass/analytics-ios,dcaunt/analytics-ios,jonathannorris/analytics-ios,graingert/analytics-ios,segmentio/analytics-ios,ldiqual/analytics-ios,segmentio/analytics-ios,lumoslabs/analytics-ios,abodo-dev/analytics-ios |
0124323b5e2c77ce639fe7db80e442b8db5cea96 | GrizSpace/MapAnnotationList.h | GrizSpace/MapAnnotationList.h | //
// MapAnnotationList.h
// GrizSpace
//
// Created by Kevin Scott on 3/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MapAnnotation.h"
@interface MapAnnotationList : NSObject
{
//int currentAnnotationIndex; //the currently selected annotation index
}
//@property (nonatomic, readwrite) bool currentAnnotationIndexSet; //used to determin if the current annotation index is set.
@property (nonatomic, readwrite) NSMutableArray* myAnnotationItems; //gets the list of annotation items
-(MapAnnotation*) GetNextAnnotation; //gets the next annotation item
-(MapAnnotation*) GetCurrentAnnotation; //gets the current annotation item
@end | //
// MapAnnotationList.h
// GrizSpace
//
// Created by Kevin Scott on 3/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MapAnnotation.h"
@interface MapAnnotationList : NSObject
{
//int currentAnnotationIndex; //the currently selected annotation index
}
//@property (nonatomic, readwrite) bool currentAnnotationIndexSet; //used to determin if the current annotation index is set.
@property (nonatomic, readwrite) NSMutableArray* myAnnotationItems; //gets the list of annotation items
-(MapAnnotation*) GetNextAnnotation; //gets the next annotation item
-(MapAnnotation*) GetCurrentAnnotation; //gets the current annotation item
@end | Add space, commit to main | Add space, commit to main
| C | mit | GrizSpace/GrizSpace,GrizSpace/GrizSpace |
4bfb9c8913d63130dd6579a38b6969a8f75a74ee | src/cog.h | src/cog.h |
//main
void cog_init();
void cog_mainloop();
void cog_destroy();
|
//main
void cog_init();
void cog_mainloop();
void cog_destroy();
//anim
typedef struct cog_sprite
{
}cog_sprite;
cog_sprite* cog_add_anim(char* animimg, int milliseconds, ...);
void cog_play_anim(cog_sprite* sprite);
| Test for animation which hasn't been implemented yet. | Test for animation which hasn't been implemented yet.
| C | mit | df3n5/cog,df3n5/cog,df3n5/cog,df3n5/cog |
8fab47ede9d17225812312c380649b06b2ee46e2 | src/main/main.c | src/main/main.c | #include <stdio.h>
#include <stdint.h>
#if PROJECT == 1
# include "project_1.h"
#else
# error Unsupported project number in PROJECT macro. Valid values: 1
#endif
int main(int argc, char **argv)
{
printf("Hello, world!\n");
# if PROJECT == 1
project_1_report();
# endif
return 0;
}
| #include <stdio.h>
#include <stdint.h>
#if PROJECT == 0
# // NOTE(bja, 2017-02): Building main with no project code.
#elif PROJECT == 1
# include "project_1.h"
#else
# error "Unsupported project number in PROJECT macro. Valid values: 0, 1"
#endif
int main(int argc, char **argv)
{
printf("Hello, world!\n");
# if PROJECT == 1
project_1_report();
# endif
return 0;
}
| Allow building executable without any project code. | Allow building executable without any project code.
Change the logic in main to allow building an executable without any project
code.
Testing: pass
macOS:
make clean; make test
make clean; make project=0 test
make clean; make project=1 test
make clean; make project=2 test
make clean; make platform=frdm project=0 all
make clean; make platform=frdm project=1 all
make clean; make platform=frdm project=2 all
| C | mpl-2.0 | bjandre/embedded-software-essentials,bjandre/embedded-software-essentials,bjandre/embedded-software-essentials |
ed16ce94936816566eafad1075d5a7425f7a563e | test/SyscallsMock.h | test/SyscallsMock.h | #ifndef __EVIL_TEST_SYSCALLS_MOCK_H
#define __EVIL_TEST_SYSCALLS_MOCK_H
#include <gmock/gmock.h>
#include <string>
#include <stack>
#include "os/syscalls.h"
namespace evil {
class SyscallsMock
{
private:
static thread_local std::stack<SyscallsMock *> _instance_stack;
public:
SyscallsMock() { _instance_stack.push(this); }
~SyscallsMock() { _instance_stack.pop(); }
static SyscallsMock *instance() { return _instance_stack.top(); }
MOCK_METHOD2(_access, int(const char *path, int mode));
MOCK_METHOD1(_close, int(int fd));
MOCK_METHOD1(_isatty, int(int fd));
MOCK_METHOD2(_kill, int(long pid, int sig));
MOCK_METHOD3(_open, int(const char *path, int flags, int mode));
MOCK_METHOD0(_getpid, long(void));
MOCK_METHOD3(_write, ssize_t(int fd, const void *buf, size_t count));
MOCK_METHOD1(_sbrk, void *(ptrdiff_t increment));
MOCK_METHOD1(_exit, void(int exit_code));
};
} // namespace evil
#endif // __EVIL_TEST_SYSCALLS_MOCK_H
| #ifndef __EVIL_TEST_SYSCALLS_MOCK_H
#define __EVIL_TEST_SYSCALLS_MOCK_H
#include <gmock/gmock.h>
#include <string>
#include <stack>
#include "os/syscalls.h"
namespace evil {
class SyscallsMock
{
private:
static thread_local std::stack<SyscallsMock *> _instance_stack;
public:
SyscallsMock() { _instance_stack.push(this); }
~SyscallsMock() { _instance_stack.pop(); }
static SyscallsMock *instance() { return _instance_stack.top(); }
MOCK_METHOD2(_access, int(const std::string &path, int mode));
MOCK_METHOD1(_close, int(int fd));
MOCK_METHOD1(_isatty, int(int fd));
MOCK_METHOD2(_kill, int(long pid, int sig));
MOCK_METHOD3(_open, int(const std::string &path, int flags, int mode));
MOCK_METHOD0(_getpid, long(void));
MOCK_METHOD3(_write, ssize_t(int fd, const void *buf, size_t count));
MOCK_METHOD1(_sbrk, void *(ptrdiff_t increment));
MOCK_METHOD1(_exit, void(int exit_code));
};
} // namespace evil
#endif // __EVIL_TEST_SYSCALLS_MOCK_H
| Make mocked functions take std::string to allow == compare | Make mocked functions take std::string to allow == compare
| C | mit | dextero/evilibc,dextero/evilibc,dextero/evilibc |
95dd7be8d2c69dc5ff8d91a0d876f51893bdf1d2 | mbc.h | mbc.h | #pragma once
#include <vector>
#include "types.h"
class MemoryBankController
{
public:
MemoryBankController() = delete;
MemoryBankController(const std::vector<u8> &rom, std::vector<u8> &ram) : rom(rom), ram(ram) {}
virtual ~MemoryBankController() {}
virtual u8 get8(uint address) const = 0;
virtual void set8(uint address, u8 value) = 0;
enum class BankingMode
{
ROM,
RAM
};
protected:
const std::vector<u8> &rom;
std::vector<u8> &ram;
uint active_rom_bank = 1;
uint active_ram_bank = 0;
bool ram_enabled = false;
BankingMode banking_mode = BankingMode::ROM;
};
class MBC1 final : public MemoryBankController
{
public:
using MemoryBankController::MemoryBankController;
u8 get8(uint address) const override;
void set8(uint address, u8 value) override;
};
| #pragma once
#include <vector>
#include "types.h"
class MemoryBankController
{
public:
MemoryBankController() = delete;
MemoryBankController(const std::vector<u8> &rom, std::vector<u8> &ram) : rom(rom), ram(ram) {}
virtual ~MemoryBankController() {}
virtual u8 get8(uint address) const = 0;
virtual void set8(uint address, u8 value) = 0;
protected:
const std::vector<u8> &rom;
std::vector<u8> &ram;
uint active_rom_bank = 1;
uint active_ram_bank = 0;
bool ram_enabled = false;
};
class MBC1 final : public MemoryBankController
{
enum class BankingMode
{
ROM,
RAM
};
BankingMode banking_mode = BankingMode::ROM;
public:
using MemoryBankController::MemoryBankController;
u8 get8(uint address) const override;
void set8(uint address, u8 value) override;
};
| Move BankingMode enum from base class to MBC1 | MBC: Move BankingMode enum from base class to MBC1
| C | mit | alastair-robertson/gameboy,alastair-robertson/gameboy,alastair-robertson/gameboy |
3345e7878878529abc29a37aa18207c708c108d5 | webkit/glue/plugins/ppb_private.h | webkit/glue/plugins/ppb_private.h | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#include "ppapi/c/pp_var.h"
#define PPB_PRIVATE_INTERFACE "PPB_Private;1"
typedef enum _ppb_ResourceString {
PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;
typedef struct _ppb_Private {
// Returns a localized string.
PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;
#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
| // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
#include "third_party/ppapi/c/pp_var.h"
#define PPB_PRIVATE_INTERFACE "PPB_Private;1"
typedef enum _ppb_ResourceString {
PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0,
} PP_ResourceString;
typedef struct _ppb_Private {
// Returns a localized string.
PP_Var (*GetLocalizedString)(PP_ResourceString string_id);
} PPB_Private;
#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
| Add third_party/ prefix to ppapi include for checkdeps. | Add third_party/ prefix to ppapi include for checkdeps.
The only users of this ppb should be inside chrome so this should work fine.
[email protected]
Review URL: http://codereview.chromium.org/3019006
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@52766 0039d316-1c4b-4281-b951-d872f2087c98
| C | bsd-3-clause | ropik/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,ropik/chromium,ropik/chromium,ropik/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,adobe/chromium,ropik/chromium,ropik/chromium,adobe/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,gavinp/chromium |
e13fe9f79af4185ac245b36e9c426c7a6c3fedb2 | src/jaguar_helper.h | src/jaguar_helper.h | #ifndef JAGUAR_HELPER_H_
#define JAGUAR_HELPER_H_
#include <boost/detail/endian.hpp>
#include <stdint.h>
#include "jaguar_api.h"
#ifdef BOOST_LITTLE_ENDIAN
#define htole16(x) x
#define htole32(x) x
#define le16toh(x) x
#define le32toh(x) x
#elif BOOST_BIG_ENDIAN
#error big endian architectures are unsupported
#else
#error unknown endiannes
#endif
namespace jaguar {
int16_t double_to_s8p8(double x);
uint16_t double_to_u8p8(double x);
int32_t double_to_s16p16(double x);
double s8p8_to_double(int16_t x);
double s16p16_to_double(int32_t x);
uint32_t pack_id(uint8_t num, Manufacturer::Enum man, DeviceType::Enum type,
APIClass::Enum api_class, uint8_t api_index);
};
#endif | #ifndef JAGUAR_HELPER_H_
#define JAGUAR_HELPER_H_
#include <boost/detail/endian.hpp>
#include <stdint.h>
#include "jaguar_api.h"
#ifndef __GLIBC__
# ifdef BOOST_LITTLE_ENDIAN
# define htole16(x) x
# define htole32(x) x
# define le16toh(x) x
# define le32toh(x) x
# elif BOOST_BIG_ENDIAN
# error big endian architectures are unsupported
# else
# error unknown endiannes
# endif
#endif
namespace jaguar {
int16_t double_to_s8p8(double x);
uint16_t double_to_u8p8(double x);
int32_t double_to_s16p16(double x);
double s8p8_to_double(int16_t x);
double s16p16_to_double(int32_t x);
uint32_t pack_id(uint8_t num, Manufacturer::Enum man, DeviceType::Enum type,
APIClass::Enum api_class, uint8_t api_index);
};
#endif
| Use provided byteorder convertions on GLIBC systems | Use provided byteorder convertions on GLIBC systems
| C | bsd-2-clause | mkoval/jaguar,mkoval/jaguar |
3c7b80131b4df24bbd71959a5af80961caa449cf | test/support/tracked_value.h | test/support/tracked_value.h | #ifndef SUPPORT_TRACKED_VALUE_H
#define SUPPORT_TRACKED_VALUE_H
#include <cassert>
struct TrackedValue {
enum State { CONSTRUCTED, MOVED_FROM, DESTROYED };
State state;
TrackedValue() : state(State::CONSTRUCTED) {}
TrackedValue(TrackedValue const& t) : state(State::CONSTRUCTED) {
assert(t.state != State::MOVED_FROM && "copying a moved-from object");
assert(t.state != State::DESTROYED && "copying a destroyed object");
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
TrackedValue(TrackedValue&& t) : state(State::CONSTRUCTED) {
assert(t.state != State::MOVED_FROM && "double moving from an object");
assert(t.state != State::DESTROYED && "moving from a destroyed object");
t.state = State::MOVED_FROM;
}
#endif
TrackedValue& operator=(TrackedValue const& t) {
assert(state != State::DESTROYED && "copy assigning into destroyed object");
assert(t.state != State::MOVED_FROM && "copying a moved-from object");
assert(t.state != State::DESTROYED && "copying a destroyed object");
state = t.state;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
TrackedValue& operator=(TrackedValue&& t) {
assert(state != State::DESTROYED && "move assigning into destroyed object");
assert(t.state != State::MOVED_FROM && "double moving from an object");
assert(t.state != State::DESTROYED && "moving from a destroyed object");
state = t.state;
t.state = State::MOVED_FROM;
return *this;
}
#endif
~TrackedValue() {
assert(state != State::DESTROYED && "double-destroying an object");
state = State::DESTROYED;
}
};
#endif // SUPPORT_TRACKED_VALUE_H
| Add TrackedValue to test/support. Thanks to Louis Dionne | Add TrackedValue to test/support. Thanks to Louis Dionne
git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@231674 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx |
|
048a65bb19412639c3abdaded8ad6d3d10e4033e | ext/narray_ffi_c/narray_ffi.c | ext/narray_ffi_c/narray_ffi.c | #include "ruby.h"
#include "narray.h"
VALUE na_address(VALUE self) {
struct NARRAY *ary;
void * ptr;
VALUE ret;
GetNArray(self,ary);
ptr = ary->ptr;
ret = ULL2NUM( (unsigned long long int) ptr);
return ret;
}
void Init_narray_ffi_c() {
ID id;
VALUE klass;
id = rb_intern("NArray");
klass = rb_const_get(rb_cObject, id);
rb_define_private_method(klass, "address", na_address, 0);
}
| #include "ruby.h"
#include "narray.h"
VALUE na_address(VALUE self) {
struct NARRAY *ary;
void * ptr;
VALUE ret;
GetNArray(self,ary);
ptr = ary->ptr;
ret = ULL2NUM( sizeof(ptr) == 4 ? (unsigned long long int) (unsigned long int) ptr : (unsigned long long int) ptr );
return ret;
}
void Init_narray_ffi_c() {
ID id;
VALUE klass;
id = rb_intern("NArray");
klass = rb_const_get(rb_cObject, id);
rb_define_private_method(klass, "address", na_address, 0);
}
| Fix nasty sign propagation bug on gcc and 32 bit architectures. | Fix nasty sign propagation bug on gcc and 32 bit architectures.
| C | bsd-2-clause | Nanosim-LIG/narray-ffi,Nanosim-LIG/narray-ffi |
c1464c4787ee7dcb3fc4c0fc0622cb7f336a4fe6 | config.h | config.h | /* Uncomment to compile with tcpd/libwrap support. */
//#define WITH_WRAP
/* Compile with database upgrading support? If disabled, mosquitto won't
* automatically upgrade old database versions. */
//#define WITH_DB_UPGRADE
/* Compile with memory tracking support? If disabled, mosquitto won't track
* heap memory usage nor export '$SYS/broker/heap/current size', but will use
* slightly less memory and CPU time. */
#define WITH_MEMORY_TRACKING
| /* Uncomment to compile with tcpd/libwrap support. */
//#define WITH_WRAP
/* Compile with database upgrading support? If disabled, mosquitto won't
* automatically upgrade old database versions. */
//#define WITH_DB_UPGRADE
/* Compile with memory tracking support? If disabled, mosquitto won't track
* heap memory usage nor export '$SYS/broker/heap/current size', but will use
* slightly less memory and CPU time. */
#define WITH_MEMORY_TRACKING
/* Compile with the ability to upgrade from old style sqlite persistent
* databases to the new mosquitto format. This means a dependency on sqlite. It
* isn't needed for new installations. */
#define WITH_SQLITE_UPGRADE
| Add compile option for sqlite db upgrades. | Add compile option for sqlite db upgrades.
| C | bsd-3-clause | tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto |
3295ea8d703c9a3f19178a38798eef5d8ee26e7c | include/core/SkMilestone.h | include/core/SkMilestone.h | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 91
#endif
| /*
* 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 92
#endif
| Update Skia milestone to 92 | Update Skia milestone to 92
Change-Id: Ic8528149f531dfa78cfb994d9e6f080a4cc3139c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393917
Reviewed-by: Heather Miller <[email protected]>
Commit-Queue: Heather Miller <[email protected]>
Auto-Submit: Heather Miller <[email protected]>
| C | bsd-3-clause | aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,google/skia,google/skia,google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia |
d2aa84fc27c36e3cf079d99ddb25d7c602579dc3 | config/config_exporter.h | config/config_exporter.h | #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass *, const ConfigObject *) = 0;
virtual void value(const ConfigValue *, const std::string&) = 0;
};
#endif /* !CONFIG_EXPORTER_H */
| #ifndef CONFIG_EXPORTER_H
#define CONFIG_EXPORTER_H
class ConfigClass;
class ConfigObject;
class ConfigValue;
class ConfigExporter {
protected:
ConfigExporter(void)
{ }
virtual ~ConfigExporter()
{ }
public:
virtual void field(const ConfigValue *, const std::string&) = 0;
virtual void object(const ConfigClass *, const ConfigObject *) = 0;
virtual void value(const ConfigValue *, const std::string&) = 0;
};
#endif /* !CONFIG_EXPORTER_H */
| Fix per Noris Datum's E-Mail. | Fix per Noris Datum's E-Mail.
| C | bsd-2-clause | wanproxy/wanproxy,wanproxy/wanproxy,wanproxy/wanproxy |
fc7e89841372166b9f41f605e2102109d12a8bf7 | config.h | config.h | #define SOCK_PATH "/var/run/devd.pipe"
#define REGEX "subsystem=CDEV type=(CREATE|DESTROY) cdev=(da[0-9]+[a-z]+[0-9]?[a-z]?)"
| #define SOCK_PATH "/var/run/devd.pipe"
#define REGEX "subsystem=CDEV type=(CREATE|DESTROY) cdev=((da|mmcsd)[0-9]+[a-z]+[0-9]?[a-z]?)"
| Support notifications for SD cards. | Support notifications for SD cards.
Tweak the regular expression a bit. SD cards are using device nodes such
as mmcsd0s1, so no notification would appear when we were looking for
da0s1 device nodes.
| C | bsd-2-clause | funglaub/devd-notifier |
be0936b342aa7da598866dfcc826c967f90b96d1 | include/elf.h | include/elf.h | /*-
* Copyright (c) 1997 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _ELF_H_
#define _ELF_H_
#include <sys/types.h>
#include <machine/elf.h>
#endif /* !_ELF_H_ */
| Add this header back, its existance is an SVR4-ELF tradition. Our ELF hints bits are still a seperate file. | Add this header back, its existance is an SVR4-ELF tradition.
Our ELF hints bits are still a seperate file.
Requested by: jdp
| C | bsd-3-clause | jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase |
|
726f5edaf516838c22f9c8e89b7abee974a84b94 | include/arch/x86/arch/types.h | include/arch/x86/arch/types.h | /*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H
#include <assert.h>
#include <stdint.h>
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
typedef unsigned long word_t;
typedef word_t vptr_t;
typedef word_t paddr_t;
typedef word_t pptr_t;
typedef word_t cptr_t;
typedef word_t dev_id_t;
typedef word_t cpu_id_t;
typedef word_t node_id_t;
typedef word_t dom_t;
/* for libsel4 headers that the kernel shares */
typedef word_t seL4_Word;
typedef cptr_t seL4_CPtr;
typedef uint32_t seL4_Uint32;
typedef uint8_t seL4_Uint8;
typedef node_id_t seL4_NodeId;
typedef paddr_t seL4_PAddr;
typedef dom_t seL4_Domain;
#endif
| /*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_TYPES_H
#define __ARCH_TYPES_H
#include <config.h>
#include <assert.h>
#include <stdint.h>
#if defined(CONFIG_ARCH_IA32)
compile_assert(long_is_32bits, sizeof(unsigned long) == 4)
#elif defined(CONFIG_ARCH_X86_64)
compile_assert(long_is_64bits, sizeof(unsigned long) == 8)
#endif
typedef unsigned long word_t;
typedef word_t vptr_t;
typedef word_t paddr_t;
typedef word_t pptr_t;
typedef word_t cptr_t;
typedef word_t dev_id_t;
typedef word_t cpu_id_t;
typedef word_t node_id_t;
typedef word_t dom_t;
/* for libsel4 headers that the kernel shares */
typedef word_t seL4_Word;
typedef cptr_t seL4_CPtr;
typedef uint32_t seL4_Uint32;
typedef uint8_t seL4_Uint8;
typedef node_id_t seL4_NodeId;
typedef paddr_t seL4_PAddr;
typedef dom_t seL4_Domain;
#endif
| Check size of unsigned long | x64: Check size of unsigned long
| C | bsd-2-clause | cmr/seL4,cmr/seL4,cmr/seL4 |
82ae93830b9bd7f2e55bf20057ed5c6ce873fe94 | AESTextEncryption/constants.h | AESTextEncryption/constants.h | //
// constants.h
// AESTextEncryption
//
// Created by Evgenii Neumerzhitckii on 21/02/2015.
// Copyright (c) 2015 Evgenii Neumerzhitckii. All rights reserved.
//
#define aesCompactHeight 400
#define aesPasswordTopMargin 11
#define aesPasswordTopMargin_compact 4
#define aesMessageTopMargin 10
#define aesMessageTopMargin_compact 0
#define aesPasswordHeightMargin 40
#define aesPasswordHeightMargin_compact 30
| //
// Created by Evgenii Neumerzhitckii on 21/02/2015.
// Copyright (c) 2015 Evgenii Neumerzhitckii. All rights reserved.
//
#define aesCompactHeight 400
#define aesPasswordTopMargin 11
#define aesPasswordTopMargin_compact 4
#define aesMessageTopMargin 10
#define aesMessageTopMargin_compact 0
#define aesPasswordHeightMargin 40
#define aesPasswordHeightMargin_compact 30
| Add compact mode for phone landscape orientation | Add compact mode for phone landscape orientation
| C | mit | evgenyneu/aes-text-encryption-ios,evgenyneu/aes-text-encryption-ios |
cf3a6c448ccddcefd84cc2be5f8c8927e2e5468d | test/Driver/diagnostics.c | test/Driver/diagnostics.c | // Parse diagnostic arguments in the driver
// PR12181
// RUN: !%clang -target x86_64-apple-darwin10 \
// RUN: -fsyntax-only -fzyzzybalubah \
// RUN: -Werror=unused-command-line-argument %s
// RUN: !%clang -target x86_64-apple-darwin10 \
// RUN: -fsyntax-only -fzyzzybalubah -Werror %s
| // Parse diagnostic arguments in the driver
// PR12181
// RUN: not %clang -target x86_64-apple-darwin10 \
// RUN: -fsyntax-only -fzyzzybalubah \
// RUN: -Werror=unused-command-line-argument %s
// RUN: not %clang -target x86_64-apple-darwin10 \
// RUN: -fsyntax-only -fzyzzybalubah -Werror %s
| Update test case to use not tool. | Update test case to use not tool.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@152664 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang |
16b705020c91b938660284734afd4218a826e96b | interp.h | interp.h | #include "lorito.h"
#ifndef LORITO_INTERP_H_GUARD
#define LORITO_INTERP_H_GUARD
Lorito_Ctx *
lorito_ctx_init(Lorito_Ctx *next_ctx, Lorito_Codeseg *codeseg);
Lorito_Interp *
lorito_init();
int
lorito_run(Lorito_Interp *interp);
#endif /* LORITO_INTERP_H_GUARD */
| #include "lorito.h"
#ifndef LORITO_INTERP_H_GUARD
#define LORITO_INTERP_H_GUARD
Lorito_Ctx *
lorito_ctx_init(Lorito_Ctx *next_ctx, Lorito_Codeseg *codeseg);
Lorito_PMC *
lorito_pmc_init(Lorito_Interp *interp, int size);
Lorito_Interp *
lorito_init();
int
lorito_run(Lorito_Interp *interp);
#endif /* LORITO_INTERP_H_GUARD */
| Add lorito_pmc_init to the proper header. | Add lorito_pmc_init to the proper header.
| C | artistic-2.0 | atrodo/lorito,atrodo/lorito |
ce0749117f31ad1052ead228acfe0ddbb431b04e | lib/CL/clSetUserEventStatus.c | lib/CL/clSetUserEventStatus.c | #include "pocl_cl.h"
#include "pocl_timing.h"
CL_API_ENTRY cl_int CL_API_CALL
POname(clSetUserEventStatus)(cl_event event ,
cl_int execution_status )
CL_API_SUFFIX__VERSION_1_1
{
/* Must be a valid user event */
POCL_RETURN_ERROR_COND((event == NULL), CL_INVALID_EVENT);
POCL_RETURN_ERROR_COND((event->command_type != CL_COMMAND_USER), CL_INVALID_EVENT);
/* Can only be set to CL_COMPLETE (0) or negative values */
POCL_RETURN_ERROR_COND((execution_status > CL_COMPLETE), CL_INVALID_VALUE);
/* Can only be done once */
POCL_RETURN_ERROR_COND((event->status <= CL_COMPLETE), CL_INVALID_OPERATION);
POCL_LOCK_OBJ (event);
event->status = execution_status;
if (execution_status == CL_COMPLETE)
{
pocl_broadcast (event);
}
POCL_UNLOCK_OBJ (event);
return CL_SUCCESS;
}
POsym(clSetUserEventStatus)
| #include "pocl_cl.h"
#include "pocl_timing.h"
CL_API_ENTRY cl_int CL_API_CALL
POname(clSetUserEventStatus)(cl_event event ,
cl_int execution_status )
CL_API_SUFFIX__VERSION_1_1
{
/* Must be a valid user event */
POCL_RETURN_ERROR_COND((event == NULL), CL_INVALID_EVENT);
POCL_RETURN_ERROR_COND((event->command_type != CL_COMMAND_USER), CL_INVALID_EVENT);
/* Can only be set to CL_COMPLETE (0) or negative values */
POCL_RETURN_ERROR_COND((execution_status > CL_COMPLETE), CL_INVALID_VALUE);
/* Can only be done once */
POCL_RETURN_ERROR_COND((event->status <= CL_COMPLETE), CL_INVALID_OPERATION);
POCL_LOCK_OBJ (event);
event->status = execution_status;
if (execution_status == CL_COMPLETE)
{
pocl_broadcast (event);
pocl_event_updated (event, CL_COMPLETE);
}
POCL_UNLOCK_OBJ (event);
return CL_SUCCESS;
}
POsym(clSetUserEventStatus)
| Make sure callbacks are called for user events | Make sure callbacks are called for user events
| C | mit | pocl/pocl,rjodin/pocl,franz/pocl,franz/pocl,Oblomov/pocl,pocl/pocl,Oblomov/pocl,Oblomov/pocl,Oblomov/pocl,franz/pocl,Oblomov/pocl,pocl/pocl,pocl/pocl,franz/pocl,rjodin/pocl,rjodin/pocl,pocl/pocl,franz/pocl,rjodin/pocl |
f777d09f375c1206cd0cea649bd0b2c04d668bfa | lib/DebugInfo/DWARFRelocMap.h | lib/DebugInfo/DWARFRelocMap.h | //===-- DWARFRelocMap.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_DWARFRELOCMAP_H
#define LLVM_DEBUGINFO_DWARFRELOCMAP_H
#include "llvm/ADT/DenseMap.h"
namespace llvm {
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
} // namespace llvm
#endif // LLVM_DEBUGINFO_DWARFRELOCMAP_H | //===-- DWARFRelocMap.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_DWARFRELOCMAP_H
#define LLVM_DEBUGINFO_DWARFRELOCMAP_H
#include "llvm/ADT/DenseMap.h"
namespace llvm {
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
} // namespace llvm
#endif // LLVM_DEBUGINFO_DWARFRELOCMAP_H
| Fix a warning in the new DWARFheader. Add a new line at the end of the file. | Fix a warning in the new DWARFheader. Add a new line at the end of the file.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@173518 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,chubbymaggie/asap,llvm-mirror/llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,dslab-epfl/asap,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm |
48d0c9e8bcc7b2f204eff8feef3b0fe6df0cae4f | include/types.h | include/types.h | // Machine types
typedef unsigned char Byte; /* 8 bits */
typedef unsigned short SWord; /* 16 bits */
typedef unsigned int DWord; /* 32 bits */
typedef unsigned int dword; /* 32 bits */
typedef unsigned int Word; /* 32 bits */
typedef unsigned int ADDRESS; /* 32-bit unsigned */
#define STD_SIZE 32 // Standard size
#define NO_ADDRESS ((ADDRESS)-1) // For invalid ADDRESSes
#ifndef _MSC_VER
typedef long unsigned long QWord; // 64 bits
#else
typedef unsigned __int64 QWord;
#endif
#if defined(_MSC_VER)
#pragma warning(disable:4390)
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1200
// For MSVC 5 or 6: warning about debug into truncated to 255 chars
#pragma warning(disable:4786)
#endif
| /*
* types.h: some often used basic type definitions
* $Revision$
*/
#ifndef __TYPES_H__
#define __TYPES_H__
// Machine types
typedef unsigned char Byte; /* 8 bits */
typedef unsigned short SWord; /* 16 bits */
typedef unsigned int DWord; /* 32 bits */
typedef unsigned int dword; /* 32 bits */
typedef unsigned int Word; /* 32 bits */
typedef unsigned int ADDRESS; /* 32-bit unsigned */
#define STD_SIZE 32 // Standard size
// Note: there is a known name collision with NO_ADDRESS in WinSock.h
#ifdef NO_ADDRESS
#undef NO_ADDRESS
#endif
#define NO_ADDRESS ((ADDRESS)-1) // For invalid ADDRESSes
#ifndef _MSC_VER
typedef long unsigned long QWord; // 64 bits
#else
typedef unsigned __int64 QWord;
#endif
#if defined(_MSC_VER)
#pragma warning(disable:4390)
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1200
// For MSVC 5 or 6: warning about debug into truncated to 255 chars
#pragma warning(disable:4786)
#endif
#endif // #ifndef __TYPES_H__
| Handle the name collision (with WinSock.h) for NO_ADDRESS | Handle the name collision (with WinSock.h) for NO_ADDRESS
| C | bsd-3-clause | TambourineReindeer/boomerang,nemerle/boomerang,xujun10110/boomerang,xujun10110/boomerang,nemerle/boomerang,nemerle/boomerang,TambourineReindeer/boomerang,xujun10110/boomerang,nemerle/boomerang,xujun10110/boomerang,TambourineReindeer/boomerang,TambourineReindeer/boomerang,xujun10110/boomerang,nemerle/boomerang,nemerle/boomerang,nemerle/boomerang,xujun10110/boomerang,xujun10110/boomerang,TambourineReindeer/boomerang,TambourineReindeer/boomerang,nemerle/boomerang,xujun10110/boomerang,TambourineReindeer/boomerang,TambourineReindeer/boomerang |
3ab883a6e155fb1f6a36a4fe341abb97d15994d4 | src/ast/node_counter.h | src/ast/node_counter.h | #pragma once
#include "bpftrace.h"
#include "log.h"
#include "pass_manager.h"
#include "visitors.h"
namespace bpftrace {
namespace ast {
class NodeCounter : public Visitor
{
public:
void Visit(Node &node)
{
count_++;
Visitor::Visit(node);
}
size_t get_count()
{
return count_;
};
private:
size_t count_ = 0;
};
Pass CreateCounterPass()
{
auto fn = [](Node &n, PassContext &ctx) {
NodeCounter c;
c.Visit(n);
auto node_count = c.get_count();
auto max = ctx.b.ast_max_nodes_;
if (bt_verbose)
{
LOG(INFO) << "node count: " << node_count;
}
if (node_count >= max)
{
LOG(ERROR) << "node count (" << node_count << ") exceeds the limit ("
<< max << ")";
return PassResult::Error("node count exceeded");
}
return PassResult::Success();
};
return Pass("NodeCounter", fn);
}
} // namespace ast
} // namespace bpftrace
| #pragma once
#include "bpftrace.h"
#include "log.h"
#include "pass_manager.h"
#include "visitors.h"
namespace bpftrace {
namespace ast {
class NodeCounter : public Visitor
{
public:
void Visit(Node &node) override
{
count_++;
Visitor::Visit(node);
}
size_t get_count()
{
return count_;
};
private:
size_t count_ = 0;
};
Pass CreateCounterPass()
{
auto fn = [](Node &n, PassContext &ctx) {
NodeCounter c;
c.Visit(n);
auto node_count = c.get_count();
auto max = ctx.b.ast_max_nodes_;
if (bt_verbose)
{
LOG(INFO) << "node count: " << node_count;
}
if (node_count >= max)
{
LOG(ERROR) << "node count (" << node_count << ") exceeds the limit ("
<< max << ")";
return PassResult::Error("node count exceeded");
}
return PassResult::Success();
};
return Pass("NodeCounter", fn);
}
} // namespace ast
} // namespace bpftrace
| Add override keyword to overridden method | Add override keyword to overridden method
| C | apache-2.0 | iovisor/bpftrace,iovisor/bpftrace,iovisor/bpftrace,iovisor/bpftrace |
2e25cff3e7ad047f83c8f45b7430bbbfbfa8aeea | test/Driver/mips-gpopt-warning.c | test/Driver/mips-gpopt-warning.c | // REQUIRES: mips-registered-target
// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt 2>&1 | FileCheck -check-prefix=IMPLICIT %s
// IMPLICIT: warning: ignoring '-mgpopt' option as it cannot be used with the implicit usage of-mabicalls
// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt -mabicalls 2>&1 | FileCheck -check-prefix=EXPLICIT %s
// EXPLICIT: warning: ignoring '-mgpopt' option as it cannot be used with -mabicalls
| Add warning test for -mgpopt option. | [mips] Add warning test for -mgpopt option.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@308432 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang |
|
b91a8ad3931b320e2c5d0b53c1481a5407d98725 | src/lib/str-sanitize.c | src/lib/str-sanitize.c | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if ((unsigned char)*p < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if ((unsigned char)*p < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
| /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if (((unsigned char)*p & 0x7f) < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if (((unsigned char)*p & 0x7f) < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
| Convert also 0x80..0x9f characters to '?' | Convert also 0x80..0x9f characters to '?'
| C | mit | LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot |
dde630e7f828d49fa7fd8e01887b4645ac7572fc | src/Magnum/Implementation/maxTextureSize.h | src/Magnum/Implementation/maxTextureSize.h | #ifndef Magnum_Implementation_maxTextureSize_h
#define Magnum_Implementation_maxTextureSize_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015
Vladimír Vondruš <[email protected]>
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, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/OpenGL.h"
namespace Magnum { namespace Implementation {
GLint maxTextureSideSize();
GLint max3DTextureDepth();
GLint maxTextureArrayLayers();
GLint maxCubeMapTextureSideSize();
}}
#endif
| #ifndef Magnum_Implementation_maxTextureSize_h
#define Magnum_Implementation_maxTextureSize_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015
Vladimír Vondruš <[email protected]>
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, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/OpenGL.h"
namespace Magnum { namespace Implementation {
GLint maxTextureSideSize();
GLint max3DTextureDepth();
#ifndef MAGNUM_TARGET_GLES2
GLint maxTextureArrayLayers();
#endif
GLint maxCubeMapTextureSideSize();
}}
#endif
| Hide internal function declaration on ES2 builds. | Hide internal function declaration on ES2 builds.
The implementation was already hidden so this is not needed too.
| C | mit | DerThorsten/magnum,DerThorsten/magnum,DerThorsten/magnum,MiUishadow/magnum,MiUishadow/magnum,ashimidashajia/magnum,ashimidashajia/magnum,MiUishadow/magnum,ashimidashajia/magnum,MiUishadow/magnum,ashimidashajia/magnum,MiUishadow/magnum,DerThorsten/magnum,DerThorsten/magnum,MiUishadow/magnum,ashimidashajia/magnum |
5103d9b68accfc116275636d1a6068aa14df2d33 | iotests/trim.c | iotests/trim.c | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <getopt.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include "utils.h"
#include "logSpeed.h"
int keepRunning = 1;
int main(int argc, char *argv[]) {
// int index = handle_args(argc, argv);
int index = 1;
// signal(SIGTERM, intHandler);
// signal(SIGINT, intHandler);
for (size_t i = index; i < argc; i++) {
int fd = open(argv[i], O_WRONLY | O_EXCL | O_DIRECT);
if (fd >= 0) {
size_t bdsize = blockDeviceSizeFromFD(fd);
trimDevice(fd, argv[i], 0, bdsize); // only sending 1GiB for now
close(fd);
} else {
perror("open");
}
}
return 0;
}
| #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <getopt.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include "utils.h"
#include "logSpeed.h"
int keepRunning = 1;
int main(int argc, char *argv[]) {
// int index = handle_args(argc, argv);
int index = 1;
// signal(SIGTERM, intHandler);
// signal(SIGINT, intHandler);
for (size_t i = index; i < argc; i++) {
int fd = open(argv[i], O_RDWR | O_EXCL | O_DIRECT );
if (fd >= 0) {
size_t bdsize = blockDeviceSizeFromFD(fd);
trimDevice(fd, argv[i], 0, bdsize - 512);
close(fd);
} else {
perror("open");
}
}
return 0;
}
| Subtract one old school sector | Subtract one old school sector
| C | apache-2.0 | dr-who/stutools,dr-who/stutools |
1d7b0f54bee766d685ab74f0c206547431f4f636 | Alc/alconfig.h | Alc/alconfig.h | #ifndef ALCONFIG_H
#define ALCONFIG_H
void ReadALConfig(void);
void FreeALConfig(void);
int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);
int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);
#endif /* ALCONFIG_H */
| #ifndef ALCONFIG_H
#define ALCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
void ReadALConfig(void);
void FreeALConfig(void);
int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);
int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* ALCONFIG_H */
| Add another missing extern "C" | Add another missing extern "C"
| C | lgpl-2.1 | aaronmjacobs/openal-soft,aaronmjacobs/openal-soft |
2e0bb77ac7a50735d50ee8a92be9bf7eadfd100c | test/global_fakes.h | test/global_fakes.h |
#ifndef GLOBAL_FAKES_H_
#define GLOBAL_FAKES_H_
#include "../fff3.h"
void global_void_func(void);
DECLARE_FAKE_VOID_FUNC0(global_void_func);
#endif /* GLOBAL_FAKES_H_ */
|
#ifndef GLOBAL_FAKES_H_
#define GLOBAL_FAKES_H_
#include "../fff3.h"
//// Imaginary production code header file ///
void voidfunc1(int);
void voidfunc2(char, char);
long longfunc0();
enum MYBOOL { FALSE = 899, TRUE };
struct MyStruct {
int x;
int y;
};
enum MYBOOL enumfunc();
struct MyStruct structfunc();
//// End Imaginary production code header file ///
DECLARE_FAKE_VOID_FUNC1(voidfunc1, int);
DECLARE_FAKE_VOID_FUNC2(voidfunc2, char, char);
DECLARE_FAKE_VALUE_FUNC0(long, longfunc0);
DECLARE_FAKE_VALUE_FUNC0(enum MYBOOL, enumfunc0);
DECLARE_FAKE_VALUE_FUNC0(struct MyStruct, structfunc0);
#endif /* GLOBAL_FAKES_H_ */
| Add fakes for common test cases | Add fakes for common test cases
| C | mit | usr42/fff,usr42/fff,usr42/fff,usr42/fff |
07f4eda3a524bdc245a088dc90a71583234273b9 | test/FrontendC/vla-1.c | test/FrontendC/vla-1.c | // RUN: not %llvmgcc -std=gnu99 %s -S |& grep "error: alignment for"
int foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
return 4;
}
| // RUN: %llvmgcc_only -std=gnu99 %s -S |& grep "warning: alignment for"
int foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
return 4;
}
| Fix this up per llvm-gcc r109819. | Fix this up per llvm-gcc r109819.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@109820 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,chubbymaggie/asap,llvm-mirror/llvm,dslab-epfl/asap,dslab-epfl/asap,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap |
a6345abe1b077f3bb2c6765245761f8a9f50965c | capi/include/mp4parse-rust.h | capi/include/mp4parse-rust.h | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef _MP4PARSE_RUST_H
#define _MP4PARSE_RUST_H
#ifdef __cplusplus
extern "C" {
#endif
struct mp4parse_state;
struct mp4parse_state* mp4parse_state_new(void);
void mp4parse_state_free(struct mp4parse_state* state);
int32_t mp4parse_state_feed(struct mp4parse_state* state, uint8_t *buffer, size_t size);
#ifdef __cplusplus
}
#endif
#endif
| // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef _MP4PARSE_RUST_H
#define _MP4PARSE_RUST_H
#ifdef __cplusplus
extern "C" {
#endif
struct mp4parse_state;
struct mp4parse_state* mp4parse_new(void);
void mp4parse_free(struct mp4parse_state* state);
int32_t mp4parse_read(struct mp4parse_state* state, uint8_t *buffer, size_t size);
#ifdef __cplusplus
}
#endif
#endif
| Update C header to match capi.rs function names. | Update C header to match capi.rs function names.
| C | mpl-2.0 | kinetiknz/mp4parse-rust,kinetiknz/mp4parse-rust,mozilla/mp4parse-rust |
6c93a693f3e0e4a2979fa8677278d181c5e3edb2 | include/rwte/coords.h | include/rwte/coords.h | #ifndef RWTE_COORDS_H
#define RWTE_COORDS_H
struct Cell
{
int row, col;
inline bool operator==(const Cell& other) const
{
return row == other.row && col == other.col;
}
inline bool operator!=(const Cell& other) const
{
return row != other.row || col != other.col;
}
inline bool operator< (const Cell& other) const
{
return row < other.row || col < other.col;
}
inline bool operator> (const Cell& other) const
{
return row > other.row || col > other.col;
}
inline bool operator<=(const Cell& other) const
{
return row < other.row || col < other.col ||
(row == other.row && col == other.col);
}
inline bool operator>=(const Cell& other) const
{
return row > other.row || col > other.col ||
(row == other.row && col == other.col);
}
};
#endif // RWTE_COORDS_H
| #ifndef RWTE_COORDS_H
#define RWTE_COORDS_H
struct Cell
{
int row = 0;
int col = 0;
inline bool operator==(const Cell& other) const
{
return row == other.row && col == other.col;
}
inline bool operator!=(const Cell& other) const
{
return row != other.row || col != other.col;
}
inline bool operator< (const Cell& other) const
{
return row < other.row || col < other.col;
}
inline bool operator> (const Cell& other) const
{
return row > other.row || col > other.col;
}
inline bool operator<=(const Cell& other) const
{
return row < other.row || col < other.col ||
(row == other.row && col == other.col);
}
inline bool operator>=(const Cell& other) const
{
return row > other.row || col > other.col ||
(row == other.row && col == other.col);
}
};
#endif // RWTE_COORDS_H
| Set default values for Cell members. | Set default values for Cell members.
| C | mit | drcforbin/rwte,drcforbin/rwte,drcforbin/rwte,drcforbin/rwte |
0eabb5f05a435bb32ba85b192875c47d213453b6 | include/shmlog_tags.h | include/shmlog_tags.h | /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
*/
SLTM(Debug)
SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
SLTM(SessionClose)
SLTM(BackendOpen)
SLTM(BackendXID)
SLTM(BackendReuse)
SLTM(BackendClose)
SLTM(HttpError)
SLTM(ClientAddr)
SLTM(Backend)
SLTM(Request)
SLTM(Response)
SLTM(Length)
SLTM(Status)
SLTM(URL)
SLTM(Protocol)
SLTM(Header)
SLTM(BldHdr)
SLTM(LostHeader)
SLTM(VCL_call)
SLTM(VCL_trace)
SLTM(VCL_return)
SLTM(XID)
SLTM(Hit)
SLTM(ExpBan)
SLTM(ExpPick)
SLTM(ExpKill)
SLTM(WorkThread)
| /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
* REMEMBER to update the documentation (especially the varnishlog(1) man
* page) whenever this list changes.
*/
SLTM(Debug)
SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
SLTM(SessionClose)
SLTM(BackendOpen)
SLTM(BackendXID)
SLTM(BackendReuse)
SLTM(BackendClose)
SLTM(HttpError)
SLTM(ClientAddr)
SLTM(Backend)
SLTM(Request)
SLTM(Response)
SLTM(Length)
SLTM(Status)
SLTM(URL)
SLTM(Protocol)
SLTM(Header)
SLTM(BldHdr)
SLTM(LostHeader)
SLTM(VCL_call)
SLTM(VCL_trace)
SLTM(VCL_return)
SLTM(XID)
SLTM(Hit)
SLTM(ExpBan)
SLTM(ExpPick)
SLTM(ExpKill)
SLTM(WorkThread)
| Add a note to update varnishlog(1) whenever this list changes. | Add a note to update varnishlog(1) whenever this list changes.
git-svn-id: 2c9807fa3ff65b17195bd55dc8a6c4261e10127b@418 d4fa192b-c00b-0410-8231-f00ffab90ce4
| C | bsd-2-clause | drwilco/varnish-cache-old,ajasty-cavium/Varnish-Cache,1HLtd/Varnish-Cache,varnish/Varnish-Cache,varnish/Varnish-Cache,gquintard/Varnish-Cache,drwilco/varnish-cache-drwilco,alarky/varnish-cache-doc-ja,feld/Varnish-Cache,wikimedia/operations-debs-varnish,zhoualbeart/Varnish-Cache,drwilco/varnish-cache-old,gauthier-delacroix/Varnish-Cache,gauthier-delacroix/Varnish-Cache,ssm/pkg-varnish,alarky/varnish-cache-doc-ja,franciscovg/Varnish-Cache,wikimedia/operations-debs-varnish,ssm/pkg-varnish,chrismoulton/Varnish-Cache,franciscovg/Varnish-Cache,zhoualbeart/Varnish-Cache,mrhmouse/Varnish-Cache,ssm/pkg-varnish,franciscovg/Varnish-Cache,ambernetas/varnish-cache,feld/Varnish-Cache,mrhmouse/Varnish-Cache,alarky/varnish-cache-doc-ja,mrhmouse/Varnish-Cache,franciscovg/Varnish-Cache,chrismoulton/Varnish-Cache,alarky/varnish-cache-doc-ja,feld/Varnish-Cache,ambernetas/varnish-cache,varnish/Varnish-Cache,ssm/pkg-varnish,varnish/Varnish-Cache,1HLtd/Varnish-Cache,1HLtd/Varnish-Cache,feld/Varnish-Cache,gquintard/Varnish-Cache,zhoualbeart/Varnish-Cache,gauthier-delacroix/Varnish-Cache,gauthier-delacroix/Varnish-Cache,chrismoulton/Varnish-Cache,gquintard/Varnish-Cache,mrhmouse/Varnish-Cache,zhoualbeart/Varnish-Cache,mrhmouse/Varnish-Cache,alarky/varnish-cache-doc-ja,ajasty-cavium/Varnish-Cache,wikimedia/operations-debs-varnish,wikimedia/operations-debs-varnish,feld/Varnish-Cache,wikimedia/operations-debs-varnish,ajasty-cavium/Varnish-Cache,ajasty-cavium/Varnish-Cache,chrismoulton/Varnish-Cache,chrismoulton/Varnish-Cache,gquintard/Varnish-Cache,drwilco/varnish-cache-old,1HLtd/Varnish-Cache,franciscovg/Varnish-Cache,drwilco/varnish-cache-drwilco,drwilco/varnish-cache-drwilco,ajasty-cavium/Varnish-Cache,zhoualbeart/Varnish-Cache,ssm/pkg-varnish,ambernetas/varnish-cache,gauthier-delacroix/Varnish-Cache,varnish/Varnish-Cache |
51c8a6dc7636942958b07ed49e925c97b9d58646 | config.h | config.h | const char *field_sep = " \u2022 ";
const char *time_fmt = "%x %I:%M %p";
const int update_period = 90;
char *
loadavg(void)
{
double avgs[3];
if (getloadavg(avgs, 3) < 0) {
perror("getloadavg");
exit(1);
}
return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
}
char *
prettytime(void)
{
return mktimes(time_fmt, NULL);
}
static char *(*forder[])(void) = {
loadavg,
prettytime,
NULL
};
| const char *field_sep = " \u2022 ";
const char *time_fmt = "%x %I:%M %p";
const int update_period = 15;
char *
loadavg(void)
{
double avgs[3];
if (getloadavg(avgs, 3) < 0) {
perror("getloadavg");
exit(1);
}
return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
}
char *
prettytime(void)
{
return mktimes(time_fmt, NULL);
}
static char *(*forder[])(void) = {
loadavg,
prettytime,
NULL
};
| Change update_period to 15 seconds | Change update_period to 15 seconds
On a laptop, 90 seconds between battery status updates can lead to
unnecessary worrying about whether or not the AC adapter is broken.
| C | mit | grantisu/dwmstatus |
06d414e87708afb29b87d33919abbf5973c9bed2 | adapters/Vungle/VungleAdapter/GADMAdapterVungleConstants.h | adapters/Vungle/VungleAdapter/GADMAdapterVungleConstants.h | //
// Copyright © 2019 Google. All rights reserved.
//
static NSString *const kGADMAdapterVungleVersion = @"6.4.2.1";
static NSString *const kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const kGADMAdapterVungleErrorDomain =
@"com.google.mediation.vungle";
| //
// Copyright © 2019 Google. All rights reserved.
//
static NSString *const kGADMAdapterVungleVersion = @"6.4.3.0";
static NSString *const kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const kGADMAdapterVungleErrorDomain =
@"com.google.mediation.vungle";
| Update adapter version number to 6.4.3.0 | Update adapter version number to 6.4.3.0
| C | apache-2.0 | googleads/googleads-mobile-ios-mediation,googleads/googleads-mobile-ios-mediation,googleads/googleads-mobile-ios-mediation,googleads/googleads-mobile-ios-mediation |
962247710c891af9f847c3c26670c3ab8928219c | src/common/angleutils.h | src/common/angleutils.h | //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angleutils.h: Common ANGLE utilities.
#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_
// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
template <typename T, unsigned int N>
inline unsigned int ArraySize(T(&)[N])
{
return N;
}
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
#endif // COMMON_ANGLEUTILS_H_
| //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angleutils.h: Common ANGLE utilities.
#ifndef COMMON_ANGLEUTILS_H_
#define COMMON_ANGLEUTILS_H_
// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
template <typename T, unsigned int N>
inline unsigned int ArraySize(T(&)[N])
{
return N;
}
template <typename T, unsigned int N>
void SafeRelease(T (&resourceBlock)[N])
{
for (unsigned int i = 0; i < N; i++)
{
SafeRelease(resourceBlock[i]);
}
}
template <typename T>
void SafeRelease(T& resource)
{
if (resource)
{
resource->Release();
resource = NULL;
}
}
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
#endif // COMMON_ANGLEUTILS_H_
| Add helper functions to safely release Windows COM resources, and arrays of COM resources. | Add helper functions to safely release Windows COM resources, and arrays of COM resources.
TRAC #22656
Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Author: Jamie Madill
git-svn-id: 7288974629ec06eaf04ee103a0a5f761b9efd9a5@2076 736b8ea6-26fd-11df-bfd4-992fa37f6226
| C | bsd-3-clause | mikolalysenko/angle,ecoal95/angle,xin3liang/platform_external_chromium_org_third_party_angle,larsbergstrom/angle,bsergean/angle,ghostoy/angle,jgcaaprom/android_external_chromium_org_third_party_angle,bsergean/angle,mrobinson/rust-angle,ghostoy/angle,MIPS/external-chromium_org-third_party-angle,mrobinson/rust-angle,vvuk/angle,nandhanurrevanth/angle,crezefire/angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,mybios/angle,csa7mdm/angle,crezefire/angle,csa7mdm/angle,mrobinson/rust-angle,larsbergstrom/angle,MIPS/external-chromium_org-third_party-angle,xin3liang/platform_external_chromium_org_third_party_angle,vvuk/angle,mrobinson/rust-angle,mikolalysenko/angle,ghostoy/angle,MSOpenTech/angle,nandhanurrevanth/angle,domokit/waterfall,mybios/angle,mrobinson/rust-angle,crezefire/angle,xin3liang/platform_external_chromium_org_third_party_angle,mlfarrell/angle,MIPS/external-chromium_org-third_party-angle,mlfarrell/angle,nandhanurrevanth/angle,ecoal95/angle,ecoal95/angle,csa7mdm/angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,larsbergstrom/angle,ppy/angle,larsbergstrom/angle,mybios/angle,MIPS/external-chromium_org-third_party-angle,crezefire/angle,ghostoy/angle,mlfarrell/angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,MSOpenTech/angle,vvuk/angle,ecoal95/angle,mikolalysenko/angle,android-ia/platform_external_chromium_org_third_party_angle,xin3liang/platform_external_chromium_org_third_party_angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,android-ia/platform_external_chromium_org_third_party_angle,nandhanurrevanth/angle,android-ia/platform_external_chromium_org_third_party_angle,bsergean/angle,domokit/waterfall,ecoal95/angle,jgcaaprom/android_external_chromium_org_third_party_angle,ppy/angle,jgcaaprom/android_external_chromium_org_third_party_angle,jgcaaprom/android_external_chromium_org_third_party_angle,MSOpenTech/angle,ppy/angle,android-ia/platform_external_chromium_org_third_party_angle,csa7mdm/angle,mikolalysenko/angle,mlfarrell/angle,MSOpenTech/angle,bsergean/angle,vvuk/angle,mybios/angle,ppy/angle |
82b771a4edc2414a6b88ea75afa73c2d82f6b569 | config.h | config.h | #ifndef _CONFIG_H_
#define _CONFIG_H_
#define DEBUG 0
#define BADGE_MINIMUM_ID 3000 /* Inclusive */
#define BADGE_MAXIMUM_ID 8000 /* Inclusive */
#define HISTORY_WINDOW_SIZE 128
/** Optionally workaround a bug whereby sequence IDs are
* not held constant within a burst of identical packets
*
* Set to 0 to disable workaround, or 2 to ignore the bottom
* two bits of all sequence IDs, since badges send 4 packets
* at a time.
*/
#define CONFIG_SEQUENCE_ID_SHIFT 2
#endif
| #ifndef _CONFIG_H_
#define _CONFIG_H_
#define DEBUG 0
#define BADGE_MINIMUM_ID 3000 /* Inclusive */
#define BADGE_MAXIMUM_ID 8000 /* Inclusive */
#define HISTORY_WINDOW_SIZE 32
/** Optionally workaround a bug whereby sequence IDs are
* not held constant within a burst of identical packets
*
* Set to 0 to disable workaround, or 2 to ignore the bottom
* two bits of all sequence IDs, since badges send 4 packets
* at a time.
*/
#define CONFIG_SEQUENCE_ID_SHIFT 2
#endif
| Reduce history size to 32 buckets | Reduce history size to 32 buckets
| C | agpl-3.0 | nwf/nwf-openamd-localizer,nwf/nwf-openamd-localizer |
c9b258415efd0659e53c756ccd979b33afb4e8d4 | test/chtest/setgroups.c | test/chtest/setgroups.c | /* Try to drop the last supplemental group, and print a message to stdout
describing what happened. */
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define NGROUPS_MAX 32
int main()
{
int group_ct;
gid_t groups[NGROUPS_MAX];
group_ct = getgroups(NGROUPS_MAX, groups);
if (group_ct == -1) {
printf("ERROR\tgetgroups(2) failed with errno=%d\n", errno);
return 1;
}
fprintf(stderr, "found %d groups; trying to drop last group %d\n",
group_ct, groups[group_ct - 1]);
if (setgroups(group_ct - 1, groups)) {
if (errno == EPERM) {
printf("SAFE\tsetgroups(2) failed with EPERM\n");
return 0;
} else {
printf("ERROR\tsetgroups(2) failed with errno=%d\n", errno);
return 1;
}
} else {
printf("RISK\tsetgroups(2) succeeded\n");
return 1;
}
}
| /* Try to drop the last supplemental group, and print a message to stdout
describing what happened. */
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define NGROUPS_MAX 128
int main()
{
int group_ct;
gid_t groups[NGROUPS_MAX];
group_ct = getgroups(NGROUPS_MAX, groups);
if (group_ct == -1) {
printf("ERROR\tgetgroups(2) failed with errno=%d\n", errno);
return 1;
}
fprintf(stderr, "found %d groups; trying to drop last group %d\n",
group_ct, groups[group_ct - 1]);
if (setgroups(group_ct - 1, groups)) {
if (errno == EPERM) {
printf("SAFE\tsetgroups(2) failed with EPERM\n");
return 0;
} else {
printf("ERROR\tsetgroups(2) failed with errno=%d\n", errno);
return 1;
}
} else {
printf("RISK\tsetgroups(2) succeeded\n");
return 1;
}
}
| Raise maximum groups in chtest to the same number used in ch-run. | Raise maximum groups in chtest to the same number used in ch-run.
Signed-off-by: Oliver Freyermuth <[email protected]>
| C | apache-2.0 | hpc/charliecloud,hpc/charliecloud,hpc/charliecloud |
a61f732d9aefc8731e05ee7003c8de4e6cc72e29 | ExLauncher/global.h | ExLauncher/global.h | /*
Copyright 2016 Andreas Bjerkeholt
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _GLOBAL_H
#define _GLOBAL_H
#if defined(WIN32) || defined(_WIN32)
#define WINDOWS
#endif
#if defined(__unix) || defined(__unix__)
#define UNIX
#endif
#define FPS 60
extern bool debugViewBounds;
extern bool isLauncher;
#endif
| /*
Copyright 2016 Andreas Bjerkeholt
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _GLOBAL_H
#define _GLOBAL_H
#if defined(WIN32) || defined(_WIN32)
#define WINDOWS
#endif
#if defined(__unix) || defined(__unix__) || defined(__APPLE__)
#define UNIX
#endif
#define FPS 60
extern bool debugViewBounds;
extern bool isLauncher;
#endif
| Add OSX-specific macro to the list of platforms detected as UNIX | Add OSX-specific macro to the list of platforms detected as UNIX
| C | apache-2.0 | Harteex/ExLauncher,Harteex/ExLauncher,Harteex/ExLauncher |
26feb1fe0c81e3545aa2bc85bc6ec7cc366049cd | chrome/browser/thumbnail_store.h | chrome/browser/thumbnail_store.h | // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_THUMBNAIL_STORE_H_
#define CHROME_BROWSER_THUMBNAIL_STORE_H_
#include <vector>
#include "base/file_path.h"
class GURL;
class SkBitmap;
struct ThumbnailScore;
namespace base {
class Time;
}
// This storage interface provides storage for the thumbnails used
// by the new_tab_ui.
class ThumbnailStore {
public:
ThumbnailStore();
~ThumbnailStore();
// Must be called after creation but before other methods are called.
// file_path is where a new database should be created or the
// location of an existing databse.
// If false is returned, no other methods should be called.
bool Init(const FilePath& file_path);
// Stores the given thumbnail and score with the associated url.
bool SetPageThumbnail(const GURL& url,
const SkBitmap& thumbnail,
const ThumbnailScore& score,
const base::Time& time);
// Retrieves the thumbnail and score for the given url.
// Returns false if there is not data for the given url or some other
// error occurred.
bool GetPageThumbnail(const GURL& url,
SkBitmap* thumbnail,
ThumbnailScore* score);
private:
// The location of the thumbnail store.
FilePath file_path_;
DISALLOW_COPY_AND_ASSIGN(ThumbnailStore);
};
#endif // CHROME_BROWSER_THUMBNAIL_STORE_H_
| Add an unused interface for storing thumbnails. This is to replace the history system's thumbnail storage. | Add an unused interface for storing thumbnails. This is to replace the history
system's thumbnail storage.
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@17028 0039d316-1c4b-4281-b951-d872f2087c98
| C | bsd-3-clause | keishi/chromium,dushu1203/chromium.src,patrickm/chromium.src,anirudhSK/chromium,zcbenz/cefode-chromium,Just-D/chromium-1,littlstar/chromium.src,ChromiumWebApps/chromium,ChromiumWebApps/chromium,keishi/chromium,crosswalk-project/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,zcbenz/cefode-chromium,timopulkkinen/BubbleFish,rogerwang/chromium,markYoungH/chromium.src,timopulkkinen/BubbleFish,ondra-novak/chromium.src,Fireblend/chromium-crosswalk,Chilledheart/chromium,littlstar/chromium.src,patrickm/chromium.src,junmin-zhu/chromium-rivertrail,chuan9/chromium-crosswalk,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,ltilve/chromium,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk,markYoungH/chromium.src,Chilledheart/chromium,fujunwei/chromium-crosswalk,patrickm/chromium.src,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,rogerwang/chromium,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,Chilledheart/chromium,hgl888/chromium-crosswalk-efl,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,anirudhSK/chromium,nacl-webkit/chrome_deps,rogerwang/chromium,junmin-zhu/chromium-rivertrail,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,ondra-novak/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,jaruba/chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,ondra-novak/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,keishi/chromium,jaruba/chromium.src,robclark/chromium,markYoungH/chromium.src,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,pozdnyakov/chromium-crosswalk,keishi/chromium,fujunwei/chromium-crosswalk,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,bright-sparks/chromium-spacewalk,junmin-zhu/chromium-rivertrail,markYoungH/chromium.src,Jonekee/chromium.src,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,mogoweb/chromium-crosswalk,anirudhSK/chromium,Just-D/chromium-1,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk-efl,robclark/chromium,littlstar/chromium.src,fujunwei/chromium-crosswalk,hujiajie/pa-chromium,bright-sparks/chromium-spacewalk,patrickm/chromium.src,dednal/chromium.src,dushu1203/chromium.src,dushu1203/chromium.src,M4sse/chromium.src,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,axinging/chromium-crosswalk,zcbenz/cefode-chromium,ChromiumWebApps/chromium,dednal/chromium.src,hgl888/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,robclark/chromium,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dednal/chromium.src,jaruba/chromium.src,dednal/chromium.src,dushu1203/chromium.src,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,ltilve/chromium,rogerwang/chromium,jaruba/chromium.src,timopulkkinen/BubbleFish,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,keishi/chromium,patrickm/chromium.src,dushu1203/chromium.src,ltilve/chromium,pozdnyakov/chromium-crosswalk,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,littlstar/chromium.src,mogoweb/chromium-crosswalk,Jonekee/chromium.src,pozdnyakov/chromium-crosswalk,dednal/chromium.src,robclark/chromium,hujiajie/pa-chromium,nacl-webkit/chrome_deps,rogerwang/chromium,ondra-novak/chromium.src,ChromiumWebApps/chromium,zcbenz/cefode-chromium,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,littlstar/chromium.src,zcbenz/cefode-chromium,axinging/chromium-crosswalk,robclark/chromium,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,hujiajie/pa-chromium,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,hujiajie/pa-chromium,hujiajie/pa-chromium,anirudhSK/chromium,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,fujunwei/chromium-crosswalk,nacl-webkit/chrome_deps,nacl-webkit/chrome_deps,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,rogerwang/chromium,keishi/chromium,krieger-od/nwjs_chromium.src,dednal/chromium.src,axinging/chromium-crosswalk,anirudhSK/chromium,Jonekee/chromium.src,keishi/chromium,markYoungH/chromium.src,rogerwang/chromium,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,mogoweb/chromium-crosswalk,jaruba/chromium.src,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,junmin-zhu/chromium-rivertrail,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,nacl-webkit/chrome_deps,ltilve/chromium,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,keishi/chromium,Chilledheart/chromium,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,rogerwang/chromium,keishi/chromium,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,littlstar/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,Chilledheart/chromium,keishi/chromium,patrickm/chromium.src,crosswalk-project/chromium-crosswalk-efl,hujiajie/pa-chromium,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,anirudhSK/chromium,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,krieger-od/nwjs_chromium.src,ltilve/chromium,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,ChromiumWebApps/chromium,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,ondra-novak/chromium.src,patrickm/chromium.src,axinging/chromium-crosswalk,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,robclark/chromium,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,hujiajie/pa-chromium,dednal/chromium.src,Chilledheart/chromium,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,patrickm/chromium.src,M4sse/chromium.src,Jonekee/chromium.src,keishi/chromium,ltilve/chromium,markYoungH/chromium.src,littlstar/chromium.src,M4sse/chromium.src,Jonekee/chromium.src,Chilledheart/chromium,Just-D/chromium-1,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,timopulkkinen/BubbleFish,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,anirudhSK/chromium,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,mogoweb/chromium-crosswalk,robclark/chromium,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,chuan9/chromium-crosswalk,robclark/chromium,markYoungH/chromium.src,patrickm/chromium.src,nacl-webkit/chrome_deps,timopulkkinen/BubbleFish,ltilve/chromium,rogerwang/chromium,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,anirudhSK/chromium,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,rogerwang/chromium,dushu1203/chromium.src,mogoweb/chromium-crosswalk,markYoungH/chromium.src,nacl-webkit/chrome_deps,jaruba/chromium.src,mogoweb/chromium-crosswalk,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,dushu1203/chromium.src,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,hujiajie/pa-chromium,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,Just-D/chromium-1,ondra-novak/chromium.src,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,Jonekee/chromium.src,ChromiumWebApps/chromium,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk,dushu1203/chromium.src,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,dednal/chromium.src,pozdnyakov/chromium-crosswalk,robclark/chromium,zcbenz/cefode-chromium,dushu1203/chromium.src,robclark/chromium,M4sse/chromium.src,Jonekee/chromium.src,Fireblend/chromium-crosswalk,Just-D/chromium-1,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk |
|
19c3bd62ad90682014c1c5d12b799d1c2d4a039d | Chapter5/expr.c | Chapter5/expr.c | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
// Exercise 5-11
#define MAX 1000
int pop(void);
void push(int n);
int main(int argc, char *argv[])
{
while (--argc > 0 && argv++ != NULL)
{
printf("%s\n", *argv);
if(*argv[0] == '+')
{
push(pop() + pop());
}
else if(*argv[0] == '-')
{
int x = pop();
push(pop() - x);
}
// else if(*argv[0] == '*')
// {
// int x = pop();
// push(pop() * x);
// }
else if(*argv[0] == '/')
{
int x = pop();
push(pop() / x);
}
else
{
push(atoi(*argv));
}
}
printf("%i\n", pop());
return 0;
}
// Push & Pop Functions
static int stack[MAX];
int *sp = stack;
int pop(void)
{
return *--sp;
}
void push(int n)
{
*sp++ = n;
} | Implement Exercise 5-10 for addition, subtraction, and division | Implement Exercise 5-10 for addition, subtraction, and division
| C | mit | Kunal57/C_Problems,Kunal57/C_Problems |
|
c3f5b426ad1425634ed5eb40bccd5fa6f4dabfd1 | libmue/teams.h | libmue/teams.h | #ifndef MUE__TEAMS_H
#define MUE__TEAMS_H
#include <iostream>
#include "config.h"
namespace mue {
class Team {
private:
Team_id _id;
Team() {}
public:
Team(Team_id id)
: _id(id)
{}
inline bool operator<(const Team& other) const { return _id < other._id; }
inline bool operator>(const Team& other) const { return _id > other._id; }
inline bool operator<=(const Team& other) const { return _id <= other._id; }
inline bool operator>=(const Team& other) const { return _id >= other._id; }
inline bool operator==(const Team& other) const { return _id == other._id; }
inline bool operator!=(const Team& other) const { return _id != other._id; }
inline bool operator<(const Team_id other) const { return _id < other; }
inline bool operator>(const Team_id other) const { return _id > other; }
inline bool operator<=(const Team_id other) const { return _id <= other; }
inline bool operator>=(const Team_id other) const { return _id >= other; }
inline bool operator==(const Team_id other) const { return _id == other; }
inline bool operator!=(const Team_id other) const { return _id != other; }
inline operator Team_id() const { return _id; }
inline Team_id id() const { return _id; }
};
std::ostream& operator<<(std::ostream& os, Team const& team) { return os << int(team.id()); }
}
#endif
| Add a wrapper for Team ids | Add a wrapper for Team ids
We can implement team specific functionality here if needed. At the
moment its only a wrapper for the team id.
Signed-off-by: Jan Losinski <[email protected]>
| C | bsd-3-clause | janLo/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool |
|
a17736abf56bf8c26f0ef947d5ed00afa7250c6d | tests/regression/02-base/44-malloc_array.c | tests/regression/02-base/44-malloc_array.c | // PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>
int main(void) {
int *r = malloc(5 * sizeof(int));
r[3] = 2;
assert(r[4] == 2);
} | // PARAM: --set ana.int.interval true --enable exp.partition-arrays.enabled
#include<stdlib.h>
#include<assert.h>
int main(void) {
int *r = malloc(5 * sizeof(int));
r[3] = 2;
assert(r[4] == 2);
(* Here we only test our implementation. Concretely, accessing the uninitialised r[4] is undefined behavior.
In our implementation we keep the whole memory allocated by malloc as one Blob and the whole Blob contains 2 after it was assigned to r[3].
This is more useful than keeping the Blob unknown. *)
} | Add explanation to the regression test 02 44 | Add explanation to the regression test 02 44
| C | mit | goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer |
44172f701c0842fc1a31bfa93b617b361a6d3618 | OpenAL32/Include/alError.h | OpenAL32/Include/alError.h | #ifndef _AL_ERROR_H_
#define _AL_ERROR_H_
#include "alMain.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ALboolean TrapALError;
ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
#define SET_ERROR_AND_RETURN(ctx, err) do { \
alSetError((ctx), (err)); \
return; \
} while(0)
#define SET_AND_RETURN_ERROR(ctx, err) do { \
alSetError((ctx), (err)); \
return (err); \
} while(0)
#ifdef __cplusplus
}
#endif
#endif
| #ifndef _AL_ERROR_H_
#define _AL_ERROR_H_
#include "alMain.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ALboolean TrapALError;
ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
#ifdef __cplusplus
}
#endif
#endif
| Remove a duplicate and unused macro | Remove a duplicate and unused macro
| C | lgpl-2.1 | alexxvk/openal-soft,irungentoo/openal-soft-tox,arkana-fts/openal-soft,arkana-fts/openal-soft,franklixuefei/openal-soft,franklixuefei/openal-soft,aaronmjacobs/openal-soft,BeamNG/openal-soft,aaronmjacobs/openal-soft,alexxvk/openal-soft,mmozeiko/OpenAL-Soft,Wemersive/openal-soft,mmozeiko/OpenAL-Soft,BeamNG/openal-soft,irungentoo/openal-soft-tox,Wemersive/openal-soft |
cfd41cfd0bd199672449db88d0502d37131a5c1f | test/Sema/struct-decl.c | test/Sema/struct-decl.c | // RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3459
struct bar {
char n[1];
};
struct foo {
char name[(int)&((struct bar *)0)->n];
char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}}
};
// PR3430
struct s {
struct st {
int v;
} *ts;
};
struct st;
int foo() {
struct st *f;
return f->v + f[0].v;
}
// PR3642, PR3671
struct pppoe_tag {
short tag_type;
char tag_data[];
};
struct datatag {
struct pppoe_tag hdr; //expected-warning{{field 'hdr' with variable sized type 'struct pppoe_tag' not at the end of a struct or class is a GNU extension}}
char data;
};
// PR4092
struct s0 {
char a; // expected-note {{previous declaration is here}}
char a; // expected-error {{duplicate member 'a'}}
};
struct s0 f0(void) {}
| // RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3459
struct bar {
char n[1];
};
struct foo {
char name[(int)&((struct bar *)0)->n];
char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}}
};
// PR3430
struct s {
struct st {
int v;
} *ts;
};
struct st;
int foo() {
struct st *f;
return f->v + f[0].v;
}
// PR3642, PR3671
struct pppoe_tag {
short tag_type;
char tag_data[];
};
struct datatag {
struct pppoe_tag hdr; //expected-warning{{field 'hdr' with variable sized type 'struct pppoe_tag' not at the end of a struct or class is a GNU extension}}
char data;
};
// PR4092
struct s0 {
char a; // expected-note {{previous declaration is here}}
char a; // expected-error {{duplicate member 'a'}}
};
struct s0 f0(void) {}
// <rdar://problem/8177927> - This previously triggered an assertion failure.
struct x0 {
unsigned int x1;
};
| Add test case for <rdar://problem/8177927> (which triggered an assertion failure in SemaChecking). | Add test case for <rdar://problem/8177927> (which triggered an assertion failure in SemaChecking).
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@108159 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang |
b13d509f6f8e627656f8af1bd5f262a63f31121f | lib/libncurses/termcap.h | lib/libncurses/termcap.h |
#ifndef _TERMCAP_H
#define _TERMCAP_H 1
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <sys/cdefs.h>
extern char PC;
extern char *UP;
extern char *BC;
extern short ospeed;
extern int tgetent __P((char *, const char *));
extern int tgetflag __P((const char *));
extern int tgetnum __P((const char *));
extern char *tgetstr __P((const char *, char **));
extern int tputs __P((const char *, int, int (*)(int)));
extern char *tgoto __P((const char *, int, int));
extern char *tparam __P((const char *, char *, int, ...));
#ifdef __cplusplus
}
#endif
#endif /* _TERMCAP_H */
| #ifndef _TERMCAP_H
#define _TERMCAP_H 1
#include <sys/cdefs.h>
__BEGIN_DECLS
extern char PC;
extern char *UP;
extern char *BC;
extern short ospeed;
extern int tgetent __P((char *, const char *));
extern int tgetflag __P((const char *));
extern int tgetnum __P((const char *));
extern char *tgetstr __P((const char *, char **));
extern int tputs __P((const char *, int, int (*)(int)));
extern char *tgoto __P((const char *, int, int));
extern char *tparam __P((const char *, char *, int, ...));
__END_DECLS
#endif /* _TERMCAP_H */
| Make this file more BSD-like | Make this file more BSD-like
| C | bsd-3-clause | jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase |
65aa2240dbcd526a339a88749d3fe43b0396384f | INPopoverController/INPopoverControllerDefines.h | INPopoverController/INPopoverControllerDefines.h | //
// INPopoverControllerDefines.h
// Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//
typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
INPopoverArrowDirectionUndefined = 0,
INPopoverArrowDirectionLeft = NSMaxXEdge,
INPopoverArrowDirectionRight = NSMinXEdge,
INPopoverArrowDirectionUp = NSMaxYEdge,
INPopoverArrowDirectionDown = NSMinYEdge
};
typedef NS_ENUM(NSInteger, INPopoverAnimationType) {
INPopoverAnimationTypePop = 0, // Pop animation similar to NSPopover
INPopoverAnimationTypeFadeIn, // Fade in only, no fade out
INPopoverAnimationTypeFadeOut, // Fade out only, no fade in
INPopoverAnimationTypeFadeInOut // Fade in and out
}; | //
// INPopoverControllerDefines.h
// Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//
typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
INPopoverArrowDirectionUndefined = 0,
INPopoverArrowDirectionLeft,
INPopoverArrowDirectionRight,
INPopoverArrowDirectionUp,
INPopoverArrowDirectionDown
};
typedef NS_ENUM(NSInteger, INPopoverAnimationType) {
INPopoverAnimationTypePop = 0, // Pop animation similar to NSPopover
INPopoverAnimationTypeFadeIn, // Fade in only, no fade out
INPopoverAnimationTypeFadeOut, // Fade out only, no fade in
INPopoverAnimationTypeFadeInOut // Fade in and out
}; | Remove references to NS...Edge in enum | Remove references to NS...Edge in enum
| C | bsd-2-clause | indragiek/INPopoverController |
19faea809ec3ea8a9722b0e87bb028fd23c721a1 | modlib.c | modlib.c | #include "modlib.h"
uint16_t MODBUSSwapEndian( uint16_t Data )
{
//Change big-endian to little-endian and vice versa
unsigned char Swap;
//Create 2 bytes long union
union Conversion
{
uint16_t Data;
unsigned char Bytes[2];
} Conversion;
//Swap bytes
Conversion.Data = Data;
Swap = Conversion.Bytes[0];
Conversion.Bytes[0] = Conversion.Bytes[1];
Conversion.Bytes[1] = Swap;
return Conversion.Data;
}
uint16_t MODBUSCRC16( uint16_t *Data, uint16_t Length )
{
//Calculate CRC16 checksum using given data and length
uint16_t CRC = 0xFFFF;
uint16_t i;
unsigned char j;
for ( i = 0; i < Length; i++ )
{
CRC ^= Data[i]; //XOR current data byte with CRC value
for ( j = 8; j != 0; j-- )
{
//For each bit
//Is least-significant-bit is set?
if ( ( CRC & 0x0001 ) != 0 )
{
CRC >>= 1; //Shift to right and xor
CRC ^= 0xA001;
}
else // Else LSB is not set
CRC >>= 1;
}
}
return CRC;
}
| #include "modlib.h"
uint16_t MODBUSSwapEndian( uint16_t Data )
{
//Change big-endian to little-endian and vice versa
uint8_t Swap;
//Create 2 bytes long union
union Conversion
{
uint16_t Data;
uint8_t Bytes[2];
} Conversion;
//Swap bytes
Conversion.Data = Data;
Swap = Conversion.Bytes[0];
Conversion.Bytes[0] = Conversion.Bytes[1];
Conversion.Bytes[1] = Swap;
return Conversion.Data;
}
uint16_t MODBUSCRC16( uint16_t *Data, uint16_t Length )
{
//Calculate CRC16 checksum using given data and length
uint16_t CRC = 0xFFFF;
uint16_t i;
uint8_t j;
for ( i = 0; i < Length; i++ )
{
CRC ^= Data[i]; //XOR current data byte with CRC value
for ( j = 8; j != 0; j-- )
{
//For each bit
//Is least-significant-bit is set?
if ( ( CRC & 0x0001 ) != 0 )
{
CRC >>= 1; //Shift to right and xor
CRC ^= 0xA001;
}
else // Else LSB is not set
CRC >>= 1;
}
}
return CRC;
}
| Change 'unsigned character' type variables to 'uint8_t' | Change 'unsigned character' type variables to 'uint8_t'
| C | mit | Jacajack/modlib |
cfd3fbd42385ff035bfc873db0ea882ea12709a7 | src/google/protobuf/stubs/atomicops_internals_pnacl.h | src/google/protobuf/stubs/atomicops_internals_pnacl.h | // Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is an internal atomic implementation, use atomicops.h instead.
#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
namespace google {
namespace protobuf {
namespace internal {
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
return __sync_val_compare_and_swap(ptr, old_value, new_value);
}
inline void MemoryBarrier() {
__sync_synchronize();
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
MemoryBarrier();
return ret;
}
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
}
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
Atomic32 value = *ptr;
MemoryBarrier();
return value;
}
} // namespace internal
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
| Add the missing PNaCl atomicops support. | Add the missing PNaCl atomicops support.
git-svn-id: 54a00c96d7caad0f188abf6e0ebede48f6547068@462 630680e5-0e50-0410-840e-4b1c322b438d
| C | bsd-3-clause | tdfischer/protobuf,tdfischer/protobuf,tdfischer/protobuf,tdfischer/protobuf,tdfischer/protobuf |
|
1cf5ce1609ef6830483199706fcd10028ad07d2d | apps/examples/nxp_example/nxp_demo_sample_main.c | apps/examples/nxp_example/nxp_demo_sample_main.c | /* ****************************************************************
*
* Copyright 2019 NXP Semiconductors 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 agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#include <tinyara/config.h>
#include <stdio.h>
extern void imxrt_log_print_kernelbuffer();
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int nxp_demo_sample_main(int argc, char *argv[])
#endif
{
printf("[New] nxp_demo_sample!!\n");
imxrt_log_print_kernelbuffer();
return 0;
}
| /* ****************************************************************
*
* Copyright 2019 NXP Semiconductors 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 agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#include <tinyara/config.h>
#include <stdio.h>
extern void imxrt_log_print_kernelbuffer();
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int nxp_demo_sample_main(int argc, char *argv[])
#endif
{
printf("[New] nxp_demo_sample!!\n");
#ifndef CONFIG_BUILD_PROTECTED
imxrt_log_print_kernelbuffer();
#endif
return 0;
}
| Fix NXP example app for Protected build | apps/examples/nxp_example: Fix NXP example app for Protected build
Remove direct call to kernel API from NXP example app in case of
protected build.
Signed-off-by: Kishore S N <[email protected]>
| C | apache-2.0 | Samsung/TizenRT,jeongchanKim/TizenRT,sunghan-chang/TizenRT,chanijjani/TizenRT,jsdosa/TizenRT,an4967/TizenRT,an4967/TizenRT,jsdosa/TizenRT,an4967/TizenRT,jeongarmy/TizenRT,Samsung/TizenRT,junmin-kim/TizenRT,sunghan-chang/TizenRT,sunghan-chang/TizenRT,chanijjani/TizenRT,davidfather/TizenRT,junmin-kim/TizenRT,junmin-kim/TizenRT,junmin-kim/TizenRT,Samsung/TizenRT,jsdosa/TizenRT,an4967/TizenRT,jeongchanKim/TizenRT,pillip8282/TizenRT,davidfather/TizenRT,jeongarmy/TizenRT,Samsung/TizenRT,pillip8282/TizenRT,jeongchanKim/TizenRT,pillip8282/TizenRT,jeongarmy/TizenRT,jeongarmy/TizenRT,jeongchanKim/TizenRT,chanijjani/TizenRT,jeongarmy/TizenRT,Samsung/TizenRT,davidfather/TizenRT,chanijjani/TizenRT,davidfather/TizenRT,pillip8282/TizenRT,jsdosa/TizenRT,jsdosa/TizenRT,davidfather/TizenRT,jsdosa/TizenRT,chanijjani/TizenRT,davidfather/TizenRT,jsdosa/TizenRT,an4967/TizenRT,pillip8282/TizenRT,sunghan-chang/TizenRT,pillip8282/TizenRT,pillip8282/TizenRT,junmin-kim/TizenRT,jeongchanKim/TizenRT,sunghan-chang/TizenRT,davidfather/TizenRT,jeongchanKim/TizenRT,Samsung/TizenRT,sunghan-chang/TizenRT,junmin-kim/TizenRT,Samsung/TizenRT,an4967/TizenRT,junmin-kim/TizenRT,jeongchanKim/TizenRT,chanijjani/TizenRT,jeongarmy/TizenRT,sunghan-chang/TizenRT,chanijjani/TizenRT,jeongarmy/TizenRT,an4967/TizenRT |
5d482ef3550d124297fb641597774d9c1a994621 | src/ippusbd.c | src/ippusbd.c | #include <stdio.h>
#include <stdlib.h>
#include "http/http.h"
int main(int argc, char *argv[])
{
http_sock *sock = open_http();
if (sock == NULL)
goto cleanup;
// TODO: print port then fork
uint32_t port = get_port_number(sock);
printf("%u\n", port);
while (1) {
http_conn *conn = accept_conn(sock);
if (conn == NULL) {
ERR("Opening connection failed");
goto conn_error;
}
message *msg = get_message(conn);
if (msg == NULL) {
ERR("Generating message failed");
goto conn_error;
}
packet *pkt = get_packet(msg);
if (pkt == NULL) {
ERR("Receiving packet failed");
goto conn_error;
}
printf("%.*s", (int)pkt->size, pkt->buffer);
conn_error:
if (conn != NULL)
free(conn);
if (msg != NULL)
free(msg);
}
cleanup:
if (sock != NULL)
close_http(sock);
return 1;
}
| #include <stdio.h>
#include <stdlib.h>
#include "http/http.h"
int main(int argc, char *argv[])
{
http_sock *sock = open_http();
if (sock == NULL)
goto cleanup;
// TODO: print port then fork
uint32_t port = get_port_number(sock);
printf("%u\n", port);
while (1) {
http_conn *conn = accept_conn(sock);
if (conn == NULL) {
ERR("Opening connection failed");
goto conn_error;
}
message *msg = get_message(conn);
if (msg == NULL) {
ERR("Generating message failed");
goto conn_error;
}
packet *pkt = get_packet(msg);
if (pkt == NULL) {
ERR("Receiving packet failed");
goto conn_error;
}
printf("%.*s", (int)pkt->size, pkt->buffer);
conn_error:
if (conn != NULL)
free(conn);
if (msg != NULL)
free(msg);
}
cleanup:
if (sock != NULL)
close_http(sock);
return 0;
}
| Fix main exiting with error code on error-less run | Fix main exiting with error code on error-less run
Comandline programs expect 0 as errror-less return
value. This is in contrast to C where we treat 0
or NULL as an error token.
| C | apache-2.0 | daniel-dressler/ippusbxd,tillkamppeter/ippusbxd |
bf67ee6399ea6fa8cb3723d29f44c5c6a4d5f118 | attiny-blink/main.c | attiny-blink/main.c | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
// A simple blinky program for ATtiny85
// Connect red LED at pin 2 (PB3)
//
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// set PB3 to be output
DDRB = 0b00001000;
while (1) {
// flash# 1:
// set PB3 high
PORTB = 0b00001000;
_delay_ms(200);
// set PB3 low
PORTB = 0b00000000;
_delay_ms(200);
// flash# 2:
// set PB3 high
PORTB = 0b00001000;
_delay_ms(1000);
// set PB3 low
PORTB = 0b00000000;
_delay_ms(1000);
// flash# 3:
// set PB3 high
PORTB = 0b00001000;
_delay_ms(3000);
// set PB3 low
PORTB = 0b00000000;
_delay_ms(3000);
}
return 1;
} | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
// A simple blinky program for ATtiny85
// Connect red LED at pin 3 (PB4)
//
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
// set PB4 to be output
DDRB = 0b00001000;
while (1) {
// flash# 1:
// set PB4 high
PORTB = 0b00010000;
_delay_ms(200);
// set PB4 low
PORTB = 0b00000000;
_delay_ms(200);
// flash# 2:
// set PB4 high
PORTB = 0b00010000;
_delay_ms(1000);
// set PB4 low
PORTB = 0b00000000;
_delay_ms(1000);
// flash# 3:
// set PB4 high
PORTB = 0b00010000;
_delay_ms(3000);
// set PB4 low
PORTB = 0b00000000;
_delay_ms(3000);
}
return 1;
}
| Change blink program to use pb4 since that's the pin the test LED is wired to on my programming board | Change blink program to use pb4 since that's the pin the test LED
is wired to on my programming board
| C | mit | thecav/avr-projects |
b22391787ec21c5d40e545a59ad5780ea8f03868 | chrome/gpu/gpu_config.h | chrome/gpu/gpu_config.h | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#include "build/build_config.h"
#if defined(OS_LINUX) && !defined(ARCH_CPU_X86)
// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX
#endif
#endif // CHROME_GPU_GPU_CONFIG_H_
| // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#include "build/build_config.h"
#if defined(OS_LINUX) && defined(ARCH_CPU_X86)
// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX
#endif
#endif // CHROME_GPU_GPU_CONFIG_H_
| Fix stupid error for Linux build. | Fix stupid error for Linux build.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/555096
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@37093 0039d316-1c4b-4281-b951-d872f2087c98
| C | bsd-3-clause | ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,adobe/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,adobe/chromium |
947c20e1a982439cc3682234b34c8d3611d9251c | src/lassert.h | src/lassert.h | /*
* Copyright (C) 2007
* Jacob Berkman
* Copyright (C) 2008
* Ludovic Rousseau <[email protected]>
*/
#ifndef LASSERT_H
#define LASSERT_H
#include <stdio.h>
#include <stdlib.h>
#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif
#define LASSERT(cond) \
({ \
if (cond) \
; \
else { \
fprintf (stderr, "%s:%d: assertion FAILED: " #cond "\n", \
__FILE__, __LINE__); \
FAIL; \
} \
})
#define LASSERTF(cond, fmt, a...) \
({ \
if (cond) \
; \
else { \
fprintf (stderr, "%s:%d: assertion FAILED: " #cond ": " fmt, \
__FILE__, __LINE__, ## a); \
FAIL; \
} \
})
#endif /* LASSERT_H */
| /*
* Copyright (C) 2007
* Jacob Berkman
* Copyright (C) 2008
* Ludovic Rousseau <[email protected]>
*/
#ifndef LASSERT_H
#define LASSERT_H
#include <stdio.h>
#include <stdlib.h>
#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif
#define LASSERT(cond) \
({ \
if (! (cond)) \
{ \
fprintf (stderr, "%s:%d: assertion FAILED: " #cond "\n", \
__FILE__, __LINE__); \
FAIL; \
} \
})
#define LASSERTF(cond, fmt, a...) \
({ \
if (! (cond)) \
{ \
fprintf (stderr, "%s:%d: assertion FAILED: " #cond ": " fmt, \
__FILE__, __LINE__, ## a); \
FAIL; \
} \
})
#endif /* LASSERT_H */
| Fix splint error src/pcsc-wirecheck-dist.c:19:164: Body of if clause of if statement is empty | Fix splint error
src/pcsc-wirecheck-dist.c:19:164: Body of if clause of if statement is empty
git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@4755 0ce88b0d-b2fd-0310-8134-9614164e65ea
| C | bsd-3-clause | vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android |
3fb9e3a841f15e5c84a860f5a3836fce628adfea | genlib/delput.c | genlib/delput.c | void
delput(float x, float *a, int *l)
{
/* put value in delay line. See delset. x is float */
*(a + (*l)++) = x;
if(*(l) >= *(l+1)) *l -= *(l+1);
}
| /* put value in delay line. See delset. x is float */
void
delput(float x, float *a, int *l)
{
int index = l[0];
a[index] = x;
l[0]++;
if (l[0] >= l[2])
l[0] -= l[2];
}
| Update to new bookkeeping array format. | Update to new bookkeeping array format.
| C | apache-2.0 | RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix,RTcmix/RTcmix |
21bdc56b1b94dcfc9badf80b544ac7b28155aa18 | include/error.h | include/error.h | #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAILURE,
OPERATION_TIMEDOUT,
PROXY_RESOLUTION_FAILURE,
SSL_CONNECT_ERROR,
SSL_LOCAL_CERTIFICATE_ERROR,
SSL_REMOTE_CERTIFICATE_ERROR,
SSL_CACERT_ERROR,
GENERIC_SSL_ERROR,
UNSUPPORTED_PROTOCOL,
UNKNOWN_ERROR = 1000,
};
class Error {
public:
Error() : code{ErrorCode::OK} {}
template <typename TextType>
Error(const ErrorCode& p_error_code, TextType&& p_error_message)
: code{p_error_code}, message{CPR_FWD(p_error_message)} {}
explicit operator bool() const {
return code != ErrorCode::OK;
}
ErrorCode code;
std::string message;
private:
static ErrorCode getErrorCodeForCurlError(int curl_code);
};
} // namespace cpr
#endif
| #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAILURE,
OPERATION_TIMEDOUT,
PROXY_RESOLUTION_FAILURE,
SSL_CONNECT_ERROR,
SSL_LOCAL_CERTIFICATE_ERROR,
SSL_REMOTE_CERTIFICATE_ERROR,
SSL_CACERT_ERROR,
GENERIC_SSL_ERROR,
UNSUPPORTED_PROTOCOL,
UNKNOWN_ERROR = 1000,
};
class Error {
public:
Error() : code{ErrorCode::OK} {}
template <typename TextType>
Error(const int& curl_code, TextType&& p_error_message)
: code{getErrorCodeForCurlError(curl_code)}, message{CPR_FWD(p_error_message)} {}
explicit operator bool() const {
return code != ErrorCode::OK;
}
ErrorCode code;
std::string message;
private:
static ErrorCode getErrorCodeForCurlError(int curl_code);
};
} // namespace cpr
#endif
| Make constructor for taking in curl code as the first argument | Make constructor for taking in curl code as the first argument
| C | mit | SuperV1234/cpr,whoshuu/cpr,whoshuu/cpr,SuperV1234/cpr,msuvajac/cpr,whoshuu/cpr,msuvajac/cpr,msuvajac/cpr,SuperV1234/cpr |
596412310fc7bdf9af2eacfeb4c281d544c2195e | include/polar/support/audio/waveshape.h | include/polar/support/audio/waveshape.h | #pragma once
#include <array>
class WaveShape {
public:
static const unsigned int granularity = 12;
static const int16_t size = 1 << granularity;
std::array<int16_t, size> table = {{0}};
};
inline WaveShape MkSineWaveShape() {
WaveShape waveShape;
for(unsigned int i = 0; i < WaveShape::size; ++i) {
double sample = sin(i * 2.0 * 3.14159265358979 / WaveShape::size);
waveShape.table[i] =
static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
}
return waveShape;
}
inline WaveShape MkSquareWaveShape() {
WaveShape waveShape;
for(unsigned int i = 0; i < WaveShape::size; ++i) {
double sample = i * 2 < WaveShape::size ? 1.0 : -1.0;
waveShape.table[i] =
static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
}
return waveShape;
}
| #pragma once
#include <array>
#include <polar/math/constants.h>
class WaveShape {
public:
static const unsigned int granularity = 12;
static const int16_t size = 1 << granularity;
std::array<int16_t, size> table = {{0}};
};
inline WaveShape MkSineWaveShape() {
WaveShape waveShape;
for(unsigned int i = 0; i < WaveShape::size; ++i) {
double sample = sin(i * polar::math::TWO_PI / WaveShape::size);
waveShape.table[i] =
static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
}
return waveShape;
}
inline WaveShape MkSquareWaveShape() {
WaveShape waveShape;
for(unsigned int i = 0; i < WaveShape::size; ++i) {
double sample = i * 2 < WaveShape::size ? 1.0 : -1.0;
waveShape.table[i] =
static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
}
return waveShape;
}
| Use TWO_PI constant instead of literal | Use TWO_PI constant instead of literal
| C | mpl-2.0 | shockkolate/polar4,polar-engine/polar,polar-engine/polar,shockkolate/polar4,shockkolate/polar4,shockkolate/polar4 |
faec0b3de34380c9d15033ef8e2d4b62dc2a3691 | cbits/hdbc-odbc-helper.c | cbits/hdbc-odbc-helper.c | #include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>
SQLLEN nullDataHDBC = SQL_NULL_DATA;
int sqlSucceeded(SQLRETURN ret) {
return SQL_SUCCEEDED(ret);
}
void *getSqlOvOdbc3(void) {
return (void *)SQL_OV_ODBC3;
}
SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
return SQLTables(stmt, NULL, 0, NULL, 0, "%", 1, "TABLE", 5);
}
SQLRETURN simpleSqlColumns(SQLHSTMT stmt, SQLCHAR *tablename,
SQLSMALLINT tnlen) {
return SQLColumns(stmt, NULL, 0, NULL, 0, tablename, tnlen, "%", 1);
}
| #include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>
SQLLEN nullDataHDBC = SQL_NULL_DATA;
int sqlSucceeded(SQLRETURN ret) {
return SQL_SUCCEEDED(ret);
}
void *getSqlOvOdbc3(void) {
return (void *)SQL_OV_ODBC3;
}
SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
return SQLTables(stmt, NULL, 0, NULL, 0, (SQLCHAR *)"%", 1, (SQLCHAR *)"TABLE", 5);
}
SQLRETURN simpleSqlColumns(SQLHSTMT stmt, SQLCHAR *tablename,
SQLSMALLINT tnlen) {
return SQLColumns(stmt, NULL, 0, NULL, 0, tablename, tnlen, (SQLCHAR *)"%", 1);
}
| Add explicit cast from (const char []) to (SQLCHAR *) | Add explicit cast from (const char []) to (SQLCHAR *)
| C | bsd-3-clause | hdbc/hdbc-odbc |
4263a8238353aeef9721f826c5b6c55d81ddca1f | src/shacpuid.c | src/shacpuid.c | /**
* cpuid.c
*
* Checks if CPU has support of SHA instructions
*
* @author [email protected]
* @version 4.0
*
* For Putty AES NI project
* http://putty-aes-ni.googlecode.com/
*/
#ifndef SILENT
#include <stdio.h>
#endif
#if defined(__clang__) || defined(__GNUC__)
#include <cpuid.h>
static int CheckCPUsupportSHA()
{
unsigned int CPUInfo[4];
__cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
return CPUInfo[1] & (1 << 29); /* Check SHA */
}
#else /* defined(__clang__) || defined(__GNUC__) */
static int CheckCPUsupportSHA()
{
unsigned int CPUInfo[4];
__cpuidex(CPUInfo, 7, 0);
return CPUInfo[1] & (1 << 29); /* Check SHA */
}
#endif /* defined(__clang__) || defined(__GNUC__) */
int main(int argc, char ** argv)
{
const int res = !CheckCPUsupportSHA();
#ifndef SILENT
printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
return res;
}
| /**
* cpuid.c
*
* Checks if CPU has support of SHA instructions
*
* @author [email protected]
* @version 4.0
*
* For Putty AES NI project
* http://putty-aes-ni.googlecode.com/
*/
#ifndef SILENT
#include <stdio.h>
#endif
#if defined(__clang__) || defined(__GNUC__)
#include <cpuid.h>
static int CheckCPUsupportSHA()
{
unsigned int CPUInfo[4];
__cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
if (CPUInfo[0] < 7)
return 0;
__cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
return CPUInfo[1] & (1 << 29); /* Check SHA */
}
#else /* defined(__clang__) || defined(__GNUC__) */
static int CheckCPUsupportSHA()
{
unsigned int CPUInfo[4];
__cpuid(CPUInfo, 0);
if (CPUInfo[0] < 7)
return 0;
__cpuidex(CPUInfo, 7, 0);
return CPUInfo[1] & (1 << 29); /* Check SHA */
}
#endif /* defined(__clang__) || defined(__GNUC__) */
int main(int argc, char ** argv)
{
const int res = !CheckCPUsupportSHA();
#ifndef SILENT
printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
return res;
}
| Add leaf checks to SHA CPUID checks | Add leaf checks to SHA CPUID checks
| C | mit | pavelkryukov/putty-aes-ni,pavelkryukov/putty-aes-ni |
9be7ffc5fc9e54253f2b82ff6ff4c68ea816dd88 | include/picrin/gc.h | include/picrin/gc.h | /**
* See Copyright Notice in picrin.h
*/
#ifndef GC_H__
#define GC_H__
#if defined(__cplusplus)
extern "C" {
#endif
enum pic_gc_mark {
PIC_GC_UNMARK = 0,
PIC_GC_MARK
};
union header {
struct {
union header *ptr;
size_t size;
enum pic_gc_mark mark : 1;
} s;
long alignment[2];
};
struct heap_page {
union header *basep, *endp;
struct heap_page *next;
};
struct pic_heap {
union header base, *freep;
struct heap_page *pages;
};
void init_heap(struct pic_heap *);
void finalize_heap(struct pic_heap *);
#if defined(__cplusplus)
}
#endif
#endif
| /**
* See Copyright Notice in picrin.h
*/
#ifndef GC_H__
#define GC_H__
#if defined(__cplusplus)
extern "C" {
#endif
#define PIC_GC_UNMARK 0
#define PIC_GC_MARK 1
union header {
struct {
union header *ptr;
size_t size;
unsigned int mark : 1;
} s;
long alignment[2];
};
struct heap_page {
union header *basep, *endp;
struct heap_page *next;
};
struct pic_heap {
union header base, *freep;
struct heap_page *pages;
};
void init_heap(struct pic_heap *);
void finalize_heap(struct pic_heap *);
#if defined(__cplusplus)
}
#endif
#endif
| Define the type of marking flags as unsigned int. | Define the type of marking flags as unsigned int.
We could define it as _Bool since we are going to use C99, but unsigned
int is more portable (even in C89!) and extensible (when we decide to
use tri-color marking GC.)
Signed-off-by: OGINO Masanori <[email protected]>
| C | mit | dcurrie/picrin,leavesbnw/picrin,omasanori/picrin,picrin-scheme/picrin,koba-e964/picrin,ktakashi/picrin,omasanori/picrin,picrin-scheme/picrin,koba-e964/picrin,dcurrie/picrin,koba-e964/picrin,leavesbnw/picrin,leavesbnw/picrin,ktakashi/picrin,ktakashi/picrin |
298143ebdfd55f83c7493760bf3d844a4ac8325a | include/core/SkMilestone.h | include/core/SkMilestone.h | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 63
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 64
#endif
| Update Skia milestone to 64 | Update Skia milestone to 64
Bug: skia:
Change-Id: I381323606f92a5388b3fd76c232e35c492a23dc4
Reviewed-on: https://skia-review.googlesource.com/58840
Reviewed-by: Heather Miller <[email protected]>
Commit-Queue: Heather Miller <[email protected]>
| C | bsd-3-clause | google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,HalCanary/skia-hc,rubenvb/skia,google/skia,aosp-mirror/platform_external_skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,HalCanary/skia-hc,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,rubenvb/skia,rubenvb/skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,google/skia,rubenvb/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,Hikari-no-Tenshi/android_external_skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,rubenvb/skia,rubenvb/skia,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,google/skia,Hikari-no-Tenshi/android_external_skia,google/skia,rubenvb/skia,google/skia,HalCanary/skia-hc,rubenvb/skia,google/skia |
deac801de98be4974cfe806eb4bc072f34f81cc5 | include/git2/checkout.h | include/git2/checkout.h | /*
* Copyright (C) 2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__
#include "common.h"
#include "types.h"
#include "indexer.h"
/**
* @file git2/checkout.h
* @brief Git checkout routines
* @defgroup git_checkout Git checkout routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
/**
* Updates files in the working tree to match the version in the index
* or HEAD.
*
* @param repo repository to check out (must be non-bare)
* @param origin_url repository to clone from
* @param workdir_path local directory to clone to
* @param stats pointer to structure that receives progress information (may be NULL)
* @return 0 on success, GIT_ERROR otherwise (use git_error_last for information about the error)
*/
GIT_EXTERN(int) git_checkout_force(git_repository *repo, git_indexer_stats *stats);
/** @} */
GIT_END_DECL
#endif
| /*
* Copyright (C) 2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__
#include "common.h"
#include "types.h"
#include "indexer.h"
/**
* @file git2/checkout.h
* @brief Git checkout routines
* @defgroup git_checkout Git checkout routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
/**
* Updates files in the working tree to match the version in the index.
*
* @param repo repository to check out (must be non-bare)
* @param stats pointer to structure that receives progress information (may be NULL)
* @return 0 on success, GIT_ERROR otherwise (use git_error_last for information about the error)
*/
GIT_EXTERN(int) git_checkout_force(git_repository *repo, git_indexer_stats *stats);
/** @} */
GIT_END_DECL
#endif
| Fix documentation comment to match actual params. | Fix documentation comment to match actual params. | C | lgpl-2.1 | jeffhostetler/public_libgit2,kenprice/libgit2,raybrad/libit2,mrksrm/Mingijura,Snazz2001/libgit2,Tousiph/Demo1,magnus98/TEST,claudelee/libgit2,Aorjoa/libgit2_maked_lib,nokiddin/libgit2,claudelee/libgit2,chiayolin/libgit2,rcorre/libgit2,yosefhackmon/libgit2,linquize/libgit2,sygool/libgit2,ardumont/libgit2,jflesch/libgit2-mariadb,yosefhackmon/libgit2,Tousiph/Demo1,claudelee/libgit2,kenprice/libgit2,skabel/manguse,KTXSoftware/libgit2,yosefhackmon/libgit2,mingyaaaa/libgit2,dleehr/libgit2,claudelee/libgit2,maxiaoqian/libgit2,spraints/libgit2,stewid/libgit2,maxiaoqian/libgit2,iankronquist/libgit2,oaastest/libgit2,kissthink/libgit2,yongthecoder/libgit2,sygool/libgit2,mcanthony/libgit2,jeffhostetler/public_libgit2,sygool/libgit2,linquize/libgit2,ardumont/libgit2,swisspol/DEMO-libgit2,KTXSoftware/libgit2,swisspol/DEMO-libgit2,saurabhsuniljain/libgit2,stewid/libgit2,KTXSoftware/libgit2,mrksrm/Mingijura,leoyanggit/libgit2,jflesch/libgit2-mariadb,mcanthony/libgit2,jeffhostetler/public_libgit2,since2014/libgit2,magnus98/TEST,skabel/manguse,mcanthony/libgit2,iankronquist/libgit2,sygool/libgit2,whoisj/libgit2,linquize/libgit2,JIghtuse/libgit2,oaastest/libgit2,jamieleecool/ptest,magnus98/TEST,Snazz2001/libgit2,nacho/libgit2,dleehr/libgit2,whoisj/libgit2,jflesch/libgit2-mariadb,iankronquist/libgit2,amyvmiwei/libgit2,Snazz2001/libgit2,sim0629/libgit2,iankronquist/libgit2,saurabhsuniljain/libgit2,Snazz2001/libgit2,magnus98/TEST,falqas/libgit2,skabel/manguse,oaastest/libgit2,MrHacky/libgit2,amyvmiwei/libgit2,evhan/libgit2,jamieleecool/ptest,kissthink/libgit2,zodiac/libgit2.js,maxiaoqian/libgit2,maxiaoqian/libgit2,linquize/libgit2,yongthecoder/libgit2,joshtriplett/libgit2,saurabhsuniljain/libgit2,amyvmiwei/libgit2,maxiaoqian/libgit2,maxiaoqian/libgit2,swisspol/DEMO-libgit2,Aorjoa/libgit2_maked_lib,leoyanggit/libgit2,iankronquist/libgit2,since2014/libgit2,t0xicCode/libgit2,t0xicCode/libgit2,evhan/libgit2,KTXSoftware/libgit2,jeffhostetler/public_libgit2,whoisj/libgit2,chiayolin/libgit2,Tousiph/Demo1,mhp/libgit2,saurabhsuniljain/libgit2,zodiac/libgit2.js,raybrad/libit2,JIghtuse/libgit2,Aorjoa/libgit2_maked_lib,sim0629/libgit2,Aorjoa/libgit2_maked_lib,since2014/libgit2,spraints/libgit2,Corillian/libgit2,mhp/libgit2,nokiddin/libgit2,zodiac/libgit2.js,saurabhsuniljain/libgit2,Snazz2001/libgit2,swisspol/DEMO-libgit2,leoyanggit/libgit2,mrksrm/Mingijura,rcorre/libgit2,leoyanggit/libgit2,sygool/libgit2,zodiac/libgit2.js,skabel/manguse,whoisj/libgit2,ardumont/libgit2,ardumont/libgit2,leoyanggit/libgit2,t0xicCode/libgit2,MrHacky/libgit2,dleehr/libgit2,spraints/libgit2,nokiddin/libgit2,yosefhackmon/libgit2,mhp/libgit2,nacho/libgit2,evhan/libgit2,linquize/libgit2,chiayolin/libgit2,JIghtuse/libgit2,claudelee/libgit2,t0xicCode/libgit2,MrHacky/libgit2,Corillian/libgit2,mcanthony/libgit2,nokiddin/libgit2,kissthink/libgit2,whoisj/libgit2,spraints/libgit2,jamieleecool/ptest,falqas/libgit2,kissthink/libgit2,chiayolin/libgit2,stewid/libgit2,rcorre/libgit2,oaastest/libgit2,t0xicCode/libgit2,mrksrm/Mingijura,falqas/libgit2,joshtriplett/libgit2,falqas/libgit2,Tousiph/Demo1,skabel/manguse,nacho/libgit2,mcanthony/libgit2,stewid/libgit2,chiayolin/libgit2,jflesch/libgit2-mariadb,mingyaaaa/libgit2,rcorre/libgit2,claudelee/libgit2,kenprice/libgit2,Snazz2001/libgit2,Tousiph/Demo1,nokiddin/libgit2,sim0629/libgit2,chiayolin/libgit2,kenprice/libgit2,dleehr/libgit2,yongthecoder/libgit2,raybrad/libit2,mingyaaaa/libgit2,MrHacky/libgit2,dleehr/libgit2,joshtriplett/libgit2,sim0629/libgit2,Corillian/libgit2,Aorjoa/libgit2_maked_lib,mingyaaaa/libgit2,iankronquist/libgit2,nacho/libgit2,joshtriplett/libgit2,sygool/libgit2,spraints/libgit2,mingyaaaa/libgit2,sim0629/libgit2,swisspol/DEMO-libgit2,rcorre/libgit2,KTXSoftware/libgit2,skabel/manguse,MrHacky/libgit2,jeffhostetler/public_libgit2,evhan/libgit2,stewid/libgit2,raybrad/libit2,kenprice/libgit2,since2014/libgit2,kissthink/libgit2,mcanthony/libgit2,Corillian/libgit2,mingyaaaa/libgit2,JIghtuse/libgit2,yongthecoder/libgit2,raybrad/libit2,ardumont/libgit2,zodiac/libgit2.js,joshtriplett/libgit2,jflesch/libgit2-mariadb,oaastest/libgit2,JIghtuse/libgit2,joshtriplett/libgit2,yosefhackmon/libgit2,saurabhsuniljain/libgit2,KTXSoftware/libgit2,swisspol/DEMO-libgit2,mrksrm/Mingijura,rcorre/libgit2,amyvmiwei/libgit2,t0xicCode/libgit2,falqas/libgit2,since2014/libgit2,jflesch/libgit2-mariadb,mrksrm/Mingijura,yosefhackmon/libgit2,Corillian/libgit2,linquize/libgit2,mhp/libgit2,JIghtuse/libgit2,magnus98/TEST,mhp/libgit2,yongthecoder/libgit2,Corillian/libgit2,ardumont/libgit2,amyvmiwei/libgit2,Tousiph/Demo1,stewid/libgit2,magnus98/TEST,mhp/libgit2,MrHacky/libgit2,leoyanggit/libgit2,jamieleecool/ptest,spraints/libgit2,since2014/libgit2,kissthink/libgit2,nokiddin/libgit2,jeffhostetler/public_libgit2,dleehr/libgit2,amyvmiwei/libgit2,oaastest/libgit2,whoisj/libgit2,kenprice/libgit2,yongthecoder/libgit2,sim0629/libgit2,falqas/libgit2 |
3ad1e0624ea2b38329fb3e2ff0ddaaeec89d13a7 | SocketIOJSONSerialization.h | SocketIOJSONSerialization.h | //
// SocketIOJSONSerialization.h
// v0.22 ARC
//
// based on
// socketio-cocoa https://github.com/fpotter/socketio-cocoa
// by Fred Potter <[email protected]>
//
// using
// https://github.com/square/SocketRocket
// https://github.com/stig/json-framework/
//
// reusing some parts of
// /socket.io/socket.io.js
//
// Created by Philipp Kyeck http://beta-interactive.de
//
// Updated by
// samlown https://github.com/samlown
// kayleg https://github.com/kayleg
//
#import <Foundation/Foundation.h>
@interface SocketIOJSONSerialization
+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error;
+ (NSString *) JSONStringFromObject:(id)object error:(NSError **)error;
@end
| //
// SocketIOJSONSerialization.h
// v0.22 ARC
//
// based on
// socketio-cocoa https://github.com/fpotter/socketio-cocoa
// by Fred Potter <[email protected]>
//
// using
// https://github.com/square/SocketRocket
// https://github.com/stig/json-framework/
//
// reusing some parts of
// /socket.io/socket.io.js
//
// Created by Philipp Kyeck http://beta-interactive.de
//
// Updated by
// samlown https://github.com/samlown
// kayleg https://github.com/kayleg
//
#import <Foundation/Foundation.h>
@interface SocketIOJSONSerialization : NSObject
+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error;
+ (NSString *) JSONStringFromObject:(id)object error:(NSError **)error;
@end
| Fix for totally bogus interface declaration | Fix for totally bogus interface declaration
In my rush to refactor JSON serialization, I made a new class that doesn't inherit from NSObject. Why this
is a) allowed, b) doesn't result in epic failure on OS X is beyond me.
| C | mit | diy/socket.IO-objc,wait10000y/socket.IO-objc,francoisp/socket.IO-objc,vgmoose/ProxiChat |
ba649056cf506b2b6e80f58f0b71d32468f85d34 | src/host/os_rmdir.c | src/host/os_rmdir.c | /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z = rmdir(path);
#endif
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to remove directory '%s'", path);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
}
| /**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z = (0 == rmdir(path));
#endif
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to remove directory '%s'", path);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
}
| Fix error result handling in os.rmdir() | Fix error result handling in os.rmdir()
| C | bsd-3-clause | dimitarcl/premake-dev,dimitarcl/premake-dev,dimitarcl/premake-dev |
54d49c21102d0a37d72b795be125640b8ab3d4b4 | includes/linux/InotifyService.h | includes/linux/InotifyService.h | #ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H
#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>
class InotifyEventLoop;
class InotifyTree;
class InotifyService {
public:
InotifyService(std::string path);
~InotifyService();
void create(int wd, std::string name);
void createDirectory(int wd, std::string name);
void modify(int wd, std::string name);
void remove(int wd, std::string name);
void removeDirectory(int wd);
void rename(int wd, std::string oldName, std::string newName);
void renameDirectory(int wd, std::string oldName, std::string newName);
private:
void createDirectoryTree(std::string directoryTreePath);
InotifyEventLoop *mEventLoop;
InotifyTree *mTree;
int mInotifyInstance;
int mAttributes;
};
#endif
| #ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H
#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>
class InotifyEventLoop;
class InotifyTree;
class InotifyService {
public:
InotifyService(std::string path);
~InotifyService();
private:
void create(int wd, std::string name);
void createDirectory(int wd, std::string name);
void createDirectoryTree(std::string directoryTreePath);
void modify(int wd, std::string name);
void remove(int wd, std::string name);
void removeDirectory(int wd);
void rename(int wd, std::string oldName, std::string newName);
void renameDirectory(int wd, std::string oldName, std::string newName);
InotifyEventLoop *mEventLoop;
InotifyTree *mTree;
int mInotifyInstance;
int mAttributes;
friend class InotifyEventLoop;
};
#endif
| Hide internal methods using friend class specifier | Hide internal methods using friend class specifier
| C | mit | Axosoft/node-sentinel-file-watcher,Axosoft/nsfw,Axosoft/nsfw,Axosoft/nsfw,Axosoft/node-sentinel-file-watcher,Axosoft/node-sentinel-file-watcher,Axosoft/node-sentinel-file-watcher |
c5f51ac16b113923162c442e1234223ab528c7d4 | src/include/gnugol_engines.h | src/include/gnugol_engines.h | #ifndef _gnugol_engines
#define _gnugol_engines 1
#ifdef DEBUG_SHAREDLIBS
# define GNUGOL_SHAREDLIBDIR "../engines"
#else
# define GNUGOL_SHAREDLIBDIR "/var/lib/gnugol"
#endif
typedef struct ggengine
{
Node node;
void *lib;
const char *name;
int (*setup) (QueryOptions_t *);
int (*search)(QueryOptions_t *);
} *GnuGolEngine;
GnuGoldEngine gnugol_engine_load (const char *);
int gnugol_engine_query (GnuGolEngine,QueryOptions_t *);
void gnugol_engine_unload (GnuGolEngine);
int gnugol_read_key (char *const,size_t *const,const char *const);
#endif
| #ifndef _gnugol_engines
#define _gnugol_engines 1
#include "nodelist.h"
#ifdef DEBUG_SHAREDLIBS
# define GNUGOL_SHAREDLIBDIR "../engines"
#else
# define GNUGOL_SHAREDLIBDIR "/var/lib/gnugol"
#endif
typedef struct ggengine
{
Node node;
void *lib;
const char *name;
int (*setup) (QueryOptions_t *);
int (*search)(QueryOptions_t *);
} *GnuGolEngine;
GnuGolEngine gnugol_engine_load (const char *);
int gnugol_engine_query (GnuGolEngine,QueryOptions_t *);
void gnugol_engine_unload (GnuGolEngine);
int gnugol_read_key (char *const,size_t *const,const char *const);
#endif
| Include nodelist here, and fix a typo. | Include nodelist here, and fix a typo.
| C | agpl-3.0 | dtaht/Gnugol,dtaht/Gnugol,dtaht/Gnugol,dtaht/Gnugol |
5eee834e48af66e851b8d5c96cf07e7b1ab214da | src/lib-dict/dict-register.c | src/lib-dict/dict-register.c | /* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
void dict_drivers_register_builtin(void)
{
dict_driver_register(&dict_driver_client);
dict_driver_register(&dict_driver_file);
dict_driver_register(&dict_driver_fs);
dict_driver_register(&dict_driver_memcached);
dict_driver_register(&dict_driver_memcached_ascii);
dict_driver_register(&dict_driver_redis);
}
void dict_drivers_unregister_builtin(void)
{
dict_driver_unregister(&dict_driver_client);
dict_driver_unregister(&dict_driver_file);
dict_driver_unregister(&dict_driver_fs);
dict_driver_unregister(&dict_driver_memcached);
dict_driver_unregister(&dict_driver_memcached_ascii);
dict_driver_unregister(&dict_driver_redis);
}
| /* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
static int refcount = 0;
void dict_drivers_register_builtin(void)
{
if (refcount++ > 0)
return;
dict_driver_register(&dict_driver_client);
dict_driver_register(&dict_driver_file);
dict_driver_register(&dict_driver_fs);
dict_driver_register(&dict_driver_memcached);
dict_driver_register(&dict_driver_memcached_ascii);
dict_driver_register(&dict_driver_redis);
}
void dict_drivers_unregister_builtin(void)
{
if (--refcount > 0)
return;
dict_driver_unregister(&dict_driver_client);
dict_driver_unregister(&dict_driver_file);
dict_driver_unregister(&dict_driver_fs);
dict_driver_unregister(&dict_driver_memcached);
dict_driver_unregister(&dict_driver_memcached_ascii);
dict_driver_unregister(&dict_driver_redis);
}
| Allow registering builtin dict drivers multiple times. | lib-dict: Allow registering builtin dict drivers multiple times.
| C | mit | LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot,LTD-Beget/dovecot |
546d7b62b3c02c2dfa6cb9ad8d10675b99b4120e | src/resizeImage.c | src/resizeImage.c | /**
* http://www.compuphase.com/graphic/scale.htm
*/
void ScaleLine(int *Target, int *Source, int SrcWidth, int TgtWidth)
{
int NumPixels = TgtWidth;
int IntPart = SrcWidth / TgtWidth;
int FractPart = SrcWidth % TgtWidth;
int E = 0;
while (NumPixels-- > 0) {
*Target++ = *Source;
Source += IntPart;
E += FractPart;
if (E >= TgtWidth) {
E -= TgtWidth;
Source++;
} /* if */
} /* while */
}
void resizeImage(int *Source, int *Target, int SrcWidth, int SrcHeight, int TgtWidth, int TgtHeight)
{
int NumPixels = TgtHeight;
int IntPart = (SrcHeight / TgtHeight) * SrcWidth;
int FractPart = SrcHeight % TgtHeight;
int E = 0;
int *PrevSource = NULL;
while (NumPixels-- > 0) {
if (Source == PrevSource) {
memcpy(Target, Target-TgtWidth, TgtWidth*sizeof(*Target));
} else {
ScaleLine(Target, Source, SrcWidth, TgtWidth);
PrevSource = Source;
} /* if */
Target += TgtWidth;
Source += IntPart;
E += FractPart;
if (E >= TgtHeight) {
E -= TgtHeight;
Source += SrcWidth;
} /* if */
} /* while */
}
| Add code to do basic image resizing | Add code to do basic image resizing
From: http://www.compuphase.com/graphic/scale.htm
| C | mit | stollcri/UA-3460-677 |
|
2e6b091c2b103ef23a52e9592714a70126cde6df | libevmjit/Utils.h | libevmjit/Utils.h | #pragma once
#include <iostream>
// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace evmjit
{
std::ostream& getLogStream(char const* _channel);
}
}
#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)
#else // Release
#define DLOG(CHANNEL) true ? std::cerr : std::cerr
#endif
| #pragma once
#include <iostream>
// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace evmjit
{
std::ostream& getLogStream(char const* _channel);
}
}
#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)
#else // Release
namespace dev
{
namespace evmjit
{
struct Voider
{
void operator=(std::ostream const&) {}
};
}
}
#define DLOG(CHANNEL) true ? (void)0 : ::dev::evmjit::Voider{} = std::cerr
#endif
| Reimplement no-op version of DLOG to avoid C++ compiler warning | Reimplement no-op version of DLOG to avoid C++ compiler warning
| C | mit | ethereum/evmjit,ethereum/evmjit,ethereum/evmjit |
3771abc38413dca7aee39a9005f3d808b440538c | JPetUnpacker/Unpacker2/TDCChannel.h | JPetUnpacker/Unpacker2/TDCChannel.h | #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 100
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[MAX_FULL_HITS];
double trailTimes[MAX_FULL_HITS];
double tots[MAX_FULL_HITS];
double referenceDiffs[MAX_FULL_HITS];
int hitsNum;
public:
TDCChannel();
~TDCChannel();
void SetChannel(Int_t channel) { this->channel = channel; }
int GetChannel() { return channel; }
int GetHitsNum() { return hitsNum; }
void AddHit(double lead, double trail, double ref);
void AddHit(double lead, double trail);
double GetLeadTime1() { return leadTime1; }
double GetLeadTime(int mult) { return leadTimes[mult]; }
double GetTrailTime1() { return trailTime1; }
double GetTrailTime(int mult) { return trailTimes[mult]; }
double GetTOT1() { return tot1; }
int GetMult() { return hitsNum; }
double GetTOT(int mult) { return tots[mult]; }
ClassDef(TDCChannel,1);
};
#endif
| #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 50
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[MAX_FULL_HITS];
double trailTimes[MAX_FULL_HITS];
double tots[MAX_FULL_HITS];
double referenceDiffs[MAX_FULL_HITS];
int hitsNum;
public:
TDCChannel();
~TDCChannel();
void SetChannel(Int_t channel) { this->channel = channel; }
int GetChannel() { return channel; }
int GetHitsNum() { return hitsNum; }
void AddHit(double lead, double trail, double ref);
void AddHit(double lead, double trail);
double GetLeadTime1() { return leadTime1; }
double GetLeadTime(int mult) { return leadTimes[mult]; }
double GetTrailTime1() { return trailTime1; }
double GetTrailTime(int mult) { return trailTimes[mult]; }
double GetTOT1() { return tot1; }
int GetMult() { return hitsNum; }
double GetTOT(int mult) { return tots[mult]; }
ClassDef(TDCChannel,1);
};
#endif
| Change TDCHits array size from 100 to 50 | Change TDCHits array size from 100 to 50
For consistency with the standalone version
of the Unpacker.
| C | apache-2.0 | alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,JPETTomography/j-pet-framework,wkrzemien/j-pet-framework,JPETTomography/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,wkrzemien/j-pet-framework,JPETTomography/j-pet-framework,wkrzemien/j-pet-framework,wkrzemien/j-pet-framework,wkrzemien/j-pet-framework |
f82cb032e33f6a079c0d18b95fdc3bc41cc66a53 | PSET2/caesar.c | PSET2/caesar.c | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
// constant
#define ALPHA_NUM 26
int main(int argc, char *argv[]) {
// check argument number and argument key to be greater than -1
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage (k >= 0):\n./caesar k \n");
return 1;
}
int key = atoi(argv[1]) % ALPHA_NUM;
// get plaintext from user
printf("plaintext: ");
string plaintext = get_string();
printf("\n");
// encode plaintext
size_t text_len = strlen(plaintext);
char ciphertext[text_len + 1]; // + 1 for '\0'
for (int i = 0; i < text_len; i++) {
if (isalpha(plaintext[i])) {
if (isupper(plaintext[i])) {
// Uppercase shift
ciphertext[i] = (char) (((plaintext[i] + key - 'A') % ALPHA_NUM) + 'A');
} else {
// Lowercase shift
ciphertext[i] = (char) (((plaintext[i] + key - 'a') % ALPHA_NUM) + 'a');
}
} else {
// Skip non alpha
ciphertext[i] = plaintext[i];
}
}
printf("ciphertext: %s\n", ciphertext);
return 0;
}
| #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
// constant
#define ALPHA_NUM 26
int main(int argc, char *argv[]) {
// check argument number and argument key to be greater than -1
if (argc != 2 || atoi(argv[1]) < 0) {
printf("Usage (k >= 0):\n./caesar k \n");
return 1;
}
int key = atoi(argv[1]) % ALPHA_NUM;
// get plaintext from user
printf("plaintext: ");
string plaintext = get_string();
// encode plaintext
size_t text_len = strlen(plaintext);
char ciphertext[text_len + 1]; // + 1 for '\0'
for (int i = 0; i < text_len; i++) {
if (isalpha(plaintext[i])) {
if (isupper(plaintext[i])) {
// Uppercase shift
ciphertext[i] = (char) (((plaintext[i] + key - 'A') % ALPHA_NUM) + 'A');
} else {
// Lowercase shift
ciphertext[i] = (char) (((plaintext[i] + key - 'a') % ALPHA_NUM) + 'a');
}
} else {
// Skip non alpha
ciphertext[i] = plaintext[i];
}
}
printf("ciphertext: %s\n", ciphertext);
return 0;
} | Remove printf for testing with check50 | Remove printf for testing with check50
| C | unlicense | Implaier/CS50,Implaier/CS50,Implaier/CS50,Implaier/CS50 |
474864639946f06abb90a5398c4a881714ac0c15 | include/zephyr/CExport.h | include/zephyr/CExport.h | #ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H
#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif
#ifdef __cplusplus
#define Z_ENUM_CLASS(ns, n) enum class n
#else
#define Z_ENUM_CLASS(ns, n) enum ns ## _ ## n
#endif
#ifdef __cplusplus
#define Z_ENUM(ns, n) enum n
#else
#define Z_ENUM(ns, n) enum ns ## _ ## n
#endif
#ifdef __cplusplus
#define Z_STRUCT(ns, n) struct n
#else
#define Z_STRUCT(ns, n) struct ns ## _ ## n
#endif
#endif
| #ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H
#ifdef __cplusplus
#define Z_VAR(ns, n) n
#else
#define Z_VAR(ns, n) ns ## _ ## n
#endif
#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif
#ifdef __cplusplus
#define Z_ENUM_CLASS(ns, n) enum class n
#else
#define Z_ENUM_CLASS(ns, n) enum Z_VAR(ns, n)
#endif
#ifdef __cplusplus
#define Z_ENUM(ns, n) enum n
#else
#define Z_ENUM(ns, n) enum Z_VAR(ns, n)
#endif
#ifdef __cplusplus
#define Z_STRUCT(ns, n) struct n
#else
#define Z_STRUCT(ns, n) struct Z_VAR(ns, n)
#endif
#endif
| Add variable name to namespace binding | Add variable name to namespace binding
| C | mit | DeonPoncini/zephyr |
391df9dfb7db693cabd598218bb58ee68e94d826 | src/Utils/Map.h | src/Utils/Map.h | /**
* @file Map.h
* @ingroup Utils
* @brief Template helper functions for std::map
*
* Copyright (c) 2017 Sebastien Rombauts ([email protected])
*
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
* or copy at http://opensource.org/licenses/MIT)
*/
#pragma once
#include <sstream>
#include <string>
namespace Utils {
/// Tells if a std::map have a specific key (similar to std::map::count())
template <typename Map>
bool hasKey(const Map& aMap, const std::string& aKey) {
return (aMap.find(aKey) != aMap.end());
}
/// Tells if a std::map have a specific value
template <typename Map>
bool hasValue(const Map& aMap, const std::string& aKey, const std::string& aValue) {
bool bHaveValue = false;
const typename Map::const_iterator iPair = aMap.find(aKey);
if (iPair != aMap.end()) {
bHaveValue = (iPair->second == aValue);
}
return bHaveValue;
}
} // namespace Utils
| Add template helper functions for std::map | Add template helper functions for std::map
| C | mit | SRombauts/cpp-skeleton,SRombauts/cpp-skeleton |
|
f2826431a1cc428fccc352d7af91d4b0b8955a9b | Note.h | Note.h | #ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE
#include <inttypes.h>
#include <config.h>
#include <FastLED.h>
typedef struct note_range_t {
uint16_t start;
uint16_t end;
} note_range_t;
class Note {
public:
Note(CRGB aColor, uint16_t order, uint16_t ledCount);
void setColor(CRGB aColor);
private:
CRGB _color;
note_range_t _range;
};
#endif | #ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE
#include <inttypes.h>
#include <config.h>
#include <Arduino.h>
typedef struct note_range_t {
uint16_t start;
uint16_t end;
} note_range_t;
class Note {
public:
Note(uint8_t aHue, uint16_t order, uint16_t ledCount);
void setHue(uint8_t aHue);
uint8_t hue();
void setPlaying(boolean flag);
boolean isPlaying();
private:
boolean _playing;
uint8_t _hue;
note_range_t _range;
};
#endif | Use hue instead of color. | Use hue instead of color.
Also added a property for activation of the Note
| C | mit | NSBum/lachaise2 |
9fd0e4bb87faf5f6eec84c330a3c61b5c2d8b455 | src/mem_alloc.c | src/mem_alloc.c | #include "common/time.h"
#include <stdio.h>
#include <stdlib.h>
static const double BENCHMARK_TIME = 5.0;
static const int NUM_ALLOCS = 1000000;
int main(int argc, const char** argv) {
printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
fflush(stdout);
double best_time = 1e9;
const double start_t = get_time();
while (get_time() - start_t < BENCHMARK_TIME) {
const double t0 = get_time();
void* addresses[NUM_ALLOCS];
for (int i = 0; i < NUM_ALLOCS; ++i) {
const int memory_size = ((i % 32) + 1) * 4;
addresses[i] = malloc(memory_size);
((char*)addresses[i])[0] = 1;
}
for (int i = 0; i < NUM_ALLOCS; ++i) {
free(addresses[i]);
}
double dt = get_time() - t0;
if (dt < best_time) {
best_time = dt;
}
}
printf("%f ns / alloc\n", (best_time / (double)NUM_ALLOCS) * 1000000000.0);
fflush(stdout);
return 0;
}
| #include "common/time.h"
#include <stdio.h>
#include <stdlib.h>
static const double BENCHMARK_TIME = 5.0;
#define NUM_ALLOCS 1000000
static void* s_addresses[NUM_ALLOCS];
int main(int argc, const char** argv) {
printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
fflush(stdout);
double best_time = 1e9;
const double start_t = get_time();
while (get_time() - start_t < BENCHMARK_TIME) {
const double t0 = get_time();
for (int i = 0; i < NUM_ALLOCS; ++i) {
const int memory_size = ((i % 32) + 1) * 4;
s_addresses[i] = malloc(memory_size);
((char*)s_addresses[i])[0] = 1;
}
for (int i = 0; i < NUM_ALLOCS; ++i) {
free(s_addresses[i]);
}
double dt = get_time() - t0;
if (dt < best_time) {
best_time = dt;
}
}
printf("%f ns / alloc\n", (best_time / (double)NUM_ALLOCS) * 1000000000.0);
fflush(stdout);
return 0;
}
| Use static memory for mem pointers | Use static memory for mem pointers
| C | unlicense | mbitsnbites/osbench |
81990abd79a163651fb7a5ef846c69e0e11c8326 | kilo.c | kilo.c | #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 raw = orig_termios;
raw.c_iflag &= ~(IXON);
raw.c_lflag &= ~(ECHO | ICANON | ISIG);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enable_raw_mode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
if (iscntrl(c)) {
printf("%d\n", c);
} else {
printf("%d ('%c')\n", c, c);
}
}
return 0;
}
| #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 raw = orig_termios;
raw.c_iflag &= ~(IXON);
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enable_raw_mode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
if (iscntrl(c)) {
printf("%d\n", c);
} else {
printf("%d ('%c')\n", c, c);
}
}
return 0;
}
| Disable Ctrl-V (and Ctrl-O on macOS) | Disable Ctrl-V (and Ctrl-O on macOS)
| C | bsd-2-clause | oldsharp/kilo,oldsharp/kilo |
1b90d7cf2b0ace1d1623562d4ad084e2ea9fdf10 | list.h | list.h | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
#endif | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int f(void*, void*));
#endif | Add List Search function declaration | Add List Search function declaration
| C | mit | MaxLikelihood/CADT |
9ba4f34f11902e16fb17ec08f66a1c9f27817359 | main.c | main.c | #include <stdio.h>
#include "forsyth.h"
int main(int argc, char* argv[])
{
FILE * stream;
int FEN_status;
if (argc < 2)
FEN_status = load_FEN(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
);
else
FEN_status = load_FEN(argv[1]);
#if defined(TEST_MATE_IN_ONE)
memcpy(&square(a8), "nk....bq", 8);
memcpy(&square(a7), "ppp.r...", 8);
memcpy(&square(a6), "........", 8);
memcpy(&square(a5), "........", 8);
memcpy(&square(a4), "........", 8);
memcpy(&square(a3), "........", 8);
memcpy(&square(a2), "...R.PPP", 8);
memcpy(&square(a1), "QB....KN", 8);
#endif
if (FEN_status != FEN_OK)
{
fprintf(stderr, "(%i): FEN record is corrupt!\n\n", FEN_status);
return (FEN_status);
}
stream = (argc < 3) ? stdout : fopen(argv[2], "w");
load_Forsyth(stream);
fclose(stream);
return 0;
}
| #include <stdio.h>
#include "forsyth.h"
#include "check.h"
int main(int argc, char* argv[])
{
FILE * stream;
int FEN_status;
if (argc < 2)
FEN_status = load_FEN(
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
);
else
FEN_status = load_FEN(argv[1]);
#if defined(TEST_MATE_IN_ONE)
memcpy(&square(a8), "nk....bq", 8);
memcpy(&square(a7), "ppp.r...", 8);
memcpy(&square(a6), "........", 8);
memcpy(&square(a5), "........", 8);
memcpy(&square(a4), "........", 8);
memcpy(&square(a3), "........", 8);
memcpy(&square(a2), "...R.PPP", 8);
memcpy(&square(a1), "QB....KN", 8);
#endif
if (FEN_status != FEN_OK)
{
fprintf(stderr, "(%i): FEN record is corrupt!\n\n", FEN_status);
return (FEN_status);
}
stream = (argc < 3) ? stdout : fopen(argv[2], "w");
load_Forsyth(stream);
fclose(stream);
if (in_check(WHITE))
puts("White is in check.");
if (in_check(BLACK))
puts("Black is in check.");
return 0;
}
| Debug check analysis for both sides. | Debug check analysis for both sides.
| C | cc0-1.0 | cxd4/chess,cxd4/chess,cxd4/chess |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.