commit
stringlengths
40
40
old_file
stringlengths
4
237
new_file
stringlengths
4
237
old_contents
stringlengths
1
4.24k
new_contents
stringlengths
1
4.87k
subject
stringlengths
15
778
message
stringlengths
15
8.75k
lang
stringclasses
266 values
license
stringclasses
13 values
repos
stringlengths
5
127k
6fdc8bc13b4b71d9285009f996863aad8af046b2
io/block_channel.h
io/block_channel.h
#ifndef BLOCK_CHANNEL_H #define BLOCK_CHANNEL_H class Action; class Buffer; class BlockChannel { protected: BlockChannel(void) { } public: virtual ~BlockChannel() { } virtual Action *close(EventCallback *) = 0; virtual Action *read(off_t, EventCallback *) = 0; virtual Action *write(off_t, Buffer *, EventCallback *) = 0; }; #endif /* !BLOCK_CHANNEL_H */
#ifndef BLOCK_CHANNEL_H #define BLOCK_CHANNEL_H class Action; class Buffer; class BlockChannel { protected: size_t bsize_; BlockChannel(size_t bsize) : bsize_(bsize) { } public: virtual ~BlockChannel() { } virtual Action *close(EventCallback *) = 0; virtual Action *read(off_t, EventCallback *) = 0; virtual Action *write(off_t, Buffer *, EventCallback *) = 0; }; #endif /* !BLOCK_CHANNEL_H */
Make block size a protected member of a block channel.
Make block size a protected member of a block channel.
C
bsd-2-clause
wanproxy/wanproxy,wanproxy/wanproxy,wanproxy/wanproxy
31e81b47fe1982b5fe8bdf22c5820943317832f4
src/util/std.c
src/util/std.c
#include <string.h> #include "std.h" int std_from_str(const char *std, enum c_std *penu, int *gnu) { if(!strcmp(std, "-ansi")) goto std_c90; if(strncmp(std, "-std=", 5)) return 1; std += 5; if(!strncmp(std, "gnu", 3)){ if(gnu) *gnu = 1; std += 3; }else if(*std == 'c'){ if(gnu) *gnu = 0; std++; }else{ return 1; } if(!strcmp(std, "99")){ *penu = STD_C99; }else if(!strcmp(std, "90")){ std_c90: *penu = STD_C90; }else if(!strcmp(std, "89")){ *penu = STD_C89; }else if(!strcmp(std, "11")){ *penu = STD_C11; }else if(!strcmp(std, "17") || !strcmp(std, "18")){ *penu = STD_C18; }else{ return 1; } return 0; }
#include <string.h> #include "std.h" int std_from_str(const char *std, enum c_std *penu, int *gnu) { if(!strcmp(std, "-ansi")){ if(gnu) *gnu = 0; goto std_c90; } if(strncmp(std, "-std=", 5)) return 1; std += 5; if(!strncmp(std, "gnu", 3)){ if(gnu) *gnu = 1; std += 3; }else if(*std == 'c'){ if(gnu) *gnu = 0; std++; }else{ return 1; } if(!strcmp(std, "99")){ *penu = STD_C99; }else if(!strcmp(std, "90")){ std_c90: *penu = STD_C90; }else if(!strcmp(std, "89")){ *penu = STD_C89; }else if(!strcmp(std, "11")){ *penu = STD_C11; }else if(!strcmp(std, "17") || !strcmp(std, "18")){ *penu = STD_C18; }else{ return 1; } return 0; }
Fix uninitialised gnu output for "-ansi" flag
Fix uninitialised gnu output for "-ansi" flag
C
mit
bobrippling/ucc-c-compiler,bobrippling/ucc-c-compiler,bobrippling/ucc-c-compiler
43e53ff9f64e521eafefecf79e8694231aa80021
src/c++11/value.h
src/c++11/value.h
// -*- Mode: C++ -*- #include "mapbox_variant/variant.hpp" #include <cstdint> #include <string> #include <vector> #include <unordered_map> // Variant value types for span tags and log payloads. #ifndef __LIGHTSTEP_VALUE_H__ #define __LIGHTSTEP_VALUE_H__ namespace lightstep { class Value; typedef std::unordered_map<std::string, Value> Dictionary; typedef std::vector<Value> Values; typedef mapbox::util::variant<bool, double, int64_t, uint64_t, std::string, std::nullptr_t, Values, Dictionary> variant_type; class Value : public variant_type { public: Value() : variant_type(nullptr) { } template <typename T> Value(T&& t) : variant_type(t) { } std::string to_string() const; }; } // namespace lighstep #endif // __LIGHTSTEP_VALUE_H__
// -*- Mode: C++ -*- #include "mapbox_variant/variant.hpp" #include <cstdint> #include <string> #include <vector> #include <unordered_map> // Variant value types for span tags and log payloads. #ifndef __LIGHTSTEP_VALUE_H__ #define __LIGHTSTEP_VALUE_H__ namespace lightstep { class Value; typedef std::unordered_map<std::string, Value> Dictionary; typedef std::vector<Value> Values; typedef mapbox::util::variant<bool, double, int64_t, uint64_t, std::string, std::nullptr_t, mapbox::util::recursive_wrapper<Values>, mapbox::util::recursive_wrapper<Dictionary>> variant_type; class Value : public variant_type { public: Value() : variant_type(nullptr) { } template <typename T> Value(T&& t) : variant_type(t) { } std::string to_string() const; }; } // namespace lighstep #endif // __LIGHTSTEP_VALUE_H__
Fix for recursive template (which somehow builds on Apple LLVM version 7.3.0 (clang-703.0.31)
Fix for recursive template (which somehow builds on Apple LLVM version 7.3.0 (clang-703.0.31)
C
mit
lightstep/lightstep-tracer-cpp,lightstep/lightstep-tracer-cpp,lightstep/lightstep-tracer-cpp,lightstep/lightstep-tracer-cpp,lightstep/lightstep-tracer-cpp
0b3b2c730aa260f1d060f5f70cf871174da28fc8
src/pam_unshare.c
src/pam_unshare.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <security/pam_appl.h> #include <security/pam_modules.h> PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) { return PAM_SUCCESS; } PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) { return PAM_SUCCESS; }
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <security/pam_appl.h> #include <security/pam_modules.h> PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) { printf("pam_unshare pam_sm_open_session\n"); return PAM_SUCCESS; } PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) { printf("pam_unshare pam_sm_close_session\n"); return PAM_SUCCESS; }
Make it print something on session open/close
Make it print something on session open/close
C
mit
gpjt/pam-unshare
5ee374583520de994200ea3ddbaa05b4dab71e32
bst.h
bst.h
#include <stdlib.h> #ifndef __BST_H__ #define __BST_H__ struct BSTNode; struct BST; typedef struct BSTNode BSTNode; typedef struct BST BST; BST* BST_Create(void); BSTNode* BSTNode_Create(void* k); void BST_Inorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Preorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Postorder_Tree_Walk(BST* T, void (f)(void*)); BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Tree_Minimum(BSTNode* n); BSTNode* BST_Tree_Maximum(BSTNode* n); BSTNode* BST_Tree_Root(BST* T); #endif
#include <stdlib.h> #ifndef __BST_H__ #define __BST_H__ struct BSTNode; struct BST; typedef struct BSTNode BSTNode; typedef struct BST BST; BST* BST_Create(void); BSTNode* BSTNode_Create(void* k); void BST_Inorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Preorder_Tree_Walk(BST* T, void (f)(void*)); void BST_Postorder_Tree_Walk(BST* T, void (f)(void*)); BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*)); BSTNode* BST_Tree_Minimum(BSTNode* n); BSTNode* BST_Tree_Maximum(BSTNode* n); BSTNode* BST_Tree_Root(BST* T); BSTNode* BST_Tree_Successor(BSTNode* n); BSTNode* BST_Tree_Predecessor(BSTNode* n); #endif
Add BST Predecessor/Successor func declaration
Add BST Predecessor/Successor func declaration
C
mit
MaxLikelihood/CADT
cf4397b954e8a1cfe777708f26dee8ad43ece917
src/core/map/block/SimpleBlock.h
src/core/map/block/SimpleBlock.h
// // Created by dar on 11/25/15. // #ifndef C003_SIMPLEBLOCK_H #define C003_SIMPLEBLOCK_H #pragma once #include "Block.h" class SimpleBlock : public Block { public: SimpleBlock(Map *map, int texPos, int x, int y) : Block(map, x, y), texPos(texPos) { shape.SetAsBox(0.5, 0.5); b2FixtureDef fixDef; fixDef.shape = &shape; fixDef.isSensor = true; body->CreateFixture(&fixDef); }; int getTexPos() const { return texPos; } private: int texPos; }; #endif //C003_SIMPLEBLOCK_H
// // Created by dar on 11/25/15. // #ifndef C003_SIMPLEBLOCK_H #define C003_SIMPLEBLOCK_H #pragma once #include "Block.h" class SimpleBlock : public Block { public: SimpleBlock(Map *map, int texPos, int x, int y) : Block(map, x, y), texPos(texPos) { shape.SetAsBox(0.5, 0.5); b2FixtureDef fixDef; fixDef.shape = &shape; fixDef.isSensor = texPos >= 13 * 16; body->CreateFixture(&fixDef); }; int getTexPos() const { return texPos; } private: int texPos; }; #endif //C003_SIMPLEBLOCK_H
Undo commit: "Made all blocks sensors"
Undo commit: "Made all blocks sensors"
C
mit
darsto/spooky,darsto/spooky
164fe0f58855721bd10abc4498e993443665b6fb
src/node.h
src/node.h
#ifndef SRC_NODE_H_ #define SRC_NODE_H_ #include <boost/serialization/serialization.hpp> #include <boost/serialization/access.hpp> #include <boost/serialization/nvp.hpp> #include <memory> #include "./render_data.h" #include "./math/obb.h" class Gl; /** * \brief Base class for nodes which are managed by the * Nodes class * * The only virtual method which must be implemented is * Node::render. */ class Node { public: virtual ~Node() { } virtual void render(Gl *gl, RenderData renderData) = 0; virtual std::shared_ptr<Math::Obb> getObb() { return std::shared_ptr<Math::Obb>(); } protected: Node() { } private: friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, unsigned int version) const { } }; #endif // SRC_NODE_H_
#ifndef SRC_NODE_H_ #define SRC_NODE_H_ #include <boost/serialization/serialization.hpp> #include <boost/serialization/access.hpp> #include <boost/serialization/nvp.hpp> #include <memory> #include "./render_data.h" #include "./math/obb.h" class Gl; /** * \brief Base class for nodes which are managed by the * Nodes class * * The only virtual method which must be implemented is * Node::render. */ class Node { public: virtual ~Node() { } virtual void render(Gl *gl, RenderData renderData) = 0; virtual std::shared_ptr<Math::Obb> getObb() { return std::shared_ptr<Math::Obb>(); } bool isPersistable() { return persistable; } protected: Node() { } bool persistable = true; private: friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, unsigned int version) const { } }; #endif // SRC_NODE_H_
Add protected persistable property to Node base class.
Add protected persistable property to Node base class.
C
mit
Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller,Christof/voly-labeller
9a9fe830340cd70d490325f70ef46c2736d953df
Engine/Entity.h
Engine/Entity.h
#ifndef __ENTITY_H__ #define __ENTITY_H__ #include "ModuleCollision.h" class Entity { public: Entity() : Parent(nullptr) {} Entity(Entity* parent) : Parent(parent) {} virtual ~Entity() {} // Entity lifecycle methods virtual bool Start() { return true; } virtual bool Start(bool active) { this->_active = active; return true; } bool Enable() { if (!_active) return _active = Start(); return true; } bool Disable() { if (_active) return _active = !CleanUp(); return false; } bool IsEnabled() { return _active; } virtual void PreUpdate() {} virtual void Update() {} virtual void PostUpdate() {} virtual bool CleanUp() { return true; } // Callbacks virtual bool OnCollision(Collider origin, Collider other) { return true; } public: Entity* Parent; private: bool _active = true; }; #endif // __ENTITY_H__
#ifndef __ENTITY_H__ #define __ENTITY_H__ #include "ModuleCollision.h" #include "Point3.h" class Entity { public: Entity() : Parent(nullptr) {} Entity(Entity* parent) : Parent(parent) {} virtual ~Entity() {} // Entity lifecycle methods virtual bool Start() { return true; } bool Enable() { if (!_active) return _active = Start(); return true; } bool Disable() { if (_active) return _active = !CleanUp(); return false; } bool IsEnabled() { return _active; } virtual void PreUpdate() {} virtual void Update() {} virtual void PostUpdate() {} virtual bool CleanUp() { return true; } // Callbacks virtual bool OnCollision(Collider& origin, Collider& other) { return true; } public: Entity* Parent; iPoint3 _position; private: bool _active = true; }; #endif // __ENTITY_H__
Fix calling by reference in entity
Fix calling by reference in entity
C
mit
jowie94/The-Simpsons-Arcade,jowie94/The-Simpsons-Arcade
af94158c6819f384f0f5b88dd00b0dc696a04d73
src/util.h
src/util.h
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define true 1 #define false 0 #define ALLOC(type) ALLOC_N(type, 1) #define ALLOC_N(type, n) ((type*) xmalloc(sizeof(type) * (n))) #define MEMCPY(dst, src, type) MEMCPY_N(dst, src, type, 1) #define MEMCPY_N(dst, src, type, n) (memcpy((dst), (src), sizeof(type) * (n))) void *xmalloc(size_t); char *hextoa(const char *, int); char *strclone(const char *string); #define STARTS_WITH(x, y) (strncmp((x), (y), strlen(y)) == 0) #endif /* UTIL_H */
#ifndef UTIL_H #define UTIL_H /*** Utility functions ***/ #define true 1 #define false 0 #define ALLOC(type) ALLOC_N(type, 1) #define ALLOC_N(type, n) ((type*) xmalloc(sizeof(type) * (n))) #define MEMCPY(dst, src, type) MEMCPY_N(dst, src, type, 1) #define MEMCPY_N(dst, src, type, n) (memcpy((dst), (src), sizeof(type) * (n))) void *xmalloc(size_t); char *hextoa(const char *, int); char *strclone(const char *string); #define STARTS_WITH(x, y) (strncmp((x), (y), strlen(y)) == 0) #define DEFINE_REFCOUNTERS_FOR(type) \ void sp_##type##_add_ref(sp_##type *x) {} \ void sp_##type##_release(sp_##type *x) {} #define DEFINE_READER(return_type, kind, field) \ return_type sp_##kind##_##field(sp_##kind *x) \ { \ return x->field; \ } #define DEFINE_SESSION_READER(return_type, kind, field) \ return_type sp_##kind##_##field(sp_session *x, sp_##kind *y) \ { \ return y->field; \ } #endif /* UTIL_H */
Add DEFINE_X macros, for ref counters, readers and session readers
Add DEFINE_X macros, for ref counters, readers and session readers
C
apache-2.0
mopidy/libmockspotify,mopidy/libmockspotify,mopidy/libmockspotify
a4a5d761f9cee11c229b9a10189505ead3324bc5
cmd/lefty/str.h
cmd/lefty/str.h
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif /* Lefteris Koutsofios - AT&T Bell Laboratories */ #ifndef _STR_H #define _STR_H void Sinit(void); void Sterm(void); char *Spath(char *, Tobj); char *Sseen(Tobj, char *); char *Sabstract(Tobj, Tobj); char *Stfull(Tobj); char *Ssfull(Tobj, Tobj); char *Scfull(Tobj, int, int); #endif /* _STR_H */ #ifdef __cplusplus } #endif
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (c) 1994-2004 AT&T Corp. * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Corp. * * * * Information and Software Systems Research * * AT&T Research, Florham Park NJ * **********************************************************/ #ifdef __cplusplus extern "C" { #endif /* Lefteris Koutsofios - AT&T Labs Research */ #ifndef _STR_H #define _STR_H void Sinit (void); void Sterm (void); char *Spath (char *, Tobj); char *Sseen (Tobj, char *); char *Sabstract (Tobj, Tobj); char *Stfull (Tobj); char *Ssfull (Tobj, Tobj); char *Scfull (Tobj, int, int); #endif /* _STR_H */ #ifdef __cplusplus } #endif
Update with new lefty, fixing many bugs and supporting new features
Update with new lefty, fixing many bugs and supporting new features
C
epl-1.0
MjAbuz/graphviz,jho1965us/graphviz,BMJHayward/graphviz,ellson/graphviz,ellson/graphviz,MjAbuz/graphviz,MjAbuz/graphviz,ellson/graphviz,MjAbuz/graphviz,jho1965us/graphviz,tkelman/graphviz,pixelglow/graphviz,jho1965us/graphviz,kbrock/graphviz,pixelglow/graphviz,kbrock/graphviz,MjAbuz/graphviz,tkelman/graphviz,ellson/graphviz,kbrock/graphviz,jho1965us/graphviz,kbrock/graphviz,ellson/graphviz,tkelman/graphviz,BMJHayward/graphviz,BMJHayward/graphviz,kbrock/graphviz,jho1965us/graphviz,jho1965us/graphviz,MjAbuz/graphviz,BMJHayward/graphviz,tkelman/graphviz,ellson/graphviz,kbrock/graphviz,ellson/graphviz,jho1965us/graphviz,pixelglow/graphviz,tkelman/graphviz,ellson/graphviz,MjAbuz/graphviz,pixelglow/graphviz,BMJHayward/graphviz,pixelglow/graphviz,BMJHayward/graphviz,ellson/graphviz,pixelglow/graphviz,MjAbuz/graphviz,tkelman/graphviz,kbrock/graphviz,kbrock/graphviz,BMJHayward/graphviz,MjAbuz/graphviz,ellson/graphviz,kbrock/graphviz,pixelglow/graphviz,MjAbuz/graphviz,tkelman/graphviz,tkelman/graphviz,pixelglow/graphviz,BMJHayward/graphviz,BMJHayward/graphviz,kbrock/graphviz,tkelman/graphviz,tkelman/graphviz,ellson/graphviz,MjAbuz/graphviz,jho1965us/graphviz,jho1965us/graphviz,kbrock/graphviz,jho1965us/graphviz,pixelglow/graphviz,pixelglow/graphviz,pixelglow/graphviz,jho1965us/graphviz,BMJHayward/graphviz,tkelman/graphviz,BMJHayward/graphviz
0a8dfb109eb3b3fd7a4efb9f39cca70ae44c31f8
payload/Bmp180.h
payload/Bmp180.h
#ifndef RCR_LEVEL1PAYLOAD_BMP180_H_ #define RCR_LEVEL1PAYLOAD_BMP180_H_ #if defined(ARDUINO) && ARDUINO >= 100 #include "arduino.h" #else #include "WProgram.h" #endif namespace rcr { namespace level1payload { } // namespace level1_payload } // namespace rcr #endif // RCR_LEVEL1PAYLOAD_BMP180_H_
#ifndef RCR_LEVEL1PAYLOAD_BMP180_H_ #define RCR_LEVEL1PAYLOAD_BMP180_H_ #if defined(ARDUINO) && ARDUINO >= 100 #include "arduino.h" #else #include "WProgram.h" #endif #include <Adafruit_BMP085_Library\Adafruit_BMP085.h> namespace rcr { namespace level1payload { // Encapsulates a BMP180 sensor and providing selected access to its interface. // Compatable with (at least) the BMP085 and BMP180. class Bmp180 { public: Bmp180(); // Temperature. // // UNIT: degrees Celcius float temperature(void); // Pressure at the sensor. // UNIT: pascal (N/m^2) int32_t ambient_pressure(void); // Pressure altitude: altitude with altimeter setting at 101325 Pascals == 1013.25 millibars // == 29.92 inches mercury (i.e., std. pressure) // For pressure conversions, visit NOAA // at: https://www.weather.gov/media/epz/wxcalc/pressureConversion.pdf. // (Pressure altitude is NOT correct for non-standard pressure or temperature.) // UNIT: meters float pressure_altitude(void); // Only if a humidity sensor is viable, TODO (Nolan Holden): // Add density altitude: // pressure altitude corrected for nonstandard temperature. // Remember: higher density altitude (High, Hot, and Humid) means decreased performance. // Disallow copying and moving. Bmp180(const Bmp180&) = delete; Bmp180& operator=(const Bmp180&) = delete; private: Adafruit_BMP085 bmp; }; } // namespace level1_payload } // namespace rcr #endif // RCR_LEVEL1PAYLOAD_BMP180_H_
Define the BMP180 container class
Define the BMP180 container class
C
mit
nolanholden/geovis,nolanholden/geovis,nolanholden/geovis,nolanholden/payload-level1-rocket
1a09fbfebd6cf3361b29cf1386a402560c7c7b3b
registryd/event-source.h
registryd/event-source.h
/* * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2009 Nokia. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef SPI_EVENT_SOURCE_H_ #define SPI_EVENT_SOURCE_H_ #ifdef HAVE_X11 #include <X11/Xlib.h> void spi_events_init (Display *display); void spi_set_filter (void (*filter) (XEvent*, void*), void* data); #endif /* HAVE_X11 */ void spi_events_uninit (); void spi_set_events (long event_mask); #endif /* SPI_EVENT_SOURCE_H_ */
/* * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2009 Nokia. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef SPI_EVENT_SOURCE_H_ #define SPI_EVENT_SOURCE_H_ #include <config.h> #ifdef HAVE_X11 #include <X11/Xlib.h> void spi_events_init (Display *display); void spi_set_filter (void (*filter) (XEvent*, void*), void* data); #endif /* HAVE_X11 */ void spi_events_uninit (); void spi_set_events (long event_mask); #endif /* SPI_EVENT_SOURCE_H_ */
Include config.h before checking HAVE_X11
registryd: Include config.h before checking HAVE_X11 https://bugzilla.gnome.org/show_bug.cgi?id=773710
C
lgpl-2.1
GNOME/at-spi2-core,GNOME/at-spi2-core,GNOME/at-spi2-core
1798b634514a8b35a47e3936cce7ce31ceb2e93e
shapes/map/map_6.c
shapes/map/map_6.c
int f(int); int main(void) { int *x, *y; // CHECK: Found // CHECK: line [[@LINE+1]] for(int i = 0; i < 100; i++) { x[9] = 45; x[i] = f(y[i]); } }
int f(int); int main(void) { int *x, *y; // CHECK: Near miss for(int i = 0; i < 100; i++) { x[9] = 45; x[i] = f(y[i]); } }
Change filecheck line for map 6
Change filecheck line for map 6
C
mit
Baltoli/skeletons,Baltoli/skeletons,Baltoli/skeletons
38fb8a117b47f4cf229ab15cfc5fdb1a27b09853
snake.c
snake.c
#include <stdlib.h> /** * @author: Hendrik Werner */ #define BOARD_HEIGHT 50 #define BOARD_WIDTH 50 typedef struct Position { int row; int col; } Position; typedef enum Cell { EMPTY ,SNAKE ,FOOD } Cell; int main() { return EXIT_SUCCESS; }
#include <stdlib.h> /** * @author: Hendrik Werner */ #define BOARD_HEIGHT 50 #define BOARD_WIDTH 50 typedef struct Position { int row; int col; } Position; typedef enum Cell { EMPTY ,SNAKE ,FOOD } Cell; typedef Cell Board[BOARD_HEIGHT][BOARD_WIDTH]; int main() { return EXIT_SUCCESS; }
Define a type alias to represent boards.
Define a type alias to represent boards.
C
mit
Hendrikto/Snake
2b40e170deeb97055d4a1ffb27de0ec38c212712
list.h
list.h
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); ListNode* ListNode_Create(void *); void ListNode_Destroy(ListNode* n); ListNode* List_Search(List* l, void* k, int (f)(void*, void*)); void List_Insert(List* l, ListNode* n); #endif
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); void List_Destroy(List* l); ListNode* ListNode_Create(void *); void ListNode_Destroy(ListNode* n); ListNode* List_Search(List* l, void* k, int (f)(void*, void*)); void List_Insert(List* l, ListNode* n); void List_Delete(List* l, ListNode* n); #endif
Add List Delete function declaration
Add List Delete function declaration
C
mit
MaxLikelihood/CADT
b45768b1321048d323fe762319a21e2da928142b
main.c
main.c
#include <stdio.h> int main(void) { return 0; }
#include <stdio.h> #include <stdlib.h> #define SETUP_HANDLER 0 short int CURRENT_STATE = SETUP_HANDLER; void setupHandler() { // Hardware definitions // Setup next state } void loop() { while(1) { switch(CURRENT_STATE) { case SETUP_HANDLER: setupHandler(); break; } } } int main(void) { loop(); return 0; }
Add base `state machine` from the scratch
feature: Add base `state machine` from the scratch
C
mit
marceloboeira/miller-urey
677be8e05b8fc5ccffa9035c0c39e4292a672803
cbits/win32.c
cbits/win32.c
/* ---------------------------------------------------------------------------- (c) The University of Glasgow 2006 Useful Win32 bits ------------------------------------------------------------------------- */ #if defined(_WIN32) #include "HsBase.h" int get_unique_file_info(int fd, HsWord64 *dev, HsWord64 *ino) { HANDLE h = (HANDLE)_get_osfhandle(fd); BY_HANDLE_FILE_INFORMATION info; if (GetFileInformationByHandle(h, &info)) { *dev = info.dwVolumeSerialNumber; *ino = info.nFileIndexLow | ((HsWord64)info.nFileIndexHigh << 32); return 0; } return -1; } #endif
/* ---------------------------------------------------------------------------- (c) The University of Glasgow 2006 Useful Win32 bits ------------------------------------------------------------------------- */ #if defined(_WIN32) #include "HsBase.h" #endif
Remove our customed `get_unique_file_info` on Windows platform.
Remove our customed `get_unique_file_info` on Windows platform. The function `get_unique_file_info` was added into base 5 years ago, https://github.com/ghc/ghc/blame/ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb/libraries/base/cbits/Win32Utils.c#L128, and first appeared in base-4.6.0. Signed-off-by: Tao He <9e9d50aa3fb60f0eb719baf23d12c62f0c16e40a@gmail.com>
C
bsd-3-clause
winterland1989/stdio,winterland1989/stdio,winterland1989/stdio
79b4591da81535d9820bda788e0acf15f07e9120
src/main.h
src/main.h
#pragma once #include "config.h" #define BOOST_LOG_DYN_LINK #include <boost/log/sources/severity_logger.hpp> #include <boost/log/trivial.hpp> int main(int argc, char **argv); boost::log::sources::severity_logger<boost::log::trivial::severity_level> &get_global_logger(void); // TOOD: Make const
#pragma once #include "config.h" #define BOOST_LOG_DYN_LINK #include <boost/log/sources/severity_logger.hpp> #include <boost/log/trivial.hpp> int main(int argc, char **argv); boost::log::sources::severity_logger<boost::log::trivial::severity_level> &get_global_logger(void);
Remove comment which is impossible :(
Remove comment which is impossible :(
C
mit
durandj/simplicity,durandj/simplicity
1ca2092e54d1b1c06daf79eaf76710889a7eda2d
RobotC/MotorTest.c
RobotC/MotorTest.c
#pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, leftMotor, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C1_2, rightMotor, tmotorTetrix, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// task main() { motor[leftMotor] =100; motor[rightMotor] = -100; wait1Msec(1000); for(int i=0;i<kNumbOfRealMotors;i++) { motor[i] = 0; } }
#pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, Michelangelo_FR, tmotorTetrix, PIDControl, reversed, encoder) #pragma config(Motor, mtr_S1_C1_2, Donatello_FL, tmotorTetrix, PIDControl, encoder) #pragma config(Motor, mtr_S1_C2_2, Raphael_BR, tmotorTetrix, PIDControl, reversed, encoder) #pragma config(Motor, mtr_S1_C2_1, Leonardo_BL, tmotorTetrix, PIDControl, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// //If none of these work, I will be very sad. #define TOTAL_MOTORS kNumbOfTotalMotors //#define TOTAL_MOTORS kNumbOfRealMotors //#define TOTAL_MOTORS kNumbOfVirtualMotors task main() { for(int i=0;i<TOTAL_MOTORS;i++) { motor[i] = 50; } wait1Msec(2000); motor[Michelangelo_FR] = 0; motor[Donatello_FL] = 0; motor[Raphael_BR] = 0; motor[Leonardo_BL] = 0; }
Add motor loop tester to see once and for all if possible
Add motor loop tester to see once and for all if possible
C
mit
RMRobotics/FTC_5421_2014-2015,RMRobotics/FTC_5421_2014-2015
0201012a54285c9851dfe8b23045f0d99a8175cd
RMUniversalAlert.h
RMUniversalAlert.h
// // RMUniversalAlert.h // RMUniversalAlert // // Created by Ryan Maxwell on 19/11/14. // Copyright (c) 2014 Ryan Maxwell. All rights reserved. // @class RMUniversalAlert; typedef void(^RMUniversalAlertCompletionBlock)(RMUniversalAlert *alert, NSInteger buttonIndex); @interface RMUniversalAlert : NSObject + (instancetype)showAlertInViewController:(UIViewController *)viewController withTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles tapBlock:(RMUniversalAlertCompletionBlock)tapBlock; + (instancetype)showActionSheetInViewController:(UIViewController *)viewController withTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles tapBlock:(RMUniversalAlertCompletionBlock)tapBlock; @property (readonly, nonatomic) BOOL visible; @property (readonly, nonatomic) NSInteger cancelButtonIndex; @property (readonly, nonatomic) NSInteger firstOtherButtonIndex; @property (readonly, nonatomic) NSInteger destructiveButtonIndex; @end
// // RMUniversalAlert.h // RMUniversalAlert // // Created by Ryan Maxwell on 19/11/14. // Copyright (c) 2014 Ryan Maxwell. All rights reserved. // #import <UIKit/UIKit.h> @class RMUniversalAlert; typedef void(^RMUniversalAlertCompletionBlock)(RMUniversalAlert *alert, NSInteger buttonIndex); @interface RMUniversalAlert : NSObject + (instancetype)showAlertInViewController:(UIViewController *)viewController withTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles tapBlock:(RMUniversalAlertCompletionBlock)tapBlock; + (instancetype)showActionSheetInViewController:(UIViewController *)viewController withTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles tapBlock:(RMUniversalAlertCompletionBlock)tapBlock; @property (readonly, nonatomic) BOOL visible; @property (readonly, nonatomic) NSInteger cancelButtonIndex; @property (readonly, nonatomic) NSInteger firstOtherButtonIndex; @property (readonly, nonatomic) NSInteger destructiveButtonIndex; @end
Add in UIKit import into header.
Add in UIKit import into header.
C
mit
lijie121210/RMUniversalAlert,ranshon/RMUniversalAlert,RockyZ/RMUniversalAlert,ryanmaxwell/RMUniversalAlert
4ea319b6ff2c1bf38adafdb8c9128ab48d3eb9ee
common/platform/api/quiche_export.h
common/platform/api/quiche_export.h
// Copyright 2019 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 THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_ #define THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_ #include "net/quiche/common/platform/impl/quiche_export_impl.h" // quiche_export_impl.h defines the following macros: // - QUICHE_EXPORT is not meant to be used. // - QUICHE_EXPORT_PRIVATE is meant for QUICHE functionality that is built in // Chromium as part of //net, and not fully contained in headers. // - QUICHE_NO_EXPORT is meant for QUICHE functionality that is either fully // defined in a header, or is built in Chromium as part of tests or tools. #endif // THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_
// Copyright 2019 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 THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_ #define THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_ #include "quiche_platform_impl/quiche_export_impl.h" // QUICHE_EXPORT is not meant to be used. #define QUICHE_EXPORT QUICHE_EXPORT_IMPL // QUICHE_EXPORT_PRIVATE is meant for QUICHE functionality that is built in // Chromium as part of //net, and not fully contained in headers. #define QUICHE_EXPORT_PRIVATE QUICHE_EXPORT_PRIVATE_IMPL // QUICHE_NO_EXPORT is meant for QUICHE functionality that is either fully // defined in a header, or is built in Chromium as part of tests or tools. #define QUICHE_NO_EXPORT QUICHE_NO_EXPORT_IMPL #endif // THIRD_PARTY_QUICHE_PLATFORM_API_QUICHE_EXPORT_H_
Make QUICHE export use new-style default impl.
Make QUICHE export use new-style default impl. PiperOrigin-RevId: 354510465 Change-Id: I3b55187e2a2e8af8e5870dc24b608ebb5a5ff865
C
bsd-3-clause
google/quiche,google/quiche,google/quiche,google/quiche
ffddc9d9b570116a0d0acc3c6309794cb68db085
src/libbitcoind.h
src/libbitcoind.h
#include "main.h" #include "addrman.h" #include "alert.h" #include "base58.h" #include "init.h" #include "noui.h" #include "rpcserver.h" #include "txdb.h" #include <boost/thread.hpp> #include <boost/filesystem.hpp> #include "nan.h" #include "scheduler.h" #include "core_io.h" #include "script/bitcoinconsensus.h" #include "consensus/validation.h" NAN_METHOD(StartBitcoind); NAN_METHOD(OnBlocksReady); NAN_METHOD(OnTipUpdate); NAN_METHOD(IsStopping); NAN_METHOD(IsStopped); NAN_METHOD(StopBitcoind); NAN_METHOD(GetBlock); NAN_METHOD(GetTransaction); NAN_METHOD(GetInfo); NAN_METHOD(IsSpent); NAN_METHOD(GetBlockIndex); NAN_METHOD(GetMempoolOutputs); NAN_METHOD(AddMempoolUncheckedTransaction); NAN_METHOD(VerifyScript); NAN_METHOD(SendTransaction); NAN_METHOD(EstimateFee); NAN_METHOD(StartTxMon); NAN_METHOD(GetProgress);
#include "main.h" #include "addrman.h" #include "alert.h" #include "base58.h" #include "init.h" #include "noui.h" #include "rpcserver.h" #include "txdb.h" #include <boost/thread.hpp> #include <boost/filesystem.hpp> #include "nan.h" #include "scheduler.h" #include "core_io.h" #include "script/bitcoinconsensus.h" #include "consensus/validation.h" NAN_METHOD(StartBitcoind); NAN_METHOD(OnBlocksReady); NAN_METHOD(OnTipUpdate); NAN_METHOD(IsStopping); NAN_METHOD(IsStopped); NAN_METHOD(StopBitcoind); NAN_METHOD(GetBlock); NAN_METHOD(GetTransaction); NAN_METHOD(GetInfo); NAN_METHOD(IsSpent); NAN_METHOD(GetBlockIndex); NAN_METHOD(GetMempoolOutputs); NAN_METHOD(AddMempoolUncheckedTransaction); NAN_METHOD(VerifyScript); NAN_METHOD(SendTransaction); NAN_METHOD(EstimateFee); NAN_METHOD(StartTxMon); NAN_METHOD(SyncPercentage); NAN_METHOD(IsSynced);
Fix declarations for IsSynced and SyncPercentage
Fix declarations for IsSynced and SyncPercentage
C
mit
isghe/bitcore-node,braydonf/bitcore-node,CryptArc/bitcore-node,jameswalpole/bitcore-node,wzrdtales/bitcore-node,zcoinrocks/bitcore-node,wzrdtales/bitcore-node,jameswalpole/bitcore-node,snogcel/bitcore-node-dash,phplaboratory/psiacore-node,jameswalpole/bitcore-node,wzrdtales/bitcore-node,wzrdtales/bitcore-node,isghe/bitcore-node,CryptArc/bitcore-node,isghe/bitcore-node,wzrdtales/bitcore-node,snogcel/bitcore-node-dash,zcoinrocks/bitcore-node,isghe/bitcore-node,jameswalpole/bitcore-node,CryptArc/bitcore-node,CryptArc/bitcore-node,fanatid/bitcore-node,kleetus/bitcore-node,kleetus/bitcore-node,fanatid/bitcore-node,fanatid/bitcore-node,jameswalpole/bitcore-node,phplaboratory/psiacore-node,fanatid/bitcore-node,phplaboratory/psiacore-node,CryptArc/bitcore-node,phplaboratory/psiacore-node,fanatid/bitcore-node,phplaboratory/psiacore-node,isghe/bitcore-node,braydonf/bitcore-node
acb99f7d6b709a7dc88344c36de7c4866e455035
src/wrap.h
src/wrap.h
#ifndef BF_WRAP_H #define BF_WRAP_H #include <type_traits> #include "object.h" namespace bf { template < typename T, typename std::enable_if<std::is_integral<T>::value>::type > object wrap(T const& x) { return {&x, sizeof(T)}; } template <typename Sequence> object wrap(Sequence const& s) { return {s.data(), s.size()}; } } // namespace bf #endif
#ifndef BF_WRAP_H #define BF_WRAP_H #include <type_traits> #include <vector> #include "object.h" namespace bf { template < typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type > object wrap(T const& x) { return {&x, sizeof(T)}; } template < typename T, size_t N, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type > object wrap(T const (&str)[N]) { return {&str, N * sizeof(T)}; } template < typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type > object wrap(std::vector<T> const& s) { return {s.data(), s.size()}; } inline object wrap(std::string const& str) { return {str.data(), str.size()}; } } // namespace bf #endif
Fix SFINAE default arg and add array overload.
Fix SFINAE default arg and add array overload.
C
bsd-3-clause
mavam/libbf,nicolacdnll/libbf,nicolacdnll/libbf
6493bb2e8d68e7862a9841807073c5a507c9c8e3
defs.c
defs.c
#include <stdio.h> void putStr(const char *str) { fputs(str, stdout); }
#include <stdio.h> #include <gmp.h> void putStr(const char *str) { fputs(str, stdout); } void mpz_set_ull(mpz_t n, unsigned long long ull) { mpz_set_ui(n, (unsigned int)(ull >> 32)); /* n = (unsigned int)(ull >> 32) */ mpz_mul_2exp(n, n, 32); /* n <<= 32 */ mpz_add_ui(n, n, (unsigned int)ull); /* n += (unsigned int)ull */ } unsigned long long mpz_get_ull(mpz_t n) { unsigned int lo, hi; mpz_t tmp; mpz_init( tmp ); mpz_mod_2exp( tmp, n, 64 ); /* tmp = (lower 64 bits of n) */ lo = mpz_get_ui( tmp ); /* lo = tmp & 0xffffffff */ mpz_div_2exp( tmp, tmp, 32 ); /* tmp >>= 32 */ hi = mpz_get_ui( tmp ); /* hi = tmp & 0xffffffff */ mpz_clear( tmp ); return (((unsigned long long)hi) << 32) + lo; }
Fix comparison return values and implement Integer truncation
Fix comparison return values and implement Integer truncation
C
bsd-3-clause
melted/idris-llvm,melted/idris-llvm,idris-hackers/idris-llvm,idris-hackers/idris-llvm
5301e87a423ec2095955328c78b350e14b38a6bc
source/tid/enums.h
source/tid/enums.h
#pragma once #include <string_view> namespace tid { enum level : int { parent = -1, normal = 0, detail = 1, pedant = 2, }; constexpr std::string_view level2sv(level l) noexcept { switch(l) { case normal: return "normal"; case detail: return "detail"; case pedant: return "pedant"; case parent: return "parent"; default: return "unknown"; } } } template<typename T> extern constexpr std::string_view enum2sv(const T &item); template<typename T> extern constexpr auto sv2enum(std::string_view item); template<> constexpr std::string_view enum2sv(const tid::level &item) { switch(item) { case(tid::level::normal): return "normal"; case(tid::level::detail): return "detail"; case(tid::level::pedant): return "pedant"; case(tid::level::parent): return "parent"; default: throw std::runtime_error("Unrecognized tid::level enum"); } } template<> constexpr auto sv2enum<tid::level>(std::string_view item) { if(item == "normal") return tid::level::normal; if(item == "detail") return tid::level::detail; if(item == "pedant") return tid::level::pedant; if(item == "parent") return tid::level::parent; throw std::runtime_error("Given item is not a tid::level enum: " + std::string(item)); }
#pragma once #include <exception> #include <string_view> namespace tid { enum level : int { parent = -1, normal = 0, detail = 1, pedant = 2, }; constexpr std::string_view level2sv(level l) noexcept { switch(l) { case normal: return "normal"; case detail: return "detail"; case pedant: return "pedant"; case parent: return "parent"; default: return "unknown"; } } } template<typename T> extern constexpr std::string_view enum2sv(const T &item); template<typename T> extern constexpr auto sv2enum(std::string_view item); template<> constexpr std::string_view enum2sv(const tid::level &item) { switch(item) { case(tid::level::normal): return "normal"; case(tid::level::detail): return "detail"; case(tid::level::pedant): return "pedant"; case(tid::level::parent): return "parent"; default: throw std::runtime_error("Unrecognized tid::level enum"); } } template<> constexpr auto sv2enum<tid::level>(std::string_view item) { if(item == "normal") return tid::level::normal; if(item == "detail") return tid::level::detail; if(item == "pedant") return tid::level::pedant; if(item == "parent") return tid::level::parent; throw std::runtime_error("Given item is not a tid::level enum"); }
Fix include headers after refactor
Fix include headers after refactor Former-commit-id: 7570681cb07311ab05e4f039e6c023fb3fe5f5a5
C
mit
DavidAce/DMRG,DavidAce/DMRG,DavidAce/DMRG,DavidAce/DMRG
1432cf072b1fb914e514603ea5a65677a450d3fc
src/blobsBack.c
src/blobsBack.c
#include <stdlib.h> #include "blobsBack.h" int requestCmd(int player, typeCommand* command) { command = NULL; //if() return 1; }
#include <stdlib.h> #include "blobsBack.h" int canMove(int player, typeBoard* board) { int i, j; for(i = 0; i < board->h; i++) { for(j = 0; j < board->w; j++) { if(board->get[i][j].owner == player && board->get[i][j].canMove) { return 1; } } } return 0; } char* getCommand(typeCommand* command) { } int isInside(int x, int y, int w, int h) { if(x >= 0 && x < w && y >= 0 && y < h) return 1; else return 0; } int validCommand(typeCommand* command, typeBoard* board, int player) { if(!isInside(command->source.x, command->source.y, board->w, board->h)) return 0; else if(!isInside(command->target.x, command->target.y, board->w, board->h)) return 0; else if(abs(command->source.x - command->target.x) > 2 || abs(command->source.y - command->target.y) > 2) return 0; else if(board->get[command->source.y][command->source.x].owner != player) return 0; else if(board->get[command->target.y][command->target.x].owner != 0) return 0; else return 1; }
Add canMove, isInside and validCommand
Add canMove, isInside and validCommand
C
mit
lucas-emery/TPE
bfb029f6ff779c828039be7f0d1eb061376d5006
tests/testCaseSingleton.h
tests/testCaseSingleton.h
#ifndef TESTCASESINGLETON_H #define TESTCASESINGLETON_H #include "CppDiFactory.h" class IEngine { public: virtual double getVolume() const = 0; virtual ~IEngine() = default; }; class Engine : public IEngine { public: virtual double getVolume() const override { return 10.5; } }; TEST_CASE( "Singleton Test", "Check if two instances of a registered singleton are equal" ){ CppDiFactory::DiFactory myFactory; myFactory.registerSingleton<Engine>().withInterfaces<IEngine>(); auto engine = myFactory.getInstance<IEngine>(); auto engine2 = myFactory.getInstance<IEngine>(); CHECK(engine == engine2); } #endif // TESTCASESINGLETON_H
#ifndef TESTCASESINGLETON_H #define TESTCASESINGLETON_H #include "CppDiFactory.h" namespace testCaseSingleton { class IEngine { public: virtual double getVolume() const = 0; virtual ~IEngine() = default; }; class Engine : public IEngine { private: static bool _valid; public: Engine() { _valid = true; } virtual ~Engine () { _valid = false; } virtual double getVolume() const override { return 10.5; } static bool isValid() { return _valid; } }; bool Engine::_valid = false; TEST_CASE( "Singleton Test", "Check if two instances of a registered singleton are equal" ){ CppDiFactory::DiFactory myFactory; myFactory.registerSingleton<Engine>().withInterfaces<IEngine>(); auto engine = myFactory.getInstance<IEngine>(); auto engine2 = myFactory.getInstance<IEngine>(); CHECK(engine == engine2); } TEST_CASE( "Singleton Lifetime test", "Check that the lifetime of the singleton is correct (alive while used)" ){ CppDiFactory::DiFactory myFactory; myFactory.registerSingleton<Engine>().withInterfaces<IEngine>(); std::shared_ptr<IEngine> spEngine; std::weak_ptr<IEngine> wpEngine; // no request yet --> Engine shouldn't exist yet. CHECK(!Engine::isValid()); //NOTE: use sub-block to ensure that no temporary shared-pointers remain alive { //First call to getInstance should create the engine spEngine = myFactory.getInstance<IEngine>(); CHECK(Engine::isValid()); } //shared pointer is alive --> engine should still exist //NOTE: use sub-block to ensure that no temporary shared-pointers remain alive { CHECK(Engine::isValid()); //second call should get same instance wpEngine = myFactory.getInstance<IEngine>(); CHECK(wpEngine.lock() == spEngine); } //remove the only shared pointer to the engine (--> engine should get destroyed) spEngine.reset(); //shared pointer is not alive anymore --> engine should have been destroyed. CHECK(wpEngine.expired()); CHECK(!Engine::isValid()); } } #endif // TESTCASESINGLETON_H
Add tests for singleton lifetime
Add tests for singleton lifetime
C
apache-2.0
bbvch/CppDiFactory
7da86164962ae726ddb761f8b9486ab31f61656b
test/main.c
test/main.c
#include <stdio.h> #include "bincookie.h" int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: %s [Full path to Cookies.binarycookies file]\n", argv[0]); printf("Example: %s Cookies.binarycookies\n", argv[0]); return 1; } binarycookies_t *bc = binarycookies_init(argv[1]); unsigned int i, j; uint32_t flags; // Output in Netscape cookies.txt format for (i = 0; i < bc->num_pages; i++) { for (j = 0; j < bc->pages[i]->number_of_cookies; j++) { flags = bc->pages[i]->cookies[j]->flags; // domain, flag, path, secure, expiration, name, value printf("%s\t%s\t%s\t%s\t%.f\t%s\t%s\n", bc->pages[i]->cookies[j]->url, bc->pages[i]->cookies[j]->url[0] == '.' ? "TRUE" : "FALSE", bc->pages[i]->cookies[j]->path, flags == 1 || flags == 5 ? "TRUE" : "FALSE", bc->pages[i]->cookies[j]->expiration_date, bc->pages[i]->cookies[j]->name, bc->pages[i]->cookies[j]->value); } } binarycookies_free(bc); return 0; }
#include <stdio.h> #include "bincookie.h" int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: %s [Full path to Cookies.binarycookies file]\n", argv[0]); printf("Example: %s Cookies.binarycookies\n", argv[0]); return 1; } binarycookies_t *bc = binarycookies_init(argv[1]); unsigned int i, j; binarycookies_flag flags; // Output in Netscape cookies.txt format for (i = 0; i < bc->num_pages; i++) { for (j = 0; j < bc->pages[i]->number_of_cookies; j++) { flags = bc->pages[i]->cookies[j]->flags; // domain, flag, path, secure, expiration, name, value printf("%s\t%s\t%s\t%s\t%.f\t%s\t%s\n", bc->pages[i]->cookies[j]->url, bc->pages[i]->cookies[j]->url[0] == '.' ? "TRUE" : "FALSE", bc->pages[i]->cookies[j]->path, flags == secure || flags == secure_http_only ? "TRUE" : "FALSE", bc->pages[i]->cookies[j]->expiration_date, bc->pages[i]->cookies[j]->name, bc->pages[i]->cookies[j]->value); } } binarycookies_free(bc); return 0; }
Use enum for flag check
Use enum for flag check
C
mit
Tatsh/libbinarycookies,Tatsh/libbinarycookies
648efe12f983c62f0ab9313ccb32a724e2d689cd
src/kernel/irq/static_irq/irq_static.c
src/kernel/irq/static_irq/irq_static.c
/** * @file * @brief * * @date Mar 12, 2014 * @author: Anton Bondarev */ #include <assert.h> #include <kernel/irq.h> extern char __static_irq_table_start; extern char __static_irq_table_end; #define STATIC_IRQ_TABLE_SIZE \ (((int) &__static_irq_table_end - (int) &__static_irq_table_start) / 4) int irq_attach(unsigned int irq_nr, irq_handler_t handler, unsigned int flags, void *dev_id, const char *dev_name) { assert(irq_nr <= STATIC_IRQ_TABLE_SIZE); assertf(((void **) &__static_irq_table_start)[irq_nr] != NULL, "IRQ handler is not assigned with STATIC_IRQ_ATTACH\n"); irqctrl_enable(irq_nr); return 0; } int irq_detach(unsigned int irq_nr, void *dev_id) { irqctrl_disable(irq_nr); return 0; } void irq_dispatch(unsigned int irq_nr) { }
/** * @file * @brief * * @date Mar 12, 2014 * @author: Anton Bondarev */ #include <assert.h> #include <kernel/irq.h> extern char __static_irq_table_start; extern char __static_irq_table_end; #define STATIC_IRQ_TABLE_SIZE \ (((int) &__static_irq_table_end - (int) &__static_irq_table_start) / 4) int irq_attach(unsigned int irq_nr, irq_handler_t handler, unsigned int flags, void *dev_id, const char *dev_name) { assert(irq_nr <= STATIC_IRQ_TABLE_SIZE); assertf(((void **) &__static_irq_table_start)[irq_nr] != NULL, "IRQ(%d) handler is not assigned with STATIC_IRQ_ATTACH\n", irq_nr); irqctrl_enable(irq_nr); return 0; } int irq_detach(unsigned int irq_nr, void *dev_id) { irqctrl_disable(irq_nr); return 0; } void irq_dispatch(unsigned int irq_nr) { }
Print irq_num during assert in static irq_attach
minor: Print irq_num during assert in static irq_attach
C
bsd-2-clause
embox/embox,embox/embox,embox/embox,embox/embox,embox/embox,embox/embox
7aab6b61066940e0933fafed6b0c1ff9ea8d1472
fibonacci_coding.c
fibonacci_coding.c
/* * fibonacci_coding.c * Author: Duc Thanh Tran */ #include <math.h> /* * Calculates i-th fibonacci-number (based on Moivre-Binet) * where we start with 1 and ignore the duplicate 1 at the beginning, i.e. * the fibonacci sequence is: 1, 2, 3, 5, 8, ... */ unsigned int fibonacciNumber(int n) { if(n <= 2) { return n; } double phi = (1 + sqrt(5.0)) / 2.0; return round(pow(phi,n+1) / sqrt(5.0)); }
/* * fibonacci_coding.c * Author: Duc Thanh Tran */ #include <math.h> /* * Calculates i-th fibonacci-number (based on Moivre-Binet) * where we start with 1 and ignore the duplicate 1 at the beginning, i.e. * the fibonacci sequence is: 1, 2, 3, 5, 8, ... */ unsigned int fibonacciNumber(int n) { if(n <= 2) { return n; } double phi = (1 + sqrt(5.0)) / 2.0; return round(pow(phi,n+1) / sqrt(5.0)); } /* * Sets the k-th bit in num */ inline void setBit(unsigned int *num, int k) { *num |= 1 << k; } /* * Encodes a positive integer into a binary codeword with fibonacci numbers as bases * Adding a 1-bit and reversing the codeword yiels a prefix code */ unsigned int encode_fib(unsigned int N) { // find highest fibonacci number that is equal or smaller than N int i = 1; while(fibonacciNumber(++i) <= N); i -= 1; // calculate rest of the Zeckendorf-Representation unsigned int z_repr = 0; while(i > 0) { if(fibonacciNumber(i) <= N) { setBit(&z_repr, i); N -= fibonacciNumber(i); // Zeckendorf-Theorem: there are no consecutive 1-bits i -= 2; } else { i -= 1; } } // TODO: Zeckendorf representation finished; add 1-bit (UD-property) and reverse bit-representation to achieve prefix-code return enc; }
Add 1st part of encoding algorithm
Add 1st part of encoding algorithm Zeckendorf-representation finished
C
mit
ducthanhtran/fibonacci-compression-coding
fa399229296ba75b2fb3f7b6891c28a3e369ae38
test/Sema/attr-micromips.c
test/Sema/attr-micromips.c
// RUN: %clang_cc1 -triple mips-linux-gnu -fsyntax-only -verify %s __attribute__((nomicromips(0))) void foo1(); // expected-error {{'nomicromips' attribute takes no arguments}} __attribute__((micromips(1))) void foo2(); // expected-error {{'micromips' attribute takes no arguments}} __attribute((nomicromips)) int a; // expected-error {{attribute only applies to functions}} __attribute((micromips)) int b; // expected-error {{attribute only applies to functions}} __attribute__((micromips,mips16)) void foo5(); // expected-error {{'micromips' and 'mips16' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} __attribute__((mips16,micromips)) void foo6(); // expected-error {{'mips16' and 'micromips' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} __attribute((micromips)) void foo7(); __attribute((nomicromips)) void foo8();
// RUN: %clang_cc1 -triple mips-linux-gnu -fsyntax-only -verify %s __attribute__((nomicromips(0))) void foo1(); // expected-error {{'nomicromips' attribute takes no arguments}} __attribute__((micromips(1))) void foo2(); // expected-error {{'micromips' attribute takes no arguments}} __attribute((nomicromips)) int a; // expected-error {{attribute only applies to functions}} __attribute((micromips)) int b; // expected-error {{attribute only applies to functions}} __attribute__((micromips,mips16)) void foo5(); // expected-error {{'micromips' and 'mips16' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} __attribute__((mips16,micromips)) void foo6(); // expected-error {{'mips16' and 'micromips' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} __attribute((micromips)) void foo7(); __attribute((nomicromips)) void foo8(); __attribute__((mips16)) void foo9(void) __attribute__((micromips)); // expected-error {{'micromips' and 'mips16' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}}
Add one more check to the micromips attribute test case. NFC
[mips] Add one more check to the micromips attribute test case. NFC git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@303565 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang
1632ad4fcb5be14705f63f61cda13cf50596b515
creator/plugins/docks/propertiesdock/propertywidgetitems/qrealpropertywidgetitem.h
creator/plugins/docks/propertiesdock/propertywidgetitems/qrealpropertywidgetitem.h
#ifndef QREALPROPERTYWIDGETITEM_H #define QREALPROPERTYWIDGETITEM_H #include "widgets/propertywidgetitem.h" class QDoubleSpinBox; namespace GluonCreator { class QRealPropertyWidgetItem : public PropertyWidgetItem { Q_OBJECT public: explicit QRealPropertyWidgetItem(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QRealPropertyWidgetItem(); virtual QList<QString> supportedDataTypes() const; virtual PropertyWidgetItem* instantiate(); public slots: void setEditValue(const QVariant& value); void qrealValueChanged(double value); }; } #endif
#ifndef QREALPROPERTYWIDGETITEM_H #define QREALPROPERTYWIDGETITEM_H #include "widgets/propertywidgetitem.h" class QDoubleSpinBox; namespace GluonCreator { class QRealPropertyWidgetItem : public PropertyWidgetItem { Q_OBJECT public: explicit QRealPropertyWidgetItem(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QRealPropertyWidgetItem(); virtual QList<QString> supportedDataTypes() const; virtual PropertyWidgetItem* instantiate(); public slots: void setEditValue(const QVariant& value); void qrealValueChanged(double value); }; } #endif
Fix krzy issue for "endswithnewline"
Fix krzy issue for "endswithnewline"
C
lgpl-2.1
KDE/gluon,pranavrc/example-gluon,cgaebel/gluon,cgaebel/gluon,KDE/gluon,pranavrc/example-gluon,KDE/gluon,cgaebel/gluon,cgaebel/gluon,pranavrc/example-gluon,pranavrc/example-gluon,KDE/gluon
18c0fdc7f6d21c9be2e91847c8441ce311a3af6a
bikepath/AddressGeocoderFactory.h
bikepath/AddressGeocoderFactory.h
// // AddressGeocoderFactory.h // bikepath // // Created by Farheen Malik on 8/19/14. // Copyright (c) 2014 Bike Path. All rights reserved. // #import <Foundation/Foundation.h> #import "SPGooglePlacesAutocomplete.h" #import <UIKit/UIKit.h> #import "GeocodeItem.h" @interface AddressGeocoderFactory : NSObject //+ (GeocodeItem*) translateAddressToGeocodeObject:(NSString*)addressString; + (NSString*)translateAddresstoUrl:(NSString*)addressString; // + (GeocodeItem*)translateUrlToGeocodedObject:(NSString*)url; @end
// // AddressGeocoderFactory.h // bikepath // // Created by Farheen Malik on 8/19/14. // Copyright (c) 2014 Bike Path. All rights reserved. // #import <Foundation/Foundation.h> #import "SPGooglePlacesAutocomplete.h" #import <UIKit/UIKit.h> #import "GeocodeItem.h" @interface AddressGeocoderFactory : NSObject //+ (GeocodeItem*) translateAddressToGeocodeObject:(NSString*)addressString; + (NSString*)translateAddresstoUrl:(NSString*)addressString; // + (NSMutableDictionary*)translateUrlToGeocodedObject:(NSString*)url; @end
Modify methods according to new names in implementation file
Modify methods according to new names in implementation file
C
apache-2.0
hushifei/bike-path,red-spotted-newts-2014/bike-path,red-spotted-newts-2014/bike-path
36bb3b728bacb99ecf2f95734d3e5e97a070fa0e
test2/code_gen/deref_reg.c
test2/code_gen/deref_reg.c
// RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax' // RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rbx), %%ebx' #ifdef FIRST f(int *p) { return *p; // should see that p isn't used after/.retains==1 and not create a new reg, // but re-use the current } #elif defined(SECOND) struct A { int i, j; }; g(struct A *p) { return p->i + p->j; } #else # error neither #endif
// RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax' // RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rcx), %%ecx' #ifdef FIRST f(int *p) { return *p; // should see that p isn't used after/.retains==1 and not create a new reg, // but re-use the current } #elif defined(SECOND) struct A { int i, j; }; g(struct A *p) { return p->i + p->j; } #else # error neither #endif
Change test now %ebx is callee-save
Change test now %ebx is callee-save
C
mit
8l/ucc-c-compiler,8l/ucc-c-compiler,8l/ucc-c-compiler,8l/ucc-c-compiler
d7ba0a9c6dad9db4a22d06c25646ae6df25ccd68
AsyncDisplayKit/Layout/ASAbsoluteLayoutElement.h
AsyncDisplayKit/Layout/ASAbsoluteLayoutElement.h
// // ASAbsoluteLayoutElement.h // AsyncDisplayKit // // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. // NS_ASSUME_NONNULL_BEGIN /** * Layout options that can be defined for an ASLayoutElement being added to a ASAbsoluteLayoutSpec. */ @protocol ASAbsoluteLayoutElement /** * @abstract The position of this object within its parent spec. */ @property (nonatomic, assign) CGPoint layoutPosition; #pragma mark Deprecated @property (nonatomic, assign) ASRelativeSizeRange sizeRange ASDISPLAYNODE_DEPRECATED; @end NS_ASSUME_NONNULL_END
// // ASAbsoluteLayoutElement.h // AsyncDisplayKit // // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. // #import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASDimension.h> NS_ASSUME_NONNULL_BEGIN /** * Layout options that can be defined for an ASLayoutElement being added to a ASAbsoluteLayoutSpec. */ @protocol ASAbsoluteLayoutElement /** * @abstract The position of this object within its parent spec. */ @property (nonatomic, assign) CGPoint layoutPosition; #pragma mark Deprecated @property (nonatomic, assign) ASRelativeSizeRange sizeRange ASDISPLAYNODE_DEPRECATED; @end NS_ASSUME_NONNULL_END
Add imports that are necessary for clang to parse header files after compilation.
[Build] Add imports that are necessary for clang to parse header files after compilation. This allows the objc-diff tool (which creates API diffs) to run successfully.
C
bsd-3-clause
maicki/AsyncDisplayKit,tomizimobile/AsyncDisplayKit,rmls/AsyncDisplayKit,romyilano/AsyncDisplayKit,tomizimobile/AsyncDisplayKit,rahul-malik/AsyncDisplayKit,chrisdanford/AsyncDisplayKit,flovouin/AsyncDisplayKit,aaronschubert0/AsyncDisplayKit,harryworld/AsyncDisplayKit,tomizimobile/AsyncDisplayKit,george-gw/AsyncDisplayKit,JetZou/AsyncDisplayKit,rahul-malik/AsyncDisplayKit,JetZou/AsyncDisplayKit,aaronschubert0/AsyncDisplayKit,harryworld/AsyncDisplayKit,aaronschubert0/AsyncDisplayKit,romyilano/AsyncDisplayKit,rahul-malik/AsyncDisplayKit,maicki/AsyncDisplayKit,george-gw/AsyncDisplayKit,romyilano/AsyncDisplayKit,chrisdanford/AsyncDisplayKit,JetZou/AsyncDisplayKit,rmls/AsyncDisplayKit,JetZou/AsyncDisplayKit,tomizimobile/AsyncDisplayKit,lappp9/AsyncDisplayKit,lappp9/AsyncDisplayKit,flovouin/AsyncDisplayKit,romyilano/AsyncDisplayKit,chrisdanford/AsyncDisplayKit,aaronschubert0/AsyncDisplayKit,harryworld/AsyncDisplayKit,rmls/AsyncDisplayKit,lappp9/AsyncDisplayKit,chrisdanford/AsyncDisplayKit,maicki/AsyncDisplayKit,harryworld/AsyncDisplayKit,maicki/AsyncDisplayKit,maicki/AsyncDisplayKit,tomizimobile/AsyncDisplayKit,harryworld/AsyncDisplayKit,george-gw/AsyncDisplayKit,flovouin/AsyncDisplayKit,rmls/AsyncDisplayKit,rmls/AsyncDisplayKit,aaronschubert0/AsyncDisplayKit,george-gw/AsyncDisplayKit,lappp9/AsyncDisplayKit,flovouin/AsyncDisplayKit,JetZou/AsyncDisplayKit,flovouin/AsyncDisplayKit,rahul-malik/AsyncDisplayKit
6bc2c3564661acd3ebbd00843a8c09d5944a1da0
fuzz/main.c
fuzz/main.c
/* How to fuzz: clang main.c -O2 -g -fsanitize=address,fuzzer -o fuzz cp -r data temp ./fuzz temp/ -dict=gltf.dict -jobs=12 -workers=12 */ #define CGLTF_IMPLEMENTATION #include "../cgltf.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { cgltf_options options = {0}; cgltf_data* data = NULL; cgltf_result res = cgltf_parse(&options, Data, Size, &data); if (res == cgltf_result_success) { cgltf_validate(data); cgltf_free(data); } return 0; }
/* How to fuzz: clang main.c -O2 -g -fsanitize=address,fuzzer -o fuzz cp -r data temp ./fuzz temp/ -dict=gltf.dict -jobs=12 -workers=12 */ #define CGLTF_IMPLEMENTATION #include "../cgltf.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { cgltf_options options = {cgltf_file_type_invalid}; cgltf_data* data = NULL; cgltf_result res = cgltf_parse(&options, Data, Size, &data); if (res == cgltf_result_success) { cgltf_validate(data); cgltf_free(data); } return 0; }
Fix fuzzer to compile in C++ mode
fuzz: Fix fuzzer to compile in C++ mode
C
mit
jkuhlmann/cgltf,jkuhlmann/cgltf,jkuhlmann/cgltf
20d0fc327afebfe3be7e27725e3ed51bb54cbf42
src/settings/types/LayerIndex.h
src/settings/types/LayerIndex.h
//Copyright (c) 2018 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef LAYERINDEX_H #define LAYERINDEX_H namespace cura { /* * Struct behaving like a layer number. * * This is a facade. It behaves exactly like an integer but is used to indicate * that it is a layer number. */ struct LayerIndex { /* * Casts an integer to a LayerIndex instance. */ LayerIndex(int value) : value(value) {}; /* * Casts the LayerIndex instance to an integer. */ operator int() const { return value; } /* * The actual layer index. * * Note that this could be negative for raft layers. */ int value = 0; }; } #endif //LAYERINDEX_H
//Copyright (c) 2018 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef LAYERINDEX_H #define LAYERINDEX_H namespace cura { /* * Struct behaving like a layer number. * * This is a facade. It behaves exactly like an integer but is used to indicate * that it is a layer number. */ struct LayerIndex { /* * Casts an integer to a LayerIndex instance. */ LayerIndex(int value) : value(value) {}; /* * Casts the LayerIndex instance to an integer. */ operator int() const { return value; } LayerIndex operator +(const LayerIndex& other) const { return LayerIndex(value + other.value); } LayerIndex operator -(const LayerIndex& other) const { return LayerIndex(value - other.value); } LayerIndex& operator +=(const LayerIndex& other) { value += other.value; return *this; } LayerIndex& operator -=(const LayerIndex& other) { value -= other.value; return *this; } /* * The actual layer index. * * Note that this could be negative for raft layers. */ int value = 0; }; } #endif //LAYERINDEX_H
Add adding and subtracting operators
Add adding and subtracting operators We want to be able to add indexes together, to increment them, etc. Contributes to issue CURA-4410.
C
agpl-3.0
Ultimaker/CuraEngine,Ultimaker/CuraEngine
cf6b39580ed78e9a8e5250e8d17a7b9eab2fbf8d
include/token.h
include/token.h
#ifndef TOKEN_H_ #define TOKEN_H_ #include <iostream> #include <string> #include <vector> enum class TokenType { NUMBER, ADD, SUBTRACT, MULTIPLY, DIVIDE, EXPONENT, }; enum class OperatorType { NONE, UNARY, BINARY, EITHER, }; class Token { public: static constexpr unsigned NULL_PRECEDENCE = -1; // Operators static const Token ADD; static const Token SUBTRACT; static const Token MULTIPLY; static const Token DIVIDE; static const Token EXPONENT; friend bool operator==(const Token& left, const Token& right); friend bool operator!=(const Token& left, const Token& right); friend std::ostream& operator<<(std::ostream& out, const Token& token); public: Token(TokenType type, const std::string& symbol, unsigned precedence); static const std::vector<Token>& checkable_tokens(); // Getters TokenType type() const; OperatorType operator_type() const; const std::string& name() const; const std::string& symbol() const; double value() const; unsigned precedence() const; // Setters void set_value(double value); private: TokenType type_; const std::string symbol_; double value_; const unsigned precedence_; }; #endif // TOKEN_H_
#ifndef TOKEN_H_ #define TOKEN_H_ #include <iostream> #include <string> #include <vector> enum class TokenType { NUMBER, ADD, SUBTRACT, MULTIPLY, DIVIDE, EXPONENT, }; enum class OperatorType { NONE, UNARY, BINARY, EITHER, }; class Token { public: static constexpr unsigned NULL_PRECEDENCE = 0; // Operators static const Token ADD; static const Token SUBTRACT; static const Token MULTIPLY; static const Token DIVIDE; static const Token EXPONENT; friend bool operator==(const Token& left, const Token& right); friend bool operator!=(const Token& left, const Token& right); friend std::ostream& operator<<(std::ostream& out, const Token& token); public: Token(TokenType type, const std::string& symbol, unsigned precedence); static const std::vector<Token>& checkable_tokens(); // Getters TokenType type() const; OperatorType operator_type() const; const std::string& name() const; const std::string& symbol() const; double value() const; unsigned precedence() const; // Setters void set_value(double value); private: TokenType type_; const std::string symbol_; double value_; const unsigned precedence_; }; #endif // TOKEN_H_
Fix invalid null precedence value
Fix invalid null precedence value
C
mit
hkmix/zcalc
525a09b103cec96ed831af5d6f133111db34d2fe
kmail/kmversion.h
kmail/kmversion.h
// KMail Version Information // #ifndef kmversion_h #define kmversion_h #define KMAIL_VERSION "1.9.52" #endif /*kmversion_h*/
// KMail Version Information // #ifndef kmversion_h #define kmversion_h #define KMAIL_VERSION "1.10.0" #endif /*kmversion_h*/
Increase version for the 4.1 release
Increase version for the 4.1 release svn path=/trunk/KDE/kdepim/; revision=827634
C
lgpl-2.1
lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi
bae6f14d27925dab378f31a41be98bf0436c0ee3
core/thread/inc/TWin32Mutex.h
core/thread/inc/TWin32Mutex.h
// @(#)root/thread:$Id$ // Author: Bertrand Bellenot 20/10/2004 /************************************************************************* * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TWin32Mutex #define ROOT_TWin32Mutex ////////////////////////////////////////////////////////////////////////// // // // TWin32Mutex // // // // This class provides an interface to the Win32 mutex routines. // // // ////////////////////////////////////////////////////////////////////////// #include "TMutexImp.h" #include "Windows4Root.h" #ifdef __CINT__ struct CRITICAL_SECTION; #endif class TWin32Mutex : public TMutexImp { friend class TWin32Condition; private: CRITICAL_SECTION fCritSect; constexpr static int kIsRecursive = BIT(14); public: TWin32Mutex(Bool_t recursive=kFALSE); virtual ~TWin32Mutex(); Int_t Lock(); Int_t UnLock(); Int_t TryLock(); std::unique_ptr<TVirtualMutex::State> Reset(); void Restore(std::unique_ptr<TVirtualMutex::State> &&); ClassDef(TWin32Mutex,0) // Win32 mutex lock }; #endif
// @(#)root/thread:$Id$ // Author: Bertrand Bellenot 20/10/2004 /************************************************************************* * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TWin32Mutex #define ROOT_TWin32Mutex ////////////////////////////////////////////////////////////////////////// // // // TWin32Mutex // // // // This class provides an interface to the Win32 mutex routines. // // // ////////////////////////////////////////////////////////////////////////// #include "TMutexImp.h" #include "Windows4Root.h" #ifdef __CINT__ struct CRITICAL_SECTION; #endif class TWin32Mutex : public TMutexImp { friend class TWin32Condition; private: CRITICAL_SECTION fCritSect; enum EStatusBits { kIsRecursive = BIT(14); } public: TWin32Mutex(Bool_t recursive=kFALSE); virtual ~TWin32Mutex(); Int_t Lock(); Int_t UnLock(); Int_t TryLock(); std::unique_ptr<TVirtualMutex::State> Reset(); void Restore(std::unique_ptr<TVirtualMutex::State> &&); ClassDef(TWin32Mutex,0) // Win32 mutex lock }; #endif
Use a EStatusBits 'enum' instead of a 'constexpr static int' (allowing automatic checking for overlaps)
Use a EStatusBits 'enum' instead of a 'constexpr static int' (allowing automatic checking for overlaps)
C
lgpl-2.1
olifre/root,olifre/root,karies/root,karies/root,zzxuanyuan/root,olifre/root,karies/root,root-mirror/root,karies/root,root-mirror/root,olifre/root,root-mirror/root,olifre/root,zzxuanyuan/root,root-mirror/root,zzxuanyuan/root,zzxuanyuan/root,zzxuanyuan/root,root-mirror/root,olifre/root,zzxuanyuan/root,karies/root,zzxuanyuan/root,root-mirror/root,root-mirror/root,karies/root,olifre/root,karies/root,olifre/root,karies/root,karies/root,karies/root,karies/root,root-mirror/root,root-mirror/root,root-mirror/root,olifre/root,zzxuanyuan/root,olifre/root,zzxuanyuan/root,root-mirror/root,zzxuanyuan/root,olifre/root,zzxuanyuan/root,zzxuanyuan/root
a53a81ca5adc6febb775d912e8d326c9e69f584e
soundex.c
soundex.c
#include <err.h> #include <stdio.h> #include <stdlib.h> #include "libspell.h" #include "websters.c" int main(int argc, char **argv) { size_t i; char *soundex_code; FILE *out = fopen("dict/soundex.txt", "w"); if (out == NULL) err(EXIT_FAILURE, "Failed to open soundex"); for (i = 0; i < sizeof(dict) / sizeof(dict[0]); i++) { soundex_code = soundex(dict[i]); if (soundex_code == NULL) { warnx("No soundex code found for %s", dict[i++]); continue; } fprintf(out, "%s\t%s\n", dict[i], soundex_code); free(soundex_code); } fclose(out); return 0; }
#include <err.h> #include <stdio.h> #include <stdlib.h> #include "libspell.h" #include "websters.c" int main(int argc, char **argv) { size_t i; char *soundex_code; FILE *out = fopen("dict/soundex.txt", "w"); if (out == NULL) err(EXIT_FAILURE, "Failed to open soundex"); for (i = 0; i < sizeof(dict) / sizeof(dict[0]); i++) { soundex_code = soundex(dict[i]); if (soundex_code == NULL) { warnx("No soundex code found for %s", dict[i++]); continue; } fprintf(out, "%s\t%s\n", soundex_code, dict[i]); free(soundex_code); } fclose(out); return 0; }
Change the order of the strings
Change the order of the strings First we should output the soundex code and then the string (makes the parsing of the file easier)
C
bsd-2-clause
abhinav-upadhyay/nbspell,abhinav-upadhyay/nbspell
ffa8484eb0610048a0e8cc4f1594fd9607c5b555
include/effects/SkXfermodeImageFilter.h
include/effects/SkXfermodeImageFilter.h
/* * Copyright 2013 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkXfermodeImageFilter_DEFINED #define SkXfermodeImageFilter_DEFINED #include "SkArithmeticImageFilter.h" #include "SkBlendMode.h" #include "SkImageFilter.h" /** * This filter takes a SkBlendMode, and uses it to composite the foreground over the background. * If foreground or background is NULL, the input bitmap (src) is used instead. */ class SK_API SkXfermodeImageFilter { public: static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background, sk_sp<SkImageFilter> foreground, const SkImageFilter::CropRect* cropRect); static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) { return Make(mode, std::move(background), nullptr, nullptr); } // Need to update chrome to use SkArithmeticImageFilter instead... static sk_sp<SkImageFilter> MakeArithmetic(float k1, float k2, float k3, float k4, bool enforcePMColor, sk_sp<SkImageFilter> background, sk_sp<SkImageFilter> foreground, const SkImageFilter::CropRect* cropRect) { return SkArithmeticImageFilter::Make(k1, k2, k3, k4, enforcePMColor, std::move(background), std::move(foreground), cropRect); } SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); private: SkXfermodeImageFilter(); // can't instantiate }; #endif
/* * Copyright 2013 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkXfermodeImageFilter_DEFINED #define SkXfermodeImageFilter_DEFINED #include "SkArithmeticImageFilter.h" #include "SkBlendMode.h" #include "SkImageFilter.h" /** * This filter takes a SkBlendMode, and uses it to composite the foreground over the background. * If foreground or background is NULL, the input bitmap (src) is used instead. */ class SK_API SkXfermodeImageFilter { public: static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background, sk_sp<SkImageFilter> foreground, const SkImageFilter::CropRect* cropRect); static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) { return Make(mode, std::move(background), nullptr, nullptr); } SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); private: SkXfermodeImageFilter(); // can't instantiate }; #endif
Revert "Revert "remove unused api on xfermodeimagefilter""
Revert "Revert "remove unused api on xfermodeimagefilter"" This reverts commit 369f7eaeb06f21b1cb15e3dd3204ed883c5376f5. Reason for revert: google3 updated Original change's description: > Revert "remove unused api on xfermodeimagefilter" > > This reverts commit fcc4a071d9dff4f3bac0bd55dab8f69a4436d15d. > > Reason for revert: broke google3 roll. > > Original change's description: > > remove unused api on xfermodeimagefilter > > > > Bug: skia: > > Change-Id: If99ee7b4d959d728849a20ee43a0d0ec25196f58 > > Reviewed-on: https://skia-review.googlesource.com/20303 > > Reviewed-by: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com> > > Commit-Queue: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com> > > TBR=f5cabf8735907151a446812c9875d6c0c712d847@google.com > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > > Change-Id: I80e8b1e9009263a61230d22a988a9bb5ba7e162d > Reviewed-on: https://skia-review.googlesource.com/20320 > Reviewed-by: Hal Canary <halcanary@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> TBR=halcanary@google.com,f5cabf8735907151a446812c9875d6c0c712d847@google.com Change-Id: Icaa72fe6b1586cb76b37ab88ee1950628048d4ac No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/20312 Reviewed-by: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com> Commit-Queue: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com>
C
bsd-3-clause
google/skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,rubenvb/skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,google/skia,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,HalCanary/skia-hc,rubenvb/skia,HalCanary/skia-hc,HalCanary/skia-hc,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,rubenvb/skia,rubenvb/skia,aosp-mirror/platform_external_skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,Hikari-no-Tenshi/android_external_skia,google/skia,google/skia,google/skia,rubenvb/skia,google/skia,HalCanary/skia-hc,Hikari-no-Tenshi/android_external_skia,aosp-mirror/platform_external_skia,google/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,HalCanary/skia-hc,rubenvb/skia,rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,HalCanary/skia-hc,rubenvb/skia,google/skia,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,aosp-mirror/platform_external_skia,google/skia
e72fab9520d4e809786ddd7d6e1b6da57d546bfa
dtool/src/dtoolutil/config_dtoolutil.h
dtool/src/dtoolutil/config_dtoolutil.h
/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file config_dtoolutil.h * @author drose * @date 2006-11-17 */ #ifndef CONFIG_DTOOLUTIL_H #define CONFIG_DTOOLUTIL_H #include "dtoolbase.h" // Include this so interrogate can find it. #include <iostream> #endif
/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file config_dtoolutil.h * @author drose * @date 2006-11-17 */ #ifndef CONFIG_DTOOLUTIL_H #define CONFIG_DTOOLUTIL_H #include "dtoolbase.h" // Include this so interrogate can find it. #include <iostream> extern EXPCL_DTOOL_DTOOLUTIL void init_libdtoolutil(); #endif
Add missing declaration for init_libdtoolutil()
dtoolutil: Add missing declaration for init_libdtoolutil()
C
bsd-3-clause
chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d
96b3dc4e1dbcc002e9d69ff6fb451909387d05e4
libraries/clib/native/Throwable.c
libraries/clib/native/Throwable.c
/* * java.lang.Throwable.c * * Copyright (c) 1996, 1997 * Transvirtual Technologies, Inc. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */ #include "config.h" #include "config-io.h" #include <assert.h> #include <native.h> #include "java_io_FileDescriptor.h" #include "java_io_FileOutputStream.h" #include "java_io_PrintStream.h" #include "java_lang_Throwable.h" #include "../../../kaffe/kaffevm/support.h" extern Hjava_lang_Object* buildStackTrace(void*); extern void printStackTrace(struct Hjava_lang_Throwable*, struct Hjava_lang_Object*); /* * Fill in stack trace information - don't know what thought. */ struct Hjava_lang_Throwable* java_lang_Throwable_fillInStackTrace(struct Hjava_lang_Throwable* o) { unhand(o)->backtrace = buildStackTrace(0); return (o); } /* * Dump the stack trace to the given stream. */ void java_lang_Throwable_printStackTrace0(struct Hjava_lang_Throwable* o, struct Hjava_lang_Object* p) { printStackTrace(o, p); }
/* * java.lang.Throwable.c * * Copyright (c) 1996, 1997 * Transvirtual Technologies, Inc. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */ #include "config.h" #include "config-io.h" #include <assert.h> #include <native.h> #include "java_io_FileDescriptor.h" #include "java_io_FileOutputStream.h" #include "java_io_PrintStream.h" #include "java_lang_Throwable.h" #include "../../../kaffe/kaffevm/support.h" extern Hjava_lang_Object* buildStackTrace(void*); extern void printStackTrace(struct Hjava_lang_Throwable*, struct Hjava_lang_Object*, int); /* * Fill in stack trace information - don't know what thought. */ struct Hjava_lang_Throwable* java_lang_Throwable_fillInStackTrace(struct Hjava_lang_Throwable* o) { unhand(o)->backtrace = buildStackTrace(0); return (o); } /* * Dump the stack trace to the given stream. */ void java_lang_Throwable_printStackTrace0(struct Hjava_lang_Throwable* o, struct Hjava_lang_Object* p) { printStackTrace(o, p, 0); }
Adjust for new paramter to printStackTrace().
Adjust for new paramter to printStackTrace().
C
lgpl-2.1
kaffe/kaffe,kaffe/kaffe,kaffe/kaffe,kaffe/kaffe,kaffe/kaffe
fed5b68b9fdf3a3196ae39609b7ae217999b094f
src/cc/common.h
src/cc/common.h
/* * Copyright (c) 2015 PLUMgrid, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <memory> #include <string> #include <unistd.h> #include <vector> namespace ebpf { template <class T, class... Args> typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(Args &&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } std::vector<int> get_online_cpus(); std::vector<int> get_possible_cpus(); std::string get_pid_exe(pid_t pid); } // namespace ebpf
/* * Copyright (c) 2015 PLUMgrid, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <memory> #include <string> #include <unistd.h> #include <vector> namespace ebpf { #ifdef __cpp_lib_make_unique using std::make_unique; #else template <class T, class... Args> typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(Args &&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } #endif std::vector<int> get_online_cpus(); std::vector<int> get_possible_cpus(); std::string get_pid_exe(pid_t pid); } // namespace ebpf
Use the STL's make_unique if available
Use the STL's make_unique if available Fixes build errors with GCC7.3.1 + LLVM5.0.1 under Centos. /bcc/src/cc/frontends/b/loader.cc: In member function 'int ebpf::BLoader::parse(llvm::Module*, const string&, const string&, ebpf::TableStorage&, const string&, const string&)': /bcc/src/cc/frontends/b/loader.cc:39:63: error: call of overloaded 'make_unique<ebpf::cc::Parser>(const string&)' is ambiguous proto_parser_ = make_unique<ebpf::cc::Parser>(proto_filename); ^ In file included from /bcc/src/cc/frontends/b/node.h:26:0, from /bcc/src/cc/frontends/b/parser.h:20, from /bcc/src/cc/frontends/b/loader.cc:17: /bcc/src/cc/common.h:28:1: note: candidate: typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), std::unique_ptr<_Tp> >::type e/* bpf::make_unique(Args&& ...) [with T = ebpf::cc::Parser; Args = {const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), std::unique_ptr<_Tp> >::type = std::unique_ptr<ebpf::cc::Parser>] make_unique(Args &&... args) { ^~~~~~~~~~~ In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/memory:80:0, from /bcc/src/cc/frontends/b/node.h:22, from /bcc/src/cc/frontends/b/parser.h:20, from /bcc/src/cc/frontends/b/loader.cc:17: /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/unique_ptr.h:824:5: note: candidate: typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = ebpf::cc::Parser; _Args = {const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<ebpf::cc::Parser>] make_unique(_Args&&... __args) ^~~~~~~~~~~ Signed-off-by: Kyle Zhang <3c25b01657254677d3e1a8fd1f0742c5d489bd39@smartx.com>
C
apache-2.0
tuxology/bcc,brendangregg/bcc,iovisor/bcc,tuxology/bcc,brendangregg/bcc,brendangregg/bcc,iovisor/bcc,tuxology/bcc,iovisor/bcc,iovisor/bcc,brendangregg/bcc,tuxology/bcc,tuxology/bcc,iovisor/bcc,brendangregg/bcc
db41cf2df6c16cec5bc7834b6932a276dc49324e
arch/sparc/include/asm/asmmacro.h
arch/sparc/include/asm/asmmacro.h
/* asmmacro.h: Assembler macros. * * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu) */ #ifndef _SPARC_ASMMACRO_H #define _SPARC_ASMMACRO_H #include <asm/btfixup.h> #include <asm/asi.h> #define GET_PROCESSOR4M_ID(reg) \ rd %tbr, %reg; \ srl %reg, 12, %reg; \ and %reg, 3, %reg; #define GET_PROCESSOR4D_ID(reg) \ lda [%g0] ASI_M_VIKING_TMP1, %reg; /* All trap entry points _must_ begin with this macro or else you * lose. It makes sure the kernel has a proper window so that * c-code can be called. */ #define SAVE_ALL_HEAD \ sethi %hi(trap_setup), %l4; \ jmpl %l4 + %lo(trap_setup), %l6; #define SAVE_ALL \ SAVE_ALL_HEAD \ nop; /* All traps low-level code here must end with this macro. */ #define RESTORE_ALL b ret_trap_entry; clr %l6; /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+ likes byte accesses. These are to avoid ifdef mania. */ #define lduXa lduba #define stXa stba #endif /* !(_SPARC_ASMMACRO_H) */
/* asmmacro.h: Assembler macros. * * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu) */ #ifndef _SPARC_ASMMACRO_H #define _SPARC_ASMMACRO_H #include <asm/btfixup.h> #include <asm/asi.h> #define GET_PROCESSOR4M_ID(reg) \ rd %tbr, %reg; \ srl %reg, 12, %reg; \ and %reg, 3, %reg; #define GET_PROCESSOR4D_ID(reg) \ lda [%g0] ASI_M_VIKING_TMP1, %reg; /* All trap entry points _must_ begin with this macro or else you * lose. It makes sure the kernel has a proper window so that * c-code can be called. */ #define SAVE_ALL_HEAD \ sethi %hi(trap_setup), %l4; \ jmpl %l4 + %lo(trap_setup), %l6; #define SAVE_ALL \ SAVE_ALL_HEAD \ nop; /* All traps low-level code here must end with this macro. */ #define RESTORE_ALL b ret_trap_entry; clr %l6; #endif /* !(_SPARC_ASMMACRO_H) */
Remove ldXa and stXa defines, unused.
sparc32: Remove ldXa and stXa defines, unused. These were for sharing some MMU code between sun4 and sun4c. Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
C
mit
KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,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,TeamVee-Kanas/android_kernel_samsung_kanas
1e8ee5c91c4f254e5247f1c50bc4eb5e0edb09a6
ComponentKit/HostingView/CKComponentRootViewInternal.h
ComponentKit/HostingView/CKComponentRootViewInternal.h
/* * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #import <UIKit/UIKit.h> typedef UIView *(^CKComponentRootViewHitTestHook)(CKComponentRootView *rootView, CGPoint point, UIEvent *event); @interface CKComponentRootView () /** Exposes the ability to supplement the hitTest for the root view used in each CKComponentHostingView or UICollectionViewCell within a CKCollectionViewDataSource. Each hook will be called in the order they were registered. If any hook returns a view, that will override the return value of the view's -hitTest:withEvent:. If no hook returns a view, then the super implementation will be invoked. */ + (void)addHitTestHook:(CKComponentRootViewHitTestHook)hook; /** Returns an array of all registered hit test hooks. */ + (NSArray *)hitTestHooks; @end
/* * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #import <UIKit/UIKit.h> #import <ComponentKit/CKComponentRootView.h> typedef UIView *(^CKComponentRootViewHitTestHook)(UIView *rootView, CGPoint point, UIEvent *event); @interface CKComponentRootView () /** Exposes the ability to supplement the hitTest for the root view used in each CKComponentHostingView or UICollectionViewCell within a CKCollectionViewDataSource. Each hook will be called in the order they were registered. If any hook returns a view, that will override the return value of the view's -hitTest:withEvent:. If no hook returns a view, then the super implementation will be invoked. */ + (void)addHitTestHook:(CKComponentRootViewHitTestHook)hook; /** Returns an array of all registered hit test hooks. */ + (NSArray *)hitTestHooks; @end
Change type of view passed to hit test hooks
Change type of view passed to hit test hooks If we want to support non-CKComponentRootViews that use these hooks, it has to be a generic UIView.
C
bsd-3-clause
ezc/componentkit,dshahidehpour/componentkit,avnerbarr/componentkit,dstnbrkr/componentkit,SummerHanada/componentkit,mcohnen/componentkit,adamdahan/componentkit,pairyo/componentkit,mcohnen/componentkit,stevielu/componentkit,avnerbarr/componentkit,inbilin-inc/componentkit,lydonchandra/componentkit,liyong03/componentkit,adamdahan/componentkit,inbilin-inc/componentkit,Jericho25/componentkit_JeckoHero,claricetechnologies/componentkit,adamjernst/componentkit,claricetechnologies/componentkit,mcohnen/componentkit,yiding/componentkit,stevielu/componentkit,eczarny/componentkit,IveWong/componentkit,aaronschubert0/componentkit,modocache/componentkit,21451061/componentkit,ezc/componentkit,TribeMedia/componentkit,MDSilber/componentkit,wee/componentkit,MDSilber/componentkit,stevielu/componentkit,IveWong/componentkit,Eric-LeiYang/componentkit,eczarny/componentkit,ezc/componentkit,yiding/componentkit,ezc/componentkit,dstnbrkr/componentkit,TribeMedia/componentkit,leoschweizer/componentkit,dshahidehpour/componentkit,Eric-LeiYang/componentkit,Jericho25/componentkit_JeckoHero,yiding/componentkit,pairyo/componentkit,darknoon/componentkitx,21451061/componentkit,darknoon/componentkitx,wee/componentkit,modocache/componentkit,modocache/componentkit,smalllixin/componentkit,modocache/componentkit,eczarny/componentkit,stevielu/componentkit,TribeMedia/componentkit,aaronschubert0/componentkit,pairyo/componentkit,yiding/componentkit,dshahidehpour/componentkit,leoschweizer/componentkit,MDSilber/componentkit,aaronschubert0/componentkit,darknoon/componentkitx,21451061/componentkit,dstnbrkr/componentkit,Jericho25/componentkit_JeckoHero,lydonchandra/componentkit,claricetechnologies/componentkit,MDSilber/componentkit,lydonchandra/componentkit,SummerHanada/componentkit,liyong03/componentkit,leoschweizer/componentkit,bricooke/componentkit,inbilin-inc/componentkit,bricooke/componentkit,liyong03/componentkit,IveWong/componentkit,adamdahan/componentkit,avnerbarr/componentkit,SummerHanada/componentkit,Jericho25/componentkit_JeckoHero,pairyo/componentkit,lydonchandra/componentkit,21451061/componentkit,ernestopino/componentkit,ernestopino/componentkit,aaronschubert0/componentkit,wee/componentkit,dstnbrkr/componentkit,mcohnen/componentkit,SummerHanada/componentkit,ernestopino/componentkit,smalllixin/componentkit,leoschweizer/componentkit,adamdahan/componentkit,smalllixin/componentkit,ernestopino/componentkit,liyong03/componentkit,claricetechnologies/componentkit,Eric-LeiYang/componentkit,bricooke/componentkit,adamjernst/componentkit,smalllixin/componentkit,IveWong/componentkit,avnerbarr/componentkit,adamjernst/componentkit,wee/componentkit,inbilin-inc/componentkit,darknoon/componentkitx,adamjernst/componentkit,TribeMedia/componentkit,bricooke/componentkit,Eric-LeiYang/componentkit
0605946badd1b4d71fa0568a189c2ff5be6fc660
SurgSim/Framework/Component-inl.h
SurgSim/Framework/Component-inl.h
// This file is a part of the OpenSurgSim project. // Copyright 2013, SimQuest Solutions Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SURGSIM_FRAMEWORK_COMPONENT_INL_H #define SURGSIM_FRAMEWORK_COMPONENT_INL_H namespace SurgSim { namespace Framework { template <class Target, class Source> std::shared_ptr<Target> checkAndConvert(std::shared_ptr<Source> incoming, const std::string& expectedTypeName) { auto result = std::dynamic_pointer_cast<Target>(incoming); SURGSIM_ASSERT(incoming != nullptr && result != nullptr) << "Expected " << expectedTypeName << " but received " << incoming->getClassName() << " which cannot " << "be converted."; return result; }; } } #endif
// This file is a part of the OpenSurgSim project. // Copyright 2013, SimQuest Solutions Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SURGSIM_FRAMEWORK_COMPONENT_INL_H #define SURGSIM_FRAMEWORK_COMPONENT_INL_H namespace SurgSim { namespace Framework { template <class Target, class Source> std::shared_ptr<Target> checkAndConvert(std::shared_ptr<Source> incoming, const std::string& expectedTypeName) { SURGSIM_ASSERT(incoming != nullptr) << "Incoming pointer can't be nullptr"; auto result = std::dynamic_pointer_cast<Target>(incoming); SURGSIM_ASSERT(result != nullptr) << "Expected " << expectedTypeName << " but received " << incoming->getClassName() << " which cannot " << "be converted, in component " << incoming->getFullName() << "."; return result; }; } } #endif
Fix check against nullptr in checkandconvert
Fix check against nullptr in checkandconvert
C
apache-2.0
simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim
d387e1648e5f30d40d811ae6c5a89726b621cfdb
src/Layer.h
src/Layer.h
#ifndef LAYER_H_ #define LAYER_H_ class Layer { public: virtual void render()=0; virtual void update()=0; protected: virtual ~Layer(); }; #endif
#ifndef LAYER_H_ #define LAYER_H_ //Abstract layer class class Layer { public: virtual void render()=0; virtual void update()=0; protected: virtual ~Layer() {} }; #endif
Make sure layer class is destructed first
Make sure layer class is destructed first
C
mit
metatrevor/mchezo-engine,metatrevor/mchezo-engine
6dde82a036afb3d1a6e012f2f8273b401c8b47d1
gnu/lib/libregex/gnuregex.h
gnu/lib/libregex/gnuregex.h
/* $FreeBSD$ */ #warning "<gnuregex.h> has been replaced by <gnu/regex.h>" #include <gnu/regex.h>
/*- * Copyright (c) 2004 David E. O'Brien * Copyright (c) 2004 Andrey A. Chernov * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifdef __GNUC__ #warning "<gnuregex.h> has been replaced by <gnu/regex.h>" #endif #include <gnu/regex.h>
Allow to compile with non-GCC compiler.
Allow to compile with non-GCC compiler.
C
bsd-3-clause
jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase
5c31ae8d7724618d27315791605449d7693bde78
ppu/include/sysutil/sysutil.h
ppu/include/sysutil/sysutil.h
#ifndef __LV2_SYSUTIL_H__ #define __LV2_SYSUTIL_H__ #include <ppu-types.h> #define SYSUTIL_EVENT_SLOT0 0 #define SYSUTIL_EVENT_SLOT1 1 #define SYSUTIL_EVENT_SLOT2 2 #define SYSUTIL_EVENT_SLOT3 3 #define SYSUTIL_EXIT_GAME 0x0101 #define SYSUTIL_DRAW_BEGIN 0x0121 #define SYSUTIL_DRAW_END 0x0122 #define SYSUTIL_MENU_OPEN 0x0131 #define SYSUTIL_MENU_CLOSE 0x0132 #ifdef __cplusplus extern "C" { #endif typedef void (*sysutilCallback)(u64 status,u64 param,void *usrdata); s32 sysUtilCheckCallback(); s32 sysUtilUnregisterCallback(s32 slot); s32 sysUtilRegisterCallback(s32 slot,sysutilCallback cb,void *usrdata); #ifdef __cplusplus } #endif #endif
#ifndef __LV2_SYSUTIL_H__ #define __LV2_SYSUTIL_H__ #include <ppu-types.h> #define SYSUTIL_EVENT_SLOT0 0 #define SYSUTIL_EVENT_SLOT1 1 #define SYSUTIL_EVENT_SLOT2 2 #define SYSUTIL_EVENT_SLOT3 3 #define SYSUTIL_EXIT_GAME 0x0101 #define SYSUTIL_DRAW_BEGIN 0x0121 #define SYSUTIL_DRAW_END 0x0122 #define SYSUTIL_MENU_OPEN 0x0131 #define SYSUTIL_MENU_CLOSE 0x0132 #define SYSUTIL_OSK_LOADED 0x0502 #define SYSUTIL_OSK_DONE 0x0503 #define SYSUTIL_OSK_UNLOADED 0x0504 #ifdef __cplusplus extern "C" { #endif typedef void (*sysutilCallback)(u64 status,u64 param,void *usrdata); s32 sysUtilCheckCallback(); s32 sysUtilUnregisterCallback(s32 slot); s32 sysUtilRegisterCallback(s32 slot,sysutilCallback cb,void *usrdata); #ifdef __cplusplus } #endif #endif
Add defines for OSK event ids
Add defines for OSK event ids
C
mit
ps3dev/PSL1GHT,ps3dev/PSL1GHT,ps3dev/PSL1GHT,ps3dev/PSL1GHT
124b9d9f70d198fd7ad220e75ad5c7fded10474f
src/minunit.h
src/minunit.h
/* http://www.jera.com/techinfo/jtns/jtn002.html */ #define mu_assert(message, test) do { if (!(test)) return message; } while (0) #define mu_run_test(testname, test) \ do { \ char *message = test(); tests_run++; \ if (message) return message; \ else printf("OK: %s\n", testname); \ } while (0) extern int tests_run;
/* http://www.jera.com/techinfo/jtns/jtn002.html */ #define mu_assert(message, test) \ do { \ if (!(test)) \ return message; \ } while (0) #define mu_run_test(testname, test) \ do { \ char *message = test(); tests_run++; \ if (message) return message; \ else printf("OK: %s\n", testname); \ } while (0) extern int tests_run;
Split macro into multiple lines.
Split macro into multiple lines.
C
mit
profan/yet-another-brainfuck-interpreter
9246d17556bfb4e9e5ba05f90ca3983dd7ad28d3
Preferences/PSSwitchTableCell.h
Preferences/PSSwitchTableCell.h
#import "PSControlTableCell.h" @class UIActivityIndicatorView; @interface PSSwitchTableCell : PSControlTableCell { UIActivityIndicatorView *_activityIndicator; } @property BOOL loading; - (BOOL)loading; - (void)setLoading:(BOOL)loading; - (id)controlValue; - (id)newControl; - (void)setCellEnabled:(BOOL)enabled; - (void)refreshCellContentsWithSpecifier:(id)specifier; - (id)initWithStyle:(int)style reuseIdentifier:(id)identifier specifier:(id)specifier; - (void)reloadWithSpecifier:(id)specifier animated:(BOOL)animated; - (BOOL)canReload; - (void)prepareForReuse; - (void)layoutSubviews; - (void)setValue:(id)value; @end
#import "PSControlTableCell.h" @class UIActivityIndicatorView; @interface PSSwitchTableCell : PSControlTableCell { UIActivityIndicatorView *_activityIndicator; } @property (nonatomic) BOOL loading; @end
Clean up what looks like a direct class-dump header.
[Preferences] Clean up what looks like a direct class-dump header.
C
unlicense
hbang/headers,hbang/headers
288f2d1cfa42f8b380ef6a3e3f175a8b474f8303
thread_tree.h
thread_tree.h
/* * Raphael Kubo da Costa - RA 072201 * * MC514 - Lab2 */ #ifndef __THREAD_TREE_H #define __THREAD_TREE_H typedef struct { size_t n_elem; pthread_t *list; } ThreadLevel; typedef struct { size_t height; ThreadLevel **tree; } ThreadTree; ThreadTree *thread_tree_new(size_t numthreads); void thread_tree_free(ThreadTree *tree); #endif /* __THREAD_TREE_H */
/* * Raphael Kubo da Costa - RA 072201 * * MC514 - Lab2 */ #ifndef __THREAD_TREE_H #define __THREAD_TREE_H typedef struct { size_t *interested; pthread_t *list; size_t n_elem; size_t turn; } ThreadLevel; typedef struct { size_t height; ThreadLevel **tree; } ThreadTree; ThreadTree *thread_tree_new(size_t numthreads); void thread_tree_free(ThreadTree *tree); #endif /* __THREAD_TREE_H */
Add turn and interested fields per level
Add turn and interested fields per level
C
bsd-2-clause
rakuco/peterson_futex
d84323ce8cd37c5b88a84e8a8ca2e80dc2b51acc
WordPressCom-Stats-iOS/StatsSection.h
WordPressCom-Stats-iOS/StatsSection.h
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionAuthors, StatsSectionSearchTerms, StatsSectionComments, StatsSectionTagsCategories, StatsSectionFollowers, StatsSectionPublicize, StatsSectionWebVersion }; typedef NS_ENUM(NSInteger, StatsSubSection) { StatsSubSectionCommentsByAuthor = 100, StatsSubSectionCommentsByPosts, StatsSubSectionFollowersDotCom, StatsSubSectionFollowersEmail, StatsSubSectionNone };
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionAuthors, StatsSectionSearchTerms, StatsSectionComments, StatsSectionTagsCategories, StatsSectionFollowers, StatsSectionPublicize, StatsSectionWebVersion, StatsSectionPostDetailsGraph, StatsSectionPostDetailsMonthsYears, StatsSectionPostDetailsAveragePerDay, StatsSectionPostDetailsRecentWeeks }; typedef NS_ENUM(NSInteger, StatsSubSection) { StatsSubSectionCommentsByAuthor = 100, StatsSubSectionCommentsByPosts, StatsSubSectionFollowersDotCom, StatsSubSectionFollowersEmail, StatsSubSectionNone };
Add new sections for post details
Add new sections for post details
C
mit
wordpress-mobile/WordPressCom-Stats-iOS,wordpress-mobile/WordPressCom-Stats-iOS
d81b288141955127e3752502433f674276cde50b
3RVX/OSD/EjectOSD.h
3RVX/OSD/EjectOSD.h
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once #include <Windows.h> #include "OSD.h" class NotifyIcon; class EjectOSD : public OSD { public: EjectOSD(); virtual void Hide(); virtual void ProcessHotkeys(HotkeyInfo &hki); private: DWORD _ignoreDrives; DWORD _latestDrive; MeterWnd _mWnd; NotifyIcon *_icon; std::vector<HICON> _iconImages; void EjectDrive(std::wstring driveLetter); DWORD DriveLetterToMask(wchar_t letter); wchar_t MaskToDriveLetter(DWORD mask); virtual void OnDisplayChange(); virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); };
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once #include <Windows.h> #include <thread> #include "OSD.h" class NotifyIcon; class EjectOSD : public OSD { public: EjectOSD(); virtual void Hide(); virtual void ProcessHotkeys(HotkeyInfo &hki); private: DWORD _ignoreDrives; DWORD _latestDrive; MeterWnd _mWnd; NotifyIcon *_icon; std::vector<HICON> _iconImages; std::thread _menuThread; void EjectDrive(std::wstring driveLetter); DWORD DriveLetterToMask(wchar_t letter); wchar_t MaskToDriveLetter(DWORD mask); virtual void OnDisplayChange(); virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); };
Add thread member for offloading disk info ops
Add thread member for offloading disk info ops
C
bsd-2-clause
malensek/3RVX,malensek/3RVX,malensek/3RVX
f891b7d3d09f152adf06bf8442d50f48f85650b8
Source/CAFMatchedTextViewController.h
Source/CAFMatchedTextViewController.h
// // CAFMatchedTextViewController.h // Curiosity // // Created by Matthew Thomas on 8/26/12. // Copyright (c) 2012 Matthew Thomas. All rights reserved. // #import <UIKit/UIKit.h> @interface CAFMatchedTextViewController : UIViewController @end
// // CAFMatchedTextViewController.h // Curiosity // // Created by Matthew Thomas on 8/26/12. // Copyright (c) 2012 Matthew Thomas. All rights reserved. // #import <UIKit/UIKit.h> @interface CAFMatchedTextViewController : UIViewController @property (copy, nonatomic) NSString *regexString; @property (copy, nonatomic) NSString *inputText; @end
Add regexString and inputText properties
Add regexString and inputText properties
C
mit
codecaffeine/Curiosity
796459a7cee33cf44961193ad6751ac6edb5e94b
source/tid/enums.h
source/tid/enums.h
#pragma once #include <exception> #include <string_view> namespace tid { enum level : int { parent = -1, normal = 0, detail = 1, pedant = 2, }; constexpr std::string_view level2sv(level l) noexcept { switch(l) { case normal: return "normal"; case detail: return "detail"; case pedant: return "pedant"; case parent: return "parent"; default: return "unknown"; } } } template<typename T> extern constexpr std::string_view enum2sv(const T &item); template<typename T> extern constexpr auto sv2enum(std::string_view item); template<> constexpr std::string_view enum2sv(const tid::level &item) { switch(item) { case(tid::level::normal): return "normal"; case(tid::level::detail): return "detail"; case(tid::level::pedant): return "pedant"; case(tid::level::parent): return "parent"; default: throw std::runtime_error("Unrecognized tid::level enum"); } } template<> constexpr auto sv2enum<tid::level>(std::string_view item) { if(item == "normal") return tid::level::normal; if(item == "detail") return tid::level::detail; if(item == "pedant") return tid::level::pedant; if(item == "parent") return tid::level::parent; throw std::runtime_error("Given item is not a tid::level enum"); }
#pragma once #include <stdexcept> #include <string_view> namespace tid { enum level : int { parent = -1, normal = 0, detail = 1, pedant = 2, }; constexpr std::string_view level2sv(level l) noexcept { switch(l) { case normal: return "normal"; case detail: return "detail"; case pedant: return "pedant"; case parent: return "parent"; default: return "unknown"; } } } template<typename T> extern constexpr std::string_view enum2sv(const T &item); template<typename T> extern constexpr auto sv2enum(std::string_view item); template<> constexpr std::string_view enum2sv(const tid::level &item) { switch(item) { case(tid::level::normal): return "normal"; case(tid::level::detail): return "detail"; case(tid::level::pedant): return "pedant"; case(tid::level::parent): return "parent"; default: throw std::runtime_error("Unrecognized tid::level enum"); } } template<> constexpr auto sv2enum<tid::level>(std::string_view item) { if(item == "normal") return tid::level::normal; if(item == "detail") return tid::level::detail; if(item == "pedant") return tid::level::pedant; if(item == "parent") return tid::level::parent; throw std::runtime_error("Given item is not a tid::level enum"); }
Fix include headers after refactor
Fix include headers after refactor Former-commit-id: f04e7d0471916735efc4fa7ea53c6a2db72fe8ab
C
mit
DavidAce/DMRG,DavidAce/DMRG,DavidAce/DMRG,DavidAce/DMRG
c239d6c8971bcba2a7875ace59936e258562934a
i2c.h
i2c.h
/* * Copyright (c) 2013 by Kyle Isom <kyle@tyrfingr.is>. * * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM 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. */ #ifndef __I2C_H__ #define __I2C_H__ void i2c_init(); int i2c_sendbyte(int, unsigned int, unsigned int, char); #endif
/* * Copyright (c) 2013 by Kyle Isom <kyle@tyrfingr.is>. * * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM 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. */ #ifndef __I2C_H__ #define __I2C_H__ void i2c_init(); int i2c_sendbyte(int, unsigned int, unsigned int, char); int i2c_readbyte(int, unsigned int, unsigned int, char *); #endif
Add missing declaration to header.
Add missing declaration to header.
C
isc
isrlabs/avr-tools,isrlabs/avr-tools
b8a8116b485bca23f277240d459f3ba0f560b42b
AFToolkit/ObjectProvider/AFObjectModel.h
AFToolkit/ObjectProvider/AFObjectModel.h
#pragma mark Class Interface @interface AFObjectModel : NSObject #pragma mark - Properties @property (nonatomic, strong, readonly) NSArray *key; @property (nonatomic, strong, readonly) NSDictionary *mappings; @property (nonatomic, strong, readonly) NSDictionary *transformers; #pragma mark - Constructors - (id)initWithKey: (NSArray *)key mappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; #pragma mark - Static Methods + (id)objectModelWithKey: (NSArray *)key mappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; + (id)objectModelWithMappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; + (id)objectModelWithKey: (NSArray *)key mappings: (NSDictionary *)mappings; + (id)objectModelWithMappings: (NSDictionary *)mappings; + (id)objectModelForClass: (Class)myClass; @end #pragma mark AFObjectModel Protocol @protocol AFObjectModel<NSObject> @required - (AFObjectModel *)objectModel; @optional + (void)update: (id)value values: (NSDictionary *)values provider: (id)provider; @end
#pragma mark Class Interface @interface AFObjectModel : NSObject #pragma mark - Properties @property (nonatomic, strong, readonly) NSArray *key; @property (nonatomic, strong, readonly) NSDictionary *mappings; @property (nonatomic, strong, readonly) NSDictionary *transformers; #pragma mark - Constructors - (id)initWithKey: (NSArray *)key mappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; #pragma mark - Static Methods + (id)objectModelWithKey: (NSArray *)key mappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; + (id)objectModelWithMappings: (NSDictionary *)mappings transformers: (NSDictionary *)transformers; + (id)objectModelWithKey: (NSArray *)key mappings: (NSDictionary *)mappings; + (id)objectModelWithMappings: (NSDictionary *)mappings; + (id)objectModelForClass: (Class)myClass; @end #pragma mark AFObjectModel Protocol @protocol AFObjectModel<NSObject> @required + (AFObjectModel *)objectModel; @optional + (void)update: (id)value values: (NSDictionary *)values provider: (id)provider; @end
Make objectModel protocol method static.
Make objectModel protocol method static.
C
mit
mlatham/AFToolkit
7e7ec2f533ee4ff14372f76f23701e726651f27d
src/cxa_finalize.c
src/cxa_finalize.c
void __cxa_finalize(void *d ); extern void __dso_handle; __attribute((destructor)) static void cleanup(void) { __cxa_finalize(&__dso_handle); }
/** * Copyright (c) 2012 David Chisnall. * This work was funded by TBricks. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * */ void __cxa_finalize(void *d ); extern void __dso_handle; __attribute((destructor)) static void cleanup(void) { __cxa_finalize(&__dso_handle); }
Add missing copyright in the other file.
Add missing copyright in the other file.
C
bsd-2-clause
sudosurootdev/external_libcxxrt,xin3liang/platform_external_libcxxrt,vegard/libcxxrt,vegard/libcxxrt,cemeyer/libcxxrt,cemeyer/libcxxrt,sudosurootdev/external_libcxxrt,vegard/libcxxrt,sudosurootdev/external_libcxxrt,cemeyer/libcxxrt,xin3liang/platform_external_libcxxrt,xin3liang/platform_external_libcxxrt
9e7a287e2d334dbfecd3b8ed1c07b2c84ad9a085
Pinmark/PMPinboardService.h
Pinmark/PMPinboardService.h
// // PMPinboardService.h // Pinmarker // // Created by Kyle Stevens on 9/24/14. // Copyright (c) 2014 kilovolt42. All rights reserved. // @class PMBookmark; @interface PMPinboardService : NSObject + (void)requestAPITokenForAPIToken:(NSString *)token success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure; + (void)requestAPITokenForUsername:(NSString *)username password:(NSString *)password success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure; + (void)requestTagsForAPIToken:(NSString *)token success:(void (^)(NSDictionary *))success failure:(void (^)(NSError *))failure; + (void)requestPostForURL:(NSString *)url APIToken:(NSString *)token success:(void (^)(NSDictionary *))success failure:(void (^)(NSError *))failure; + (void)postBookmarkParameters:(NSDictionary *)parameters APIToken:(NSString *)token success:(void (^)(id))success failure:(void (^)(NSError *, id))failure; @end
// // PMPinboardService.h // Pinmarker // // Created by Kyle Stevens on 9/24/14. // Copyright (c) 2014 kilovolt42. All rights reserved. // @interface PMPinboardService : NSObject + (void)requestAPITokenForAPIToken:(NSString *)token success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure; + (void)requestAPITokenForUsername:(NSString *)username password:(NSString *)password success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure; + (void)requestTagsForAPIToken:(NSString *)token success:(void (^)(NSDictionary *))success failure:(void (^)(NSError *))failure; + (void)requestPostForURL:(NSString *)url APIToken:(NSString *)token success:(void (^)(NSDictionary *))success failure:(void (^)(NSError *))failure; + (void)postBookmarkParameters:(NSDictionary *)parameters APIToken:(NSString *)token success:(void (^)(id))success failure:(void (^)(NSError *, id))failure; @end
Remove unnecessary forward class declaration
Remove unnecessary forward class declaration
C
mit
kilovolt42/Pinmarker,kilovolt42/Pinmarker,kilovolt42/Pinmarker
324384b631761fc034fafd80e8396e7d3d15203d
benchmarks/c/examples/simple_math/main.c
benchmarks/c/examples/simple_math/main.c
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> #include "math.h" int main() { float a; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif float b = a - a; assert(sin(b) == 0.0f); return 0; }
#ifdef KLEE #include "klee/klee.h" #endif #include <assert.h> #include <stdio.h> #include "math.h" int main() { float a = 0.0f; #ifdef KLEE klee_make_symbolic(&a, sizeof(a), "a"); #endif if (isnan(a) || isinf(a)) { // assertion won't hold in these cases so exit early return 0; } float b = a - a; assert(sin(b) == 0.0f); return 0; }
Fix mistake in example benchmark that is supposed to be correct. The NaN and infinity cases were not considered.
Fix mistake in example benchmark that is supposed to be correct. The NaN and infinity cases were not considered.
C
bsd-3-clause
delcypher/fp-bench,delcypher/fp-bench,delcypher/fp-bench
c627504b77b68b133ce2cde73d192e4c40f436a5
TrailsKit/TrailsKit.h
TrailsKit/TrailsKit.h
// // TrailsKit.h // TrailsKit // // Created by Mike Mertsock on 1/1/13. // Copyright (c) 2013 Esker Apps. All rights reserved. // #ifndef TrailsKit_TrailsKit_h #define TrailsKit_TrailsKit_h #import "TrailsKitGeometry.h" #import "TKGPXPolylineMapper.h" #import "TrailsKitUI.h" #import "TrailsKitTypes.h" #endif
// // TrailsKit.h // TrailsKit // // Created by Mike Mertsock on 1/1/13. // Copyright (c) 2013 Esker Apps. All rights reserved. // #ifndef TrailsKit_TrailsKit_h #define TrailsKit_TrailsKit_h #import "TrailsKitGeometry.h" #import "TrailsKitParsers.h" #import "TrailsKitTypes.h" #import "TrailsKitUI.h" #endif
Add parsers header to root header
Add parsers header to root header
C
mit
mmertsock/TrailsKit
e0fa191cf75370ca96af601a029aa85e632a2ec3
SSPSolution/SSPSolution/GameStateHandler.h
SSPSolution/SSPSolution/GameStateHandler.h
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> #define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<GameState*> m_statesToRemove; public: GameStateHandler(); ~GameStateHandler(); int ShutDown(); int Initialize(ComponentHandler* cHandler, Camera* cameraRef); int Update(float dt, InputHandler* inputHandler); //Push a state to the stack int PushStateToStack(GameState* state); private: }; #endif
#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H #include "GameState.h" #include "StartState.h" #include "LevelSelectState.h" #include <vector> //#define START_WITHOUT_MENU class GameStateHandler { private: std::vector<GameState*> m_stateStack; std::vector<GameState*> m_statesToRemove; public: GameStateHandler(); ~GameStateHandler(); int ShutDown(); int Initialize(ComponentHandler* cHandler, Camera* cameraRef); int Update(float dt, InputHandler* inputHandler); //Push a state to the stack int PushStateToStack(GameState* state); private: }; #endif
REMOVE commented out START_WITHOUT_MENU so we start with a menu
REMOVE commented out START_WITHOUT_MENU so we start with a menu
C
apache-2.0
Chringo/SSP,Chringo/SSP
32f23b462b3b1732abfcdde5af941e34bfeaba40
Source/NSManagedObject+HYPPropertyMapper.h
Source/NSManagedObject+HYPPropertyMapper.h
@import CoreData; static NSString * const HYPPropertyMapperCustomRemoteKey = @"mapper.remote.key"; @interface NSManagedObject (HYPPropertyMapper) - (void)hyp_fillWithDictionary:(NSDictionary *)dictionary; - (NSDictionary *)hyp_dictionary; @end
@import CoreData; static NSString * const HYPPropertyMapperCustomRemoteKey = @"hyper.remoteKey"; @interface NSManagedObject (HYPPropertyMapper) - (void)hyp_fillWithDictionary:(NSDictionary *)dictionary; - (NSDictionary *)hyp_dictionary; @end
Improve user info name consistency
Improve user info name consistency
C
mit
hyperoslo/NSManagedObject-HYPPropertyMapper,hyperoslo/NSManagedObject-HYPPropertyMapper,isghe/NSManagedObject-HYPPropertyMapper,nbarnold01/NSManagedObject-HYPPropertyMapper,markosankovic/NSManagedObject-HYPPropertyMapper
d53efb9d518fbc795f79c676649e0ba311838e3a
drivers/scsi/qla4xxx/ql4_version.h
drivers/scsi/qla4xxx/ql4_version.h
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k18"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k19"
Update driver version to 5.02.00-k19
[SCSI] qla4xxx: Update driver version to 5.02.00-k19 Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com> Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>
C
apache-2.0
TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs
b132768bba645cf5008cbe3c5a12b9806d604480
libavformat/avc.h
libavformat/avc.h
/* * AVC helper functions for muxers * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVC_H #define AVC_H #include <stdint.h> #include "avio.h" int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size); int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); #endif /* AVC_H */
/* * AVC helper functions for muxers * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef FFMPEG_AVC_H #define FFMPEG_AVC_H #include <stdint.h> #include "avio.h" int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size); int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); #endif /* FFMPEG_AVC_H */
Add missing FFMPEG_ prefix to multiple inclusion guard.
Add missing FFMPEG_ prefix to multiple inclusion guard. git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@15047 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
C
lgpl-2.1
prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg
9fc55387986f0979d10370fe2fa313db8776bdea
src/trm/ft_trmnew.c
src/trm/ft_trmnew.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 12:26:49 by ncoden #+# #+# */ /* Updated: 2015/05/30 16:29:30 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_trm *ft_trmnew(void) { t_trm *trm; char *name; if (!(name = ft_envget("TERM"))) return (NULL); if (!(trm = (t_trm *)ft_memalloc(sizeof(t_trm)))) return (NULL); if ((tgetent(NULL, name))) { if (tcgetattr(ft_trmgetout(), &trm->opts) != -1) return (trm); } free(trm); return (NULL); }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 12:26:49 by ncoden #+# #+# */ /* Updated: 2015/06/06 16:14:04 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_trm *ft_trmnew(void) { t_trm *trm; char *name; if (!(name = ft_envget("TERM"))) return (NULL); if (!(trm = (t_trm *)ft_memalloc(sizeof(t_trm)))) return (NULL); if ((tgetent(NULL, name))) { if (tcgetattr(ft_trmgetout(), &trm->opts) != -1) { trm->inherit_signal = TRUE; return (trm); } } free(trm); return (NULL); }
Set trm inherit signals by default
Set trm inherit signals by default
C
apache-2.0
ncoden/libft
21e7321ee26f12929cfc4bca16961873291b6349
lib/cycy/stdio.c
lib/cycy/stdio.c
#include "cycy/stdio.h" int puts(const char * string) { int i = 0; while (string[i] != NULL) { putchar(string[i++]); } putc('\n'); return i + 1; }
#include "cycy/stdio.h" int puts(const char * string) { int i = 0; while (string[i] != NULL) { putchar(string[i]); i = i + 1; } putc('\n'); return i + 1; }
Make this easier to compile
Make this easier to compile
C
mit
Magnetic/cycy,Magnetic/cycy,Magnetic/cycy
6d53dd07a03c4bd24b9ca75cbbfe1c9fc3d4ff1f
cpp/libopenzwavec.h
cpp/libopenzwavec.h
typedef void* COptions; COptions newCOptions(const char*, const char*, const char*);
#ifdef __cplusplus extern "C" { #endif typedef void* COptions; COptions newCOptions(const char*, const char*, const char*); #ifdef __cplusplus } #endif
Add back the C++ extern
Add back the C++ extern
C
mit
Julian/libopenzwave-cffi,Julian/libopenzwave-cffi,Julian/libopenzwave-cffi
939117c3e4b66641dd2f0291800ec3294eeebfd4
api-testcases/test-c-constructor.c
api-testcases/test-c-constructor.c
/*=== *** test1 (duk_safe_call) inherited value top at end: 0 ==> rc=0, result='undefined' ===*/ static duk_ret_t my_constructor(duk_context *ctx) { return 1; } static duk_ret_t test1(duk_context *ctx) { duk_push_global_object(ctx); duk_push_c_function(ctx, my_constructor, 0); /* constructor (function) */ duk_push_object(ctx); /* prototype object -> [ global cons proto ] */ duk_push_string(ctx, "inherited value"); duk_put_prop_string(ctx, -2, "inherited"); /* set proto.inherited = "inherited value" */ duk_put_prop_string(ctx, -2, "prototype"); /* set cons.prototype = proto; stack -> [ global cons ] */ duk_put_prop_string(ctx, -2, "MyConstructor"); /* set global.MyConstructor = cons; stack -> [ global ] */ duk_pop(ctx); duk_eval_string(ctx, "var obj = new MyConstructor(); print(obj.inherited);"); duk_pop(ctx); printf("top at end: %ld\n", (long) duk_get_top(ctx)); return 0; } void test(duk_context *ctx) { TEST_SAFE_CALL(test1); }
/*=== *** test1 (duk_safe_call) inherited value top at end: 0 ==> rc=0, result='undefined' ===*/ static duk_ret_t my_constructor(duk_context *ctx) { return 0; } static duk_ret_t test1(duk_context *ctx) { duk_push_global_object(ctx); duk_push_c_function(ctx, my_constructor, 0); /* constructor (function) */ duk_push_object(ctx); /* prototype object -> [ global cons proto ] */ duk_push_string(ctx, "inherited value"); duk_put_prop_string(ctx, -2, "inherited"); /* set proto.inherited = "inherited value" */ duk_put_prop_string(ctx, -2, "prototype"); /* set cons.prototype = proto; stack -> [ global cons ] */ duk_put_prop_string(ctx, -2, "MyConstructor"); /* set global.MyConstructor = cons; stack -> [ global ] */ duk_pop(ctx); duk_eval_string(ctx, "var obj = new MyConstructor(); print(obj.inherited);"); duk_pop(ctx); printf("top at end: %ld\n", (long) duk_get_top(ctx)); return 0; } void test(duk_context *ctx) { TEST_SAFE_CALL(test1); }
Fix invalid return value in API test
Fix invalid return value in API test No effect on test result because the constructor was not returning an object anyway.
C
mit
chenyaqiuqiu/duktape,zeropool/duktape,harold-b/duktape,eddieh/duktape,nivertech/duktape,reqshark/duktape,nivertech/duktape,markand/duktape,pombredanne/duktape,tassmjau/duktape,haosu1987/duktape,jmptrader/duktape,haosu1987/duktape,nivertech/duktape,pombredanne/duktape,nivertech/duktape,markand/duktape,kphillisjr/duktape,zeropool/duktape,chenyaqiuqiu/duktape,sloth4413/duktape,svaarala/duktape,reqshark/duktape,haosu1987/duktape,jmptrader/duktape,sloth4413/duktape,reqshark/duktape,reqshark/duktape,pombredanne/duktape,zeropool/duktape,skomski/duktape,thurday/duktape,reqshark/duktape,harold-b/duktape,kphillisjr/duktape,chenyaqiuqiu/duktape,harold-b/duktape,haosu1987/duktape,skomski/duktape,skomski/duktape,eddieh/duktape,skomski/duktape,chenyaqiuqiu/duktape,harold-b/duktape,harold-b/duktape,svaarala/duktape,kphillisjr/duktape,haosu1987/duktape,jmptrader/duktape,chenyaqiuqiu/duktape,skomski/duktape,jmptrader/duktape,jmptrader/duktape,sloth4413/duktape,skomski/duktape,nivertech/duktape,svaarala/duktape,jmptrader/duktape,skomski/duktape,pombredanne/duktape,kphillisjr/duktape,harold-b/duktape,pombredanne/duktape,zeropool/duktape,skomski/duktape,kphillisjr/duktape,svaarala/duktape,chenyaqiuqiu/duktape,jmptrader/duktape,tassmjau/duktape,tassmjau/duktape,haosu1987/duktape,markand/duktape,chenyaqiuqiu/duktape,harold-b/duktape,sloth4413/duktape,svaarala/duktape,chenyaqiuqiu/duktape,svaarala/duktape,jmptrader/duktape,sloth4413/duktape,harold-b/duktape,markand/duktape,markand/duktape,tassmjau/duktape,sloth4413/duktape,zeropool/duktape,skomski/duktape,nivertech/duktape,tassmjau/duktape,kphillisjr/duktape,svaarala/duktape,markand/duktape,thurday/duktape,zeropool/duktape,sloth4413/duktape,zeropool/duktape,pombredanne/duktape,zeropool/duktape,eddieh/duktape,eddieh/duktape,chenyaqiuqiu/duktape,zeropool/duktape,thurday/duktape,markand/duktape,sloth4413/duktape,thurday/duktape,pombredanne/duktape,haosu1987/duktape,thurday/duktape,harold-b/duktape,eddieh/duktape,thurday/duktape,pombredanne/duktape,nivertech/duktape,haosu1987/duktape,haosu1987/duktape,thurday/duktape,kphillisjr/duktape,tassmjau/duktape,harold-b/duktape,tassmjau/duktape,reqshark/duktape,tassmjau/duktape,reqshark/duktape,nivertech/duktape,kphillisjr/duktape,jmptrader/duktape,reqshark/duktape,pombredanne/duktape,pombredanne/duktape,haosu1987/duktape,reqshark/duktape,eddieh/duktape,chenyaqiuqiu/duktape,thurday/duktape,sloth4413/duktape,markand/duktape,tassmjau/duktape,markand/duktape,tassmjau/duktape,reqshark/duktape,zeropool/duktape,eddieh/duktape,jmptrader/duktape,kphillisjr/duktape,nivertech/duktape,sloth4413/duktape,svaarala/duktape,eddieh/duktape,eddieh/duktape,eddieh/duktape,thurday/duktape,markand/duktape,svaarala/duktape,kphillisjr/duktape,skomski/duktape,nivertech/duktape,thurday/duktape
e3e07072472a4962895a433206f0d84b54b99695
rmc.h
rmc.h
#ifndef RMC_CORE_H #define RMC_CORE_H #include "atomic.h" #ifdef HAS_RMC #error "no you don't" #else /* Dummy version that should work. */ #define XEDGE(x, y) do { } while (0) #define VEDGE(x, y) do { } while (0) /* Just stick a visibility barrier after every label. This isn't good * or anything, but it probably works. */ /* This is unhygenic in a nasty way. */ #define L(label, stmt) stmt; vis_barrier() #endif #endif
#ifndef RMC_CORE_H #define RMC_CORE_H #include "atomic.h" #ifdef HAS_RMC /* We signal our labels and edges to our LLVM pass in a *really* hacky * way to avoid needing to modify the frontend. Labelled statements * are wrapped in two goto labels to force them into their own basic * block (labelled statements don't fundamentally *need* to be in * their own basic block, but it makes things convenient) and edges * are specified by calling a dummy function __rmc_edge_register with * the labels as arguments (using computed goto to get the labels). * * This is really quite fragile; optimization passes will easily * destroy this information. The RMC pass should be run *before* any * real optimization passes are run but *after* mem2reg. */ extern void __rmc_edge_register(int is_vis, void *src, void *dst); #define RMC_EDGE(t, x, y) __rmc_edge_register(t, &&_rmc_##x, &&_rmc_##y) #define XEDGE(x, y) RMC_EDGE(0, x, y) #define VEDGE(x, y) RMC_EDGE(1, x, y) /* This is unhygenic in a nasty way. */ /* The (void)0s are because declarations can't directly follow labels, * apparently. */ #define L(label, stmt) \ _rmc_##label: (void)0; \ stmt; \ _rmc_end_##label: __attribute__((unused)) (void)0 #else /* Dummy version that should work. */ #define XEDGE(x, y) do { } while (0) #define VEDGE(x, y) do { } while (0) /* Just stick a visibility barrier after every label. This isn't good * or anything, but it probably works. */ /* This is unhygenic in a nasty way. */ #define L(label, stmt) stmt; vis_barrier() #endif /* HAS_RMC */ #endif
Add in a mechanism for interacting with the RMC llvm pass.
Add in a mechanism for interacting with the RMC llvm pass.
C
mit
msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler
181906966dd2bdabcaec3c3e8b1d9b1ac43eb294
misc.h
misc.h
#ifndef MISC_H #define MISC_H #include <stdlib.h> #include <stdio.h> #include <assert.h> #include "types.h" #define ARR_LEN(a) (sizeof(a) / sizeof(a[0])) #define LOOKUP(key, table) (assert(key < ARR_LEN(table)), table[key]) static inline void* xmalloc(size_t s) { void* p = malloc(s); if (!p) { perror("malloc"); abort(); } return p; } static inline void* xcalloc(size_t s) { void* p = calloc(1, s); if (!p) { perror("calloc"); abort(); } return p; } static inline void xfree(void* p) { free(p); } extern struct config* config; #endif /* MISC_H */
#ifndef MISC_H #define MISC_H #include <stdlib.h> #include <stdio.h> #include <assert.h> #include "types.h" #define ARR_LEN(a) (sizeof(a) / sizeof(a[0])) #define LOOKUP(key, table) (assert(key < ARR_LEN(table)), \ assert(key >= 0), \ table[key]) static inline void* xmalloc(size_t s) { void* p = malloc(s); if (!p) { perror("malloc"); abort(); } return p; } static inline void* xcalloc(size_t s) { void* p = calloc(1, s); if (!p) { perror("calloc"); abort(); } return p; } static inline void xfree(void* p) { free(p); } extern struct config* config; #endif /* MISC_H */
Add a greater-than-or-equal-to-zero assert to LOOKUP().
Add a greater-than-or-equal-to-zero assert to LOOKUP().
C
isc
zevweiss/enthrall
afedf4fa79fedacfcd285d49f1c044ddd138951e
chrome/browser/cocoa/objc_zombie.h
chrome/browser/cocoa/objc_zombie.h
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #pragma once #import <Foundation/Foundation.h> // You should think twice every single time you use anything from this // namespace. namespace ObjcEvilDoers { // Enable zombies. Returns NO if it fails to enable. // // When |zombieAllObjects| is YES, all objects inheriting from // NSObject become zombies on -dealloc. If NO, -shouldBecomeCrZombie // is queried to determine whether to make the object a zombie. // // |zombieCount| controls how many zombies to store before freeing the // oldest. Set to 0 to free objects immediately after making them // zombies. BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount); // Disable zombies. void ZombieDisable(); } // namespace ObjcEvilDoers @interface NSObject (CrZombie) - (BOOL)shouldBecomeCrZombie; @end #endif // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_ #pragma once #import <Foundation/Foundation.h> // You should think twice every single time you use anything from this // namespace. namespace ObjcEvilDoers { // Enable zombie object debugging. This implements a variant of Apple's // NSZombieEnabled which can help expose use-after-free errors where messages // are sent to freed Objective-C objects in production builds. // // Returns NO if it fails to enable. // // When |zombieAllObjects| is YES, all objects inheriting from // NSObject become zombies on -dealloc. If NO, -shouldBecomeCrZombie // is queried to determine whether to make the object a zombie. // // |zombieCount| controls how many zombies to store before freeing the // oldest. Set to 0 to free objects immediately after making them // zombies. BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount); // Disable zombies. void ZombieDisable(); } // namespace ObjcEvilDoers @interface NSObject (CrZombie) - (BOOL)shouldBecomeCrZombie; @end #endif // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
Add link to explanation of what we mean by zombie The person triaging / debugging a zombie crash may never have heard of this before.
Add link to explanation of what we mean by zombie The person triaging / debugging a zombie crash may never have heard of this before. BUG=None TEST=None Review URL: http://codereview.chromium.org/3763002 git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@62723 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
C
bsd-3-clause
wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser
83a86b351e8542ef3f9d607bbf8b32f3ca606fd9
common.h
common.h
#define exit_with_code(code) { result = code; goto _exit; } int compile_files( YR_COMPILER* compiler, int argc, const char** argv) { for (int i = 0; i < argc - 1; i++) { const char* ns; const char* file_name; char* colon = (char*) strchr(argv[i], ':'); // Namespace delimiter must be a colon not followed by a slash or backslash if (colon && *(colon + 1) != '\\' && *(colon + 1) != '/') { file_name = colon + 1; *colon = '\0'; ns = argv[i]; } else { file_name = argv[i]; ns = NULL; } FILE* rule_file = fopen(file_name, "r"); if (rule_file == NULL) { fprintf(stderr, "error: could not open file: %s\n", file_name); fclose(rule_file); return 0; } yr_compiler_add_file(compiler, rule_file, ns, file_name); fclose(rule_file); } return 1; }
#define exit_with_code(code) { result = code; goto _exit; } int compile_files( YR_COMPILER* compiler, int argc, const char** argv) { for (int i = 0; i < argc - 1; i++) { const char* ns; const char* file_name; char* colon = (char*) strchr(argv[i], ':'); // Namespace delimiter must be a colon not followed by a slash or backslash if (colon && *(colon + 1) != '\\' && *(colon + 1) != '/') { file_name = colon + 1; *colon = '\0'; ns = argv[i]; } else { file_name = argv[i]; ns = NULL; } FILE* rule_file = fopen(file_name, "r"); if (rule_file == NULL) { fprintf(stderr, "error: could not open file: %s\n", file_name); return 0; } yr_compiler_add_file(compiler, rule_file, ns, file_name); fclose(rule_file); } return 1; }
Remove unnecessary call to fclose.
Remove unnecessary call to fclose.
C
bsd-3-clause
plusvic/yara,cblichmann/yara,wxsBSD/yara,rednaga/yara,tanium/yara,hillu/yara,cblichmann/yara,wxsBSD/yara,VirusTotal/yara,wxsBSD/yara,hillu/yara,plusvic/yara,tanium/yara,hillu/yara,hillu/yara,wxsBSD/yara,plusvic/yara,wxsBSD/yara,rednaga/yara,plusvic/yara,VirusTotal/yara,rednaga/yara,cblichmann/yara,plusvic/yara,cblichmann/yara,pombredanne/yara,VirusTotal/yara,hillu/yara,pombredanne/yara,tanium/yara,VirusTotal/yara,pombredanne/yara,pombredanne/yara,cblichmann/yara,pombredanne/yara,VirusTotal/yara
d8b4e55ab22ce4e65a2b64821702f3143ab1105f
elkhound/emitcode.h
elkhound/emitcode.h
// emitcode.h see license.txt for copyright and terms of use // track state of emitted code so I can emit #line too #ifndef EMITCODE_H #define EMITCODE_H #include <fstream.h> // ofstream #include "str.h" // stringBuffer #include "srcloc.h" // SourceLoc class EmitCode : public stringBuilder { private: // data ofstream os; // stream to write to string fname; // filename for emitting #line int line; // current line number public: // funcs EmitCode(rostring fname); ~EmitCode(); string const &getFname() const { return fname; } // get current line number; flushes internally int getLine(); // flush data in stringBuffer to 'os' void flush(); }; // return a #line directive for the given location string lineDirective(SourceLoc loc); // emit a #line directive to restore reporting to the // EmitCode file itself (the 'sb' argument must be an EmitFile object) stringBuilder &restoreLine(stringBuilder &sb); #endif // EMITCODE_H
// emitcode.h see license.txt for copyright and terms of use // track state of emitted code so I can emit #line too #ifndef EMITCODE_H #define EMITCODE_H #include "str.h" // stringBuffer #include "srcloc.h" // SourceLoc #include "ofstreamts.h" // ofstreamTS class EmitCode : public stringBuilder { private: // data ofstreamTS os; // stream to write to string fname; // filename for emitting #line int line; // current line number public: // funcs EmitCode(rostring fname); ~EmitCode(); string const &getFname() const { return fname; } // get current line number; flushes internally int getLine(); // flush data in stringBuffer to 'os' void flush(); }; // return a #line directive for the given location string lineDirective(SourceLoc loc); // emit a #line directive to restore reporting to the // EmitCode file itself (the 'sb' argument must be an EmitFile object) stringBuilder &restoreLine(stringBuilder &sb); #endif // EMITCODE_H
Use ofstreamTS to avoid touching the .gen.cc, .gen.h output if unchanged.
Use ofstreamTS to avoid touching the .gen.cc, .gen.h output if unchanged.
C
bsd-3-clause
angavrilov/olmar,angavrilov/olmar,angavrilov/olmar,angavrilov/olmar
fbe96411e7888bfb9cc92fe85e35e093239d24a7
include/insect.h
include/insect.h
#ifndef __INSECT_H__ #define __INSECT_H__ #include "insect/crawler.h" #include "insect/records.h" /* basic file API */ #include "insect/file/stat.h" #ifdef USE_THREADS #include "insect/concurrent/thread.h" #endif /* USE_THREADS */ #endif /* __INSECT_H__ */
#ifndef __INSECT_H__ #define __INSECT_H__ #ifdef __cplusplus extern "C" { #endif /* C++ */ #include "insect/crawler.h" #include "insect/records.h" /* basic file API */ #include "insect/file/stat.h" #ifdef USE_THREADS #include "insect/concurrent/thread.h" #endif /* USE_THREADS */ #ifdef __cplusplus } /* extern "C" */ #endif /* C++ */ #endif /* __INSECT_H__ */
Add extern "C" wrapper to main header, for C++
Add extern "C" wrapper to main header, for C++
C
bsd-2-clause
hagemt/insect,hagemt/insect
6457ba1007bd218624a196b8de351d6e2f644ce7
include/bitcoin/bitcoin/compat.h
include/bitcoin/bitcoin/compat.h
/* * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS) * * This file is part of libbitcoin. * * libbitcoin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. For more information see LICENSE. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LIBBITCOIN_COMPAT_H #define LIBBITCOIN_COMPAT_H #ifdef _MSC_VER // There is no <endian.h> for MSVC but it is always little endian. #ifndef __LITTLE_ENDIAN__ # undef __BIG_ENDIAN__ # define __LITTLE_ENDIAN__ #endif #endif #ifdef _MSC_VER // For SET_BINARY_FILE_MODE #include <fcntl.h> #include <io.h> #include <stdio.h> #endif // Sets the _fmode global variable, which controls the default translation // mode for file I/O operations. #ifdef _MSC_VER #define BC_SET_BINARY_FILE_MODE(mode) \ _setmode(_fileno(stdin), if_else(mode, _O_BINARY, _O_TEXT)) #else #define BC_SET_BINARY_FILE_MODE(mode) #endif #endif
/* * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS) * * This file is part of libbitcoin. * * libbitcoin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License with * additional permissions to the one published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. For more information see LICENSE. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LIBBITCOIN_COMPAT_H #define LIBBITCOIN_COMPAT_H #ifdef _MSC_VER // There is no <endian.h> for MSVC but it is always little endian. #ifndef __LITTLE_ENDIAN__ # undef __BIG_ENDIAN__ # define __LITTLE_ENDIAN__ #endif #endif #endif
Remove unused code, keep in bx.
Remove unused code, keep in bx.
C
agpl-3.0
GroestlCoin/libgroestlcoin,GroestlCoin/libgroestlcoin,GroestlCoin/libgroestlcoin,swansontec/libbitcoin,GroestlCoin/libgroestlcoin,swansontec/libbitcoin,swansontec/libbitcoin,swansontec/libbitcoin
914aa3e86b039d935ae322bf2c0b654dd9de42ad
KugelmatikFirmware/config.h
KugelmatikFirmware/config.h
#pragma once #include <Arduino.h> #include "stepper.h" enum StepMode : uint8_t { StepHalf = 1, StepFull = 2, StepBoth = 3 }; enum BrakeMode : uint8_t { BrakeNone = 0, BrakeAlways = 1, BrakeSmart = 2 }; struct Config { StepMode stepMode; BrakeMode brakeMode; uint32_t tickTime; uint32_t homeTime; uint32_t fixTime; int16_t maxSteps; // Maximale Anzahl an Schritten die die Firmware maximal machen darf (nach unten) int16_t homeSteps; int16_t fixSteps; // Anzahl an Schritten die die Firmware macht um eine Kugel nach unten zu fahren (ignoriert dabei maxSteps) uint16_t brakeTicks; uint16_t minStepDelta; // Unterschied zwischen derzeitiger Hhe und Zielhhe ab wann die Kugel bewegt werden soll }; extern Config config; // setzt die Standard Config void setDefaultConfig(); // prft Config auf invalide Werte boolean checkConfig(Config* config);
#pragma once #include <Arduino.h> #include "stepper.h" enum StepMode : uint8_t { StepHalf = 1, StepFull = 2, StepBoth = 3 }; enum BrakeMode : uint8_t { BrakeNone = 0, BrakeAlways = 1, BrakeSmart = 2 }; struct Config { StepMode stepMode; BrakeMode brakeMode; uint32_t tickTime; uint32_t homeTime; uint32_t fixTime; int16_t maxSteps; // Maximale Anzahl an Schritten die die Firmware maximal machen darf (nach unten) int16_t homeSteps; int16_t fixSteps; // Anzahl an Schritten die die Firmware macht um eine Kugel nach unten zu fahren (ignoriert dabei maxSteps) uint16_t brakeTicks; uint16_t minStepDelta; // Unterschied zwischen derzeitiger Hhe und Zielhhe ab wann die Kugel bewegt werden soll } __attribute__((__packed__)); extern Config config; // setzt die Standard Config void setDefaultConfig(); // prft Config auf invalide Werte boolean checkConfig(Config* config);
Add packed attribute to Config
Add packed attribute to Config
C
mit
henrik1235/Kugelmatik,henrik1235/Kugelmatik,henrik1235/Kugelmatik
90ae0921a7faccb8c2ce05745cc9ca7ca112cba8
ext/quarry/quarry.h
ext/quarry/quarry.h
# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */ # define DEG_TO_RAD 0.0174532925199433 /* PI/180 */ VALUE mgrs_to_lat_long(VALUE klass) { VALUE mgrs_grid = rb_iv_get(klass, "@grid"); char* grid = StringValuePtr(mgrs_grid); double lat, lng; Convert_MGRS_To_Geodetic(grid, &lat, &lng); VALUE lat_lng_array = rb_ary_new(); rb_ary_push(lat_lng_array, rb_float_new(lat*RAD_TO_DEG)); rb_ary_push(lat_lng_array, rb_float_new(lng*RAD_TO_DEG)); return lat_lng_array; } VALUE lat_long_to_mgrs(VALUE klass) { VALUE iv_latitude = rb_funcall(rb_iv_get(klass, "@latitude" ), rb_intern("to_s"), 0), iv_longitude = rb_funcall(rb_iv_get(klass, "@longitude"), rb_intern("to_s"), 0); double latitude = rb_str_to_dbl(iv_latitude, Qfalse), longitude = rb_str_to_dbl(iv_longitude, Qfalse); char grid[15]; Convert_Geodetic_To_MGRS(latitude*DEG_TO_RAD, longitude*DEG_TO_RAD, 5, grid); return rb_str_new2(grid); }
# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */ # define DEG_TO_RAD 0.0174532925199433 /* PI/180 */ VALUE mgrs_to_lat_long(VALUE klass) { VALUE mgrs_grid = rb_iv_get(klass, "@grid"); char* grid = StringValuePtr(mgrs_grid); double lat, lng; Convert_MGRS_To_Geodetic(grid, &lat, &lng); VALUE lat_lng_array = rb_ary_new(); rb_ary_push(lat_lng_array, rb_float_new(lat*RAD_TO_DEG)); rb_ary_push(lat_lng_array, rb_float_new(lng*RAD_TO_DEG)); return lat_lng_array; } VALUE lat_long_to_mgrs(VALUE klass) { double latitude = rb_num2dbl(rb_iv_get(klass, "@latitude")), longitude = rb_num2dbl(rb_iv_get(klass, "@longitude")); char grid[15]; Convert_Geodetic_To_MGRS(latitude*DEG_TO_RAD, longitude*DEG_TO_RAD, 5, grid); return rb_str_new2(grid); }
Clean up converting float to double
Clean up converting float to double
C
mit
joshuaclayton/quarry,joshuaclayton/quarry
35c85704a3e61eaf6e5c55dcf3cd66b09088d09b
src/tcp_socket.c
src/tcp_socket.c
#include "syshead.h" #include "tcp_socket.h" #define MAX_TCP_SOCKETS 128 static int cur_fd = 3; static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS]; void init_tcp_sockets() { memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS); } struct tcp_socket *alloc_tcp_socket() { struct tcp_socket *sock; for (int i = 0; i<MAX_TCP_SOCKETS; i++) { sock = &tcp_sockets[i]; if (sock->fd == 0) { sock->fd = cur_fd++; sock->state = CLOSED; return sock; } } /* No space left, error case */ return NULL; } void free_tcp_socket(struct tcp_socket *sock) { } struct tcp_socket *get_tcp_socket(int sockfd) { struct tcp_socket sk; for (int i = 0; i<MAX_TCP_SOCKETS; i++) { sk = tcp_sockets[i]; if (sk.fd == sockfd) return &sk; } return NULL; }
#include "syshead.h" #include "tcp_socket.h" #define MAX_TCP_SOCKETS 128 static int cur_fd = 3; static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS]; void init_tcp_sockets() { memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS); } struct tcp_socket *alloc_tcp_socket() { struct tcp_socket *sock; for (int i = 0; i<MAX_TCP_SOCKETS; i++) { sock = &tcp_sockets[i]; if (sock->fd == 0) { sock->fd = cur_fd++; sock->state = CLOSED; return sock; } } /* No space left, error case */ return NULL; } void free_tcp_socket(struct tcp_socket *sock) { } struct tcp_socket *get_tcp_socket(int sockfd) { struct tcp_socket *sk; for (int i = 0; i<MAX_TCP_SOCKETS; i++) { sk = &tcp_sockets[i]; if (sk->fd == sockfd) return sk; } return NULL; }
Fix ugly pointer return bug
Fix ugly pointer return bug
C
mit
saminiir/level-ip,saminiir/level-ip
06e44840368efdb359224b5d04db6c92f73bd373
arch/cris/include/arch-v32/arch/cache.h
arch/cris/include/arch-v32/arch/cache.h
#ifndef _ASM_CRIS_ARCH_CACHE_H #define _ASM_CRIS_ARCH_CACHE_H #include <arch/hwregs/dma.h> /* A cache-line is 32 bytes. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_SHIFT 5 #define __read_mostly __attribute__((__section__(".data.read_mostly"))) void flush_dma_list(dma_descr_data *descr); void flush_dma_descr(dma_descr_data *descr, int flush_buf); #define flush_dma_context(c) \ flush_dma_list(phys_to_virt((c)->saved_data)); void cris_flush_cache_range(void *buf, unsigned long len); void cris_flush_cache(void); #endif /* _ASM_CRIS_ARCH_CACHE_H */
#ifndef _ASM_CRIS_ARCH_CACHE_H #define _ASM_CRIS_ARCH_CACHE_H #include <arch/hwregs/dma.h> /* A cache-line is 32 bytes. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_SHIFT 5 #define __read_mostly __attribute__((__section__(".data..read_mostly"))) void flush_dma_list(dma_descr_data *descr); void flush_dma_descr(dma_descr_data *descr, int flush_buf); #define flush_dma_context(c) \ flush_dma_list(phys_to_virt((c)->saved_data)); void cris_flush_cache_range(void *buf, unsigned long len); void cris_flush_cache(void); #endif /* _ASM_CRIS_ARCH_CACHE_H */
Correct name of read_mostly section.
CRISv32: Correct name of read_mostly section. 54cb27a71f51d304342c79e62fd7667f2171062b renamed .data.read_mostly to .data..read_mostly for all architectures for 2.6.33. Reported-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org> Signed-off-by: Jesper Nilsson <987a7dbc972893e93e5578401bedc3a0f2ccb5e3@axis.com>
C
mit
KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs
4cfc51017db3e3f4eaaa2cb436a905097a4f08e2
drivers/scsi/qla2xxx/qla_version.h
drivers/scsi/qla2xxx/qla_version.h
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.02.01-k5" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 1 #define QLA_DRIVER_BETA_VER 0
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.02.01-k6" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 1 #define QLA_DRIVER_BETA_VER 0
Update version number to 8.02.01-k6.
[SCSI] qla2xxx: Update version number to 8.02.01-k6. Signed-off-by: Andrew Vasquez <67840a4977006af7f584bdc4c86d7243c1629cad@qlogic.com> Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>
C
apache-2.0
TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,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
5d334bbd060cb6129f8e8af6b29f897d6d4840a1
src/lily_config.h
src/lily_config.h
/* Path handling. This was copied from Lua, with some minor adjustments. The biggest one is the lack of Windows support, because I don't have my Windows box setup for Lily yet (I'd rather make sure Windows works all at once). */ #define LILY_MAJOR "0" #define LILY_MINOR "13" #define LILY_VERSION_DIR LILY_MAJOR "." LILY_MINOR #define LILY_BASE_DIR "/usr/local/" #define LILY_SHARE_DIR LILY_ROOT "share/lua/" LUA_VDIR "/" #define LILY_CDIR LILY_ROOT "lib/lua/" LUA_VDIR "/" /* So, by default, Lily will attempt to load .lly files from these directories. */ #define LILY_PATH_SEED \ LILY_BASE_DIR "share/" LILY_VERSION_DIR "/;" \ LILY_BASE_DIR "lib/" LILY_VERSION_DIR "/;" \ "./;"
/* Path handling. This was copied from Lua, with some minor adjustments. The biggest one is the lack of Windows support, because I don't have my Windows box setup for Lily yet (I'd rather make sure Windows works all at once). */ #define LILY_MAJOR "0" #define LILY_MINOR "13" #define LILY_VERSION_DIR LILY_MAJOR "_" LILY_MINOR #define LILY_BASE_DIR "/usr/local/" #define LILY_SHARE_DIR LILY_BASE_DIR "share/lily/" LILY_VERSION_DIR "/" #define LILY_LIB_DIR LILY_BASE_DIR "lib/lily/" LILY_VERSION_DIR "/" /* This is where Lily will attempt to import new files from. If the parser is loading from a file, then the directory of the first file is added as the very last path to search. */ #define LILY_PATH_SEED \ LILY_SHARE_DIR ";" \ LILY_LIB_DIR ";" \ "./;"
Fix up the embarassing mess of path seeding. Yikes. :(
Fix up the embarassing mess of path seeding. Yikes. :(
C
mit
crasm/lily,crasm/lily,boardwalk/lily,crasm/lily,boardwalk/lily
2c377d116884aa9dc8fca51830b914b127de1420
mordor/common/http/tunnel.h
mordor/common/http/tunnel.h
#ifndef __HTTP_TUNNEL_H__ #define __HTTP_TUNNEL_H__ // Copyright (c) 2009 - Decho Corp. #include "auth.h" namespace HTTP { template <class T> Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target) { Request requestHeaders; requestHeaders.requestLine.method = CONNECT; requestHeaders.requestLine.uri = target; requestHeaders.request.host = proxy; requestHeaders.general.connection.insert("Proxy-Connection"); requestHeaders.general.proxyConnection.insert("Keep-Alive"); ClientRequest::ptr request = conn.request(requestHeaders); if (request->response().status.status == HTTP::OK) { return request->stream(); } else { throw std::runtime_error("proxy connection failed"); } } } #endif
#ifndef __HTTP_TUNNEL_H__ #define __HTTP_TUNNEL_H__ // Copyright (c) 2009 - Decho Corp. #include "auth.h" namespace HTTP { template <class T> Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target) { Request requestHeaders; requestHeaders.requestLine.method = CONNECT; requestHeaders.requestLine.uri = target; requestHeaders.request.host = proxy; requestHeaders.general.connection.insert("Proxy-Connection"); requestHeaders.general.proxyConnection.insert("Keep-Alive"); ClientRequest::ptr request = conn.request(requestHeaders); if (request->response().status.status == HTTP::OK) { return request->stream(); } else { throw InvalidResponseException("proxy connection failed", request->response()); } } } #endif
Throw a more useful exceptoin when proxy connection fails.
Throw a more useful exceptoin when proxy connection fails.
C
bsd-3-clause
cgaebel/mordor,adfin/mordor,mtanski/mordor,mtanski/mordor,ccutrer/mordor,cgaebel/mordor,ccutrer/mordor,adfin/mordor,adfin/mordor,mozy/mordor,mozy/mordor,ccutrer/mordor,mtanski/mordor,mozy/mordor
b793fd632ce03ce39a4d49e97b8f052cf9c03e18
base/inc/Htypes.h
base/inc/Htypes.h
/* @(#)root/base:$Name: $:$Id: Htypes.h,v 1.1.1.1 2000/05/16 17:00:39 rdm Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_Htypes #define ROOT_Htypes ////////////////////////////////////////////////////////////////////////// // // // Htypes // // // // Types used by the histogramming classes. // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_Rtypes #include "Rtypes.h" #endif typedef double Axis_t; //Axis values type typedef double Stat_t; //Statistics type #endif
/* @(#)root/base:$Name: $:$Id: Htypes.h,v 1.2 2000/06/13 12:25:52 brun Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_Htypes #define ROOT_Htypes ////////////////////////////////////////////////////////////////////////// // // // Htypes // // // // Types used by the histogramming classes. // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_Rtypes #include "Rtypes.h" #endif typedef double Axis_t; //Axis values type (double) typedef double Stat_t; //Statistics type (double) #endif
Add more comments describing Stat_t and Axis_t
Add more comments describing Stat_t and Axis_t git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@3097 27541ba8-7e3a-0410-8455-c3a389f83636
C
lgpl-2.1
bbannier/ROOT,bbannier/ROOT,bbannier/ROOT,dawehner/root,bbannier/ROOT,dawehner/root,dawehner/root,bbannier/ROOT,dawehner/root,bbannier/ROOT,bbannier/ROOT,dawehner/root,dawehner/root,dawehner/root,dawehner/root
4df12e7cba463ce664b8cf4e95bb72c4aef2a5ff
PySide/QtCore/qstringlist_conversions.h
PySide/QtCore/qstringlist_conversions.h
namespace Shiboken { inline bool Converter<QStringList>::isConvertible(PyObject* pyObj) { return StdListConverter<QStringList>::isConvertible(pyObj); } inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj) { return StdListConverter<QStringList>::toCpp(pyObj); } inline PyObject* Converter<QStringList>::toPython(const QStringList& cppObj) { return StdListConverter<QStringList>::toPython(cppObj); } }
namespace Shiboken { inline bool Converter<QStringList>::isConvertible(PyObject* pyObj) { return StdListConverter<QStringList>::isConvertible(pyObj); } inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj) { return StdListConverter<QStringList>::toCpp(pyObj); } inline PyObject* Converter<QStringList>::toPython(const QStringList& cppObj) { return ValueTypeConverter<QStringList>::toPython(cppObj); } }
Return a QStringList wrapper instead of a python list in Converter::toPython.
Return a QStringList wrapper instead of a python list in Converter::toPython.
C
lgpl-2.1
enthought/pyside,RobinD42/pyside,IronManMark20/pyside2,BadSingleton/pyside2,M4rtinK/pyside-bb10,RobinD42/pyside,gbaty/pyside2,pankajp/pyside,enthought/pyside,PySide/PySide,BadSingleton/pyside2,qtproject/pyside-pyside,M4rtinK/pyside-bb10,pankajp/pyside,M4rtinK/pyside-android,IronManMark20/pyside2,gbaty/pyside2,PySide/PySide,RobinD42/pyside,M4rtinK/pyside-bb10,enthought/pyside,M4rtinK/pyside-android,IronManMark20/pyside2,enthought/pyside,RobinD42/pyside,M4rtinK/pyside-bb10,M4rtinK/pyside-android,PySide/PySide,M4rtinK/pyside-android,gbaty/pyside2,qtproject/pyside-pyside,enthought/pyside,qtproject/pyside-pyside,gbaty/pyside2,pankajp/pyside,M4rtinK/pyside-android,BadSingleton/pyside2,M4rtinK/pyside-bb10,M4rtinK/pyside-android,RobinD42/pyside,BadSingleton/pyside2,PySide/PySide,RobinD42/pyside,BadSingleton/pyside2,qtproject/pyside-pyside,pankajp/pyside,enthought/pyside,IronManMark20/pyside2,IronManMark20/pyside2,M4rtinK/pyside-bb10,enthought/pyside,pankajp/pyside,PySide/PySide,RobinD42/pyside,qtproject/pyside-pyside,gbaty/pyside2
21995694719c8c5f83265c291d26d06ee824e461
Tests/UIAlertViewBlocksKitTest.h
Tests/UIAlertViewBlocksKitTest.h
// // UIAlertViewBlocksKitTest.h // BlocksKit // // Created by Zachary Waldowski on 12/20/11. // Copyright (c) 2011 Dizzy Technology. All rights reserved. // #import <GHUnitIOS/GHUnit.h> #import "BlocksKit/BlocksKit.h" @interface UIAlertViewBlocksKitTest : GHTestCase @end
// // UIAlertViewBlocksKitTest.h // BlocksKit Unit Tests // #import <GHUnitIOS/GHUnit.h> #import "BlocksKit/BlocksKit.h" @interface UIAlertViewBlocksKitTest : GHTestCase - (void)testInit; - (void)testAddButtonWithHandler; - (void)testSetCancelButtonWithHandler; - (void)testDelegationBlocks; @end
Make the UIAlertView unit test header consistent.
Make the UIAlertView unit test header consistent.
C
mit
anton-matosov/BlocksKit,yimouleng/BlocksKit,Herbert77/BlocksKit,aipeople/BlocksKit,AlexanderMazaletskiy/BlocksKit,ManagerOrganization/BlocksKit,Voxer/BlocksKit,pilot34/BlocksKit,pomu0325/BlocksKit,yaoxiaoyong/BlocksKit,hartbit/BlocksKit,HarrisLee/BlocksKit,stevenxiaoyang/BlocksKit,owers19856/BlocksKit,coneman/BlocksKit,tattocau/BlocksKit,hq804116393/BlocksKit,shenhzou654321/BlocksKit,zhaoguohui/BlocksKit,Gitub/BlocksKit,dachaoisme/BlocksKit,zwaldowski/BlocksKit,z8927623/BlocksKit,zxq3220122/BlocksKit-1,TomBin647/BlocksKit,demonnico/BlocksKit,xinlehou/BlocksKit
84fb9633caf6dc5b63ca98fd4d92e6086ab146d0
lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
//=== MipsELFStreamer.h - MipsELFStreamer ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENCE.TXT for details. // //===-------------------------------------------------------------------===// #ifndef MIPSELFSTREAMER_H_ #define MIPSELFSTREAMER_H_ #include "llvm/MC/MCELFStreamer.h" namespace llvm { class MipsSubtarget; class MipsELFStreamer : public MCELFStreamer { private: unsigned EFlags; public: MipsELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter, bool RelaxAll, bool NoExecStack) : MCELFStreamer(Context, TAB, OS, Emitter), EFlags(0) { } ~MipsELFStreamer() {} void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget); // void emitELFHeaderFlagCG(unsigned Val); }; MCELFStreamer* createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter, bool RelaxAll, bool NoExecStack); } #endif /* MIPSELFSTREAMER_H_ */
//=== MipsELFStreamer.h - MipsELFStreamer ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENCE.TXT for details. // //===-------------------------------------------------------------------===// #ifndef MIPSELFSTREAMER_H_ #define MIPSELFSTREAMER_H_ #include "llvm/MC/MCELFStreamer.h" namespace llvm { class MipsSubtarget; class MipsELFStreamer : public MCELFStreamer { public: MipsELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter, bool RelaxAll, bool NoExecStack) : MCELFStreamer(Context, TAB, OS, Emitter), EFlags(0) { } ~MipsELFStreamer() {} void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget); // void emitELFHeaderFlagCG(unsigned Val); }; MCELFStreamer* createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter, bool RelaxAll, bool NoExecStack); } #endif /* MIPSELFSTREAMER_H_ */
Remove unused variable (introduced in r173884) to clear clang -Werror build
Remove unused variable (introduced in r173884) to clear clang -Werror build git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@173887 91177308-0d34-0410-b5e6-96231b3b80d8
C
apache-2.0
llvm-mirror/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,dslab-epfl/asap,apple/swift-llvm,dslab-epfl/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm
a067e96511a774f2398d6b222072926c2917f84c
include/thai/thinp.h
include/thai/thinp.h
/* * $Id: thinp.h,v 1.2 2001-05-17 17:58:56 thep Exp $ * thinp.h - Thai string input sequence filtering * Created: 2001-05-17 */ #ifndef THAI_THINP_H #define THAI_THINP_H #include <thai/thailib.h> BEGIN_CDECL /* * strictness of input sequence checking, according to WTT 2.0 */ typedef enum { ISC_PASSTHROUGH = 0, ISC_BASICCHECK = 1, ISC_STRICT = 2 } strict_t; /* * Is c2 allowed to be placed after c1? * Returns: non-zero if yes, 0 otherwise */ extern int th_iscompose(thchar_t c1, thchar_t c2, strict_t s); /* * Is c2 allowed to be placed after c1? And if not, swap them. * Returns: non-zero if the swap happenned, 0 otherwise */ extern int th_validate(thchar_t *c1, thchar_t *c2, strict_t s); END_CDECL #endif /* THAI_THINP_H */
/* * $Id: thinp.h,v 1.3 2001-05-17 18:15:04 thep Exp $ * thinp.h - Thai string input sequence filtering * Created: 2001-05-17 */ #ifndef THAI_THINP_H #define THAI_THINP_H #include <thai/thailib.h> BEGIN_CDECL /* * strictness of input sequence checking, according to WTT 2.0 */ typedef enum { ISC_PASSTHROUGH = 0, ISC_BASICCHECK = 1, ISC_STRICT = 2 } strict_t; /* * Is c2 allowed to be placed after c1? * Returns: non-zero if yes, 0 otherwise */ extern int th_iscompose(thchar_t c1, thchar_t c2, strict_t s); /* * Is *c2 allowed to be placed after *c1? And if not, and if swapping * them makes it valid, do it. * Returns: 1 if (*c1, *c2) is a valid sequence in the first place * 2 if (*c1, *c2) has been swapped and the sequence becomes valid * 0 if (*c1, *c2) is invalid, no matter how */ extern int th_validate(thchar_t *c1, thchar_t *c2, strict_t s); END_CDECL #endif /* THAI_THINP_H */
Change the spec (comment) of th_validate()
Change the spec (comment) of th_validate()
C
lgpl-2.1
tlwg/libthai,tlwg/libthai
a718c85a2d55da2372278dcd9ae8977fd53197c3
ios/KontaktBeacons.h
ios/KontaktBeacons.h
#if __has_include("RCTBridgeModule.h") #import "RCTBridgeModule.h" #else #import <React/RCTBridgeModule.h> #endif #if __has_include("RCTEventEmitter.h") #import "RCTEventEmitter.h" #else #import <React/RCTEventEmitter.h> #endif @interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule> @end
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #else #import "RCTBridgeModule.h" #endif #if __has_include(<React/RCTEventEmitter.h>) #import <React/RCTEventEmitter.h> #else #import "RCTEventEmitter.h" #endif @interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule> @end
Fix imports for React Native 0.48.x.
Fix imports for React Native 0.48.x.
C
mit
Artirigo/react-native-kontaktio,Artirigo/react-native-kontaktio,Artirigo/react-native-kontaktio,Artirigo/react-native-kontaktio,Artirigo/react-native-kontaktio
8b55ba7d6d1fbd3244ce9e1bc19e691099274172
src/clientversion.h
src/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 8 #define CLIENT_VERSION_REVISION 6 #define CLIENT_VERSION_BUILD 2 // 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
#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 0 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE false // 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
Update the version number to 0.9 for a beta build.
Update the version number to 0.9 for a beta build.
C
mit
TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin
ce9d3b5bb566afb72d5d7ba4623f4f73b5dab830
cantranslator/tests/bitfield_tests.c
cantranslator/tests/bitfield_tests.c
#include <check.h> #include "bitfield.h" START_TEST (test_foo) { fail_unless(1 == 2); } END_TEST Suite* bitfieldSuite(void) { Suite* s = suite_create("bitfield"); TCase *tc_core = tcase_create("core"); tcase_add_test(tc_core, test_foo); suite_add_tcase(s, tc_core); return s; } int main(void) { int numberFailed; Suite* s = bitfieldSuite(); SRunner *sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); numberFailed = srunner_ntests_failed(sr); srunner_free(sr); return (numberFailed == 0) ? 0 : 1; }
#include <check.h> #include <stdint.h> #include "bitfield.h" START_TEST (test_size) { uint8_t data = 0xFF; fail_unless(getBitField(&data, 0, 4) == 0xF); } END_TEST Suite* bitfieldSuite(void) { Suite* s = suite_create("bitfield"); TCase *tc_core = tcase_create("core"); tcase_add_test(tc_core, test_size); suite_add_tcase(s, tc_core); return s; } int main(void) { int numberFailed; Suite* s = bitfieldSuite(); SRunner *sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); numberFailed = srunner_ntests_failed(sr); srunner_free(sr); return (numberFailed == 0) ? 0 : 1; }
Add a real test case for bitfield.
Add a real test case for bitfield. This currently fails because we're not linking the test with the objects we want to test. I tried adding the $(OBJS) variable to the build line, but because those objects are all compiled with pic32-gcc it's not going to work. I think the solution is to either: Manually list the objects we want to recompile and link with (boo) Compile our non-Arduino code into a static library that we link with.
C
bsd-3-clause
mgiannikouris/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,openxc/vi-firmware,ene-ilies/vi-firmware,openxc/vi-firmware,ene-ilies/vi-firmware,ene-ilies/vi-firmware,mgiannikouris/vi-firmware,ene-ilies/vi-firmware
c0e3faa7fc57ddefe8ecab3eca1fc866809c5def
sort_algorithms.c
sort_algorithms.c
/* Author: Dan Wilder * * School: University of Missouri - St. Louis * Semester: Fall 2015 * Class: CS 3130 - Design and Analysis of Algorithms * Instructor: Galina N. Piatnitskaia */ #include "sort_algorithms.h" void swap(int *x, int *y) { int temp = *x; *x = *y *y = temp; } void bubbleSort(int arr[], int size) { /* with swaps counting. */ int i, j; for (i = 0; i <= size-1; ++i) for (j = size; j >= i+1; --j) if (arr[j] < arr[j-1]) swap(&arr[j], &arr[j-1]); }
/* Author: Dan Wilder * * School: University of Missouri - St. Louis * Semester: Fall 2015 * Class: CS 3130 - Design and Analysis of Algorithms * Instructor: Galina N. Piatnitskaia */ #include "sort_algorithms.h" void swap(int *x, int *y) { int temp = *x; *x = *y *y = temp; } void bubbleSort(int arr[], int size) { /* with swaps counting. */ int i, j, swaps; for (i = 0; i <= size-1; ++i) { swaps = 0; for (j = size; j >= i+1; --j) if (arr[j] < arr[j-1]) { swap(&arr[j], &arr[j-1]); ++swaps; } if (swaps == 0) break; } }
Add swap counting in bubbleSort
Add swap counting in bubbleSort
C
mit
sentientWilder/Search-and-Sort,sentientWilder/Search-and-Sort
e812028de50245da9984aedc326093b0364332d1
libarchivist/archivist/cache.h
libarchivist/archivist/cache.h
#ifndef ARCH_CACHE_H #define ARCH_CACHE_H 1 #include "uuid.h" #include "record.h" #define ARCH_CACHE_MIN 31 typedef struct arch_cache_bucket { arch_uuid_t uuid; arch_record_t *record; struct arch_cache_bucket *next; } arch_cache_bucket_t; typedef struct arch_cache { struct arch_cache *old; size_t size, entries; arch_cache_bucket_t *slots[]; } arch_cache_t; arch_record_t *arch_cache_get(arch_cache_t *cache, arch_uuid_t uuid); bool arch_cache_set(arch_cache_t *cache, arch_record_t *record); #endif
#ifndef ARCH_CACHE_H #define ARCH_CACHE_H 1 #include "uuid.h" #include "record.h" #define ARCH_CACHE_MIN 31 typedef struct arch_cache_bucket { arch_uuid_t uuid; arch_record_t *record; struct arch_cache_bucket *next; } arch_cache_bucket_t; typedef struct arch_cache { struct arch_cache *old; size_t size, entries; arch_cache_bucket_t *slots[]; } arch_cache_t; #define ARCH_CACHE_BYTES(elts) (sizeof(arch_cache_t) + sizeof(arch_cache_bucket_t) * elts) arch_record_t *arch_cache_get(arch_cache_t *cache, arch_uuid_t uuid); bool arch_cache_set(arch_cache_t *cache, arch_record_t *record); #endif
Add allocation helper macro ARCH_CACHE_BYTES()
Add allocation helper macro ARCH_CACHE_BYTES()
C
bsd-2-clause
LambdaOS/Archivist
b0fd54165257fa2c62c1e700c547b597778683bb
ionWindow/CWindowManager.h
ionWindow/CWindowManager.h
#pragma once #include <ionMath.h> #include "CWindow.h" #undef CreateWindow enum class EWindowType { Fullscreen, Windowed }; class CWindowManager : public Singleton<CWindowManager>, public IEventListener { public: void Init(); void PollEvents(); bool ShouldClose() const; bool Run(); CWindow * CreateWindow(vec2i const & Size, std::string const & Title, EWindowType const Type); protected: CWindow * PrimaryWindow; std::map<GLFWwindow *, CWindow *> Windows; static void KeyCallback(GLFWwindow * window, int key, int scancode, int action, int mods); static void MouseButtonCallback(GLFWwindow * window, int button, int action, int mods); static void MouseScrollCallback(GLFWwindow * window, double xoffset, double yoffset); static void MouseCursorCallback(GLFWwindow * window, double xpos, double ypos); static void CharCallback(GLFWwindow * window, unsigned int c); private: friend class Singleton<CWindowManager>; CWindowManager(); };
#pragma once #include <ionMath.h> #include "CWindow.h" enum class EWindowType { Fullscreen, Windowed }; class CWindowManager : public Singleton<CWindowManager>, public IEventListener { public: void Init(); void PollEvents(); bool ShouldClose() const; bool Run(); #undef CreateWindow CWindow * CreateWindow(vec2i const & Size, std::string const & Title, EWindowType const Type); protected: CWindow * PrimaryWindow; std::map<GLFWwindow *, CWindow *> Windows; static void KeyCallback(GLFWwindow * window, int key, int scancode, int action, int mods); static void MouseButtonCallback(GLFWwindow * window, int button, int action, int mods); static void MouseScrollCallback(GLFWwindow * window, double xoffset, double yoffset); static void MouseCursorCallback(GLFWwindow * window, double xpos, double ypos); static void CharCallback(GLFWwindow * window, unsigned int c); private: friend class Singleton<CWindowManager>; CWindowManager(); };
Move CreateWindow undef to make its purpose more clear
Move CreateWindow undef to make its purpose more clear
C
mit
iondune/ionEngine,iondune/ionEngine
aa1c5191494846d7a7ce11a485bd24176be36886
creator/plugins/tools/vcs/vcstoolplugin.h
creator/plugins/tools/vcs/vcstoolplugin.h
/****************************************************************************** * This file is part of the Gluon Development Platform * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GLUON_CREATOR_VCSTOOLPLUGIN_H #define GLUON_CREATOR_VCSTOOLPLUGIN_H #include <creator/lib/toolplugin.h> namespace GluonCreator { class VcsToolPlugin : public ToolPlugin { Q_OBJECT public: VcsToolPlugin( QObject* parent, const QList<QVariant>& params ); ~VcsToolPlugin(); protected: QWidget* createTool( KXmlGuiWindow* parent ); }; } #endif // GLUON_CREATOR_MESSAGEDOCKPLUGIN_H
/****************************************************************************** * This file is part of the Gluon Development Platform * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GLUON_CREATOR_VCSTOOLPLUGIN_H #define GLUON_CREATOR_VCSTOOLPLUGIN_H #include <creator/lib/toolplugin.h> namespace GluonCreator { class VcsToolPlugin : public ToolPlugin { Q_OBJECT public: VcsToolPlugin( QObject* parent, const QList<QVariant>& params ); ~VcsToolPlugin(); void initialize() {} protected: QWidget* createTool( KXmlGuiWindow* parent ); }; } #endif // GLUON_CREATOR_MESSAGEDOCKPLUGIN_H
Add an empty initialize implementation in order to avoid the compilation error
Add an empty initialize implementation in order to avoid the compilation error CCMAIL: ashwin_rajeev@hotmail.com Commit "17496753" added a pure virtual initialize method to the plugin interface without extending the vcstoolplugin subclass even just with an empty body, so that is the reason why it got broken. It was not probably tested with the VCS option enabled and kdevplatform installed.
C
lgpl-2.1
KDE/gluon,KDE/gluon,KDE/gluon,KDE/gluon
19c9cc48d98add5e1f0414ce7d1885e6f3ed1e82
src/homie-node-collection.h
src/homie-node-collection.h
#pragma once #include "misc/welcome.hpp" #include "misc/ota.hpp" #include "Bme280Node.hpp" #include "ContactNode.hpp" #include "DHT22Node.hpp" #include "RelayNode.hpp"
#pragma once #include "misc/welcome.hpp" #include "misc/ota.hpp" #include "Bme280Node.hpp" #include "ButtonNode.hpp" #include "ContactNode.hpp" #include "DHT22Node.hpp" #include "RelayNode.hpp"
Include ButtonNode in header file
Include ButtonNode in header file
C
mit
luebbe/homie-node-collection
ee3c4d78acdfd67d161a3d9bac79e6597393d414
tests/test_util.c
tests/test_util.c
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" int main( int argc, char **argv ) { vartype bv[] = {0,1,0,1}; if (bitvec_to_int( bv, 4 ) != 0xA) { ERRPRINT( "bitvec_to_int( [0,1,0,1], 4) != 0xA" ); abort(); } return 0; }
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include <assert.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" void print_arr( FILE *fp, vartype *arr, int len ) { int k; assert( len > 0 ); fprintf( fp, "[" ); for (k = 0; k < len; k++) { fprintf( fp, "%d", arr[k] ); if (k < len-1) fprintf( fp, "," ); } fprintf( fp, "]" ); } void check_bitvec_to_int( vartype *bv, int len, int expected ) { if (bitvec_to_int( bv, len ) != expected) { ERRPRINT( "Unexpected return value of bitvec_to_int" ); fprintf( stderr, "bitvec_to_int( " ); print_arr( stderr, bv, len ); fprintf( stderr, ", %d ) != 0x%X\n\n", len, expected ); abort(); } } int main( int argc, char **argv ) { vartype bv_A[] = {0,1,0,1}; check_bitvec_to_int( bv_A, 4, 0xA ); return 0; }
Implement generic check of bitvec_to_int()
TEST: Implement generic check of bitvec_to_int()
C
bsd-3-clause
slivingston/gr1c,slivingston/gr1c,slivingston/gr1c