commit
stringlengths
40
40
old_file
stringlengths
4
237
new_file
stringlengths
4
237
old_contents
stringlengths
1
4.24k
new_contents
stringlengths
1
4.87k
subject
stringlengths
15
778
message
stringlengths
15
8.75k
lang
stringclasses
266 values
license
stringclasses
13 values
repos
stringlengths
5
127k
83122da713a81c8310bf97de8ff6320497d5f327
lib/CodeGen/CGBuilder.h
lib/CodeGen/CGBuilder.h
//===-- CGBuilder.h - Choose IRBuilder implementation ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef CLANG_CODEGEN_CGBUILDER_H #define CLANG_CODEGEN_CGBUILDER_H #include "llvm/Support/IRBuilder.h" namespace clang { namespace CodeGen { // Don't preserve names on values in an optimized build. #ifdef NDEBUG typedef llvm::IRBuilder<false> CGBuilderTy; #else typedef llvm::IRBuilder<> CGBuilderTy; #endif } // end namespace CodeGen } // end namespace clang #endif
//===-- CGBuilder.h - Choose IRBuilder implementation ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef CLANG_CODEGEN_CGBUILDER_H #define CLANG_CODEGEN_CGBUILDER_H #include "llvm/IRBuilder.h" namespace clang { namespace CodeGen { // Don't preserve names on values in an optimized build. #ifdef NDEBUG typedef llvm::IRBuilder<false> CGBuilderTy; #else typedef llvm::IRBuilder<> CGBuilderTy; #endif } // end namespace CodeGen } // end namespace clang #endif
Update Clang to reflect the new home of IRBuilder.h as of r159421.
Update Clang to reflect the new home of IRBuilder.h as of r159421. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@159422 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang
07de4cbbbb7c3f5ef9728342a35efc12f6d6080b
src/interfaces/odbc/md5.h
src/interfaces/odbc/md5.h
/* File: connection.h * * Description: See "md.h" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ /* #if SIZEOF_UINT8 == 0 Can't get this from configure */ typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ /* #endif */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
/* File: connection.h * * Description: See "md.h" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ /* Also defined in include/c.h */ #if SIZEOF_UINT8 == 0 typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* SIZEOF_UINT8 == 0 */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
Add configure result checks on odbc, per Peter E.
Add configure result checks on odbc, per Peter E.
C
apache-2.0
adam8157/gpdb,randomtask1155/gpdb,ashwinstar/gpdb,xinzweb/gpdb,ovr/postgres-xl,zeroae/postgres-xl,yazun/postgres-xl,ahachete/gpdb,kmjungersen/PostgresXL,snaga/postgres-xl,rubikloud/gpdb,arcivanov/postgres-xl,ashwinstar/gpdb,jmcatamney/gpdb,techdragon/Postgres-XL,adam8157/gpdb,lintzc/gpdb,yuanzhao/gpdb,ahachete/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,ovr/postgres-xl,foyzur/gpdb,zeroae/postgres-xl,ahachete/gpdb,CraigHarris/gpdb,janebeckman/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,foyzur/gpdb,lintzc/gpdb,xuegang/gpdb,ovr/postgres-xl,arcivanov/postgres-xl,chrishajas/gpdb,ahachete/gpdb,yuanzhao/gpdb,lisakowen/gpdb,janebeckman/gpdb,arcivanov/postgres-xl,kmjungersen/PostgresXL,foyzur/gpdb,zaksoup/gpdb,Quikling/gpdb,tpostgres-projects/tPostgres,postmind-net/postgres-xl,xuegang/gpdb,edespino/gpdb,zeroae/postgres-xl,cjcjameson/gpdb,postmind-net/postgres-xl,cjcjameson/gpdb,zaksoup/gpdb,zeroae/postgres-xl,cjcjameson/gpdb,50wu/gpdb,lpetrov-pivotal/gpdb,atris/gpdb,rvs/gpdb,tangp3/gpdb,ashwinstar/gpdb,xinzweb/gpdb,rvs/gpdb,randomtask1155/gpdb,jmcatamney/gpdb,tpostgres-projects/tPostgres,edespino/gpdb,zeroae/postgres-xl,yuanzhao/gpdb,cjcjameson/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,randomtask1155/gpdb,lintzc/gpdb,xinzweb/gpdb,rubikloud/gpdb,cjcjameson/gpdb,lisakowen/gpdb,atris/gpdb,jmcatamney/gpdb,zaksoup/gpdb,ahachete/gpdb,greenplum-db/gpdb,lpetrov-pivotal/gpdb,jmcatamney/gpdb,Chibin/gpdb,edespino/gpdb,tangp3/gpdb,kmjungersen/PostgresXL,lisakowen/gpdb,lintzc/gpdb,0x0FFF/gpdb,yazun/postgres-xl,50wu/gpdb,randomtask1155/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,tangp3/gpdb,tangp3/gpdb,xuegang/gpdb,lintzc/gpdb,yazun/postgres-xl,foyzur/gpdb,foyzur/gpdb,rubikloud/gpdb,edespino/gpdb,50wu/gpdb,Postgres-XL/Postgres-XL,0x0FFF/gpdb,Chibin/gpdb,kmjungersen/PostgresXL,oberstet/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,janebeckman/gpdb,yuanzhao/gpdb,snaga/postgres-xl,rubikloud/gpdb,rubikloud/gpdb,lintzc/gpdb,xinzweb/gpdb,lpetrov-pivotal/gpdb,lisakowen/gpdb,50wu/gpdb,pavanvd/postgres-xl,chrishajas/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,arcivanov/postgres-xl,janebeckman/gpdb,cjcjameson/gpdb,tangp3/gpdb,royc1/gpdb,janebeckman/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,atris/gpdb,randomtask1155/gpdb,0x0FFF/gpdb,lpetrov-pivotal/gpdb,Postgres-XL/Postgres-XL,Chibin/gpdb,ovr/postgres-xl,techdragon/Postgres-XL,edespino/gpdb,Quikling/gpdb,edespino/gpdb,lisakowen/gpdb,chrishajas/gpdb,Quikling/gpdb,edespino/gpdb,techdragon/Postgres-XL,janebeckman/gpdb,postmind-net/postgres-xl,ovr/postgres-xl,royc1/gpdb,50wu/gpdb,0x0FFF/gpdb,CraigHarris/gpdb,tpostgres-projects/tPostgres,CraigHarris/gpdb,adam8157/gpdb,Chibin/gpdb,royc1/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,royc1/gpdb,kaknikhil/gpdb,Chibin/gpdb,pavanvd/postgres-xl,chrishajas/gpdb,Chibin/gpdb,Quikling/gpdb,rvs/gpdb,adam8157/gpdb,oberstet/postgres-xl,0x0FFF/gpdb,50wu/gpdb,0x0FFF/gpdb,atris/gpdb,janebeckman/gpdb,jmcatamney/gpdb,CraigHarris/gpdb,tangp3/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,Postgres-XL/Postgres-XL,lpetrov-pivotal/gpdb,foyzur/gpdb,atris/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,yazun/postgres-xl,rvs/gpdb,yazun/postgres-xl,CraigHarris/gpdb,CraigHarris/gpdb,xinzweb/gpdb,rvs/gpdb,Quikling/gpdb,tangp3/gpdb,ashwinstar/gpdb,Chibin/gpdb,rubikloud/gpdb,ahachete/gpdb,greenplum-db/gpdb,xuegang/gpdb,lintzc/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,lintzc/gpdb,ahachete/gpdb,xinzweb/gpdb,zaksoup/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,rvs/gpdb,xinzweb/gpdb,kaknikhil/gpdb,lpetrov-pivotal/gpdb,rubikloud/gpdb,xuegang/gpdb,yuanzhao/gpdb,rubikloud/gpdb,royc1/gpdb,Quikling/gpdb,kaknikhil/gpdb,edespino/gpdb,snaga/postgres-xl,xuegang/gpdb,tangp3/gpdb,janebeckman/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,Chibin/gpdb,lisakowen/gpdb,Quikling/gpdb,xuegang/gpdb,50wu/gpdb,randomtask1155/gpdb,yuanzhao/gpdb,zaksoup/gpdb,edespino/gpdb,snaga/postgres-xl,greenplum-db/gpdb,rvs/gpdb,adam8157/gpdb,janebeckman/gpdb,zaksoup/gpdb,edespino/gpdb,atris/gpdb,chrishajas/gpdb,lintzc/gpdb,royc1/gpdb,xuegang/gpdb,snaga/postgres-xl,tpostgres-projects/tPostgres,xuegang/gpdb,0x0FFF/gpdb,kmjungersen/PostgresXL,ashwinstar/gpdb,chrishajas/gpdb,postmind-net/postgres-xl,Chibin/gpdb,ashwinstar/gpdb,xinzweb/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,chrishajas/gpdb,Quikling/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,Postgres-XL/Postgres-XL,rvs/gpdb,royc1/gpdb,atris/gpdb,adam8157/gpdb,rvs/gpdb,atris/gpdb,lisakowen/gpdb,lpetrov-pivotal/gpdb,chrishajas/gpdb,Chibin/gpdb,Quikling/gpdb,zaksoup/gpdb,CraigHarris/gpdb,randomtask1155/gpdb,randomtask1155/gpdb,pavanvd/postgres-xl,0x0FFF/gpdb,oberstet/postgres-xl,royc1/gpdb,adam8157/gpdb,kaknikhil/gpdb,zaksoup/gpdb,janebeckman/gpdb,Quikling/gpdb,foyzur/gpdb,ahachete/gpdb,jmcatamney/gpdb,oberstet/postgres-xl,arcivanov/postgres-xl,ashwinstar/gpdb,foyzur/gpdb,postmind-net/postgres-xl,rvs/gpdb,Postgres-XL/Postgres-XL,50wu/gpdb,lpetrov-pivotal/gpdb
a8ea76a45a8771245e70e9b603eac8d9df1bcfad
test/CodeGen/builtin-stackaddress.c
test/CodeGen/builtin-stackaddress.c
// RUN: clang -emit-llvm < %s void* a(unsigned x) { return __builtin_return_address(0); } void* c(unsigned x) { return __builtin_frame_address(0); } // RUN: clang -emit-llvm < %s void* a(unsigned x) { return __builtin_return_address(0); } void* c(unsigned x) { return __builtin_frame_address(0); }
// RUN: clang -emit-llvm < %s | grep "llvm.returnaddress" // RUN: clang -emit-llvm < %s | grep "llvm.frameaddress" void* a(unsigned x) { return __builtin_return_address(0); } void* c(unsigned x) { return __builtin_frame_address(0); }
Fix test (it was incorrectly succeeding).
Fix test (it was incorrectly succeeding). git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@51310 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
llvm-mirror/clang,apple/swift-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,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang
7fcd3e596fbeabc0c6388c9f457b267adbb664a5
OctoKit/OCTClient+Issues.h
OctoKit/OCTClient+Issues.h
// // OCTClient+Issues.h // OctoKit // // Created by leichunfeng on 15/3/7. // Copyright (c) 2015年 GitHub. All rights reserved. // #import <OctoKit/OctoKit.h> @interface OCTClient (Issues) // Creates an issue. // // title - The title of the issue. This must not be nil. // body - The contents of the issue. This can be nil. // assignee - Login for the user that this issue should be assigned to. NOTE: // Only users with push access can set the assignee for new issues. // The assignee is silently dropped otherwise. This can be nil. // milestone - Milestone to associate this issue with. NOTE: Only users with // push access can set the milestone for new issues. The milestone // is silently dropped otherwise. This can be nil. // labels - Labels to associate with this issue. NOTE: Only users with push // access can set labels for new issues. Labels are silently dropped // otherwise. This can be nil. // repository - The repository in which to create the issue. This must not be nil. // // Returns a signal which will send the created `OCTIssue` then complete, or error. - (RACSignal *)createIssueWithTitle:(NSString *)title body:(NSString *)body assignee:(NSString *)assignee milestone:(NSUInteger)milestone labels:(NSArray *)labels inRepository:(OCTRepository *)repository; @end
// // OCTClient+Issues.h // OctoKit // // Created by leichunfeng on 15/3/7. // Copyright (c) 2015年 GitHub. All rights reserved. // #import <OctoKit/OctoKit.h> @interface OCTClient (Issues) /// Creates an issue. /// /// title - The title of the issue. This must not be nil. /// body - The contents of the issue. This can be nil. /// assignee - Login for the user that this issue should be assigned to. NOTE: /// Only users with push access can set the assignee for new issues. // The assignee is silently dropped otherwise. This can be nil. /// milestone - Milestone to associate this issue with. NOTE: Only users with /// push access can set the milestone for new issues. The milestone /// is silently dropped otherwise. This can be nil. /// labels - Labels to associate with this issue. NOTE: Only users with push /// access can set labels for new issues. Labels are silently dropped /// otherwise. This can be nil. /// repository - The repository in which to create the issue. This must not be nil. /// /// Returns a signal which will send the created `OCTIssue` then complete, or error. - (RACSignal *)createIssueWithTitle:(NSString *)title body:(NSString *)body assignee:(NSString *)assignee milestone:(NSUInteger)milestone labels:(NSArray *)labels inRepository:(OCTRepository *)repository; @end
Use triple /s replace double /s.
Use triple /s replace double /s.
C
mit
Acidburn0zzz/octokit.objc,xantage/octokit.objc,phatblat/octokit.objc,cnbin/octokit.objc,daemonchen/octokit.objc,daemonchen/octokit.objc,CHNLiPeng/octokit.objc,leichunfeng/octokit.objc,xantage/octokit.objc,wrcj12138aaa/octokit.objc,wrcj12138aaa/octokit.objc,daukantas/octokit.objc,leichunfeng/octokit.objc,GroundControl-Solutions/octokit.objc,Palleas/octokit.objc,Palleas/octokit.objc,Acidburn0zzz/octokit.objc,jonesgithub/octokit.objc,phatblat/octokit.objc,GroundControl-Solutions/octokit.objc,daukantas/octokit.objc,cnbin/octokit.objc,CHNLiPeng/octokit.objc,jonesgithub/octokit.objc
f14fc9d3af0a098ac8edf43fe494b546471cc029
SSPSolution/SSPSolution/DoorEntity.h
SSPSolution/SSPSolution/DoorEntity.h
#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H #define SSPAPPLICATION_ENTITIES_DOORENTITY_H #include "Entity.h" class DoorEntity : public Entity { private: bool m_isOpened; float m_minRotation; float m_maxRotation; float m_rotateTime; float m_rotatePerSec; public: DoorEntity(); virtual ~DoorEntity(); int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float minRotation, float maxRotation, float rotateTime); int Update(float dT, InputHandler* inputHandler); int React(int entityID, EVENT reactEvent); bool SetIsOpened(bool isOpened); bool GetIsOpened(); }; #endif
#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H #define SSPAPPLICATION_ENTITIES_DOORENTITY_H #include "Entity.h" class DoorEntity : public Entity { private: bool m_isOpened; float m_minRotation; float m_maxRotation; float m_rotateTime; float m_rotatePerSec; public: DoorEntity(); virtual ~DoorEntity(); int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float minRotation = 0.0f, float maxRotation = DirectX::XM_PI / 2, float rotateTime = 1.0f); int Update(float dT, InputHandler* inputHandler); int React(int entityID, EVENT reactEvent); bool SetIsOpened(bool isOpened); bool GetIsOpened(); }; #endif
UPDATE Door.h initialize standard values
UPDATE Door.h initialize standard values
C
apache-2.0
Chringo/SSP,Chringo/SSP
168e25b70e76547af44c3d71f71215abbcafb686
libcwap.h
libcwap.h
#ifndef LIBCWAP_H #define LIBCWAP_H #include <stddef.h> #include <inttypes.h> typedef uint32_t time_t; typedef size_t (*read_function_t)(char *, size_t); #define CWAP_TIME_REQUEST '\t' #define CWAP_TIME_SET 'T' #define CWAP_SET_ALARM_TIMESTAMP 'O' struct libcwap_functions { void (*time_request_function)(void); void (*time_set_function)(time_t); void (*alarm_set_timestamp)(uint8_t, time_t); // etc. }; void libcwap_action(size_t (*)(char *, size_t)); void libcwap_register(struct libcwap_functions *); #endif
#ifndef LIBCWAP_H #define LIBCWAP_H #include <stddef.h> #include <inttypes.h> typedef uint32_t time_t; typedef size_t (*read_function_t)(char *, size_t); #define CWAP_TIME_REQUEST '\t' #define CWAP_TIME_SET 'T' #define CWAP_SET_ALARM_TIMESTAMP 'O' struct libcwap_functions { void (*time_request_function)(void); void (*time_set_function)(time_t); void (*alarm_set_timestamp)(uint8_t, time_t); // etc. }; void libcwap_action(read_function_t); void libcwap_register(struct libcwap_functions *); #endif
Use the typedef read_function_t for readability
Use the typedef read_function_t for readability
C
mit
xim/tsoc,xim/tsoc,xim/tsoc,xim/tsoc
fa91d9afb5167914873fa64a709d41671edd0e91
libcwap.c
libcwap.c
#include <stdlib.h> #include "libcwap.h" struct libcwap_functions * registered_functions = NULL; void libcwap_action(size_t (*read_function)(char *, size_t)) { char action; if (!read_function(&action, 1)) return; // Remember to increase the buffer if we want to receive larger packets. char data[4]; switch (action) { case 'T': if (!read_function(data, 4)) break; if (registered_functions->time_set_function != NULL) registered_functions->time_set_function(*(time_t *) data); // TODO verify these casts break; case 'O': if (!read_function(data, 4)) break; if (registered_functions->alarm_set_timestamp != NULL) registered_functions->alarm_set_timestamp(*(time_t *) data); break; // etc. default: ; // Assume the data was garbage. } } void libcwap_register(struct libcwap_functions * funs) { registered_functions = funs; }
#include <stdlib.h> #include "libcwap.h" struct libcwap_functions * registered_functions = NULL; typedef union { char chars[4]; uint32_t uinteger; int32_t integer; } data32_t; void libcwap_action(size_t (*read_function)(char *, size_t)) { char action; if (!read_function(&action, 1)) return; data32_t data32; switch (action) { case 'T': if (!read_function(data32.chars, 4)) break; if (registered_functions->time_set_function != NULL) registered_functions->time_set_function(data32.uinteger); // TODO verify these casts break; case 'O': if (!read_function(data32.chars, 4)) break; if (registered_functions->alarm_set_timestamp != NULL) registered_functions->alarm_set_timestamp(data32.uinteger); break; // etc. default: ; // Assume the data was garbage. } } void libcwap_register(struct libcwap_functions * funs) { registered_functions = funs; }
Make a 32bit union for receiving data rather than shady casting
Make a 32bit union for receiving data rather than shady casting
C
mit
xim/tsoc,xim/tsoc,xim/tsoc,xim/tsoc
4610137c1c437300551b0e1b92936dc28789d662
test/Profile/c-generate.c
test/Profile/c-generate.c
// Check that the -fprofile-instr-generate= form works. // RUN: %clang_cc1 -main-file-name c-generate.c %s -o - -emit-llvm -fprofile-instr-generate=c-generate-test.profraw | FileCheck %s // CHECK: private constant [24 x i8] c"c-generate-test.profraw\00" // CHECK: call void @__llvm_profile_set_filename_env_override(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @0, i32 0, i32 0)) // CHECK: declare void @__llvm_profile_set_filename_env_override(i8*) int main(void) { return 0; }
// Check that the -fprofile-instr-generate= form works. // RUN: %clang_cc1 -main-file-name c-generate.c %s -o - -emit-llvm -fprofile-instr-generate=c-generate-test.profraw | FileCheck %s // CHECK: private constant [24 x i8] c"c-generate-test.profraw\00" // CHECK: call void @__llvm_profile_override_default_filename(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @0, i32 0, i32 0)) // CHECK: declare void @__llvm_profile_override_default_filename(i8*) int main(void) { return 0; }
Update name of compiler-rt routine for setting filename
InstrProf: Update name of compiler-rt routine for setting filename Patch by Teresa Johnson. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@237187 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang
f1e5e9d9db6e8e467d994f6307452147d2becbca
bench/udb2/test-mlib.c
bench/udb2/test-mlib.c
#include "../common.c" #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) void test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get(h, key); if (ptr) { (*ptr)++; z+= *ptr; } else { dict_oa_uint_set_at(h, key, 1); z+=1; } } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); dict_oa_uint_clear(h); }
#include "../common.c" #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) void test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get_at(h, key); (*ptr)++; z+= *ptr; } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); dict_oa_uint_clear(h); }
Simplify code to use get_at method with its get & create semantic
Simplify code to use get_at method with its get & create semantic
C
bsd-2-clause
P-p-H-d/mlib,P-p-H-d/mlib
714295fdcc9c64721b9f7d4db6fae8f7bdaca55a
X10_Project/Classes/ColliderManager.h
X10_Project/Classes/ColliderManager.h
#pragma once class StageInformation; class Collider; class Bullet; class Sling; class ColliderManager { public: ColliderManager() {} ~ColliderManager() {} void InitBullets(StageInformation* si); void ResetBullets(); Bullet* GetBulletToShot(Sling* sling); Vector<Collider*>& GetColliders(){ return colliders; } bool HasBullet(); void AddExplosion(Collider* explosion); void EraseCollider(Collider* collider); private: Vector<Collider*> colliders; int curBulletIndex; int defaultBulletNum; };
#pragma once #include "Collider.h" class StageInformation; class Bullet; class Sling; class ColliderManager { public: ColliderManager() {} ~ColliderManager() {} void InitBullets(StageInformation* si); void ResetBullets(); Bullet* GetBulletToShot(Sling* sling); Vector<Collider*>& GetColliders(){ return colliders; } bool HasBullet(); void AddExplosion(Collider* explosion); void EraseCollider(Collider* collider); private: Vector<Collider*> colliders; int curBulletIndex; int defaultBulletNum; };
Fix file include bug (cocos Vector<T>)
Fix file include bug (cocos Vector<T>)
C
mit
kimsin3003/X10,kimsin3003/X10,kimsin3003/X10,kimsin3003/X10,kimsin3003/X10
94db2b46f8108d0f5e6edc0d65ae20eee40414aa
MdePkg/Include/PiPei.h
MdePkg/Include/PiPei.h
/** @file Root include file for Mde Package SEC, PEIM, PEI_CORE type modules. This is the include file for any module of type PEIM. PEIM modules only use types defined via this include file and can be ported easily to any environment. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __PI_PEI_H__ #define __PI_PEI_H__ #include <Uefi/UefiBaseType.h> #include <Pi/PiPeiCis.h> #include <Uefi/UefiMultiPhase.h> // // BUGBUG: The EFI_PEI_STARTUP_DESCRIPTOR definition does not follows PI specification. // After enabling PI for Nt32Pkg and tools generate correct autogen for PEI_CORE, // the following structure should be removed at once. // typedef struct { UINTN BootFirmwareVolume; UINTN SizeOfCacheAsRam; EFI_PEI_PPI_DESCRIPTOR *DispatchTable; } EFI_PEI_STARTUP_DESCRIPTOR; #endif
/** @file Root include file for Mde Package SEC, PEIM, PEI_CORE type modules. This is the include file for any module of type PEIM. PEIM modules only use types defined via this include file and can be ported easily to any environment. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __PI_PEI_H__ #define __PI_PEI_H__ #include <Uefi/UefiBaseType.h> #include <Pi/PiPeiCis.h> #include <Uefi/UefiMultiPhase.h> #endif
Move the EFI_PEI_STARTUP_DESCRIPTOR into IntelFrameworkPkg.
Move the EFI_PEI_STARTUP_DESCRIPTOR into IntelFrameworkPkg. git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@4120 6f19259b-4bc3-4df7-8a09-765794883524
C
bsd-2-clause
MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2
9b04b3ca1184556181562ce79e23cf3dfb572396
includes/libft_trm.h
includes/libft_trm.h
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft_trm.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 09:57:42 by ncoden #+# #+# */ /* Updated: 2015/05/11 18:53:58 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_TRM_H # define LIBFT_TRM_H # include <term.h> # include <termios.h> # include <curses.h> # include <sys/ioctl.h> # include <signal.h> typedef struct s_trm { struct termios *opts; t_ilst_evnt *on_key; t_evnt *on_resize; } t_trm; struct termios *ft_trmget(); t_bool ft_trmset(struct termios *trm); #endif
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft_trm.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 09:57:42 by ncoden #+# #+# */ /* Updated: 2015/05/12 00:42:36 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_TRM_H # define LIBFT_TRM_H # include <term.h> # include <termios.h> # include <curses.h> # include <sys/ioctl.h> # include <signal.h> typedef struct s_trm { struct termios *opts; t_ilst_evnt *on_key_press; t_evnt *on_resize; } t_trm; struct termios *ft_trmget(); t_bool ft_trmset(struct termios *trm); #endif
Change on_key term event to on_key_press
Change on_key term event to on_key_press
C
apache-2.0
ncoden/libft
9f2e996500ef58f5ddadfab9ec7e882b9a201933
include/groonga.h
include/groonga.h
/* Copyright(C) 2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GROONGA_H #define GROONGA_H #include <groonga/groonga.h> #include <groonga/ii.h> #include <groonga/expr.h> #include <groonga/util.h> #endif /* GROONGA_H */
/* Copyright(C) 2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GROONGA_H #define GROONGA_H #include "groonga/groonga.h" #include "groonga/ii.h" #include "groonga/expr.h" #include "groonga/util.h" #endif /* GROONGA_H */
Use "..." for ensure including header files in sub directory
Use "..." for ensure including header files in sub directory
C
lgpl-2.1
kenhys/groonga,naoa/groonga,hiroyuki-sato/groonga,groonga/groonga,hiroyuki-sato/groonga,hiroyuki-sato/groonga,hiroyuki-sato/groonga,kenhys/groonga,redfigure/groonga,naoa/groonga,redfigure/groonga,kenhys/groonga,komainu8/groonga,hiroyuki-sato/groonga,cosmo0920/groonga,cosmo0920/groonga,redfigure/groonga,naoa/groonga,naoa/groonga,komainu8/groonga,naoa/groonga,komainu8/groonga,naoa/groonga,redfigure/groonga,groonga/groonga,cosmo0920/groonga,groonga/groonga,komainu8/groonga,komainu8/groonga,groonga/groonga,komainu8/groonga,groonga/groonga,kenhys/groonga,cosmo0920/groonga,kenhys/groonga,groonga/groonga,redfigure/groonga,cosmo0920/groonga,cosmo0920/groonga,redfigure/groonga,komainu8/groonga,cosmo0920/groonga,hiroyuki-sato/groonga,kenhys/groonga,groonga/groonga,kenhys/groonga,naoa/groonga,kenhys/groonga,cosmo0920/groonga,redfigure/groonga,redfigure/groonga,groonga/groonga,hiroyuki-sato/groonga,hiroyuki-sato/groonga,naoa/groonga,komainu8/groonga
3cc87c2958215f031643358719b4fd858eae596a
include/arch/x86/memlayout.h
include/arch/x86/memlayout.h
#ifndef MEMLAYOUT_H #define MEMLAYOUT_H #include <stdint.h> #define KERNEL_START ((uint32_t)&kernel_start) #define KERNEL_END ((uint32_t)&kernel_end) #define KERNEL_SIZE (KERNEL_START - KERNEL_END) #define VIDEO_MEMORY_BEGIN 0xB8000 #define VIDEO_MEMORY_SIZE (80 * 24) #define VIRTUAL_TO_PHYSICAL(addr) ((uint32_t)(addr) - KERNEL_START) #define PHYSICAL_TO_VIRTUAL(addr) ((void *)(addr) + KERNEL_START) #endif
#ifndef MEMLAYOUT_H #define MEMLAYOUT_H #include <stdint.h> // These two variables are defined by the linker. They are located where you // would expect based on the names. extern uint32_t kernel_start; extern uint32_t kernel_end; #define KERNEL_END ((uint32_t)&kernel_end) #define KERNEL_START ((uint32_t)&kernel_start) #define KERNEL_END ((uint32_t)&kernel_end) #define KERNEL_SIZE (KERNEL_START - KERNEL_END) // Paging related #define PAGE_ALIGN(x) (((uintptr_t)(x)) & ~0xfff) #define NEXT_PAGE(x) (((uintptr_t)(x)+PAGE_SIZE) & ~0xfff) #define PAGE_DIRECTORY NEXT_PAGE(KERNEL_END) // Heap related #define KHEAP_PHYS_ROOT ((void*)0x100000) #define KHEAP_PHYS_END ((void*)NEXT_PAGE(KHEAP_PHYS_ROOT)) // Video memory related #define VIDEO_MEMORY_BEGIN 0xB8000 #define VIDEO_MEMORY_SIZE (80 * 24) #endif
Reorganize macros related to memory layout
Reorganize macros related to memory layout
C
mit
iankronquist/kernel-of-truth,awensaunders/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,awensaunders/kernel-of-truth,Herbstein/kernel-of-truth,awensaunders/kernel-of-truth,Herbstein/kernel-of-truth,iankronquist/kernel-of-truth,Herbstein/kernel-of-truth
257d42ef1d4c7bcc8b9fed75c86bd7df2d8f6eb3
organ.c
organ.c
#ifndef F_CPU #define F_CPU F_OSC #endif #include <avr/io.h> #include <avr/interrupt.h> #include <ctype.h> #include <math.h> #include <stdint.h> #include <util/delay.h> #include "config.h" #include "nco.h" #include "uart.h" static void handle_midi(void); int main(void); __attribute__((optimize("unroll-loops"))) static void handle_midi(void) { uint8_t command; uint8_t channel; do { command = rx(); } while(!(command&0x80)); channel = command & 0x0F; command = (command >> 4) - 8; uint8_t p1, p2; if(channel != 0) { return; } switch(command) { case 0: p1 = rx(); p2 = rx(); stop_tone(p1, p2); break; case 1: p1 = rx(); p2 = rx(); start_tone(p1, p2); break; default: break; } } int main(void) { uart_init(38400); nco_init(); sei(); uint8_t i = 0; while(1) { handle_midi(); } return 0; }
#ifndef F_CPU #define F_CPU F_OSC #endif #include <avr/io.h> #include <avr/interrupt.h> #include <ctype.h> #include <math.h> #include <stdint.h> #include <util/delay.h> #include "config.h" #include "nco.h" #include "uart.h" static void handle_midi(void); int main(void); __attribute__((optimize("unroll-loops"))) static void handle_midi(void) { uint8_t command; uint8_t channel; do { command = rx(); } while(!(command&0x80)); channel = command & 0x0F; command = (command >> 4) - 8; uint8_t p1, p2; if(channel != 0) { return; } switch(command) { case 0: case 1: p1 = rx(); p2 = rx(); if(p2 != 0 && command != 0) { start_tone(p1, p2); } else { stop_tone(p1, p2); } break; default: break; } } int main(void) { uart_init(38400); nco_init(); sei(); uint8_t i = 0; while(1) { handle_midi(); } return 0; }
Use stop_tone() if velocity set to 0
Use stop_tone() if velocity set to 0
C
mit
Cat-Ion/atmega328-midi-synthesizer
010006bafda486f36725e6b3e0b460faf30c5d7d
libraries/datastruct/hash/walk.c
libraries/datastruct/hash/walk.c
/* -------------------------------------------------------------------------- * Name: walk.c * Purpose: Associative array implemented as a hash * ----------------------------------------------------------------------- */ #include <stdlib.h> #include "base/memento/memento.h" #include "base/errors.h" #include "datastruct/hash.h" #include "impl.h" error hash_walk(const hash_t *h, hash_walk_callback *cb, void *cbarg) { int i; for (i = 0; i < h->nbins; i++) { hash__node_t *n; hash__node_t *next; for (n = h->bins[i]; n != NULL; n = next) { int r; next = n->next; r = cb(&n->item, cbarg); if (r < 0) return r; } } return error_OK; }
/* -------------------------------------------------------------------------- * Name: walk.c * Purpose: Associative array implemented as a hash * ----------------------------------------------------------------------- */ #include <stdlib.h> #include "base/memento/memento.h" #include "base/errors.h" #include "datastruct/hash.h" #include "impl.h" error hash_walk(const hash_t *h, hash_walk_callback *cb, void *cbarg) { int i; for (i = 0; i < h->nbins; i++) { hash__node_t *n; hash__node_t *next; for (n = h->bins[i]; n != NULL; n = next) { error r; next = n->next; r = cb(&n->item, cbarg); if (r < 0) return r; } } return error_OK; }
Fix itype int -> error.
Fix itype int -> error.
C
bsd-2-clause
dpt/Containers,dpt/Containers
0aeec8d488541f58a74a189972049937e92ea364
tests/regression/02-base/90-memcpy.c
tests/regression/02-base/90-memcpy.c
// Test case taken from sqlite3.c #include <string.h> typedef unsigned long u64; # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) static int sqlite3IsNaN(double x){ int rc; /* The value return */ u64 y; memcpy(&y,&x,sizeof(y)); // Goblint used to crash here rc = IsNaN(y); return rc; } int foo(){ int x = 23; int y; memcpy(&y, &x, sizeof(int)); __goblint_check(y == 23); return 0; } int main(){ sqlite3IsNaN(23.0); foo(); return 0; }
// Test case taken from sqlite3.c #include <string.h> typedef unsigned long u64; # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) static int sqlite3IsNaN(double x){ int rc; /* The value return */ u64 y; memcpy(&y,&x,sizeof(y)); // Goblint used to crash here rc = IsNaN(y); return rc; } int foo(){ int x = 23; int y; memcpy(&y, &x, sizeof(int)); __goblint_check(y == 23); return 0; } int bar(){ int arr[10]; double y; for(int i = 0; i < 10; i++){ arr[i] = 0; } __goblint_check(arr[0] == 0); __goblint_check(arr[3] == 0); memcpy(&arr, &y, sizeof(double)); __goblint_check(arr[0] == 0); //UNKNOWN! __goblint_check(arr[3] == 0); //UNKNOWN return 0; } int main(){ sqlite3IsNaN(23.0); foo(); bar(); return 0; }
Add test case checking that memcpy into an array invalidates it.
Add test case checking that memcpy into an array invalidates it.
C
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
642d8cd7b9669111aea0c22ec09530fab383593f
lepton/renderer.h
lepton/renderer.h
/**************************************************************************** * * Copyright (c) 2008 by Casey Duncan and contributors * All Rights Reserved. * * This software is subject to the provisions of the MIT License * A copy of the license should accompany this distribution. * 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. * ****************************************************************************/ /* Renderer shared code * * $Id$ */ #ifndef _RENDERER_H_ #define _RENDERER_H_ typedef struct { PyObject_HEAD Py_ssize_t size; float *data; } FloatArrayObject; /* Return true if o is a bon-a-fide FloatArrayObject */ int FloatArrayObject_Check(FloatArrayObject *o); FloatArrayObject * FloatArray_new(Py_ssize_t size); FloatArrayObject * generate_default_2D_tex_coords(GroupObject *pgroup); /* Initialize the glew OpenGL extension manager If glew has already been initialized, do nothing */ int glew_initialize(void); #endif
/**************************************************************************** * * Copyright (c) 2008 by Casey Duncan and contributors * All Rights Reserved. * * This software is subject to the provisions of the MIT License * A copy of the license should accompany this distribution. * 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. * ****************************************************************************/ /* Renderer shared code * * $Id$ */ #ifndef _RENDERER_H_ #define _RENDERER_H_ typedef struct { PyObject_HEAD Py_ssize_t size; float *data; } FloatArrayObject; /* Return true if o is a bon-a-fide FloatArrayObject */ int FloatArrayObject_Check(FloatArrayObject *o); FloatArrayObject * FloatArray_new(Py_ssize_t size); FloatArrayObject * generate_default_2D_tex_coords(GroupObject *pgroup); /* Initialize the glew OpenGL extension manager If glew has already been initialized, do nothing */ int glew_initialize(void); #endif // Windows lacks fminf #ifndef fminf #define fminf(x, y) (((x) < (y)) ? (x) : (y)) #endif
Define fminf for platforms that lack it
Define fminf for platforms that lack it
C
mit
pombreda/py-lepton,caseman/py-lepton,caseman/py-lepton,pombreda/py-lepton
813af68babfff1c261f491f463b04d5cce28282d
include/ROBASTInit.h
include/ROBASTInit.h
#include "stdio.h" __attribute__((constructor)) static void PrintReference() { printf(" ----------------------------------------------------------------------------\n" "| Welcome to ROBAST https://robast.github.io/ |\n" "| |\n" "| Please cite the following paper when you publish your ROBAST simulation. |\n" "| |\n" "| Akira Okumura, Koji Noda, Cameron Rulten (2016) |\n" "| \"ROBAST: Development of a ROOT-Based Ray-Tracing Library for Cosmic-Ray |\n" "| Telescopes and its Applications in the Cherenkov Telescope Array\" |\n" "| Astroparticle Physics 76 38-47 |\n" "| |\n" "| For support & FAQ, please visit https://robast.github.io/support.html |\n" "| |\n" "| ROBAST is developed by Akira Okumura (oxon@mac.com) |\n" " ----------------------------------------------------------------------------\n"); }
#include "stdio.h" __attribute__((constructor)) static void PrintReference() { printf(" ----------------------------------------------------------------------------\n" "| Welcome to ROBAST https://robast.github.io/ |\n" "| |\n" "| Please cite the following paper when you publish your ROBAST simulation. |\n" "| |\n" "| Akira Okumura, Koji Noda, Cameron Rulten (2016) |\n" "| \"ROBAST: Development of a ROOT-Based Ray-Tracing Library for Cosmic-Ray |\n" "| Telescopes and its Applications in the Cherenkov Telescope Array\" |\n" "| \e[3mAstroparticle Physics\e[0m \e[1m76\e[0m 38-47 |\n" "| |\n" "| For support & FAQ, please visit https://robast.github.io/support.html |\n" "| |\n" "| ROBAST is developed by Akira Okumura (oxon@mac.com) |\n" " ----------------------------------------------------------------------------\n"); }
Add escape sequences to make characters italic or bold
Add escape sequences to make characters italic or bold
C
lgpl-2.1
ROBAST/ROBAST,ROBAST/ROBAST,ROBAST/ROBAST,ROBAST/ROBAST,ROBAST/ROBAST
00f243db13be5124a76d09f6c15ae7ef41de0a94
include/inicpp/dll.h
include/inicpp/dll.h
#ifndef INICPP_DLL_H #define INICPP_DLL_H #ifdef INICPP_DLL #ifdef INICPP_EXPORT #define INICPP_API __declspec(dllexport) #else #define INICPP_API __declspec(dllimport) #endif #else #define INICPP_API #endif // Disable unwanted and not necessary MSVC++ warnings #pragma warning(disable:4800) #pragma warning(disable:4251) #endif // INICPP_DLL_H
#ifndef INICPP_DLL_H #define INICPP_DLL_H #ifdef INICPP_DLL #ifdef INICPP_EXPORT #define INICPP_API __declspec(dllexport) #else #define INICPP_API __declspec(dllimport) #endif #else #define INICPP_API #endif // Disable unwanted and not necessary MSVC++ warnings #ifdef _MSC_VER #pragma warning(disable:4800) #pragma warning(disable:4251) #endif #endif // INICPP_DLL_H
Enable disabling warnings using pragmas only on MSVC++
Enable disabling warnings using pragmas only on MSVC++
C
mit
SemaiCZE/inicpp,SemaiCZE/inicpp
f56aea747c00f3f9275189a33a8f81e9135b1469
texor.c
texor.c
#include <stdlib.h> #include <termios.h> #include <unistd.h> struct termios orig_termios; void disableRawMode() { tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios); } void enableRawMode() { tcgetattr(STDIN_FILENO, &orig_termios); atexit(disableRawMode); struct termios raw = orig_termios; raw.c_lflag &= ~(ECHO); tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw); } int main() { enableRawMode(); char c; while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q'); return 0; }
#include <stdlib.h> #include <termios.h> #include <unistd.h> struct termios orig_termios; void disableRawMode() { tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios); } void enableRawMode() { tcgetattr(STDIN_FILENO, &orig_termios); atexit(disableRawMode); struct termios raw = orig_termios; raw.c_lflag &= ~(ECHO | ICANON); tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw); } int main() { enableRawMode(); char c; while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q'); return 0; }
Disable canonical mode in terminal
Disable canonical mode in terminal
C
bsd-2-clause
kyletolle/texor
933d247dcf74b77442a9780fb885e59b60972439
include/ipv4.h
include/ipv4.h
#ifndef IPV4_H #define IPV4_H #include "syshead.h" #include "netdev.h" #define IPV4 0x04 #define ICMPV4 0x01 struct iphdr { uint8_t ihl : 4; /* TODO: Support Big Endian hosts */ uint8_t version : 4; uint8_t tos; uint16_t len; uint16_t id; uint16_t flags : 3; uint16_t frag_offset : 13; uint8_t ttl; uint8_t proto; uint16_t csum; uint32_t saddr; uint32_t daddr; } __attribute__((packed)); void ipv4_incoming(struct netdev *netdev, struct eth_hdr *hdr); #endif
#ifndef IPV4_H #define IPV4_H #include "syshead.h" #include "netdev.h" #define IPV4 0x04 #define ICMPV4 0x01 struct iphdr { uint8_t ihl : 4; /* TODO: Support Big Endian hosts */ uint8_t version : 4; uint8_t tos; uint16_t len; uint16_t id; uint16_t flags : 3; uint16_t frag_offset : 13; uint8_t ttl; uint8_t proto; uint16_t csum; uint32_t saddr; uint32_t daddr; uint8_t data[]; } __attribute__((packed)); void ipv4_incoming(struct netdev *netdev, struct eth_hdr *hdr); #endif
Add payload field to IPv4 header
Add payload field to IPv4 header
C
mit
saminiir/level-ip,saminiir/level-ip
a919944372d887ec6ea094621c4f0d4dc6dbf36a
app/src/unix/command.c
app/src/unix/command.c
#include "../command.h" #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> pid_t cmd_execute(const char *path, const char *const argv[]) { pid_t pid = fork(); if (pid == -1) { perror("fork"); return -1; } if (pid == 0) { execvp(path, (char *const *)argv); perror("exec"); exit(1); } return pid; } SDL_bool cmd_terminate(pid_t pid) { return kill(pid, SIGTERM) != -1; } SDL_bool cmd_simple_wait(pid_t pid, int *exit_code) { int status; int code; if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) { // cannot wait, or exited unexpectedly, probably by a signal code = -1; } else { code = WEXITSTATUS(status); } if (exit_code) { *exit_code = code; } return !code; }
#include "../command.h" #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> pid_t cmd_execute(const char *path, const char *const argv[]) { pid_t pid = fork(); if (pid == -1) { perror("fork"); return -1; } if (pid == 0) { execvp(path, (char *const *)argv); perror("exec"); _exit(1); } return pid; } SDL_bool cmd_terminate(pid_t pid) { return kill(pid, SIGTERM) != -1; } SDL_bool cmd_simple_wait(pid_t pid, int *exit_code) { int status; int code; if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) { // cannot wait, or exited unexpectedly, probably by a signal code = -1; } else { code = WEXITSTATUS(status); } if (exit_code) { *exit_code = code; } return !code; }
Use _exit() instead of exit() in child process
Use _exit() instead of exit() in child process exit() should not be called from within a child process, since it would call functions registered with atexit(), and flush stdio streams. Use _exit() instead.
C
apache-2.0
Genymobile/scrcpy,Genymobile/scrcpy,Genymobile/scrcpy
c25e3541c6cfc06393af108902fa4c3f768d00b2
src/main.c
src/main.c
#include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <unistd.h> #include "bmp.h" #define SIGNATURE_LENGTH 2 const char usage[] = "Usage: %s <filenname>\n"; int main(int argc, char *argv[]) { if (argc != 2) { printf(usage, argv[0]); return 1; } int fd = open(argv[1], O_RDONLY); char buf[SIGNATURE_LENGTH]; ssize_t bytes = read(fd, buf, SIGNATURE_LENGTH); if (bytes == -1) { perror("error reading file"); return 1; } lseek(fd, 0, SEEK_SET); switch (buf[0] << 8 | buf[1]) { case BMP_SIGNATURE: return print_bmp(fd); default: puts("Error: unrecognized file format"); return 1; } }
#include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <unistd.h> #include "bmp.h" #define SIGNATURE_LENGTH 2 const char usage[] = "Usage: %s <filenname>\n"; int main(int argc, char *argv[]) { if (argc != 2) { printf(usage, argv[0]); return 1; } int fd = open(argv[1], O_RDONLY); if (fd == -1) { perror("error opening file"); return 1; } char buf[SIGNATURE_LENGTH]; ssize_t bytes = read(fd, buf, SIGNATURE_LENGTH); if (bytes == -1) { perror("error reading file"); return 1; } lseek(fd, 0, SEEK_SET); switch (buf[0] << 8 | buf[1]) { case BMP_SIGNATURE: return print_bmp(fd); default: puts("Error: unrecognized file format"); return 1; } }
Check for error when calling open()
Check for error when calling open()
C
mit
orodley/imgprint
daf3a9e2f0ecaca59542decfacacca851264b92f
xmas3.c
xmas3.c
#include <stdlib.h> #include <stdio.h> int main(int argc, char*argv[]) { int length = 8; for (int i = 0;i<length;i++) { for (int j = 0;j<=i;j++) { printf("*"); } printf("\n"); } return 0; }
/*Build: gcc -std=c99 -o xmas3 xmas3.c*/ #include <stdlib.h> #include <stdio.h> int main(int argc, char*argv[]) { if (argc != 2) { printf("USAGE: %s [length]\n", argv[0]); exit(-1); } int length = atoi(argv[1]); for (int i = 0;i<length;i++) { for (int j = 0;j<=i;j++) { printf("*"); } printf("\n"); } return 0; }
Add length as a parameter in command line.
Add length as a parameter in command line.
C
mit
svagionitis/xmas-tree
9be8dcd2584b09ed00978daadb5ec6b597349b0d
cc2/optm.c
cc2/optm.c
#include "arch.h" #include "cc2.h" Node * optm(Node *np) { Node *dst; switch (np->op) { case OJMP: case OBRANCH: dst = np->u.sym->u.stmt; if (dst->op == OJMP) np->u.sym = dst->u.sym; break; } return np; }
#include <stddef.h> #include "arch.h" #include "cc2.h" Node * optm(Node *np) { Node *p, *dst, *next = np->next; Symbol *sym, *osym; switch (np->op) { case ONOP: if (next && next->op == ONOP) { sym = np->u.sym; osym = next->u.sym; osym->id = sym->id; osym->numid = sym->id; osym->u.stmt = sym->u.stmt; return NULL; } break; case OJMP: case OBRANCH: for (;;) { dst = np->u.sym->u.stmt; if (dst->op != OJMP) break; np->u.sym = dst->u.sym; } for (p = np->next; p; p = p->next) { if (p == dst) return NULL; if (p->op == ONOP || p->op == OBLOOP || p->op == OELOOP) { continue; } break; } break; } return np; }
Add general tree optimizations for jumps and labels
[cc2] Add general tree optimizations for jumps and labels These commit adds: - Remove consecutive labels - Jump to jump - Jump to next instruction
C
isc
k0gaMSX/scc,k0gaMSX/scc,k0gaMSX/scc
6d4e56790c4d798a66a7dd06fe381f0a2fdb6ae9
examples/specific/functionOverload.h
examples/specific/functionOverload.h
//! Function which takes two int arguments void f(int, int); //! Function which takes two double arguments void f(double, double); namespace test { //! Another function which takes two int arguments void g(int, int); //! Another function which takes two double arguments void g(double, double); } class MyType {}; class MyOtherType {}; //! Another function which takes a custom type void h(std::string, MyType); //! Another function which takes another custom type void h(std::string, MyOtherType); //! Another function which takes a basic type void h(std::string, int);
//! Non overloaded function void simplefunc(); //! Function which takes two int arguments void f(int, int); //! Function which takes two double arguments void f(double, double); namespace test { //! Another function which takes two int arguments void g(int, int); //! Another function which takes two double arguments void g(double, double); } class MyType {}; class MyOtherType {}; //! Another function which takes a custom type void h(std::string, MyType); //! Another function which takes another custom type void h(std::string, MyOtherType); //! Another function which takes a basic type void h(std::string, int);
Add simple function to test domain cpp:func
Add simple function to test domain cpp:func Probably others in the examples but this does no harm and was useful for testing.
C
bsd-3-clause
kirbyfan64/breathe,RR2DO2/breathe,kirbyfan64/breathe,AnthonyTruchet/breathe,RR2DO2/breathe,kirbyfan64/breathe,AnthonyTruchet/breathe,AnthonyTruchet/breathe,kirbyfan64/breathe,AnthonyTruchet/breathe
c1a763c34ed4726c08a37fd2125e00d2a5a75b6f
nix-test/src/sizes.c
nix-test/src/sizes.c
#include "sys/socket.h" #include "sys/uio.h" #define SIZE_OF_T(TYPE) \ do { \ if (0 == strcmp(type, #TYPE)) { \ return sizeof(TYPE); \ } \ } while (0) #define SIZE_OF_S(TYPE) \ do { \ if (0 == strcmp(type, #TYPE)) { \ return sizeof(struct TYPE); \ } \ } while (0) size_t size_of(const char* type) { // Builtin SIZE_OF_T(long); // sys/socket SIZE_OF_S(sockaddr_storage); // sys/uio SIZE_OF_S(iovec); return 0; }
#include <sys/socket.h> #include <sys/uio.h> #include <string.h> #define SIZE_OF_T(TYPE) \ do { \ if (0 == strcmp(type, #TYPE)) { \ return sizeof(TYPE); \ } \ } while (0) #define SIZE_OF_S(TYPE) \ do { \ if (0 == strcmp(type, #TYPE)) { \ return sizeof(struct TYPE); \ } \ } while (0) size_t size_of(const char* type) { // Builtin SIZE_OF_T(long); // sys/socket SIZE_OF_S(sockaddr_storage); // sys/uio SIZE_OF_S(iovec); return 0; }
Fix a compiler warning on FreeBSD
Fix a compiler warning on FreeBSD
C
mit
berkowski/nix,carllerche/nix-rust,xd009642/nix,kamalmarhubi/nix-rust,xd009642/nix,geofft/nix-rust,posborne/rust-nix,geofft/nix-rust,MarkusJais/nix-rust,nix-rust/nix,kamalmarhubi/nix-rust,posborne/rust-nix,xd009642/nix,carllerche/nix-rust,asomers/nix,MarkusJais/nix-rust,carllerche/nix-rust,berkowski/nix,Susurrus/nix,posborne/rust-nix,kamalmarhubi/nix-rust,MarkusJais/nix-rust,geofft/nix-rust,Susurrus/nix,berkowski/nix,nix-rust/nix,asomers/nix,Susurrus/nix
dabbb71c281f0e4b0f1466396ace097a8496b45a
some_cipher.h
some_cipher.h
#ifndef SOME_CIPHER_H #define SOME_CIPHER_H #include <stdint.h> #define ROUNDS 7 extern const uint16_t RCONS[]; extern const uint16_t TE0[16], TE1[16], TE2[16], TE3[16], TE4[16]; extern const uint16_t TD0[16], TD1[16], TD2[16], TD3[16], TD4[16]; extern const uint16_t MC_INV_0[16], MC_INV_1[16], MC_INV_2[16], MC_INV_3[16]; void encrypt(const uint16_t *input, uint16_t *output, const uint16_t *key); void decrypt(const uint16_t *input, uint16_t *output, const uint16_t *key); #endif
#ifndef SOME_CIPHER_H #define SOME_CIPHER_H #include <stdint.h> #define ROUNDS 6 extern const uint16_t RCONS[]; extern const uint16_t TE0[16], TE1[16], TE2[16], TE3[16], TE4[16]; extern const uint16_t TD0[16], TD1[16], TD2[16], TD3[16], TD4[16]; extern const uint16_t MC_INV_0[16], MC_INV_1[16], MC_INV_2[16], MC_INV_3[16]; void encrypt(const uint16_t *input, uint16_t *output, const uint16_t *key); void decrypt(const uint16_t *input, uint16_t *output, const uint16_t *key); #endif
Revert "extend to 7 rounds"
Revert "extend to 7 rounds" This reverts commit 2057f426e6c2e02aa9123e63b4c00bf7c8c0f586.
C
mit
wei2912/aes-idc,wei2912/aes-idc,wei2912/idc,wei2912/idc,wei2912/idc,wei2912/idc
9c3ee047dd5168c456c6b2fd6674c99b82aa04fe
cartridge.h
cartridge.h
#pragma once #include <istream> #include <memory> #include <vector> #include "types.h" #include "mbc.h" class Cartridge { const static size_t max_rom_size = 0x400000; // 4 MB std::vector<u8> rom; std::vector<u8> ram; std::unique_ptr<MemoryBankController> mbc; public: Cartridge() : rom(max_rom_size), ram(0x2000), mbc(new MBC1(rom, ram)) {} void load_rom(std::istream& src) { src.read(reinterpret_cast<char *>(rom.data()), max_rom_size); } u8 get8(uint address) const { return mbc->get8(address); } void set8(uint address, u8 value) { mbc->set8(address, value); } };
#pragma once #include <istream> #include <memory> #include <vector> #include "types.h" #include "mbc.h" class Cartridge { const static size_t max_rom_size = 0x400000; // 4 MB std::vector<u8> rom; std::vector<u8> ram; std::unique_ptr<MemoryBankController> mbc; public: Cartridge() : rom(max_rom_size), ram(0x20000), mbc(new MBC1(rom, ram)) { } void load_rom(std::istream& src) { src.read(reinterpret_cast<char *>(rom.data()), max_rom_size); } u8 get8(uint address) const { return mbc->get8(address); } void set8(uint address, u8 value) { mbc->set8(address, value); } };
Make RAM 128KB - big enough for any game
Cartridge: Make RAM 128KB - big enough for any game
C
mit
alastair-robertson/gameboy,alastair-robertson/gameboy,alastair-robertson/gameboy
f1d12e7392896f45a76df87b6ad0bf18647922df
include/pci_ids/virtio_gpu_pci_ids.h
include/pci_ids/virtio_gpu_pci_ids.h
CHIPSET(0x0010, VIRTGL, VIRTGL)
CHIPSET(0x0010, VIRTGL, VIRTGL) CHIPSET(0x1050, VIRTGL, VIRTGL)
Add virtio 1.0 PCI ID to driver map
virtio_gpu: Add virtio 1.0 PCI ID to driver map Add the virtio-gpu PCI ID for virtio 1.0 (according to the specification, "the PCI Device ID is calculated by adding 0x1040 to the Virtio Device ID") Support for virtio 1.0 was added in qemu 2.4 (same time virtio-gpu landed). Cc: "11.1 11.2" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org> Signed-off-by: Marc-André Lureau <a6f2b960a4aca61381fc650a67901b2ac8e83e6d@redhat.com> Reviewed-by: Emil Velikov <f20878473f414da183da19ee25c8722cc1d711e4@collabora.com>
C
mit
metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler
1eba4c3d6cbff506ed61c17b93db45bbf196b8d8
platforms/ios/framework/TangramMap.h
platforms/ios/framework/TangramMap.h
// // TangramMap.h // TangramMap // // Created by Matt Smollinger on 7/8/16. // // #import <UIKit/UIKit.h> /// Project version number for TangramMap. FOUNDATION_EXPORT double TangramMapVersionNumber; /// Project version string for TangramMap. FOUNDATION_EXPORT const unsigned char TangramMapVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <TangramMap/PublicHeader.h> #import <TangramMap/TGMapViewController.h>
// // TangramMap.h // TangramMap // // Created by Matt Smollinger on 7/8/16. // Updated by Karim Naaji on 2/28/17. // Copyright (c) 2017 Mapzen. All rights reserved. // #import <UIKit/UIKit.h> /// Project version number for TangramMap. FOUNDATION_EXPORT double TangramMapVersionNumber; /// Project version string for TangramMap. FOUNDATION_EXPORT const unsigned char TangramMapVersionString[]; #import <TangramMap/TGMapViewController.h> #import <TangramMap/TGMapData.h> #import <TangramMap/TGGeoPoint.h> #import <TangramMap/TGGeoPolygon.h> #import <TangramMap/TGGeoPolyline.h> #import <TangramMap/TGEaseType.h> #import <TangramMap/TGHttpHandler.h> #import <TangramMap/TGMarker.h> #import <TangramMap/TGMapData.h> #import <TangramMap/TGSceneUpdate.h> #import <TangramMap/TGMarkerPickResult.h> #import <TangramMap/TGLabelPickResult.h>
Update umbrella header with public interface
Update umbrella header with public interface
C
mit
quitejonny/tangram-es,cleeus/tangram-es,quitejonny/tangram-es,quitejonny/tangram-es,cleeus/tangram-es,cleeus/tangram-es,cleeus/tangram-es,quitejonny/tangram-es,tangrams/tangram-es,quitejonny/tangram-es,cleeus/tangram-es,tangrams/tangram-es,tangrams/tangram-es,tangrams/tangram-es,tangrams/tangram-es,tangrams/tangram-es,quitejonny/tangram-es,tangrams/tangram-es,cleeus/tangram-es
01a3e9afd47cef7924024e7c56eba732f49cf972
source/common/typedefs.h
source/common/typedefs.h
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef COMMON_TYPEDEFS_H #define COMMON_TYPEDEFS_H typedef unsigned char byte; typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned int uint; typedef __int64 int64; typedef unsigned __int64 uint64; #endif
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef COMMON_TYPEDEFS_H #define COMMON_TYPEDEFS_H typedef unsigned char byte; typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned int uint; typedef __int64 int64; typedef unsigned __int64 uint64; namespace DisposeAfterUse { enum Flag { NO, YES }; } #endif
Add namespace and enum for signaling auto-disposing
COMMON: Add namespace and enum for signaling auto-disposing
C
apache-2.0
RichieSams/thehalflingproject,RichieSams/thehalflingproject,RichieSams/thehalflingproject
faf3bc1eabc938b3ed9fa898b08ed8a9c47fb77e
project_config/lmic_project_config.h
project_config/lmic_project_config.h
// project-specific definitions for otaa sensor //#define CFG_eu868 1 //#define CFG_us915 1 //#define CFG_au921 1 #define CFG_as923 1 #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP //#define CFG_in866 1 #define CFG_sx1276_radio 1 //#define LMIC_USE_INTERRUPTS #define LMIC_DEBUG_LEVEL 2 #define LMIC_DEBUG_PRINTF_FN lmic_printf
// project-specific definitions for otaa sensor //#define CFG_eu868 1 #define CFG_us915 1 //#define CFG_au921 1 //#define CFG_as923 1 //#define CFG_in866 1 #define CFG_sx1276_radio 1 //#define LMIC_USE_INTERRUPTS
Set project_config back to defaults
Set project_config back to defaults
C
mit
mcci-catena/arduino-lmic,mcci-catena/arduino-lmic,mcci-catena/arduino-lmic
2757ab9ebaba347019468e3362abb4deee324140
ios/RCTOneSignal/RCTOneSignalEventEmitter.h
ios/RCTOneSignal/RCTOneSignalEventEmitter.h
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #import <React/RCTEventEmitter.h> #import <React/RCTConvert.h> #import <React/RCTEventDispatcher.h> #import <React/RCTUtils.h> #elif __has_include("RCTBridgeModule.h") #import "RCTBridgeModule.h" #import "RCTEventEmitter.h" #import "RCTConvert.h" #import "RCTEventDispatcher.h" #import "RCTUtils.h" #endif typedef NS_ENUM(NSInteger, OSNotificationEventTypes) { NotificationReceived, NotificationOpened, IdsAvailable, EmailSubscriptionChanged }; #define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription"] #define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum] @interface RCTOneSignalEventEmitter : RCTEventEmitter <RCTBridgeModule> + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body; + (BOOL)hasSetBridge; @end
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #import <React/RCTEventEmitter.h> #import <React/RCTConvert.h> #import <React/RCTEventDispatcher.h> #import <React/RCTUtils.h> #elif __has_include("RCTBridgeModule.h") #import "RCTBridgeModule.h" #import "RCTEventEmitter.h" #import "RCTConvert.h" #import "RCTEventDispatcher.h" #import "RCTUtils.h" #endif typedef NS_ENUM(NSInteger, OSNotificationEventTypes) { NotificationReceived, NotificationOpened, IdsAvailable, EmailSubscriptionChanged, InAppMessageClicked }; #define OSNotificationEventTypesArray @[@"OneSignal-remoteNotificationReceived",@"OneSignal-remoteNotificationOpened",@"OneSignal-idsAvailable",@"OneSignal-emailSubscription",@"OneSignal-inAppMessageClicked"] #define OSEventString(enum) [OSNotificationEventTypesArray objectAtIndex:enum] @interface RCTOneSignalEventEmitter : RCTEventEmitter <RCTBridgeModule> + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body; + (BOOL)hasSetBridge; @end
Add InAppMessage event to iOS
Add InAppMessage event to iOS
C
mit
geektimecoil/react-native-onesignal,geektimecoil/react-native-onesignal,geektimecoil/react-native-onesignal
4aec2351e289f194628e188b103800a08c6e829a
bigtable/api/parse_taq_line.h
bigtable/api/parse_taq_line.h
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://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 parse_taq_line_h #define parse_taq_line_h #include "taq.pb.h" #include <utility> namespace bigtable_api_samples { // Parse a line from a TAQ file and convert it to a quote. Quote parse_taq_line(int lineno, std::string const& line); } // namespace bigtable_api_samples #endif // parse_taq_line_h
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://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 parse_taq_line_h #define parse_taq_line_h #include "taq.pb.h" #include <utility> namespace bigtable_api_samples { // Parse a line from a TAQ file and convert it to a quote. // // TAQ files are delimiter (using '|' as the delimiter) separated text // files, using this format: // // timestamp|exchange|ticker|bid price|bid qty|offer price|offer qty|... // 093000123456789|K|GOOG|800.00|100|900.00|200|... // ... // END|20161024|78721395||||||||||||||||||||||||| // // The first line is a header, it defines the fields, each line // contains all the data for a quote, in this example we are only // interested in the first few fields, the last line is indicated by // the 'END' marker, it contains the date (timestamps are relative to // midnight on this date), and the total number of lines. Quote parse_taq_line(int lineno, std::string const& line); } // namespace bigtable_api_samples #endif // parse_taq_line_h
Document the format of the TAQ file.
Document the format of the TAQ file.
C
apache-2.0
GoogleCloudPlatform/cpp-samples,GoogleCloudPlatform/cpp-samples,GoogleCloudPlatform/cpp-samples,GoogleCloudPlatform/cpp-samples
ea1faeed8ecf8780e7b23f07a27b9c8e3e63d82c
swephelp/swhwin.h
swephelp/swhwin.h
/* Swephelp Copyright 2007-2014 Stanislas Marquis <smarquis@astrorigin.ch> Swephelp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Swephelp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Swephelp. If not, see <http://www.gnu.org/licenses/>. */ /** @file swhwin.h ** @brief swephelp windowz specific header */ #ifndef SWHWIN_H #define SWHWIN_H #ifdef WIN32 #define lround(num) \ ((long)(num > 0 ? num + 0.5 : ceil(num - 0.5))) #endif /* WIN32 */ #endif /* SWHWIN_H */ /* vi: set fenc=utf8 ff=unix et sw=4 ts=4 sts=4 : */
/* Swephelp Copyright 2007-2014 Stanislas Marquis <smarquis@astrorigin.ch> Swephelp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Swephelp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Swephelp. If not, see <http://www.gnu.org/licenses/>. */ /** @file swhwin.h ** @brief swephelp windowz specific header */ /* define WIN32 for MSVC compilers */ #ifdef _WIN32 #define WIN32 #endif #ifndef SWHWIN_H #define SWHWIN_H #ifdef WIN32 #define lround(num) \ ((long)(num > 0 ? num + 0.5 : ceil(num - 0.5))) #endif /* WIN32 */ #endif /* SWHWIN_H */ /* vi: set fenc=utf8 ff=unix et sw=4 ts=4 sts=4 : */
Define WIN32 for MSVC compilers
Define WIN32 for MSVC compilers Microsoft Visual C++ compilers define _WIN32 (with underscore) instead of WIN32 as gcc does when compiling on Windows. Pyswisseph fails to compile with MSVC compiler. This patch forces WIN32 to be defined if _WIN32 is defined by the MSVC compiler.
C
agpl-3.0
astrorigin/pyswisseph,astrorigin/pyswisseph
f8e8e58902fbaa14e2ea7c8a317747197d53bf37
src/processes/helpers/image/macros.h
src/processes/helpers/image/macros.h
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_PROCESSES_HELPER_IMAGE_MACROS_H #define VISTK_PROCESSES_HELPER_IMAGE_MACROS_H #include <boost/cstdint.hpp> /** * \file macros.h * * \brief Macros to help manage templates. */ #define TYPE_CHECK(type, name, function) \ if (pixtype == pixtypes::pixtype_##name()) \ { \ return &function<type>; \ } #define SPECIFY_FUNCTION(function) \ TYPE_CHECK(bool, bool, function) \ TYPE_CHECK(uint8_t, byte, function) \ TYPE_CHECK(float, float, function) \ TYPE_CHECK(double, double, function) #endif // VISTK_PROCESSES_HELPER_IMAGE_MACROS_H
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_PROCESSES_HELPER_IMAGE_MACROS_H #define VISTK_PROCESSES_HELPER_IMAGE_MACROS_H #include <boost/cstdint.hpp> /** * \file macros.h * * \brief Macros to help manage templates. */ #define TYPE_CHECK(type, name, function) \ if (pixtype == pixtypes::pixtype_##name()) \ { \ return &function<type>; \ } #define SPECIFY_FUNCTION(function) \ TYPE_CHECK(bool, bool, function) \ else TYPE_CHECK(uint8_t, byte, function) \ else TYPE_CHECK(float, float, function) \ else TYPE_CHECK(double, double, function) #endif // VISTK_PROCESSES_HELPER_IMAGE_MACROS_H
Use else in comparison chain
Use else in comparison chain
C
bsd-3-clause
Kitware/sprokit,mathstuf/sprokit,Kitware/sprokit,mathstuf/sprokit,linus-sherrill/sprokit,linus-sherrill/sprokit,Kitware/sprokit,mathstuf/sprokit,linus-sherrill/sprokit,Kitware/sprokit,mathstuf/sprokit,linus-sherrill/sprokit
4917024c9485d5ed3362ddcb1a0d0f8ee45dfedc
al/event.h
al/event.h
#ifndef AL_EVENT_H #define AL_EVENT_H #include "AL/al.h" #include "AL/alc.h" struct EffectState; enum { /* End event thread processing. */ EventType_KillThread = 0, /* User event types. */ EventType_SourceStateChange = 1<<0, EventType_BufferCompleted = 1<<1, EventType_Error = 1<<2, EventType_Performance = 1<<3, EventType_Deprecated = 1<<4, EventType_Disconnected = 1<<5, /* Internal events. */ EventType_ReleaseEffectState = 65536, }; struct AsyncEvent { unsigned int EnumType{0u}; union { char dummy; struct { ALuint id; ALenum state; } srcstate; struct { ALuint id; ALsizei count; } bufcomp; struct { ALenum type; ALuint id; ALuint param; ALchar msg[1008]; } user; EffectState *mEffectState; } u{}; AsyncEvent() noexcept = default; constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { } }; void StartEventThrd(ALCcontext *ctx); void StopEventThrd(ALCcontext *ctx); #endif
#ifndef AL_EVENT_H #define AL_EVENT_H #include "AL/al.h" #include "AL/alc.h" struct EffectState; enum { /* End event thread processing. */ EventType_KillThread = 0, /* User event types. */ EventType_SourceStateChange = 1<<0, EventType_BufferCompleted = 1<<1, EventType_Error = 1<<2, EventType_Performance = 1<<3, EventType_Deprecated = 1<<4, EventType_Disconnected = 1<<5, /* Internal events. */ EventType_ReleaseEffectState = 65536, }; struct AsyncEvent { unsigned int EnumType{0u}; union { char dummy; struct { ALuint id; ALenum state; } srcstate; struct { ALuint id; ALsizei count; } bufcomp; struct { ALenum type; ALuint id; ALuint param; ALchar msg[232]; } user; EffectState *mEffectState; } u{}; AsyncEvent() noexcept = default; constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { } }; void StartEventThrd(ALCcontext *ctx); void StopEventThrd(ALCcontext *ctx); #endif
Reduce the AsyncEvent struct size
Reduce the AsyncEvent struct size The "user" message length is significantly reduced to fit the struct in 256 bytes, rather than 1KB.
C
lgpl-2.1
aaronmjacobs/openal-soft,aaronmjacobs/openal-soft
f5fe521c850a02ae1f352bfb652e263c0c97d624
include/mozilla/Compiler.h
include/mozilla/Compiler.h
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ /* Various compiler checks. */ #ifndef mozilla_Compiler_h_ #define mozilla_Compiler_h_ #if !defined(__clang__) && defined(__GNUC__) /* * This macro should simplify gcc version checking. For example, to check * for gcc 4.5.1 or later, check `#ifdef MOZ_GCC_VERSION_AT_LEAST(4, 5, 1)`. */ # define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel) \ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \ >= ((major) * 10000 + (minor) * 100 + (patchlevel))) #if !MOZ_GCC_VERSION_AT_LEAST(4, 4, 0) # error "mfbt (and Gecko) require at least gcc 4.4 to build." #endif #endif #endif /* mozilla_Compiler_h_ */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ /* Various compiler checks. */ #ifndef mozilla_Compiler_h_ #define mozilla_Compiler_h_ #if !defined(__clang__) && defined(__GNUC__) /* * This macro should simplify gcc version checking. For example, to check * for gcc 4.5.1 or later, check `#ifdef MOZ_GCC_VERSION_AT_LEAST(4, 5, 1)`. */ # define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel) \ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \ >= ((major) * 10000 + (minor) * 100 + (patchlevel))) #if !MOZ_GCC_VERSION_AT_LEAST(4, 4, 0) // RBA: Not true for servo! //# error "mfbt (and Gecko) require at least gcc 4.4 to build." #endif #endif #endif /* mozilla_Compiler_h_ */
Disable error that forbids builds with gcc 4.2
Disable error that forbids builds with gcc 4.2
C
mpl-2.0
nox/rust-azure,Adenilson/rust-azure,larsbergstrom/rust-azure,Adenilson/rust-azure,notriddle/rust-azure,larsbergstrom/rust-azure,servo/rust-azure,servo/rust-azure,notriddle/rust-azure,nox/rust-azure,brendandahl/rust-azure,servo/rust-azure,pcwalton/rust-azure,mrobinson/rust-azure,notriddle/rust-azure,larsbergstrom/rust-azure,hyowon/rust-azure,hyowon/rust-azure,Adenilson/rust-azure,mbrubeck/rust-azure,akiss77/rust-azure,mrobinson/rust-azure,vvuk/rust-azure,dzbarsky/rust-azure,mmatyas/rust-azure,mbrubeck/rust-azure,akiss77/rust-azure,brendandahl/rust-azure,metajack/rust-azure,dzbarsky/rust-azure,akiss77/rust-azure,vvuk/rust-azure,mbrubeck/rust-azure,Adenilson/rust-azure,mrobinson/rust-azure,metajack/rust-azure,vvuk/rust-azure,dzbarsky/rust-azure,mmatyas/rust-azure,hyowon/rust-azure,pcwalton/rust-azure,notriddle/rust-azure,mmatyas/rust-azure,nox/rust-azure,brendandahl/rust-azure,mbrubeck/rust-azure,servo/rust-azure,mbrubeck/rust-azure,notriddle/rust-azure,pcwalton/rust-azure,pcwalton/rust-azure,mrobinson/rust-azure,pcwalton/rust-azure,larsbergstrom/rust-azure,hyowon/rust-azure,larsbergstrom/rust-azure,metajack/rust-azure,nox/rust-azure,mmatyas/rust-azure,vvuk/rust-azure,mrobinson/rust-azure,Adenilson/rust-azure,mmatyas/rust-azure,hyowon/rust-azure,akiss77/rust-azure,akiss77/rust-azure,dzbarsky/rust-azure,dzbarsky/rust-azure,servo/rust-azure,brendandahl/rust-azure,vvuk/rust-azure,brendandahl/rust-azure,metajack/rust-azure,nox/rust-azure,metajack/rust-azure
6a6590fbdfd0266f2d5b90552de3279b4b57b24f
ReactCommon/fabric/components/text/text/TextShadowNode.h
ReactCommon/fabric/components/text/text/TextShadowNode.h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <limits> #include <react/components/text/BaseTextShadowNode.h> #include <react/components/text/TextProps.h> #include <react/components/view/ViewEventEmitter.h> #include <react/core/ConcreteShadowNode.h> namespace facebook { namespace react { extern const char TextComponentName[]; using TextEventEmitter = TouchEventEmitter; class TextShadowNode : public ConcreteShadowNode< TextComponentName, ShadowNode, TextProps, TextEventEmitter>, public BaseTextShadowNode { public: static ShadowNodeTraits BaseTraits() { auto traits = ConcreteShadowNode::BaseTraits(); #ifdef ANDROID traits.set(ShadowNodeTraits::Trait::FormsView); traits.set(ShadowNodeTraits::Trait::FormsStackingContext); #endif return traits; } using ConcreteShadowNode::ConcreteShadowNode; #ifdef ANDROID using BaseShadowNode = ConcreteShadowNode< TextComponentName, ShadowNode, TextProps, TextEventEmitter>; TextShadowNode( ShadowNodeFragment const &fragment, ShadowNodeFamily::Shared const &family, ShadowNodeTraits traits) : BaseShadowNode(fragment, family, traits), BaseTextShadowNode() { orderIndex_ = std::numeric_limits<decltype(orderIndex_)>::max(); } #endif }; } // namespace react } // namespace facebook
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <limits> #include <react/components/text/BaseTextShadowNode.h> #include <react/components/text/TextProps.h> #include <react/components/view/ViewEventEmitter.h> #include <react/core/ConcreteShadowNode.h> namespace facebook { namespace react { extern const char TextComponentName[]; using TextEventEmitter = TouchEventEmitter; class TextShadowNode : public ConcreteShadowNode< TextComponentName, ShadowNode, TextProps, TextEventEmitter>, public BaseTextShadowNode { public: static ShadowNodeTraits BaseTraits() { auto traits = ConcreteShadowNode::BaseTraits(); #ifdef ANDROID traits.set(ShadowNodeTraits::Trait::FormsView); #endif return traits; } using ConcreteShadowNode::ConcreteShadowNode; #ifdef ANDROID using BaseShadowNode = ConcreteShadowNode< TextComponentName, ShadowNode, TextProps, TextEventEmitter>; TextShadowNode( ShadowNodeFragment const &fragment, ShadowNodeFamily::Shared const &family, ShadowNodeTraits traits) : BaseShadowNode(fragment, family, traits), BaseTextShadowNode() { orderIndex_ = std::numeric_limits<decltype(orderIndex_)>::max(); } #endif }; } // namespace react } // namespace facebook
Fix bug in TextInlineViews when using a deep nested hierarchy of Text and Images
Fix bug in TextInlineViews when using a deep nested hierarchy of Text and Images Summary: This fixes a bug in Android TextInlineViews that was reproducible in ActivityLog screen, see T63438920 Since Text are virtual nodes it is not necessary for these kind of views to stack views during diffing. changelog: [internal] Reviewed By: shergin Differential Revision: D20448085 fbshipit-source-id: 2d852975493bf6bcc7840c80c5de5cb5f7890303
C
mit
pandiaraj44/react-native,facebook/react-native,javache/react-native,exponentjs/react-native,javache/react-native,javache/react-native,janicduplessis/react-native,hoangpham95/react-native,janicduplessis/react-native,hammerandchisel/react-native,hoangpham95/react-native,exponentjs/react-native,janicduplessis/react-native,hammerandchisel/react-native,janicduplessis/react-native,exponent/react-native,pandiaraj44/react-native,hammerandchisel/react-native,hoangpham95/react-native,myntra/react-native,janicduplessis/react-native,facebook/react-native,pandiaraj44/react-native,myntra/react-native,myntra/react-native,exponent/react-native,exponentjs/react-native,janicduplessis/react-native,facebook/react-native,myntra/react-native,exponent/react-native,facebook/react-native,myntra/react-native,exponent/react-native,exponent/react-native,exponent/react-native,arthuralee/react-native,pandiaraj44/react-native,facebook/react-native,hoangpham95/react-native,hammerandchisel/react-native,myntra/react-native,exponent/react-native,javache/react-native,myntra/react-native,arthuralee/react-native,pandiaraj44/react-native,javache/react-native,janicduplessis/react-native,exponentjs/react-native,hoangpham95/react-native,exponent/react-native,hoangpham95/react-native,hammerandchisel/react-native,hammerandchisel/react-native,myntra/react-native,arthuralee/react-native,janicduplessis/react-native,arthuralee/react-native,exponentjs/react-native,exponentjs/react-native,javache/react-native,pandiaraj44/react-native,hammerandchisel/react-native,hoangpham95/react-native,exponentjs/react-native,javache/react-native,hoangpham95/react-native,facebook/react-native,facebook/react-native,pandiaraj44/react-native,facebook/react-native,pandiaraj44/react-native,javache/react-native,myntra/react-native,arthuralee/react-native,hammerandchisel/react-native,exponentjs/react-native,facebook/react-native,javache/react-native
a13984843e51c317f92843756b2fd5dbcc19b02b
Include/KAI/Platform/GameController.h
Include/KAI/Platform/GameController.h
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif // SHATTER_PLATFORM_GAME_CONTROLLER_H //EOF
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif //EOF
Add some color for console output
Add some color for console output Former-commit-id: 315cc71afe5d5245e60ce4564328619c49310b6a Former-commit-id: 4afa9ab712a2bdbef25bee286ff0bdcf2a8da2b2
C
mit
cschladetsch/KAI,cschladetsch/KAI,cschladetsch/KAI
64635220db85ed16109ee33387884bf5aa42bcaf
Settings/Updater/Version.h
Settings/Updater/Version.h
#pragma once #include <string> struct Version { public: const int major; const int minor; const int revision; Version(int major, int minor = 0, int revision = 0) : major(major), minor(minor), revision(revision) { } std::wstring ToString() { return std::to_wstring(major) + L"." + std::to_wstring(minor) + L"." + std::to_wstring(revision); } };
#pragma once #include <string> struct Version { public: Version(int major = 0, int minor = 0, int revision = 0) : _major(major), _minor(minor), _revision(revision) { } const int Major() { return _major; } const int Minor() { return _minor; } const int Revision() { return _revision; } } std::wstring ToString() { return std::to_wstring(_major) + L"." + std::to_wstring(_minor) + L"." + std::to_wstring(_revision); } private: int _major; int _minor; int _revision; };
Update instance variables, add getters
Update instance variables, add getters
C
bsd-2-clause
malensek/3RVX,malensek/3RVX,malensek/3RVX
578c65d5f619ede48ee99aa837a8600692d6edd6
NetKVM/Common/ParaNdis_DebugHistory.h
NetKVM/Common/ParaNdis_DebugHistory.h
#pragma once //#define ENABLE_HISTORY_LOG #if !defined(ENABLE_HISTORY_LOG) void FORCEINLINE ParaNdis_DebugHistory( PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4) { UNREFERENCED_PARAMETER(pContext); UNREFERENCED_PARAMETER(op); UNREFERENCED_PARAMETER(pParam1); UNREFERENCED_PARAMETER(lParam2); UNREFERENCED_PARAMETER(lParam3); UNREFERENCED_PARAMETER(lParam4); } #else void ParaNdis_DebugHistory( PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4); #endif
#pragma once //#define ENABLE_HISTORY_LOG //#define KEEP_PENDING_NBL #if !defined(KEEP_PENDING_NBL) void FORCEINLINE ParaNdis_DebugNBLIn(PNET_BUFFER_LIST nbl, ULONG& index) { UNREFERENCED_PARAMETER(nbl); UNREFERENCED_PARAMETER(index); } void FORCEINLINE ParaNdis_DebugNBLOut(ULONG index, PNET_BUFFER_LIST nbl) { UNREFERENCED_PARAMETER(index); UNREFERENCED_PARAMETER(nbl); } #else void ParaNdis_DebugNBLIn(PNET_BUFFER_LIST nbl, ULONG& index); void ParaNdis_DebugNBLOut(ULONG index, PNET_BUFFER_LIST nbl); #endif #if !defined(ENABLE_HISTORY_LOG) void FORCEINLINE ParaNdis_DebugHistory( PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4) { UNREFERENCED_PARAMETER(pContext); UNREFERENCED_PARAMETER(op); UNREFERENCED_PARAMETER(pParam1); UNREFERENCED_PARAMETER(lParam2); UNREFERENCED_PARAMETER(lParam3); UNREFERENCED_PARAMETER(lParam4); } #else void ParaNdis_DebugHistory( PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4); #endif
Add ability to keep array of pending TX NBLs
netkvm: Add ability to keep array of pending TX NBLs This debug instrumentation is resolved to nothing in regular release compilation. To enable it, uncomment KEEP_PENDING_NBL define in ParaNdis_DebugHistory.h Signed-off-by: Yuri Benditovich <9668326cb042de5d91fd7679dac7ca5ea402812c@daynix.com>
C
bsd-3-clause
vrozenfe/kvm-guest-drivers-windows,ladipro/kvm-guest-drivers-windows,YanVugenfirer/virtio-win-arm,YanVugenfirer/kvm-guest-drivers-windows,YanVugenfirer/virtio-win-arm,virtio-win/kvm-guest-drivers-windows,gnif/kvm-guest-drivers-windows,gnif/kvm-guest-drivers-windows,vrozenfe/kvm-guest-drivers-windows,ladipro/kvm-guest-drivers-windows,ladipro/kvm-guest-drivers-windows,vrozenfe/kvm-guest-drivers-windows,virtio-win/kvm-guest-drivers-windows,ladipro/kvm-guest-drivers-windows,YanVugenfirer/kvm-guest-drivers-windows,gnif/kvm-guest-drivers-windows,daynix/kvm-guest-drivers-windows,daynix/kvm-guest-drivers-windows,YanVugenfirer/kvm-guest-drivers-windows,daynix/kvm-guest-drivers-windows,virtio-win/kvm-guest-drivers-windows,vrozenfe/kvm-guest-drivers-windows,vrozenfe/kvm-guest-drivers-windows,YanVugenfirer/virtio-win-arm,YanVugenfirer/kvm-guest-drivers-windows,YanVugenfirer/virtio-win-arm,virtio-win/kvm-guest-drivers-windows,YanVugenfirer/kvm-guest-drivers-windows,virtio-win/kvm-guest-drivers-windows,gnif/kvm-guest-drivers-windows,daynix/kvm-guest-drivers-windows,daynix/kvm-guest-drivers-windows
d6f4a5106bebb23826c0867494ade7f4d7ebd1f3
examples/common/scpi-def.h
examples/common/scpi-def.h
#ifndef __SCPI_DEF_H_ #define __SCPI_DEF_H_ #include "scpi/scpi.h" extern scpi_t scpi_context; size_t SCPI_Write(scpi_t * context, const char * data, size_t len); int SCPI_Error(scpi_t * context, int_fast16_t err); scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val); scpi_result_t SCPI_Reset(scpi_t * context); scpi_result_t SCPI_Test(scpi_t * context); scpi_result_t SCPI_Flush(scpi_t * context); scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context); #endif // __SCPI_DEF_H_
#ifndef __SCPI_DEF_H_ #define __SCPI_DEF_H_ #include "scpi/scpi.h" extern scpi_t scpi_context; size_t SCPI_Write(scpi_t * context, const char * data, size_t len); int SCPI_Error(scpi_t * context, int_fast16_t err); scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val); scpi_result_t SCPI_Reset(scpi_t * context); int32_t SCPI_Test(scpi_t * context); scpi_result_t SCPI_Flush(scpi_t * context); scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context); #endif // __SCPI_DEF_H_
Correct *TST? callback in header file
Correct *TST? callback in header file
C
bsd-2-clause
j123b567/scpi-parser,koeart/scpi-parser,koeart/scpi-parser,j123b567/scpi-parser,RedPitaya/scpi-parser,RedPitaya/scpi-parser
1b7c7ce6555ac92929f131aebb3f7e21bef3f0a1
examples/minimal/minimal.c
examples/minimal/minimal.c
#include <Arika/Arika.h> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { ARFuncs* arFuncs = ar_init("t2-output/macosx-clang-debug-default/libarika-qt.dylib"); if (!arFuncs) return 0; arFuncs->window_create_main(); for (;;) { if (!arFuncs->update()) break; } //arFuncs->close(); return 0; }
#include <Arika/Arika.h> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { ARFuncs* arFuncs = ar_init("t2-output/macosx-clang-debug-default/libarika-qt.dylib"); if (!arFuncs) return 0; if (!arFuncs->ui_load("examples/minimal/minimal.ar")) return 0; //arFuncs->window_create_main(); for (;;) { if (!arFuncs->update()) break; } //arFuncs->close(); return 0; }
Use Lua for creating main window
Use Lua for creating main window
C
mit
emoon/Arika,emoon/Arika,emoon/Arika,emoon/Arika
e369bd1813b725ba6d6f2effeaa7bd7cb6013664
third-party/bsp/st_f4/arch.c
third-party/bsp/st_f4/arch.c
/** * @file * @brief * * @author Anton Kozlov * @date 30.10.2014 */ #include <assert.h> #include <stdint.h> #include <system_stm32f4xx.h> #include <framework/mod/options.h> #include <module/embox/arch/system.h> #include <hal/arch.h> void arch_init(void) { static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000); SystemInit(); } void arch_idle(void) { } void arch_shutdown(arch_shutdown_mode_t mode) { while (1); }
/** * @file * @brief * * @author Anton Kozlov * @date 30.10.2014 */ #include <assert.h> #include <stdint.h> #include <system_stm32f4xx.h> #include <framework/mod/options.h> #include <module/embox/arch/system.h> #include <hal/arch.h> #include <stm32f4xx_wwdg.h> void arch_init(void) { static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000); SystemInit(); } void arch_idle(void) { } void arch_shutdown(arch_shutdown_mode_t mode) { switch (mode) { case ARCH_SHUTDOWN_MODE_HALT: case ARCH_SHUTDOWN_MODE_REBOOT: case ARCH_SHUTDOWN_MODE_ABORT: default: NVIC_SystemReset(); } /* NOTREACHED */ while(1) { } }
Change shutdown to reset the board
stm32: Change shutdown to reset the board
C
bsd-2-clause
gzoom13/embox,embox/embox,abusalimov/embox,Kakadu/embox,mike2390/embox,mike2390/embox,vrxfile/embox-trik,vrxfile/embox-trik,abusalimov/embox,Kakadu/embox,Kakadu/embox,embox/embox,Kefir0192/embox,Kefir0192/embox,Kefir0192/embox,Kefir0192/embox,gzoom13/embox,vrxfile/embox-trik,gzoom13/embox,abusalimov/embox,vrxfile/embox-trik,Kakadu/embox,gzoom13/embox,Kefir0192/embox,embox/embox,abusalimov/embox,gzoom13/embox,vrxfile/embox-trik,mike2390/embox,gzoom13/embox,gzoom13/embox,Kakadu/embox,mike2390/embox,mike2390/embox,Kakadu/embox,Kakadu/embox,mike2390/embox,mike2390/embox,vrxfile/embox-trik,vrxfile/embox-trik,embox/embox,abusalimov/embox,abusalimov/embox,embox/embox,Kefir0192/embox,embox/embox,Kefir0192/embox
d49604b9ed52928f8a3b31cc560692f130928014
src/transaction_data.h
src/transaction_data.h
/* * the continuation data assigned to each request along side with the functions * to manipulate them * * Vmon: June 2013 */ #ifndef BANJAX_CONTINUATION_H #define BANJAX_CONTINUATION_H #include "banjax.h" #include "banjax_filter.h" #include "transaction_muncher.h" class Banjax; class TransactionData{ public: std::shared_ptr<Banjax> banjax; TSHttpTxn txnp; TransactionMuncher transaction_muncher; FilterResponse response_info; ~TransactionData(); /** Constructor to set the default values */ TransactionData(std::shared_ptr<Banjax> banjax, TSHttpTxn cur_txn) : banjax(std::move(banjax)) , txnp(cur_txn) , transaction_muncher(cur_txn) { } static int handle_transaction_change(TSCont contp, TSEvent event, void *edata); private: void handle_request(); void handle_response(); void handle_http_close(Banjax::TaskQueue& current_queue); }; #endif /*banjax_continuation.h*/
/* * the continuation data assigned to each request along side with the functions * to manipulate them * * Vmon: June 2013 */ #ifndef BANJAX_CONTINUATION_H #define BANJAX_CONTINUATION_H #include "banjax.h" #include "banjax_filter.h" #include "transaction_muncher.h" class Banjax; class TransactionData{ public: /** Constructor to set the default values */ TransactionData(std::shared_ptr<Banjax> banjax, TSHttpTxn cur_txn) : banjax(std::move(banjax)) , txnp(cur_txn) , transaction_muncher(cur_txn) { } static int handle_transaction_change(TSCont contp, TSEvent event, void *edata); ~TransactionData(); private: std::shared_ptr<Banjax> banjax; TSHttpTxn txnp; TransactionMuncher transaction_muncher; FilterResponse response_info; private: void handle_request(); void handle_response(); void handle_http_close(Banjax::TaskQueue& current_queue); }; #endif /*banjax_continuation.h*/
Make TransactionData member vars private
Make TransactionData member vars private
C
agpl-3.0
equalitie/banjax,equalitie/banjax,equalitie/banjax,equalitie/banjax,equalitie/banjax
47b545958603fb2f62b945985d191193183caeab
src/math/p_acos.c
src/math/p_acos.c
#include <math.h> #include <pal.h> static const float pi_2 = (float) M_PI / 2.f; /** * * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input * values to acos must be in the range -1 to 1. The result values are in the * range 0 to pi. The function does not check for illegal input values. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ void p_acos_f32(const float *a, float *c, int n) { int i; float tmp; /* acos x = pi/2 - asin x */ p_asin_f32(a, c, n); for (i = 0; i < n; i++) { tmp = pi_2 - c[i]; c[i] = tmp; } }
#include <pal.h> #include "p_asin.h" /** * * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input * values to acos must be in the range -1 to 1. The result values are in the * range 0 to pi. The function does not check for illegal input values. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ void p_acos_f32(const float *a, float *c, int n) { int i; /* acos x = pi/2 - asin x */ for (i = 0; i < n; i++) { c[i] = pi_2 - _p_asin(a[i]); } }
Use the inline inverse sine function.
math:acos: Use the inline inverse sine function. Signed-off-by: Mansour Moufid <ac5f6b12fab5e0d4efa7215e6c2dac9d55ab77dc@gmail.com>
C
apache-2.0
parallella/pal,Adamszk/pal3,olajep/pal,olajep/pal,olajep/pal,debug-de-su-ka/pal,mateunho/pal,debug-de-su-ka/pal,parallella/pal,parallella/pal,mateunho/pal,mateunho/pal,debug-de-su-ka/pal,8l/pal,8l/pal,aolofsson/pal,eliteraspberries/pal,aolofsson/pal,debug-de-su-ka/pal,eliteraspberries/pal,Adamszk/pal3,aolofsson/pal,parallella/pal,8l/pal,eliteraspberries/pal,olajep/pal,eliteraspberries/pal,eliteraspberries/pal,aolofsson/pal,Adamszk/pal3,mateunho/pal,mateunho/pal,Adamszk/pal3,8l/pal,debug-de-su-ka/pal,parallella/pal
cb3e05bc8b912e716811406333c5deedc06824be
src/condor_ckpt/condor_syscalls.h
src/condor_ckpt/condor_syscalls.h
#ifndef _CONDOR_SYSCALLS_H #define _CONDOR_SYSCALLS_H typedef int BOOL; static const int SYS_LOCAL = 1; static const int SYS_REMOTE = 0; static const int SYS_RECORDED = 2; static const int SYS_MAPPED = 2; static const int SYS_UNRECORDED = 0; static const int SYS_UNMAPPED = 0; #if defined(__cplusplus) extern "C" { #endif int SetSyscalls( int mode ); BOOL LocalSysCalls(); BOOL RemoteSysCalls(); BOOL MappingFileDescriptors(); int REMOTE_syscall( int syscall_num, ... ); int syscall( int, ... ); #if defined(__cplusplus) } #endif #endif
#ifndef _CONDOR_SYSCALLS_H #define _CONDOR_SYSCALLS_H #if defined( AIX32) # include "syscall.aix32.h" #else # include <syscall.h> #endif typedef int BOOL; static const int SYS_LOCAL = 1; static const int SYS_REMOTE = 0; static const int SYS_RECORDED = 2; static const int SYS_MAPPED = 2; static const int SYS_UNRECORDED = 0; static const int SYS_UNMAPPED = 0; #if defined(__cplusplus) extern "C" { #endif int SetSyscalls( int mode ); BOOL LocalSysCalls(); BOOL RemoteSysCalls(); BOOL MappingFileDescriptors(); int REMOTE_syscall( int syscall_num, ... ); #if defined(AIX32) && defined(__cplusplus) int syscall( ... ); #else int syscall( int, ... ); #endif #if defined(__cplusplus) } #endif #endif
Add inclusion of "syscall.aix32.h" or <syscall.h> depending on whether we are on an AIX machine where there is no <syscall.h>.
Add inclusion of "syscall.aix32.h" or <syscall.h> depending on whether we are on an AIX machine where there is no <syscall.h>.
C
apache-2.0
djw8605/htcondor,htcondor/htcondor,clalancette/condor-dcloud,djw8605/condor,zhangzhehust/htcondor,neurodebian/htcondor,mambelli/osg-bosco-marco,neurodebian/htcondor,htcondor/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,zhangzhehust/htcondor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,htcondor/htcondor,djw8605/condor,mambelli/osg-bosco-marco,bbockelm/condor-network-accounting,djw8605/htcondor,djw8605/condor,djw8605/condor,djw8605/htcondor,neurodebian/htcondor,clalancette/condor-dcloud,zhangzhehust/htcondor,bbockelm/condor-network-accounting,djw8605/htcondor,bbockelm/condor-network-accounting,djw8605/condor,neurodebian/htcondor,clalancette/condor-dcloud,htcondor/htcondor,djw8605/htcondor,djw8605/condor,mambelli/osg-bosco-marco,htcondor/htcondor,clalancette/condor-dcloud,neurodebian/htcondor,djw8605/htcondor,neurodebian/htcondor,clalancette/condor-dcloud,djw8605/htcondor,htcondor/htcondor,neurodebian/htcondor,mambelli/osg-bosco-marco,zhangzhehust/htcondor,mambelli/osg-bosco-marco,neurodebian/htcondor,djw8605/condor,djw8605/htcondor,mambelli/osg-bosco-marco,htcondor/htcondor,bbockelm/condor-network-accounting,zhangzhehust/htcondor,djw8605/condor,mambelli/osg-bosco-marco,clalancette/condor-dcloud,clalancette/condor-dcloud,htcondor/htcondor,zhangzhehust/htcondor,bbockelm/condor-network-accounting,djw8605/htcondor,bbockelm/condor-network-accounting,bbockelm/condor-network-accounting,zhangzhehust/htcondor,bbockelm/condor-network-accounting
6b15d7151f2703ce049ac9ab14b13c8b13122bf8
http.h
http.h
#ifndef HTTP_H #define HTTP_H #include <stddef.h> #define HTTP_GET 1 #define HTTP_HEAD 2 #define HTTP_POST 3 #define HTTP_PUT 4 #define HTTP_DELETE 5 #define FIELD_HOST 1 #define FIELD_LENGTH 2 #define FIELD_TYPE 3 #define ERR_BAD_REQ 0 #define ERR_NOT_FOUND 1 #define ERR_METHOD 2 #define ERR_FORBIDDEN 3 #define ERR_INTERNAL 4 typedef struct { int method; /* request method */ char* path; /* requested path */ char* host; /* hostname field */ char* type; /* content-type */ size_t length; /* content-length */ int flags; } http_request; /* Write an error page (and header). Returns number of bytes written. */ size_t gen_error_page( int fd, int error ); /* Write 200 Ok header with content length and content type. Returns the number of bytes written, 0 on failure. */ size_t http_ok( int fd, const char* type, unsigned long size ); /* parse a HTTP request, returns non-zero on success, zero on failure */ int http_request_parse( char* buffer, http_request* request ); #endif /* HTTP_H */
#ifndef HTTP_H #define HTTP_H #include <stddef.h> #define HTTP_GET 1 #define HTTP_HEAD 2 #define HTTP_POST 3 #define HTTP_PUT 4 #define HTTP_DELETE 5 #define FIELD_HOST 1 #define FIELD_LENGTH 2 #define FIELD_TYPE 3 #define ERR_BAD_REQ 0 #define ERR_NOT_FOUND 1 #define ERR_METHOD 2 #define ERR_FORBIDDEN 3 #define ERR_INTERNAL 4 typedef struct { int method; /* request method */ char* path; /* requested path */ char* host; /* hostname field */ char* type; /* content-type */ size_t length; /* content-length */ } http_request; /* Write an error page (and header). Returns number of bytes written. */ size_t gen_error_page( int fd, int error ); /* Write 200 Ok header with content length and content type. Returns the number of bytes written, 0 on failure. */ size_t http_ok( int fd, const char* type, unsigned long size ); /* parse a HTTP request, returns non-zero on success, zero on failure */ int http_request_parse( char* buffer, http_request* request ); #endif /* HTTP_H */
Remove unused flags field from request
Remove unused flags field from request Signed-off-by: David Oberhollenzer <ef97309e490485c1bad5018f0617d7fa37bc07ac@tele2.at>
C
agpl-3.0
AgentD/websrv,AgentD/websrv,AgentD/websrv
e31dfde23efa02f2f5480904fd0c895ce08acd9b
MONITOR/SORNotifier.h
MONITOR/SORNotifier.h
/************************************************************************** * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice * **************************************************************************/ #ifndef SORNOTIFIER_H #define SORNOTIFIER_H //______________________________________________________________________________ // // ECS Start-of-Run notifier // // This class "listens" to the SOR coming from the ECS. // // DIM #include <dic.hxx> class AliOnlineRecoTrigger; class SORNotifier: public DimUpdatedInfo { public: SORNotifier(AliOnlineRecoTrigger* trigger): DimUpdatedInfo("/LOGBOOK/SUBSCRIBE/ECS_SOR_PHYSICS", -1), fRun(-1), fTrigger(trigger) {} void infoHandler(); void errorHandler(int severity, int code, char *msg); int GetRun() const {return fRun;} private: SORNotifier(const SORNotifier& other); SORNotifier& operator = (const SORNotifier& other); int fRun; AliOnlineRecoTrigger* fTrigger; }; #endif
/************************************************************************** * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice * **************************************************************************/ #ifndef SORNOTIFIER_H #define SORNOTIFIER_H //______________________________________________________________________________ // // ECS Start-of-Run notifier // // This class "listens" to the SOR coming from the ECS. // // DIM #include <dic.hxx> class AliOnlineRecoTrigger; class SORNotifier: public DimUpdatedInfo { public: SORNotifier(AliOnlineRecoTrigger* trigger): DimUpdatedInfo("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS", -1), fRun(-1), fTrigger(trigger) {} void infoHandler(); void errorHandler(int severity, int code, char *msg); int GetRun() const {return fRun;} private: SORNotifier(const SORNotifier& other); SORNotifier& operator = (const SORNotifier& other); int fRun; AliOnlineRecoTrigger* fTrigger; }; #endif
Correct DIM service is DAQ_SOR_PHYSICS. In this case we get the trigger config from the logbook.
Correct DIM service is DAQ_SOR_PHYSICS. In this case we get the trigger config from the logbook.
C
bsd-3-clause
miranov25/AliRoot,sebaleh/AliRoot,miranov25/AliRoot,ecalvovi/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,mkrzewic/AliRoot,coppedis/AliRoot,jgrosseo/AliRoot,ALICEHLT/AliRoot,ALICEHLT/AliRoot,coppedis/AliRoot,miranov25/AliRoot,shahor02/AliRoot,coppedis/AliRoot,miranov25/AliRoot,miranov25/AliRoot,sebaleh/AliRoot,alisw/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,mkrzewic/AliRoot,sebaleh/AliRoot,coppedis/AliRoot,alisw/AliRoot,sebaleh/AliRoot,shahor02/AliRoot,shahor02/AliRoot,jgrosseo/AliRoot,jgrosseo/AliRoot,ecalvovi/AliRoot,ALICEHLT/AliRoot,ALICEHLT/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,alisw/AliRoot,jgrosseo/AliRoot,miranov25/AliRoot,alisw/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,shahor02/AliRoot,jgrosseo/AliRoot,miranov25/AliRoot,ecalvovi/AliRoot,mkrzewic/AliRoot,shahor02/AliRoot,jgrosseo/AliRoot,alisw/AliRoot,ALICEHLT/AliRoot,shahor02/AliRoot,coppedis/AliRoot,ecalvovi/AliRoot,mkrzewic/AliRoot,sebaleh/AliRoot,jgrosseo/AliRoot,miranov25/AliRoot,sebaleh/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,coppedis/AliRoot,coppedis/AliRoot,ecalvovi/AliRoot,mkrzewic/AliRoot,shahor02/AliRoot,alisw/AliRoot
b2f051ae390432789f2b02fe451aa23ae2698e3d
include/asm-frv/irq.h
include/asm-frv/irq.h
/* irq.h: FRV IRQ definitions * * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _ASM_IRQ_H_ #define _ASM_IRQ_H_ /* this number is used when no interrupt has been assigned */ #define NO_IRQ (-1) #define NR_IRQS 48 #define IRQ_BASE_CPU (0 * 16) #define IRQ_BASE_FPGA (1 * 16) #define IRQ_BASE_MB93493 (2 * 16) /* probe returns a 32-bit IRQ mask:-/ */ #define MIN_PROBE_IRQ (NR_IRQS - 32) #ifndef __ASSEMBLY__ static inline int irq_canonicalize(int irq) { return irq; } #endif #endif /* _ASM_IRQ_H_ */
/* irq.h: FRV IRQ definitions * * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _ASM_IRQ_H_ #define _ASM_IRQ_H_ #define NR_IRQS 48 #define IRQ_BASE_CPU (0 * 16) #define IRQ_BASE_FPGA (1 * 16) #define IRQ_BASE_MB93493 (2 * 16) /* probe returns a 32-bit IRQ mask:-/ */ #define MIN_PROBE_IRQ (NR_IRQS - 32) #ifndef __ASSEMBLY__ static inline int irq_canonicalize(int irq) { return irq; } #endif #endif /* _ASM_IRQ_H_ */
Remove bogus NO_IRQ = -1 define
frv: Remove bogus NO_IRQ = -1 define The old NO_IRQ define some platforms had was long ago declared obsolete and wrong. FRV should therefore not be re-introducing this, especially as IRQs are usually unsigned in the kernel. The "no IRQ" case is defined to be zero and Linus made this rather clear at the time. arch/frv shows no dependancy on this but it might show up driver fixes needing doing I guess Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@redhat.com> Acked-by: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com> Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
C
mit
KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas
36b7e11186070ed405e73db8666b21c41e55aa5a
prompt.c
prompt.c
#include <stdio.h> #include <stdlib.h> /* I am intentionally not doing the Windows portability stuff here since I am doing this for the language-implementation aspect, rather than the portability aspect. If it turns out the portability stuff is a big deal, I will come back and add in that code. -MAW */ #include <editline/readline.h> int main(int argc, char **argv) { /* Print Version and Exit information */ puts("Lispy Version 0.0.0.0.1"); puts("Press Ctrl-C to exit\n"); while(1) { /* prompt: */ char *input = readline("lispy> "); /* add input to command history */ add_history(input); printf("No, you're a %s\n", input); /* input was dynamically allocated */ free(input); } return 0; }
#include <stdio.h> #include <stdlib.h> /* I am intentionally not doing the Windows portability stuff here since I am doing this for the language-implementation aspect, rather than the portability aspect. If it turns out the portability stuff is a big deal, I will come back and add in that code. -MAW */ /* Fun SO link on target platform detection: http://stackoverflow.com/a/5920028/3435397 */ #include <editline/readline.h> int main(int argc, char **argv) { /* Print Version and Exit information */ puts("Lispy Version 0.0.0.0.1"); puts("Press Ctrl-C to exit\n"); while(1) { /* prompt: */ char *input = readline("lispy> "); /* add input to command history */ add_history(input); printf("No, you're a %s\n", input); /* input was dynamically allocated */ free(input); } return 0; }
Add a link to an SO answer about platform detection
Add a link to an SO answer about platform detection
C
mit
MattyDub/my-own-lisp
51d5be75475f3d03445f02b34dbaf9b5a31174c5
src/host/os_isfile.c
src/host/os_isfile.c
/** * \file os_isfile.c * \brief Returns true if the given file exists on the file system. * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project */ #include <sys/stat.h> #include "premake.h" int os_isfile(lua_State* L) { const char* filename = luaL_checkstring(L, 1); lua_pushboolean(L, do_isfile(filename)); return 1; } int do_isfile(const char* filename) { struct stat buf; #if PLATFORM_WINDOWS DWORD attrib = GetFileAttributesA(filename); if (attrib != INVALID_FILE_ATTRIBUTES) { return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0; } #else if (stat(filename, &buf) == 0) { return ((buf.st_mode & S_IFDIR) == 0); } #endif return 0; }
/** * \file os_isfile.c * \brief Returns true if the given file exists on the file system. * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project */ #include <sys/stat.h> #include "premake.h" int os_isfile(lua_State* L) { const char* filename = luaL_checkstring(L, 1); lua_pushboolean(L, do_isfile(filename)); return 1; } int do_isfile(const char* filename) { #if PLATFORM_WINDOWS DWORD attrib = GetFileAttributesA(filename); if (attrib != INVALID_FILE_ATTRIBUTES) { return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0; } #else struct stat buf; if (stat(filename, &buf) == 0) { return ((buf.st_mode & S_IFDIR) == 0); } #endif return 0; }
Fix a new Visual Studio unused variable build warning
Fix a new Visual Studio unused variable build warning
C
bsd-3-clause
LORgames/premake-core,CodeAnxiety/premake-core,bravnsgaard/premake-core,dcourtois/premake-core,CodeAnxiety/premake-core,sleepingwit/premake-core,premake/premake-core,resetnow/premake-core,lizh06/premake-core,TurkeyMan/premake-core,premake/premake-core,Blizzard/premake-core,CodeAnxiety/premake-core,Zefiros-Software/premake-core,aleksijuvani/premake-core,tvandijck/premake-core,mandersan/premake-core,mandersan/premake-core,noresources/premake-core,aleksijuvani/premake-core,aleksijuvani/premake-core,starkos/premake-core,jstewart-amd/premake-core,LORgames/premake-core,mandersan/premake-core,xriss/premake-core,TurkeyMan/premake-core,CodeAnxiety/premake-core,starkos/premake-core,sleepingwit/premake-core,mandersan/premake-core,lizh06/premake-core,noresources/premake-core,tvandijck/premake-core,mendsley/premake-core,jstewart-amd/premake-core,premake/premake-core,soundsrc/premake-core,xriss/premake-core,premake/premake-core,mendsley/premake-core,mendsley/premake-core,dcourtois/premake-core,starkos/premake-core,lizh06/premake-core,dcourtois/premake-core,noresources/premake-core,bravnsgaard/premake-core,dcourtois/premake-core,Blizzard/premake-core,noresources/premake-core,noresources/premake-core,soundsrc/premake-core,resetnow/premake-core,sleepingwit/premake-core,martin-traverse/premake-core,soundsrc/premake-core,mendsley/premake-core,tvandijck/premake-core,CodeAnxiety/premake-core,bravnsgaard/premake-core,bravnsgaard/premake-core,xriss/premake-core,dcourtois/premake-core,starkos/premake-core,TurkeyMan/premake-core,aleksijuvani/premake-core,dcourtois/premake-core,aleksijuvani/premake-core,soundsrc/premake-core,dcourtois/premake-core,Blizzard/premake-core,soundsrc/premake-core,starkos/premake-core,Blizzard/premake-core,Zefiros-Software/premake-core,jstewart-amd/premake-core,resetnow/premake-core,TurkeyMan/premake-core,starkos/premake-core,resetnow/premake-core,tvandijck/premake-core,premake/premake-core,martin-traverse/premake-core,martin-traverse/premake-core,resetnow/premake-core,sleepingwit/premake-core,sleepingwit/premake-core,Zefiros-Software/premake-core,xriss/premake-core,lizh06/premake-core,bravnsgaard/premake-core,Blizzard/premake-core,premake/premake-core,jstewart-amd/premake-core,martin-traverse/premake-core,mendsley/premake-core,LORgames/premake-core,Zefiros-Software/premake-core,premake/premake-core,jstewart-amd/premake-core,xriss/premake-core,noresources/premake-core,LORgames/premake-core,Blizzard/premake-core,LORgames/premake-core,tvandijck/premake-core,TurkeyMan/premake-core,mandersan/premake-core,noresources/premake-core,starkos/premake-core,Zefiros-Software/premake-core
9a3831ff69c0f341416b38bab7d9f27ebbda2304
src/imap/cmd-close.c
src/imap/cmd-close.c
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" #include "commands.h" #include "imap-expunge.h" bool cmd_close(struct client_command_context *cmd) { struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; struct mail_storage *storage; if (!client_verify_open_mailbox(cmd)) return TRUE; storage = mailbox_get_storage(mailbox); client->mailbox = NULL; if (!imap_expunge(mailbox, NULL)) client_send_untagged_storage_error(client, storage); if (mailbox_close(&mailbox) < 0) client_send_untagged_storage_error(client, storage); client_update_mailbox_flags(client, NULL); client_send_tagline(cmd, "OK Close completed."); return TRUE; }
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" #include "commands.h" #include "imap-expunge.h" bool cmd_close(struct client_command_context *cmd) { struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; struct mail_storage *storage; if (!client_verify_open_mailbox(cmd)) return TRUE; storage = mailbox_get_storage(mailbox); client->mailbox = NULL; if (!imap_expunge(mailbox, NULL)) client_send_untagged_storage_error(client, storage); else if (mailbox_sync(mailbox, 0, 0, NULL) < 0) client_send_untagged_storage_error(client, storage); if (mailbox_close(&mailbox) < 0) client_send_untagged_storage_error(client, storage); client_update_mailbox_flags(client, NULL); client_send_tagline(cmd, "OK Close completed."); return TRUE; }
Synchronize the mailbox after expunging messages to actually get them expunged.
CLOSE: Synchronize the mailbox after expunging messages to actually get them expunged. --HG-- branch : HEAD
C
mit
dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot
cefe89625e4728d349d8d3db1b9c81268178449d
lib/GPIOlib.h
lib/GPIOlib.h
#ifndef GPIOLIB_H #define GPIOLIB_H #define FORWARD 1 #define BACKWARD 0 namespace GPIO { int init(); int controlLeft(int direction,int speed); int controlRight(int direction,int speed); int stopLeft(); int stopRight(); int resetCounter(); void getCounter(int *countLeft,int *countRight); int turnTo(int angle); void delay(int milliseconds); } #endif
#ifndef GPIOLIB_H #define GPIOLIB_H #define FORWARD 1 #define BACKWARD 0 namespace GPIO { int init(); //direction is either FORWARD or BACKWARD. speed can be an integer ranging from 0 to 100. int controlLeft(int direction,int speed); int controlRight(int direction,int speed); int stopLeft(); int stopRight(); int resetCounter(); void getCounter(int *countLeft,int *countRight); //angle is available in the range of -90 to 90. int turnTo(int angle); void delay(int milliseconds); } #endif
Add some comments in the header file for understanding
Add some comments in the header file for understanding
C
mit
miaoxw/EmbeddedSystemNJU2017-Demo
fea168823acd6c1c50d3d366798a4314c79e6dc9
src/backend/port/dynloader/osf.c
src/backend/port/dynloader/osf.c
/* Dummy file used for nothing at this point * * see alpha.h * $PostgreSQL: pgsql/src/backend/port/dynloader/osf.c,v 1.2 2006/03/11 04:38:31 momjian Exp $ */
/* * $PostgreSQL: pgsql/src/backend/port/dynloader/osf.c,v 1.3 2009/04/21 21:05:25 tgl Exp $ * * Dummy file used for nothing at this point * * see osf.h */
Fix obsolete cross-reference (this file isn't called alpha.c anymore)
Fix obsolete cross-reference (this file isn't called alpha.c anymore)
C
mpl-2.0
Postgres-XL/Postgres-XL,tpostgres-projects/tPostgres,greenplum-db/gpdb,edespino/gpdb,pavanvd/postgres-xl,tpostgres-projects/tPostgres,edespino/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,arcivanov/postgres-xl,ovr/postgres-xl,yuanzhao/gpdb,50wu/gpdb,adam8157/gpdb,yuanzhao/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,arcivanov/postgres-xl,yazun/postgres-xl,jmcatamney/gpdb,jmcatamney/gpdb,Chibin/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,snaga/postgres-xl,zeroae/postgres-xl,yazun/postgres-xl,yuanzhao/gpdb,jmcatamney/gpdb,pavanvd/postgres-xl,oberstet/postgres-xl,lisakowen/gpdb,yuanzhao/gpdb,yazun/postgres-xl,arcivanov/postgres-xl,yuanzhao/gpdb,ashwinstar/gpdb,edespino/gpdb,tpostgres-projects/tPostgres,lisakowen/gpdb,ovr/postgres-xl,ashwinstar/gpdb,adam8157/gpdb,50wu/gpdb,50wu/gpdb,Postgres-XL/Postgres-XL,Chibin/gpdb,lisakowen/gpdb,ashwinstar/gpdb,snaga/postgres-xl,snaga/postgres-xl,techdragon/Postgres-XL,postmind-net/postgres-xl,yazun/postgres-xl,xinzweb/gpdb,edespino/gpdb,techdragon/Postgres-XL,pavanvd/postgres-xl,postmind-net/postgres-xl,yuanzhao/gpdb,50wu/gpdb,edespino/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,adam8157/gpdb,jmcatamney/gpdb,Chibin/gpdb,oberstet/postgres-xl,postmind-net/postgres-xl,ashwinstar/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,greenplum-db/gpdb,Chibin/gpdb,yuanzhao/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,oberstet/postgres-xl,xinzweb/gpdb,oberstet/postgres-xl,edespino/gpdb,yuanzhao/gpdb,edespino/gpdb,Chibin/gpdb,pavanvd/postgres-xl,postmind-net/postgres-xl,tpostgres-projects/tPostgres,ovr/postgres-xl,Chibin/gpdb,adam8157/gpdb,jmcatamney/gpdb,lisakowen/gpdb,xinzweb/gpdb,edespino/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,xinzweb/gpdb,50wu/gpdb,lisakowen/gpdb,arcivanov/postgres-xl,greenplum-db/gpdb,xinzweb/gpdb,yazun/postgres-xl,Chibin/gpdb,snaga/postgres-xl,Postgres-XL/Postgres-XL,greenplum-db/gpdb,ovr/postgres-xl,yuanzhao/gpdb,adam8157/gpdb,adam8157/gpdb,yuanzhao/gpdb,postmind-net/postgres-xl,kmjungersen/PostgresXL,techdragon/Postgres-XL,adam8157/gpdb,ashwinstar/gpdb,xinzweb/gpdb,edespino/gpdb,Chibin/gpdb,Chibin/gpdb,arcivanov/postgres-xl,Postgres-XL/Postgres-XL,Postgres-XL/Postgres-XL,arcivanov/postgres-xl,tpostgres-projects/tPostgres,jmcatamney/gpdb,snaga/postgres-xl,50wu/gpdb,zeroae/postgres-xl,ovr/postgres-xl,edespino/gpdb,kmjungersen/PostgresXL,Chibin/gpdb,kmjungersen/PostgresXL,greenplum-db/gpdb,50wu/gpdb,kmjungersen/PostgresXL,50wu/gpdb,zeroae/postgres-xl,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,adam8157/gpdb,kmjungersen/PostgresXL
159caac86902add83f4ff3a2d813559144806f98
src/forces/label_state.h
src/forces/label_state.h
#ifndef SRC_FORCES_LABEL_STATE_H_ #define SRC_FORCES_LABEL_STATE_H_ #include <Eigen/Core> #include <string> namespace Forces { /** * \brief * * */ class LabelState { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW LabelState(int id, std::string text, Eigen::Vector3f anchorPosition); const int id; const Eigen::Vector3f anchorPosition; Eigen::Vector3f labelPosition; Eigen::Vector2f anchorPosition2D; Eigen::Vector2f labelPosition2D; float labelPositionDepth; private: std::string text; }; } // namespace Forces #endif // SRC_FORCES_LABEL_STATE_H_
#ifndef SRC_FORCES_LABEL_STATE_H_ #define SRC_FORCES_LABEL_STATE_H_ #include <Eigen/Core> #include <string> namespace Forces { /** * \brief * * */ class LabelState { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW LabelState(int id, std::string text, Eigen::Vector3f anchorPosition); const int id; const Eigen::Vector3f anchorPosition; Eigen::Vector3f labelPosition; Eigen::Vector2f anchorPosition2D; Eigen::Vector2f labelPosition2D; float labelPositionDepth; const std::string text; }; } // namespace Forces #endif // SRC_FORCES_LABEL_STATE_H_
Make text in LabelState public.
Make text in LabelState public.
C
mit
Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller
83bd9b0b1e7de15e9f5c95fdc50b35d0379ce2c8
7segments.c
7segments.c
main(int u,char**a){for(char*c,y;y=u;u*=8)for(c=a[1];*c;)printf("%c%c%c%c",(y="$ֶ<&"[*c++-48])&u/2?33:32,y&u?95:32,y&u/4?33:32,*c?32:10);}
main(int u,char**a){for(char*c,y;y=u;u*=8,puts(""))for(c=a[1];*c;)printf("%c%c%c ",(y="$ֶ<&"[*c++-48])&u/2?33:32,y&u?95:32,y&u/4?33:32);}
Use puts again in a better position, save one byte (143)
Use puts again in a better position, save one byte (143)
C
mit
McZonk/7segements,McZonk/7segements
ecd76f902198765339c7923c2e3f8538a431ac1f
atomic_append.c
atomic_append.c
/* Exercise 5-3 */ #include <unistd.h> #include <fcntl.h> #include "tlpi_hdr.h" int main (int argc, char *argv[]) { if (argc < 3 || argc > 4) { usageErr("%s filename num-bytes [x]", argv[0]); } long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes"); Boolean x = argc == 4 && strcmp(argv[3], "x") == 0; int flags = O_WRONLY | O_CREAT; if (!x) { flags |= O_APPEND; } int fd = open(argv[1], flags, S_IWUSR | S_IRUSR); if (fd == -1) { errExit("open"); } while (n-- > 0) { if (x) { if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); } } if (write(fd, "a", 1) == -1) { errExit("write byte a"); } } }
/* Exercise 5-3 */ #include <unistd.h> #include <fcntl.h> #include "tlpi_hdr.h" int main (int argc, char *argv[]) { if (argc < 3 || argc > 4) { usageErr("%s filename num-bytes [x]", argv[0]); } long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes"); Boolean x = argc == 4 && strcmp(argv[3], "x") == 0; int flags = O_WRONLY | O_CREAT; if (!x) { flags |= O_APPEND; } int fd = open(argv[1], flags, S_IWUSR | S_IRUSR); if (fd == -1) { errExit("open"); } while (n-- > 0) { if (x) { if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); } } if (write(fd, "a", 1) == -1) { errExit("write byte a"); } } if (close(fd) == -1) { errExit("close output"); } exit(EXIT_SUCCESS); }
Add missing close for file descriptor
Add missing close for file descriptor
C
mit
dalleng/tlpi-exercises,timjb/tlpi-exercises,dalleng/tlpi-exercises,timjb/tlpi-exercises
620383bae31caa246a05bd77a1abdb88c2fb7543
iOS/Plugins/FlipperKitNetworkPlugin/FlipperKitNetworkPlugin/SKDispatchQueue.h
iOS/Plugins/FlipperKitNetworkPlugin/FlipperKitNetworkPlugin/SKDispatchQueue.h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. */ #if FB_SONARKIT_ENABLED #pragma once #import <dispatch/dispatch.h> namespace facebook { namespace flipper { class DispatchQueue { public: virtual void async(dispatch_block_t block) = 0; }; class GCDQueue: public DispatchQueue { public: GCDQueue(dispatch_queue_t underlyingQueue) :_underlyingQueue(underlyingQueue) { } void async(dispatch_block_t block) override { dispatch_async(_underlyingQueue, block); } virtual ~GCDQueue() { } private: dispatch_queue_t _underlyingQueue; }; } } #endif
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. */ #if FB_SONARKIT_ENABLED #pragma once #import <dispatch/dispatch.h> namespace facebook { namespace flipper { class DispatchQueue { public: virtual void async(dispatch_block_t block) = 0; virtual ~DispatchQueue() { } }; class GCDQueue: public DispatchQueue { public: GCDQueue(dispatch_queue_t underlyingQueue) :_underlyingQueue(underlyingQueue) { } void async(dispatch_block_t block) override { dispatch_async(_underlyingQueue, block); } virtual ~GCDQueue() { } private: dispatch_queue_t _underlyingQueue; }; } } #endif
Add virtual destructor to class with virtual functions but non-virtual destructor
Add virtual destructor to class with virtual functions but non-virtual destructor Reviewed By: jdthomas Differential Revision: D16954508 fbshipit-source-id: 958118843687145c1147ac5beeb2857b21332702
C
mit
facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper
088a3aedb31e5abdf0113f1259a2ef70eac6ee60
src/bin/e_int_config_modules.h
src/bin/e_int_config_modules.h
/* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ #ifdef E_TYPEDEFS #else #ifndef E_INT_CONFIG_MODULES_H #define E_INT_CONFIG_MODULES_H EAPI E_Config_Dialog *e_int_config_modules(E_Container *con, const char *params __UNUSED__); #endif #endif
/* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ #ifdef E_TYPEDEFS #else #ifndef E_INT_CONFIG_MODULES_H #define E_INT_CONFIG_MODULES_H EAPI E_Config_Dialog *e_int_config_modules(E_Container *con, const char *params); #endif #endif
Remove __UNUSED__ as it doesn't make sense here.
Remove __UNUSED__ as it doesn't make sense here. git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@38188 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
C
bsd-2-clause
jordemort/e17,jordemort/e17,jordemort/e17
5c51a6886e92c6c4fadee9eb484e93ba54b992b9
ivory-tower-freertos/ivory-freertos-wrapper/freertos_task_wrapper.c
ivory-tower-freertos/ivory-freertos-wrapper/freertos_task_wrapper.c
#include "freertos_task_wrapper.h" #include <FreeRTOS.h> #include <task.h> void ivory_freertos_task_create(void (*tsk)(void), uint32_t stacksize, uint8_t priority) { xTaskCreate((void (*)(void*)) tsk, /* this cast is undefined behavior */ NULL, stacksize, NULL, priority, NULL); } void ivory_freertos_task_delay(uint32_t time_ms) { vTaskDelay(time_ms); } void ivory_freertos_task_delayuntil(uint32_t *lastwaketime, uint32_t dt) { vTaskDelayUntil(lastwaketime, dt); } uint32_t ivory_freertos_task_getmilliscount(void) { return xTaskGetTickCount() / portTICK_RATE_MS; } uint32_t ivory_freertos_task_gettickcount(void) { return xTaskGetTickCount(); } uint32_t ivory_freertos_millistoticks(uint32_t ms) { return time * portTICK_RATE_MS; }
#include "freertos_task_wrapper.h" #include <FreeRTOS.h> #include <task.h> void ivory_freertos_task_create(void (*tsk)(void), uint32_t stacksize, uint8_t priority) { xTaskCreate((void (*)(void*)) tsk, /* this cast is undefined behavior */ NULL, stacksize, NULL, priority, NULL); } void ivory_freertos_task_delay(uint32_t time_ms) { vTaskDelay(time_ms); } void ivory_freertos_task_delayuntil(uint32_t *lastwaketime, uint32_t dt) { vTaskDelayUntil(lastwaketime, dt); } uint32_t ivory_freertos_task_getmilliscount(void) { return xTaskGetTickCount() / portTICK_RATE_MS; } uint32_t ivory_freertos_task_gettickcount(void) { return xTaskGetTickCount(); } uint32_t ivory_freertos_millistoticks(uint32_t ms) { return ms * portTICK_RATE_MS; }
Fix bug in ivory wrapper.
Fix bug in ivory wrapper.
C
bsd-3-clause
GaloisInc/ivory-tower-stm32,GaloisInc/tower,GaloisInc/ivory-tower-stm32,GaloisInc/ivory-tower-stm32
4890773efaf26e681f53447ede232df6eb5ee809
alura/c/adivinhacao.c
alura/c/adivinhacao.c
#include <stdio.h> int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; for(int i = 1; i <= 3; i++) { printf("Tentativa %d de 3\n", i); printf("Qual é o seu chute? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); int acertou = chute == numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); break; } else { int maior = chute > numerosecreto; if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } printf("Você errou!\n"); printf("Mas não desanime, tente de novo!\n"); } } printf("Fim de jogo!\n"); }
#include <stdio.h> #define NUMERO_DE_TENTATIVAS 5 int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) { printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS); printf("Qual é o seu chute? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); int acertou = chute == numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); break; } else { int maior = chute > numerosecreto; if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } printf("Você errou!\n"); printf("Mas não desanime, tente de novo!\n"); } } printf("Fim de jogo!\n"); }
Update files, Alura, Introdução a C, Aula 2.7
Update files, Alura, Introdução a C, Aula 2.7
C
mit
fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs
82c7b125af3eae9e65c1854c53fa1c8633508a2e
src/libsodium/include/sodium/export.h
src/libsodium/include/sodium/export.h
#ifndef __SODIUM_EXPORT_H__ #define __SODIUM_EXPORT_H__ #ifndef __GNUC__ # ifdef __attribute__ # undef __attribute__ # endif # define __attribute__(a) #endif #ifndef SODIUM_STATIC # if defined(_MSC_VER) # ifdef DLL_EXPORT # define SODIUM_EXPORT __declspec(dllexport) # else # define SODIUM_EXPORT __declspec(dllimport) # endif # else # if defined(__SUNPRO_C) # define SODIUM_EXPORT __attribute__ __global # elif defined(_MSG_VER) # define SODIUM_EXPORT extern __declspec(dllexport) # else # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) # endif # endif #endif #endif
#ifndef __SODIUM_EXPORT_H__ #define __SODIUM_EXPORT_H__ #ifndef __GNUC__ # ifdef __attribute__ # undef __attribute__ # endif # define __attribute__(a) #endif #ifdef SODIUM_STATIC # define SODIUM_EXPORT #else # if defined(_MSC_VER) # ifdef DLL_EXPORT # define SODIUM_EXPORT __declspec(dllexport) # else # define SODIUM_EXPORT __declspec(dllimport) # endif # else # if defined(__SUNPRO_C) # define SODIUM_EXPORT __attribute__ __global # elif defined(_MSG_VER) # define SODIUM_EXPORT extern __declspec(dllexport) # else # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) # endif # endif #endif #endif
Define an empty SODIUM_EXPORT if SODIUM_STATIC is defined.
Define an empty SODIUM_EXPORT if SODIUM_STATIC is defined.
C
isc
netroby/libsodium,optedoblivion/android_external_libsodium,pyparallel/libsodium,SpiderOak/libsodium,Payshare/libsodium,SpiderOak/libsodium,donpark/libsodium,SpiderOak/libsodium,Payshare/libsodium,kytvi2p/libsodium,paragonie-scott/libsodium,eburkitt/libsodium,donpark/libsodium,Payshares/libsodium,paragonie-scott/libsodium,netroby/libsodium,akkakks/libsodium,kytvi2p/libsodium,optedoblivion/android_external_libsodium,mvduin/libsodium,JackWink/libsodium,JackWink/libsodium,pyparallel/libsodium,soumith/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,mvduin/libsodium,soumith/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,GreatFruitOmsk/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,optedoblivion/android_external_libsodium,akkakks/libsodium,HappyYang/libsodium,eburkitt/libsodium,GreatFruitOmsk/libsodium,JackWink/libsodium,zhuqling/libsodium,Payshares/libsodium,mvduin/libsodium,paragonie-scott/libsodium,rustyhorde/libsodium,pmienk/libsodium,GreatFruitOmsk/libsodium,pmienk/libsodium,HappyYang/libsodium,akkakks/libsodium,akkakks/libsodium,Payshares/libsodium,Payshare/libsodium,tml/libsodium,zhuqling/libsodium,eburkitt/libsodium,soumith/libsodium,tml/libsodium,rustyhorde/libsodium,rustyhorde/libsodium,donpark/libsodium,rustyhorde/libsodium,pyparallel/libsodium,HappyYang/libsodium,tml/libsodium,zhuqling/libsodium,pmienk/libsodium,SpiderOak/libsodium,netroby/libsodium,kytvi2p/libsodium
42b8a1ed96ee13738b52cfe9ce9a48abc90c1e09
Fountain/Common/FTMutableDataSource.h
Fountain/Common/FTMutableDataSource.h
// // FTMutableDataSource.h // Fountain // // Created by Tobias Kraentzer on 15.09.15. // Copyright © 2015 Tobias Kräntzer. All rights reserved. // #import "FTDataSource.h" @protocol FTMutableDataSource <FTDataSource> #pragma mark Insertion - (BOOL)canInsertItem:(id)item; - (NSIndexPath *)insertItem:(id)item atProposedIndexPath:(NSIndexPath *)proposedIndexPath error:(NSError **)error; #pragma mark Editing - (BOOL)canEditItemAtIndexPath:(NSIndexPath *)indexPath; #pragma mark Deletion - (BOOL)canDeleteItemAtIndexPath:(NSIndexPath *)indexPath; - (void)deleteItemAtIndexPath:(NSIndexPath *)indexPath __attribute__((deprecated)); - (BOOL)deleteItemAtIndexPath:(NSIndexPath *)indexPath error:(NSError **)error; @end
// // FTMutableDataSource.h // Fountain // // Created by Tobias Kraentzer on 15.09.15. // Copyright © 2015 Tobias Kräntzer. All rights reserved. // #import "FTDataSource.h" @protocol FTMutableDataSource <FTDataSource> #pragma mark Insertion - (BOOL)canInsertItem:(id)item; - (NSIndexPath *)insertItem:(id)item atProposedIndexPath:(NSIndexPath *)proposedIndexPath error:(NSError **)error; #pragma mark Editing - (BOOL)canEditItemAtIndexPath:(NSIndexPath *)indexPath; #pragma mark Deletion - (BOOL)canDeleteItemAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)deleteItemAtIndexPath:(NSIndexPath *)indexPath error:(NSError **)error; @end
Remove leftover method in protocol
Remove leftover method in protocol
C
bsd-3-clause
anagromataf/Fountain,anagromataf/Fountain
05f753b996a6ea712ab06787190fb3287610fc59
include/clang/AST/TargetBuiltins.h
include/clang/AST/TargetBuiltins.h
//===--- TargetBuiltins.h - Target specific builtin IDs -------------------===// // // The LLVM Compiler Infrastructure // // This file was developed by Anders Carlsson and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_TARGET_BUILTINS_H #define LLVM_CLANG_AST_TARGET_BUILTINS_H #include "clang/AST/Builtins.h" namespace clang { /// X86 builtins namespace X86 { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "X86Builtins.def" LastTSBuiltin }; } /// PPC builtins namespace PPC { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "PPCBuiltins.def" LastTSBuiltin }; } } #endif
//===--- TargetBuiltins.h - Target specific builtin IDs -------------------===// // // The LLVM Compiler Infrastructure // // This file was developed by Anders Carlsson and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_TARGET_BUILTINS_H #define LLVM_CLANG_AST_TARGET_BUILTINS_H #include "clang/AST/Builtins.h" /// X86 builtins namespace X86 { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "X86Builtins.def" LastTSBuiltin }; } /// PPC builtins namespace PPC { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "PPCBuiltins.def" LastTSBuiltin }; } #endif
Revert change that broke the build.
Revert change that broke the build. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@44808 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang
310f90109c4f4aeaaa50417e467ec7fc8c66d08b
chapter01/log.h
chapter01/log.h
#ifndef LOG_H #define LOG_H #include <time.h> typedef struct data_struct { time_t time; char *string; } data_t; int addmsg(data_t data); void clearlog(void); char *getlog(void); int savelog(char *filename); #endif
#ifndef LOG_H #define LOG_H #include <time.h> typedef struct data_struct { time_t time; char *string; } data_t; int addmsg(data_t data); void clearlog(void); char *getlog(void); int savelog(const char *filename); #endif
Make the char * parameter as const char *
Make the char * parameter as const char *
C
bsd-2-clause
abhinav-upadhyay/unix-systems-programming
1bc8e14e5857e509cda58858e101641a7c7ea4a4
src/kernel/sched/strategy/sched_strategy.h
src/kernel/sched/strategy/sched_strategy.h
/** * @file * @brief * * @date 06.03.2013 * @author Anton Bulychev */ #ifndef KERNEL_THREAD_SCHED_STRATEGY_H_ #define KERNEL_THREAD_SCHED_STRATEGY_H_ #include <kernel/sched/affinity.h> #include <kernel/sched/runq.h> #include <kernel/sched/sched_timing.h> #include <kernel/sched/sched_priority.h> struct runq { runq_t queue; }; struct sched_attr { runq_item_t runq_link; affinity_t affinity; sched_timing_t sched_time; thread_priority_t thread_priority; }; #endif /* KERNEL_THREAD_SCHED_STRATEGY_H_ */
/** * @file * @brief * * @date 06.03.2013 * @author Anton Bulychev */ #ifndef KERNEL_THREAD_SCHED_STRATEGY_H_ #define KERNEL_THREAD_SCHED_STRATEGY_H_ #include <kernel/spinlock.h> #include <kernel/sched/affinity.h> #include <kernel/sched/runq.h> #include <kernel/sched/sched_timing.h> #include <kernel/sched/sched_priority.h> struct runq { runq_t queue; spinlock_t lock; }; struct sched_attr { runq_item_t runq_link; affinity_t affinity; sched_timing_t sched_time; thread_priority_t thread_priority; }; #endif /* KERNEL_THREAD_SCHED_STRATEGY_H_ */
Add lock to runq struct
sched: Add lock to runq struct
C
bsd-2-clause
Kefir0192/embox,embox/embox,Kakadu/embox,abusalimov/embox,Kefir0192/embox,gzoom13/embox,gzoom13/embox,gzoom13/embox,abusalimov/embox,vrxfile/embox-trik,Kakadu/embox,Kakadu/embox,mike2390/embox,abusalimov/embox,mike2390/embox,mike2390/embox,Kefir0192/embox,gzoom13/embox,vrxfile/embox-trik,Kakadu/embox,embox/embox,gzoom13/embox,abusalimov/embox,embox/embox,Kefir0192/embox,embox/embox,vrxfile/embox-trik,gzoom13/embox,mike2390/embox,Kefir0192/embox,vrxfile/embox-trik,abusalimov/embox,mike2390/embox,gzoom13/embox,vrxfile/embox-trik,embox/embox,Kefir0192/embox,Kefir0192/embox,abusalimov/embox,vrxfile/embox-trik,Kakadu/embox,Kakadu/embox,mike2390/embox,mike2390/embox,embox/embox,Kakadu/embox,vrxfile/embox-trik
9a3ea15d4b3af5994084fde9002cd969a2a76d78
Opserver.Core/OpserverCore.cs
Opserver.Core/OpserverCore.cs
using StackExchange.Elastic; namespace StackExchange.Opserver { public class OpserverCore { // Initializes various bits in OpserverCore like exception logging and such so that projects using the core need not load up all references to do so. public static void Init() { try { ElasticException.ExceptionDataPrefix = ExtensionMethods.ExceptionLogPrefix; ElasticException.ExceptionOccurred += e => Current.LogException(e); } catch { } } } }
using StackExchange.Elastic; namespace StackExchange.Opserver { public class OpserverCore { // Initializes various bits in OpserverCore like exception logging and such so that projects using the core need not load up all references to do so. public static void Init() { try { ElasticException.ExceptionDataPrefix = ExtensionMethods.ExceptionLogPrefix; // We're going to get errors - that's kinda the point of monitoring // No need to log every one here unless for crazy debugging //ElasticException.ExceptionOccurred += e => Current.LogException(e); } catch { } } } }
Comment out per-error logging, now only needed for logging
Comment out per-error logging, now only needed for logging
C#
mit
VictoriaD/Opserver,wuanunet/Opserver,dteg/Opserver,mqbk/Opserver,baflynn/Opserver,agrath/Opserver,opserver/Opserver,vebin/Opserver,GABeech/Opserver,jeddytier4/Opserver,a9261/Opserver,opserver/Opserver,huoxudong125/Opserver,volkd/Opserver,18098924759/Opserver,rducom/Opserver,manesiotise/Opserver,manesiotise/Opserver,GABeech/Opserver,navone/Opserver,jeddytier4/Opserver,geffzhang/Opserver,IDisposable/Opserver,agrath/Opserver,vebin/Opserver,hotrannam/Opserver,18098924759/Opserver,hotrannam/Opserver,michaelholzheimer/Opserver,manesiotise/Opserver,rducom/Opserver,maurobennici/Opserver,maurobennici/Opserver,Janiels/Opserver,navone/Opserver,vbfox/Opserver,a9261/Opserver,baflynn/Opserver,huoxudong125/Opserver,geffzhang/Opserver,volkd/Opserver,vbfox/Opserver,dteg/Opserver,IDisposable/Opserver,michaelholzheimer/Opserver,Janiels/Opserver,VictoriaD/Opserver,mqbk/Opserver,opserver/Opserver,wuanunet/Opserver
3312617532ff01be4ad5de2e59e280e17d704a03
SQLitePCL.pretty/ResultSet.cs
SQLitePCL.pretty/ResultSet.cs
/* Copyright 2014 David Bordoley Copyright 2014 Zumero, LLC 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. */ using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; namespace SQLitePCL.pretty { public static class ResultSet { public static IEnumerable<IColumnInfo> Columns(this IReadOnlyList<IResultSetValue> rs) { Contract.Requires(rs != null); return rs.Select(value => value.ColumnInfo); } } }
/* Copyright 2014 David Bordoley Copyright 2014 Zumero, LLC 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. */ using System.Collections; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; namespace SQLitePCL.pretty { public static class ResultSet { public static IReadOnlyList<IColumnInfo> Columns(this IReadOnlyList<IResultSetValue> rs) { Contract.Requires(rs != null); return new ResultSetColumnsListImpl(rs); } internal sealed class ResultSetColumnsListImpl : IReadOnlyList<IColumnInfo> { private readonly IReadOnlyList<IResultSetValue> rs; internal ResultSetColumnsListImpl(IReadOnlyList<IResultSetValue> rs) { this.rs = rs; } public IColumnInfo this[int index] { get { return rs[index].ColumnInfo; } } public int Count { get { return rs.Count; } } public IEnumerator<IColumnInfo> GetEnumerator() { return rs.Select(val => val.ColumnInfo).GetEnumerator(); } IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this.GetEnumerator(); } } } }
Change Columns static method to return IReadOnlyList.
Change Columns static method to return IReadOnlyList.
C#
apache-2.0
bordoley/SQLitePCL.pretty,matrostik/SQLitePCL.pretty
89013e65ca66f6e1c1180e7ecbc290acbf64c884
Contentful.Core/Models/File.cs
Contentful.Core/Models/File.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents information about the actual binary file of an <see cref="Asset"/>. /// </summary> public class File { /// <summary> /// The original name of the file. /// </summary> public string FileName { get; set; } /// <summary> /// The content type of the data contained within this file. /// </summary> public string ContentType { get; set; } /// <summary> /// An absolute URL to this file. /// </summary> public string Url { get; set; } /// <summary> /// Detailed information about the file stored by Contentful. /// </summary> public FileDetails Details { get; set; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents information about the actual binary file of an <see cref="Asset"/>. /// </summary> public class File { /// <summary> /// The original name of the file. /// </summary> public string FileName { get; set; } /// <summary> /// The content type of the data contained within this file. /// </summary> public string ContentType { get; set; } /// <summary> /// An absolute URL to this file. /// </summary> public string Url { get; set; } /// <summary> /// The url to upload this file from. /// </summary> [JsonProperty("upload")] public string UploadUrl { get; set; } /// <summary> /// Detailed information about the file stored by Contentful. /// </summary> public FileDetails Details { get; set; } } }
Add upload property to file
Add upload property to file
C#
mit
contentful/contentful.net
4e3ea0a2b5e3b98435822788af14bac9534c95ef
ArcGIS.ServiceModel.Serializers.JsonDotNet/JsonDotNetSerializer.cs
ArcGIS.ServiceModel.Serializers.JsonDotNet/JsonDotNetSerializer.cs
using System; using System.Collections.Generic; using ArcGIS.ServiceModel; using ArcGIS.ServiceModel.Operation; namespace ArcGIS.Test { public class JsonDotNetSerializer : ISerializer { static ISerializer _serializer = null; public static void Init() { _serializer = new JsonDotNetSerializer(); SerializerFactory.Get = (() => _serializer ?? new JsonDotNetSerializer()); } readonly Newtonsoft.Json.JsonSerializerSettings _settings; public JsonDotNetSerializer() { _settings = new Newtonsoft.Json.JsonSerializerSettings { NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore, ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() }; } public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters { var stringValue = Newtonsoft.Json.JsonConvert.SerializeObject(objectToConvert, _settings); var jobject = Newtonsoft.Json.Linq.JObject.Parse(stringValue); var dict = new Dictionary<String, String>(); foreach (var item in jobject) { dict.Add(item.Key, item.Value.ToString()); } return dict; } public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse { return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(dataToConvert, _settings); } } }
using System; using System.Collections.Generic; using ArcGIS.ServiceModel; using ArcGIS.ServiceModel.Operation; namespace ArcGIS.ServiceModel.Serializers { public class JsonDotNetSerializer : ISerializer { static ISerializer _serializer = null; public static void Init() { _serializer = new JsonDotNetSerializer(); SerializerFactory.Get = (() => _serializer ?? new JsonDotNetSerializer()); } readonly Newtonsoft.Json.JsonSerializerSettings _settings; public JsonDotNetSerializer() { _settings = new Newtonsoft.Json.JsonSerializerSettings { NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore, ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() }; } public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters { var stringValue = Newtonsoft.Json.JsonConvert.SerializeObject(objectToConvert, _settings); var jobject = Newtonsoft.Json.Linq.JObject.Parse(stringValue); var dict = new Dictionary<String, String>(); foreach (var item in jobject) { dict.Add(item.Key, item.Value.ToString()); } return dict; } public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse { return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(dataToConvert, _settings); } } }
Use same namespace for serializers
Use same namespace for serializers
C#
mit
davetimmins/ArcGIS.PCL,davetimmins/ArcGIS.PCL
73393ca52a0d3b0a4ed09d0da96e08a8d39f88af
XSerializer/Encryption/EncryptionMechanism.cs
XSerializer/Encryption/EncryptionMechanism.cs
namespace XSerializer.Encryption { /// <summary> /// Provides a mechanism for an application to specify an instance of /// <see cref="IEncryptionMechanism"/> to be used by XSerializer when /// encrypting or decrypting data. /// </summary> public static class EncryptionMechanism { /// <summary> /// The default instance of <see cref="IEncryptionMechanism"/>. /// </summary> public static readonly IEncryptionMechanism _defaultEncryptionMechanism = new ClearTextEncryptionMechanism(); private static IEncryptionMechanism _current = _defaultEncryptionMechanism; /// <summary> /// Gets or sets the instance of <see cref="IEncryptionMechanism"/> /// to be used by XSerializer when encrypting or decrypting data. /// When setting this property, if <paramref name="value"/> is null, /// then <see cref="_defaultEncryptionMechanism"/> will be used instead. /// </summary> public static IEncryptionMechanism Current { internal get { return _current; } set { _current = value ?? _defaultEncryptionMechanism; } } } }
namespace XSerializer.Encryption { /// <summary> /// Provides a mechanism for an application to specify an instance of /// <see cref="IEncryptionMechanism"/> to be used by XSerializer when /// encrypting or decrypting data. /// </summary> public static class EncryptionMechanism { /// <summary> /// The default instance of <see cref="IEncryptionMechanism"/>. /// </summary> public static readonly IEncryptionMechanism DefaultEncryptionMechanism = new ClearTextEncryptionMechanism(); private static IEncryptionMechanism _current = DefaultEncryptionMechanism; /// <summary> /// Gets or sets the instance of <see cref="IEncryptionMechanism"/> /// to be used by XSerializer when encrypting or decrypting data. /// When setting this property, if <paramref name="value"/> is null, /// then <see cref="DefaultEncryptionMechanism"/> will be used instead. /// </summary> public static IEncryptionMechanism Current { internal get { return _current; } set { _current = value ?? DefaultEncryptionMechanism; } } } }
Use correct casing on public static field.
Use correct casing on public static field.
C#
mit
QuickenLoans/XSerializer,rlyczynski/XSerializer
5d450018c36ddcba3d5f4db0903aaf9b7e52615c
osu.Framework/Graphics/UserInterface/BasicDirectorySelectorBreadcrumbDisplay.cs
osu.Framework/Graphics/UserInterface/BasicDirectorySelectorBreadcrumbDisplay.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osuTK; namespace osu.Framework.Graphics.UserInterface { public class BasicDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay { protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new ComputerPiece(); protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new CurrentDisplayPiece(directory, displayName); public BasicDirectorySelectorBreadcrumbDisplay() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; } protected class ComputerPiece : CurrentDisplayPiece { protected override IconUsage? Icon => null; public ComputerPiece() : base(null, "Computer") { } } protected class CurrentDisplayPiece : BasicDirectorySelectorDirectory { protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null; public CurrentDisplayPiece(DirectoryInfo directory, string displayName = null) : base(directory, displayName) { } [BackgroundDependencyLoader] private void load() { Flow.Add(new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(FONT_SIZE / 2) }); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osuTK; namespace osu.Framework.Graphics.UserInterface { public class BasicDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay { protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new BreadcrumbDisplayComputer(); protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new BreadcrumbDisplayDirectory(directory, displayName); public BasicDirectorySelectorBreadcrumbDisplay() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; } protected class BreadcrumbDisplayComputer : BreadcrumbDisplayDirectory { protected override IconUsage? Icon => null; public BreadcrumbDisplayComputer() : base(null, "Computer") { } } protected class BreadcrumbDisplayDirectory : BasicDirectorySelectorDirectory { protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null; public BreadcrumbDisplayDirectory(DirectoryInfo directory, string displayName = null) : base(directory, displayName) { } [BackgroundDependencyLoader] private void load() { Flow.Add(new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(FONT_SIZE / 2) }); } } } }
Rename some more nested classes
Rename some more nested classes
C#
mit
ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework
a2b018e8ab206cbfae6a7288f345404fe23414d7
src/KGP.Core/Curves/ThresholdLinearCurve.cs
src/KGP.Core/Curves/ThresholdLinearCurve.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KGP.Curves { public class ThresholdLinearCurve : ICurve { private float threshold; public float Threshold { get { return this.threshold; } set { this.threshold = value; } } public ThresholdLinearCurve(float threshold) { this.threshold = threshold; } public float Apply(float value) { float absval = Math.Abs(value); if (absval <= threshold) { return 0.0f; } else { float diff = (absval - threshold) / (1.0f - threshold); return diff * Math.Sign(value); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KGP { /// <summary> /// Linear threshold curve, clamp while absolute value is within threshold /// </summary> public class ThresholdLinearCurve : ICurve { private float threshold; /// <summary> /// Current threshold /// </summary> public float Threshold { get { return this.threshold; } set { this.threshold = value; } } /// <summary> /// Constructor /// </summary> /// <param name="threshold">Initial threshold value</param> public ThresholdLinearCurve(float threshold) { this.threshold = threshold; } /// <summary> ///Apply threshold curve /// </summary> /// <param name="value">Intial value</param> /// <returns>Value with curve applied</returns> public float Apply(float value) { float absval = Math.Abs(value); if (absval <= threshold) { return 0.0f; } else { float diff = (absval - threshold) / (1.0f - threshold); return diff * Math.Sign(value); } } } }
Comment and fix on namespace
Comment and fix on namespace
C#
mit
mrvux/kgp
6d9dfe780fb3760158197ebb263797dc3699f126
Server/Dup.cs
Server/Dup.cs
namespace Server { using System; using System.IO; using System.Text; internal partial class Program { class Dup : Stream { string _name; private Dup() { } public Dup(string name) { _name = name; } public override bool CanRead { get { return false; } } public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return true; } } public override long Length => throw new NotImplementedException(); public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public override void Flush() { } public override int Read(byte[] buffer, int offset, int count) { throw new NotImplementedException(); } public override long Seek(long offset, SeekOrigin origin) { throw new NotImplementedException(); } public override void SetLength(long value) { throw new NotImplementedException(); } public override void Write(byte[] buffer, int offset, int count) { DateTime now = DateTime.Now; StringBuilder sb = new StringBuilder(); sb.AppendLine("Raw message from " + _name + " " + now.ToString()); var truncated_array = new byte[count]; for (int i = offset; i < offset + count; ++i) truncated_array[i - offset] = buffer[i]; string str = System.Text.Encoding.Default.GetString(truncated_array); sb.AppendLine("data = '" + str); LoggerNs.Logger.Log.WriteLine(sb.ToString()); } } } }
namespace Server { using System; using System.IO; using System.Text; internal partial class Program { class Dup : Stream { string _name; private Dup() { } public Dup(string name) { _name = name; } public override bool CanRead { get { return false; } } public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return true; } } public override long Length => throw new NotImplementedException(); public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public override void Flush() { } public override int Read(byte[] buffer, int offset, int count) { throw new NotImplementedException(); } public override long Seek(long offset, SeekOrigin origin) { throw new NotImplementedException(); } public override void SetLength(long value) { throw new NotImplementedException(); } public override void Write(byte[] buffer, int offset, int count) { DateTime now = DateTime.Now; StringBuilder sb = new StringBuilder(); sb.AppendLine("Raw message from " + _name + " " + now.ToString()); var truncated_array = new byte[count]; for (int i = offset; i < offset + count; ++i) truncated_array[i - offset] = buffer[i]; string str = System.Text.Encoding.Default.GetString(truncated_array); sb.AppendLine("data (length " + str.Length + ")= '" + str + "'"); LoggerNs.Logger.Log.WriteLine(sb.ToString()); } } } }
Add quotes and length of JSON packets being sent.
Add quotes and length of JSON packets being sent.
C#
mit
kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX
6a48272e234de3792984310833416c51c1b71920
src/VisualStudio/Core/Def/Implementation/CodeModel/ICodeModelInstanceFactory.cs
src/VisualStudio/Core/Def/Implementation/CodeModel/ICodeModelInstanceFactory.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel { interface ICodeModelInstanceFactory { /// <summary> /// Requests the project system to create a <see cref="EnvDTE.FileCodeModel"/> through the project system. /// </summary> /// <remarks> /// This is sometimes necessary because it's possible to go from one <see cref="EnvDTE.FileCodeModel"/> to another, /// but the language service can't create that instance directly, as it doesn't know what the <see cref="EnvDTE.FileCodeModel.Parent"/> /// member should be. The expectation is the implementer of this will do what is necessary and call back into the code model implementation /// with a parent object.</remarks> EnvDTE.FileCodeModel TryCreateFileCodeModelThroughProjectSystem(string filePath); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel { interface ICodeModelInstanceFactory { /// <summary> /// Requests the project system to create a <see cref="EnvDTE.FileCodeModel"/> through the project system. /// </summary> /// <remarks> /// This is sometimes necessary because it's possible to go from one <see cref="EnvDTE.FileCodeModel"/> to another, /// but the language service can't create that instance directly, as it doesn't know what the <see cref="EnvDTE.FileCodeModel.Parent"/> /// member should be. The expectation is the implementer of this will do what is necessary and call back into <see cref="IProjectCodeModel.GetOrCreateFileCodeModel(string, object)"/> /// handing it the appropriate parent.</remarks> EnvDTE.FileCodeModel TryCreateFileCodeModelThroughProjectSystem(string filePath); } }
Update documentation now that we can point to a concrete method
Update documentation now that we can point to a concrete method
C#
mit
dotnet/roslyn,cston/roslyn,VSadov/roslyn,brettfo/roslyn,reaction1989/roslyn,physhi/roslyn,diryboy/roslyn,dpoeschl/roslyn,panopticoncentral/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,VSadov/roslyn,AlekseyTs/roslyn,eriawan/roslyn,jamesqo/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,MichalStrehovsky/roslyn,wvdd007/roslyn,stephentoub/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,xasx/roslyn,panopticoncentral/roslyn,jamesqo/roslyn,agocke/roslyn,bartdesmet/roslyn,aelij/roslyn,eriawan/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,Hosch250/roslyn,tmeschter/roslyn,weltkante/roslyn,heejaechang/roslyn,OmarTawfik/roslyn,jasonmalinowski/roslyn,davkean/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,jasonmalinowski/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,Giftednewt/roslyn,tmat/roslyn,Hosch250/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,nguerrera/roslyn,tmat/roslyn,jcouv/roslyn,jmarolf/roslyn,bkoelman/roslyn,sharwell/roslyn,mavasani/roslyn,mavasani/roslyn,abock/roslyn,xasx/roslyn,paulvanbrenk/roslyn,wvdd007/roslyn,brettfo/roslyn,Giftednewt/roslyn,DustinCampbell/roslyn,stephentoub/roslyn,diryboy/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,bkoelman/roslyn,ErikSchierboom/roslyn,swaroop-sridhar/roslyn,jcouv/roslyn,sharwell/roslyn,abock/roslyn,gafter/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,paulvanbrenk/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,stephentoub/roslyn,eriawan/roslyn,bkoelman/roslyn,davkean/roslyn,DustinCampbell/roslyn,nguerrera/roslyn,sharwell/roslyn,tannergooding/roslyn,gafter/roslyn,DustinCampbell/roslyn,mavasani/roslyn,KevinRansom/roslyn,agocke/roslyn,heejaechang/roslyn,VSadov/roslyn,bartdesmet/roslyn,brettfo/roslyn,reaction1989/roslyn,physhi/roslyn,jcouv/roslyn,KirillOsenkov/roslyn,physhi/roslyn,genlu/roslyn,AmadeusW/roslyn,weltkante/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmat/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,heejaechang/roslyn,dpoeschl/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,cston/roslyn,tmeschter/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,jmarolf/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,Giftednewt/roslyn,gafter/roslyn,tannergooding/roslyn,paulvanbrenk/roslyn,diryboy/roslyn,panopticoncentral/roslyn,dpoeschl/roslyn,jmarolf/roslyn,tmeschter/roslyn,agocke/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,shyamnamboodiripad/roslyn,jamesqo/roslyn,mgoertz-msft/roslyn,abock/roslyn,Hosch250/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,cston/roslyn,aelij/roslyn,OmarTawfik/roslyn
fe1c33a55b9c78f9729e30cbd973ab0022cbde6d
test/Spk.Common.Tests.Helpers/Service/ServiceResultTests.cs
test/Spk.Common.Tests.Helpers/Service/ServiceResultTests.cs
using System; using Shouldly; using Spk.Common.Helpers.Service; using Xunit; namespace Spk.Common.Tests.Helpers.Service { public class ServiceResultTests { [Theory] [InlineData("test")] [InlineData("")] [InlineData(null)] public void SetData_SuccessShouldBeTrue(string value) { // Arrange var sr = new ServiceResult<string>(); // Act sr.SetData(value); // Assert sr.Success.ShouldBeTrue(); } [Theory] [InlineData("error")] public void GetFirstError_ShouldReturnFirstError(string error) { // Arrange var sr = new ServiceResult<string>(); // Act sr.AddError(error); // Assert sr.GetFirstError().ShouldBe(error); } [Fact] public void AddError_ShouldArgumentNullException_WhenNullError() { // Act & assert Assert.Throws<ArgumentNullException>(() => { var sr = new ServiceResult<string>(); sr.AddError(null); }); } } }
using System; using Shouldly; using Spk.Common.Helpers.Service; using Xunit; namespace Spk.Common.Tests.Helpers.Service { public class ServiceResultTests { [Theory] [InlineData("test")] [InlineData("")] [InlineData(null)] public void Success_ShouldBeTrue_WhenDataIsSet(string value) { // Arrange var sr = new ServiceResult<string>(); // Act sr.SetData(value); // Assert sr.Success.ShouldBeTrue(); } [Theory] [InlineData("error")] public void GetFirstError_ShouldReturnFirstError(string error) { // Arrange var sr = new ServiceResult<string>(); // Act sr.AddError(error); sr.AddError("bleh"); // Assert sr.GetFirstError().ShouldBe(error); } [Fact] public void AddError_ShouldArgumentNullException_WhenNullError() { // Act & assert Assert.Throws<ArgumentNullException>(() => { var sr = new ServiceResult<string>(); sr.AddError(null); }); } } }
Test case renamed to be more accurate
Test case renamed to be more accurate
C#
mit
spektrumgeeks/Spk.Common
2686057fe3886e755f70eda5afae2253e80677b7
src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneModels/AdlsLoggerTarget.cs
src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneModels/AdlsLoggerTarget.cs
using System.Collections.Concurrent; using System.IO; using NLog; using NLog.Config; using NLog.Targets; namespace Microsoft.Azure.Commands.DataLakeStore.Models { /// <summary> /// NLog is used by the ADLS dataplane sdk to log debug messages. We can create a custom target /// which basically queues the debug data to the ConcurrentQueue for debug messages. /// https://github.com/NLog/NLog/wiki/How-to-write-a-custom-target /// </summary> [Target("AdlsLogger")] public sealed class AdlsLoggerTarget : TargetWithLayout { internal ConcurrentQueue<string> DebugMessageQueue; public AdlsLoggerTarget() { } protected override void Write(LogEventInfo logEvent) { string logMessage = Layout.Render(logEvent); DebugMessageQueue?.Enqueue(logMessage); } } }
using System.Collections.Concurrent; using NLog; using NLog.Targets; namespace Microsoft.Azure.Commands.DataLakeStore.Models { /// <summary> /// NLog is used by the ADLS dataplane sdk to log debug messages. We can create a custom target /// which basically queues the debug data to the ConcurrentQueue for debug messages. /// https://github.com/NLog/NLog/wiki/How-to-write-a-custom-target /// </summary> [Target("AdlsLogger")] internal sealed class AdlsLoggerTarget : TargetWithLayout { internal ConcurrentQueue<string> DebugMessageQueue; protected override void Write(LogEventInfo logEvent) { string logMessage = Layout.Render(logEvent); DebugMessageQueue?.Enqueue(logMessage); } } }
Remove unused usings and make the target class internal
Remove unused usings and make the target class internal
C#
apache-2.0
AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell
cb91786ea97f82299847556dc9149378ec882900
Schedules.API/Tasks/Sending/PostRemindersEmailSend.cs
Schedules.API/Tasks/Sending/PostRemindersEmailSend.cs
using Simpler; using System; using Schedules.API.Models; using Schedules.API.Tasks.Reminders; namespace Schedules.API.Tasks.Sending { public class PostRemindersEmailSend : InOutTask<PostRemindersEmailSend.Input, PostRemindersEmailSend.Output> { public class Input { public Send Send { get; set; } } public class Output { public Send Send { get; set; } } public FetchDueReminders FetchDueReminders { get; set; } public SendEmails SendEmails { get; set; } public override void Execute () { FetchDueReminders.In.RemindOn = In.Send.RemindOn; FetchDueReminders.Execute(); SendEmails.In.DueReminders = FetchDueReminders.Out.DueReminders; SendEmails.Execute(); Out.Send = new Send { Sent = SendEmails.Out.Sent, Errors = SendEmails.Out.Errors }; } } }
using Simpler; using System; using Schedules.API.Models; using Schedules.API.Tasks.Reminders; namespace Schedules.API.Tasks.Sending { public class PostRemindersEmailSend : InOutTask<PostRemindersEmailSend.Input, PostRemindersEmailSend.Output> { public class Input { public Send Send { get; set; } } public class Output { public Send Send { get; set; } } public FetchDueReminders FetchDueReminders { get; set; } public SendEmails SendEmails { get; set; } public override void Execute () { FetchDueReminders.In.RemindOn = In.Send.RemindOn; FetchDueReminders.Execute(); SendEmails.In.DueReminders = FetchDueReminders.Out.DueReminders; SendEmails.Execute(); Out.Send = new Send { RemindOn = In.Send.RemindOn, Sent = SendEmails.Out.Sent, Errors = SendEmails.Out.Errors }; } } }
Return the given RemindOn date
Return the given RemindOn date
C#
mit
schlos/denver-schedules-api,codeforamerica/denver-schedules-api,codeforamerica/denver-schedules-api,schlos/denver-schedules-api
acfa4d478fa7ad5015fed8d6ff473e100c8f1f23
src/Essential.Templating.Razor.Email/Helpers/ResourceTemplateHelperExtensions.cs
src/Essential.Templating.Razor.Email/Helpers/ResourceTemplateHelperExtensions.cs
using System; using System.Diagnostics.Contracts; using System.Globalization; using System.Net.Mail; using System.Net.Mime; using RazorEngine.Text; namespace Essential.Templating.Razor.Email.Helpers { public static class ResourceTemplateHelperExtensions { public static IEncodedString Link(this ResourceTemplateHelper helper, string path, string contentId, string mediaType, TransferEncoding transferEncoding, CultureInfo culture = null) { Contract.Requires<ArgumentNullException>(helper != null); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(path)); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentId)); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(mediaType)); var resource = helper.Get(path, culture); if (resource == null) { var message = string.Format("Resource [{0}] was not found.", contentId); throw new TemplateHelperException(message); } var linkedResource = new LinkedResource(resource, mediaType) { TransferEncoding = transferEncoding }; helper.AddLinkedResource(linkedResource); var renderedResult = new RawString(string.Format("cid:{0}", contentId)); return renderedResult; } } }
using System; using System.Diagnostics.Contracts; using System.Globalization; using System.Net.Mail; using System.Net.Mime; using RazorEngine.Text; namespace Essential.Templating.Razor.Email.Helpers { public static class ResourceTemplateHelperExtensions { public static IEncodedString Link(this ResourceTemplateHelper helper, string path, string contentId, string mediaType, TransferEncoding transferEncoding, CultureInfo culture = null) { Contract.Requires<ArgumentNullException>(helper != null); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(path)); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentId)); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(mediaType)); var resource = helper.Get(path, culture); if (resource == null) { var message = string.Format("Resource [{0}] was not found.", contentId); throw new TemplateHelperException(message); } var linkedResource = new LinkedResource(resource, mediaType) { TransferEncoding = transferEncoding, ContentId = contentId }; helper.AddLinkedResource(linkedResource); var renderedResult = new RawString(string.Format("cid:{0}", contentId)); return renderedResult; } } }
Store ContentId against the LinkedResource
Store ContentId against the LinkedResource ContentId is not being set for the LinkedResource so once rendered, the cid value in the HTML content can't be found as it isn't named.
C#
mit
smolyakoff/essential-templating,smolyakoff/essential-templating,petedavis/essential-templating
9b19050fafde5ebe051f7b2daa478805644552e1
osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs
osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; private readonly SliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; InternalChild = body = new SliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 }; slider.PositionChanged += _ => updatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { body.BorderColour = colours.Yellow; updatePosition(); } private void updatePosition() => Position = slider.StackedPosition; protected override void Update() { base.Update(); Size = body.Size; OriginPosition = body.PathOffset; // Need to cause one update body.UpdateProgress(0); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; private readonly SnakingSliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; InternalChild = body = new SnakingSliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 }; slider.PositionChanged += _ => updatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { body.BorderColour = colours.Yellow; updatePosition(); } private void updatePosition() => Position = slider.StackedPosition; protected override void Update() { base.Update(); Size = body.Size; OriginPosition = body.PathOffset; // Need to cause one update body.UpdateProgress(0); } } }
Update with slider body changes
Update with slider body changes
C#
mit
peppy/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,DrabWeb/osu,2yangk23/osu,smoogipoo/osu,naoey/osu,naoey/osu,UselessToucan/osu,ZLima12/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,DrabWeb/osu,naoey/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,peppy/osu,peppy/osu-new,EVAST9919/osu,NeoAdonis/osu
2bd0b91e16e0e7e02d41cc0494f6e8cc669f8a6c
AlertRoster.Web/Models/Group.cs
AlertRoster.Web/Models/Group.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace AlertRoster.Web.Models { public class Group { [Key] public int Id { get; private set; } [Required, StringLength(25)] public String DisplayName { get; set; } [StringLength(25)] public String PhoneNumber { get; set; } public virtual ICollection<MemberGroup> Members { get; private set; } public virtual ICollection<Message> Messages { get; private set; } // TODO Who are admins? // TODO Reply-mode : Reply-All, Reply-to-Admin, Reject? private Group() { // Parameter-less ctor for EF } public Group(String displayName) { this.DisplayName = displayName; this.Members = new List<MemberGroup>(); this.Messages = new List<Message>(); } } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; namespace AlertRoster.Web.Models { public class Group { [Key] public int Id { get; private set; } [Required, StringLength(25)] public String DisplayName { get; set; } [StringLength(25)] public String PhoneNumber { get; set; } public virtual ICollection<MemberGroup> Members { get; private set; } public virtual IEnumerable<Member> Admins => Members.Where(_ => _.Role == MemberGroup.GroupRole.Administrator).Select(_ => _.Member); public virtual ICollection<Message> Messages { get; private set; } [Required] public ReplyMode Replies { get; set; } = ReplyMode.ReplyAll; private Group() { // Parameter-less ctor for EF } public Group(String displayName) { this.DisplayName = displayName; this.Members = new List<MemberGroup>(); this.Messages = new List<Message>(); } public enum ReplyMode : byte { ReplyAll = 0, ReplyToAdmins = 1, Reject = 2 } } }
Add reply mode and a shortcut for getting admins
Add reply mode and a shortcut for getting admins
C#
mit
mattgwagner/alert-roster
0c30c80b826d85e13158c70cffe7b837b23d2feb
Cirrious/Color/Cirrious.MvvmCross.Plugins.Color.Touch/MvxColorExtensions.cs
Cirrious/Color/Cirrious.MvvmCross.Plugins.Color.Touch/MvxColorExtensions.cs
// MvxColorExtensions.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, me@slodge.com using Cirrious.CrossCore.UI; using MonoTouch.UIKit; namespace Cirrious.MvvmCross.Plugins.Color.Touch { public static class MvxColorExtensions { public static UIColor ToAndroidColor(this MvxColor color) { return MvxTouchColor.ToUIColor(color); } } }
// MvxColorExtensions.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, me@slodge.com using Cirrious.CrossCore.UI; using MonoTouch.UIKit; namespace Cirrious.MvvmCross.Plugins.Color.Touch { public static class MvxColorExtensions { public static UIColor ToNativeColor(this MvxColor color) { return MvxTouchColor.ToUIColor(color); } } }
Fix for native extension method name (not Android!)
Fix for native extension method name (not Android!)
C#
mit
martijn00/MvvmCross-Plugins,MatthewSannes/MvvmCross-Plugins,Didux/MvvmCross-Plugins,lothrop/MvvmCross-Plugins
625d2696844fdd3838a1528f70e6c0e2268088c1
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/OpportunityDto.cs
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/OpportunityDto.cs
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace PS.Mothership.Core.Common.Dto.Merchant { [DataContract] public class OpportunityDto { [DataMember] public Guid OpportunityGuid { get; set; } [DataMember] public string OpportunityLocatorId { get; set; } [DataMember] public Guid ProspectGuid { get; set; } [DataMember] public Guid CustomerGuid { get; set; } [DataMember] public Guid CurrentOfferGuid { get; set; } [DataMember] public Guid PartnerGuid { get; set; } [DataMember] public Guid CurrentStatusTrnGuid { get; set; } [DataMember] public OfferDto CurrentOffer { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace PS.Mothership.Core.Common.Dto.Merchant { [DataContract] public class OpportunityDto { [DataMember] public Guid OpportunityGuid { get; set; } [DataMember] public string OpportunityLocatorId { get; set; } [DataMember] public Guid ProspectGuid { get; set; } [DataMember] public Guid CustomerGuid { get; set; } [DataMember] public Guid CurrentOfferGuid { get; set; } [DataMember] public Guid PartnerGuid { get; set; } [DataMember] public Guid CurrentStatusTrnGuid { get; set; } [DataMember] public OfferDto CurrentOffer { get; set; } [DataMember] public Guid UpdateUserGuid { get; set; } [DataMember] public string UpdateUsername { get; set; } [DataMember] public DateTimeOffset UpdateDate { get; set; } } }
Update user info on opportunity.
Update user info on opportunity.
C#
mit
Paymentsense/Dapper.SimpleSave
3f2e52542e2cc904c8e7a0602aa3cdad1c6fd95f
src/backend/SO115App.Persistence.MongoDB/Marker/DeleteChiamataInCorsoByIdUtente.cs
src/backend/SO115App.Persistence.MongoDB/Marker/DeleteChiamataInCorsoByIdUtente.cs
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Marker; using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti; using SO115App.Models.Servizi.Infrastruttura.Marker; namespace SO115App.Persistence.MongoDB.Marker { public class DeleteChiamataInCorsoByIdUtente : IDeleteChiamataInCorsoByIdUtente { private readonly DbContext _dbContext; private readonly IGetUtenteById _getUtente; public DeleteChiamataInCorsoByIdUtente(DbContext dbContext, IGetUtenteById getUtente) { _dbContext = dbContext; _getUtente = getUtente; } public void Delete(string idUtente) { var utente = _getUtente.GetUtenteByCodice(idUtente); var nominativo = utente.Nome + " " + utente.Cognome; _dbContext.ChiamateInCorsoCollection.DeleteOne(Builders<ChiamateInCorso>.Filter.Eq(x => x.DescrizioneOperatore, nominativo)); } } }
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Marker; using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti; using SO115App.Models.Servizi.Infrastruttura.Marker; namespace SO115App.Persistence.MongoDB.Marker { public class DeleteChiamataInCorsoByIdUtente : IDeleteChiamataInCorsoByIdUtente { private readonly DbContext _dbContext; private readonly IGetUtenteById _getUtente; public DeleteChiamataInCorsoByIdUtente(DbContext dbContext, IGetUtenteById getUtente) { _dbContext = dbContext; _getUtente = getUtente; } public void Delete(string idUtente) { var utente = _getUtente.GetUtenteByCodice(idUtente); var nominativo = utente.Nome + " " + utente.Cognome; _dbContext.ChiamateInCorsoCollection.DeleteMany(Builders<ChiamateInCorso>.Filter.Eq(x => x.DescrizioneOperatore, nominativo)); } } }
Fix - Cancellazione Chiamate In Corso al logout
Fix - Cancellazione Chiamate In Corso al logout
C#
agpl-3.0
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
5f5773b0c02e2190ac7d94b3ce84008c9a85a63c
src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
using System.Collections.Generic; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models.Editors; using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { /// <summary> /// Represents a media picker property editor. /// </summary> [DataEditor( Constants.PropertyEditors.Aliases.MediaPicker, EditorType.PropertyValue | EditorType.MacroParameter, "Media Picker", "mediapicker", ValueType = ValueTypes.Text, Group = Constants.PropertyEditors.Groups.Media, Icon = Constants.Icons.MediaImage)] public class MediaPickerPropertyEditor : DataEditor { /// <summary> /// Initializes a new instance of the <see cref="MediaPickerPropertyEditor"/> class. /// </summary> public MediaPickerPropertyEditor(ILogger logger) : base(logger) { } /// <inheritdoc /> protected override IConfigurationEditor CreateConfigurationEditor() => new MediaPickerConfigurationEditor(); protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(Attribute); internal class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference { public MediaPickerPropertyValueEditor(DataEditorAttribute attribute) : base(attribute) { } public IEnumerable<UmbracoEntityReference> GetReferences(object value) { var asString = value is string str ? str : value?.ToString(); if (string.IsNullOrEmpty(asString)) yield break; if (Udi.TryParse(asString, out var udi)) yield return new UmbracoEntityReference(udi); } } } }
using System.Collections.Generic; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models.Editors; using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { /// <summary> /// Represents a media picker property editor. /// </summary> [DataEditor( Constants.PropertyEditors.Aliases.MediaPicker, EditorType.PropertyValue | EditorType.MacroParameter, "Media Picker", "mediapicker", ValueType = ValueTypes.Text, Group = Constants.PropertyEditors.Groups.Media, Icon = Constants.Icons.MediaImage)] public class MediaPickerPropertyEditor : DataEditor { /// <summary> /// Initializes a new instance of the <see cref="MediaPickerPropertyEditor"/> class. /// </summary> public MediaPickerPropertyEditor(ILogger logger) : base(logger) { } /// <inheritdoc /> protected override IConfigurationEditor CreateConfigurationEditor() => new MediaPickerConfigurationEditor(); protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(Attribute); internal class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference { public MediaPickerPropertyValueEditor(DataEditorAttribute attribute) : base(attribute) { } public IEnumerable<UmbracoEntityReference> GetReferences(object value) { var asString = value is string str ? str : value?.ToString(); if (string.IsNullOrEmpty(asString)) yield break; foreach (var udiStr in asString.Split(',')) { if (Udi.TryParse(udiStr, out var udi)) yield return new UmbracoEntityReference(udi); } } } } }
Handle for multiple picked media relations
7879: Handle for multiple picked media relations (cherry picked from commit 9f7c44c64ebfb23acd1bb06aa22c5bc39ad5079a)
C#
mit
KevinJump/Umbraco-CMS,madsoulswe/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,NikRimington/Umbraco-CMS,marcemarc/Umbraco-CMS
537583537c65a572a991c8b711b3e0d554685356
IShaderProgram.cs
IShaderProgram.cs
using System; namespace ChamberLib { public interface IShaderProgram { string Name { get; } void Apply(); void UnApply(); IShaderStage VertexShader { get; } IShaderStage FragmentShader { get; } void SetUniform(string name, bool value); void SetUniform(string name, byte value); void SetUniform(string name, sbyte value); void SetUniform(string name, short value); void SetUniform(string name, ushort value); void SetUniform(string name, int value); void SetUniform(string name, uint value); void SetUniform(string name, float value); void SetUniform(string name, double value); void SetUniform(string name, Vector2 value); void SetUniform(string name, Vector3 value); void SetUniform(string name, Vector4 value); void SetUniform(string name, Matrix value); } }
using System; using System.Collections.Generic; namespace ChamberLib { public interface IShaderProgram { string Name { get; } void Apply(); void UnApply(); IShaderStage VertexShader { get; } IShaderStage FragmentShader { get; } IEnumerable<string> BindAttributes { get; } void SetBindAttributes(IEnumerable<string> bindattrs); void SetUniform(string name, bool value); void SetUniform(string name, byte value); void SetUniform(string name, sbyte value); void SetUniform(string name, short value); void SetUniform(string name, ushort value); void SetUniform(string name, int value); void SetUniform(string name, uint value); void SetUniform(string name, float value); void SetUniform(string name, double value); void SetUniform(string name, Vector2 value); void SetUniform(string name, Vector3 value); void SetUniform(string name, Vector4 value); void SetUniform(string name, Matrix value); } }
Add the bind attributes property and method to the interface.
Add the bind attributes property and method to the interface.
C#
lgpl-2.1
izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib
dddf62c35eabcd01f45fa9673bdc667500667068
core/Piranha.Manager/Areas/Manager/Views/Shared/EditorTemplates/Block.cshtml
core/Piranha.Manager/Areas/Manager/Views/Shared/EditorTemplates/Block.cshtml
@using Piranha.Extend; @using Piranha.Manager.Manager; @model Block @foreach(var name in Model.GetFieldNames()) { <div class="form-group"> <label>@name</label> @Html.Editor(name) </div> }
@using Piranha.Extend; @using Piranha.Manager.Manager; @using System.Text.RegularExpressions; @model Block @foreach(var name in Model.GetFieldNames()) { var label = Regex.Replace(name, "(\\B[A-Z])", " $1"); <div class="form-group"> <label>@label</label> @Html.Editor(name) </div> }
Split Pascal cased property names into words
Split Pascal cased property names into words
C#
mit
PiranhaCMS/piranha.core,PiranhaCMS/piranha.core,PiranhaCMS/piranha.core,PiranhaCMS/piranha.core
1df1794c2d6ca2c1190b6091c65160f3b645155a
source/Handlebars/Compiler/Lexer/Converter/ExpressionScopeConverter.cs
source/Handlebars/Compiler/Lexer/Converter/ExpressionScopeConverter.cs
using System; using System.Collections.Generic; using System.Linq; using HandlebarsDotNet.Compiler.Lexer; using System.Linq.Expressions; namespace HandlebarsDotNet.Compiler { internal class ExpressionScopeConverter : TokenConverter { public static IEnumerable<object> Convert(IEnumerable<object> sequence) { return new ExpressionScopeConverter().ConvertTokens(sequence).ToList(); } private ExpressionScopeConverter() { } public override IEnumerable<object> ConvertTokens(IEnumerable<object> sequence) { var enumerator = sequence.GetEnumerator(); while (enumerator.MoveNext()) { var item = enumerator.Current; if (item is StartExpressionToken) { var startExpression = item as StartExpressionToken; item = GetNext(enumerator); if ((item is Expression) == false) { throw new HandlebarsCompilerException( string.Format("Token '{0}' could not be converted to an expression", item)); } yield return HandlebarsExpression.Statement( (Expression)item, startExpression.IsEscaped); item = GetNext(enumerator); if ((item is EndExpressionToken) == false) { throw new HandlebarsCompilerException("Handlebars statement was not reduced to a single expression"); } if (((EndExpressionToken)item).IsEscaped != startExpression.IsEscaped) { throw new HandlebarsCompilerException("Starting and ending handleabars do not match"); } } else { yield return item; } } } private static object GetNext(IEnumerator<object> enumerator) { enumerator.MoveNext(); return enumerator.Current; } } }
using System; using System.Collections.Generic; using System.Linq; using HandlebarsDotNet.Compiler.Lexer; using System.Linq.Expressions; namespace HandlebarsDotNet.Compiler { internal class ExpressionScopeConverter : TokenConverter { public static IEnumerable<object> Convert(IEnumerable<object> sequence) { return new ExpressionScopeConverter().ConvertTokens(sequence).ToList(); } private ExpressionScopeConverter() { } public override IEnumerable<object> ConvertTokens(IEnumerable<object> sequence) { var enumerator = sequence.GetEnumerator(); while (enumerator.MoveNext()) { var item = enumerator.Current; if (item is StartExpressionToken) { var startExpression = item as StartExpressionToken; item = GetNext(enumerator); if ((item is Expression) == false) { throw new HandlebarsCompilerException( string.Format("Token '{0}' could not be converted to an expression", item)); } yield return HandlebarsExpression.Statement( (Expression)item, startExpression.IsEscaped); item = GetNext(enumerator); if ((item is EndExpressionToken) == false) { throw new HandlebarsCompilerException("Handlebars statement was not reduced to a single expression"); } if (((EndExpressionToken)item).IsEscaped != startExpression.IsEscaped) { throw new HandlebarsCompilerException("Starting and ending handlebars do not match"); } } else { yield return item; } } } private static object GetNext(IEnumerator<object> enumerator) { enumerator.MoveNext(); return enumerator.Current; } } }
Fix spelling mistake in error message
Fix spelling mistake in error message
C#
mit
esskar/handlebars-core,tsliang/Handlebars.Net,rexm/Handlebars.Net,mcintyre321/Handlebars.Net.Mvc,mcintyre321/Handlebars.Net.Mvc,sandorfr/Handlebars.Net,tsliang/Handlebars.Net,rexm/Handlebars.Net,mcintyre321/Handlebars.Net.Mvc,sandorfr/Handlebars.Net,kendallb/Handlebars.Net
558cc870397589757ee3233c7bd017dfabc065f9
TestObjectBuilderTests/Tests/TestObjectBuilderBuilderTests.cs
TestObjectBuilderTests/Tests/TestObjectBuilderBuilderTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using TestObjectBuilder; namespace TestObjectBuilderTests.Tests { public class TestObjectBuilderBuilderTests { [TestFixture] public class CreateNewObject { [Test] public void CreatesProductWithoutPropertiesAndAZeroArgConstructor() { // Arrange ITestObjBuilder<ProductWithoutProperties> builder = TestObjectBuilderBuilder<ProductWithoutProperties>.CreateNewObject(); // Act ProductWithoutProperties product = builder.Build(); // Assert Assert.NotNull(product); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using TestObjectBuilder; namespace TestObjectBuilderTests.Tests { public class TestObjectBuilderBuilderTests { [TestFixture] public class CreateNewObject { [Test] public void ProductBuilderCreateBuildsObjectsOfTypeProduct() { // Arrange // Act ITestObjBuilder<ProductWithoutProperties> builder = TestObjectBuilderBuilder<ProductWithoutProperties>.CreateNewObject(); // Assert Assert.AreSame(typeof(ProductWithoutProperties), builder.GetType().GetMethod("Build").ReturnType); } [Test] public void ProductBuilderHasNoPropertiesWhenProductHasNoProperties() { // Arrange // Act ITestObjBuilder<ProductWithoutProperties> builder = TestObjectBuilderBuilder<ProductWithoutProperties>.CreateNewObject(); // Assert Assert.AreEqual(0, builder.GetType().GetProperties().Count()); } } } }
Replace first TestObjectBuilderBuilder unit test with two tests to make the tests less brittle.
Replace first TestObjectBuilderBuilder unit test with two tests to make the tests less brittle.
C#
mit
tdpreece/TestObjectBuilderCsharp
6034680b36b49c790ea70f987bc4ed1649555862
MonoGameUtils/UI/GameComponents/UIFPSCounter.cs
MonoGameUtils/UI/GameComponents/UIFPSCounter.cs
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGameUtils.Diagnostics; namespace PCGame.GameComponents { public class UIFPSCounter : DrawableGameComponent { private FPSCounter _fpsCounter = new FPSCounter(); private SpriteBatch _spriteBatch; private SpriteFont _font; private Vector2 _topLeftPoint; private Vector2 _avgFPSLocation; private readonly Color _fontColor = Color.Black; public UIFPSCounter(Game game, SpriteFont font, Vector2 topLeftPoint, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; _font = font; _topLeftPoint = topLeftPoint; _avgFPSLocation = Vector2.Add(_topLeftPoint, new Vector2(0, 20)); } public override void Update(GameTime gameTime) { _fpsCounter.Update(gameTime); base.Update(gameTime); } public override void Draw(GameTime gameTime) { _spriteBatch.DrawString(_font, "Current FPS: " + _fpsCounter.CurrentFPS, _topLeftPoint, _fontColor); _spriteBatch.DrawString(_font, "Avg FPS: " + _fpsCounter.AverageFPS, _avgFPSLocation, _fontColor); base.Draw(gameTime); } } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGameUtils.Diagnostics; namespace MonoGameUtils.UI.GameComponents { public class UIFPSCounter : DrawableGameComponent { private FPSCounter _fpsCounter = new FPSCounter(); private SpriteBatch _spriteBatch; private SpriteFont _font; private Vector2 _topLeftPoint; private Vector2 _avgFPSLocation; private readonly Color _fontColor = Color.Black; public UIFPSCounter(Game game, SpriteFont font, Vector2 topLeftPoint, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; _font = font; _topLeftPoint = topLeftPoint; _avgFPSLocation = Vector2.Add(_topLeftPoint, new Vector2(0, 20)); } public override void Update(GameTime gameTime) { _fpsCounter.Update(gameTime); base.Update(gameTime); } public override void Draw(GameTime gameTime) { _spriteBatch.DrawString(_font, "Current FPS: " + _fpsCounter.CurrentFPS, _topLeftPoint, _fontColor); _spriteBatch.DrawString(_font, "Avg FPS: " + _fpsCounter.AverageFPS, _avgFPSLocation, _fontColor); base.Draw(gameTime); } } }
Fix incorrect namespace for UI component.
Fix incorrect namespace for UI component.
C#
mit
dneelyep/MonoGameUtils
b86712014151bb78d6e6adfd35b8499d78ff8f83
RebirthTracker/RebirthTracker/PacketHandlers/HolePunchPacketHandler.cs
RebirthTracker/RebirthTracker/PacketHandlers/HolePunchPacketHandler.cs
using Microsoft.EntityFrameworkCore; using System; using System.Linq; using System.Net.Sockets; using System.Threading.Tasks; namespace RebirthTracker.PacketHandlers { /// <summary> /// Request a game host try a hole punch /// </summary> [Opcode(26)] public class HolePunchPacketHandler : IPacketHandler { /// <summary> /// Constructor called through reflection in PacketHandlerFactory /// </summary> public HolePunchPacketHandler() { } /// <summary> /// Handle the packet /// </summary> public async Task Handle(UdpReceiveResult result) { var peer = result.RemoteEndPoint; await Logger.Log("Hole Punch").ConfigureAwait(false); ushort gameID = BitConverter.ToUInt16(result.Buffer, 1); await Logger.Log($"Got Game ID {gameID}"); Game game; using (var db = new GameContext()) { game = (await db.Games.Where(x => x.ID == gameID).ToListAsync().ConfigureAwait(false)).FirstOrDefault(); } Packet packet; if (game != null) { packet = new Packet(26, $"{peer.Address}/{peer.Port}"); await packet.Send(Globals.MainClient, game.Endpoint).ConfigureAwait(false); return; } packet = new Packet(27, gameID); await packet.Send(Globals.MainClient, peer).ConfigureAwait(false); } } }
using Microsoft.EntityFrameworkCore; using System; using System.Linq; using System.Net.Sockets; using System.Threading.Tasks; namespace RebirthTracker.PacketHandlers { /// <summary> /// Request a game host try a hole punch /// </summary> [Opcode(26)] public class HolePunchPacketHandler : IPacketHandler { /// <summary> /// Constructor called through reflection in PacketHandlerFactory /// </summary> public HolePunchPacketHandler() { } /// <summary> /// Handle the packet /// </summary> public async Task Handle(UdpReceiveResult result) { var peer = result.RemoteEndPoint; await Logger.Log("Hole Punch").ConfigureAwait(false); ushort gameID = BitConverter.ToUInt16(result.Buffer, 1); await Logger.Log($"Got Game ID {gameID}").ConfigureAwait(false); Game game; using (var db = new GameContext()) { game = (await db.Games.Where(x => x.ID == gameID).ToListAsync().ConfigureAwait(false)).FirstOrDefault(); } Packet packet; if (game != null) { await Logger.Log("Sending hole punch packet").ConfigureAwait(false); packet = new Packet(26, $"{peer.Address}/{peer.Port}"); await packet.Send(Globals.MainClient, game.Endpoint).ConfigureAwait(false); return; } await Logger.Log("Couldn't fetch game").ConfigureAwait(false); packet = new Packet(27, gameID); await packet.Send(Globals.MainClient, peer).ConfigureAwait(false); } } }
Add additional hole punch logging
Add additional hole punch logging
C#
mit
Mako88/dxx-tracker
2eda23d58b1b6343a62d2cf57932e61be6976c1b
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Calendars/TraktCalendarAllDVDMoviesRequestTests.cs
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Calendars/TraktCalendarAllDVDMoviesRequestTests.cs
namespace TraktApiSharp.Tests.Experimental.Requests.Calendars { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TraktApiSharp.Experimental.Requests.Calendars; using TraktApiSharp.Objects.Get.Calendars; [TestClass] public class TraktCalendarAllDVDMoviesRequestTests { [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsNotAbstract() { typeof(TraktCalendarAllDVDMoviesRequest).IsAbstract.Should().BeFalse(); } [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsSealed() { typeof(TraktCalendarAllDVDMoviesRequest).IsSealed.Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsSubclassOfATraktCalendarAllRequest() { typeof(TraktCalendarAllDVDMoviesRequest).IsSubclassOf(typeof(ATraktCalendarAllRequest<TraktCalendarMovie>)).Should().BeTrue(); } } }
namespace TraktApiSharp.Tests.Experimental.Requests.Calendars { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TraktApiSharp.Experimental.Requests.Calendars; using TraktApiSharp.Objects.Get.Calendars; using TraktApiSharp.Requests; [TestClass] public class TraktCalendarAllDVDMoviesRequestTests { [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsNotAbstract() { typeof(TraktCalendarAllDVDMoviesRequest).IsAbstract.Should().BeFalse(); } [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsSealed() { typeof(TraktCalendarAllDVDMoviesRequest).IsSealed.Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestIsSubclassOfATraktCalendarAllRequest() { typeof(TraktCalendarAllDVDMoviesRequest).IsSubclassOf(typeof(ATraktCalendarAllRequest<TraktCalendarMovie>)).Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Calendars"), TestCategory("Without OAuth"), TestCategory("Movies")] public void TestTraktCalendarAllDVDMoviesRequestHasAuthorizationNotRequired() { var request = new TraktCalendarAllDVDMoviesRequest(null); request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.NotRequired); } } }
Make sure that authorization of TraktCalendarAllDVDMoviesRequest is not required
Make sure that authorization of TraktCalendarAllDVDMoviesRequest is not required
C#
mit
henrikfroehling/TraktApiSharp
982843aff56d34f2bfb9f532a9b0465031f4172d
ForumScorer/Users.cshtml
ForumScorer/Users.cshtml
@using ForumModels; @{ string usersFile = Server.MapPath("~/App_Data/users.json"); var userList = new UserList(usersFile); } <table class="table"> <thead> <tr class="lead"> <th></th> <th>Name</th> <th>MSDN Name</th> <th>StackOverflow ID</th> </tr> </thead> @{int count = 0; } @foreach (var user in userList.Users) { count++; <tr class="lead"> <td>@count</td> <td>@user.Name</td> <td><a href="https://social.msdn.microsoft.com/Profile/@user.MSDNName/activity">@user.MSDNName</a></td> <td><a href="http://stackoverflow.com/users/@user.StackOverflowID?tab=reputation">@user.StackOverflowID</a></td> </tr> } </table>
@using ForumModels; @{ string usersFile = Server.MapPath("~/App_Data/users.json"); var userList = new UserList(usersFile); } <table class="table"> <thead> <tr class="lead"> <th></th> <th></th> <th>Name</th> <th>MSDN Name</th> <th>StackOverflow ID</th> </tr> </thead> @{int count = 0; } @foreach (var user in userList.Users) { count++; <tr class="lead"> <td width="20px">@count</td> <td width="20px"><img src="https://i1.social.s-msft.com/profile/u/avatar.jpg?displayname=@user.MSDNName" /></td> <td>@user.Name</td> <td><a href="https://social.msdn.microsoft.com/Profile/@user.MSDNName/activity">@user.MSDNName</a></td> <td><a href="http://stackoverflow.com/users/@user.StackOverflowID?tab=reputation">@user.StackOverflowID</a></td> </tr> } </table>
Add user photo to users list
Add user photo to users list
C#
apache-2.0
davidebbo/ForumScorer
1c578f285accf3f17168708ba5c6aa1fd402f6ec
osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs
osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; namespace osu.Game.Screens.OnlinePlay.Playlists { public class PlaylistsReadyButton : ReadyButton { [Resolved(typeof(Room), nameof(Room.EndDate))] private Bindable<DateTimeOffset?> endDate { get; set; } [Resolved] private IBindable<WorkingBeatmap> gameBeatmap { get; set; } public PlaylistsReadyButton() { Text = "Start"; } [BackgroundDependencyLoader] private void load(OsuColour colours) { BackgroundColour = colours.Green; Triangles.ColourDark = colours.Green; Triangles.ColourLight = colours.GreenLight; } protected override void Update() { base.Update(); Enabled.Value = endDate.Value != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; namespace osu.Game.Screens.OnlinePlay.Playlists { public class PlaylistsReadyButton : ReadyButton { [Resolved(typeof(Room), nameof(Room.EndDate))] private Bindable<DateTimeOffset?> endDate { get; set; } [Resolved] private IBindable<WorkingBeatmap> gameBeatmap { get; set; } public PlaylistsReadyButton() { Text = "Start"; } [BackgroundDependencyLoader] private void load(OsuColour colours) { BackgroundColour = colours.Green; Triangles.ColourDark = colours.Green; Triangles.ColourLight = colours.GreenLight; } private bool hasRemainingAttempts = true; protected override void LoadComplete() { base.LoadComplete(); userScore.BindValueChanged(aggregate => { if (maxAttempts.Value == null) return; int remaining = maxAttempts.Value.Value - aggregate.NewValue.PlaylistItemAttempts.Sum(a => a.Attempts); hasRemainingAttempts = remaining > 0; }); } protected override void Update() { base.Update(); Enabled.Value = hasRemainingAttempts && enoughTimeLeft; } private bool enoughTimeLeft => // This should probably consider the length of the currently selected item, rather than a constant 30 seconds. endDate.Value != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value; } }
Disable playlist start button when attempts have been exhausted
Disable playlist start button when attempts have been exhausted
C#
mit
smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,NeoAdonis/osu
1f7270482ce3fe7d69389c3de1ba4cd80ed3157f
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System.Diagnostics; namespace osu.Framework.Extensions.ObjectExtensions { /// <summary> /// Extensions that apply to all objects. /// </summary> public static class ObjectExtensions { /// <summary> /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "<c>!</c>". /// </summary> /// <remarks> /// This should only be used when an assertion or other handling is not a reasonable alternative. /// </remarks> /// <param name="obj">The nullable object.</param> /// <typeparam name="T">The type of the object.</typeparam> /// <returns>The non-nullable object corresponding to <paramref name="obj"/>.</returns> public static T AsNonNull<T>(this T? obj) where T : class { Debug.Assert(obj != null); return obj; } /// <summary> /// If the given object is null. /// </summary> public static bool IsNull<T>(this T obj) => ReferenceEquals(obj, null); /// <summary> /// <c>true</c> if the given object is not null, <c>false</c> otherwise. /// </summary> public static bool IsNotNull<T>(this T obj) => !ReferenceEquals(obj, null); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace osu.Framework.Extensions.ObjectExtensions { /// <summary> /// Extensions that apply to all objects. /// </summary> public static class ObjectExtensions { /// <summary> /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "<c>!</c>". /// </summary> /// <remarks> /// This should only be used when an assertion or other handling is not a reasonable alternative. /// </remarks> /// <param name="obj">The nullable object.</param> /// <typeparam name="T">The type of the object.</typeparam> /// <returns>The non-nullable object corresponding to <paramref name="obj"/>.</returns> public static T AsNonNull<T>(this T? obj) where T : class { Debug.Assert(obj != null); return obj; } /// <summary> /// If the given object is null. /// </summary> public static bool IsNull<T>([NotNullWhen(false)] this T obj) => ReferenceEquals(obj, null); /// <summary> /// <c>true</c> if the given object is not null, <c>false</c> otherwise. /// </summary> public static bool IsNotNull<T>([NotNullWhen(true)] this T obj) => !ReferenceEquals(obj, null); } }
Annotate return value for consumers
Annotate return value for consumers
C#
mit
smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework
5dd8dac192054ab39d7561f7d8223619ad531f1a
src/Marten.Testing/ConnectionSource.cs
src/Marten.Testing/ConnectionSource.cs
using System; using Baseline; namespace Marten.Testing { public class ConnectionSource : ConnectionFactory { public static readonly string ConnectionString = Environment.GetEnvironmentVariable("marten_testing_database"); static ConnectionSource() { if (ConnectionString.IsEmpty()) throw new Exception( "You need to set the connection string for your local Postgresql database in the environment variable 'marten-testing-database'"); } public ConnectionSource() : base(ConnectionString) { } } }
using System; namespace Marten.Testing { public class ConnectionSource : ConnectionFactory { public static readonly string ConnectionString = Environment.GetEnvironmentVariable("marten_testing_database"); static ConnectionSource() { if (ConnectionString.IsEmpty()) throw new Exception( "You need to set the connection string for your local Postgresql database in the environment variable 'marten_testing_database'"); } public ConnectionSource() : base(ConnectionString) { } } }
Correct error message for missing test connection string
Correct error message for missing test connection string
C#
mit
mysticmind/marten,ericgreenmix/marten,JasperFx/Marten,ericgreenmix/marten,jokokko/marten,jokokko/marten,mdissel/Marten,ericgreenmix/marten,mysticmind/marten,jokokko/marten,JasperFx/Marten,jokokko/marten,mdissel/Marten,jokokko/marten,JasperFx/Marten,ericgreenmix/marten,mysticmind/marten,mysticmind/marten