after
stringlengths
72
2.11k
before
stringlengths
21
1.55k
diff
stringlengths
85
2.31k
instruction
stringlengths
20
1.71k
license
stringclasses
13 values
repos
stringlengths
7
82.6k
commit
stringlengths
40
40
/**************************************************\ * A port of LuRsT's hr to C * * Sam Stuewe (C) 2014 Licensed under the terms of * * the GNU Public License version 2 * \**************************************************/ // Libraries // #include <stdio.h> #include <string.h> #include <sys/ioctl.h> // Main Function // int main (int argc, char * argv []) { struct winsize w; ioctl(0, TIOCGWINSZ, &w); int COLS = ( w.ws_col <= 0 ? 80 : w.ws_col); if ( argc <= 1 ) { for ( int i = 0; i < COLS; i ++ ) { printf("#"); } printf("\n"); } else { for ( int i = 1; i < argc; i ++ ) { for ( int j = 0; j < (COLS/strlen(argv[i])); j ++ ) { printf(argv[i]); } printf("\n"); } } return 0; } // vim: set tabstop=4 shiftwidth=4 expandtab:
/**************************************************\ * A port of LuRsT's hr to C * * Sam Stuewe (C) 2014 Licensed under the terms of * * the GNU Public License version 2 * \**************************************************/ // Libraries // #include <stdio.h> #include <string.h> #include <sys/ioctl.h> // Main Function // int main (int argc, char * * argv) { struct winsize w; ioctl(0, TIOCGWINSZ, &w); int COLS; if ( w.ws_col <= 0 ) { COLS = 80; } else { COLS = w.ws_col; } if ( argc <= 1 ) { for ( int i = 0; i < COLS; i ++ ) { printf("#"); } printf("\n"); } else { for ( int i = 1; i < argc; i ++ ) { for ( int j = 0; j < (COLS/strlen(argv[i])); j ++ ) { printf(argv[i]); } printf("\n"); } } return 0; } // vim: set tabstop=4 shiftwidth=4 expandtab:
--- +++ @@ -10,16 +10,12 @@ #include <sys/ioctl.h> // Main Function // -int main (int argc, char * * argv) { +int +main (int argc, char * argv []) { + struct winsize w; ioctl(0, TIOCGWINSZ, &w); - int COLS; - - if ( w.ws_col <= 0 ) { - COLS = 80; - } else { - COLS = w.ws_col; - } + int COLS = ( w.ws_col <= 0 ? 80 : w.ws_col); if ( argc <= 1 ) { for ( int i = 0; i < COLS; i ++ ) {
Update for style and simplicity
unlicense
HalosGhost/.dotfiles,HalosGhost/.dotfiles
a804609334035658ed74f5e0664dd4c380e68955
// // PHCredentials.h // PerchRTC // // Created by Sam Symons on 2015-05-08. // Copyright (c) 2015 Perch Communications. All rights reserved. // #ifndef PerchRTC_PHCredentials_h #define PerchRTC_PHCredentials_h #error Please enter your XirSys credentials (http://xirsys.com/pricing/) static NSString *kPHConnectionManagerDomain = @""; static NSString *kPHConnectionManagerApplication = @"default"; static NSString *kPHConnectionManagerXSUsername = @""; static NSString *kPHConnectionManagerXSSecretKey = @""; #ifdef DEBUG static NSString *kPHConnectionManagerDefaultRoomName = @"default"; #else static NSString *kPHConnectionManagerDefaultRoomName = @"default"; #endif #endif
// // PHCredentials.h // PerchRTC // // Created by Sam Symons on 2015-05-08. // Copyright (c) 2015 Perch Communications. All rights reserved. // #ifndef PerchRTC_PHCredentials_h #define PerchRTC_PHCredentials_h #error Please enter your XirSys credentials (http://xirsys.com/pricing/) static NSString *kPHConnectionManagerDomain = @""; static NSString *kPHConnectionManagerApplication = @""; static NSString *kPHConnectionManagerXSUsername = @""; static NSString *kPHConnectionManagerXSSecretKey = @""; #ifdef DEBUG static NSString *kPHConnectionManagerDefaultRoomName = @""; #else static NSString *kPHConnectionManagerDefaultRoomName = @""; #endif #endif
--- +++ @@ -12,14 +12,14 @@ #error Please enter your XirSys credentials (http://xirsys.com/pricing/) static NSString *kPHConnectionManagerDomain = @""; -static NSString *kPHConnectionManagerApplication = @""; +static NSString *kPHConnectionManagerApplication = @"default"; static NSString *kPHConnectionManagerXSUsername = @""; static NSString *kPHConnectionManagerXSSecretKey = @""; #ifdef DEBUG -static NSString *kPHConnectionManagerDefaultRoomName = @""; +static NSString *kPHConnectionManagerDefaultRoomName = @"default"; #else -static NSString *kPHConnectionManagerDefaultRoomName = @""; +static NSString *kPHConnectionManagerDefaultRoomName = @"default"; #endif #endif
Use the XirSys defaults for room and application.
mit
imton/perchrtc,duk42111/perchrtc,duk42111/perchrtc,perchco/perchrtc,imton/perchrtc,perchco/perchrtc,ikonst/perchrtc,ikonst/perchrtc,duk42111/perchrtc,ikonst/perchrtc,ikonst/perchrtc,perchco/perchrtc,duk42111/perchrtc,imton/perchrtc
d51affbc2c78f4370fd73ba3d83b8f129289c9e8
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); ListNode* ListNode_Create(void *); void ListNode_Destroy(ListNode* n); ListNode* List_Search(List* l, void* k, int (f)(void*, void*)); #endif
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); ListNode* ListNode_Create(void *); void ListNode_Destroy(ListNode* n); ListNode* List_Search(List* l, void* k, int f(void*, void*)); #endif
--- +++ @@ -10,6 +10,7 @@ void List_Destroy(List* l); ListNode* ListNode_Create(void *); void ListNode_Destroy(ListNode* n); -ListNode* List_Search(List* l, void* k, int f(void*, void*)); +ListNode* List_Search(List* l, void* k, int (f)(void*, void*)); + #endif
Fix missing parenthesis around f as parameter
mit
MaxLikelihood/CADT
b1167684c00877fac8bb3ebe120f088ff99daa57
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VALIDATION_H #define BITCOIN_VALIDATION_H #include <stdint.h> #include <string> static const int64_t DEFAULT_MAX_TIP_AGE = 1 * 60 * 60; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin extern int64_t nMaxTipAge; FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb"); FILE* AppendBlockFile(unsigned int& nFileRet); bool IsInitialBlockDownload(); #endif // BITCOIN_VALIDATION_H
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VALIDATION_H #define BITCOIN_VALIDATION_H #include <stdint.h> #include <string> static const int64_t DEFAULT_MAX_TIP_AGE = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin extern int64_t nMaxTipAge; FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb"); FILE* AppendBlockFile(unsigned int& nFileRet); bool IsInitialBlockDownload(); #endif // BITCOIN_VALIDATION_H
--- +++ @@ -10,7 +10,7 @@ #include <stdint.h> #include <string> -static const int64_t DEFAULT_MAX_TIP_AGE = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin +static const int64_t DEFAULT_MAX_TIP_AGE = 1 * 60 * 60; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin extern int64_t nMaxTipAge;
Adjust default max tip age
mit
neutroncoin/neutron,neutroncoin/neutron,neutroncoin/neutron,neutroncoin/neutron
b858676194b9e384789bc9d506136c37e5da015a
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef CRATE_DEMO_GRAPHICS_MANAGER_H #define CRATE_DEMO_GRAPHICS_MANAGER_H #include "common/graphics_manager_base.h" #include <d3d11.h> #include "DirectXMath.h" namespace CrateDemo { class GameStateManager; struct Vertex { DirectX::XMFLOAT3 pos; DirectX::XMFLOAT4 color; }; struct MatrixBufferType { DirectX::XMMATRIX world; DirectX::XMMATRIX view; DirectX::XMMATRIX projection; }; class GraphicsManager : public Common::GraphicsManagerBase { public: GraphicsManager(GameStateManager *gameStateManager); private: GameStateManager *m_gameStateManager; ID3D11RenderTargetView *m_renderTargetView; public: bool Initialize(int clientWidth, int clientHeight, HWND hwnd); void Shutdown(); void DrawFrame(); void OnResize(int newClientWidth, int newClientHeight); void GamePaused(); void GameUnpaused(); }; } // End of namespace CrateDemo #endif
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef CRATE_DEMO_GRAPHICS_MANAGER_H #define CRATE_DEMO_GRAPHICS_MANAGER_H #include "common/graphics_manager_base.h" #include <d3d11.h> #include "DirectXMath.h" namespace CrateDemo { class GameStateManager; struct Vertex { DirectX::XMFLOAT3 pos; DirectX::XMFLOAT4 color; }; class GraphicsManager : public Common::GraphicsManagerBase { public: GraphicsManager(GameStateManager *gameStateManager); private: GameStateManager *m_gameStateManager; ID3D11RenderTargetView *m_renderTargetView; public: bool Initialize(int clientWidth, int clientHeight, HWND hwnd); void Shutdown(); void DrawFrame(); void OnResize(int newClientWidth, int newClientHeight); void GamePaused(); void GameUnpaused(); }; } // End of namespace CrateDemo #endif
--- +++ @@ -19,6 +19,12 @@ struct Vertex { DirectX::XMFLOAT3 pos; DirectX::XMFLOAT4 color; +}; + +struct MatrixBufferType { + DirectX::XMMATRIX world; + DirectX::XMMATRIX view; + DirectX::XMMATRIX projection; }; class GraphicsManager : public Common::GraphicsManagerBase {
CRATE_DEMO: Create MatrixBufferType struct to hold current world, view, and projection matricies
apache-2.0
RichieSams/thehalflingproject,RichieSams/thehalflingproject,RichieSams/thehalflingproject
4e874c8a3ec1d524e5ab0df04994fb25243e9c72
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. // constexpr might help avoid that, but then it breaks my fragile upgrade-needed // detection code, so this should be left as const. const float kCurrentVersion = 1.55f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. constexpr float kCurrentVersion = 1.55f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
--- +++ @@ -3,7 +3,9 @@ // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. -constexpr float kCurrentVersion = 1.55f; +// constexpr might help avoid that, but then it breaks my fragile upgrade-needed +// detection code, so this should be left as const. +const float kCurrentVersion = 1.55f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor
Revert constexpr so that upgrade detection works
apache-2.0
google/UIforETW,google/UIforETW,google/UIforETW,google/UIforETW
d1320f5b3bf39c62adf5280161335d58e22e1ea9
// // NSString+urlencode.h // Respoke SDK // // Copyright 2015, Digium, Inc. // All rights reserved. // // This source code is licensed under The MIT License found in the // LICENSE file in the root directory of this source tree. // // For all details and documentation: https://www.respoke.io // #import <Foundation/Foundation.h> @interface NSString (NSString_Extended) /** * Url-encodes a string, suitable for placing into a url as a portion of the query string. * Source taken from http://stackoverflow.com/a/8088484/355743 * * @return The url-encoded version of the string */ - (NSString *)urlencode; @end
// // NSString+urlencode.h // Respoke SDK // // Copyright 2015, Digium, Inc. // All rights reserved. // // This source code is licensed under The MIT License found in the // LICENSE file in the root directory of this source tree. // // For all details and documentation: https://www.respoke.io // #import <Foundation/Foundation.h> @interface NSString (NSString_Extended) /** * Url-encodes a string, suitable for placing into a url as a portion of the query string * * @return The url-encoded version of the string */ - (NSString *)urlencode; @end
--- +++ @@ -16,7 +16,8 @@ @interface NSString (NSString_Extended) /** - * Url-encodes a string, suitable for placing into a url as a portion of the query string + * Url-encodes a string, suitable for placing into a url as a portion of the query string. + * Source taken from http://stackoverflow.com/a/8088484/355743 * * @return The url-encoded version of the string */
Add comment about source of urlencode category
mit
respoke/respoke-sdk-ios,respoke/respoke-sdk-ios,respoke/respoke-sdk-ios
ee62a25839ebf871fe04d3edb190b6ec3d535fe0
#include "../common.c" #define DICTI_OA_PROBING(s) 1 #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, HASH(hash_fn), OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) uint32_t 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); z = dict_oa_uint_size(h); dict_oa_uint_clear(h); return z; }
#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) uint32_t 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); z = dict_oa_uint_size(h); dict_oa_uint_clear(h); return z; }
--- +++ @@ -1,4 +1,5 @@ #include "../common.c" +#define DICTI_OA_PROBING(s) 1 #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) @@ -11,7 +12,7 @@ } 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_OPEXTEND(M_DEFAULT_OPLIST, HASH(hash_fn), OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) uint32_t test_int(uint32_t n, uint32_t x0)
Use of linear probing and the same hash function as other libraries
bsd-2-clause
P-p-H-d/mlib,P-p-H-d/mlib
ca7cea3fe392766a1252c86274554950384663e4
/* $FreeBSD$ */ /* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */ /* * Written by J.T. Conklin, Apr 28, 1995 * Public domain. */ #ifndef _ALPHA_IEEEFP_H_ #define _ALPHA_IEEEFP_H_ typedef int fp_except_t; #define FP_X_INV (1LL << 1) /* invalid operation exception */ #define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ #define FP_X_OFL (1LL << 3) /* overflow exception */ #define FP_X_UFL (1LL << 4) /* underflow exception */ #define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */ #if 0 #define FP_X_IOV (1LL << 6) /* integer overflow XXX? */ #endif typedef enum { FP_RZ=0, /* round to zero (truncate) */ FP_RM=1, /* round toward negative infinity */ FP_RN=2, /* round to nearest representable number */ FP_RP=3 /* round toward positive infinity */ } fp_rnd; #endif /* _ALPHA_IEEEFP_H_ */
/* $FreeBSD$ */ /* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */ /* * Written by J.T. Conklin, Apr 28, 1995 * Public domain. */ #ifndef _ALPHA_IEEEFP_H_ #define _ALPHA_IEEEFP_H_ typedef int fp_except; #define FP_X_INV (1LL << 1) /* invalid operation exception */ #define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ #define FP_X_OFL (1LL << 3) /* overflow exception */ #define FP_X_UFL (1LL << 4) /* underflow exception */ #define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */ #if 0 #define FP_X_IOV (1LL << 6) /* integer overflow XXX? */ #endif typedef enum { FP_RZ=0, /* round to zero (truncate) */ FP_RM=1, /* round toward negative infinity */ FP_RN=2, /* round to nearest representable number */ FP_RP=3 /* round toward positive infinity */ } fp_rnd; #endif /* _ALPHA_IEEEFP_H_ */
--- +++ @@ -9,7 +9,7 @@ #ifndef _ALPHA_IEEEFP_H_ #define _ALPHA_IEEEFP_H_ -typedef int fp_except; +typedef int fp_except_t; #define FP_X_INV (1LL << 1) /* invalid operation exception */ #define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ #define FP_X_OFL (1LL << 3) /* overflow exception */
Change floating point exception type to match the i386 one. Submitted by: Mark Abene <[email protected]>
bsd-3-clause
jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase
db44ba375371f40754feca8fa14a009d49333c03
#ifndef ONEDMASSFLUX_H #define ONEDMASSFLUX_H #include "Kernel.h" class OneDMassFlux; template<> InputParameters validParams<OneDMassFlux>(); /** * Mass flux */ class OneDMassFlux : public Kernel { public: OneDMassFlux(const InputParameters & parameters); virtual ~OneDMassFlux(); protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); const VariableValue & _rhouA; unsigned int _rhouA_var_number; }; #endif /* ONEDMASSFLUX_H */
#ifndef ONEDMASSFLUX_H #define ONEDMASSFLUX_H #include "Kernel.h" class OneDMassFlux; template<> InputParameters validParams<OneDMassFlux>(); /** * Mass flux */ class OneDMassFlux : public Kernel { public: OneDMassFlux(const InputParameters & parameters); virtual ~OneDMassFlux(); protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); VariableValue & _rhouA; unsigned int _rhouA_var_number; }; #endif /* ONEDMASSFLUX_H */
--- +++ @@ -22,7 +22,7 @@ virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); - VariableValue & _rhouA; + const VariableValue & _rhouA; unsigned int _rhouA_var_number; };
Prepare RELAP-7 for MooseVariable::sln() const update. This set of changes prepares RELAP-7 to work with an upcoming version of MOOSE in which MooseVariable::sln() returns a const reference. Refs idaholab/moose#6327.
lgpl-2.1
andrsd/moose,bwspenc/moose,andrsd/moose,laagesen/moose,jessecarterMOOSE/moose,laagesen/moose,milljm/moose,lindsayad/moose,idaholab/moose,harterj/moose,idaholab/moose,idaholab/moose,andrsd/moose,jessecarterMOOSE/moose,sapitts/moose,laagesen/moose,sapitts/moose,bwspenc/moose,harterj/moose,milljm/moose,bwspenc/moose,andrsd/moose,milljm/moose,jessecarterMOOSE/moose,dschwen/moose,lindsayad/moose,idaholab/moose,lindsayad/moose,milljm/moose,jessecarterMOOSE/moose,sapitts/moose,laagesen/moose,bwspenc/moose,sapitts/moose,idaholab/moose,dschwen/moose,milljm/moose,dschwen/moose,harterj/moose,bwspenc/moose,harterj/moose,lindsayad/moose,lindsayad/moose,harterj/moose,sapitts/moose,dschwen/moose,dschwen/moose,jessecarterMOOSE/moose,laagesen/moose,andrsd/moose
3e4d6584a8634c839a083b5cd8c51f54dc33112f
#pragma once #include <functional> #include "halley/maths/vector2.h" #include "halley/core/input/input_device.h" #include "halley/maths/colour.h" #include "halley/data_structures/maybe.h" namespace Halley { class InputJoystick; class InputTouch; class InputControllerData { public: Colour colour; String name; }; class InputAPI { public: virtual ~InputAPI() {} virtual size_t getNumberOfKeyboards() const = 0; virtual std::shared_ptr<InputDevice> getKeyboard(int id = 0) const = 0; virtual size_t getNumberOfJoysticks() const = 0; virtual std::shared_ptr<InputJoystick> getJoystick(int id = 0) const = 0; virtual size_t getNumberOfMice() const = 0; virtual std::shared_ptr<InputDevice> getMouse(int id = 0) const = 0; virtual Vector<std::shared_ptr<InputTouch>> getNewTouchEvents() = 0; virtual Vector<std::shared_ptr<InputTouch>> getTouchEvents() = 0; virtual void setMouseRemapping(std::function<Vector2f(Vector2i)> remapFunction) = 0; virtual void requestControllerSetup(int minControllers, int maxControllers, std::function<void(bool)> callback, Maybe<std::vector<InputControllerData>> controllerData = {}) { callback(true); } }; }
#pragma once #include <functional> #include "halley/maths/vector2.h" #include "halley/core/input/input_device.h" namespace Halley { class InputJoystick; class InputTouch; class InputAPI { public: virtual ~InputAPI() {} virtual size_t getNumberOfKeyboards() const = 0; virtual std::shared_ptr<InputDevice> getKeyboard(int id = 0) const = 0; virtual size_t getNumberOfJoysticks() const = 0; virtual std::shared_ptr<InputJoystick> getJoystick(int id = 0) const = 0; virtual size_t getNumberOfMice() const = 0; virtual std::shared_ptr<InputDevice> getMouse(int id = 0) const = 0; virtual Vector<std::shared_ptr<InputTouch>> getNewTouchEvents() = 0; virtual Vector<std::shared_ptr<InputTouch>> getTouchEvents() = 0; virtual void setMouseRemapping(std::function<Vector2f(Vector2i)> remapFunction) = 0; virtual void requestControllerSetup(int numControllers, std::function<void(bool)> callback) { callback(true); } }; }
--- +++ @@ -3,11 +3,19 @@ #include <functional> #include "halley/maths/vector2.h" #include "halley/core/input/input_device.h" +#include "halley/maths/colour.h" +#include "halley/data_structures/maybe.h" namespace Halley { class InputJoystick; class InputTouch; + + class InputControllerData { + public: + Colour colour; + String name; + }; class InputAPI { @@ -28,6 +36,6 @@ virtual void setMouseRemapping(std::function<Vector2f(Vector2i)> remapFunction) = 0; - virtual void requestControllerSetup(int numControllers, std::function<void(bool)> callback) { callback(true); } + virtual void requestControllerSetup(int minControllers, int maxControllers, std::function<void(bool)> callback, Maybe<std::vector<InputControllerData>> controllerData = {}) { callback(true); } }; }
Support for additional data to be passed for controller support (implemented on consoles).
apache-2.0
amzeratul/halley,amzeratul/halley,amzeratul/halley
90c74ab32dc8a19f979975b9910c1810032f1ba9
/* enums.h * Copyright: 2001-2003 The Perl Foundation. All Rights Reserved. * Overview: * enums shared by much of the stack-handling code * Data Structure and Algorithms: * History: * Notes: * References: */ #if !defined(PARROT_ENUMS_H_GUARD) #define PARROT_ENUMS_H_GUARD typedef enum { NO_STACK_ENTRY_TYPE = 0, STACK_ENTRY_INT = 1, STACK_ENTRY_FLOAT = 2, STACK_ENTRY_STRING = 3, STACK_ENTRY_PMC = 4, STACK_ENTRY_POINTER = 5, STACK_ENTRY_DESTINATION = 6 } Stack_entry_type; typedef enum { NO_STACK_ENTRY_FLAGS = 0, STACK_ENTRY_CLEANUP_FLAG = 1 << 0 } Stack_entry_flags; typedef enum { NO_STACK_CHUNK_FLAGS = 0, STACK_CHUNK_COW_FLAG = 1 << 0 } Stack_chunk_flags; #endif /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */
#if !defined(PARROT_ENUMS_H_GUARD) #define PARROT_ENUMS_H_GUARD typedef enum { NO_STACK_ENTRY_TYPE = 0, STACK_ENTRY_INT = 1, STACK_ENTRY_FLOAT = 2, STACK_ENTRY_STRING = 3, STACK_ENTRY_PMC = 4, STACK_ENTRY_POINTER = 5, STACK_ENTRY_DESTINATION = 6 } Stack_entry_type; typedef enum { NO_STACK_ENTRY_FLAGS = 0, STACK_ENTRY_CLEANUP_FLAG = 1 << 0 } Stack_entry_flags; typedef enum { NO_STACK_CHUNK_FLAGS = 0, STACK_CHUNK_COW_FLAG = 1 << 0 } Stack_chunk_flags; #endif
--- +++ @@ -1,3 +1,13 @@ +/* enums.h + * Copyright: 2001-2003 The Perl Foundation. All Rights Reserved. + * Overview: + * enums shared by much of the stack-handling code + * Data Structure and Algorithms: + * History: + * Notes: + * References: + */ + #if !defined(PARROT_ENUMS_H_GUARD) #define PARROT_ENUMS_H_GUARD @@ -23,3 +33,13 @@ #endif + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * + * vim: expandtab shiftwidth=4: +*/
Add header and footer comments git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@3957 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
artistic-2.0
gitster/parrot,parrot/parrot,fernandobrito/parrot,fernandobrito/parrot,tewk/parrot-select,gagern/parrot,fernandobrito/parrot,youprofit/parrot,parrot/parrot,gagern/parrot,FROGGS/parrot,tkob/parrot,fernandobrito/parrot,gitster/parrot,FROGGS/parrot,tkob/parrot,FROGGS/parrot,FROGGS/parrot,tkob/parrot,gitster/parrot,tewk/parrot-select,gagern/parrot,gagern/parrot,gitster/parrot,parrot/parrot,tewk/parrot-select,tewk/parrot-select,gagern/parrot,tkob/parrot,tkob/parrot,fernandobrito/parrot,youprofit/parrot,youprofit/parrot,parrot/parrot,fernandobrito/parrot,gitster/parrot,gagern/parrot,tewk/parrot-select,fernandobrito/parrot,gagern/parrot,youprofit/parrot,youprofit/parrot,FROGGS/parrot,FROGGS/parrot,tewk/parrot-select,tkob/parrot,gitster/parrot,tkob/parrot,youprofit/parrot,parrot/parrot,youprofit/parrot,FROGGS/parrot,tewk/parrot-select,tkob/parrot,gitster/parrot,FROGGS/parrot,youprofit/parrot
c1d5b503174f1c6a72b1e72326fea1f930dca112
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include <string.h> #include "../src/rootdb.h" int main(void) { MDB_env *env; MDB_dbi dbi; int status; status = rootdb_open(&env, &dbi, "./testingdb"); assert(status == 0); char key_char[] = "hello"; char value_char[] = "world"; MDB_val key; MDB_val value; key.mv_size = sizeof(key_char); key.mv_data = key_char; value.mv_size = sizeof(value_char); value.mv_data = value_char; status = rootdb_put(&env, dbi, &key, &value); assert(status == 0); MDB_val rvalue; status = rootdb_get(&env, dbi, &key, &rvalue); assert(status == 0); assert(strcmp(rvalue.mv_data, value.mv_data) == 0); rootdb_close(&env, dbi); return 0; }
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include "../src/rootdb.h" int main(void) { MDB_env *env; MDB_dbi dbi; int status; status = rootdb_open(&env, &dbi, "./testingdb"); assert(status == 0); char key_char[] = "hello"; char value_char[] = "world"; MDB_val key; MDB_val value; key.mv_size = sizeof(key_char); key.mv_data = key_char; value.mv_size = sizeof(value_char); value.mv_data = value_char; printf("key: %p %.*s, data: %p %.*s\n", key.mv_data, (int) key.mv_size, (char *) key.mv_data, value.mv_data, (int) value.mv_size, (char *) value.mv_data); status = rootdb_put(&env, dbi, &key, &value); assert(status == 0); MDB_val rvalue; status = rootdb_get(&env, dbi, &key, &rvalue); assert(status == 0); printf("key: %p %.*s, data: %p %.*s\n", key.mv_data, (int) key.mv_size, (char *) key.mv_data, rvalue.mv_data, (int) rvalue.mv_size, (char *) rvalue.mv_data); rootdb_close(&env, dbi); return 0; }
--- +++ @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <assert.h> +#include <string.h> #include "../src/rootdb.h" int main(void) @@ -22,10 +23,6 @@ value.mv_size = sizeof(value_char); value.mv_data = value_char; - printf("key: %p %.*s, data: %p %.*s\n", - key.mv_data, (int) key.mv_size, (char *) key.mv_data, - value.mv_data, (int) value.mv_size, (char *) value.mv_data); - status = rootdb_put(&env, dbi, &key, &value); assert(status == 0); @@ -33,10 +30,7 @@ status = rootdb_get(&env, dbi, &key, &rvalue); assert(status == 0); - - printf("key: %p %.*s, data: %p %.*s\n", - key.mv_data, (int) key.mv_size, (char *) key.mv_data, - rvalue.mv_data, (int) rvalue.mv_size, (char *) rvalue.mv_data); + assert(strcmp(rvalue.mv_data, value.mv_data) == 0); rootdb_close(&env, dbi);
Add assertion for value in get/put test
mit
braydonf/rootdb,braydonf/rootdb,braydonf/rootdb
afca1b7a6a332d667bf9f92a0402a51af1a51ff6
#ifndef __TOURH__ #define __TOURH__ #include <stdio.h> #include <stdlib.h> typedef int* tour; typedef int city; //inicializa um tour tour create_tour(int ncities); //popula um tour pre-definido com cidades void populate_tour(tour t, int ncities); //retorna true se a distancia total do //tour t for menor que dist int is_shoter(tour t, int dist); //define a cidade inicial de um tour void start_point(tour t, city c); //inverte a posição de duas cidades no tour void swap_cities(tour t, int c1, int c2); #endif
#ifndef __TOURH__ #define __TOURH__ #include <stdio.h> #include <stdlib.h> #define tour int* #define city int //initializes a new tour tour create_tour(int ncities); //returns true if the tour t is shorter than //a distance indicated by dist int is_shtr(tour t, int dist); //defines the starter point of a tour void strt_point(tour t, city c); //defines a new tour changing the order of two cities void swap_cities(tour* t, city c1, city c2); #endif
--- +++ @@ -4,20 +4,23 @@ #include <stdio.h> #include <stdlib.h> -#define tour int* -#define city int +typedef int* tour; +typedef int city; -//initializes a new tour +//inicializa um tour tour create_tour(int ncities); -//returns true if the tour t is shorter than -//a distance indicated by dist -int is_shtr(tour t, int dist); +//popula um tour pre-definido com cidades +void populate_tour(tour t, int ncities); -//defines the starter point of a tour -void strt_point(tour t, city c); +//retorna true se a distancia total do +//tour t for menor que dist +int is_shoter(tour t, int dist); -//defines a new tour changing the order of two cities -void swap_cities(tour* t, city c1, city c2); +//define a cidade inicial de um tour +void start_point(tour t, city c); + +//inverte a posição de duas cidades no tour +void swap_cities(tour t, int c1, int c2); #endif
Change type creation from define to typedef.
apache-2.0
frila/caixeiro
06be45bd2a250ccba120c46c673b7e4a5242947e
#ifndef __PROCEDURALMAZE_H__ #define __PROCEDURALMAZE_H__ #include "maze.h" #include <map> class ProceduralMaze { private: int width; int height; std::map<std::tuple<int, int>, int> grid; void clearGrid(); std::vector<std::tuple<int, int>> getAdjCells(std::tuple<int, int> center, Tile tile_state); public: ProceduralMaze(int width, int height); void generate(); void print(); std::map<std::tuple<int, int>, int> getGrid() { return grid; } }; #endif
#ifndef __PROCEDURALMAZE_H__ #define __PROCEDURALMAZE_H__ #include "maze.h" #include <map> class ProceduralMaze { private: int width; int height; public: std::map<std::tuple<int, int>, int> grid; ProceduralMaze(int width, int height); void generate(); void clearGrid(); std::vector<std::tuple<int, int>> getAdjCells(std::tuple<int, int> center, Tile tile_state); }; #endif
--- +++ @@ -9,14 +9,17 @@ private: int width; int height; + std::map<std::tuple<int, int>, int> grid; + + void clearGrid(); + std::vector<std::tuple<int, int>> getAdjCells(std::tuple<int, int> center, Tile tile_state); public: - std::map<std::tuple<int, int>, int> grid; ProceduralMaze(int width, int height); void generate(); - void clearGrid(); - std::vector<std::tuple<int, int>> getAdjCells(std::tuple<int, int> center, Tile tile_state); + void print(); + std::map<std::tuple<int, int>, int> getGrid() { return grid; } }; #endif
Move some ProceduralMaze public methods to private
mit
gfceccon/Maze,gfceccon/Maze
1d62dd3d309d009ffa3f9a71cf141ab7689e1138
/* * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <stdint.h> #include <lib/utils.h> #include <lib/utils_def.h> #include "rpi3_private.h" /* Get 128 bits of entropy and fuse the values together to form the canary. */ #define TRNG_NBYTES 16U u_register_t plat_get_stack_protector_canary(void) { size_t i; u_register_t buf[TRNG_NBYTES / sizeof(u_register_t)]; u_register_t ret = 0U; rpi3_rng_read(buf, sizeof(buf)); for (i = 0U; i < ARRAY_SIZE(buf); i++) ret ^= buf[i]; return ret; }
/* * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <stdint.h> #include <lib/utils.h> #include "rpi3_private.h" /* Get 128 bits of entropy and fuse the values together to form the canary. */ #define TRNG_NBYTES 16U u_register_t plat_get_stack_protector_canary(void) { size_t i; u_register_t buf[TRNG_NBYTES / sizeof(u_register_t)]; u_register_t ret = 0U; rpi3_rng_read(buf, sizeof(buf)); for (i = 0U; i < ARRAY_SIZE(buf); i++) ret ^= buf[i]; return ret; }
--- +++ @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,6 +7,7 @@ #include <stdint.h> #include <lib/utils.h> +#include <lib/utils_def.h> #include "rpi3_private.h"
rpi3: Fix compilation error when stack protector is enabled Include necessary header file to use ARRAY_SIZE() macro Change-Id: I5b7caccd02c14c598b7944cf4f347606c1e7a8e7 Signed-off-by: Madhukar Pappireddy <[email protected]>
bsd-3-clause
achingupta/arm-trusted-firmware,achingupta/arm-trusted-firmware
f6de960fb76ab36550a119b1465e8a24e59af219
/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===-----------------------------------------------------------------------=== * * This is a stub SDK header file. This file is not part of the interface of * this library nor an official version of the appropriate SDK header. It is * intended only to stub the features of this header required by compiler-rt. * * ===-----------------------------------------------------------------------=== */ #ifndef __SYS_MMAN_H__ #define __SYS_MMAN_H__ typedef __SIZE_TYPE__ size_t; #define PROT_READ 0x1 #define PROT_WRITE 0x2 #define PROT_EXEC 0x4 extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__((__nothrow__)); #endif /* __SYS_MMAN_H__ */
/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * * ===-----------------------------------------------------------------------=== * * This is a stub SDK header file. This file is not part of the interface of * this library nor an official version of the appropriate SDK header. It is * intended only to stub the features of this header required by compiler-rt. * * ===-----------------------------------------------------------------------=== */ #ifndef __SYS_MMAN_H__ #define __SYS_MMAN_H__ typedef __SIZE_TYPE__ size_t; #define PROT_READ 0x1 #define PROT_WRITE 0x1 #define PROT_EXEC 0x4 extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__((__nothrow__)); #endif /* __SYS_MMAN_H__ */
--- +++ @@ -20,7 +20,7 @@ typedef __SIZE_TYPE__ size_t; #define PROT_READ 0x1 -#define PROT_WRITE 0x1 +#define PROT_WRITE 0x2 #define PROT_EXEC 0x4 extern int mprotect (void *__addr, size_t __len, int __prot)
SDK/linux: Fix braindead pasto, caught by Matt Beaumont-Gay. git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@146188 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt
2a1aad729e09761ce45b9b283e2fb65da191d38c
#ifndef CPR_BODY_H #define CPR_BODY_H #include <cstring> #include <initializer_list> #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
#ifndef CPR_BODY_H #define CPR_BODY_H #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
--- +++ @@ -1,6 +1,9 @@ #ifndef CPR_BODY_H #define CPR_BODY_H +#include <cstring> + +#include <initializer_list> #include <string> #include "defines.h"
Add specific headers for used symbols in Body
mit
whoshuu/cpr,SuperV1234/cpr,whoshuu/cpr,msuvajac/cpr,msuvajac/cpr,SuperV1234/cpr,SuperV1234/cpr,msuvajac/cpr,whoshuu/cpr
ed56e96ebeffec4ee264c707ddacc3ac3b3bb2fd
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_ #define CEF_LIBCEF_DLL_CEF_MACROS_H_ #pragma once #ifdef BUILDING_CEF_SHARED #include "base/macros.h" #else // !BUILDING_CEF_SHARED // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) #endif // !BUILDING_CEF_SHARED #endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_ #define CEF_LIBCEF_DLL_CEF_MACROS_H_ #pragma once #ifdef BUILDING_CEF_SHARED #include "base/macros.h" #else // !BUILDING_CEF_SHARED // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) #endif // !BUILDING_CEF_SHARED #endif // CEF_LIBCEF_DLL_CEF_MACROS_H_ // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_ #define CEF_LIBCEF_DLL_CEF_MACROS_H_ #pragma once #ifdef BUILDING_CEF_SHARED #include "base/macros.h" #else // !BUILDING_CEF_SHARED // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) #endif // !BUILDING_CEF_SHARED #endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
--- +++ @@ -19,24 +19,3 @@ #endif // !BUILDING_CEF_SHARED #endif // CEF_LIBCEF_DLL_CEF_MACROS_H_ -// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#ifndef CEF_LIBCEF_DLL_CEF_MACROS_H_ -#define CEF_LIBCEF_DLL_CEF_MACROS_H_ -#pragma once - -#ifdef BUILDING_CEF_SHARED -#include "base/macros.h" -#else // !BUILDING_CEF_SHARED - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) - -#endif // !BUILDING_CEF_SHARED - -#endif // CEF_LIBCEF_DLL_CEF_MACROS_H_
Remove duplicate content in file. git-svn-id: 07c9500005b9a5ecd02aa6a59d3db90a097b7e72@1734 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
bsd-3-clause
zmike/cef-rebase,zmike/cef-rebase,zmike/cef-rebase,bkeiren/cef,bkeiren/cef,bkeiren/cef,bkeiren/cef,zmike/cef-rebase,bkeiren/cef,zmike/cef-rebase
f6819004e0e04193dfab17b636f266a0f36c2e17
#pragma once // assume that visuals and code are the same here.... // and also assuming our screen is square :) #define VISUALS_WIDTH 504 #define VISUALS_HEIGHT 504 #define CODE_WIDTH VISUALS_WIDTH #define CODE_HEIGHT VISUALS_HEIGHT #define CODE_X_POS 520 // via the tech staff //if this is defined, we will wait for type animation //#define TYPE_ANIMATION #define USE_MIDI_PARAM_SYNC // if this is defined, we will disable all sound playback inside this app, and instead send // OpenSoundControl messages which can be used to trigger sounds in another program (e.g. Ableton Live) //#define USE_EXTERNAL_SOUNDS
#pragma once // assume that visuals and code are the same here.... // and also assuming our screen is square :) #define VISUALS_WIDTH 504 #define VISUALS_HEIGHT 504 #define CODE_WIDTH VISUALS_WIDTH #define CODE_HEIGHT VISUALS_HEIGHT #define CODE_X_POS 520 // via the tech staff //if this is defined, we will wait for type animation #define TYPE_ANIMATION #define USE_MIDI_PARAM_SYNC // if this is defined, we will disable all sound playback inside this app, and instead send // OpenSoundControl messages which can be used to trigger sounds in another program (e.g. Ableton Live) //#define USE_EXTERNAL_SOUNDS
--- +++ @@ -13,7 +13,7 @@ #define CODE_X_POS 520 // via the tech staff //if this is defined, we will wait for type animation -#define TYPE_ANIMATION +//#define TYPE_ANIMATION #define USE_MIDI_PARAM_SYNC
Revert accidental uncommenting of TYPE_ANIMATION
mit
sh0w/recoded,sh0w/recoded,sh0w/recoded,ofZach/dayForNightSFPC,sh0w/recoded,ofZach/dayForNightSFPC,ofZach/dayForNightSFPC,ofZach/dayForNightSFPC
ddfac6ad96a03c3c6a5a638c4bf50ac00af8a58f
static inline uint32_t hash_func_string(const char* key) { uint32_t hash = 0; uint32_t c; while ((c = (uint32_t)*key++) != 0) hash = c + (hash << 6u) + (hash << 16u) - hash; return hash; }
static inline uint32_t hash_func_string(const char* key) { uint32_t hash = 0; int c; while ((c = *key++) != 0) hash = c + (hash << 6) + (hash << 16) - hash; return hash; }
--- +++ @@ -1,9 +1,9 @@ static inline uint32_t hash_func_string(const char* key) { uint32_t hash = 0; - int c; - while ((c = *key++) != 0) - hash = c + (hash << 6) + (hash << 16) - hash; + uint32_t c; + while ((c = (uint32_t)*key++) != 0) + hash = c + (hash << 6u) + (hash << 16u) - hash; return hash; }
Correct signedness to prevent some warnings.
mit
gatzka/cjet,mloy/cjet,gatzka/cjet,gatzka/cjet,gatzka/cjet,mloy/cjet,mloy/cjet,mloy/cjet,mloy/cjet,gatzka/cjet
e15920730f75a94866f7cdc955e442aec0b722d4
/* * Copyright (c) 2006 KATO Kazuyoshi <[email protected]> * This source code is released under the MIT license. */ #import <Cocoa/Cocoa.h> @interface WildcardPattern : NSObject { NSString* pattern_; } - (id) initWithString: (NSString*) s; - (BOOL) isMatch: (NSString*) s; @end
#import <Cocoa/Cocoa.h> @interface WildcardPattern : NSObject { NSString* pattern_; } - (id) initWithString: (NSString*) s; - (BOOL) isMatch: (NSString*) s; @end
--- +++ @@ -1,5 +1,9 @@ +/* + * Copyright (c) 2006 KATO Kazuyoshi <[email protected]> + * This source code is released under the MIT license. + */ + #import <Cocoa/Cocoa.h> - @interface WildcardPattern : NSObject { NSString* pattern_;
Add copyright and license header.
mit
kzys/greasekit,sohocoke/greasekit,chrismessina/greasekit,tbodt/greasekit
cdd545fda02f9cc72a309c473a32377b70f66946
#ifndef STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H #define STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H // Copyright (c) 2011 - 2017, GS Group, https://github.com/GSGroup // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, // provided that the above copyright notice and this permission notice appear in all copies. // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <stingraykit/metaprogramming/CompileTimeAssert.h> namespace stingray { template < typename T > struct StaticAssertCompleteType : CompileTimeAssert<sizeof(T) == sizeof(T)> { typedef T ValueT; }; } #endif
#ifndef STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H #define STINGRAYKIT_METAPROGRAMMING_TYPECOMPLETENESS_H // Copyright (c) 2011 - 2017, GS Group, https://github.com/GSGroup // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, // provided that the above copyright notice and this permission notice appear in all copies. // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <stingraykit/metaprogramming/CompileTimeAssert.h> namespace stingray { template < typename T > struct StaticAssertCompleteType : CompileTimeAssert<sizeof(T)> { typedef T ValueT; }; } #endif
--- +++ @@ -12,7 +12,9 @@ namespace stingray { - template < typename T > struct StaticAssertCompleteType : CompileTimeAssert<sizeof(T)> { typedef T ValueT; }; + + template < typename T > struct StaticAssertCompleteType : CompileTimeAssert<sizeof(T) == sizeof(T)> { typedef T ValueT; }; + } #endif
Fix compile ui.shell, fckng non-standard behaviour Revert "metaprogramming: Get rid of excess check in IsComplete" This reverts commit dc328c6712e9d23b3a58f7dd14dbdfa8e5a196db.
isc
GSGroup/stingraykit,GSGroup/stingraykit
c30f78e6593470906a3773d21ab2f265f1f95ddc
/* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. * $FreeBSD$ */ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ #include <machine/fsr.h> typedef int fp_except_t; #define FP_X_IMP FSR_NX /* imprecise (loss of precision) */ #define FP_X_DZ FSR_DZ /* divide-by-zero exception */ #define FP_X_UFL FSR_UF /* underflow exception */ #define FP_X_OFL FSR_OF /* overflow exception */ #define FP_X_INV FSR_NV /* invalid operation exception */ typedef enum { FP_RN = FSR_RD_N, /* round to nearest representable number */ FP_RZ = FSR_RD_Z, /* round to zero (truncate) */ FP_RP = FSR_RD_PINF, /* round toward positive infinity */ FP_RM = FSR_RD_NINF /* round toward negative infinity */ } fp_rnd_t; #endif /* _MACHINE_IEEEFP_H_ */
/* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. * $FreeBSD$ */ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ typedef int fp_except_t; #define FP_X_IMP 0x01 /* imprecise (loss of precision) */ #define FP_X_DZ 0x02 /* divide-by-zero exception */ #define FP_X_UFL 0x04 /* underflow exception */ #define FP_X_OFL 0x08 /* overflow exception */ #define FP_X_INV 0x10 /* invalid operation exception */ typedef enum { FP_RN=0, /* round to nearest representable number */ FP_RZ=1, /* round to zero (truncate) */ FP_RP=2, /* round toward positive infinity */ FP_RM=3 /* round toward negative infinity */ } fp_rnd_t; #endif /* _MACHINE_IEEEFP_H_ */
--- +++ @@ -7,18 +7,20 @@ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ +#include <machine/fsr.h> + typedef int fp_except_t; -#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ -#define FP_X_DZ 0x02 /* divide-by-zero exception */ -#define FP_X_UFL 0x04 /* underflow exception */ -#define FP_X_OFL 0x08 /* overflow exception */ -#define FP_X_INV 0x10 /* invalid operation exception */ +#define FP_X_IMP FSR_NX /* imprecise (loss of precision) */ +#define FP_X_DZ FSR_DZ /* divide-by-zero exception */ +#define FP_X_UFL FSR_UF /* underflow exception */ +#define FP_X_OFL FSR_OF /* overflow exception */ +#define FP_X_INV FSR_NV /* invalid operation exception */ typedef enum { - FP_RN=0, /* round to nearest representable number */ - FP_RZ=1, /* round to zero (truncate) */ - FP_RP=2, /* round toward positive infinity */ - FP_RM=3 /* round toward negative infinity */ + FP_RN = FSR_RD_N, /* round to nearest representable number */ + FP_RZ = FSR_RD_Z, /* round to zero (truncate) */ + FP_RP = FSR_RD_PINF, /* round toward positive infinity */ + FP_RM = FSR_RD_NINF /* round toward negative infinity */ } fp_rnd_t; #endif /* _MACHINE_IEEEFP_H_ */
Use the definitions in machine/fsr.h instead of duplicating these magic numbers here (the values need to correspond to the %fsr ones for some libc functions to work right).
bsd-3-clause
jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase
69c3f107e2c8a2eef56249a87c8e192d8f6abe5c
#ifndef GRIDCELL_H #define GRIDCELL_H #include <gsl/gsl_rng.h> /* DATA STRUCTURES */ #define GC_NUM_STATES 4 typedef enum { DECIDUOUS,CONIFEROUS,TRANSITIONAL,MIXED} State; typedef double StateData [GC_NUM_STATES]; typedef enum { MOORE, VONNE} NeighType; typedef struct { double meanTemp; /*Task: list all variables need to be used*/ // Fill later } Climate; typedef struct { State* currentState; State* stateHistory; Climate climate; StateData prevalence; StateData transitionProbs; size_t historySize; } GridCell; /*. FUNCTION PROTOTYPES */ GridCell* gc_make_cell (size_t numTimeSteps); // allocate memory and null initialize cell, initialize pointers void gc_get_trans_prob (GridCell* cell); void gc_select_new_state (GridCell* cell, gsl_rng* rng); void gc_destroy_cell(GridCell *cell); #endif
#ifndef GRIDCELL_H #define GRIDCELL_H #include <gsl/gsl_rng.h> /* DATA STRUCTURES */ #define GC_NUM_STATES 4 typedef enum { DECIDUOUS,CONIFEROUS,TRANSITIONAL,MIXED} State; typedef double StateData [GC_NUM_STATES]; typedef enum { MOORE, VONNE} NeighType; extern State GC_POSSIBLE_STATES [GC_NUM_STATES]; // this is an array giving all possible states typedef struct { double meanTemp; /*Task: list all variables need to be used*/ // Fill later } Climate; typedef struct { State* currentState; State* stateHistory; Climate climate; StateData prevalence; StateData transitionProbs; size_t historySize; } GridCell; /*. FUNCTION PROTOTYPES */ GridCell* gc_make_cell (size_t numTimeSteps); // allocate memory and null initialize cell, initialize pointers void gc_get_trans_prob (GridCell* cell); void gc_select_new_state (GridCell* cell, gsl_rng* rng); void gc_destroy_cell(GridCell *cell); #endif
--- +++ @@ -10,10 +10,8 @@ #define GC_NUM_STATES 4 typedef enum { DECIDUOUS,CONIFEROUS,TRANSITIONAL,MIXED} State; typedef double StateData [GC_NUM_STATES]; - typedef enum { MOORE, VONNE} NeighType; -extern State GC_POSSIBLE_STATES [GC_NUM_STATES]; // this is an array giving all possible states typedef struct { double meanTemp;
Delete unused extern variable declared
mit
QUICC-FOR/STModel-Simulation,QUICC-FOR/STModel-Simulation
afd6a6dcac92c604ff97892e3c95f845dd479bc5
/** * Servo "mock" class. Ideally our ServoMotor class would be using composition * to become an (Arduino) Servo motor. However, we want to make usage easier and * transparent to the user, so we are extending the Arduino Servo class. * The inheritance instead of composition makes things a little bit trickier * to mock and that is why we need a stub implementation of `Servo` that can get * injected with the mock which in turn we can set our expectations upon. */ #pragma once #include <memory> #include <stdexcept> #include <stdint.h> #include "gmock/gmock.h" class MockServo { public: MOCK_METHOD3(attach, void(uint8_t pin, int maxPulseLength, int minPulseLength)); MOCK_METHOD1(writeMicroseconds, void(int microseconds)); }; class Servo { public: void attach(uint8_t pin, int maxPulseLength, int minPulseLength) { mMockServo->attach(pin, maxPulseLength, minPulseLength); } void writeMicroseconds(int microseconds) { mMockServo->writeMicroseconds(microseconds); } std::shared_ptr<MockServo> mMockServo; };
/** * Servo "mock" class. Ideally our ServoMotor class would be using composition * to become an (Arduino) Servo motor. However, we want to make usage easier and * transparent to the user, so we are extending the Arduino Servo class. * The inheritance instead of composition makes things a little bit trickier * to mock and that is why we need a stub implementation of `Servo` that can get * injected with the mock which in turn we can set our expectations upon. */ #pragma once #include <memory> #include <stdexcept> #include <stdint.h> #include "gmock/gmock.h" class MockServo { public: MOCK_METHOD3(attach, void(uint8_t pin, int maxPulseLength, int minPulseLength)); MOCK_METHOD1(writeMicroseconds, void(int microseconds)); }; class Servo { public: void attach(uint8_t pin, int maxPulseLength, int minPulseLength) { if (!mMockServo) { throw std::logic_error("No mockServo attached! Please set the mMockServo with a MockServo shared pointer."); } mMockServo->attach(pin, maxPulseLength, minPulseLength); } void writeMicroseconds(int microseconds) { if (!mMockServo) { throw std::logic_error("No mockServo attached! Please set the mMockServo with a MockServo shared pointer."); } mMockServo->writeMicroseconds(microseconds); } std::shared_ptr<MockServo> mMockServo; };
--- +++ @@ -26,19 +26,11 @@ public: void attach(uint8_t pin, int maxPulseLength, int minPulseLength) { - if (!mMockServo) - { - throw std::logic_error("No mockServo attached! Please set the mMockServo with a MockServo shared pointer."); - } mMockServo->attach(pin, maxPulseLength, minPulseLength); } void writeMicroseconds(int microseconds) { - if (!mMockServo) - { - throw std::logic_error("No mockServo attached! Please set the mMockServo with a MockServo shared pointer."); - } mMockServo->writeMicroseconds(microseconds); }
Remove unecessary checks from mock class
mit
platisd/smartcar_shield,platisd/smartcar_shield
63bd713f7609ffb72b8592b772ef525224e6ffdf
#ifndef EIGEN_HELPER_H #define EIGEN_HELPER_H #include "ros/ros.h" #include <Eigen/Dense> template<typename Derived> inline bool isFucked(const Eigen::MatrixBase<Derived>& x) { return !((x.array() == x.array())).all() && !( (x - x).array() == (x - x).array()).all(); } inline Eigen::MatrixXd getMatrixParam(ros::NodeHandle nh, std::string name) { XmlRpc::XmlRpcValue matrix; nh.getParam(name, matrix); try { const int rows = matrix.size(); const int cols = matrix[0].size(); Eigen::MatrixXd X(rows,cols); for (int i = 0; i < rows; ++i) for (int j = 0; j < cols; ++j) X(i,j) = matrix[i][j]; return X; } catch(...) { ROS_ERROR("Error in getMatrixParam. Returning 1-by-1 zero matrix."); return Eigen::MatrixXd::Zero(1,1); } } inline void printEigen(std::string name, const Eigen::MatrixXd &x) { std::stringstream ss; ss << name << " = " << std::endl << x; ROS_INFO_STREAM(ss.str()); } inline Eigen::MatrixXd pinv(const Eigen::MatrixXd &X) { Eigen::MatrixXd X_pinv = X.transpose() * ( X*X.transpose() ).inverse(); if (isFucked(X_pinv)) { ROS_WARN("Could not compute pseudoinverse. Returning transpose."); return X.transpose(); } return X_pinv; } #endif
#ifndef EIGEN_HELPER_H #define EIGEN_HELPER_H #include <Eigen/Dense> template<typename Derived> inline bool isFucked(const Eigen::MatrixBase<Derived>& x) { return !((x.array() == x.array())).all() && !( (x - x).array() == (x - x).array()).all(); } #endif
--- +++ @@ -1,6 +1,7 @@ #ifndef EIGEN_HELPER_H #define EIGEN_HELPER_H +#include "ros/ros.h" #include <Eigen/Dense> template<typename Derived> @@ -9,4 +10,46 @@ return !((x.array() == x.array())).all() && !( (x - x).array() == (x - x).array()).all(); } +inline Eigen::MatrixXd getMatrixParam(ros::NodeHandle nh, std::string name) +{ + XmlRpc::XmlRpcValue matrix; + nh.getParam(name, matrix); + + try + { + const int rows = matrix.size(); + const int cols = matrix[0].size(); + Eigen::MatrixXd X(rows,cols); + for (int i = 0; i < rows; ++i) + for (int j = 0; j < cols; ++j) + X(i,j) = matrix[i][j]; + return X; + } + catch(...) + { + ROS_ERROR("Error in getMatrixParam. Returning 1-by-1 zero matrix."); + return Eigen::MatrixXd::Zero(1,1); + } +} + +inline void printEigen(std::string name, const Eigen::MatrixXd &x) +{ + std::stringstream ss; + ss << name << " = " << std::endl << x; + ROS_INFO_STREAM(ss.str()); +} + +inline Eigen::MatrixXd pinv(const Eigen::MatrixXd &X) +{ + Eigen::MatrixXd X_pinv = X.transpose() * ( X*X.transpose() ).inverse(); + + if (isFucked(X_pinv)) + { + ROS_WARN("Could not compute pseudoinverse. Returning transpose."); + return X.transpose(); + } + + return X_pinv; +} + #endif
Move more stuff to eigen helper header
mit
vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control
74ce9a97e81b913f26f0353dc0d3e988af99cb5c
#include <stdio.h> #include "forsyth.h" #include "check.h" int main(int argc, char* argv[]) { FILE * stream; int FEN_status; if (argc < 2) FEN_status = load_FEN( "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ); else FEN_status = load_FEN(argv[1]); #if defined(TEST_MATE_IN_ONE) memcpy(&square(a8), "nk....bq", 8); memcpy(&square(a7), "ppp.r...", 8); memcpy(&square(a6), "........", 8); memcpy(&square(a5), "........", 8); memcpy(&square(a4), "........", 8); memcpy(&square(a3), "........", 8); memcpy(&square(a2), "...R.PPP", 8); memcpy(&square(a1), "QB....KN", 8); #endif if (FEN_status != FEN_OK) { fprintf(stderr, "(%i): FEN record is corrupt!\n\n", FEN_status); return (FEN_status); } stream = (argc < 3) ? stdout : fopen(argv[2], "w"); load_Forsyth(stream); fclose(stream); if (in_check(WHITE)) puts("White is in check."); if (in_check(BLACK)) puts("Black is in check."); return 0; }
#include <stdio.h> #include "forsyth.h" int main(int argc, char* argv[]) { FILE * stream; int FEN_status; if (argc < 2) FEN_status = load_FEN( "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ); else FEN_status = load_FEN(argv[1]); #if defined(TEST_MATE_IN_ONE) memcpy(&square(a8), "nk....bq", 8); memcpy(&square(a7), "ppp.r...", 8); memcpy(&square(a6), "........", 8); memcpy(&square(a5), "........", 8); memcpy(&square(a4), "........", 8); memcpy(&square(a3), "........", 8); memcpy(&square(a2), "...R.PPP", 8); memcpy(&square(a1), "QB....KN", 8); #endif if (FEN_status != FEN_OK) { fprintf(stderr, "(%i): FEN record is corrupt!\n\n", FEN_status); return (FEN_status); } stream = (argc < 3) ? stdout : fopen(argv[2], "w"); load_Forsyth(stream); fclose(stream); return 0; }
--- +++ @@ -1,5 +1,7 @@ #include <stdio.h> #include "forsyth.h" + +#include "check.h" int main(int argc, char* argv[]) { @@ -33,5 +35,10 @@ stream = (argc < 3) ? stdout : fopen(argv[2], "w"); load_Forsyth(stream); fclose(stream); + + if (in_check(WHITE)) + puts("White is in check."); + if (in_check(BLACK)) + puts("Black is in check."); return 0; }
Debug check analysis for both sides.
cc0-1.0
cxd4/chess,cxd4/chess,cxd4/chess
9ba4f34f11902e16fb17ec08f66a1c9f27817359
#ifndef VAST_QUERY_SEARCH_H #define VAST_QUERY_SEARCH_H #include <unordered_map> #include <cppa/cppa.hpp> #include <ze/event.h> #include <vast/query/query.h> namespace vast { namespace query { class search : public cppa::sb_actor<search> { friend class cppa::sb_actor<search>; public: search(cppa::actor_ptr archive, cppa::actor_ptr index); private: std::vector<cppa::actor_ptr> queries_; std::unordered_multimap<cppa::actor_ptr, cppa::actor_ptr> clients_; cppa::actor_ptr archive_; cppa::actor_ptr index_; cppa::behavior init_state; }; } // namespace query } // namespace vast #endif
#ifndef VAST_QUERY_SEARCH_H #define VAST_QUERY_SEARCH_H #include <unordered_map> #include <cppa/cppa.hpp> #include <ze/event.h> #include <vast/query/query.h> namespace vast { namespace query { class search : public cppa::sb_actor<search> { friend class cppa::sb_actor<search>; public: search(cppa::actor_ptr archive, cppa::actor_ptr index); private: std::vector<cppa::actor_ptr> queries_; std::multimap<cppa::actor_ptr, cppa::actor_ptr> clients_; cppa::actor_ptr archive_; cppa::actor_ptr index_; cppa::behavior init_state; }; } // namespace query } // namespace vast #endif
--- +++ @@ -18,7 +18,7 @@ private: std::vector<cppa::actor_ptr> queries_; - std::multimap<cppa::actor_ptr, cppa::actor_ptr> clients_; + std::unordered_multimap<cppa::actor_ptr, cppa::actor_ptr> clients_; cppa::actor_ptr archive_; cppa::actor_ptr index_; cppa::behavior init_state;
Use an unordered map to track clients.
bsd-3-clause
pmos69/vast,mavam/vast,vast-io/vast,vast-io/vast,pmos69/vast,pmos69/vast,mavam/vast,vast-io/vast,mavam/vast,mavam/vast,vast-io/vast,pmos69/vast,vast-io/vast
db3de3779b73a2919c193fa3bd85d1295a0e54ef
#include "mbb/test.h" #include "mbb/queue.h" #include "mbb/debug.h" char *test_enqueue_dequeue() { int i; MQUE_DEFINE_STRUCT(int, 5) queue; MQUE_INITIALISE(&queue); MUNT_ASSERT(MQUE_IS_EMPTY(&queue)); for (i = 1; i <= 5; i++) { MUNT_ASSERT(!MQUE_IS_FULL(&queue)); MQUE_ENQUEUE(&queue, i); } for (i = 1; i <= 5; i++) { int head; MUNT_ASSERT(!MQUE_IS_EMPTY(&queue)); head = MQUE_HEAD(&queue); MQUE_DEQUEUE(&queue);; MUNT_ASSERT(head == i); } MUNT_ASSERT(MQUE_IS_EMPTY(&queue)); return 0; }
#include "mbb/test.h" #include "mbb/queue.h" #include "mbb/debug.h" char *test_enqueue_dequeue() { int i; MQUE_DEFINE_STRUCT(int, 5) queue; MQUE_INITIALISE(&queue); MUNT_ASSERT(MQUE_IS_EMPTY(&queue)); for (i = 1; i <= 5; i++) { MUNT_ASSERT(!MQUE_IS_FULL(&queue)); MQUE_ENQUEUE(&queue, i); } for (i = 1; i <= 5; i++) { int head; MUNT_ASSERT(!MQUE_IS_EMPTY(&queue)); head = MQUE_HEAD(&queue); MQUE_DEQUEUE(&queue);; } MUNT_ASSERT(MQUE_IS_EMPTY(&queue)); return 0; }
--- +++ @@ -24,6 +24,8 @@ head = MQUE_HEAD(&queue); MQUE_DEQUEUE(&queue);; + + MUNT_ASSERT(head == i); } MUNT_ASSERT(MQUE_IS_EMPTY(&queue));
Check enqueued values in unit test
mit
jawebada/libmbb,jawebada/libmbb,jawebada/libmbb,jawebada/libmbb
5b6bfd2202b9ad7a3eafd0585ce5c37dd6f5d91f
// // process.h // Project3 // // Created by Stratton Aguilar on 7/3/14. // Copyright (c) 2014 Stratton Aguilar. All rights reserved. // #ifndef Project3_process_h #define Project3_process_h typedef struct { int processNum; int arrivalTime; int lifeTime; int memReq; int time_left; int is_active; } PROCESS; #endif
// // process.h // Project3 // // Created by Stratton Aguilar on 7/3/14. // Copyright (c) 2014 Stratton Aguilar. All rights reserved. // #ifndef Project3_process_h #define Project3_process_h typedef struct { int processNum; int arrivalTime; int lifeTime; int memReq; } PROCESS; #endif
--- +++ @@ -14,5 +14,8 @@ int arrivalTime; int lifeTime; int memReq; + + int time_left; + int is_active; } PROCESS; #endif
Add time_left and is_active to the proc struct
mit
ciarand/operating-systems-memory-management-assignment
bafe09faaffee154ccc9225bacb526517e555882
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.53f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.52f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
--- +++ @@ -3,7 +3,7 @@ // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. -const float kCurrentVersion = 1.52f; +const float kCurrentVersion = 1.53f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor
Increase version number to 1.53
apache-2.0
google/UIforETW,ariccio/UIforETW,google/UIforETW,ariccio/UIforETW,google/UIforETW,ariccio/UIforETW,google/UIforETW,ariccio/UIforETW
e6420a303bfdeeba04ec7b00367ef4474e96e5a3
#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_
#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_
--- +++ @@ -26,9 +26,8 @@ Eigen::Vector2f anchorPosition2D; Eigen::Vector2f labelPosition2D; float labelPositionDepth; - private: - std::string text; + const std::string text; }; } // namespace Forces
Make text in LabelState public.
mit
Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller
159caac86902add83f4ff3a2d813559144806f98
/* * A simple Brainfuck interpreter. * * This file was written by Damien Dart, <[email protected]>. This is free * and unencumbered software released into the public domain. For more * information, please refer to the accompanying "UNLICENCE" file. */ #include <errno.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "brainfuck.h" void *realloc2(void *, size_t); int main(void) { char character = 0; char *commands = NULL; uint32_t number_of_commands = 0; while((character = getchar()) != EOF) { commands = realloc2(commands, ++number_of_commands * sizeof(char)); commands[number_of_commands - 1] = character; } commands = realloc2(commands, ++number_of_commands * sizeof(char)); commands[number_of_commands - 1] = '\0'; brainfuck_evaluate(commands); free(commands); return EXIT_SUCCESS; } void *realloc2(void *ptr, size_t size) { char *new_obj = realloc(ptr, size); if (new_obj == NULL) { free(ptr); strerror(errno); exit(EXIT_FAILURE); } return new_obj; }
/* * A simple Brainfuck interpreter. * * This file was written by Damien Dart, <[email protected]>. This is free * and unencumbered software released into the public domain. For more * information, please refer to the accompanying "UNLICENCE" file. */ #include <errno.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "brainfuck.h" int main(void) { char character = 0; char *commands = NULL; uint32_t number_of_commands = 0; while((character = getchar()) != EOF) { if ((character == '>') || (character == '<') || (character == '+') || (character == '-') || (character == '.') || (character == ',') || (character == '[') || (character == ']')) { char *temp = realloc(commands, ++number_of_commands * sizeof(char)); if (temp == NULL) { free(commands); perror("Unable to create command list"); exit(EXIT_FAILURE); } commands = temp; commands[number_of_commands - 1] = character; } } commands = realloc(commands, ++number_of_commands * sizeof(char)); commands[number_of_commands - 1] = '\0'; brainfuck_evaluate(commands); free(commands); return EXIT_SUCCESS; }
--- +++ @@ -14,28 +14,31 @@ #include "brainfuck.h" +void *realloc2(void *, size_t); + int main(void) { char character = 0; char *commands = NULL; uint32_t number_of_commands = 0; while((character = getchar()) != EOF) { - if ((character == '>') || (character == '<') || (character == '+') || - (character == '-') || (character == '.') || (character == ',') || - (character == '[') || (character == ']')) { - char *temp = realloc(commands, ++number_of_commands * sizeof(char)); - if (temp == NULL) { - free(commands); - perror("Unable to create command list"); - exit(EXIT_FAILURE); - } - commands = temp; - commands[number_of_commands - 1] = character; - } + commands = realloc2(commands, ++number_of_commands * sizeof(char)); + commands[number_of_commands - 1] = character; } - commands = realloc(commands, ++number_of_commands * sizeof(char)); + commands = realloc2(commands, ++number_of_commands * sizeof(char)); commands[number_of_commands - 1] = '\0'; brainfuck_evaluate(commands); free(commands); return EXIT_SUCCESS; } + +void *realloc2(void *ptr, size_t size) +{ + char *new_obj = realloc(ptr, size); + if (new_obj == NULL) { + free(ptr); + strerror(errno); + exit(EXIT_FAILURE); + } + return new_obj; +}
Handle instances when "realloc()" fails.
unlicense
damiendart/brainfuck
53cd39088decb09998153455d9b00938115a322e
#include <stdio.h> int main() { /* hi this is a multi-line comment hi. */ // single-line comment printf ("Hello world!\n"); // this works too // some vars and control flow int numDaysInYear = 365; printf ("days per year: %d\n", numDaysInYear); if (numDaysInYear == 366) { printf ("Seems reasonable\n"); } else { int long someReallyLongNumber = 100000000000000L; printf ("Some long number: %ld\n", someReallyLongNumber); } // loops int i; for (i=0; i<5; i++) { printf ("i=%d\n", i); } // https://www.seas.gwu.edu/~simhaweb/C/lectures/module2/module2 int x = 5; int *intPtr; // print mem address of variable i printf ("Variable x is located at memory address %lu\n", &x); // extract address of var i into the pointer intPtr = & x; printf ("The int at memory location %lu is %d\n", intPtr, *intPtr); // TODO: examine compiler warnings }
#include <stdio.h> int main() { /* hi this is a multi-line comment hi. */ // single-line comment printf ("Hello world!\n"); // this works too // some vars and control flow int numDaysInYear = 365; printf ("days per year: %d\n", numDaysInYear); if (numDaysInYear == 366) { printf ("Seems reasonable\n"); } else { int long someReallyLongNumber = 100000000000000L; printf ("Some long number: %ld\n", someReallyLongNumber); } // loops int i; for (i=0; i<5; i++) { printf ("i=%d\n", i); } }
--- +++ @@ -27,4 +27,18 @@ printf ("i=%d\n", i); } + // https://www.seas.gwu.edu/~simhaweb/C/lectures/module2/module2 + int x = 5; + + int *intPtr; + + // print mem address of variable i + printf ("Variable x is located at memory address %lu\n", &x); + + // extract address of var i into the pointer + intPtr = & x; + printf ("The int at memory location %lu is %d\n", intPtr, *intPtr); + + // TODO: examine compiler warnings + }
Add c pointer basic example
mit
oldhill/halloween,oldhill/halloween,oldhill/halloween,oldhill/halloween
55ca2704359dbd97169eeed03e258f9005d7336d
// RUN: %clang_cfi -lm -o %t1 %s // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s // This test uses jump tables containing PC-relative references to external // symbols, which the Mach-O object writer does not currently support. // The test passes on i386 Darwin and fails on x86_64, hence unsupported instead of xfail. // UNSUPPORTED: darwin #include <stdlib.h> #include <stdio.h> #include <math.h> int main(int argc, char **argv) { // CFI: 1 fprintf(stderr, "1\n"); double (*fn)(double); if (argv[1][0] == 's') fn = sin; else fn = cos; fn(atof(argv[2])); // CFI: 2 fprintf(stderr, "2\n"); }
// RUN: %clang_cfi -lm -o %t1 %s // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s // This test uses jump tables containing PC-relative references to external // symbols, which the Mach-O object writer does not currently support. // XFAIL: darwin #include <stdlib.h> #include <stdio.h> #include <math.h> int main(int argc, char **argv) { // CFI: 1 fprintf(stderr, "1\n"); double (*fn)(double); if (argv[1][0] == 's') fn = sin; else fn = cos; fn(atof(argv[2])); // CFI: 2 fprintf(stderr, "2\n"); }
--- +++ @@ -4,7 +4,8 @@ // This test uses jump tables containing PC-relative references to external // symbols, which the Mach-O object writer does not currently support. -// XFAIL: darwin +// The test passes on i386 Darwin and fails on x86_64, hence unsupported instead of xfail. +// UNSUPPORTED: darwin #include <stdlib.h> #include <stdio.h>
[cfi] Mark a test as unsupported on darwin. git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@315007 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt
ad59ece0e473ce0278ab3516e9d0a757955a5da1
#ifndef CLIENTVERSION_H #define CLIENTVERSION_H // // client versioning and copyright year // // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 5 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source #define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X #endif // CLIENTVERSION_H
#ifndef CLIENTVERSION_H #define CLIENTVERSION_H // // client versioning and copyright year // // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source #define COPYRIGHT_YEAR 2013 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X #endif // CLIENTVERSION_H
--- +++ @@ -8,7 +8,7 @@ // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 -#define CLIENT_VERSION_REVISION 3 +#define CLIENT_VERSION_REVISION 5 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build @@ -16,7 +16,7 @@ // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source -#define COPYRIGHT_YEAR 2013 +#define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro!
Update client version to 0.9.5
mit
coinkeeper/2015-06-22_18-49_unobtanium,unobtanium-official/Unobtanium,unobtanium-official/Unobtanium,coinkeeper/2015-06-22_18-49_unobtanium,coinkeeper/2015-06-22_18-49_unobtanium,coinkeeper/2015-06-22_18-49_unobtanium,unobtanium-official/Unobtanium,coinkeeper/2015-06-22_18-49_unobtanium,unobtanium-official/Unobtanium,coinkeeper/2015-06-22_18-49_unobtanium,unobtanium-official/Unobtanium,unobtanium-official/Unobtanium
40042b55d410a8c0adfb7a5b1ee27c55a72a731d
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. // Inclusion of all message files present in the system. Keep this file // up-to-date when adding a new value to enum IPCMessageStart in // ipc/ipc_message_utils.h to include the corresponding message file. #include "chrome/browser/importer/profile_import_process_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" #include "content/common/pepper_messages.h" #include "ppapi/proxy/ppapi_messages.h"
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. // Inclusion of all message files present in the system. Keep this file // up-to-date when adding a new value to enum IPCMessageStart in // ipc/ipc_message_utils.h to include the corresponding message file. #include "chrome/browser/importer/profile_import_process_messages.h" #include "chrome/common/automation_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" #include "ppapi/proxy/ppapi_messages.h"
--- +++ @@ -7,8 +7,8 @@ // up-to-date when adding a new value to enum IPCMessageStart in // ipc/ipc_message_utils.h to include the corresponding message file. #include "chrome/browser/importer/profile_import_process_messages.h" -#include "chrome/common/automation_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" +#include "content/common/pepper_messages.h" #include "ppapi/proxy/ppapi_messages.h"
Fix build break from bad merge git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@106741 0039d316-1c4b-4281-b951-d872f2087c98
bsd-3-clause
hujiajie/pa-chromium,timopulkkinen/BubbleFish,dushu1203/chromium.src,dushu1203/chromium.src,robclark/chromium,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,keishi/chromium,littlstar/chromium.src,ondra-novak/chromium.src,junmin-zhu/chromium-rivertrail,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,Jonekee/chromium.src,dushu1203/chromium.src,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,Fireblend/chromium-crosswalk,hujiajie/pa-chromium,anirudhSK/chromium,Chilledheart/chromium,timopulkkinen/BubbleFish,Chilledheart/chromium,dednal/chromium.src,ondra-novak/chromium.src,keishi/chromium,markYoungH/chromium.src,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,nacl-webkit/chrome_deps,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,ChromiumWebApps/chromium,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ltilve/chromium,nacl-webkit/chrome_deps,junmin-zhu/chromium-rivertrail,ondra-novak/chromium.src,zcbenz/cefode-chromium,markYoungH/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,junmin-zhu/chromium-rivertrail,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,ondra-novak/chromium.src,nacl-webkit/chrome_deps,littlstar/chromium.src,mogoweb/chromium-crosswalk,dednal/chromium.src,chuan9/chromium-crosswalk,ltilve/chromium,PeterWangIntel/chromium-crosswalk,krieger-od/nwjs_chromium.src,junmin-zhu/chromium-rivertrail,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,keishi/chromium,Fireblend/chromium-crosswalk,ltilve/chromium,markYoungH/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,Jonekee/chromium.src,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,patrickm/chromium.src,anirudhSK/chromium,dushu1203/chromium.src,anirudhSK/chromium,ondra-novak/chromium.src,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,zcbenz/cefode-chromium,keishi/chromium,ChromiumWebApps/chromium,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,hujiajie/pa-chromium,markYoungH/chromium.src,keishi/chromium,junmin-zhu/chromium-rivertrail,crosswalk-project/chromium-crosswalk-efl,Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,timopulkkinen/BubbleFish,patrickm/chromium.src,junmin-zhu/chromium-rivertrail,mogoweb/chromium-crosswalk,dednal/chromium.src,robclark/chromium,Just-D/chromium-1,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,zcbenz/cefode-chromium,fujunwei/chromium-crosswalk,pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,keishi/chromium,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,TheTypoMaster/chromium-crosswalk,keishi/chromium,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,dednal/chromium.src,M4sse/chromium.src,chuan9/chromium-crosswalk,robclark/chromium,anirudhSK/chromium,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,hgl888/chromium-crosswalk,dushu1203/chromium.src,patrickm/chromium.src,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,Just-D/chromium-1,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,timopulkkinen/BubbleFish,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,timopulkkinen/BubbleFish,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,hujiajie/pa-chromium,dednal/chromium.src,dednal/chromium.src,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,keishi/chromium,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,robclark/chromium,timopulkkinen/BubbleFish,dednal/chromium.src,axinging/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,hujiajie/pa-chromium,rogerwang/chromium,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,nacl-webkit/chrome_deps,markYoungH/chromium.src,dednal/chromium.src,zcbenz/cefode-chromium,anirudhSK/chromium,hujiajie/pa-chromium,Jonekee/chromium.src,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,ondra-novak/chromium.src,nacl-webkit/chrome_deps,robclark/chromium,ChromiumWebApps/chromium,ondra-novak/chromium.src,hujiajie/pa-chromium,keishi/chromium,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,rogerwang/chromium,junmin-zhu/chromium-rivertrail,TheTypoMaster/chromium-crosswalk,hujiajie/pa-chromium,rogerwang/chromium,zcbenz/cefode-chromium,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,littlstar/chromium.src,jaruba/chromium.src,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,patrickm/chromium.src,rogerwang/chromium,robclark/chromium,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,Chilledheart/chromium,ChromiumWebApps/chromium,keishi/chromium,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,jaruba/chromium.src,bright-sparks/chromium-spacewalk,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,zcbenz/cefode-chromium,ltilve/chromium,markYoungH/chromium.src,anirudhSK/chromium,ChromiumWebApps/chromium,ltilve/chromium,TheTypoMaster/chromium-crosswalk,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,robclark/chromium,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,markYoungH/chromium.src,zcbenz/cefode-chromium,hujiajie/pa-chromium,jaruba/chromium.src,hujiajie/pa-chromium,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,nacl-webkit/chrome_deps,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,ltilve/chromium,Just-D/chromium-1,axinging/chromium-crosswalk,ltilve/chromium,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,mogoweb/chromium-crosswalk,Fireblend/chromium-crosswalk,patrickm/chromium.src,Jonekee/chromium.src,rogerwang/chromium,hujiajie/pa-chromium,jaruba/chromium.src,M4sse/chromium.src,Fireblend/chromium-crosswalk,keishi/chromium,ChromiumWebApps/chromium,ltilve/chromium,anirudhSK/chromium,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,patrickm/chromium.src,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,Just-D/chromium-1,dednal/chromium.src,patrickm/chromium.src,Chilledheart/chromium,littlstar/chromium.src,chuan9/chromium-crosswalk,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,zcbenz/cefode-chromium,timopulkkinen/BubbleFish,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,Just-D/chromium-1,littlstar/chromium.src,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,Chilledheart/chromium,jaruba/chromium.src,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,anirudhSK/chromium,rogerwang/chromium,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,Fireblend/chromium-crosswalk,junmin-zhu/chromium-rivertrail,markYoungH/chromium.src,M4sse/chromium.src,jaruba/chromium.src,chuan9/chromium-crosswalk,rogerwang/chromium,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,dushu1203/chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk,robclark/chromium,Chilledheart/chromium,timopulkkinen/BubbleFish,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,rogerwang/chromium,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,robclark/chromium,crosswalk-project/chromium-crosswalk-efl,rogerwang/chromium,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,robclark/chromium,M4sse/chromium.src,dushu1203/chromium.src,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,markYoungH/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,patrickm/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,littlstar/chromium.src,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,markYoungH/chromium.src
f94c619e73b934b8f32edf303cc8998670f7cc64
/* * dialer - MeeGo Voice Call Manager * Copyright (c) 2009, 2010, Intel Corporation. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at * http://www.apache.org/licenses/LICENSE-2.0 * */ #ifndef GENERICPAGE_H #define GENERICPAGE_H #include <MApplicationPage> class MainWindow; class MLayout; class MGridLayoutPolicy; class GenericPage : public MApplicationPage { Q_OBJECT public: enum PageType { PAGE_NONE = -1, PAGE_DIALER = 0, PAGE_RECENT = 1, PAGE_PEOPLE = 2, PAGE_FAVORITE = 3, PAGE_DEBUG = 4, }; GenericPage(); virtual ~GenericPage(); virtual void createContent(); virtual MGridLayoutPolicy * policy(M::Orientation); virtual void activateWidgets(); virtual void deactivateAndResetWidgets(); MainWindow *mainWindow(); protected: virtual void showEvent(QShowEvent *event); MLayout * layout; MGridLayoutPolicy * landscape; MGridLayoutPolicy * portrait; PageType m_pageType; }; #endif // GENERICPAGE_H
/* * dialer - MeeGo Voice Call Manager * Copyright (c) 2009, 2010, Intel Corporation. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at * http://www.apache.org/licenses/LICENSE-2.0 * */ #ifndef GENERICPAGE_H #define GENERICPAGE_H #include <MApplicationPage> class MainWindow; class MLayout; class MGridLayoutPolicy; class GenericPage : public MApplicationPage { Q_OBJECT public: enum PageType { PAGE_NONE = -1, PAGE_DIALER = 0, PAGE_RECENT = 1, PAGE_PEOPLE = 2, PAGE_FAVORITE = 3, PAGE_DEBUG = 4, }; GenericPage(); virtual ~GenericPage(); virtual void createContent(); virtual MGridLayoutPolicy * policy(M::Orientation); MainWindow *mainWindow(); protected: virtual void showEvent(QShowEvent *event); virtual void activateWidgets(); virtual void deactivateAndResetWidgets(); MLayout * layout; MGridLayoutPolicy * landscape; MGridLayoutPolicy * portrait; PageType m_pageType; }; #endif // GENERICPAGE_H
--- +++ @@ -37,12 +37,13 @@ virtual void createContent(); virtual MGridLayoutPolicy * policy(M::Orientation); + virtual void activateWidgets(); + virtual void deactivateAndResetWidgets(); + MainWindow *mainWindow(); protected: virtual void showEvent(QShowEvent *event); - virtual void activateWidgets(); - virtual void deactivateAndResetWidgets(); MLayout * layout; MGridLayoutPolicy * landscape;
Make the genericPage methods activate and deactivate widgets public instead of protected. Signed-off-by: Michael Demeter <[email protected]>
apache-2.0
lbt/meego-handset-dialer,lbt/meego-handset-dialer,lbt/meego-handset-dialer,lbt/meego-handset-dialer
abeb3e3e92bd30ccd7f0d6683a97fbb9f828f75b
#include "mininode.h" #include <unistd.h> #include <fcntl.h> duk_ret_t mn_bi_fs_access(duk_context *ctx) { const int nargs = duk_get_top(ctx); const char *path = NULL; uv_fs_t *req = NULL; int mode = 0; if (nargs == 3) { mode = duk_require_int(ctx, -2); path = duk_require_string(ctx, -3); } else if (nargs == 2){ mode = F_OK; path = duk_require_string(ctx, -2); } else if (nargs < 2) { duk_pop_n(ctx, nargs); duk_push_error_object( ctx, DUK_ERR_TYPE_ERROR, "invalid arguments" ); duk_push_string(ctx, "src/modules/fs/methods/access.c"); duk_put_prop_string(ctx, -2, "fileName"); duk_push_int(ctx, 17); duk_put_prop_string(ctx, -2, "lineNumber"); duk_throw(ctx); return 1; } req = duk_push_fixed_buffer(ctx, sizeof(*req)); req->data = mn_setup_req(ctx, -2); uv_fs_access(mn_loop, req, path, mode, mn_fs_cb); if (req->result != 0) { mn_push_error_result(ctx, req); duk_throw(ctx); return 1; } else { return 0; } }
#include "mininode.h" #include <unistd.h> #include <fcntl.h> duk_ret_t mn_bi_fs_access(duk_context *ctx) { const int nargs = duk_get_top(ctx); const char *path = NULL; uv_fs_t *req = NULL; int mode = 0; if (nargs == 3) { mode = duk_require_int(ctx, -2); path = duk_require_string(ctx, -3); } else { mode = F_OK; path = duk_require_string(ctx, -2); } req = duk_push_fixed_buffer(ctx, sizeof(*req)); req->data = mn_setup_req(ctx, -2); uv_fs_access(mn_loop, req, path, mode, mn_fs_cb); if (req->result != 0) { mn_push_error_result(ctx, req); duk_throw(ctx); return 1; } else { return 0; } }
--- +++ @@ -11,11 +11,24 @@ if (nargs == 3) { mode = duk_require_int(ctx, -2); path = duk_require_string(ctx, -3); - } else { + } else if (nargs == 2){ mode = F_OK; path = duk_require_string(ctx, -2); + } else if (nargs < 2) { + duk_pop_n(ctx, nargs); + duk_push_error_object( + ctx, + DUK_ERR_TYPE_ERROR, + "invalid arguments" + ); + duk_push_string(ctx, "src/modules/fs/methods/access.c"); + duk_put_prop_string(ctx, -2, "fileName"); + duk_push_int(ctx, 17); + duk_put_prop_string(ctx, -2, "lineNumber"); + duk_throw(ctx); + return 1; } - + req = duk_push_fixed_buffer(ctx, sizeof(*req)); req->data = mn_setup_req(ctx, -2); uv_fs_access(mn_loop, req, path, mode, mn_fs_cb);
Add fileName and lineNumber properties to Error
mit
hypoalex/mininode,hypoalex/mininode,hypoalex/mininode
01145fa196b4158507dfcd7405026c2d51551c69
#include <truth/panic.h> #include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/slab.h> #include <truth/heap.h> #include <truth/physical_allocator.h> string Logo = str("\n" " _.-.\n" " .-. `) | .-.\n" " _.'`. .~./ \\.~. .`'._\n" " .-' .'.'.'.-| |-.'.'.'. '-.\n" " `'`'`'`'` \\ / `'`'`'`'`\n" " /||\\\n" " //||\\\\\n" "\n" " The Kernel of Truth\n"); void kernel_main(void *multiboot_tables) { enum status status = init_log("log"); assert(status == Ok); log(Logo); logf("\tVersion %d.%d.%d\n\tCommit %s\n\t%s\n\tCPU Time %ld\n", kernel_major, kernel_minor, kernel_patch, vcs_version, project_website, cpu_time()); init_interrupts(); init_physical_allocator(multiboot_tables); init_slab(); status = init_heap(); assert(status == Ok); halt(); }
#include <truth/panic.h> #include <truth/cpu.h> #include <truth/types.h> #include <truth/log.h> #include <truth/slab.h> #include <truth/heap.h> #include <truth/physical_allocator.h> string Logo = str("\n" " _.-.\n" " .-. `) | .-.\n" " _.'`. .~./ \\.~. .`'._\n" " .-' .'.'.'.-| |-.'.'.'. '-.\n" " `'`'`'`'` \\ / `'`'`'`'`\n" " /||\\\n" " //||\\\\\n" "\n" " The Kernel of Truth\n"); void kernel_main(void *multiboot_tables) { enum status status = init_log("log"); assert(status == Ok); log(Logo); logf("\tVersion %d.%d.%d\n\tCommit %s\n\t%s\n", kernel_major, kernel_minor, kernel_patch, vcs_version, project_website); init_interrupts(); init_physical_allocator(multiboot_tables); init_slab(); status = init_heap(); assert(status == Ok); halt(); }
--- +++ @@ -21,9 +21,9 @@ enum status status = init_log("log"); assert(status == Ok); log(Logo); - logf("\tVersion %d.%d.%d\n\tCommit %s\n\t%s\n", + logf("\tVersion %d.%d.%d\n\tCommit %s\n\t%s\n\tCPU Time %ld\n", kernel_major, kernel_minor, kernel_patch, vcs_version, - project_website); + project_website, cpu_time()); init_interrupts(); init_physical_allocator(multiboot_tables); init_slab();
Print CPU time in splash screen
mit
iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth,iankronquist/kernel-of-truth
5a3d7873993eb4c6f4e4d650e2b46b0d403fecd3
#ifndef CPR_ERROR_H #define CPR_ERROR_H #include <string> #include "cprtypes.h" #include "defines.h" namespace cpr { enum class ErrorCode { OK = 0, CONNECTION_FAILURE, EMPTY_RESPONSE, HOST_RESOLUTION_FAILURE, INTERNAL_ERROR, INVALID_URL_FORMAT, NETWORK_RECEIVE_ERROR, NETWORK_SEND_FAILURE, OPERATION_TIMEDOUT, PROXY_RESOLUTION_FAILURE, SSL_CONNECT_ERROR, SSL_LOCAL_CERTIFICATE_ERROR, SSL_REMOTE_CERTIFICATE_ERROR, SSL_CACERT_ERROR, GENERIC_SSL_ERROR, UNSUPPORTED_PROTOCOL, UNKNOWN_ERROR = 1000, }; class Error { public: Error() : code{ErrorCode::OK} {} template <typename TextType> Error(const int& curl_code, TextType&& p_error_message) : code{getErrorCodeForCurlError(curl_code)}, message{CPR_FWD(p_error_message)} {} explicit operator bool() const { return code != ErrorCode::OK; } ErrorCode code; std::string message; private: static ErrorCode getErrorCodeForCurlError(int curl_code); }; } // namespace cpr #endif
#ifndef CPR_ERROR_H #define CPR_ERROR_H #include <string> #include "cprtypes.h" #include "defines.h" namespace cpr { enum class ErrorCode { OK = 0, CONNECTION_FAILURE, EMPTY_RESPONSE, HOST_RESOLUTION_FAILURE, INTERNAL_ERROR, INVALID_URL_FORMAT, NETWORK_RECEIVE_ERROR, NETWORK_SEND_FAILURE, OPERATION_TIMEDOUT, PROXY_RESOLUTION_FAILURE, SSL_CONNECT_ERROR, SSL_LOCAL_CERTIFICATE_ERROR, SSL_REMOTE_CERTIFICATE_ERROR, SSL_CACERT_ERROR, GENERIC_SSL_ERROR, UNSUPPORTED_PROTOCOL, UNKNOWN_ERROR = 1000, }; class Error { public: Error() : code{ErrorCode::OK} {} template <typename TextType> Error(const ErrorCode& p_error_code, TextType&& p_error_message) : code{p_error_code}, message{CPR_FWD(p_error_message)} {} explicit operator bool() const { return code != ErrorCode::OK; } ErrorCode code; std::string message; private: static ErrorCode getErrorCodeForCurlError(int curl_code); }; } // namespace cpr #endif
--- +++ @@ -33,8 +33,8 @@ Error() : code{ErrorCode::OK} {} template <typename TextType> - Error(const ErrorCode& p_error_code, TextType&& p_error_message) - : code{p_error_code}, message{CPR_FWD(p_error_message)} {} + Error(const int& curl_code, TextType&& p_error_message) + : code{getErrorCodeForCurlError(curl_code)}, message{CPR_FWD(p_error_message)} {} explicit operator bool() const { return code != ErrorCode::OK;
Make constructor for taking in curl code as the first argument
mit
SuperV1234/cpr,whoshuu/cpr,whoshuu/cpr,SuperV1234/cpr,msuvajac/cpr,whoshuu/cpr,msuvajac/cpr,msuvajac/cpr,SuperV1234/cpr
21bdc56b1b94dcfc9badf80b544ac7b28155aa18
// PARAM: --enable ana.int.congruence void unsignedCase() { unsigned int top; unsigned int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! } } int main() { int top; int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! } unsignedCase(); }
// PARAM: --enable ana.int.congruence void unsignedCase() { unsigned int top; unsigned int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { assert(top%17 == 3); //UNKNOWN! } } int main() { int top; int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { i = 12; } } assert(i == 0); if(top % 3 == 17) { assert(top%17 == 3); //UNKNOWN! } unsignedCase(); }
--- +++ @@ -21,6 +21,7 @@ assert(i == 0); if(top % 3 == 17) { + // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! } } @@ -47,6 +48,7 @@ assert(i == 0); if(top % 3 == 17) { + // This is unreachable in the concrete! assert(top%17 == 3); //UNKNOWN! }
Add comments to confusing test
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
aba62b0799f87628580c92943152432e6118cedd
// RUN: %llvmgcc -S %s -o /dev/null /* * XFAIL: * */ struct s { unsigned long long u33: 33; unsigned long long u40: 40; }; struct s a = { 1, 2}; int foo() { return a.u40; }
// RUN: %llvmgcc -S %s -o /dev/null /* * XFAIL: linux */ struct s { unsigned long long u33: 33; unsigned long long u40: 40; }; struct s a = { 1, 2}; int foo() { return a.u40; }
--- +++ @@ -1,7 +1,7 @@ // RUN: %llvmgcc -S %s -o /dev/null /* - * XFAIL: linux + * XFAIL: * */ struct s { unsigned long long u33: 33;
Test fails on all platforms, not just linux git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@19405 91177308-0d34-0410-b5e6-96231b3b80d8
bsd-2-clause
dslab-epfl/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,apple/swift-llvm
b56013dda5371aa32a634bc59878f754b537f874
// PARAM: --set ana.int.interval true --set solver "'td3'" #include<pthread.h> #include<assert.h> int glob1 = 0; pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { int t; pthread_mutex_lock(&mutex1); pthread_mutex_lock(&mutex2); glob1 = 5; pthread_mutex_unlock(&mutex2); pthread_mutex_lock(&mutex2); assert(glob1 == 5); glob1 = 0; pthread_mutex_unlock(&mutex1); pthread_mutex_unlock(&mutex2); return NULL; } int main(void) { pthread_t id; assert(glob1 == 0); pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&mutex2); assert(glob1 == 0); // UNKNOWN! assert(glob1 == 5); // UNKNOWN! pthread_mutex_unlock(&mutex2); pthread_join (id, NULL); return 0; }
// PARAM: --set ana.int.interval true --set solver "'td3'" #include<pthread.h> #include<assert.h> int glob1 = 0; pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { int t; pthread_mutex_lock(&mutex1); pthread_mutex_lock(&mutex2); glob1 = 5; pthread_mutex_unlock(&mutex2); pthread_mutex_lock(&mutex2); assert(glob1 == 5); glob1 = 0; pthread_mutex_unlock(&mutex1); pthread_mutex_unlock(&mutex2); return NULL; } int main(void) { pthread_t id; assert(glob1 == 0); pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&mutex2); assert(glob1 == 0); // UNKNOWN assert(glob1 == 5); // UNKNOWN pthread_mutex_unlock(&mutex2); pthread_join (id, NULL); return 0; }
--- +++ @@ -28,8 +28,8 @@ assert(glob1 == 0); pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&mutex2); - assert(glob1 == 0); // UNKNOWN - assert(glob1 == 5); // UNKNOWN + assert(glob1 == 0); // UNKNOWN! + assert(glob1 == 5); // UNKNOWN! pthread_mutex_unlock(&mutex2); pthread_join (id, NULL); return 0;
Test 13/19: Add ! to UNKNOWN
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
884143e3d78327a81ceadff98b4190776396d6c7
#include <stdio.h> typedef struct { int hands[2][2]; int turn; } Sticks; void sticks_create(Sticks *sticks) { sticks->hands[0][0] = 1; sticks->hands[0][1] = 1; sticks->hands[1][0] = 1; sticks->hands[1][1] = 1; sticks->turn = 0; } void sticks_play(Sticks *sticks, int attack, int x, int y) { if (attack) { sticks->hands[!sticks->turn][y] += sticks->hands[sticks->turn][x]; if (sticks->hands[!sticks->turn][y] >= 5) { sticks->hands[!sticks->turn][y] = 0; } } else { int fingers = sticks->hands[sticks->turn][0] + sticks->hands[sticks->turn][1]; int desired = 2 * x + y; if (desired > fingers) desired = fingers; if (desired < fingers - 4) desired = fingers - 4; sticks->hands[sticks->turn][0] = desired; sticks->hands[sticks->turn][1] = fingers - desired; } sticks->turn = !sticks->turn; } int main(void) { Sticks sticks; sticks_create(&sticks); printf("%d\n", sticks.hands[0][0]); printf("%d\n", sticks.turn); sticks_play(&sticks, 0, 0, 0); printf("%d\n", sticks.hands[0][0]); printf("%d\n", sticks.hands[0][1]); printf("%d\n", sticks.turn); }
#include <stdio.h> typedef struct { int hands[2][2]; int turn; } Sticks; void sticks_create(Sticks *sticks) { sticks->hands[0][0] = 1; sticks->hands[0][1] = 1; sticks->hands[1][0] = 1; sticks->hands[1][1] = 1; sticks->turn = 0; } void sticks_play(Sticks *sticks, int x, int y) { sticks->hands[!sticks->turn][y] += sticks->hands[sticks->turn][x]; if (sticks->hands[!sticks->turn][y] >= 5) { sticks->hands[!sticks->turn][y] = 0; } sticks->turn = !sticks->turn; } int main(void) { Sticks sticks; sticks_create(&sticks); printf("%d\n", sticks.hands[0][0]); printf("%d\n", sticks.turn); sticks_play(&sticks, 0, 1); printf("%d\n", sticks.hands[1][1]); printf("%d\n", sticks.turn); }
--- +++ @@ -13,10 +13,19 @@ sticks->turn = 0; } -void sticks_play(Sticks *sticks, int x, int y) { - sticks->hands[!sticks->turn][y] += sticks->hands[sticks->turn][x]; - if (sticks->hands[!sticks->turn][y] >= 5) { - sticks->hands[!sticks->turn][y] = 0; +void sticks_play(Sticks *sticks, int attack, int x, int y) { + if (attack) { + sticks->hands[!sticks->turn][y] += sticks->hands[sticks->turn][x]; + if (sticks->hands[!sticks->turn][y] >= 5) { + sticks->hands[!sticks->turn][y] = 0; + } + } else { + int fingers = sticks->hands[sticks->turn][0] + sticks->hands[sticks->turn][1]; + int desired = 2 * x + y; + if (desired > fingers) desired = fingers; + if (desired < fingers - 4) desired = fingers - 4; + sticks->hands[sticks->turn][0] = desired; + sticks->hands[sticks->turn][1] = fingers - desired; } sticks->turn = !sticks->turn; } @@ -26,7 +35,8 @@ sticks_create(&sticks); printf("%d\n", sticks.hands[0][0]); printf("%d\n", sticks.turn); - sticks_play(&sticks, 0, 1); - printf("%d\n", sticks.hands[1][1]); + sticks_play(&sticks, 0, 0, 0); + printf("%d\n", sticks.hands[0][0]); + printf("%d\n", sticks.hands[0][1]); printf("%d\n", sticks.turn); }
Allow user to move fingers between own hands
mit
tysonzero/c-ann
3c2e43310c2530efe55a10c6e02b89501c373f08
/* System module interface */ #ifndef Py_SYSMODULE_H #define Py_SYSMODULE_H #ifdef __cplusplus extern "C" { #endif DL_IMPORT(PyObject *) PySys_GetObject(char *); DL_IMPORT(int) PySys_SetObject(char *, PyObject *); DL_IMPORT(FILE *) PySys_GetFile(char *, FILE *); DL_IMPORT(void) PySys_SetArgv(int, char **); DL_IMPORT(void) PySys_SetPath(char *); DL_IMPORT(void) PySys_WriteStdout(const char *format, ...); DL_IMPORT(void) PySys_WriteStderr(const char *format, ...); extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; extern DL_IMPORT(int) _PySys_CheckInterval; DL_IMPORT(void) PySys_ResetWarnOptions(void); DL_IMPORT(void) PySys_AddWarnOption(char *); #ifdef __cplusplus } #endif #endif /* !Py_SYSMODULE_H */
/* System module interface */ #ifndef Py_SYSMODULE_H #define Py_SYSMODULE_H #ifdef __cplusplus extern "C" { #endif DL_IMPORT(PyObject *) PySys_GetObject(char *); DL_IMPORT(int) PySys_SetObject(char *, PyObject *); DL_IMPORT(FILE *) PySys_GetFile(char *, FILE *); DL_IMPORT(void) PySys_SetArgv(int, char **); DL_IMPORT(void) PySys_SetPath(char *); DL_IMPORT(void) PySys_WriteStdout(const char *format, ...); DL_IMPORT(void) PySys_WriteStderr(const char *format, ...); extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; extern DL_IMPORT(int) _PySys_CheckInterval; #ifdef __cplusplus } #endif #endif /* !Py_SYSMODULE_H */
--- +++ @@ -19,6 +19,9 @@ extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; extern DL_IMPORT(int) _PySys_CheckInterval; +DL_IMPORT(void) PySys_ResetWarnOptions(void); +DL_IMPORT(void) PySys_AddWarnOption(char *); + #ifdef __cplusplus } #endif
Add declarations for PySys_ResetWarnOptions() and PySys_AddWarnOption().
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
33231a276ae9ac84ae779531e9f346fb7719a4cb
// // arch/x86_64/rsp/vmov.c // // This file is subject to the terms and conditions defined in // 'LICENSE', which is part of this source code package. // #include "common.h" #include "rsp/cpu.h" #include "rsp/rsp.h" __m128i rsp_vmov(struct rsp *rsp, unsigned src, unsigned e, unsigned dest, unsigned de) { uint16_t data; // Get the element from VT. data = rsp->cp2.regs[src].e[e]; // Write out the upper part of the result. rsp->cp2.regs[dest].e[de] = data; return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e); }
// // arch/x86_64/rsp/vmov.c // // This file is subject to the terms and conditions defined in // 'LICENSE', which is part of this source code package. // #include "common.h" #include "rsp/cpu.h" #include "rsp/rsp.h" __m128i rsp_vmov(struct rsp *rsp, unsigned src, unsigned e, unsigned dest, unsigned de) { uint16_t data; // Get the element from VT. data = rsp->cp2.div_in = rsp->cp2.regs[src].e[e]; // Write out the upper part of the result. rsp->cp2.regs[dest].e[de] = data; return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e); }
--- +++ @@ -14,7 +14,7 @@ uint16_t data; // Get the element from VT. - data = rsp->cp2.div_in = rsp->cp2.regs[src].e[e]; + data = rsp->cp2.regs[src].e[e]; // Write out the upper part of the result. rsp->cp2.regs[dest].e[de] = data;
Fix a typo in the VMOV implementation.
bsd-3-clause
tj90241/cen64,LuigiBlood/cen64,tj90241/cen64,LuigiBlood/cen64
71db9767599b54ee8f8622bee2420daf78603dcf
#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 version : 4; uint8_t ihl : 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
--- +++ @@ -9,8 +9,8 @@ #define ICMPV4 0x01 struct iphdr { + uint8_t ihl : 4; /* TODO: Support Big Endian hosts */ uint8_t version : 4; - uint8_t ihl : 4; uint8_t tos; uint16_t len; uint16_t id;
Swap fields in IPv4 header because of little endianness This should be handled more gracefully. Now, little endian byte order is assumed.
mit
saminiir/level-ip,saminiir/level-ip
8993b1ede652b3c81b1cae873a00716b3dd8545d
#pragma once #include "rapidcheck/seq/Operations.h" namespace rc { namespace test { //! Forwards Seq a random amount and copies it to see if it is equal to the //! original. Must not be infinite, of course. template<typename T> void assertEqualCopies(Seq<T> seq) { std::size_t len = seq::length(seq); std::size_t n = *gen::ranged<std::size_t>(0, len * 2); while (n--) seq.next(); const auto copy = seq; RC_ASSERT(copy == seq); } } // namespace test } // namespace rc
#pragma once #include "rapidcheck/seq/Operations.h" namespace rc { namespace test { //! Forwards Seq a random amount and copies it to see if it is equal to the //! original. template<typename T> void assertEqualCopies(Seq<T> seq) { std::size_t len = seq::length(seq); std::size_t n = *gen::ranged<std::size_t>(0, len * 2); while (n--) seq.next(); const auto copy = seq; RC_ASSERT(copy == seq); } } // namespace test } // namespace rc
--- +++ @@ -6,7 +6,7 @@ namespace test { //! Forwards Seq a random amount and copies it to see if it is equal to the -//! original. +//! original. Must not be infinite, of course. template<typename T> void assertEqualCopies(Seq<T> seq) {
Add clarifying comment for assertEqualCopies
bsd-2-clause
whoshuu/rapidcheck,tm604/rapidcheck,whoshuu/rapidcheck,emil-e/rapidcheck,tm604/rapidcheck,emil-e/rapidcheck,unapiedra/rapidfuzz,emil-e/rapidcheck,whoshuu/rapidcheck,tm604/rapidcheck,unapiedra/rapidfuzz,unapiedra/rapidfuzz
1e0998cf1d80b72eafd1639c839c86ac6f38a6ef
#include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include <glib.h> static void main_window_destroy(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType modifier, gpointer user_data) { gtk_widget_destroy(GTK_WIDGET(user_data)); } void main_window_bind_keys(GtkWidget *window) { GtkAccelGroup *group = gtk_accel_group_new(); GClosure *closure = g_cclosure_new(G_CALLBACK(main_window_destroy), window, NULL); gtk_accel_group_connect(group, GDK_KEY_q, GDK_CONTROL_MASK, 0, closure); gtk_window_add_accel_group(GTK_WINDOW(window), group); } GtkWidget * main_window_create() { GtkWidget *window; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "ghighlighter"); main_window_bind_keys(window); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); return window; }
#include <gtk/gtk.h> GtkWidget * main_window_create() { GtkWidget *window; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "ghighlighter"); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); return window; }
--- +++ @@ -1,4 +1,24 @@ #include <gtk/gtk.h> +#include <gdk/gdkkeysyms.h> +#include <glib.h> + +static void +main_window_destroy(GtkAccelGroup *group, GObject *acceleratable, + guint keyval, GdkModifierType modifier, gpointer user_data) +{ + gtk_widget_destroy(GTK_WIDGET(user_data)); +} + +void +main_window_bind_keys(GtkWidget *window) +{ + GtkAccelGroup *group = gtk_accel_group_new(); + + GClosure *closure = g_cclosure_new(G_CALLBACK(main_window_destroy), window, NULL); + gtk_accel_group_connect(group, GDK_KEY_q, GDK_CONTROL_MASK, 0, closure); + + gtk_window_add_accel_group(GTK_WINDOW(window), group); +} GtkWidget * main_window_create() @@ -8,6 +28,8 @@ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "ghighlighter"); + main_window_bind_keys(window); + g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); return window;
Destroy main window on Ctrl+q
mit
chdorner/ghighlighter-c
0daebd485c02840729740949caa429efd5cf0153
#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H #define SSPAPPLICATION_GAMESTATES_MENUSTATE_H #include "GameState.h" #include "../GraphicsDLL/GraphicsComponent.h" class MenuState : public GameState { private: const static int m_NR_OF_MENU_ITEMS = 2; UIComponent* m_uiComps[NR_OF_MENU_ITEMS]; TextComponent* m_textComps[NR_OF_MENU_ITEMS]; public: MenuState(); ~MenuState(); int ShutDown(); int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler); int Update(float dt, InputHandler * inputHandler); private: }; #endif
#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H #define SSPAPPLICATION_GAMESTATES_MENUSTATE_H #include "GameState.h" class MenuState : public GameState { private: public: MenuState(); ~MenuState(); int ShutDown(); int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler); int Update(float dt, InputHandler * inputHandler); private: }; #endif
--- +++ @@ -1,10 +1,14 @@ #ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H #define SSPAPPLICATION_GAMESTATES_MENUSTATE_H #include "GameState.h" +#include "../GraphicsDLL/GraphicsComponent.h" class MenuState : public GameState { private: + const static int m_NR_OF_MENU_ITEMS = 2; + UIComponent* m_uiComps[NR_OF_MENU_ITEMS]; + TextComponent* m_textComps[NR_OF_MENU_ITEMS]; public: MenuState(); ~MenuState();
ADD ui and text comps to menustate
apache-2.0
Chringo/SSP,Chringo/SSP
acd4d69243c48f9bbff625d269b337eed0c47f24
#ifndef __POSIX_SIGNAL_SIGTABLES_H typedef struct { int signal; char *name; } Signal; typedef struct { int len; int items[]; } SignalVector; MODULE_SCOPE const Signal signals[]; MODULE_SCOPE const int nsigs; MODULE_SCOPE int max_signum; #define SIGOFFSET(SIG) ((SIG) - 1) void InitSignalTables (void); SignalVector* CreateSignalVector (void); void FreeSignalVector( SignalVector *svPtr ); int GetSignalIdFromObj ( Tcl_Interp *interp, Tcl_Obj *nameObj ); #define __POSIX_SIGNAL_SIGTABLES_H #endif /* __POSIX_SIGNAL_SIGTABLES_H */ /* vim: set ts=8 sts=4 sw=4 sts=4 noet: */
#ifndef __POSIX_SIGNAL_SIGTABLES_H typedef struct { int signal; char *name; } Signal; typedef struct { int len; int items[]; } SignalVector; extern const Signal signals[]; extern const int nsigs; extern int max_signum; #define SIGOFFSET(SIG) ((SIG) - 1) void InitSignalTables (void); SignalVector* CreateSignalVector (void); void FreeSignalVector( SignalVector *svPtr ); int GetSignalIdFromObj ( Tcl_Interp *interp, Tcl_Obj *nameObj ); #define __POSIX_SIGNAL_SIGTABLES_H #endif /* __POSIX_SIGNAL_SIGTABLES_H */ /* vim: set ts=8 sts=4 sw=4 sts=4 noet: */
--- +++ @@ -10,10 +10,10 @@ int items[]; } SignalVector; -extern const Signal signals[]; -extern const int nsigs; +MODULE_SCOPE const Signal signals[]; +MODULE_SCOPE const int nsigs; -extern int max_signum; +MODULE_SCOPE int max_signum; #define SIGOFFSET(SIG) ((SIG) - 1)
Hide global data symbols related to signal tables 'extern' decls for "signals", "nsigs" and "max_signum" changed to 'MODULE_SCOPE' in unix/sigtables.h to remove it from the symbol table of the generated shared object file.
mit
kostix/posix-signal
f0898d02f76cbd77206b6ef278b1da9721b7cd3d
// // MustacheToken.h // OCMustache // // Created by Wesley Moore on 31/10/10. // Copyright 2010 Wesley Moore. All rights reserved. // #import <Foundation/Foundation.h> enum mustache_token_type { mustache_token_type_etag = 1, // Escaped tag mustache_token_type_utag, // Unescaped tag mustache_token_type_section, mustache_token_type_inverted, mustache_token_type_static, // Static text mustache_token_type_partial }; @interface MustacheToken : NSObject { enum mustache_token_type type; const char *content; NSUInteger content_length; } @property(nonatomic, assign) enum mustache_token_type type; @property(nonatomic, assign) const char *content; @property(nonatomic, assign) NSUInteger contentLength; - (id)initWithType:(enum mustache_token_type)token_type content:(const char *)content contentLength:(NSUInteger)length; - (NSString *)contentString; @end
// // MustacheToken.h // OCMustache // // Created by Wesley Moore on 31/10/10. // Copyright 2010 Wesley Moore. All rights reserved. // #import <Foundation/Foundation.h> enum mustache_token_type { mustache_token_type_etag = 1, // Escaped tag mustache_token_type_utag, // Unescaped tag mustache_token_type_section, mustache_token_type_inverted, mustache_token_type_static, // Static text mustache_token_type_partial }; @interface MustacheToken : NSObject { enum mustache_token_type type; const char *content; NSUInteger content_length; } @property(nonatomic, assign) enum mustache_token_type type; @property(nonatomic, assign) const char *content; @property(nonatomic, assign) size_t contentLength; - (id)initWithType:(enum mustache_token_type)token_type content:(const char *)content contentLength:(NSUInteger)length; - (NSString *)contentString; @end
--- +++ @@ -25,7 +25,7 @@ @property(nonatomic, assign) enum mustache_token_type type; @property(nonatomic, assign) const char *content; -@property(nonatomic, assign) size_t contentLength; +@property(nonatomic, assign) NSUInteger contentLength; - (id)initWithType:(enum mustache_token_type)token_type content:(const char *)content contentLength:(NSUInteger)length; - (NSString *)contentString;
Fix type mismatch between property and ivar
bsd-3-clause
wezm/OCMustache,wezm/OCMustache
e36c3d63728197449d4e555823d7d07db16e2c3a
// REQUIRES: x86_64-linux // RUN: %host_cc -O0 -g %s -o %t 2>&1 // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s // // See PR31870 for more details on the XFAIL // XFAIL: avr #include <stdio.h> int inc(int a) { return a + 1; } int main() { printf("%p\n", inc); return 0; } // CHECK: inc // CHECK: print_context.c:7 // CHECK: 5 : #include // CHECK: 6 : // CHECK: 7 >: int inc // CHECK: 8 : return // CHECK: 9 : }
// REQUIRES: x86_64-linux // RUN: %host_cc -O0 -g %s -o %t 2>&1 // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s #include <stdio.h> int inc(int a) { return a + 1; } int main() { printf("%p\n", inc); return 0; } // CHECK: inc // CHECK: print_context.c:7 // CHECK: 5 : #include // CHECK: 6 : // CHECK: 7 >: int inc // CHECK: 8 : return // CHECK: 9 : }
--- +++ @@ -1,6 +1,9 @@ // REQUIRES: x86_64-linux // RUN: %host_cc -O0 -g %s -o %t 2>&1 // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s +// +// See PR31870 for more details on the XFAIL +// XFAIL: avr #include <stdio.h>
[AVR] Mark a failing symbolizer test as XFAIL git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@309512 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm
588c5e4b6f5fa8e45811d3f4e95d3b94f8f58341
// RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \ // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ // RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s // // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \ // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ // RUN: -fmodules-local-submodule-visibility \ // RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s #include "DebugSubmoduleA.h" #include "DebugSubmoduleB.h" // CHECK: !DICompileUnit // CHECK-NOT: !DICompileUnit // CHECK: !DIModule(scope: ![[PARENT:.*]], name: "DebugSubmoduleA" // CHECK: [[PARENT]] = !DIModule(scope: null, name: "DebugSubmodules" // CHECK: !DIModule(scope: ![[PARENT]], name: "DebugSubmoduleB" // CHECK: !DICompileUnit({{.*}}splitDebugFilename: {{.*}}DebugSubmodules // CHECK-SAME: dwoId: // CHECK-NOT: !DICompileUnit
// RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \ // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ // RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s #include "DebugSubmoduleA.h" #include "DebugSubmoduleB.h" // CHECK: !DICompileUnit // CHECK-NOT: !DICompileUnit // CHECK: !DIModule(scope: ![[PARENT:.*]], name: "DebugSubmoduleA" // CHECK: [[PARENT]] = !DIModule(scope: null, name: "DebugSubmodules" // CHECK: !DIModule(scope: ![[PARENT]], name: "DebugSubmoduleB" // CHECK: !DICompileUnit({{.*}}splitDebugFilename: {{.*}}DebugSubmodules // CHECK-SAME: dwoId: // CHECK-NOT: !DICompileUnit
--- +++ @@ -1,6 +1,11 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \ // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ +// RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s +// +// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \ +// RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ +// RUN: -fmodules-local-submodule-visibility \ // RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s #include "DebugSubmoduleA.h" #include "DebugSubmoduleB.h"
Add a test that local submodule visibility has no effect on debug info rdar://problem/27876262 git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@302809 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/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
5dcd7a8c429aa6f7d26cb8dfce62e4a793a6d9b5
#ifndef TIMEOUT_QUEUE_H #define TIMEOUT_QUEUE_H #include <map> #include <common/time/time.h> class TimeoutQueue { typedef std::map<NanoTime, CallbackQueue> timeout_map_t; LogHandle log_; timeout_map_t timeout_queue_; public: TimeoutQueue(void) : log_("/event/timeout/queue"), timeout_queue_() { } ~TimeoutQueue() { } bool empty(void) const { timeout_map_t::const_iterator it; /* * Since we allow elements within each CallbackQueue to be * cancelled, we must scan them. * * XXX * We really shouldn't allow this, even if it means we have * to specialize CallbackQueue for this purpose or add * virtual methods to it. As it is, we can return true * for empty and for ready at the same time. And in those * cases we have to call perform to garbage collect the * unused CallbackQueues. We'll, quite conveniently, * never make that call. Yikes. */ for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) { if (it->second.empty()) continue; return (false); } return (true); } Action *append(uintmax_t, SimpleCallback *); uintmax_t interval(void) const; void perform(void); bool ready(void) const; }; #endif /* !TIMEOUT_QUEUE_H */
#ifndef TIMEOUT_QUEUE_H #define TIMEOUT_QUEUE_H #include <map> class TimeoutQueue { typedef std::map<NanoTime, CallbackQueue> timeout_map_t; LogHandle log_; timeout_map_t timeout_queue_; public: TimeoutQueue(void) : log_("/event/timeout/queue"), timeout_queue_() { } ~TimeoutQueue() { } bool empty(void) const { timeout_map_t::const_iterator it; /* * Since we allow elements within each CallbackQueue to be * cancelled, we must scan them. * * XXX * We really shouldn't allow this, even if it means we have * to specialize CallbackQueue for this purpose or add * virtual methods to it. As it is, we can return true * for empty and for ready at the same time. And in those * cases we have to call perform to garbage collect the * unused CallbackQueues. We'll, quite conveniently, * never make that call. Yikes. */ for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) { if (it->second.empty()) continue; return (false); } return (true); } Action *append(uintmax_t, SimpleCallback *); uintmax_t interval(void) const; void perform(void); bool ready(void) const; }; #endif /* !TIMEOUT_QUEUE_H */
--- +++ @@ -2,6 +2,8 @@ #define TIMEOUT_QUEUE_H #include <map> + +#include <common/time/time.h> class TimeoutQueue { typedef std::map<NanoTime, CallbackQueue> timeout_map_t;
Use new NanoTime location header, oops.
bsd-2-clause
wanproxy/wanproxy,wanproxy/wanproxy,wanproxy/wanproxy
fae7949017389ee7c127883fdfcd3672f98e2fc3
// // MRHexKeyboard.h // // Created by Mikk Rätsep on 02/10/13. // Copyright (c) 2013 Mikk Rätsep. All rights reserved. // #import <UIKit/UIKit.h> @interface MRHexKeyboard : UIView <UITextFieldDelegate> @property(nonatomic, assign) CGFloat height; @property(nonatomic, assign) BOOL display0xButton; @property(nonatomic, assign) BOOL add0x; @end
// // MRHexKeyboard.h // // Created by Mikk Rätsep on 02/10/13. // Copyright (c) 2013 Mikk Rätsep. All rights reserved. // @import UIKit; @interface MRHexKeyboard : UIView <UITextFieldDelegate> @property(nonatomic, assign) CGFloat height; @property(nonatomic, assign) BOOL display0xButton; @property(nonatomic, assign) BOOL add0x; @end
--- +++ @@ -5,7 +5,7 @@ // Copyright (c) 2013 Mikk Rätsep. All rights reserved. // -@import UIKit; +#import <UIKit/UIKit.h> @interface MRHexKeyboard : UIView <UITextFieldDelegate>
Switch to importing framework header Some Apps may not use modules
mit
doofyus/HexKeyboard
8da70953568e44c46d7aebeea3147c029135a824
/* Copyright (C) 2012-2013 Zeex * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <time.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> time_t timer_clock(void) { LARGE_INTEGER freq, count; if (!QueryPerformanceFrequency(&freq)) { return 0; } if (!QueryPerformanceCounter(&count)) { return 0; } return (time_t)(1000.0L / freq.QuadPart * count.QuadPart);; }
/* Copyright (C) 2012-2013 Zeex * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <time.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> time_t timer_clock(void) { return GetTickCount(); }
--- +++ @@ -18,5 +18,15 @@ #include <windows.h> time_t timer_clock(void) { - return GetTickCount(); + LARGE_INTEGER freq, count; + + if (!QueryPerformanceFrequency(&freq)) { + return 0; + } + + if (!QueryPerformanceCounter(&count)) { + return 0; + } + + return (time_t)(1000.0L / freq.QuadPart * count.QuadPart);; }
Use QueryPerformanceCounter() timer instead of GetTickCount() GetTickCount() has poor resolution according to MSDN docs (from 10 to 16 ms).
apache-2.0
WopsS/sampgdk,Zeex/sampgdk,Zeex/sampgdk,WopsS/sampgdk,Zeex/sampgdk,WopsS/sampgdk
274937d4b721bb1162598610a3635ea67728c116
/* 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; }
/* 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; }
--- +++ @@ -18,6 +18,8 @@ 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);
CLOSE: Synchronize the mailbox after expunging messages to actually get them expunged. --HG-- branch : HEAD
mit
dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot
9a3831ff69c0f341416b38bab7d9f27ebbda2304
/* * context_del.c -- delete an entry from the context/profile list * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ #include <h/mh.h> #include <h/utils.h> /* * Delete a key/value pair from the context/profile list. * Return 0 if key is found, else return 1. */ int context_del (char *key) { struct node *np, *pp; for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) { if (!strcasecmp (np->n_name ? np->n_name : "", key ? key : "")) { if (!np->n_context) admonish (NULL, "bug: context_del(key=\"%s\")", np->n_name); if (pp) pp->n_next = np->n_next; else m_defs = np->n_next; free (np->n_name); mh_xfree(np->n_field); free ((char *) np); ctxflags |= CTXMOD; return 0; } } return 1; }
/* * context_del.c -- delete an entry from the context/profile list * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ #include <h/mh.h> /* * Delete a key/value pair from the context/profile list. * Return 0 if key is found, else return 1. */ int context_del (char *key) { struct node *np, *pp; for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) { if (!strcasecmp (np->n_name ? np->n_name : "", key ? key : "")) { if (!np->n_context) admonish (NULL, "bug: context_del(key=\"%s\")", np->n_name); if (pp) pp->n_next = np->n_next; else m_defs = np->n_next; free (np->n_name); if (np->n_field) free (np->n_field); free ((char *) np); ctxflags |= CTXMOD; return 0; } } return 1; }
--- +++ @@ -8,6 +8,7 @@ */ #include <h/mh.h> +#include <h/utils.h> /* * Delete a key/value pair from the context/profile list. @@ -28,8 +29,7 @@ else m_defs = np->n_next; free (np->n_name); - if (np->n_field) - free (np->n_field); + mh_xfree(np->n_field); free ((char *) np); ctxflags |= CTXMOD; return 0;
Replace `if (p) free(p)' with `mh_xfree(p)'.
bsd-3-clause
mcr/nmh,mcr/nmh
6420adb9d93a17d3d16ae17bb67b012273fa0e8d
//Trie data structure testing //All code written my Nathaniel Thompson #include <stdio.h> #include <stdlib.h> //trie structure typedef struct _trie{ char letter; //the letter that the node holds struct _trie *next[26];//pointers to the rest of the letters }trie; //fucntion prototypes void initialize(trie *); //main function int main(void) { int i=0; trie *root=malloc(sizeof(trie)); //this is the root of the tree root->letter=0;//it doesn't contain a letter initialize(root); for(i=0;i<26;i++) { printf("%c",root->next[i]->letter); } } void initialize(trie *root) { int i; int j; for(i=0;i<26;i++) //initialize all of the letters { root->next[i]=malloc(sizeof(trie)); // get memory for each letter root->next[i]->letter='a'+i; //give the letters the proper values for(j=0;j<26;j++) root->next[i]->next[j]=NULL; //Set all the letters pointers to null } printf("good fucntion call\n"); }
//Trie data structure testing //All code written my Nathaniel Thompson #include <stdio.h> #include <stdlib.h> //trie structure typedef struct _trie { char letter; //the letter that the node holds _trie *next[26];//pointers to the rest of the letters }trie; //main function int main(void) { }
--- +++ @@ -5,14 +5,40 @@ #include <stdlib.h> //trie structure -typedef struct _trie -{ +typedef struct _trie{ char letter; //the letter that the node holds - _trie *next[26];//pointers to the rest of the letters + struct _trie *next[26];//pointers to the rest of the letters }trie; + +//fucntion prototypes +void initialize(trie *); //main function int main(void) { + int i=0; + trie *root=malloc(sizeof(trie)); //this is the root of the tree + root->letter=0;//it doesn't contain a letter + initialize(root); + + for(i=0;i<26;i++) + { + printf("%c",root->next[i]->letter); + } + + +} +void initialize(trie *root) +{ + int i; + int j; + for(i=0;i<26;i++) //initialize all of the letters + { + root->next[i]=malloc(sizeof(trie)); // get memory for each letter + root->next[i]->letter='a'+i; //give the letters the proper values + for(j=0;j<26;j++) + root->next[i]->next[j]=NULL; //Set all the letters pointers to null + } + printf("good fucntion call\n"); }
Structure was properly set up, TODO Create a small dictionary load dictionary into the trie
mit
Felttrip/TrieWords
b8af68049f97718e1ecd5e86aa1bf5c7cafa8be0
#pragma once #include <QObject> #include <QQmlParserStatus> #include "qslistmodel.h" /* QSJsonListModel is a data model that combine QSListModel and QSDiffRunner * into a single class. It may take a Javascript array object as source input, * it will compare with previous input then update the model according to * the diff. */ class QSJsonListModel : public QSListModel, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged) Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged) Q_INTERFACES(QQmlParserStatus) public: explicit QSJsonListModel(QObject *parent = 0); QString keyField() const; void setKeyField(const QString &keyField); QVariantList source() const; void setSource(const QVariantList &source); QStringList fields() const; void setFields(const QStringList &roleNames); signals: void keyFieldChanged(); void sourceChanged(); void fieldsChanged(); public slots: protected: virtual void classBegin(); virtual void componentComplete(); private: void sync(); QString m_keyField; QVariantList m_source; QStringList m_fields; bool componentCompleted; };
#pragma once #include <QObject> #include <QQmlParserStatus> #include "qslistmodel.h" class QSJsonListModel : public QSListModel, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged) Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged) Q_INTERFACES(QQmlParserStatus) public: explicit QSJsonListModel(QObject *parent = 0); QString keyField() const; void setKeyField(const QString &keyField); QVariantList source() const; void setSource(const QVariantList &source); QStringList fields() const; void setFields(const QStringList &roleNames); signals: void keyFieldChanged(); void sourceChanged(); void fieldsChanged(); public slots: protected: virtual void classBegin(); virtual void componentComplete(); private: void sync(); QString m_keyField; QVariantList m_source; QStringList m_fields; bool componentCompleted; };
--- +++ @@ -3,6 +3,12 @@ #include <QObject> #include <QQmlParserStatus> #include "qslistmodel.h" + +/* QSJsonListModel is a data model that combine QSListModel and QSDiffRunner + * into a single class. It may take a Javascript array object as source input, + * it will compare with previous input then update the model according to + * the diff. + */ class QSJsonListModel : public QSListModel, public QQmlParserStatus {
Add description to QSJsonListModel in source file.
apache-2.0
benlau/qsyncable,benlau/qsyncable
9daa20c4f49febf0046ed42e0b436ad9f6956a2c
#if __has_include("RCTBridgeModule.h") #import "RCTBridgeModule.h" #else #import <React/RCTBridgeModule.h> #endif @interface RNI18n : NSObject <RCTBridgeModule> @end
#import <React/RCTBridgeModule.h> @interface RNI18n : NSObject <RCTBridgeModule> @end
--- +++ @@ -1,4 +1,8 @@ +#if __has_include("RCTBridgeModule.h") +#import "RCTBridgeModule.h" +#else #import <React/RCTBridgeModule.h> +#endif @interface RNI18n : NSObject <RCTBridgeModule> @end
Add support for react-native < 0.40
mit
AlexanderZaytsev/react-native-i18n,AlexanderZaytsev/react-native-i18n,AlexanderZaytsev/react-native-i18n,AlexanderZaytsev/react-native-i18n
56259f7f61084eabd4dc2d3d6cb3ea4cc161320f
#include <string.h> #include "c4-internal.h" void * ol_alloc(apr_size_t sz) { void *result = malloc(sz); if (result == NULL) FAIL(); return result; } void * ol_alloc0(apr_size_t sz) { void *result = ol_alloc(sz); memset(result, 0, sz); return result; } void * ol_realloc(void *ptr, apr_size_t sz) { void *result = realloc(ptr, sz); if (result == NULL) FAIL(); return result; } void ol_free(void *ptr) { free(ptr); } char * ol_strdup(const char *str) { size_t len = strlen(str) + 1; char *result; result = ol_alloc(len); memcpy(result, str, len); return result; } apr_pool_t * make_subpool(apr_pool_t *parent) { apr_status_t s; apr_pool_t *pool; s = apr_pool_create(&pool, parent); if (s != APR_SUCCESS) FAIL_APR(s); return pool; }
#include <string.h> #include "c4-internal.h" void * ol_alloc(apr_size_t sz) { void *result = malloc(sz); if (result == NULL) FAIL(); return result; } void * ol_alloc0(apr_size_t sz) { void *result = ol_alloc(sz); memset(result, 0, sz); return result; } void * ol_realloc(void *ptr, apr_size_t sz) { void *result = realloc(ptr, sz); if (result == NULL) FAIL(); return result; } void ol_free(void *ptr) { free(ptr); } char * ol_strdup(const char *str) { size_t len = strlen(str) + 1; char *result; result = ol_alloc(len); memcpy(result, str, len); return result; } apr_pool_t * make_subpool(apr_pool_t *parent) { apr_status_t s; apr_pool_t *pool; s = apr_pool_create(&pool, parent); if (s != APR_SUCCESS) FAIL(); return pool; }
--- +++ @@ -54,7 +54,7 @@ s = apr_pool_create(&pool, parent); if (s != APR_SUCCESS) - FAIL(); + FAIL_APR(s); return pool; }
Use FAIL_APR() rather than FAIL() in create_subpool().
mit
bloom-lang/c4,bloom-lang/c4,bloom-lang/c4
6f39bf9df903d2c150f1e2590211a91e7277c748
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __GFS2_IOCTL_DOT_H__ #define __GFS2_IOCTL_DOT_H__ #define _GFS2C_(x) (('G' << 16) | ('2' << 8) | (x)) /* Ioctls implemented */ #define GFS2_IOCTL_SETFLAGS _GFS2C_(3) #define GFS2_IOCTL_GETFLAGS _GFS2C_(4) #endif /* ___GFS2_IOCTL_DOT_H__ */
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __GFS2_IOCTL_DOT_H__ #define __GFS2_IOCTL_DOT_H__ #define _GFS2C_(x) (('G' << 16) | ('2' << 8) | (x)) /* Ioctls implemented */ #define GFS2_IOCTL_IDENTIFY _GFS2C_(1) #define GFS2_IOCTL_SUPER _GFS2C_(2) #define GFS2_IOCTL_SETFLAGS _GFS2C_(3) #define GFS2_IOCTL_GETFLAGS _GFS2C_(4) struct gfs2_ioctl { unsigned int gi_argc; const char **gi_argv; char __user *gi_data; unsigned int gi_size; uint64_t gi_offset; }; #endif /* ___GFS2_IOCTL_DOT_H__ */
--- +++ @@ -14,19 +14,8 @@ /* Ioctls implemented */ -#define GFS2_IOCTL_IDENTIFY _GFS2C_(1) -#define GFS2_IOCTL_SUPER _GFS2C_(2) #define GFS2_IOCTL_SETFLAGS _GFS2C_(3) #define GFS2_IOCTL_GETFLAGS _GFS2C_(4) -struct gfs2_ioctl { - unsigned int gi_argc; - const char **gi_argv; - - char __user *gi_data; - unsigned int gi_size; - uint64_t gi_offset; -}; - #endif /* ___GFS2_IOCTL_DOT_H__ */
[GFS2] Remove unused ioctls and unused structure Signed-off-by: David Teigland <[email protected]> Signed-off-by: Steven Whitehouse <[email protected]>
apache-2.0
TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas
cd1344fe322cd9d95b2c0f011d6766677cfcb29b
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_ #define CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_ #include <string> #include <vector> #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/strings/string_split.h" #include "content/common/content_export.h" namespace content { struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { typedef base::StringPairs HeadersVector; CONTENT_EXPORT ResourceDevToolsInfo(); int32 http_status_code; std::string http_status_text; HeadersVector request_headers; HeadersVector response_headers; std::string request_headers_text; std::string response_headers_text; private: friend class base::RefCounted<ResourceDevToolsInfo>; CONTENT_EXPORT ~ResourceDevToolsInfo(); }; } // namespace content #endif // CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_ #define CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_ #include <string> #include <vector> #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "content/common/content_export.h" namespace content { struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { typedef std::vector<std::pair<std::string, std::string> > HeadersVector; CONTENT_EXPORT ResourceDevToolsInfo(); int32 http_status_code; std::string http_status_text; HeadersVector request_headers; HeadersVector response_headers; std::string request_headers_text; std::string response_headers_text; private: friend class base::RefCounted<ResourceDevToolsInfo>; CONTENT_EXPORT ~ResourceDevToolsInfo(); }; } // namespace content #endif // CONTENT_COMMON_RESOURCE_DEVTOOLS_INFO_H_
--- +++ @@ -10,13 +10,13 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "base/strings/string_split.h" #include "content/common/content_export.h" namespace content { struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { - typedef std::vector<std::pair<std::string, std::string> > - HeadersVector; + typedef base::StringPairs HeadersVector; CONTENT_EXPORT ResourceDevToolsInfo();
Use base::StringPairs where appropriate from /content Because base/strings/string_split.h defines: typedef std::vector<std::pair<std::string, std::string> > StringPairs; BUG=412250 Review URL: https://codereview.chromium.org/600163003 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#296649}
bsd-3-clause
hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,dednal/chromium.src,ltilve/chromium,dednal/chromium.src,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,dednal/chromium.src,M4sse/chromium.src,ltilve/chromium,markYoungH/chromium.src,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,fujunwei/chromium-crosswalk,Jonekee/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,Fireblend/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,markYoungH/chromium.src,markYoungH/chromium.src,Chilledheart/chromium,krieger-od/nwjs_chromium.src,jaruba/chromium.src,Chilledheart/chromium,fujunwei/chromium-crosswalk,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,fujunwei/chromium-crosswalk,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,ltilve/chromium,hgl888/chromium-crosswalk,markYoungH/chromium.src,Chilledheart/chromium,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,M4sse/chromium.src,M4sse/chromium.src,dednal/chromium.src,Just-D/chromium-1,Just-D/chromium-1,M4sse/chromium.src,Chilledheart/chromium,dushu1203/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,Fireblend/chromium-crosswalk,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,Jonekee/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,dednal/chromium.src,krieger-od/nwjs_chromium.src,fujunwei/chromium-crosswalk,markYoungH/chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dednal/chromium.src,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,Chilledheart/chromium,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,dednal/chromium.src,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,Chilledheart/chromium,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Fireblend/chromium-crosswalk,Just-D/chromium-1,jaruba/chromium.src,ltilve/chromium,ltilve/chromium,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,Chilledheart/chromium,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,krieger-od/nwjs_chromium.src,dednal/chromium.src,jaruba/chromium.src,Fireblend/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk,jaruba/chromium.src,hgl888/chromium-crosswalk,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,dushu1203/chromium.src,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,M4sse/chromium.src,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,markYoungH/chromium.src,chuan9/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk
542c416be33f1cc748530f20db2025f43f490b30
#ifndef MIAOW_SIAGEN_H #define MIAOW_SIAGEN_H #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <string> #include "asm.h" #include "helper.h" #define MAX_INSTR 1000 #define MAX_OPS 50 #define INSTR_TYPES 4 #define SCALAR_ALU 0 #define VECTOR_ALU 1 #define SCALAR_MEM 2 #define VECTOR_MEM 3 typedef void(*instr_function)(int); typedef struct _instr { int opcode; std::string op_str; } Instr; typedef struct _instr_sel { enum si_fmt_enum instr_type; Instr instr; instr_function instr_func; } Instr_Sel; void initializeInstrArr(int *arr, int array_size); void printInstrsInArray(int arr[MAX_INSTR]); void printAllUnitTests(); #endif
#ifndef MIAOW_SIAGEN_H #define MIAOW_SIAGEN_H #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include "asm.h" #include "helper.h" #define MAX_INSTR 1000 #define MAX_OPS 50 #define INSTR_TYPES 4 #define SCALAR_ALU 0 #define VECTOR_ALU 1 #define SCALAR_MEM 2 #define VECTOR_MEM 3 typedef void(*instr_function)(int); typedef struct _instr { int opcode; char op_str[30]; } Instr; typedef struct _instr_sel { enum si_fmt_enum instr_type; Instr instr; instr_function instr_func; } Instr_Sel; void initializeInstrArr(int *arr, int array_size); void printInstrsInArray(int arr[MAX_INSTR]); void printAllUnitTests(); #endif
--- +++ @@ -5,6 +5,7 @@ #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> +#include <string> #include "asm.h" #include "helper.h" @@ -23,7 +24,7 @@ typedef struct _instr { int opcode; - char op_str[30]; + std::string op_str; } Instr; typedef struct _instr_sel
Fix build on Linux where gcc apparently enforces character arrays as arrays for initialization purposes.
bsd-3-clause
VerticalResearchGroup/miaow,VerticalResearchGroup/miaow,VerticalResearchGroup/miaow,VerticalResearchGroup/miaow
4ba9ea887633b3783bd86aae9da2a35bcd25bffd
@import Foundation; #import <VENCore/VENCreateTransactionRequest.h> #import <VENCore/VENHTTP.h> #import <VENCore/VENHTTPResponse.h> #import <VENCore/VENTransaction.h> #import <VENCore/VENTransactionTarget.h> #import <VENCore/VENUser.h> #import <VENCore/NSArray+VENCore.h> #import <VENCore/NSDictionary+VENCore.h> #import <VENCore/NSError+VENCore.h> #import <VENCore/NSString+VENCore.h> #import <VENCore/UIDevice+VENCore.h> extern NSString *const VENErrorDomainCore; typedef NS_ENUM(NSInteger, VENCoreErrorCode) { VENCoreErrorCodeNoDefaultCore, VENCoreErrorCodeNoAccessToken }; @interface VENCore : NSObject @property (strong, nonatomic) VENHTTP *httpClient; @property (strong, nonatomic) NSString *accessToken; /** * Sets the shared core object. * @param core The core object to share. */ + (void)setDefaultCore:(VENCore *)core; /** * Returns the shared core object. * @return A VENCore object. */ + (instancetype)defaultCore; /** * Sets the core object's access token. */ - (void)setAccessToken:(NSString *)accessToken; @end
@import Foundation; #import <VENCore/VENCreateTransactionRequest.h> #import <VENCore/VENHTTP.h> #import <VENCore/VENHTTPResponse.h> #import <VENCore/VENTransaction.h> #import <VENCore/VENTransactionTarget.h> #import <VENCore/VENUser.h> extern NSString *const VENErrorDomainCore; typedef NS_ENUM(NSInteger, VENCoreErrorCode) { VENCoreErrorCodeNoDefaultCore, VENCoreErrorCodeNoAccessToken }; @interface VENCore : NSObject @property (strong, nonatomic) VENHTTP *httpClient; @property (strong, nonatomic) NSString *accessToken; /** * Sets the shared core object. * @param core The core object to share. */ + (void)setDefaultCore:(VENCore *)core; /** * Returns the shared core object. * @return A VENCore object. */ + (instancetype)defaultCore; /** * Sets the core object's access token. */ - (void)setAccessToken:(NSString *)accessToken; @end
--- +++ @@ -6,6 +6,11 @@ #import <VENCore/VENTransaction.h> #import <VENCore/VENTransactionTarget.h> #import <VENCore/VENUser.h> +#import <VENCore/NSArray+VENCore.h> +#import <VENCore/NSDictionary+VENCore.h> +#import <VENCore/NSError+VENCore.h> +#import <VENCore/NSString+VENCore.h> +#import <VENCore/UIDevice+VENCore.h> extern NSString *const VENErrorDomainCore;
Add formerly private headers to the umbrella header
mit
venmo/VENCore
ffeaf8d4204a555cb95858839378f36d0c5cc69e
#pragma once #include "SDL.h" #include "Component.h" #include "Point.h" #define NUM_MOUSE_BUTTONS 5 #define CONTROLLER_JOYSTICK_DEATHZONE 8000 class Input { public: Input(); ~Input(); void Poll(const SDL_Event& e); bool IsKeyPressed(SDL_Scancode key); bool IsKeyHeld(SDL_Scancode key) const; bool IsKeyReleased(SDL_Scancode key); SDL_GameController *controller1 = nullptr; SDL_GameController *controller2 = nullptr; bool IsControllerButtonPressed(SDL_GameController* controller, SDL_GameControllerButton button); bool IsControllerButtonHeld(SDL_GameController* controller, SDL_GameControllerButton button) const; bool IsControllerButtonReleased(SDL_GameController* controller, SDL_GameControllerButton button); bool IsMouseButtonPressed(int button) const; bool IsMouseButtonHeld(int button) const; bool IsMouseButtonReleased(int button) const; float MouseX() const; float MouseY() const; Point GetMousePosition(Point& position) const; private: bool keys[SDL_NUM_SCANCODES]; bool lastKeys[SDL_NUM_SCANCODES]; bool lastControllerButtons[SDL_CONTROLLER_BUTTON_MAX]; void OpenControllers(); bool mouseButtons[NUM_MOUSE_BUTTONS]; bool lastMouseButtons[NUM_MOUSE_BUTTONS]; //Might need SDL_MouseMotionEvent instead //Point mousePosition; };
#pragma once #include "SDL.h" #include "Component.h" #include "Point.h" #define NUM_MOUSE_BUTTONS 5 #define CONTROLLER_JOYSTICK_DEATHZONE 8000 class Input { public: Input(); ~Input(); void Poll(const SDL_Event& e); bool IsKeyPressed(SDL_Scancode key); bool IsKeyHeld(SDL_Scancode key) const; bool IsKeyReleased(SDL_Scancode key); SDL_GameController *controller1 = nullptr; SDL_GameController *controller2 = nullptr; bool IsControllerButtonPressed(SDL_GameController* controller, SDL_GameControllerButton button); bool IsControllerButtonHeld(SDL_GameController* controller, SDL_GameControllerButton button) const; bool IsControllerButtonReleased(SDL_GameController* controller, SDL_GameControllerButton button); bool IsMouseButtonPressed(int button) const; bool IsMouseButtonHeld(int button) const; bool IsMouseButtonReleased(int button) const; float MouseX() const; float MouseY() const; Point GetMousePosition(Point& position) const; private: bool keys[SDL_NUM_SCANCODES]; bool lastKeys[SDL_NUM_SCANCODES]; bool lastControllerButtons[SDL_CONTROLLER_BUTTON_MAX]; void OpenControllers(); bool mouseButtons[NUM_MOUSE_BUTTONS]; bool lastMouseButtons[NUM_MOUSE_BUTTONS]; };
--- +++ @@ -43,5 +43,8 @@ bool mouseButtons[NUM_MOUSE_BUTTONS]; bool lastMouseButtons[NUM_MOUSE_BUTTONS]; + + //Might need SDL_MouseMotionEvent instead + //Point mousePosition; };
Add mousePosition as Point, now commented for reworking
mit
CollegeBart/bart-sdl-engine-e16,CollegeBart/bart-sdl-engine-e16
cf0aebe327a7086e4c31a37aaa9b91491c619681
#ifndef _ECORE_STR_H # define _ECORE_STR_H #ifdef EAPI #undef EAPI #endif #ifdef WIN32 # ifdef BUILDING_DLL # define EAPI __declspec(dllexport) # else # define EAPI __declspec(dllimport) # endif #else # ifdef __GNUC__ # if __GNUC__ >= 4 # define EAPI __attribute__ ((visibility("default"))) # else # define EAPI # endif # else # define EAPI # endif #endif /** * @file Ecore_Str.h * @brief Contains useful C string functions. */ # ifdef __cplusplus extern "C" { # endif # ifdef __sgi # define __FUNCTION__ "unknown" # ifndef __cplusplus # define inline # endif # endif /* strlcpy implementation for libc's lacking it */ EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz); #ifdef __cplusplus } #endif #endif /* _ECORE_STR_H */
#ifndef _ECORE_STR_H # define _ECORE_STR_H #ifdef EAPI #undef EAPI #endif #ifdef WIN32 # ifdef BUILDING_DLL # define EAPI __declspec(dllexport) # else # define EAPI __declspec(dllimport) # endif #else # ifdef __GNUC__ # if __GNUC__ >= 4 # define EAPI __attribute__ ((visibility("default"))) # else # define EAPI # endif # else # define EAPI # endif #endif /** * @file Ecore_Data.h * @brief Contains threading, list, hash, debugging and tree functions. */ # ifdef __cplusplus extern "C" { # endif # ifdef __sgi # define __FUNCTION__ "unknown" # ifndef __cplusplus # define inline # endif # endif /* strlcpy implementation for libc's lacking it */ EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz); #ifdef __cplusplus } #endif #endif /* _ECORE_STR_H */
--- +++ @@ -23,8 +23,8 @@ #endif /** - * @file Ecore_Data.h - * @brief Contains threading, list, hash, debugging and tree functions. + * @file Ecore_Str.h + * @brief Contains useful C string functions. */ # ifdef __cplusplus
Fix doxygen comments for new header. SVN revision: 27891
bsd-2-clause
gfriloux/ecore,gfriloux/ecore,gfriloux/ecore
9b662d66ce40ee91314cf392a73cf6991a654172
/** * @file * * @date 21.04.2016 * @author Anton Bondarev */ #ifndef TTYS_H_ #define TTYS_H_ #include <fs/idesc.h> #include <drivers/tty.h> #include <drivers/char_dev.h> struct uart; struct tty_uart { struct idesc idesc; struct tty tty; struct uart *uart; }; extern struct idesc *uart_cdev_open(struct dev_module *cdev, void *priv); #define TTYS_DEF(name, uart) \ CHAR_DEV_DEF(name, uart_cdev_open, NULL, NULL, uart) #endif /* TTYS_H_ */
/** * @file * * @date 21.04.2016 * @author Anton Bondarev */ #ifndef TTYS_H_ #define TTYS_H_ #include <fs/idesc.h> #include <drivers/tty.h> struct uart; struct tty_uart { struct idesc idesc; struct tty tty; struct uart *uart; }; #endif /* TTYS_H_ */
--- +++ @@ -10,13 +10,18 @@ #include <fs/idesc.h> #include <drivers/tty.h> +#include <drivers/char_dev.h> struct uart; - struct tty_uart { struct idesc idesc; struct tty tty; struct uart *uart; }; +extern struct idesc *uart_cdev_open(struct dev_module *cdev, void *priv); + +#define TTYS_DEF(name, uart) \ + CHAR_DEV_DEF(name, uart_cdev_open, NULL, NULL, uart) + #endif /* TTYS_H_ */
drivers: Add TTYS_DEF macro to oldfs
bsd-2-clause
embox/embox,embox/embox,embox/embox,embox/embox,embox/embox,embox/embox
47cb8d841569225b3e8e33945313709f964bd932
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef BL2_H__ #define BL2_H__ void bl2_main(void); #endif /* BL2_H__ */
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef BL2_H__ #define BL2_H__ struct entry_point_info; void bl2_main(void); struct entry_point_info *bl2_load_images(void); #endif /* BL2_H__ */
--- +++ @@ -7,9 +7,6 @@ #ifndef BL2_H__ #define BL2_H__ -struct entry_point_info; - void bl2_main(void); -struct entry_point_info *bl2_load_images(void); #endif /* BL2_H__ */
Fix MISRA rule 8.5 in common code Rule 8.5: An external object or function shall be declared once in one and only one file. Change-Id: I7c3d4ec7d3ba763fdb4600008ba10b4b93ecdfce Signed-off-by: Roberto Vargas <[email protected]>
bsd-3-clause
achingupta/arm-trusted-firmware,achingupta/arm-trusted-firmware
c28b765893ed505ac62864c9d4ce67cd4f9b9fc0
// Copyright 2014 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef MEDIA_FILE_FILE_CLOSER_H_ #define MEDIA_FILE_FILE_CLOSER_H_ #include "packager/base/logging.h" #include "packager/media/file/file.h" namespace edash_packager { namespace media { /// Used by scoped_ptr to automatically close the file when it goes out of /// scope. struct FileCloser { inline void operator()(File* file) const { if (file != NULL) { const std::string filename = file->file_name(); if (!file->Close()) { LOG(WARNING) << "Failed to close the file properly: " << filename; } } } }; } // namespace media } // namespace edash_packager #endif // MEDIA_FILE_FILE_CLOSER_H_
// Copyright 2014 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef MEDIA_FILE_FILE_CLOSER_H_ #define MEDIA_FILE_FILE_CLOSER_H_ #include "packager/base/logging.h" #include "packager/media/file/file.h" namespace edash_packager { namespace media { /// Used by scoped_ptr to automatically close the file when it goes out of /// scope. struct FileCloser { inline void operator()(File* file) const { if (file != NULL && !file->Close()) { LOG(WARNING) << "Failed to close the file properly: " << file->file_name(); } } }; } // namespace media } // namespace edash_packager #endif // MEDIA_FILE_FILE_CLOSER_H_
--- +++ @@ -17,9 +17,12 @@ /// scope. struct FileCloser { inline void operator()(File* file) const { - if (file != NULL && !file->Close()) { - LOG(WARNING) << "Failed to close the file properly: " - << file->file_name(); + if (file != NULL) { + const std::string filename = file->file_name(); + if (!file->Close()) { + LOG(WARNING) << "Failed to close the file properly: " + << filename; + } } } };
Fix a possible crash if a file fails to be closed Change-Id: I6bc806a68b81ea5bde09bada1175f257c296afcd
bsd-3-clause
nevil/edash-packager,nevil/edash-packager,nevil/edash-packager
d60cc9416f92dc9dd4e59ecc9883b77ad7acfb3f
// This file is part of nbind, copyright (C) 2014-2015 BusFaster Ltd. // Released under the MIT license, see LICENSE. #pragma once #ifdef BUILDING_NODE_EXTENSION #include "Binding.h" #define NBIND_ERR(message) nbind::Bindings::setError(message) #define NBIND_CLASS(Name) \ template<class Bound> struct BindInvoker { \ BindInvoker(); \ nbind::BindClass<Name> linkage; \ nbind::BindDefiner<Name> definer; \ }; \ static struct BindInvoker<Name> bindInvoker##Name; \ template<class Bound> BindInvoker<Bound>::BindInvoker():definer(#Name) #define method(name) definer.function(#name, &Bound::name) #define construct definer.constructor #define NBIND_INIT(moduleName) NODE_MODULE(moduleName, nbind::Bindings::initModule) #else #define NBIND_ERR(message) #endif
// This file is part of nbind, copyright (C) 2014-2015 BusFaster Ltd. // Released under the MIT license, see LICENSE. #pragma once #ifdef BUILDING_NODE_EXTENSION #include "Binding.h" #define NBIND_ERR(message) nbind::Bindings::setError(message) #define NBIND_CLASS(Name) \ template<class Bound> struct BindInvoker { \ BindInvoker(); \ nbind::BindClass<Name> linkage; \ nbind::BindDefiner<Name> definer; \ }; \ static struct BindInvoker<Name> bindInvoker##Name; \ template<class Bound> BindInvoker<Bound>::BindInvoker():definer(#Name) #define method(name) definer.function(#name, &Bound::name) #define constructor definer.constructor #define NBIND_INIT(moduleName) NODE_MODULE(moduleName, nbind::Bindings::initModule) #else #define NBIND_ERR(message) #endif
--- +++ @@ -19,7 +19,7 @@ template<class Bound> BindInvoker<Bound>::BindInvoker():definer(#Name) #define method(name) definer.function(#name, &Bound::name) -#define constructor definer.constructor +#define construct definer.constructor #define NBIND_INIT(moduleName) NODE_MODULE(moduleName, nbind::Bindings::initModule)
Fix GCC keyword conflict with simpler API.
mit
charto/nbind,charto/nbind,charto/nbind,charto/nbind,charto/nbind,charto/nbind
018638ec7f304a4acd11b881be3d02bd6af966b4
#include <string.h> #include "lib/minunit.h" #include "acacia.h" #define TEST_KEY "abcdefghijklmnopqrstuvwxyz" #define TEST_VALUE "foo_bar_baz_111" MU_TEST(test_store_fetch_simple) { struct Node *cache = cache_init(); cache_set(TEST_KEY, TEST_VALUE, cache); mu_check(strcmp(cache_get(TEST_KEY, cache), TEST_VALUE) == 0); cache_close(cache); } MU_TEST(test_store_fetch_empty_string) { struct Node *cache = cache_init(); cache_set("foo", "", cache); mu_check(strcmp(cache_get("foo", cache), "") == 0); cache_close(cache); } MU_TEST_SUITE(test_suite) { MU_RUN_TEST(test_store_fetch_simple); MU_RUN_TEST(test_store_fetch_empty_string); } int main(int argc, const char *argv[]) { MU_RUN_SUITE(test_suite); MU_REPORT(); return 0; }
#include <string.h> #include "lib/minunit.h" #include "acacia.h" //#define TEST_KEY "abcd1111" #define TEST_KEY "abcdefghijklmnopqrstuvwxyz" #define TEST_VALUE "foo_bar_baz_111" MU_TEST(test_check) { struct Node *cache = cache_init(); cache_set(TEST_KEY, TEST_VALUE, cache); mu_check(strcmp(cache_get(TEST_KEY, cache), TEST_VALUE) == 0); cache_close(cache); } MU_TEST_SUITE(test_suite) { MU_RUN_TEST(test_check); } int main(int argc, const char *argv[]) { MU_RUN_SUITE(test_suite); MU_REPORT(); return 0; }
--- +++ @@ -2,20 +2,27 @@ #include "lib/minunit.h" #include "acacia.h" -//#define TEST_KEY "abcd1111" #define TEST_KEY "abcdefghijklmnopqrstuvwxyz" #define TEST_VALUE "foo_bar_baz_111" -MU_TEST(test_check) { +MU_TEST(test_store_fetch_simple) { struct Node *cache = cache_init(); cache_set(TEST_KEY, TEST_VALUE, cache); mu_check(strcmp(cache_get(TEST_KEY, cache), TEST_VALUE) == 0); cache_close(cache); } +MU_TEST(test_store_fetch_empty_string) { + struct Node *cache = cache_init(); + cache_set("foo", "", cache); + mu_check(strcmp(cache_get("foo", cache), "") == 0); + cache_close(cache); +} + MU_TEST_SUITE(test_suite) { - MU_RUN_TEST(test_check); + MU_RUN_TEST(test_store_fetch_simple); + MU_RUN_TEST(test_store_fetch_empty_string); } int main(int argc, const char *argv[])
Add a test for caching an empty string
mit
zedr/acacia
3cfe2d2e5b57ff33d4febcb0668d1d71fce2dd21

This is a dataset built from CommitPackFT, providing ~1500 commits with diffs for several programming languages:

  • Python
  • JavaScript
  • TypeScript
  • Go
  • Ruby
  • Java
  • PHP
  • C
  • C++
  • Rust
  • Swift
  • Scala
  • Bash

The goal of this dataset is to evaluate the ability of models to retrieve a diff given its instruction.

Code To Produce Dataset

Below is the code to reproduce this dataset:

import datasets
from tqdm import tqdm
import difflib


outrepo = "cassanof/CodeEditSearch"
LANGS = ["python", "javascript", "go", "ruby", "java", "php", "c", "c++", "rust", "swift",
         "typescript", "scala", "kotlin", "r", "perl", "haskell", "lua", "shell", "dart", "julia"]

processed = []


def get_udiff(a, b):
    a = a.splitlines()
    b = b.splitlines()
    diff = difflib.unified_diff(a, b, lineterm="")
    return "\n".join(diff)


for lang in tqdm(LANGS):
    print(f"Processing {lang}")
    ds = datasets.load_dataset("bigcode/commitpackft", lang, split="train")
    ds = ds.shuffle(seed=42)
    print(f"{lang}: {len(ds)}")
    ds = ds.filter(lambda x: len(
        x["new_contents"] + x["old_contents"]) < 2500, num_proc=8)
    ds = ds.filter(lambda x: len(x["new_contents"].strip()) > 0 and len(
        x["old_contents"].strip()) > 0, num_proc=8)
    if len(ds) < 2000:
        print(f"Skipping {lang} due to insufficient data")
        continue
    print(f"{lang} after: {len(ds)}")
    ds = ds.select(range(2000))
    diffs = [get_udiff(a, b)
             for a, b in zip(ds["old_contents"], ds["new_contents"])]
    ds = {
        "after": ds["new_contents"],
        "before": ds["old_contents"],
        "diff": diffs,
        "instruction": ds["message"],
        "license": ds["license"],
        "repos": ds["repos"],
        "commit": ds["commit"],
    }
    ds = datasets.Dataset.from_dict(ds)
    ds = ds.filter(lambda x: len(x["diff"].splitlines()) > 10, num_proc=8)
    print(f" ******* Final {lang}: {len(ds)} *******")
    ds.push_to_hub(outrepo, lang)
    processed.append(lang)

print(processed)
Downloads last month
854
Edit dataset card