after
stringlengths
72
2.11k
before
stringlengths
21
1.55k
diff
stringlengths
85
2.31k
instruction
stringlengths
20
1.71k
license
stringclasses
13 values
repos
stringlengths
7
82.6k
commit
stringlengths
40
40
/* Copyright (c) 2017 Rolf Timmermans */ #pragma once #include <napi.h> #include <zmq.h> #if ZMQ_VERSION < ZMQ_MAKE_VERSION(4,1,0) # include <zmq_utils.h> #endif #include <node.h> #include <cassert> #include "inline/arguments.h" #include "inline/error.h" #include "inline/util.h" #ifdef __MSVC__ #define force_inline inline __forceinline #else #define force_inline inline __attribute__((always_inline)) #endif
/* Copyright (c) 2017 Rolf Timmermans */ #pragma once #include <napi.h> #include <zmq.h> #include <node.h> #include <cassert> #include <iostream> #include "inline/arguments.h" #include "inline/error.h" #include "inline/util.h" #ifdef __MSVC__ #define force_inline inline __forceinline #else #define force_inline inline __attribute__((always_inline)) #endif
--- +++ @@ -2,10 +2,14 @@ #pragma once #include <napi.h> + #include <zmq.h> +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(4,1,0) +# include <zmq_utils.h> +#endif + #include <node.h> #include <cassert> -#include <iostream> #include "inline/arguments.h" #include "inline/error.h"
Include zmq utils if necessary.
mit
rolftimmermans/zeromq-ng,rolftimmermans/zeromq-ng
a9c85baedcdb73a4f72ec1dd7dc05a8a93ea56d9
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "dense_tensor.h" namespace vespalib::tensor { /** * Class for building a dense tensor by inserting cell values directly into underlying array of cells. */ class DirectDenseTensorBuilder { public: using Cells = DenseTensor::Cells; using Address = DenseTensor::Address; private: eval::ValueType _type; Cells _cells; static size_t calculateCellAddress(const Address &address, const eval::ValueType &type) { size_t result = 0; for (size_t i = 0; i < address.size(); ++i) { result *= type.dimensions()[i].size; result += address[i]; } return result; } public: DirectDenseTensorBuilder(const eval::ValueType &type_in); ~DirectDenseTensorBuilder(); void insertCell(const Address &address, double cellValue) { insertCell(calculateCellAddress(address, _type), cellValue); } void insertCell(size_t index, double cellValue) { _cells[index] = cellValue; } Tensor::UP build(); }; }
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "dense_tensor.h" namespace vespalib::tensor { /** * Class for building a dense tensor by inserting cell values directly into underlying array of cells. */ class DirectDenseTensorBuilder { public: using Cells = DenseTensor::Cells; using Address = DenseTensor::Address; private: eval::ValueType _type; Cells _cells; static size_t calculateCellAddress(const Address &address, const eval::ValueType &type) { size_t result = 0; for (size_t i = 0; i < address.size(); ++i) { result *= type.dimensions()[i].size; result += address[i]; } return result; } public: DirectDenseTensorBuilder(const eval::ValueType &type_in); ~DirectDenseTensorBuilder(); void insertCell(const Address &address, double cellValue) { _cells[calculateCellAddress(address, _type)] = cellValue; } Tensor::UP build(); }; }
--- +++ @@ -31,7 +31,10 @@ DirectDenseTensorBuilder(const eval::ValueType &type_in); ~DirectDenseTensorBuilder(); void insertCell(const Address &address, double cellValue) { - _cells[calculateCellAddress(address, _type)] = cellValue; + insertCell(calculateCellAddress(address, _type), cellValue); + } + void insertCell(size_t index, double cellValue) { + _cells[index] = cellValue; } Tensor::UP build(); };
Allow for building index on the outside.
apache-2.0
vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa
fca387c79a274d3da8d5abb97ee9b1765188abaa
/* trace.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Tracing support for runops_cores.c. * Data Structure and Algorithms: * History: * Notes: * References: */ #ifndef PARROT_TRACE_H_GUARD #define PARROT_TRACE_H_GUARD #include "parrot/parrot.h" void trace_op_dump(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *pc); void trace_op(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *code_end, opcode_t *pc); void trace_op_b0(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *pc); void trace_op_b1(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *code_end, opcode_t *pc); #endif /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */
/* trace.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Tracing support for runops_cores.c. * Data Structure and Algorithms: * History: * Notes: * References: */ #ifndef PARROT_TRACE_H_GUARD #define PARROT_TRACE_H_GUARD #include "parrot/parrot.h" void trace_op_dump(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *pc); void trace_op(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *code_end, opcode_t *pc); void trace_op_b0(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *pc); void trace_op_b1(struct Parrot_Interp *interpreter, opcode_t *code_start, opcode_t *code_end, code_t *pc); #endif /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */
--- +++ @@ -25,7 +25,7 @@ opcode_t *pc); void trace_op_b1(struct Parrot_Interp *interpreter, opcode_t *code_start, - opcode_t *code_end, code_t *pc); + opcode_t *code_end, opcode_t *pc); #endif
Fix a typo in the argument type. Patch from <daniel.ritz@gmx.ch> git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@1106 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
artistic-2.0
gagern/parrot,FROGGS/parrot,parrot/parrot,youprofit/parrot,parrot/parrot,tkob/parrot,FROGGS/parrot,fernandobrito/parrot,FROGGS/parrot,tkob/parrot,parrot/parrot,tkob/parrot,gagern/parrot,gitster/parrot,FROGGS/parrot,gitster/parrot,tkob/parrot,tewk/parrot-select,fernandobrito/parrot,gagern/parrot,fernandobrito/parrot,gagern/parrot,parrot/parrot,gitster/parrot,fernandobrito/parrot,tewk/parrot-select,youprofit/parrot,youprofit/parrot,youprofit/parrot,youprofit/parrot,gagern/parrot,tewk/parrot-select,tewk/parrot-select,tkob/parrot,youprofit/parrot,gagern/parrot,fernandobrito/parrot,tewk/parrot-select,tkob/parrot,fernandobrito/parrot,FROGGS/parrot,FROGGS/parrot,tkob/parrot,youprofit/parrot,youprofit/parrot,gitster/parrot,tkob/parrot,gitster/parrot,gitster/parrot,tewk/parrot-select,gitster/parrot,tewk/parrot-select,FROGGS/parrot,FROGGS/parrot,fernandobrito/parrot,gagern/parrot,parrot/parrot
ef1a586474d7df11fda2a7c3064418e173c38055
// This is a queue that can be accessed from multiple threads safely. // // It's not well optimized, and requires obtaining a lock every time you check for a new value. #pragma once #include <condition_variable> #include <mutex> #include <optional> #include <queue> template <class T> class SynchronizedQueue { std::condition_variable cv_; std::mutex lock_; std::queue<T> q_; std::atomic_uint64_t input_count{0}, output_count{0}; public: void push(T && t) { std::unique_lock l(lock_); q_.push(std::move(t)); input_count++; cv_.notify_one(); } std::optional<T> get() { if(input_count == output_count) { return std::nullopt; } { std::unique_lock l(lock_); if(q_.empty()) { return std::nullopt; } output_count++; T t = std::move(q_.front()); q_.pop(); return t; } } T get_blocking() { std::unique_lock l(lock_); while(q_.empty()) { cv_.wait(l); } output_count++; T t = std::move(q_.front()); q_.pop(); return std::move(t); } };
// This is a queue that can be accessed from multiple threads safely. // // It's not well optimized, and requires obtaining a lock every time you check for a new value. #pragma once #include <condition_variable> #include <mutex> #include <optional> #include <queue> template <class T> class SynchronizedQueue { std::condition_variable cv_; std::mutex lock_; std::queue<T> q_; public: void push(T && t) { std::unique_lock l(lock_); q_.push(std::move(t)); cv_.notify_one(); } std::optional<T> get() { std::unique_lock l(lock_); if(q_.empty()) { return std::nullopt; } T t = std::move(q_.front()); q_.pop(); return t; } T get_blocking() { std::unique_lock l(lock_); while(q_.empty()) { cv_.wait(l); } T t = std::move(q_.front()); q_.pop(); return std::move(t); } };
--- +++ @@ -14,23 +14,31 @@ std::condition_variable cv_; std::mutex lock_; std::queue<T> q_; + std::atomic_uint64_t input_count{0}, output_count{0}; public: void push(T && t) { std::unique_lock l(lock_); q_.push(std::move(t)); + input_count++; cv_.notify_one(); } std::optional<T> get() { - std::unique_lock l(lock_); - if(q_.empty()) { + if(input_count == output_count) { return std::nullopt; } + { + std::unique_lock l(lock_); + if(q_.empty()) { + return std::nullopt; + } - T t = std::move(q_.front()); - q_.pop(); - return t; + output_count++; + T t = std::move(q_.front()); + q_.pop(); + return t; + } } T get_blocking() { @@ -39,6 +47,7 @@ cv_.wait(l); } + output_count++; T t = std::move(q_.front()); q_.pop(); return std::move(t);
Increase the efficiency of multithreading. This should slightly slightly increase frame rate.
mit
leecbaker/datareftool,leecbaker/datareftool,leecbaker/datareftool
4740d588a16d45add192ed3ea58627f06cba9b3f
#pragma once #include <string> #include <ostream> #include <iomanip> #include <iostream> struct Hex { Hex(char *buffer, size_t size) : m_buffer(buffer) , m_size(size) { } friend std::ostream& operator <<(std::ostream &os, const Hex &obj) { unsigned char* aschar = (unsigned char*)obj.m_buffer; for (size_t i = 0; i < obj.m_size; ++i) { if (isprint(aschar[i])) { os << aschar[i]; } else { os << "\\x" << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]); } } return os; } private: char *m_buffer; size_t m_size; };
#pragma once #include <string> #include <ostream> #include <iomanip> #include <iostream> struct Hex { Hex(char *buffer, size_t size) : m_buffer(buffer) , m_size(size) { } friend std::ostream& operator <<(std::ostream &os, const Hex &obj) { unsigned char* aschar = (unsigned char*)obj.m_buffer; for (size_t i = 0; i < obj.m_size; ++i) { if (isprint(aschar[i])) { os << aschar[i]; } else { os << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]); } } return os; } private: char *m_buffer; size_t m_size; };
--- +++ @@ -21,7 +21,7 @@ if (isprint(aschar[i])) { os << aschar[i]; } else { - os << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]); + os << "\\x" << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]); } } return os;
Add "\x" for hex part.
mit
azat/hadoop-io-sequence-reader
a2e999b2cae9f2ff7dab4362c052a88b3d7440d3
/************************************************* * SHA1PRNG RNG Header File * * (C) 2007 FlexSecure GmbH / Manuel Hartl * * (C) 2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_SHA1PRNG_H__ #define BOTAN_SHA1PRNG_H__ #include <botan/rng.h> #include <botan/base.h> namespace Botan { /************************************************* * SHA1PRNG * *************************************************/ class BOTAN_DLL SHA1PRNG : public RandomNumberGenerator { public: void randomize(byte[], u32bit) throw(PRNG_Unseeded); bool is_seeded() const; void clear() throw(); std::string name() const; SHA1PRNG(RandomNumberGenerator* = 0); ~SHA1PRNG(); private: void add_randomness(const byte[], u32bit); void update_state(byte[]); RandomNumberGenerator* prng; HashFunction* hash; SecureVector<byte> buffer; SecureVector<byte> state; int buf_pos; }; } #endif
/************************************************* * SHA1PRNG RNG Header File * * (C) 2007 FlexSecure GmbH / Manuel Hartl * * (C) 2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_SHA1PRNG_H__ #define BOTAN_SHA1PRNG_H__ #include <botan/rng.h> #include <botan/base.h> namespace Botan { /************************************************* * SHA1PRNG * *************************************************/ class SHA1PRNG : public RandomNumberGenerator { public: void randomize(byte[], u32bit) throw(PRNG_Unseeded); bool is_seeded() const; void clear() throw(); std::string name() const; SHA1PRNG(RandomNumberGenerator* = 0); ~SHA1PRNG(); private: void add_randomness(const byte[], u32bit); void update_state(byte[]); RandomNumberGenerator* prng; HashFunction* hash; SecureVector<byte> buffer; SecureVector<byte> state; int buf_pos; }; } #endif
--- +++ @@ -15,7 +15,7 @@ /************************************************* * SHA1PRNG * *************************************************/ -class SHA1PRNG : public RandomNumberGenerator +class BOTAN_DLL SHA1PRNG : public RandomNumberGenerator { public: void randomize(byte[], u32bit) throw(PRNG_Unseeded);
Add missing BOTAN_DLL decl to SHA1PRNG class declaration
bsd-2-clause
webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,randombit/botan
82a1df8942be8551ab365db20e35ca6a2b7e0d85
#ifndef ALI_DECAYER__H #define ALI_DECAYER__H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ #include "RVersion.h" #include "TVirtualMCDecayer.h" typedef TVirtualMCDecayer AliDecayer; #if ROOT_VERSION_CODE >= 197633 //Corresponds to Root v3-04-01 typedef enum { kSemiElectronic, kDiElectron, kSemiMuonic, kDiMuon, kBJpsiDiMuon, kBJpsiDiElectron, kBPsiPrimeDiMuon, kBPsiPrimeDiElectron, kPiToMu, kKaToMu, kNoDecay, kHadronicD, kOmega, kPhiKK, kAll, kNoDecayHeavy, kHardMuons, kBJpsi, kWToMuon,kWToCharm, kWToCharmToMuon, kNewTest } Decay_t; #endif #endif //ALI_DECAYER__H
#ifndef ALI_DECAYER__H #define ALI_DECAYER__H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ #include "RVersion.h" #include "TVirtualMCDecayer.h" typedef TVirtualMCDecayer AliDecayer; #if ROOT_VERSION_CODE >= 197633 //Corresponds to Root v3-04-01 typedef enum { kSemiElectronic, kDiElectron, kSemiMuonic, kDiMuon, kBJpsiDiMuon, kBJpsiDiElectron, kBPsiPrimeDiMuon, kBPsiPrimeDiElectron, kPiToMu, kKaToMu, kNoDecay, kHadronicD, kOmega, kPhiKK, kAll, kNoDecayHeavy, kHardMuons, kBJpsi, kWToMuon,kWToCharm, kWToCharmToMuon } Decay_t; #endif #endif //ALI_DECAYER__H
--- +++ @@ -18,7 +18,7 @@ kBPsiPrimeDiMuon, kBPsiPrimeDiElectron, kPiToMu, kKaToMu, kNoDecay, kHadronicD, kOmega, kPhiKK, kAll, kNoDecayHeavy, kHardMuons, kBJpsi, - kWToMuon,kWToCharm, kWToCharmToMuon + kWToMuon,kWToCharm, kWToCharmToMuon, kNewTest } Decay_t; #endif
Test case for B0 -> mu
bsd-3-clause
jgrosseo/AliRoot,alisw/AliRoot,sebaleh/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,jgrosseo/AliRoot,ALICEHLT/AliRoot,coppedis/AliRoot,mkrzewic/AliRoot,coppedis/AliRoot,jgrosseo/AliRoot,ALICEHLT/AliRoot,miranov25/AliRoot,mkrzewic/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,mkrzewic/AliRoot,shahor02/AliRoot,miranov25/AliRoot,shahor02/AliRoot,shahor02/AliRoot,sebaleh/AliRoot,jgrosseo/AliRoot,coppedis/AliRoot,shahor02/AliRoot,ecalvovi/AliRoot,alisw/AliRoot,ALICEHLT/AliRoot,alisw/AliRoot,jgrosseo/AliRoot,alisw/AliRoot,shahor02/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,mkrzewic/AliRoot,mkrzewic/AliRoot,ALICEHLT/AliRoot,coppedis/AliRoot,miranov25/AliRoot,alisw/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,shahor02/AliRoot,ecalvovi/AliRoot,mkrzewic/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,jgrosseo/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,shahor02/AliRoot,alisw/AliRoot,miranov25/AliRoot,ALICEHLT/AliRoot,jgrosseo/AliRoot,ecalvovi/AliRoot,sebaleh/AliRoot,miranov25/AliRoot,miranov25/AliRoot,miranov25/AliRoot,ecalvovi/AliRoot,ALICEHLT/AliRoot,ecalvovi/AliRoot,miranov25/AliRoot
58f00f52de054b44bec79497e33805f57d8bc8e5
#ifndef VAST_ACCESS_H #define VAST_ACCESS_H namespace vast { /// Wrapper to encapsulate the implementation of concepts requiring access to /// private state. struct access { template <typename, typename = void> struct state; template <typename, typename = void> struct parser; template <typename, typename = void> struct printer; template <typename, typename = void> struct converter; }; namespace detail { struct has_access_state { template <typename T> static auto test(T* x) -> decltype(access::state<T>{}, std::true_type()); template <typename> static auto test(...) -> std::false_type; }; struct has_access_parser { template <typename T> static auto test(T* x) -> decltype(access::parser<T>{}, std::true_type()); template <typename> static auto test(...) -> std::false_type; }; struct has_access_printer { template <typename T> static auto test(T* x) -> decltype(access::printer<T>{}, std::true_type()); template <typename> static auto test(...) -> std::false_type; }; struct has_access_converter { template <typename T> static auto test(T* x) -> decltype(access::converter<T>{}, std::true_type()); template <typename> static auto test(...) -> std::false_type; }; } // namespace detail template <typename T> struct has_access_state : decltype(detail::has_access_state::test<T>(0)) {}; template <typename T> struct has_access_parser : decltype(detail::has_access_parser::test<T>(0)) {}; template <typename T> struct has_access_printer : decltype(detail::has_access_printer::test<T>(0)) {}; template <typename T> struct has_access_converter : decltype(detail::has_access_converter::test<T>(0)) {}; } // namespace vast #endif
#ifndef VAST_ACCESS_H #define VAST_ACCESS_H namespace vast { /// Wrapper to encapsulate the implementation of concepts requiring access to /// private state. struct access { template <typename, typename = void> struct state; template <typename, typename = void> struct parsable; template <typename, typename = void> struct printable; template <typename, typename = void> struct convertible; }; } // namespace vast #endif
--- +++ @@ -11,14 +11,66 @@ struct state; template <typename, typename = void> - struct parsable; + struct parser; template <typename, typename = void> - struct printable; + struct printer; template <typename, typename = void> - struct convertible; + struct converter; }; + +namespace detail { + +struct has_access_state +{ + template <typename T> + static auto test(T* x) -> decltype(access::state<T>{}, std::true_type()); + + template <typename> + static auto test(...) -> std::false_type; +}; + +struct has_access_parser +{ + template <typename T> + static auto test(T* x) -> decltype(access::parser<T>{}, std::true_type()); + + template <typename> + static auto test(...) -> std::false_type; +}; + +struct has_access_printer +{ + template <typename T> + static auto test(T* x) -> decltype(access::printer<T>{}, std::true_type()); + + template <typename> + static auto test(...) -> std::false_type; +}; + +struct has_access_converter +{ + template <typename T> + static auto test(T* x) -> decltype(access::converter<T>{}, std::true_type()); + + template <typename> + static auto test(...) -> std::false_type; +}; + +} // namespace detail + +template <typename T> +struct has_access_state : decltype(detail::has_access_state::test<T>(0)) {}; + +template <typename T> +struct has_access_parser : decltype(detail::has_access_parser::test<T>(0)) {}; + +template <typename T> +struct has_access_printer : decltype(detail::has_access_printer::test<T>(0)) {}; + +template <typename T> +struct has_access_converter : decltype(detail::has_access_converter::test<T>(0)) {}; } // namespace vast
Add traits for befriendable concepts.
bsd-3-clause
pmos69/vast,mavam/vast,pmos69/vast,mavam/vast,vast-io/vast,vast-io/vast,vast-io/vast,pmos69/vast,vast-io/vast,vast-io/vast,mavam/vast,mavam/vast,pmos69/vast
3c7b73f39d31cddf1c2126e1d3e25fd8c9708235
/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS. Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include <assert.h> #include <rtems/error.h> #include <rtems/system.h> #include <rtems/rtems/tasks.h> /* RTEMS does not support GNU TLS extension __thread. */ void __wrap_rtems_task_variable_add (void **var) { rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL); if (sc != RTEMS_SUCCESSFUL) { rtems_error (sc, "rtems_task_variable_add failed"); assert (0); } }
/* rtems-task-variable-add.c -- adding a task specific variable in RTEMS OS. Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include <rtems/error.h> #include <rtems/system.h> #include <rtems/rtems/tasks.h> /* RTEMS does not support GNU TLS extension __thread. */ void __wrap_rtems_task_variable_add (void **var) { rtems_status_code sc = rtems_task_variable_add (RTEMS_SELF, var, NULL); if (sc != RTEMS_SUCCESSFUL) { rtems_error (sc, "rtems_task_variable_add failed"); } }
--- +++ @@ -3,6 +3,8 @@ Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ + +#include <assert.h> #include <rtems/error.h> #include <rtems/system.h> @@ -16,6 +18,7 @@ if (sc != RTEMS_SUCCESSFUL) { rtems_error (sc, "rtems_task_variable_add failed"); + assert (0); } }
Add assert on rtems_task_variable_add error. assert is used so that if rtems_task_variable_add fails, the error is fatal. R=iant CC=gofrontend-dev, joel.sherrill https://golang.org/cl/1684053
bsd-3-clause
qskycolor/gofrontend,golang/gofrontend,golang/gofrontend,anlhord/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,qskycolor/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,qskycolor/gofrontend,anlhord/gofrontend,qskycolor/gofrontend,golang/gofrontend,anlhord/gofrontend,golang/gofrontend,anlhord/gofrontend
c5c547e1faeeb300fb7a7d4976f561bb01496cad
// // OCHamcrest - HCReturnTypeHandler.h // Copyright 2014 hamcrest.org. See LICENSE.txt // // Created by: Jon Reid, http://qualitycoding.org/ // Docs: http://hamcrest.github.com/OCHamcrest/ // Source: https://github.com/hamcrest/OCHamcrest // #import <Foundation/Foundation.h> /** Chain-of-responsibility for handling NSInvocation return types. */ @interface HCReturnTypeHandler : NSObject @property (nonatomic, strong) HCReturnTypeHandler *successor; - (instancetype)initWithType:(char const *)handlerType; - (id)valueForReturnType:(char const *)type fromInvocation:(NSInvocation *)invocation; @end
// // OCHamcrest - HCReturnTypeHandler.h // Copyright 2014 hamcrest.org. See LICENSE.txt // // Created by: Jon Reid, http://qualitycoding.org/ // Docs: http://hamcrest.github.com/OCHamcrest/ // Source: https://github.com/hamcrest/OCHamcrest // #import <Foundation/Foundation.h> @interface HCReturnTypeHandler : NSObject @property (nonatomic, strong) HCReturnTypeHandler *successor; - (instancetype)initWithType:(char const *)handlerType; - (id)valueForReturnType:(char const *)type fromInvocation:(NSInvocation *)invocation; @end
--- +++ @@ -10,6 +10,9 @@ #import <Foundation/Foundation.h> +/** + Chain-of-responsibility for handling NSInvocation return types. + */ @interface HCReturnTypeHandler : NSObject @property (nonatomic, strong) HCReturnTypeHandler *successor;
Add comment to explicitly identify Chain of Responsibility
bsd-2-clause
hamcrest/OCHamcrest,hamcrest/OCHamcrest,klundberg/OCHamcrest,klundberg/OCHamcrest,hamcrest/OCHamcrest
53ed2c4576f6e25c3c409d61c1f59b7221631554
#pragma once #include <string> #include <vector> struct usdt_probe_entry { std::string path; std::string provider; std::string name; int num_locations; }; typedef std::vector<usdt_probe_entry> usdt_probe_list; // Note this class is fully static because bcc_usdt_foreach takes a function // pointer callback without a context variable. So we must keep global state. class USDTHelper { public: static usdt_probe_entry find(int pid, const std::string &target, const std::string &provider, const std::string &name); static usdt_probe_list probes_for_provider(const std::string &provider); static usdt_probe_list probes_for_pid(int pid); static usdt_probe_list probes_for_path(const std::string &path); static void read_probes_for_pid(int pid); static void read_probes_for_path(const std::string &path); };
#pragma once #include <string> #include <vector> struct usdt_probe_entry { std::string path; std::string provider; std::string name; int num_locations; }; typedef std::vector<usdt_probe_entry> usdt_probe_list; class USDTHelper { public: static usdt_probe_entry find(int pid, const std::string &target, const std::string &provider, const std::string &name); static usdt_probe_list probes_for_provider(const std::string &provider); static usdt_probe_list probes_for_pid(int pid); static usdt_probe_list probes_for_path(const std::string &path); static void read_probes_for_pid(int pid); static void read_probes_for_path(const std::string &path); };
--- +++ @@ -13,6 +13,8 @@ typedef std::vector<usdt_probe_entry> usdt_probe_list; +// Note this class is fully static because bcc_usdt_foreach takes a function +// pointer callback without a context variable. So we must keep global state. class USDTHelper { public:
NFC: Add comment for why USDTHelper is static
apache-2.0
iovisor/bpftrace,iovisor/bpftrace,iovisor/bpftrace,iovisor/bpftrace
a6b59d5f22fc3329d3514094e43aa2b27271b632
#pragma once #if !defined( NS_CONCAT_ ) #define NS_CONCAT_( A, B ) A##B #endif /* !defined( NS_CONCAT ) */ #if !defined( NS_CONCAT ) #define NS_CONCAT( A, B ) NS_CONCAT_( A, B ) #endif /* !defined( NS_CONCAT ) */ #if !defined( __NAMESPACE ) #define __NAMESPACE #endif /* !defined( __NAMESPACE ) */ #if !defined( NS ) #define NS(name) NS_CONCAT( __NAMESPACE, name ) #endif /* !defined( NS ) */ /* end: sixtracklib/_impl/namespace_begin.h */
#pragma once #if !defined( NS_CONCAT_ ) #define NS_CONCAT_( A, B ) A##B #endif /* !defined( NS_CONCAT ) */ #if !defined( NS_CONCAT ) #define NS_CONCAT( A, B ) NS_CONCAT_( A, B ) #endif /* !defined( NS_CONCAT ) */ #if !defined( NAMESPACE ) #define NAMESPACE #endif /* !defined( NAMESPACE ) */ #if !defined( NS ) #define NS(name) NS_CONCAT( NAMESPACE, name ) #endif /* !defined( NS ) */ /* end: sixtracklib/_impl/namespace_begin.h */
--- +++ @@ -8,12 +8,12 @@ #define NS_CONCAT( A, B ) NS_CONCAT_( A, B ) #endif /* !defined( NS_CONCAT ) */ -#if !defined( NAMESPACE ) - #define NAMESPACE -#endif /* !defined( NAMESPACE ) */ +#if !defined( __NAMESPACE ) + #define __NAMESPACE +#endif /* !defined( __NAMESPACE ) */ #if !defined( NS ) - #define NS(name) NS_CONCAT( NAMESPACE, name ) + #define NS(name) NS_CONCAT( __NAMESPACE, name ) #endif /* !defined( NS ) */ /* end: sixtracklib/_impl/namespace_begin.h */
Fix not yet corrected NAMESPACE macro
lgpl-2.1
SixTrack/SixTrackLib,SixTrack/SixTrackLib,SixTrack/SixTrackLib,SixTrack/SixTrackLib
859f0d817daea24874bda1f07d350be481cc1012
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef MATH_H #define MATH_H #include "common/halfling_sys.h" namespace Common { template<typename T> inline T Min(const T& a, const T& b) { return a < b ? a : b; } template<typename T> inline T Max(const T& a, const T& b) { return a > b ? a : b; } template<typename T> inline T Lerp(const T& a, const T& b, float t) { return a + (b - a)*t; } template<typename T> inline T Clamp(const T& x, const T& low, const T& high) { return x < low ? low : (x > high ? high : x); } // Returns random float in [0, 1). static float RandF() { return (float)(rand()) / (float)RAND_MAX; } // Returns random float in [a, b). static float RandF(float a, float b) { return a + RandF()*(b - a); } } // End of namespace Common #endif // MATHHELPER_H
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef MATH_H #define MATH_H namespace Common { template<typename T> inline T Min(const T& a, const T& b) { return a < b ? a : b; } template<typename T> inline T Max(const T& a, const T& b) { return a > b ? a : b; } template<typename T> inline T Lerp(const T& a, const T& b, float t) { return a + (b - a)*t; } template<typename T> inline T Clamp(const T& x, const T& low, const T& high) { return x < low ? low : (x > high ? high : x); } } // End of namespace Common #endif // MATHHELPER_H
--- +++ @@ -6,6 +6,8 @@ #ifndef MATH_H #define MATH_H + +#include "common/halfling_sys.h" namespace Common { @@ -30,6 +32,16 @@ return x < low ? low : (x > high ? high : x); } +// Returns random float in [0, 1). +static float RandF() { + return (float)(rand()) / (float)RAND_MAX; +} + +// Returns random float in [a, b). +static float RandF(float a, float b) { + return a + RandF()*(b - a); +} + } // End of namespace Common #endif // MATHHELPER_H
COMMON: Create helper functions for creating random floats
apache-2.0
RichieSams/thehalflingproject,RichieSams/thehalflingproject,RichieSams/thehalflingproject
55e3f242fddf4256c96878167d432e176b9650c8
#define CONSOLE_CMD /* Console command */ #define DIGEST_CMD /* Image crypto digest commands */ #define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ #define IMAGE_COMBOOT /* COMBOOT */ #define IMAGE_TRUST_CMD /* Image trust management commands */ #define IMAGE_GZIP /* GZIP image support */ #define IMAGE_ZLIB /* ZLIB image support */ #define NET_PROTO_IPV6 /* IPv6 protocol */ #define NSLOOKUP_CMD /* DNS resolving command */ #define NTP_CMD /* NTP commands */ #define PCI_CMD /* PCI commands */ #define REBOOT_CMD /* Reboot command */ #define TIME_CMD /* Time commands */ #define VLAN_CMD /* VLAN commands */
#define CONSOLE_CMD /* Console command */ #define DIGEST_CMD /* Image crypto digest commands */ #define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ #define IMAGE_COMBOOT /* COMBOOT */ #define IMAGE_TRUST_CMD /* Image trust management commands */ #define NET_PROTO_IPV6 /* IPv6 protocol */ #define NSLOOKUP_CMD /* DNS resolving command */ #define NTP_CMD /* NTP commands */ #define PCI_CMD /* PCI commands */ #define REBOOT_CMD /* Reboot command */ #define TIME_CMD /* Time commands */ #define VLAN_CMD /* VLAN commands */
--- +++ @@ -1,8 +1,10 @@ -#define CONSOLE_CMD /* Console command */ +#define CONSOLE_CMD /* Console command */ #define DIGEST_CMD /* Image crypto digest commands */ -#define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ +#define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ #define IMAGE_COMBOOT /* COMBOOT */ -#define IMAGE_TRUST_CMD /* Image trust management commands */ +#define IMAGE_TRUST_CMD /* Image trust management commands */ +#define IMAGE_GZIP /* GZIP image support */ +#define IMAGE_ZLIB /* ZLIB image support */ #define NET_PROTO_IPV6 /* IPv6 protocol */ #define NSLOOKUP_CMD /* DNS resolving command */ #define NTP_CMD /* NTP commands */
Enable GZIP and ZLIB options in iPXE
apache-2.0
antonym/netboot.xyz,antonym/netboot.xyz,antonym/netboot.xyz
95411cf0b5dadfe821f4121721c0f50e806c4630
/* Return the copyright string. This is updated manually. */ #include "Python.h" static char cprt[] = "Copyright (c) 2000 BeOpen.com. All Rights Reserved.\n\ Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\ All Rights Reserved.\n\ Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n\ All Rights Reserved."; const char * Py_GetCopyright(void) { return cprt; }
/* Return the copyright string. This is updated manually. */ #include "Python.h" static char cprt[] = "Copyright (c) 2000 BeOpen.com; All Rights Reserved.\n\ Copyright (c) 1995-2000 Corporation for National Research Initiatives;\n\ All Rights Reserved.\n\ Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam;\n\ All Rights Reserved."; const char * Py_GetCopyright(void) { return cprt; }
--- +++ @@ -3,10 +3,10 @@ #include "Python.h" static char cprt[] = -"Copyright (c) 2000 BeOpen.com; All Rights Reserved.\n\ -Copyright (c) 1995-2000 Corporation for National Research Initiatives;\n\ +"Copyright (c) 2000 BeOpen.com. All Rights Reserved.\n\ +Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\ All Rights Reserved.\n\ -Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam;\n\ +Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n\ All Rights Reserved."; const char *
Use periods, not semicolons between Copyright and All Rights Reserved.
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
e4ad8ed638d3147d95d41940a50d59f82597a18f
/** * Phase 01 - Get a Window that works and can be closed. * * This code won't be structured very well, just trying to get stuff working. */ #include <stdlib.h> int main(int argc, char *argv[]) { return EXIT_SUCCESS; }
#include <stdlib.h> int main(int argc, char *argv[]) { return EXIT_SUCCESS; }
--- +++ @@ -1,3 +1,8 @@ +/** + * Phase 01 - Get a Window that works and can be closed. + * + * This code won't be structured very well, just trying to get stuff working. + */ #include <stdlib.h> int main(int argc, char *argv[])
Add a little header explaining the purpose of phase-01
mit
Faison/xlib-learning
db57bd7faea002d5e73e0468a6e131416c1059df
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.06.00.12-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 6 #define QLA_DRIVER_PATCH_VER 0 #define QLA_DRIVER_BETA_VER 0
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2013 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.06.00.08-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 6 #define QLA_DRIVER_PATCH_VER 0 #define QLA_DRIVER_BETA_VER 0
--- +++ @@ -7,7 +7,7 @@ /* * Driver version */ -#define QLA2XXX_VERSION "8.06.00.08-k" +#define QLA2XXX_VERSION "8.06.00.12-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 6
[SCSI] qla2xxx: Update the driver version to 8.06.00.12-k. Signed-off-by: Giridhar Malavali <799b6491fce2c7a80b5fedcf9a728560cc9eb954@qlogic.com> Signed-off-by: Saurav Kashyap <88d6fd94e71a9ac276fc44f696256f466171a3c0@qlogic.com> Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>
mit
KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs
81cb088385ca4a1f63b7b308a8766117eaf90c09
#include "drmP.h" #include "drm.h" #include "nouveau_drv.h" #include "nouveau_drm.h" int nv04_mc_init(struct drm_device *dev) { /* Power up everything, resetting each individual unit will * be done later if needed. */ nv_wr32(dev, NV03_PMC_ENABLE, 0xFFFFFFFF); /* Disable PROM access. */ nv_wr32(dev, NV_PBUS_PCI_NV_20, NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED); return 0; } void nv04_mc_takedown(struct drm_device *dev) { }
#include "drmP.h" #include "drm.h" #include "nouveau_drv.h" #include "nouveau_drm.h" int nv04_mc_init(struct drm_device *dev) { /* Power up everything, resetting each individual unit will * be done later if needed. */ nv_wr32(dev, NV03_PMC_ENABLE, 0xFFFFFFFF); return 0; } void nv04_mc_takedown(struct drm_device *dev) { }
--- +++ @@ -11,6 +11,10 @@ */ nv_wr32(dev, NV03_PMC_ENABLE, 0xFFFFFFFF); + + /* Disable PROM access. */ + nv_wr32(dev, NV_PBUS_PCI_NV_20, NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED); + return 0; }
drm/nouveau: Disable PROM access on init. On older cards (<nv17) scanout gets blocked when the ROM is being accessed. PROM access usually comes out enabled from suspend, switch it off. Signed-off-by: Francisco Jerez <5906ff32bdd9fd8db196f6ba5ad3afd6f9257ea5@riseup.net> Signed-off-by: Ben Skeggs <d9f27fb07c1e9f131223ad827fa5179f3846c30b@redhat.com>
mit
KristFoundation/Programs,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,TeamVee-Kanas/android_kernel_samsung_kanas
112d20ad5ca06a9ec7237602ee33bef6fa881daa
// PARAM: --disable ana.int.def_exc --enable ana.int.interval --enable ana.int.congruence --enable ana.int.congruence_no_overflow --enable ana.int.refinement #include <assert.h> int main(){ int r = -103; for (int i = 0; i < 40; i++) { r = r + 5; } // At this point r in the congr. dom should be 2 + 5Z int k = r; if (k >= 3) { // After refinement with congruences, the lower bound should be 7 as the numbers 3 - 6 are not in the congr. class assert (k < 7); // FAIL } if (r >= -11 && r <= -4) { assert (r == -8); } return 0; }
// PARAM: --disable ana.int.def_exc --enable ana.int.interval --enable ana.int.congruence #include <assert.h> int main(){ int r = -103; for (int i = 0; i < 40; i++) { r = r + 5; } // At this point r in the congr. dom should be 2 + 5Z int k = r; if (k >= 3) { // After refinement with congruences, the lower bound should be 7 as the numbers 3 - 6 are not in the congr. class assert (k < 7); // FAIL } if (r >= -11 && r <= -4) { assert (r == -8); } return 0; }
--- +++ @@ -1,4 +1,4 @@ -// PARAM: --disable ana.int.def_exc --enable ana.int.interval --enable ana.int.congruence +// PARAM: --disable ana.int.def_exc --enable ana.int.interval --enable ana.int.congruence --enable ana.int.congruence_no_overflow --enable ana.int.refinement #include <assert.h> int main(){ @@ -6,6 +6,7 @@ for (int i = 0; i < 40; i++) { r = r + 5; } + // At this point r in the congr. dom should be 2 + 5Z int k = r; if (k >= 3) {
Add updated params to interval-congruence ref. reg test
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
586336cfe52c6e626583dbe20dbaf8cd50d3608b
@import UIKit; @protocol HYPScatterPlotDataSource; @class HYPScatterPoint; @class HYPScatterLabel; @interface HYPScatterPlot : UIView @property (nonatomic) UIColor *averageLineColor; @property (nonatomic) UIColor *xAxisColor; @property (nonatomic) UIColor *yAxisMidGradient; @property (nonatomic) UIColor *yAxisEndGradient; @property (nonatomic, weak) id<HYPScatterPlotDataSource> dataSource; @end @protocol HYPScatterPlotDataSource <NSObject> @required /** @return should be a list of HYPScatterPoint objects */ - (NSArray *)scatterPointsForScatterPlot:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)maximumXValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)minimumXValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)maximumYValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)minimumYValue:(HYPScatterPlot *)scatterPlot; @optional - (CGFloat)averageYValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)minimumYLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)maximumYLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)minimumXLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)maximumXLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)averageLabel:(HYPScatterPlot *)scatterPlot; @end
@import UIKit; @protocol HYPScatterPlotDataSource; @class HYPScatterPoint; @class HYPScatterLabel; @interface HYPScatterPlot : UIView @property (nonatomic) UIColor *averageLineColor; @property (nonatomic) UIColor *xAxisColor; @property (nonatomic) UIColor *yAxisMidGradient; @property (nonatomic) UIColor *yAxisEndGradient; @property (nonatomic, weak) id<HYPScatterPlotDataSource> dataSource; @end @protocol HYPScatterPlotDataSource <NSObject> @required - (NSArray *)scatterPointsForScatterPlot:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)maximumXValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)minimumXValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)maximumYValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)minimumYValue:(HYPScatterPlot *)scatterPlot; @optional - (CGFloat)averageYValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)minimumYLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)maximumYLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)minimumXLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)maximumXLabel:(HYPScatterPlot *)scatterPlot; - (HYPScatterLabel *)averageLabel:(HYPScatterPlot *)scatterPlot; @end
--- +++ @@ -20,6 +20,10 @@ @required +/** + + @return should be a list of HYPScatterPoint objects + */ - (NSArray *)scatterPointsForScatterPlot:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)maximumXValue:(HYPScatterPlot *)scatterPlot; - (HYPScatterPoint *)minimumXValue:(HYPScatterPlot *)scatterPlot;
Add an important info. for scatter datasource
mit
hyperoslo/Scatter
040f741c3387244091f24f7232ee85485b77f1f3
// Douglas Hill, May 2015 // https://github.com/douglashill/DHScatterGraph extern double const DHScatterGraphVersionNumber; extern unsigned char const DHScatterGraphVersionString[]; #import <DHScatterGraph/DHScatterGraphLineAttributes.h> #import <DHScatterGraph/DHScatterGraphPointSet.h> #import <DHScatterGraph/DHScatterGraphView.h>
// Douglas Hill, May 2015 // https://github.com/douglashill/DHScatterGraph #import <DHScatterGraph/DHScatterGraphLineAttributes.h> #import <DHScatterGraph/DHScatterGraphPointSet.h> #import <DHScatterGraph/DHScatterGraphView.h>
--- +++ @@ -1,5 +1,8 @@ // Douglas Hill, May 2015 // https://github.com/douglashill/DHScatterGraph + +extern double const DHScatterGraphVersionNumber; +extern unsigned char const DHScatterGraphVersionString[]; #import <DHScatterGraph/DHScatterGraphLineAttributes.h> #import <DHScatterGraph/DHScatterGraphPointSet.h>
Add framework version info to umbrella header The values of these constants are provided by Xcode’s automatically generated DerivedSources/DHScatterGraph_vers.c.
mit
douglashill/DHScatterGraph
56e734d78f593b0da4fce749ead8c841e3453ba8
#include <stdint.h> #include "stm8s208s.h" void main(void) { MEMLOC(CLK_CKDIVR) = 0x00; /* Set the frequency to 16 MHz */ BITSET(CLK_PCKENR1, 7); /* Enable clk to TIM1 */ // Configure timer // 250 ticks per second MEMLOC(TIM1_PSCRH) = (64000>>8); MEMLOC(TIM1_PSCRL) = (uint8_t)(64000 & 0xff); MEMLOC(TIM1_CR1) = 0x01; /* Enable timer */ BITSET(PB_DDR, 0); /* Set PB0 as output */ BITRST(PB_CR2, 0); /* Set low speed mode */ BITSET(PB_CR1, 0); /* Set Push/Pull mode */ for(;;) { if ((MEMLOC(TIM1_CNTRL)) % 250 <= 125) { BITTOG(PB_ODR, 0); } } }
#include <stdint.h> #include "stm8s208s.h" void main(void) { MEMLOC(CLK_CKDIVR) = 0x00; // Set the frequency to 16 MHz BITSET(CLK_PCKENR1, 7); // Configure timer // 1000 ticks per second MEMLOC(TIM1_PSCRH) = (16000>>8); MEMLOC(TIM1_PSCRL) = (uint8_t)(16000 & 0xff); // Enable timer MEMLOC(TIM1_CR1) = 0x01; /* Set PB0 as output */ BITSET(PB_DDR, 0); /* Set low speed mode */ BITRST(PB_CR2, 0); /* Set Push/Pull mode */ BITSET(PB_CR1, 0); for(;;) { if ((MEMLOC(TIM1_CNTRL)) % 1000 <= 500) { BITTOG(PB_ODR, 0); } } }
--- +++ @@ -3,28 +3,22 @@ void main(void) { - MEMLOC(CLK_CKDIVR) = 0x00; // Set the frequency to 16 MHz - BITSET(CLK_PCKENR1, 7); + MEMLOC(CLK_CKDIVR) = 0x00; /* Set the frequency to 16 MHz */ + BITSET(CLK_PCKENR1, 7); /* Enable clk to TIM1 */ // Configure timer - // 1000 ticks per second - MEMLOC(TIM1_PSCRH) = (16000>>8); - MEMLOC(TIM1_PSCRL) = (uint8_t)(16000 & 0xff); - // Enable timer - MEMLOC(TIM1_CR1) = 0x01; + // 250 ticks per second + MEMLOC(TIM1_PSCRH) = (64000>>8); + MEMLOC(TIM1_PSCRL) = (uint8_t)(64000 & 0xff); - /* Set PB0 as output */ - BITSET(PB_DDR, 0); + MEMLOC(TIM1_CR1) = 0x01; /* Enable timer */ - /* Set low speed mode */ - BITRST(PB_CR2, 0); + BITSET(PB_DDR, 0); /* Set PB0 as output */ + BITRST(PB_CR2, 0); /* Set low speed mode */ + BITSET(PB_CR1, 0); /* Set Push/Pull mode */ - /* Set Push/Pull mode */ - BITSET(PB_CR1, 0); - - for(;;) - { - if ((MEMLOC(TIM1_CNTRL)) % 1000 <= 500) { + for(;;) { + if ((MEMLOC(TIM1_CNTRL)) % 250 <= 125) { BITTOG(PB_ODR, 0); } }
Reduce ticks to 250 to use 8bit diff
bsd-3-clause
spoorcc/docker_embedded,spoorcc/docker_embedded
f35eea985e4b20020c8a91533fcd769c5745662b
#include "sphia-test.h" // See #51 static void test_clear_similar_keys() { sphia_set(sphia, "key-1", "hello world"); sphia_set(sphia, "key-10", "hello world"); sphia_set(sphia, "00000000", "hello world"); sphia_set(sphia, "000000000", "hello world"); assert(4 == sphia_count(sphia)); assert(0 == sphia_clear(sphia)); assert(0 == sphia_count(sphia)); } TEST(test_clear_similar_keys);
#include "sphia-test.h" // See #51 static void test_clear_similar_keys() { sphia_set(sphia, "key-1", "hello world"); sphia_set(sphia, "key-10", "hello world"); assert(2 == sphia_count(sphia)); assert(0 == sphia_clear(sphia)); assert(0 == sphia_count(sphia)); } TEST(test_clear_similar_keys);
--- +++ @@ -6,7 +6,9 @@ test_clear_similar_keys() { sphia_set(sphia, "key-1", "hello world"); sphia_set(sphia, "key-10", "hello world"); - assert(2 == sphia_count(sphia)); + sphia_set(sphia, "00000000", "hello world"); + sphia_set(sphia, "000000000", "hello world"); + assert(4 == sphia_count(sphia)); assert(0 == sphia_clear(sphia)); assert(0 == sphia_count(sphia)); }
Update clear test to use keys longer than 8 chars
mit
sphia/sphia,sphia/sphia,sphia/sphia
cc7b316872403c586627bd909bb596801e4a67cf
#ifndef UDBM_STUBS_H_ #define UDBM_STUBS_H_ #include <vector> typedef std::vector<int> carray_t; #define get_cvector(x) ((carray_t*)Data_custom_val(x)) #define get_dbm_ptr(x) static_cast<dbm_t*>(Data_custom_val(x)) bool dbm_closure_leq(const raw_t * const dr1, const raw_t * const dr2, cindex_t dim, const std::vector<int> &lbounds, const std::vector<int> &ubounds); #endif // UDBM_STUBS_H_
#ifndef UDBM_STUBS_H_ #define UDBM_STUBS_H_ #include <vector> typedef std::vector<int> carray_t; #define get_cvector(x) ((carray_t*)Data_custom_val(x)) #define get_dbm_ptr(x) static_cast<dbm_t*>(Data_custom_val(x)) #endif // UDBM_STUBS_H_
--- +++ @@ -8,4 +8,8 @@ #define get_dbm_ptr(x) static_cast<dbm_t*>(Data_custom_val(x)) +bool +dbm_closure_leq(const raw_t * const dr1, const raw_t * const dr2, cindex_t dim, + const std::vector<int> &lbounds, const std::vector<int> &ubounds); + #endif // UDBM_STUBS_H_
Make closure inclusion test visible (to be used from the priced zone part).
agpl-3.0
osankur/udbml,osankur/udbml,osankur/udbml
8422e5d1b414ee3a5ca6813e064fb55ea7a8c5bd
#include "blueprint.h" #include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include "parson.h" #include "bstrlib.h" void free_blueprint(struct blueprint *bp) { if (bp == NULL) return; bdestroy(bp->name); bdestroy(bp->blueprint_name); bdestroy(bp->Name); bdestroy(bp->game_version); for (int i = 0; i < bp->num_sc; i++) free_blueprint(&bp->SCs[i]); for (int i = 0; i < bp->total_block_count; i++) { if (bp->blocks[i].string_data == NULL) continue; bdestroy(bp->blocks[i].string_data); } free(bp->blocks); free(bp); }
#include "blueprint.h" #include <assert.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include "parson.h" #include "bstrlib.h" void free_blueprint(struct blueprint *bp) { if (bp == NULL) return; bdestroy(bp->name); bdestroy(bp->blueprint_name); bdestroy(bp->Name); bdestroy(bp->game_version); for (int i = 0; i < bp->num_sc; i++) free_blueprint(&bp->SCs[i]); free(bp->blocks); free(bp); }
--- +++ @@ -24,6 +24,13 @@ for (int i = 0; i < bp->num_sc; i++) free_blueprint(&bp->SCs[i]); + for (int i = 0; i < bp->total_block_count; i++) + { + if (bp->blocks[i].string_data == NULL) + continue; + bdestroy(bp->blocks[i].string_data); + } + free(bp->blocks); free(bp); }
Remove yet another memory leak
mit
Dean4Devil/libblueprint,Dean4Devil/libblueprint
666d003deec427657491dcfef7c4871ed2c4eb66
#ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H #define SSPAPPLICATION_ENTITIES_LEVERENTITY_H #include "Entity.h" struct LeverSyncState { int entityID; bool iActive; }; class LeverEntity : public Entity { private: //Variables bool m_isActive; float m_range; bool m_needSync; public: LeverEntity(); virtual ~LeverEntity(); int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp); int Update(float dT, InputHandler* inputHandler); int React(int entityID, EVENT reactEvent); //For now we check only if the player is close enough int CheckPressed(DirectX::XMFLOAT3 playerPos); private: //Functions }; #endif
#ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H #define SSPAPPLICATION_ENTITIES_LEVERENTITY_H #include "Entity.h" struct LeverSyncState { }; class LeverEntity : public Entity { private: //Variables bool m_isActive; float m_range; public: LeverEntity(); virtual ~LeverEntity(); int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp); int Update(float dT, InputHandler* inputHandler); int React(int entityID, EVENT reactEvent); //For now we check only if the player is close enough int CheckPressed(DirectX::XMFLOAT3 playerPos); private: //Functions }; #endif
--- +++ @@ -3,7 +3,8 @@ #include "Entity.h" struct LeverSyncState { - + int entityID; + bool iActive; }; class LeverEntity : @@ -13,6 +14,8 @@ //Variables bool m_isActive; float m_range; + + bool m_needSync; public: LeverEntity(); virtual ~LeverEntity();
UPDATE Lever entity sync state
apache-2.0
Chringo/SSP,Chringo/SSP
a532922ccf61505c9ac667ae40f617aea8376f95
// [WriteFile Name=SetInitialMapLocation, Category=Maps] // [Legal] // Copyright 2015 Esri. // 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. // [Legal] #ifndef SET_INITIAL_MAP_LOCATION_H #define SET_INITIAL_MAP_LOCATION_H namespace Esri { namespace ArcGISRuntime { class Map; class MapQuickView; } } #include <QQuickItem> class SetInitialMapLocation : public QQuickItem { Q_OBJECT public: SetInitialMapLocation(QQuickItem* parent = 0); ~SetInitialMapLocation(); void componentComplete() Q_DECL_OVERRIDE; private: Esri::ArcGISRuntime::Map* m_map; Esri::ArcGISRuntime::MapQuickView* m_mapView; }; #endif // SET_INITIAL_MAP_LOCATION_H
// [WriteFile Name=SetInitialMapLocation, Category=Maps] // [Legal] // Copyright 2015 Esri. // 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. s// [Legal] #ifndef SET_INITIAL_MAP_LOCATION_H #define SET_INITIAL_MAP_LOCATION_H namespace Esri { namespace ArcGISRuntime { class Map; class MapQuickView; } } #include <QQuickItem> class SetInitialMapLocation : public QQuickItem { Q_OBJECT public: SetInitialMapLocation(QQuickItem* parent = 0); ~SetInitialMapLocation(); void componentComplete() Q_DECL_OVERRIDE; private: Esri::ArcGISRuntime::Map* m_map; Esri::ArcGISRuntime::MapQuickView* m_mapView; }; #endif // SET_INITIAL_MAP_LOCATION_H
--- +++ @@ -12,7 +12,7 @@ // 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. -s// [Legal] +// [Legal] #ifndef SET_INITIAL_MAP_LOCATION_H #define SET_INITIAL_MAP_LOCATION_H
Fix legal comment build error
apache-2.0
Esri/arcgis-runtime-samples-qt,Esri/arcgis-runtime-samples-qt,Esri/arcgis-runtime-samples-qt,Esri/arcgis-runtime-samples-qt
e143b52dbbee202551c0ccc7ce594cbe530a8391
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #pragma once #include "common.h" #include "tokenizer.h" namespace ufal { namespace morphodita { struct tokenized_sentence { u32string sentence; vector<token_range> tokens; }; class gru_tokenizer_factory_trainer { public: static bool train(unsigned version, const vector<tokenized_sentence>& data, ostream& os, string& error); }; } // namespace morphodita } // namespace ufal
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #pragma once #include "common.h" #include "tokenizer.h" namespace ufal { namespace morphodita { class tokenized_sentence { u32string sentence; vector<token_range> tokens; }; class gru_tokenizer_factory_trainer { public: static bool train(unsigned version, const vector<tokenized_sentence>& data, ostream& os, string& error); }; } // namespace morphodita } // namespace ufal
--- +++ @@ -15,7 +15,7 @@ namespace ufal { namespace morphodita { -class tokenized_sentence { +struct tokenized_sentence { u32string sentence; vector<token_range> tokens; };
Make tokenized_sentence a structure (i.e., all fields public).
mpl-2.0
ufal/morphodita,ufal/morphodita,ufal/morphodita,ufal/morphodita,ufal/morphodita,ufal/morphodita,ufal/morphodita,ufal/morphodita
e5c5c31ef382af0620d4b9f8177e287e00a09fa0
#ifndef PERSISTENT_COOKIE_JAR_H #define PERSISTENT_COOKIE_JAR_H #include <QMutex> #include <QNetworkCookieJar> #include <QList> class QNetworkCookie; class QObject; class QUrl; /** * Network cookie jar which loads and stores cookies on a persistent file on disk. */ class PersistentCookieJar : public QNetworkCookieJar { Q_OBJECT public: /** * Create a new persistent cookie jar. * @param filename The full path of the file to use to load and store cookies. * @param parent The Qt parent object. */ explicit PersistentCookieJar(QString filename, QObject *parent = nullptr); /** * Saves the cookies before destroying the instance. */ ~PersistentCookieJar() override; /** * Remove all cookies from the cookie jar. */ void clear(); /** * Add new cookies to the cookie jar. * @param cookies The list of cookies to add to the cookie jar. * @return Whether all cookies were successfully added to the cookie jar. */ bool insertCookies(const QList<QNetworkCookie> &cookies); QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override; bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override; protected: /** * Save the cookies to the file. */ void save(); /** * Load the cookies from the file. */ void load(); private: QString m_filename; mutable QMutex m_mutex; }; #endif // PERSISTENT_COOKIE_JAR_H
#ifndef PERSISTENT_COOKIE_JAR_H #define PERSISTENT_COOKIE_JAR_H #include <QMutex> #include <QNetworkCookieJar> #include <QList> class QNetworkCookie; class QObject; class QUrl; class PersistentCookieJar : public QNetworkCookieJar { Q_OBJECT public: explicit PersistentCookieJar(QString filename, QObject *parent = nullptr); ~PersistentCookieJar(); void clear(); bool insertCookies(const QList<QNetworkCookie> &cookies); virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override; virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override; protected: void save(); void load(); private: QString m_filename; mutable QMutex m_mutex; }; #endif // PERSISTENT_COOKIE_JAR_H
--- +++ @@ -10,22 +10,50 @@ class QObject; class QUrl; +/** + * Network cookie jar which loads and stores cookies on a persistent file on disk. + */ class PersistentCookieJar : public QNetworkCookieJar { Q_OBJECT public: + /** + * Create a new persistent cookie jar. + * @param filename The full path of the file to use to load and store cookies. + * @param parent The Qt parent object. + */ explicit PersistentCookieJar(QString filename, QObject *parent = nullptr); - ~PersistentCookieJar(); + /** + * Saves the cookies before destroying the instance. + */ + ~PersistentCookieJar() override; + + /** + * Remove all cookies from the cookie jar. + */ void clear(); + + /** + * Add new cookies to the cookie jar. + * @param cookies The list of cookies to add to the cookie jar. + * @return Whether all cookies were successfully added to the cookie jar. + */ bool insertCookies(const QList<QNetworkCookie> &cookies); - virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override; - virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override; + QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const override; + bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) override; protected: + /** + * Save the cookies to the file. + */ void save(); + + /** + * Load the cookies from the file. + */ void load(); private:
Add documentation comments for PersistentCookieJar
apache-2.0
Bionus/imgbrd-grabber,Bionus/imgbrd-grabber,Bionus/imgbrd-grabber,Bionus/imgbrd-grabber,Bionus/imgbrd-grabber,Bionus/imgbrd-grabber
7c0fe28d061b6316017683c31b2e027c2d2f017f
#include "link-includes.h" #include "utilities.h" // Already declared in link-includes.h // const char * linkgrammar_get_dict_locale(Dictionary dict); // const char * linkgrammar_get_version(void); // const char * linkgrammar_get_dict_version(Dictionary dict); void dictionary_setup_locale(Dictionary dict); void dictionary_setup_defines(Dictionary dict); void afclass_init(Dictionary dict); bool afdict_init(Dictionary dict); void affix_list_add(Dictionary afdict, Afdict_class *, const char *); #ifdef __MINGW32__ int callGetLocaleInfoEx(LPCWSTR, LCTYPE, LPWSTR, int); #endif /* __MINGW32__ */
#include "link-includes.h" // Already declared in link-includes.h // const char * linkgrammar_get_dict_locale(Dictionary dict); // const char * linkgrammar_get_version(void); // const char * linkgrammar_get_dict_version(Dictionary dict); void dictionary_setup_locale(Dictionary dict); void dictionary_setup_defines(Dictionary dict); void afclass_init(Dictionary dict); bool afdict_init(Dictionary dict); void affix_list_add(Dictionary afdict, Afdict_class *, const char *);
--- +++ @@ -1,5 +1,6 @@ #include "link-includes.h" +#include "utilities.h" // Already declared in link-includes.h // const char * linkgrammar_get_dict_locale(Dictionary dict); @@ -11,3 +12,8 @@ void afclass_init(Dictionary dict); bool afdict_init(Dictionary dict); void affix_list_add(Dictionary afdict, Afdict_class *, const char *); + +#ifdef __MINGW32__ +int callGetLocaleInfoEx(LPCWSTR, LCTYPE, LPWSTR, int); + +#endif /* __MINGW32__ */
MinGW: Add a missing prototype (callGetLocaleInfoEx())
lgpl-2.1
ampli/link-grammar,ampli/link-grammar,ampli/link-grammar,ampli/link-grammar,linas/link-grammar,opencog/link-grammar,opencog/link-grammar,linas/link-grammar,linas/link-grammar,ampli/link-grammar,linas/link-grammar,opencog/link-grammar,ampli/link-grammar,opencog/link-grammar,opencog/link-grammar,linas/link-grammar,opencog/link-grammar,opencog/link-grammar,ampli/link-grammar,linas/link-grammar,opencog/link-grammar,linas/link-grammar,ampli/link-grammar,linas/link-grammar,linas/link-grammar,ampli/link-grammar,opencog/link-grammar
5439e60468398c955f2448df853a11a8e36d9dcd
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ #include <string.h> #include <stdlib.h> #include <stdio.h> #include "gsm.h" #include "private.h" gsm gsm_create () { gsm r = (gsm)calloc(1, sizeof(struct gsm_state)); if (r) r->nrp = 40; return r; }
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ #include <string.h> #include <stdlib.h> #include <stdio.h> #include "gsm.h" #include "private.h" gsm gsm_create () { gsm = (gsm)calloc(sizeof(struct gsm_state)); if (r) r->nrp = 40; return r; }
--- +++ @@ -13,7 +13,7 @@ gsm gsm_create () { - gsm = (gsm)calloc(sizeof(struct gsm_state)); + gsm r = (gsm)calloc(1, sizeof(struct gsm_state)); if (r) r->nrp = 40;
Fix typos in last commit.
lgpl-2.1
davel/sox,cbagwell/sox,Distrotech/sox,CaptainHayashi/sox,CaptainHayashi/sox,davel/sox,MageSlayer/sox,jacksonh/sox,uklauer/sox,cbagwell/sox,Distrotech/sox,jacksonh/sox,pcqpcq/sox,mhartzel/sox_personal_fork,davel/sox,MageSlayer/sox,cbagwell/sox,MageSlayer/sox,Motiejus/sox,mhartzel/sox_personal_fork,davel/sox,Distrotech/sox,uklauer/sox,CaptainHayashi/sox,mhartzel/sox_personal_fork,Motiejus/sox,pcqpcq/sox,mhartzel/sox_personal_fork,CaptainHayashi/sox,jacksonh/sox,pcqpcq/sox,MageSlayer/sox,Distrotech/sox,Motiejus/sox,uklauer/sox,cbagwell/sox,uklauer/sox,Motiejus/sox,jacksonh/sox,pcqpcq/sox,MageSlayer/sox
7a41ebe99da12b58622df6112624669a013e7659
/*------------------------------------------------------------------------- * * FILE * pqxx/util.h * * DESCRIPTION * Various utility definitions for libpqxx * * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl> * * See COPYING for copyright license. If you did not receive a file called * COPYING with this source code, please notify the distributor of this mistake, * or contact the author. * *------------------------------------------------------------------------- */ #ifndef PQXX_UTIL_H #define PQXX_UTIL_H #if !defined(PQXXYES_I_KNOW_DEPRECATED_HEADER) #define PQXXYES_I_KNOW_DEPRECATED_HEADER #if defined(PQXX_HAVE_CPP_WARNING) #warning "Deprecated libpqxx header included. Use headers without '.h'" #elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE) #pragma message("Deprecated libpqxx header included. Use headers without '.h'") #endif #endif #define PQXX_DEPRECATED_HEADERS #include "pqxx/util" #endif
/*------------------------------------------------------------------------- * * FILE * pqxx/util.h * * DESCRIPTION * Various utility definitions for libpqxx * * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl> * * See COPYING for copyright license. If you did not receive a file called * COPYING with this source code, please notify the distributor of this mistake, * or contact the author. * *------------------------------------------------------------------------- */ #ifndef PQXX_UTIL_H #define PQXX_UTIL_H #if defined(PQXX_HAVE_CPP_WARNING) #warning "Deprecated libpqxx header included. Use headers without '.h'" #elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE) #pragma message("Deprecated libpqxx header included. Use headers without '.h'") #endif #define PQXX_DEPRECATED_HEADERS #include "pqxx/util" #endif
--- +++ @@ -17,10 +17,13 @@ #ifndef PQXX_UTIL_H #define PQXX_UTIL_H +#if !defined(PQXXYES_I_KNOW_DEPRECATED_HEADER) +#define PQXXYES_I_KNOW_DEPRECATED_HEADER #if defined(PQXX_HAVE_CPP_WARNING) #warning "Deprecated libpqxx header included. Use headers without '.h'" #elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE) #pragma message("Deprecated libpqxx header included. Use headers without '.h'") +#endif #endif #define PQXX_DEPRECATED_HEADERS
Allow suppression of "deprecated header" warning
bsd-3-clause
jtv/libpqxx,jtv/libpqxx,jtv/libpqxx,jtv/libpqxx
8035340f994f48b8b5f7c0d382517c3243b58ac3
/* * Copyright (C) 2014 FU Berlin * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @addtogroup driver_periph * @{ * * @file * @brief Low-level CPUID driver implementation * * @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> */ #include <string.h> #include "periph/cpuid.h" extern volatile uint32_t _cpuid_address; void cpuid_get(void *id) { memcpy(id, (void *)(&_cpuid_address), CPUID_ID_LEN); } /** @} */
/* * Copyright (C) 2014 FU Berlin * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @addtogroup driver_periph * @{ * * @file * @brief Low-level CPUID driver implementation * * @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> */ #include <string.h> #include "periph/cpuid.h" extern volatile uint32_t _cpuid_address; void cpuid_get(void *id) { memcpy(id, (void *)(_cpuid_address), CPUID_ID_LEN); } /** @} */
--- +++ @@ -24,7 +24,7 @@ void cpuid_get(void *id) { - memcpy(id, (void *)(_cpuid_address), CPUID_ID_LEN); + memcpy(id, (void *)(&_cpuid_address), CPUID_ID_LEN); } /** @} */
Use the address of the variable instead of the value itself for the CPUID
lgpl-2.1
DipSwitch/RIOT,DipSwitch/RIOT,DipSwitch/RIOT,DipSwitch/RIOT,DipSwitch/RIOT,DipSwitch/RIOT
6142283e4f51049c3ab867e5cdeaea9d6052eb6f
/* Never include this file directly. Include <linux/compiler.h> instead. */ /* * Common definitions for all gcc versions go here. */ /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") /* This macro obfuscates arithmetic on a variable address so that gcc shouldn't recognize the original var, and make assumptions about it */ /* * Versions of the ppc64 compiler before 4.1 had a bug where use of * RELOC_HIDE could trash r30. The bug can be worked around by changing * the inline assembly constraint from =g to =r, in this particular * case either is valid. */ #define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ (typeof(ptr)) (__ptr + (off)); }) #define inline inline __attribute__((always_inline)) #define __inline__ __inline__ __attribute__((always_inline)) #define __inline __inline __attribute__((always_inline)) #define __deprecated __attribute__((deprecated)) #define noinline __attribute__((noinline)) #define __attribute_pure__ __attribute__((pure)) #define __attribute_const__ __attribute__((__const__))
/* Never include this file directly. Include <linux/compiler.h> instead. */ /* * Common definitions for all gcc versions go here. */ /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") /* This macro obfuscates arithmetic on a variable address so that gcc shouldn't recognize the original var, and make assumptions about it */ #define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ __asm__ ("" : "=g"(__ptr) : "0"(ptr)); \ (typeof(ptr)) (__ptr + (off)); }) #define inline inline __attribute__((always_inline)) #define __inline__ __inline__ __attribute__((always_inline)) #define __inline __inline __attribute__((always_inline)) #define __deprecated __attribute__((deprecated)) #define noinline __attribute__((noinline)) #define __attribute_pure__ __attribute__((pure)) #define __attribute_const__ __attribute__((__const__))
--- +++ @@ -11,9 +11,15 @@ /* This macro obfuscates arithmetic on a variable address so that gcc shouldn't recognize the original var, and make assumptions about it */ +/* + * Versions of the ppc64 compiler before 4.1 had a bug where use of + * RELOC_HIDE could trash r30. The bug can be worked around by changing + * the inline assembly constraint from =g to =r, in this particular + * case either is valid. + */ #define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ - __asm__ ("" : "=g"(__ptr) : "0"(ptr)); \ + __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ (typeof(ptr)) (__ptr + (off)); })
[PATCH] Work around ppc64 compiler bug In the process of optimising our per cpu data code, I found a ppc64 compiler bug that has been around forever. Basically the current RELOC_HIDE can end up trashing r30. Details of the bug can be found at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25572 This bug is present in all compilers before 4.1. It is masked by the fact that our current per cpu data code is inefficient and causes other loads that end up marking r30 as used. A workaround identified by Alan Modra is to use the =r asm constraint instead of =g. Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org> [ Verified that this makes no real difference on x86[-64] */ Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>
mit
KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs
c8d52465f95c4187871f8e65666c07806ca06d41
/* This is a simple C program which is a stub for the FS monitor. It takes one argument which would be a directory to monitor. In this case, the filename is discarded after argument validation. Every minute the */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (int argc, char **argv) { if (argc < 2) { fprintf(stderr, "Not enough arguments"); exit(EXIT_FAILURE); } while (1) { fprintf(stdout, "{ \"key\": \"value\" }\n"); fflush(stdout); fprintf(stderr, "tick\n"); sleep(1); } }
/* This is a simple C program which is a stub for the FS monitor. It takes one argument which would be a directory to monitor. In this case, the filename is discarded after argument validation. Every minute the */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (int argc, char **argv) { if (argc != 2) { fprintf(stderr, "Not enough arguments"); exit(EXIT_FAILURE); } while (1) { fprintf(stdout, "{ \"key\": \"value\" }\n"); fflush(stdout); fprintf(stderr, "tick\n"); sleep(1); } }
--- +++ @@ -10,7 +10,7 @@ #include <unistd.h> int main (int argc, char **argv) { - if (argc != 2) { + if (argc < 2) { fprintf(stderr, "Not enough arguments"); exit(EXIT_FAILURE); }
Fix arguments count check in test inotify program
mit
iankronquist/senior-project-experiment,iankronquist/senior-project-experiment,iankronquist/senior-project-experiment,iankronquist/beeswax,iankronquist/beeswax,iankronquist/beeswax,iankronquist/senior-project-experiment,iankronquist/beeswax
6f132875296595c4f26f9eee940666b1a4ca8135
#include <stdio.h> #include <stdlib.h> #include "utility.h" /* * MAW 3.25.a Write the routines to implement queues using: Linked Lists * * We use a header node at the very beginning of the linked list. * * Front: | header node | -> | data node | -> | data node | :Rear */ #ifndef _QUEUE_H #define _QUEUE_H typedef int ET; struct QueueRecord; struct QueueCDT; typedef struct QueueRecord* PtrToNode; // CDT: concrete-type-of-a-queue // ADT: abstract-type-of-a-queue typedef struct QueueCDT* QueueADT; // naming convention: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html int isEmpty(QueueADT Q); QueueADT createQueue(); void disposeQueue(QueueADT Q); void makeEmpty(QueueADT Q); void enqueue(ET elem, QueueADT Q); ET front(QueueADT Q); void dequeue(QueueADT Q); ET frontAndDequeue(QueueADT Q); QueueADT initializeQueue(ET array[], int lengthArray); void printQueue(QueueADT Q); #endif
#include <stdio.h> #include <stdlib.h> #include "utility.h" /* * MAW 3.25.a Write the routines to implement queues using: Linked Lists * * We use a header node at the very beginning of the linked list. * * Front: | header node | -> | data node | -> | data node | :Rear */ #ifndef _QUEUE_H #define _QUEUE_H typedef int ET; struct QueueRecord; struct QueueCDT; typedef struct QueueRecord* PtrToNode; typedef struct QueueCDT* QueueADT; // naming convention: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html int isEmpty(QueueADT Q); QueueADT createQueue(); void disposeQueue(QueueADT Q); void makeEmpty(QueueADT Q); void enqueue(ET elem, QueueADT Q); ET front(QueueADT Q); void dequeue(QueueADT Q); ET frontAndDequeue(QueueADT Q); QueueADT initializeQueue(ET array[], int lengthArray); void printQueue(QueueADT Q); #endif
--- +++ @@ -17,6 +17,9 @@ struct QueueRecord; struct QueueCDT; typedef struct QueueRecord* PtrToNode; + +// CDT: concrete-type-of-a-queue +// ADT: abstract-type-of-a-queue typedef struct QueueCDT* QueueADT; // naming convention: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html int isEmpty(QueueADT Q);
Add comment remarks to CDT & ADT
mit
xxks-kkk/algo,xxks-kkk/algo
e5c078e0f278adfbe685df2d8e141a9f71ea7cc8
#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
#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
--- +++ @@ -13,6 +13,9 @@ #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" {
Add defines for OSK event ids
mit
ps3dev/PSL1GHT,ps3dev/PSL1GHT,ps3dev/PSL1GHT,ps3dev/PSL1GHT
5c31ae8d7724618d27315791605449d7693bde78
#ifndef PYLOGGER_H #define PYLOGGER_H #include "Python.h" #include <string> #include "cantera/base/logger.h" namespace Cantera { /// Logger for Python. /// @ingroup textlogs class Py_Logger : public Logger { public: Py_Logger() { PyRun_SimpleString("import sys"); } virtual ~Py_Logger() {} virtual void write(const std::string& s) { std::string ss = "sys.stdout.write(\"\"\""; ss += s; ss += "\"\"\")"; PyRun_SimpleString(ss.c_str()); PyRun_SimpleString("sys.stdout.flush()"); } virtual void error(const std::string& msg) { std::string err = "raise Exception(\"\"\""+msg+"\"\"\")"; PyRun_SimpleString(err.c_str()); } }; } #endif
#ifndef PYLOGGER_H #define PYLOGGER_H #include "Python.h" #include <string> #include "cantera/base/logger.h" namespace Cantera { /// Logger for Python. /// @ingroup textlogs class Py_Logger : public Logger { public: Py_Logger() { PyRun_SimpleString("import sys"); } virtual ~Py_Logger() {} virtual void write(const std::string& s) { std::string ss = "sys.stdout.write(\"\"\""; ss += s; ss += "\"\"\")"; PyRun_SimpleString(ss.c_str()); PyRun_SimpleString("sys.stdout.flush()"); } virtual void error(const std::string& msg) { std::string err = "raise \""+msg+"\""; PyRun_SimpleString((char*)err.c_str()); } }; } #endif
--- +++ @@ -27,8 +27,8 @@ } virtual void error(const std::string& msg) { - std::string err = "raise \""+msg+"\""; - PyRun_SimpleString((char*)err.c_str()); + std::string err = "raise Exception(\"\"\""+msg+"\"\"\")"; + PyRun_SimpleString(err.c_str()); } }; }
Fix Py_Logger to raise instances of Exception instead of strings Raising string exceptions was removed in Python 2.6 git-svn-id: e76dbe14710aecee1ad27675521492cea2578c83@1932 02a645c2-efd0-11dd-984d-ab748d24aa7e
bsd-3-clause
Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn
40206332871e11ee28c6d163797cb374da2663e9
#include <pal.h> /* * sinh z = (exp z - exp(-z)) / 2 */ static inline float _p_sinh(const float z) { float exp_z; p_exp_f32(&z, &exp_z, 1); return 0.5f * (exp_z - 1.f / exp_z); } /** * * Calculates the hyperbolic sine of the vector 'a'. Angles are specified * in radians. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ void p_sinh_f32(const float *a, float *c, int n) { int i; for (i = 0; i < n; i++) { c[i] = _p_sinh(a[i]); } }
#include <pal.h> /** * * Calculates the hyperbolic sine of the vector 'a'. Angles are specified * in radians. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ #include <math.h> void p_sinh_f32(const float *a, float *c, int n) { int i; for (i = 0; i < n; i++) { *(c + i) = sinhf(*(a + i)); } }
--- +++ @@ -1,4 +1,14 @@ #include <pal.h> + +/* + * sinh z = (exp z - exp(-z)) / 2 + */ +static inline float _p_sinh(const float z) +{ + float exp_z; + p_exp_f32(&z, &exp_z, 1); + return 0.5f * (exp_z - 1.f / exp_z); +} /** * @@ -14,11 +24,10 @@ * @return None * */ -#include <math.h> void p_sinh_f32(const float *a, float *c, int n) { int i; for (i = 0; i < n; i++) { - *(c + i) = sinhf(*(a + i)); + c[i] = _p_sinh(a[i]); } }
math:sinh: Implement the hyperbolic sine function. Signed-off-by: Mansour Moufid <ac5f6b12fab5e0d4efa7215e6c2dac9d55ab77dc@gmail.com>
apache-2.0
mateunho/pal,eliteraspberries/pal,mateunho/pal,Adamszk/pal3,olajep/pal,eliteraspberries/pal,eliteraspberries/pal,aolofsson/pal,parallella/pal,mateunho/pal,8l/pal,parallella/pal,aolofsson/pal,8l/pal,Adamszk/pal3,debug-de-su-ka/pal,debug-de-su-ka/pal,eliteraspberries/pal,8l/pal,parallella/pal,debug-de-su-ka/pal,olajep/pal,Adamszk/pal3,mateunho/pal,debug-de-su-ka/pal,olajep/pal,parallella/pal,Adamszk/pal3,mateunho/pal,aolofsson/pal,eliteraspberries/pal,8l/pal,olajep/pal,aolofsson/pal,debug-de-su-ka/pal,parallella/pal
a93e50dba9a0528ba2bebe76601b933259b684d1
/* * UIOMux: a conflict manager for system resources, including UIO devices. * Copyright (C) 2009 Renesas Technology Corp. * * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> #include <stdlib.h> #define INFO(str) \ { printf ("---- %s ...\n", (str)); } #define WARN(str) \ { printf ("%s:%d: warning: %s\n", __FILE__, __LINE__, (str)); } #define FAIL(str) \ { printf ("%s:%d: %s\n", __FILE__, __LINE__, (str)); exit(1); }
/* * UIOMux: a conflict manager for system resources, including UIO devices. * Copyright (C) 2009 Renesas Technology Corp. * * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA */ #include "config.h" #include <stdio.h> #include <stdlib.h> #define INFO(str) \ { printf ("---- %s ...\n", (str)); } #define WARN(str) \ { printf ("%s:%d: warning: %s\n", __FILE__, __LINE__, (str)); } #define FAIL(str) \ { printf ("%s:%d: %s\n", __FILE__, __LINE__, (str)); exit(1); }
--- +++ @@ -17,7 +17,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include <stdio.h> #include <stdlib.h>
Apply HAVE_CONFIG_H condition in src/tests/uiomux_test.h config.h should be included only if HAVE_CONFIG_H defined when autoconf used.
lgpl-2.1
kfish/libuiomux,kfish/libuiomux
5e33ef4b6724a72188da87ddc7e8af98c4658671
// // MPConstants.h // MoPub // // Created by Nafis Jamal on 2/9/11. // Copyright 2011 MoPub, Inc. All rights reserved. // #import <UIKit/UIKit.h> #if DEBUG #define MP_DEBUG_MODE 1 #else #define MP_DEBUG_MODE 0 #endif #define HOSTNAME @"ads.mopub.com" #define HOSTNAME_FOR_TESTING @"testing.ads.mopub.com" #define DEFAULT_PUB_ID @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA" #define MP_SERVER_VERSION @"8" #define MP_SDK_VERSION @"1.16.0.1" // Sizing constants. #define MOPUB_BANNER_SIZE CGSizeMake(320, 50) #define MOPUB_MEDIUM_RECT_SIZE CGSizeMake(300, 250) #define MOPUB_LEADERBOARD_SIZE CGSizeMake(728, 90) #define MOPUB_WIDE_SKYSCRAPER_SIZE CGSizeMake(160, 600) // Miscellaneous constants. #define MINIMUM_REFRESH_INTERVAL 5.0 #define DEFAULT_BANNER_REFRESH_INTERVAL 60 #define BANNER_TIMEOUT_INTERVAL 10 #define INTERSTITIAL_TIMEOUT_INTERVAL 30 // Feature Flags #define SESSION_TRACKING_ENABLED 1
// // MPConstants.h // MoPub // // Created by Nafis Jamal on 2/9/11. // Copyright 2011 MoPub, Inc. All rights reserved. // #import <UIKit/UIKit.h> #define MP_DEBUG_MODE 1 #define HOSTNAME @"ads.mopub.com" #define HOSTNAME_FOR_TESTING @"testing.ads.mopub.com" #define DEFAULT_PUB_ID @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA" #define MP_SERVER_VERSION @"8" #define MP_SDK_VERSION @"1.16.0.1" // Sizing constants. #define MOPUB_BANNER_SIZE CGSizeMake(320, 50) #define MOPUB_MEDIUM_RECT_SIZE CGSizeMake(300, 250) #define MOPUB_LEADERBOARD_SIZE CGSizeMake(728, 90) #define MOPUB_WIDE_SKYSCRAPER_SIZE CGSizeMake(160, 600) // Miscellaneous constants. #define MINIMUM_REFRESH_INTERVAL 5.0 #define DEFAULT_BANNER_REFRESH_INTERVAL 60 #define BANNER_TIMEOUT_INTERVAL 10 #define INTERSTITIAL_TIMEOUT_INTERVAL 30 // Feature Flags #define SESSION_TRACKING_ENABLED 1
--- +++ @@ -8,7 +8,11 @@ #import <UIKit/UIKit.h> +#if DEBUG #define MP_DEBUG_MODE 1 +#else +#define MP_DEBUG_MODE 0 +#endif #define HOSTNAME @"ads.mopub.com" #define HOSTNAME_FOR_TESTING @"testing.ads.mopub.com"
Disable MoPub logging for release builds.
bsd-3-clause
skillz/mopub-ios-sdk,skillz/mopub-ios-sdk,skillz/mopub-ios-sdk,skillz/mopub-ios-sdk
56de4f7f2434bfb7b22f83bdb87744a8e6ca28de
#ifndef __SETTINGS_H_ #define __SETTINGS_H_ #include <Arduino.h> #include "Device.h" // This section is for devices and their configuration //Kit: #define HAS_STD_LIGHTS (1) #define LIGHTS_PIN 5 #define HAS_STD_CAPE (1) #define HAS_STD_2X1_THRUSTERS (1) #define HAS_STD_PILOT (1) #define HAS_STD_CAMERAMOUNT (1) #define CAMERAMOUNT_PIN 3 #define CAPE_VOLTAGE_PIN 0 #define CAPE_CURRENT_PIN 3 //After Market: #define HAS_STD_CALIBRATIONLASERS (0) #define CALIBRATIONLASERS_PIN 6 #define HAS_POLOLU_MINIMUV (0) #define HAS_MS5803_14BA (0) #define MS5803_14BA_I2C_ADDRESS 0x76 #define MIDPOINT 1500 #define LOGGING (1) class Settings : public Device { public: static int smoothingIncriment; //How aggressive the throttle changes static int deadZone_min; static int deadZone_max; static int capability_bitarray; Settings():Device(){}; void device_setup(); void device_loop(Command cmd); }; #endif
#ifndef __SETTINGS_H_ #define __SETTINGS_H_ #include <Arduino.h> #include "Device.h" // This section is for devices and their configuration //Kit: #define HAS_STD_LIGHTS (1) #define LIGHTS_PIN 5 #define HAS_STD_CAPE (1) #define HAS_STD_2X1_THRUSTERS (1) #define HAS_STD_PILOT (1) #define HAS_STD_CAMERAMOUNT (1) #define CAMERAMOUNT_PIN 3 #define CAPE_VOLTAGE_PIN 0 #define CAPE_CURRENT_PIN 3 //After Market: #define HAS_STD_CALIBRATIONLASERS (0) #define CALIBRATIONLASERS_PIN 6 #define HAS_POLOLU_MINIMUV (1) #define HAS_MS5803_14BA (0) #define MS5803_14BA_I2C_ADDRESS 0x76 #define MIDPOINT 1500 #define LOGGING (1) class Settings : public Device { public: static int smoothingIncriment; //How aggressive the throttle changes static int deadZone_min; static int deadZone_max; static int capability_bitarray; Settings():Device(){}; void device_setup(); void device_loop(Command cmd); }; #endif
--- +++ @@ -19,7 +19,7 @@ //After Market: #define HAS_STD_CALIBRATIONLASERS (0) #define CALIBRATIONLASERS_PIN 6 -#define HAS_POLOLU_MINIMUV (1) +#define HAS_POLOLU_MINIMUV (0) #define HAS_MS5803_14BA (0) #define MS5803_14BA_I2C_ADDRESS 0x76
Reset default settings to stock kit configuration
mit
BrianAdams/openrov-cockpit,BenjaminTsai/openrov-cockpit,kavi87/openrov-cockpit,johan--/openrov-cockpit,spiderkeys/openrov-cockpit,OpenROV/openrov-cockpit,johan--/openrov-cockpit,kavi87/openrov-cockpit,johan--/openrov-cockpit,kavi87/openrov-cockpit,chaudhryjunaid/openrov-cockpit,spiderkeys/openrov-cockpit,BrianAdams/openrov-cockpit,kavi87/openrov-cockpit,BenjaminTsai/openrov-cockpit,spiderkeys/openrov-cockpit,BenjaminTsai/openrov-cockpit,chaudhryjunaid/openrov-cockpit,BrianAdams/openrov-cockpit,BenjaminTsai/openrov-cockpit,chaudhryjunaid/openrov-cockpit,kavi87/openrov-cockpit,OpenROV/openrov-cockpit,spiderkeys/openrov-cockpit,johan--/openrov-cockpit,chaudhryjunaid/openrov-cockpit,BrianAdams/openrov-cockpit,BenjaminTsai/openrov-cockpit,BrianAdams/openrov-cockpit,spiderkeys/openrov-cockpit,chaudhryjunaid/openrov-cockpit,johan--/openrov-cockpit,OpenROV/openrov-cockpit
150ea1ffddd8ade2bd1b7f146277210c5f182321
#ifndef _PKG_UTIL_H #define _PKG_UTIL_H #include <sys/types.h> #include <sys/sbuf.h> #include <sys/param.h> #define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0) #define ERROR_SQLITE(db) \ EMIT_PKG_ERROR("sqlite: %s", sqlite3_errmsg(db)) int sbuf_set(struct sbuf **, const char *); const char * sbuf_get(struct sbuf *); void sbuf_reset(struct sbuf *); void sbuf_free(struct sbuf *); int mkdirs(const char *path); int file_to_buffer(const char *, char **, off_t *); int format_exec_cmd(char **, const char *, const char *, const char *); int split_chr(char *, char); int file_fetch(const char *, const char *); int is_dir(const char *); int is_conf_file(const char *path, char newpath[MAXPATHLEN]); int sha256_file(const char *, char[65]); void sha256_str(const char *, char[65]); #endif
#ifndef _PKG_UTIL_H #define _PKG_UTIL_H #include <sys/types.h> #include <sys/sbuf.h> #include <sys/param.h> #define ARRAY_INIT {0, 0, NULL} struct array { size_t cap; size_t len; void **data; }; #define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0) #define ERROR_SQLITE(db) \ EMIT_PKG_ERROR("sqlite: %s", sqlite3_errmsg(db)) int sbuf_set(struct sbuf **, const char *); const char * sbuf_get(struct sbuf *); void sbuf_reset(struct sbuf *); void sbuf_free(struct sbuf *); int mkdirs(const char *path); int file_to_buffer(const char *, char **, off_t *); int format_exec_cmd(char **, const char *, const char *, const char *); int split_chr(char *, char); int file_fetch(const char *, const char *); int is_dir(const char *); int is_conf_file(const char *path, char newpath[MAXPATHLEN]); int sha256_file(const char *, char[65]); void sha256_str(const char *, char[65]); #endif
--- +++ @@ -4,14 +4,6 @@ #include <sys/types.h> #include <sys/sbuf.h> #include <sys/param.h> - -#define ARRAY_INIT {0, 0, NULL} - -struct array { - size_t cap; - size_t len; - void **data; -}; #define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0)
Remove last occurences of the dead struct array
bsd-2-clause
en90/pkg,khorben/pkg,en90/pkg,khorben/pkg,Open343/pkg,skoef/pkg,Open343/pkg,skoef/pkg,junovitch/pkg,junovitch/pkg,khorben/pkg
21882ab7a21eb17f0d23d2d2459fdb3c6e787322
#ifndef _SYSTEMEMORY_H_ #define _SYSTEMEMORY_H_ #include "windows.h" typedef unsigned long DWORD; class SystemMemory { private: MEMORYSTATUSEX memoryStat; private: int memoryCall(); public: int getLoadPercent(int &val); int getUsage(double &val); int getTotalByte(DWORD &val); int getFreeByte(DWORD &val); }; #endif
#ifndef _SYSTEMEMORY_H_ #define _SYSTEMEMORY_H_ #include "windows.h" class SystemMemory { private: MEMORYSTATUSEX memoryStat; private: int memoryCall(); public: int getLoadPercent(int &val); int getUsage(double &val); int getTotalByte(DWORD &val); int getFreeByte(DWORD &val); }; #endif
--- +++ @@ -2,6 +2,8 @@ #define _SYSTEMEMORY_H_ #include "windows.h" + +typedef unsigned long DWORD; class SystemMemory {
Define 'unsigned long' as 'DWORD' for cross-platform
mit
bg0820/SMS,bg0820/SMS
02e86ccfe9fc04afbd5275d4b2f27881d61e3ced
#include <bc_scheduler.h> #include <bc_module_core.h> #include <stm32l0xx.h> void application_init(void); void application_task(void *param); int main(void) { bc_module_core_init(); bc_scheduler_init(); bc_scheduler_register(application_task, NULL, 0); application_init(); bc_scheduler_run(); } __attribute__((weak)) void application_init(void) { } __attribute__((weak)) void application_task(void *param) { (void) param; }
#include <bc_scheduler.h> #include <bc_module_core.h> #include <stm32l0xx.h> void application_init(void); void application_task(void *param); int main(void) { bc_module_core_init(); bc_scheduler_init(); application_init(); bc_scheduler_register(application_task, NULL, 0); bc_scheduler_run(); } __attribute__((weak)) void application_init(void) { } __attribute__((weak)) void application_task(void *param) { (void) param; }
--- +++ @@ -11,9 +11,9 @@ bc_scheduler_init(); + bc_scheduler_register(application_task, NULL, 0); + application_init(); - - bc_scheduler_register(application_task, NULL, 0); bc_scheduler_run(); }
Move app_task() scheduler registration before app_init() so app_task() has task_id 0
mit
bigclownlabs/bc-core-module-sdk,bigclownlabs/bc-core-module-sdk,bigclownlabs/bc-core-module-sdk
ec2c60ee36437d0bf817a836aa78130087c36fc7
#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
#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
--- +++ @@ -7,16 +7,16 @@ // 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 +#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 true +#define CLIENT_VERSION_IS_RELEASE false // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source -#define COPYRIGHT_YEAR 2013 +#define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro!
Update the version number to 0.9 for a beta build.
mit
TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin,TacoCoin/tacocoin
8b55ba7d6d1fbd3244ce9e1bc19e691099274172
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org> * */ #ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H #define __ASM_MACH_GENERIC_DMA_COHERENCE_H struct device; static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) { return virt_to_phys(addr); } static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) { return page_to_phys(page); } static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) { return dma_addr; } static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) { } static inline int plat_device_is_coherent(struct device *dev) { #ifdef CONFIG_DMA_COHERENT return 1; #endif #ifdef CONFIG_DMA_NONCOHERENT return 0; #endif } #endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org> * */ #ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H #define __ASM_MACH_GENERIC_DMA_COHERENCE_H struct device; static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) { return virt_to_phys(addr); } static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) { return page_to_phys(page); } static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) { return dma_addr; } static void plat_unmap_dma_mem(dma_addr_t dma_addr) { } static inline int plat_device_is_coherent(struct device *dev) { #ifdef CONFIG_DMA_COHERENT return 1; #endif #ifdef CONFIG_DMA_NONCOHERENT return 0; #endif } #endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
--- +++ @@ -11,22 +11,24 @@ struct device; -static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) +static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, + size_t size) { return virt_to_phys(addr); } -static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) +static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, + struct page *page) { return page_to_phys(page); } -static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) +static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) { return dma_addr; } -static void plat_unmap_dma_mem(dma_addr_t dma_addr) +static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) { }
[MIPS] DMA: Fix a bunch of warnings due to missing inline keywords. Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>
mit
KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas
a9b6590ced1370537edad8dc60be32c044b2380e
/* * Let's make sure we always have a sane definition for ntohl()/htonl(). * Some libraries define those as a function call, just to perform byte * shifting, bringing significant overhead to what should be a simple * operation. */ /* * Default version that the compiler ought to optimize properly with * constant values. */ static inline uint32_t default_swab32(uint32_t val) { return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); } #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define bswap32(x) ({ \ uint32_t __res; \ if (__builtin_constant_p(x)) { \ __res = default_swab32(x); \ } else { \ __asm__("bswap %0" : "=r" (__res) : "0" (x)); \ } \ __res; }) #undef ntohl #undef htonl #define ntohl(x) bswap32(x) #define htonl(x) bswap32(x) #endif
/* * Let's make sure we always have a sane definition for ntohl()/htonl(). * Some libraries define those as a function call, just to perform byte * shifting, bringing significant overhead to what should be a simple * operation. */ /* * Default version that the compiler ought to optimize properly with * constant values. */ static inline unsigned int default_swab32(unsigned int val) { return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); } #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define bswap32(x) ({ \ unsigned int __res; \ if (__builtin_constant_p(x)) { \ __res = default_swab32(x); \ } else { \ __asm__("bswap %0" : "=r" (__res) : "0" (x)); \ } \ __res; }) #undef ntohl #undef htonl #define ntohl(x) bswap32(x) #define htonl(x) bswap32(x) #endif
--- +++ @@ -9,7 +9,7 @@ * Default version that the compiler ought to optimize properly with * constant values. */ -static inline unsigned int default_swab32(unsigned int val) +static inline uint32_t default_swab32(uint32_t val) { return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | @@ -20,7 +20,7 @@ #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define bswap32(x) ({ \ - unsigned int __res; \ + uint32_t __res; \ if (__builtin_constant_p(x)) { \ __res = default_swab32(x); \ } else { \
Fix some printf format warnings commit 51ea551 ("make sure byte swapping is optimal for git" 2009-08-18) introduced a "sane definition for ntohl()/htonl()" for use on some GNU C platforms. Unfortunately, for some of these platforms, this results in the introduction of a problem which is essentially the reverse of a problem that commit 6e1c234 ("Fix some warnings (on cygwin) to allow -Werror" 2008-07-3) was intended to fix. In particular, on platforms where the uint32_t type is defined to be unsigned long, the return type of the new ntohl()/htonl() is causing gcc to issue printf format warnings, such as: warning: long unsigned int format, unsigned int arg (arg 3) (nine such warnings, covering six different files). The earlier commit (6e1c234) needed to suppress these same warnings, except that the types were in the opposite direction; namely the format specifier ("%u") was 'unsigned int' and the argument type (ie the return type of ntohl()) was 'long unsigned int' (aka uint32_t). In order to suppress these warnings, the earlier commit used the (C99) PRIu32 format specifier, since the definition of this macro is suitable for use with the uint32_t type on that platform. This worked because the return type of the (original) platform ntohl()/htonl() functions was uint32_t. In order to suppress these warnings, we change the return type of the new byte swapping functions in the compat/bswap.h header file from 'unsigned int' to uint32_t. Signed-off-by: Ramsay Jones <3e74413778ce9c8bebbbaedfd56741f6850faeaf@ramsay1.demon.co.uk> Acked-by: Nicolas Pitre <d659c10e27d52b00987b65e85d99bce5480adcae@fluxnic.net> Signed-off-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>
mit
destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git
5322ef2006cc93ad76140ff742cd96e74c1ec09b
#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
--- +++ @@ -45,7 +45,7 @@ @required -- (AFObjectModel *)objectModel; ++ (AFObjectModel *)objectModel; @optional
Make objectModel protocol method static.
mit
mlatham/AFToolkit
b8a8116b485bca23f277240d459f3ba0f560b42b
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "mail-namespace.h" #include "commands.h" bool cmd_create(struct client_command_context *cmd) { struct mail_namespace *ns; const char *mailbox, *full_mailbox; bool directory; size_t len; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mailbox)) return FALSE; full_mailbox = mailbox; ns = client_find_namespace(cmd, &mailbox); if (ns == NULL) return TRUE; len = strlen(full_mailbox); if (len == 0 || full_mailbox[len-1] != ns->sep) directory = FALSE; else { /* name ends with hierarchy separator - client is just informing us that it wants to create children under this mailbox. */ directory = TRUE; mailbox = t_strndup(mailbox, strlen(mailbox)-1); full_mailbox = t_strndup(full_mailbox, len-1); } if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE)) return TRUE; if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0) client_send_storage_error(cmd, ns->storage); else client_send_tagline(cmd, "OK Create completed."); return TRUE; }
/* Copyright (C) 2002 Timo Sirainen */ #include "common.h" #include "mail-namespace.h" #include "commands.h" bool cmd_create(struct client_command_context *cmd) { struct mail_namespace *ns; const char *mailbox, *full_mailbox; bool directory; size_t len; /* <mailbox> */ if (!client_read_string_args(cmd, 1, &mailbox)) return FALSE; full_mailbox = mailbox; ns = client_find_namespace(cmd, &mailbox); if (ns == NULL) return TRUE; len = strlen(full_mailbox); if (len == 0 || full_mailbox[len-1] != ns->sep) directory = FALSE; else { /* name ends with hierarchy separator - client is just informing us that it wants to create children under this mailbox. */ directory = TRUE; mailbox = t_strndup(mailbox, len-1); full_mailbox = t_strndup(full_mailbox, strlen(full_mailbox)-1); } if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE)) return TRUE; if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0) client_send_storage_error(cmd, ns->storage); else client_send_tagline(cmd, "OK Create completed."); return TRUE; }
--- +++ @@ -28,8 +28,8 @@ informing us that it wants to create children under this mailbox. */ directory = TRUE; - mailbox = t_strndup(mailbox, len-1); - full_mailbox = t_strndup(full_mailbox, strlen(full_mailbox)-1); + mailbox = t_strndup(mailbox, strlen(mailbox)-1); + full_mailbox = t_strndup(full_mailbox, len-1); } if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
CREATE ns_prefix/box/ didn't work right when namespace prefix existed. --HG-- branch : HEAD
mit
dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot
77378e0ff43a3fc1074c3eac22dbf25d1686fece
/* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/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. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #include "internal.h" #include "shims.h" #if !HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1; strncpy(dst, src, n); dst[n] = 0; } return res; } #endif
/* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/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. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #include "internal.h" #include "shims.h" #if !HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1; strncpy(dst, src, n); dst[n] = 0; } return res; } #endif
--- +++ @@ -22,7 +22,8 @@ #include "shims.h" #if !HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t size) { +size_t strlcpy(char *dst, const char *src, size_t size) +{ size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1;
Fix formatting to match libdispatch coding style. Signed-off-by: Daniel A. Steffen <bc823475b60dbcbd7be1bbdfe095b5f1939d5bd2@apple.com>
apache-2.0
apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch
d0436f27fd7bc254715e1b3b9cc6aae5ff9d4783
#ifndef TEST_GUEST_TUPLE_ITERATOR_H #define TEST_GUEST_TUPLE_ITERATOR_H #include <cxxtest/TestSuite.h> #include <unordered_set> #include <vector> #include "teams.h" #include "guest_tuple_iterator.h" class TestSeenTable : public CxxTest::TestSuite { public: void testFooBar(void) { } }; #endif
#ifndef TEST_GUEST_TUPLE_ITERATOR_H #define TEST_GUEST_TUPLE_ITERATOR_H #include <cxxtest/TestSuite.h> #include <unordered_set> #include <vector> #include "teams.h" #include "guest_tuple_iterator.h" class TestSeenTable : public CxxTest::TestSuite { private: std::vector<mue::Team> make_testteams(int num) { std::vector<mue::Team> teams; for (mue::Team_id i = 0; i < num; ++i) teams.push_back(mue::Team(i)); return teams; } public: void testFooBar(void) { } }; #endif
--- +++ @@ -10,21 +10,9 @@ class TestSeenTable : public CxxTest::TestSuite { - private: - std::vector<mue::Team> make_testteams(int num) - { - std::vector<mue::Team> teams; - - for (mue::Team_id i = 0; i < num; ++i) - teams.push_back(mue::Team(i)); - return teams; - } - public: void testFooBar(void) { - - } };
Clean skel for guest tuple iterator tests Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
bsd-3-clause
janLo/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool
89f7600802d05329facf46d92910ad8b1bdc642d
// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s // AS_LINK: /clang // AS_LINK-SAME: "-cc1as" // AS_LINK: /lld // AS_LINK-SAME: "-flavor" "gnu" "-target" "amdgcn--amdhsa"
// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s // AS_LINK-LABEL: clang // AS_LINK: "-cc1as" // AS_LINK-LABEL: lld // AS_LINK: "-flavor" "gnu" "-target" "amdgcn--amdhsa" // REQUIRES: clang-driver
--- +++ @@ -1,6 +1,5 @@ // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s -// AS_LINK-LABEL: clang -// AS_LINK: "-cc1as" -// AS_LINK-LABEL: lld -// AS_LINK: "-flavor" "gnu" "-target" "amdgcn--amdhsa" -// REQUIRES: clang-driver +// AS_LINK: /clang +// AS_LINK-SAME: "-cc1as" +// AS_LINK: /lld +// AS_LINK-SAME: "-flavor" "gnu" "-target" "amdgcn--amdhsa"
Fix test to pass when the directory name has lld in it. CHECK-LABEL assumes that there is only one occurrence of the match. The output looks like: clang version 3.8.0 (trunk 247999) .... /path/to/build/dir/bin/clang-3.8 .... If the path contains lld, the second CHECK-LABEL matches it and we fail since there is no -cc1as between clang and lld. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@248029 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang
a52a248ec8d38168dd15989ec6daacad1d43bdbb
#include "user.h" #include <stdlib.h> #include <string.h> #include <stdio.h> user_t* NewUser(int fd,char *addr,unsigned short port,char *name){ user_t *user = malloc(sizeof(user_t)); if(user == NULL){ goto ret; } if(fd < 0 || addr == NULL || name == NULL){ free(user); user = NULL; goto ret; } user->fd = fd; strcpy(user->addr,addr); user->port = port; strcpy(user->name,name); user->next = NULL; ret: return user; } void AddUserToList(user_t *root,user_t *newUser){ user_t *cur = root; if(root == NULL){ return; } while(cur->next != NULL){ cur = cur->next; } cur->next = newUser; } int CheckUserValid(user_t *root,char *name){ user_t *cur=root; int len = strlen(name); if(len < 2 || len > 12){ return 0; } if(strcmp(name,"anonymous") == 0){ return 0; } while(cur != NULL){ if(strcmp(cur->name,name) == 0){ return 0; } cur = cur->next; } return 1; }
#include "user.h" #include <stdlib.h> #include <string.h> #include <stdio.h> user_t* NewUser(int fd,char *addr,unsigned short port,char *name){ user_t *user = malloc(sizeof(user_t)); if(user == NULL){ goto ret; } if(fd < 0 || addr == NULL || name == NULL){ free(user); user = NULL; goto ret; } user->fd = fd; strcpy(user->addr,addr); user->port = port; strcpy(user->name,name); user->next = NULL; ret: return user; } void AddUserToList(user_t *root,user_t *newUser){ user_t *cur = root; while(cur->next != NULL){ cur = cur->next; } cur->next = newUser; } int CheckUserValid(user_t *root,char *name){ user_t *cur=root; int len = strlen(name); if(len < 2 || len > 12){ return 0; } if(strcmp(name,"anonymous") == 0){ return 0; } while(cur != NULL){ if(strcmp(cur->name,name) == 0){ return 0; } cur = cur->next; } return 1; }
--- +++ @@ -27,6 +27,9 @@ void AddUserToList(user_t *root,user_t *newUser){ user_t *cur = root; + if(root == NULL){ + return; + } while(cur->next != NULL){ cur = cur->next; }
Fix AddUserToList bug when root is NULL
apache-2.0
Billy4195/Simple_Chatroom
1bc76e90771befd2be6accd71b32ae2547e98f6a
// // STPLocalizationUtils.h // Stripe // // Created by Brian Dorfman on 8/11/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // #import <Foundation/Foundation.h> @interface STPLocalizationUtils : NSObject /** Acts like NSLocalizedString but tries to find the string in the Stripe bundle first if possible. */ + (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key; @end static inline NSString * _Nonnull STPLocalizedString(NSString* _Nonnull key, NSString * _Nullable __unused comment) { return [STPLocalizationUtils localizedStripeStringForKey:key]; }
// // STPLocalizedStringUtils.h // Stripe // // Created by Brian Dorfman on 8/11/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // #import <Foundation/Foundation.h> #define STPLocalizedString(key, comment) \ [STPLocalizationUtils localizedStripeStringForKey:(key)] @interface STPLocalizationUtils : NSObject /** Acts like NSLocalizedString but tries to find the string in the Stripe bundle first if possible. */ + (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key; @end
--- +++ @@ -1,5 +1,5 @@ // -// STPLocalizedStringUtils.h +// STPLocalizationUtils.h // Stripe // // Created by Brian Dorfman on 8/11/16. @@ -7,9 +7,6 @@ // #import <Foundation/Foundation.h> - -#define STPLocalizedString(key, comment) \ -[STPLocalizationUtils localizedStripeStringForKey:(key)] @interface STPLocalizationUtils : NSObject @@ -20,3 +17,7 @@ + (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key; @end + +static inline NSString * _Nonnull STPLocalizedString(NSString* _Nonnull key, NSString * _Nullable __unused comment) { + return [STPLocalizationUtils localizedStripeStringForKey:key]; +}
Change to use inline function instead of macro. This makes FauxPas's localization checks work properly.
mit
stripe/stripe-ios,NewAmsterdamLabs/stripe-ios,stripe/stripe-ios,fbernardo/stripe-ios,fbernardo/stripe-ios,stripe/stripe-ios,stripe/stripe-ios,stripe/stripe-ios,NewAmsterdamLabs/stripe-ios,fbernardo/stripe-ios,NewAmsterdamLabs/stripe-ios,stripe/stripe-ios,NewAmsterdamLabs/stripe-ios,fbernardo/stripe-ios
7b3e6a03279e775974dd43f7ff643f170fc08d1c
#include <stdio.h> int main() { char palavrasecreta[20]; sprintf(palavrasecreta, "MELANCIA"); int acertou = 0; int enforcou = 0; do { // comecar o nosso jogo!! } while(!acertou && !enforcou); }
#include <stdio.h> int main() { char palavrasecreta[20]; sprintf(palavrasecreta, "MELANCIA"); printf("%s\n", palavrasecreta); /* palavrasecreta[0] = 'M'; palavrasecreta[1] = 'E'; palavrasecreta[2] = 'L'; palavrasecreta[3] = 'A'; palavrasecreta[4] = 'N'; palavrasecreta[5] = 'C'; palavrasecreta[6] = 'I'; palavrasecreta[7] = 'A'; palavrasecreta[8] = '\0'; printf("%c%c%c%c%c%c%c%c\n", palavrasecreta[0], palavrasecreta[1], palavrasecreta[2], palavrasecreta[3], palavrasecreta[4], palavrasecreta[5], palavrasecreta[6], palavrasecreta[7]); */ }
--- +++ @@ -5,19 +5,12 @@ sprintf(palavrasecreta, "MELANCIA"); - printf("%s\n", palavrasecreta); + int acertou = 0; + int enforcou = 0; - /* - palavrasecreta[0] = 'M'; - palavrasecreta[1] = 'E'; - palavrasecreta[2] = 'L'; - palavrasecreta[3] = 'A'; - palavrasecreta[4] = 'N'; - palavrasecreta[5] = 'C'; - palavrasecreta[6] = 'I'; - palavrasecreta[7] = 'A'; - palavrasecreta[8] = '\0'; + do { + // comecar o nosso jogo!! - printf("%c%c%c%c%c%c%c%c\n", palavrasecreta[0], palavrasecreta[1], palavrasecreta[2], palavrasecreta[3], palavrasecreta[4], palavrasecreta[5], palavrasecreta[6], palavrasecreta[7]); - */ + } while(!acertou && !enforcou); + }
Update files, Alura, Introdução a C - Parte 2, Aula 2.3
mit
fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs
e9b5d3e4c0d690b50cc9a04b2aaec37381e22854
// -*- C++ -*- #ifndef _writer_verilog_task_h_ #define _writer_verilog_task_h_ #include "writer/verilog/resource.h" namespace iroha { namespace writer { namespace verilog { class Task : public Resource { public: Task(const IResource &res, const Table &table); virtual void BuildResource(); virtual void BuildInsn(IInsn *insn, State *st); static bool IsTask(const Table &table); static string TaskEnablePin(const ITable &tab, const ITable *caller); static const int kTaskEntryStateId; private: void BuildTaskResource(); void BuildTaskCallResource(); void BuildCallWire(IResource *caller); void BuildTaskCallInsn(IInsn *insn, State *st); void AddPort(const IModule *mod, IResource *caller, bool upward); void AddWire(const IModule *mod, IResource *caller); static string TaskPinPrefix(const ITable &tab, const ITable *caller); static string TaskAckPin(const ITable &tab, const ITable *caller); }; } // namespace verilog } // namespace writer } // namespace iroha #endif // _writer_verilog_task_h_
// -*- C++ -*- #ifndef _writer_verilog_task_h_ #define _writer_verilog_task_h_ #include "writer/verilog/resource.h" namespace iroha { namespace writer { namespace verilog { class Task : public Resource { public: Task(const IResource &res, const Table &table); virtual void BuildResource(); virtual void BuildInsn(IInsn *insn, State *st); static bool IsTask(const Table &table); static string TaskEnablePin(const ITable &tab, const ITable *caller); static const int kTaskEntryStateId; private: void BuildTaskResource(); void BuildTaskCallResource(); void BuildCallWire(IResource *caller); void BuildTaskCallInsn(IInsn *insn, State *st); void AddPort(const IModule *mod, IResource *caller); void AddWire(const IModule *mod, IResource *caller); static string TaskPinPrefix(const ITable &tab, const ITable *caller); static string TaskAckPin(const ITable &tab, const ITable *caller); }; } // namespace verilog } // namespace writer } // namespace iroha #endif // _writer_verilog_task_h_
--- +++ @@ -23,7 +23,7 @@ void BuildTaskCallResource(); void BuildCallWire(IResource *caller); void BuildTaskCallInsn(IInsn *insn, State *st); - void AddPort(const IModule *mod, IResource *caller); + void AddPort(const IModule *mod, IResource *caller, bool upward); void AddWire(const IModule *mod, IResource *caller); static string TaskPinPrefix(const ITable &tab, const ITable *caller);
Fix a missed file in previous change.
bsd-3-clause
nlsynth/iroha,nlsynth/iroha
f7c992a59e005e2f555a75cc23c83948c856435a
#include "sys/select.h" #include "bits/mac_esp8266.h" #include <stdio.h> #include "usart.h" int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds, fd_set *__exceptfds, struct timeval *__timeout) { SOCKET i; /* Count the ready socket. */ int count; count = 0; /* Go through interested sockets. */ for(i = SOCKET_BASE; i < nfds; i++) { if((__readfds != NULL) && FD_ISSET(i, __readfds)) { if(IsSocketReady2Read(i)) { /* The interested socket is ready to be read. */ count++; } else { /* The interested socket is not ready to be read. */ FD_CLR(i, __readfds); } } if((__writefds != NULL) && FD_ISSET(i, __writefds)) { if(IsSocketReady2Write(i)) { /* The interested socket is ready to be written. */ count++; } else { /* The interested socket is not ready to be written. */ FD_CLR(i, __writefds); } } if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) { // To do: List exception sockets. /* Zero __exceptfds for now. */ FD_ZERO(__exceptfds); } } return count; }
#include "sys/select.h" #include "bits/mac_esp8266.h" #include <stdio.h> #include "usart.h" int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds, fd_set *__exceptfds, struct timeval *__timeout) { SOCKET i; int c; c = 0; /* Go through interested sockets. */ for(i = SOCKET_BASE; i < nfds; i++) { if((__readfds != NULL) && FD_ISSET(i, __readfds)) { if(IsSocketReady2Read(i)) { /* The interested socket is ready to be read. */ c++; } else { /* The interested socket is not ready to be read. */ FD_CLR(i, __readfds); } } if((__writefds != NULL) && FD_ISSET(i, __writefds)) { if(IsSocketReady2Write(i)) { /* The interested socket is ready to be written. */ c++; } else { /* The interested socket is not ready to be written. */ FD_CLR(i, __writefds); } } if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) { // To do: List exception sockets. /* Zero __exceptfds for now. */ FD_ZERO(__exceptfds); } } return c; }
--- +++ @@ -7,15 +7,16 @@ int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds, fd_set *__exceptfds, struct timeval *__timeout) { SOCKET i; - int c; + /* Count the ready socket. */ + int count; - c = 0; + count = 0; /* Go through interested sockets. */ for(i = SOCKET_BASE; i < nfds; i++) { if((__readfds != NULL) && FD_ISSET(i, __readfds)) { if(IsSocketReady2Read(i)) { /* The interested socket is ready to be read. */ - c++; + count++; } else { /* The interested socket is not ready to be read. */ @@ -25,7 +26,7 @@ if((__writefds != NULL) && FD_ISSET(i, __writefds)) { if(IsSocketReady2Write(i)) { /* The interested socket is ready to be written. */ - c++; + count++; } else { /* The interested socket is not ready to be written. */ @@ -39,5 +40,5 @@ } } - return c; + return count; }
Change the variable name for more meaningful.
bsd-3-clause
starnight/MicroHttpServer,starnight/MicroHttpServer,starnight/MicroHttpServer,starnight/MicroHttpServer
34438e0e5eb32764691044269b8f3557f8c39668
#include <my_global.h> #include <my_sys.h> #include <m_string.h> #include <mysql.h> #include <quad_tile.h> my_bool tile_for_point_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { if ( args->arg_count != 2 || args->arg_type[0] != INT_RESULT || args->arg_type[1] != INT_RESULT ) { strcpy( message, "Your tile_for_point arguments are bogus!" ); return 1; } return 0; } void tile_for_point_deinit(UDF_INIT *initid) { return; } long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) { long long lat = *(long long *)args->args[0]; long long lon = *(long long *)args->args[1]; return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0)); }
#include <my_global.h> #include <my_sys.h> #include <m_string.h> #include <mysql.h> #include <quad_tile.h> my_bool tile_for_point_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { if ( args->arg_count != 2 || args->arg_type[0] != INT_RESULT || args->arg_type[1] != INT_RESULT ) { strcpy( message, "Your tile_for_point arguments are bogus!" ); return 1; } return 0; } void tile_for_point_deinit(UDF_INIT *initid) { return; } long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) { long long lon = *(long long *)args->args[0]; long long lat = *(long long *)args->args[1]; return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0)); }
--- +++ @@ -24,8 +24,8 @@ long long tile_for_point(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) { - long long lon = *(long long *)args->args[0]; - long long lat = *(long long *)args->args[1]; + long long lat = *(long long *)args->args[0]; + long long lon = *(long long *)args->args[1]; return xy2tile(lon2x(lon / 1000000.0), lat2y(lat / 1000000.0)); }
Make the MySQL tile_for_point function take arguments in the same order as the ruby version.
agpl-3.0
tillmo/do-roam,tillmo/do-roam,tillmo/do-roam,tillmo/do-roam,tillmo/do-roam,tillmo/do-roam
b1a0e5ae8b3e3d1052cc7c3e3ec12750060cb173
#ifndef DIRECTORY_H #define DIRECTORY_H #if defined (ULTRIX42) || defined(ULTRIX43) /* _POSIX_SOURCE should have taken care of this, but for some reason the ULTRIX version of dirent.h is not POSIX conforming without it... */ # define __POSIX #endif #include <dirent.h> #if defined(SUNOS41) /* Note that function seekdir() is not required by POSIX, but the sun implementation of rewinddir() (which is required by POSIX) is a macro utilizing seekdir(). Thus we need the prototype. */ extern "C" void seekdir( DIR *dirp, int loc ); #endif class Directory { public: Directory( const char *name ); ~Directory(); void Rewind(); char *Next(); private: DIR *dirp; }; #endif
#ifndef DIRECTORY_H #define DIRECTORY_H #if defined (ULTRIX42) || defined(ULTRIX43) /* _POSIX_SOURCE should have taken care of this, */ #define __POSIX /* but for some reason the ULTRIX version of dirent.h */ #endif /* is not POSIX conforming without it... */ #include <dirent.h> class Directory { public: Directory( const char *name ); ~Directory(); void Rewind(); char *Next(); private: DIR *dirp; }; #endif
--- +++ @@ -1,11 +1,23 @@ #ifndef DIRECTORY_H #define DIRECTORY_H -#if defined (ULTRIX42) || defined(ULTRIX43) /* _POSIX_SOURCE should have taken care of this, */ -#define __POSIX /* but for some reason the ULTRIX version of dirent.h */ -#endif /* is not POSIX conforming without it... */ +#if defined (ULTRIX42) || defined(ULTRIX43) + /* _POSIX_SOURCE should have taken care of this, + but for some reason the ULTRIX version of dirent.h + is not POSIX conforming without it... + */ +# define __POSIX +#endif + #include <dirent.h> +#if defined(SUNOS41) + /* Note that function seekdir() is not required by POSIX, but the sun + implementation of rewinddir() (which is required by POSIX) is + a macro utilizing seekdir(). Thus we need the prototype. + */ + extern "C" void seekdir( DIR *dirp, int loc ); +#endif class Directory {
Add prototype for seekdir() for Suns.
apache-2.0
htcondor/htcondor,clalancette/condor-dcloud,djw8605/htcondor,djw8605/htcondor,djw8605/condor,mambelli/osg-bosco-marco,neurodebian/htcondor,djw8605/htcondor,djw8605/htcondor,htcondor/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,htcondor/htcondor,zhangzhehust/htcondor,htcondor/htcondor,htcondor/htcondor,djw8605/htcondor,clalancette/condor-dcloud,djw8605/condor,clalancette/condor-dcloud,bbockelm/condor-network-accounting,bbockelm/condor-network-accounting,zhangzhehust/htcondor,bbockelm/condor-network-accounting,bbockelm/condor-network-accounting,mambelli/osg-bosco-marco,zhangzhehust/htcondor,djw8605/condor,djw8605/condor,neurodebian/htcondor,mambelli/osg-bosco-marco,clalancette/condor-dcloud,bbockelm/condor-network-accounting,djw8605/htcondor,bbockelm/condor-network-accounting,djw8605/condor,mambelli/osg-bosco-marco,bbockelm/condor-network-accounting,neurodebian/htcondor,djw8605/htcondor,zhangzhehust/htcondor,djw8605/htcondor,djw8605/htcondor,neurodebian/htcondor,neurodebian/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,djw8605/condor,neurodebian/htcondor,mambelli/osg-bosco-marco,bbockelm/condor-network-accounting,zhangzhehust/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,djw8605/condor,mambelli/osg-bosco-marco,htcondor/htcondor,clalancette/condor-dcloud,htcondor/htcondor,htcondor/htcondor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,mambelli/osg-bosco-marco,clalancette/condor-dcloud,clalancette/condor-dcloud,djw8605/condor
cc74b1067d791ce7f765eba8b67e2d1000c2cfcb
// // GWCollapsibleTable.h // CollapsibleTable // // Created by Greg Wang on 13-1-3. // Copyright (c) 2013年 Greg Wang. All rights reserved. // #import "NSObject+GWCollapsibleTable.h" #import "UITableView+GWCollapsibleTable.h" @protocol GWCollapsibleTableDataSource <NSObject> - (BOOL)tableView:(UITableView *)tableView canCollapseSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView headerCellForCollapsibleSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView bodyCellForRowAtIndexPath:(NSIndexPath *)indexPath; - (NSInteger)tableView:(UITableView *)tableView numberOfBodyRowsInSection:(NSInteger)section; // TODO: Support Editing & Reordering Methods @end @protocol GWCollapsibleTableDelegate <NSObject> - (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath; @optional - (void)tableView:(UITableView *)tableView willExpandSection:(NSInteger)section; - (void)tableView:(UITableView *)tableView willCollapseSection:(NSInteger)section; // TODO: Support Extra Selection Management Methods // TODO: Support Editing & Reordering Methods @end
// // GWCollapsibleTable.h // CollapsibleTable // // Created by Greg Wang on 13-1-3. // Copyright (c) 2013年 Greg Wang. All rights reserved. // @protocol GWCollapsibleTableDataSource <NSObject> - (BOOL)tableView:(UITableView *)tableView canCollapseSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView headerCellForCollapsibleSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView bodyCellForRowAtIndexPath:(NSIndexPath *)indexPath; - (NSInteger)tableView:(UITableView *)tableView numberOfBodyRowsInSection:(NSInteger)section; // TODO: Support Editing & Reordering Methods @end @protocol GWCollapsibleTableDelegate <NSObject> - (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath; // TODO: Support Extra Selection Management Methods // TODO: Support Editing & Reordering Methods @end
--- +++ @@ -5,6 +5,9 @@ // Created by Greg Wang on 13-1-3. // Copyright (c) 2013年 Greg Wang. All rights reserved. // + +#import "NSObject+GWCollapsibleTable.h" +#import "UITableView+GWCollapsibleTable.h" @protocol GWCollapsibleTableDataSource <NSObject> @@ -20,6 +23,11 @@ @protocol GWCollapsibleTableDelegate <NSObject> - (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath; + +@optional +- (void)tableView:(UITableView *)tableView willExpandSection:(NSInteger)section; +- (void)tableView:(UITableView *)tableView willCollapseSection:(NSInteger)section; + // TODO: Support Extra Selection Management Methods // TODO: Support Editing & Reordering Methods
Add necessary interfaces Add optional delegate methods
mit
yocaminobien/GWCollapsibleTable,gregwym/GWCollapsibleTable
6dcac4a16d43bc76b5e4492233cd170699f30875
#include <time.h> #include <sstream> #include <iostream> clock_t calc_time0,calc_time1; double calc_time; void printTime(const std::string& msg, long long iterations, double iterPerSec) { std::stringstream ss; ss << msg; while (ss.tellp() < 30) { ss << ' '; } ss << " iterations=" << iterations; while (ss.tellp() < 60) { ss << ' '; } ss <<" CPU Time="<<std::fixed<<calc_time; while (ss.tellp() < 80) { ss << ' '; } ss <<" iter/s="<<iterPerSec<<std::endl; std::cout << ss.str() << std::flush; } #define TIME_ON calc_time0=clock(); #define TIME_OFF(msg) calc_time1=clock(); \ calc_time=(double)(calc_time1-calc_time0)/CLOCKS_PER_SEC; \ printTime(msg, i, i/calc_time);
#include <time.h> clock_t calc_time0,calc_time1; double calc_time; #define TIME_ON calc_time0=clock(); #define TIME_OFF(msg) calc_time1=clock(); \ calc_time=(double)(calc_time1-calc_time0)/CLOCKS_PER_SEC; \ std::cout<<msg<<": iterations="<<i \ <<" CPU Time="<<std::fixed<<calc_time \ <<" iter/s="<<i/calc_time<<std::endl<<std::flush;
--- +++ @@ -1,11 +1,31 @@ #include <time.h> +#include <sstream> +#include <iostream> clock_t calc_time0,calc_time1; double calc_time; + +void printTime(const std::string& msg, long long iterations, double iterPerSec) { + std::stringstream ss; + ss << msg; + while (ss.tellp() < 30) { + ss << ' '; + } + ss << " iterations=" << iterations; + while (ss.tellp() < 60) { + ss << ' '; + } + ss <<" CPU Time="<<std::fixed<<calc_time; + while (ss.tellp() < 80) { + ss << ' '; + } + ss <<" iter/s="<<iterPerSec<<std::endl; + std::cout << ss.str() << std::flush; +} + + #define TIME_ON calc_time0=clock(); #define TIME_OFF(msg) calc_time1=clock(); \ calc_time=(double)(calc_time1-calc_time0)/CLOCKS_PER_SEC; \ - std::cout<<msg<<": iterations="<<i \ - <<" CPU Time="<<std::fixed<<calc_time \ - <<" iter/s="<<i/calc_time<<std::endl<<std::flush; + printTime(msg, i, i/calc_time);
Print times in fixed columns. Makes it easier to compare.
lgpl-2.1
worldforge/atlas-cpp,worldforge/atlas-cpp,worldforge/atlas-cpp,worldforge/atlas-cpp,worldforge/atlas-cpp,worldforge/atlas-cpp
771cb01c0311688f00593cc2a309e32afdbd4b40
/* Copyright (c) 2016, Nokia * Copyright (c) 2016, ENEA Software AB * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __OFP_EPOLL_H__ #define __OFP_EPOLL_H__ #include <stdint.h> #if __GNUC__ >= 4 #pragma GCC visibility push(default) #endif typedef union ofp_epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } ofp_epoll_data_t; struct ofp_epoll_event { uint32_t events; ofp_epoll_data_t data; }; enum OFP_EPOLL_EVENTS { OFP_EPOLLIN = 0x001, #define OFP_EPOLLIN OFP_EPOLLIN }; #define OFP_EPOLL_CTL_ADD 1 #define OFP_EPOLL_CTL_DEL 2 #define OFP_EPOLL_CTL_MOD 3 int ofp_epoll_create(int size); int ofp_epoll_ctl(int epfd, int op, int fd, struct ofp_epoll_event *event); int ofp_epoll_wait(int epfd, struct ofp_epoll_event *events, int maxevents, int timeout); #if __GNUC__ >= 4 #pragma GCC visibility pop #endif #endif
/* Copyright (c) 2016, Nokia * Copyright (c) 2016, ENEA Software AB * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __OFP_EPOLL_H__ #define __OFP_EPOLL_H__ #include <stdint.h> typedef union ofp_epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } ofp_epoll_data_t; struct ofp_epoll_event { uint32_t events; ofp_epoll_data_t data; }; enum OFP_EPOLL_EVENTS { OFP_EPOLLIN = 0x001, #define OFP_EPOLLIN OFP_EPOLLIN }; #define OFP_EPOLL_CTL_ADD 1 #define OFP_EPOLL_CTL_DEL 2 #define OFP_EPOLL_CTL_MOD 3 int ofp_epoll_create(int size); int ofp_epoll_ctl(int epfd, int op, int fd, struct ofp_epoll_event *event); int ofp_epoll_wait(int epfd, struct ofp_epoll_event *events, int maxevents, int timeout); #endif
--- +++ @@ -9,6 +9,10 @@ #define __OFP_EPOLL_H__ #include <stdint.h> + +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif typedef union ofp_epoll_data { void *ptr; @@ -37,4 +41,8 @@ int ofp_epoll_wait(int epfd, struct ofp_epoll_event *events, int maxevents, int timeout); +#if __GNUC__ >= 4 +#pragma GCC visibility pop #endif + +#endif
Add visibility to epoll headers The odp_epoll_* symbols were not visible in the final library built with GCC. Signed-off-by: Oriol Arcas <a98c9d4e37de3d71db2e1a293b51c579a914c4ae@starflownetworks.com> Reviewed-by: Sorin Vultureanu <8013ba55f8675034bc2ab0d6c3a1c9650437ca36@enea.com>
bsd-3-clause
TolikH/ofp,TolikH/ofp,OpenFastPath/ofp,OpenFastPath/ofp,OpenFastPath/ofp,TolikH/ofp,OpenFastPath/ofp
35bc38ac4592800a2c3d13b001a0b66679c8f0b7
// // SMLTextViewPrivate.h // Fragaria // // Created by Daniele Cattaneo on 26/02/15. // // #import <Cocoa/Cocoa.h> #import "SMLTextView.h" #import "SMLAutoCompleteDelegate.h" @interface SMLTextView () /** The autocomplete delegate for this text view. This property is private * because it is set to an internal object when MGSFragaria's autocomplete * delegate is set to nil. */ @property (weak) id<SMLAutoCompleteDelegate> autocompleteDelegate; /** The controller which manages the accessory user interface for this text * view. */ @property (readonly) MGSExtraInterfaceController *interfaceController; /** Instances of this class will perform syntax highlighting in text views. */ @property (readonly) SMLSyntaxColouring *syntaxColouring; @end
// // SMLTextViewPrivate.h // Fragaria // // Created by Daniele Cattaneo on 26/02/15. // // #import <Cocoa/Cocoa.h> #import "SMLTextView.h" #import "SMLAutoCompleteDelegate.h" @interface SMLTextView () /** The autocomplete delegate for this text view. This property is private * because it is set to an internal object when MGSFragaria's autocomplete * delegate is set to nil. */ @property id<SMLAutoCompleteDelegate> autocompleteDelegate; /** The controller which manages the accessory user interface for this text * view. */ @property (readonly) MGSExtraInterfaceController *interfaceController; /** Instances of this class will perform syntax highlighting in text views. */ @property (readonly) SMLSyntaxColouring *syntaxColouring; @end
--- +++ @@ -17,7 +17,7 @@ /** The autocomplete delegate for this text view. This property is private * because it is set to an internal object when MGSFragaria's autocomplete * delegate is set to nil. */ -@property id<SMLAutoCompleteDelegate> autocompleteDelegate; +@property (weak) id<SMLAutoCompleteDelegate> autocompleteDelegate; /** The controller which manages the accessory user interface for this text * view. */
Use weak attribute for the autocompleteDelegate property of SMLTextView.
apache-2.0
shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,vakoc/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,bitstadium/Fragaria,shysaur/Fragaria,bitstadium/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,shysaur/Fragaria,vakoc/Fragaria,shysaur/Fragaria
d19c36737dd3d2111911c411b19f1a270415b079
// RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // CHECK-NGM: "-mno-global-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // CHECK-GM-NOT: "-mglobal-merge"
// RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mno-global-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NGM < %t %s // CHECK-NGM: "-mno-global-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // RUN: %clang -target arm64-apple-ios7 \ // RUN: -mglobal-merge -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-GM < %t %s // CHECK-GM-NOT: "-mglobal-merge" // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mno-global-merge -c %s // RUN: %clang -target armv7-apple-darwin10 \ // RUN: -mglobal-merge -c %s
--- +++ @@ -18,8 +18,3 @@ // CHECK-GM-NOT: "-mglobal-merge" -// RUN: %clang -target armv7-apple-darwin10 \ -// RUN: -mno-global-merge -c %s - -// RUN: %clang -target armv7-apple-darwin10 \ -// RUN: -mglobal-merge -c %s
Revert new test from 213993. It requires an arm backend and also writes output in the test directory. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@213998 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang
4026b3ed5ed0c6af1312ac58a2ec578637d9175a
/* * $Id$ */ #include <errno.h> #include <time.h> /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0)
/* * $Id$ */ #include <errno.h> #include <time.h> /* from libvarnish/argv.c */ void FreeArgv(char **argv); char **ParseArgv(const char *s, int comment); /* from libvarnish/time.c */ void TIM_format(time_t t, char *p); time_t TIM_parse(const char *p); /* from libvarnish/version.c */ void varnish_version(const char *); /* from libvarnish/assert.c */ #ifdef WITHOUT_ASSERTS #define assert(e) ((void)0) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (e) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif void lbv_assert(const char *, const char *, int, const char *, int); /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0)
--- +++ @@ -22,7 +22,7 @@ #else /* WITH_ASSERTS */ #define assert(e) \ do { \ - if (e) \ + if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno); \ } while (0) #endif
Make assert do the right thing git-svn-id: 2c9807fa3ff65b17195bd55dc8a6c4261e10127b@745 d4fa192b-c00b-0410-8231-f00ffab90ce4
bsd-2-clause
alarky/varnish-cache-doc-ja,mrhmouse/Varnish-Cache,drwilco/varnish-cache-drwilco,ajasty-cavium/Varnish-Cache,franciscovg/Varnish-Cache,ambernetas/varnish-cache,drwilco/varnish-cache-drwilco,alarky/varnish-cache-doc-ja,ssm/pkg-varnish,ambernetas/varnish-cache,drwilco/varnish-cache-drwilco,gauthier-delacroix/Varnish-Cache,zhoualbeart/Varnish-Cache,ssm/pkg-varnish,varnish/Varnish-Cache,feld/Varnish-Cache,ssm/pkg-varnish,zhoualbeart/Varnish-Cache,wikimedia/operations-debs-varnish,varnish/Varnish-Cache,feld/Varnish-Cache,gquintard/Varnish-Cache,1HLtd/Varnish-Cache,gauthier-delacroix/Varnish-Cache,franciscovg/Varnish-Cache,gquintard/Varnish-Cache,alarky/varnish-cache-doc-ja,1HLtd/Varnish-Cache,drwilco/varnish-cache-old,alarky/varnish-cache-doc-ja,ajasty-cavium/Varnish-Cache,mrhmouse/Varnish-Cache,gauthier-delacroix/Varnish-Cache,wikimedia/operations-debs-varnish,zhoualbeart/Varnish-Cache,chrismoulton/Varnish-Cache,wikimedia/operations-debs-varnish,feld/Varnish-Cache,ajasty-cavium/Varnish-Cache,drwilco/varnish-cache-old,varnish/Varnish-Cache,drwilco/varnish-cache-old,ajasty-cavium/Varnish-Cache,wikimedia/operations-debs-varnish,wikimedia/operations-debs-varnish,1HLtd/Varnish-Cache,zhoualbeart/Varnish-Cache,chrismoulton/Varnish-Cache,ambernetas/varnish-cache,franciscovg/Varnish-Cache,feld/Varnish-Cache,gquintard/Varnish-Cache,mrhmouse/Varnish-Cache,1HLtd/Varnish-Cache,varnish/Varnish-Cache,franciscovg/Varnish-Cache,varnish/Varnish-Cache,chrismoulton/Varnish-Cache,ssm/pkg-varnish,ajasty-cavium/Varnish-Cache,mrhmouse/Varnish-Cache,gquintard/Varnish-Cache,chrismoulton/Varnish-Cache,gauthier-delacroix/Varnish-Cache,mrhmouse/Varnish-Cache,chrismoulton/Varnish-Cache,alarky/varnish-cache-doc-ja,ssm/pkg-varnish,feld/Varnish-Cache,gauthier-delacroix/Varnish-Cache,franciscovg/Varnish-Cache,zhoualbeart/Varnish-Cache
e10ab25f34927dedde7ad7621d9767b8ab76b857
// // SVProgressHUDAppDelegate.h // SVProgressHUD // // Created by Sam Vermette on 27.03.11. // Copyright 2011 Sam Vermette. All rights reserved. // #import <UIKit/UIKit.h> @class ViewController; @interface AppDelegate : NSObject <UIApplicationDelegate> @property (strong, nonatomic) IBOutlet UIWindow *window; @property (strong, nonatomic) IBOutlet ViewController *viewController; @end
// // SVProgressHUDAppDelegate.h // SVProgressHUD // // Created by Sam Vermette on 27.03.11. // Copyright 2011 Sam Vermette. All rights reserved. // #import <UIKit/UIKit.h> @class ViewController; @interface AppDelegate : NSObject <UIApplicationDelegate> { UIWindow *__weak window; ViewController *__weak viewController; } @property (weak, nonatomic) IBOutlet UIWindow *window; @property (weak, nonatomic) IBOutlet ViewController *viewController; @end
--- +++ @@ -10,13 +10,10 @@ @class ViewController; -@interface AppDelegate : NSObject <UIApplicationDelegate> { - UIWindow *__weak window; - ViewController *__weak viewController; -} +@interface AppDelegate : NSObject <UIApplicationDelegate> -@property (weak, nonatomic) IBOutlet UIWindow *window; -@property (weak, nonatomic) IBOutlet ViewController *viewController; +@property (strong, nonatomic) IBOutlet UIWindow *window; +@property (strong, nonatomic) IBOutlet ViewController *viewController; @end
Fix ARC warning in demo project.
mit
sdonly/SVProgressHUD,luxe-eng/valet-ios.SVProgressHUD,phildow/SVProgressHUD,ohyeslk/SVProgressHUD,Sunday4/SVProgressHUD,CoderJFCK/SVProgressHUD,cnzlh/SVProgressHUD,bertramdev/SVProgressHUD,lyndonChen/SVProgressHUD,wrcj12138aaa/SVProgressHUD,DramaFever/DFProgressHUD,CPF183/SVProgressHUD,PeeJWeeJ/SwiftyHUD,ddc391565320/SVProgressHUD,tonyunreal/SVProgressHUD,Alsen007/SVProgressHUD,zeptolee/SVProgressHUD,ashfurrow/SVProgressHUD,Kevin775263419/SVProgressHUD,1yvT0s/SVProgressHUD,hanangellove/SVProgressHUD,SuPair/SVProgressHUD,bhapca/SVProgressHUD,grachyov/SVProgressHUD,Pingco/SVProgressHUD,zdiovo/SVProgressHUD,siburb/SVProgressHUD,AutoScout24/SVProgressHUD,ShowerLi1991/SVProgressHUD,hnney/SVProgressHUD,SVProgressHUD/SVProgressHUD,flovilmart/SVProgressHUD,haiiev/SVProgressHUD,TransitApp/SVProgressHUD,morgman/TASVProgressHUD,dongdonggaui/SVProgressHUD,pplant/SVProgressHUD,zoyi/SVProgressHUD,hoanganh6491/SVProgressHUD,pengleelove/SVProgressHUD,iamcharleych/SVProgressHUD,hyperoslo/SVProgressHUD,ShyHornet/SVProgressHUD,basvankuijck/SVProgressHUD,mohsinalimat/SVProgressHUD,taviscaron/SVProgressHUD,cuppi/SVProgressHUD,powerhome/SVProgressHUD,z514306470/SVProgressHUD,andreyvit/SVProgressHUD,apascual/SVProgressHUD,wjszf/SVProgressHUD,Dschee/SVProgressHUD,pblondin/SVProgressHUD,cnbin/SVProgressHUD,Benuuu/SVProgressHUD,Karumi/SVProgressHUD,isghe/SVProgressHUD,SixFiveSoftware/SVProgressHUD,ezescaruli/SVProgressHUD,PeeJWeeJ/SwiftyHUD,maxcampolo/SVProgressHUD,RyanCodes/SVProgressHUD,yarneo/SVProgressHUD,shizu2014/SVProgressHUD,shenhzou654321/SVProgressHUD,adrum/SVProgressHUD,emodeqidao/SVProgressHUD,hoowang/SVProgressHUD,lzhao18/SVProgressHUD,huqiji/SVProgressHUD,lookingstars/SVProgressHUD,kohtenko/SVProgressHUD,cogddo/SVProgressHUD,icepy/SVProgressHUD,Staance/SVProgressHUD,HelloWilliam/SVProgressHUD,dxt/SVProgressHUD
8bf24c66e6a41067fb4fb7b443fb6ea85dc96b8e
/* 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; }
/* 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; }
--- +++ @@ -10,7 +10,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - cgltf_options options = {0}; + 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)
fuzz: Fix fuzzer to compile in C++ mode
mit
jkuhlmann/cgltf,jkuhlmann/cgltf,jkuhlmann/cgltf
6bc2c3564661acd3ebbd00843a8c09d5944a1da0
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2010 Collabora Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <config.h> #include <glib.h> #include <glib/gi18n-lib.h> #include <gmodule.h> #include <gio/gio.h> #include "cc-empathy-accounts-panel.h" void g_io_module_load (GIOModule *module) { cc_empathy_accounts_panel_register (module); } void g_io_module_unload (GIOModule *module) { }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2010 Collabora Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <config.h> #include <glib.h> #include <glib/gi18n-lib.h> #include <gmodule.h> #include <gio/gio.h> #include "cc-empathy-accounts-panel.h" void g_io_module_load (GIOModule *module) { textdomain (GETTEXT_PACKAGE); cc_empathy_accounts_panel_register (module); } void g_io_module_unload (GIOModule *module) { }
--- +++ @@ -30,8 +30,6 @@ void g_io_module_load (GIOModule *module) { - textdomain (GETTEXT_PACKAGE); - cc_empathy_accounts_panel_register (module); }
accounts-module: Remove call to textdomain () This shouldn't be called in shared module. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=617262
lgpl-2.1
GNOME/telepathy-account-widgets,Distrotech/telepathy-account-widgets,Distrotech/telepathy-account-widgets,GNOME/telepathy-account-widgets,GNOME/telepathy-account-widgets
849dcc2fd36ec01352a3544c501cbbe5afa78d95
#ifndef LMS7_MCU_PROGRAMS_H #define LMS7_MCU_PROGRAMS_H #include "LimeSuiteConfig.h" #include <stdint.h> #define MCU_PROGRAM_SIZE 16384 #define MCU_ID_DC_IQ_CALIBRATIONS 0x01 #define MCU_ID_CALIBRATIONS_SINGLE_IMAGE 0x05 #define MCU_FUNCTION_CALIBRATE_TX 1 #define MCU_FUNCTION_CALIBRATE_RX 2 #define MCU_FUNCTION_UPDATE_BW 3 #define MCU_FUNCTION_UPDATE_REF_CLK 4 #define MCU_FUNCTION_TUNE_RX_FILTER 5 #define MCU_FUNCTION_TUNE_TX_FILTER 6 #define MCU_FUNCTION_UPDATE_EXT_LOOPBACK_PAIR 9 #define MCU_FUNCTION_CALIBRATE_TX_EXTLOOPB 17 #define MCU_FUNCTION_CALIBRATE_RX_EXTLOOPB 18 #define MCU_FUNCTION_AGC 10 #define MCU_FUNCTION_GET_PROGRAM_ID 255 LIME_API extern const uint8_t mcu_program_lms7_dc_iq_calibration_bin[16384]; #endif
#ifndef LMS7_MCU_PROGRAMS_H #define LMS7_MCU_PROGRAMS_H #include "LimeSuiteConfig.h" #include <stdint.h> #define MCU_PROGRAM_SIZE 16384 #define MCU_ID_DC_IQ_CALIBRATIONS 0x01 #define MCU_ID_CALIBRATIONS_SINGLE_IMAGE 0x05 #define MCU_FUNCTION_CALIBRATE_TX 1 #define MCU_FUNCTION_CALIBRATE_RX 2 #define MCU_FUNCTION_UPDATE_BW 3 #define MCU_FUNCTION_UPDATE_REF_CLK 4 #define MCU_FUNCTION_TUNE_TX_FILTER 5 #define MCU_FUNCTION_TUNE_RX_FILTER 6 #define MCU_FUNCTION_UPDATE_EXT_LOOPBACK_PAIR 9 #define MCU_FUNCTION_CALIBRATE_TX_EXTLOOPB 17 #define MCU_FUNCTION_CALIBRATE_RX_EXTLOOPB 18 #define MCU_FUNCTION_AGC 10 #define MCU_FUNCTION_GET_PROGRAM_ID 255 LIME_API extern const uint8_t mcu_program_lms7_dc_iq_calibration_bin[16384]; #endif
--- +++ @@ -13,8 +13,8 @@ #define MCU_FUNCTION_CALIBRATE_RX 2 #define MCU_FUNCTION_UPDATE_BW 3 #define MCU_FUNCTION_UPDATE_REF_CLK 4 -#define MCU_FUNCTION_TUNE_TX_FILTER 5 -#define MCU_FUNCTION_TUNE_RX_FILTER 6 +#define MCU_FUNCTION_TUNE_RX_FILTER 5 +#define MCU_FUNCTION_TUNE_TX_FILTER 6 #define MCU_FUNCTION_UPDATE_EXT_LOOPBACK_PAIR 9 #define MCU_FUNCTION_CALIBRATE_TX_EXTLOOPB 17 #define MCU_FUNCTION_CALIBRATE_RX_EXTLOOPB 18
Fix MCU procedure ID definitions.
apache-2.0
myriadrf/LimeSuite,myriadrf/LimeSuite,myriadrf/LimeSuite,myriadrf/LimeSuite,myriadrf/LimeSuite
aa6cb15c3969e2f711e98c3f3012efbe0679d87e
// Copyright 2012 Rui Ueyama <rui314@gmail.com> // This program is free software licensed under the MIT license. #include "test.h" #define stringify(x) #x void digraph(void) { expect_string("[", stringify(<:)); expect_string("]", stringify(:>)); expect_string("{", stringify(<%)); expect_string("}", stringify(%>)); expect_string("#", stringify(%:)); expect_string("% :", stringify(% :)); expect_string("##", stringify(%:%:)); expect_string("#%", stringify(%:%)); } void escape(void) { int value = 10; expect(10, val\ ue); } void whitespace(void) { expect_string("x y", stringify( x y )); } void newline(void) { # } void testmain(void) { print("lexer"); digraph(); escape(); whitespace(); newline(); }
// Copyright 2012 Rui Ueyama <rui314@gmail.com> // This program is free software licensed under the MIT license. #include "test.h" #define stringify(x) #x void digraph(void) { expect_string("[", stringify(<:)); expect_string("]", stringify(:>)); expect_string("{", stringify(<%)); expect_string("}", stringify(%>)); expect_string("#", stringify(%:)); expect_string("% :", stringify(% :)); expect_string("##", stringify(%:%:)); expect_string("#%", stringify(%:%)); } void escape(void) { int value = 10; expect(10, val\ ue); } void whitespace(void) { expect_string("x y", stringify( x y )); } void testmain(void) { print("lexer"); digraph(); escape(); whitespace(); }
--- +++ @@ -32,9 +32,16 @@ )); } +void newline(void) { + + +# +} + void testmain(void) { print("lexer"); digraph(); escape(); whitespace(); + newline(); }
Add a test for line separator characters.
mit
jtramm/8cc,vastin/8cc,vastin/8cc,8l/8cc,vastin/8cc,nobody1986/8cc,rui314/8cc,cpjreynolds/8cc,abc00/8cc,nobody1986/8cc,gergo-/8cc,rui314/8cc,jtramm/8cc,andrewchambers/8cc,andrewchambers/8cc,nobody1986/8cc,cpjreynolds/8cc,8l/8cc,andrewchambers/8cc,abc00/8cc,andrewchambers/8cc,jtramm/8cc,cpjreynolds/8cc,jtramm/8cc,gergo-/8cc,abc00/8cc,nobody1986/8cc,rui314/8cc,cpjreynolds/8cc,8l/8cc,gergo-/8cc,vastin/8cc,rui314/8cc,8l/8cc,abc00/8cc
b9b636884725b783c3a33cf762148cbf19e0458d
#ifndef ROLE_H_ #define ROLE_H_ #include "State.h" #include "Location.h" #include <vector> // this class is partial abstract class Role { public: // reference to the main state State& state; // neighbors std::vector<int> neighbors; private: // position of the ant int x, y; // ant's id int id; public: // -- virtual functions that will be implemented separately // communicate virtual void receive ( int msg ) { // do nothing } // action move virtual int move() = 0; void run(void) const { int result = move(); if ( 0 < result and result < TDIRECTION ) { state.makeMove( getLocation(), result ); } } // helper functions // return location of the ant Location getLocation(void) const { return Location( x, y ); } // return the id of the ant int getID() const { return id; } // constructor Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {} }; #endif
#ifndef ROLE_H_ #define ROLE_H_ #include "State.h" class Role{ public: State& state; int x,y; Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {} int getID(){ return id; } virtual void move() = 0; private: //changing id is impossible int id; }; #endif
--- +++ @@ -1,20 +1,68 @@ + #ifndef ROLE_H_ #define ROLE_H_ #include "State.h" +#include "Location.h" -class Role{ - public: +#include <vector> + +// this class is partial abstract +class Role { + +public: + + // reference to the main state State& state; - int x,y; - Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {} - int getID(){ + + // neighbors + std::vector<int> neighbors; + +private: + + // position of the ant + int x, y; + + // ant's id + int id; + +public: + + // -- virtual functions that will be implemented separately + + // communicate + virtual void receive ( int msg ) { + // do nothing + } + + // action move + virtual int move() = 0; + + void run(void) const { + + int result = move(); + + if ( 0 < result and result < TDIRECTION ) { + state.makeMove( getLocation(), result ); + } + } + + // helper functions + + // return location of the ant + Location getLocation(void) const { + return Location( x, y ); + } + + // return the id of the ant + int getID() const { return id; } - virtual void move() = 0; - private: - //changing id is impossible - int id; + + // constructor + Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {} + }; + #endif
Add more features ( made it more functional )
mit
KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot
58d8ac057e53be1a71a519fe4db7d83e7cf8056a
#include "GRT/GRT.h" #include "istream.h" using namespace GRT; // Normalize by dividing each dimension by the total magnitude. // Also add the magnitude as an additional feature. vector<double> normalize(vector<double> input) { double magnitude = 0.0; for (int i = 0; i < input.size(); i++) magnitude += (input[i] * input[i]); magnitude = sqrt(magnitude); for (int i = 0; i < input.size(); i++) input[i] /= magnitude; input.push_back(magnitude); return input; } ASCIISerialStream stream(9600, 3); GestureRecognitionPipeline pipeline; void setup() { stream.useUSBPort(0); stream.useNormalizer(normalize); useStream(stream); pipeline.addPreProcessingModule(MovingAverageFilter(5, 4)); //pipeline.addFeatureExtractionModule(TimeDomainFeatures(10, 1, 3, false, true, true, false, false)); pipeline.setClassifier(ANBC()); usePipeline(pipeline); }
#include "GRT/GRT.h" #include "istream.h" using namespace GRT; // Normalize by dividing each dimension by the total magnitude. // Also add the magnitude as an additional feature. vector<double> normalize(vector<double> input) { double magnitude; for (int i = 0; i < input.size(); i++) magnitude += (input[i] * input[i]); magnitude = sqrt(magnitude); for (int i = 0; i < input.size(); i++) input[i] /= magnitude; input.push_back(magnitude); return input; } ASCIISerialStream stream(9600, 3); GestureRecognitionPipeline pipeline; void setup() { stream.useUSBPort(0); stream.useNormalizer(normalize); useStream(stream); pipeline.addPreProcessingModule(MovingAverageFilter(5, 4)); //pipeline.addFeatureExtractionModule(TimeDomainFeatures(10, 1, 3, false, true, true, false, false)); pipeline.setClassifier(ANBC()); usePipeline(pipeline); }
--- +++ @@ -6,14 +6,14 @@ // Normalize by dividing each dimension by the total magnitude. // Also add the magnitude as an additional feature. vector<double> normalize(vector<double> input) { - double magnitude; - + double magnitude = 0.0; + for (int i = 0; i < input.size(); i++) magnitude += (input[i] * input[i]); magnitude = sqrt(magnitude); for (int i = 0; i < input.size(); i++) input[i] /= magnitude; - + input.push_back(magnitude); - + return input; } @@ -24,7 +24,7 @@ stream.useUSBPort(0); stream.useNormalizer(normalize); useStream(stream); - + pipeline.addPreProcessingModule(MovingAverageFilter(5, 4)); //pipeline.addFeatureExtractionModule(TimeDomainFeatures(10, 1, 3, false, true, true, false, false)); pipeline.setClassifier(ANBC());
Initialize double variable before use. Also removed trailing spaces.
bsd-3-clause
damellis/ESP,damellis/ESP
546aa3b916172c46fa6df8f7a002949c3976c060
#include "clar_libgit2.h" #include "git2/clone.h" static git_repository *g_repo; #if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) static bool g_has_ssl = true; #else static bool g_has_ssl = false; #endif void test_online_badssl__expired(void) { if (!g_has_ssl) cl_skip(); cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://expired.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__wrong_host(void) { if (!g_has_ssl) cl_skip(); cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://wrong.host.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__self_signed(void) { if (!g_has_ssl) cl_skip(); cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://self-signed.badssl.com/fake.git", "./fake", NULL)); }
#include "clar_libgit2.h" #include "git2/clone.h" static git_repository *g_repo; #if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) void test_online_badssl__expired(void) { cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://expired.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__wrong_host(void) { cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://wrong.host.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__self_signed(void) { cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://self-signed.badssl.com/fake.git", "./fake", NULL)); } #endif
--- +++ @@ -5,23 +5,34 @@ static git_repository *g_repo; #if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) +static bool g_has_ssl = true; +#else +static bool g_has_ssl = false; +#endif void test_online_badssl__expired(void) { + if (!g_has_ssl) + cl_skip(); + cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://expired.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__wrong_host(void) { + if (!g_has_ssl) + cl_skip(); + cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://wrong.host.badssl.com/fake.git", "./fake", NULL)); } void test_online_badssl__self_signed(void) { + if (!g_has_ssl) + cl_skip(); + cl_git_fail_with(GIT_ECERTIFICATE, git_clone(&g_repo, "https://self-signed.badssl.com/fake.git", "./fake", NULL)); } - -#endif
Fix build for unit test If none of GIT_OPENSSL, GIT_WINHTTP or GIT_SECURE_TRANSPORT is defined we should also be able to build the unit test.
lgpl-2.1
stewid/libgit2,magnus98/TEST,leoyanggit/libgit2,Tousiph/Demo1,yongthecoder/libgit2,jeffhostetler/public_libgit2,KTXSoftware/libgit2,KTXSoftware/libgit2,saurabhsuniljain/libgit2,magnus98/TEST,yongthecoder/libgit2,KTXSoftware/libgit2,magnus98/TEST,yongthecoder/libgit2,Tousiph/Demo1,Tousiph/Demo1,Corillian/libgit2,saurabhsuniljain/libgit2,joshtriplett/libgit2,saurabhsuniljain/libgit2,yongthecoder/libgit2,Corillian/libgit2,leoyanggit/libgit2,KTXSoftware/libgit2,magnus98/TEST,jeffhostetler/public_libgit2,Corillian/libgit2,stewid/libgit2,stewid/libgit2,saurabhsuniljain/libgit2,joshtriplett/libgit2,Tousiph/Demo1,jeffhostetler/public_libgit2,Corillian/libgit2,KTXSoftware/libgit2,magnus98/TEST,leoyanggit/libgit2,saurabhsuniljain/libgit2,stewid/libgit2,yongthecoder/libgit2,yongthecoder/libgit2,leoyanggit/libgit2,jeffhostetler/public_libgit2,stewid/libgit2,Corillian/libgit2,magnus98/TEST,joshtriplett/libgit2,stewid/libgit2,jeffhostetler/public_libgit2,saurabhsuniljain/libgit2,joshtriplett/libgit2,leoyanggit/libgit2,joshtriplett/libgit2,Tousiph/Demo1,joshtriplett/libgit2,jeffhostetler/public_libgit2,Tousiph/Demo1,leoyanggit/libgit2,KTXSoftware/libgit2,Corillian/libgit2
505e4531b7e52daf6caa9eac9904d9a014e0d14f
/** * @file * * @brief * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #ifndef ELEKTRA_PLUGIN_CCODE_H #define ELEKTRA_PLUGIN_CCODE_H #include <kdbplugin.h> typedef struct { unsigned char encode[256]; unsigned char decode[256]; char escape; char * buf; size_t bufalloc; } CCodeData; ssize_t keySetRaw (Key * key, const void * newBinary, size_t dataSize); void elektraCcodeEncode (Key * cur, CCodeData * h); void elektraCcodeDecode (Key * cur, CCodeData * h); int elektraCcodeOpen (Plugin * handle, Key * k); int elektraCcodeClose (Plugin * handle, Key * k); int elektraCcodeGet (Plugin * handle, KeySet * ks, Key * parentKey); int elektraCcodeSet (Plugin * handle, KeySet * ks, Key * parentKey); Plugin * ELEKTRA_PLUGIN_EXPORT (ccode); #endif
/** * @file * * @brief * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #ifndef ELEKTRA_PLUGIN_CCODE_H #define ELEKTRA_PLUGIN_CCODE_H #include <kdbplugin.h> typedef struct { char encode[256]; char decode[256]; char escape; char * buf; size_t bufalloc; } CCodeData; ssize_t keySetRaw (Key * key, const void * newBinary, size_t dataSize); void elektraCcodeEncode (Key * cur, CCodeData * h); void elektraCcodeDecode (Key * cur, CCodeData * h); int elektraCcodeOpen (Plugin * handle, Key * k); int elektraCcodeClose (Plugin * handle, Key * k); int elektraCcodeGet (Plugin * handle, KeySet * ks, Key * parentKey); int elektraCcodeSet (Plugin * handle, KeySet * ks, Key * parentKey); Plugin * ELEKTRA_PLUGIN_EXPORT (ccode); #endif
--- +++ @@ -13,8 +13,8 @@ typedef struct { - char encode[256]; - char decode[256]; + unsigned char encode[256]; + unsigned char decode[256]; char escape;
CCode: Use `unsigned char` for mapping
bsd-3-clause
e1528532/libelektra,ElektraInitiative/libelektra,e1528532/libelektra,mpranj/libelektra,BernhardDenner/libelektra,ElektraInitiative/libelektra,BernhardDenner/libelektra,mpranj/libelektra,mpranj/libelektra,petermax2/libelektra,BernhardDenner/libelektra,BernhardDenner/libelektra,mpranj/libelektra,petermax2/libelektra,mpranj/libelektra,petermax2/libelektra,mpranj/libelektra,petermax2/libelektra,ElektraInitiative/libelektra,e1528532/libelektra,e1528532/libelektra,ElektraInitiative/libelektra,ElektraInitiative/libelektra,mpranj/libelektra,petermax2/libelektra,BernhardDenner/libelektra,ElektraInitiative/libelektra,petermax2/libelektra,BernhardDenner/libelektra,ElektraInitiative/libelektra,e1528532/libelektra,mpranj/libelektra,petermax2/libelektra,petermax2/libelektra,e1528532/libelektra,BernhardDenner/libelektra,ElektraInitiative/libelektra,BernhardDenner/libelektra,ElektraInitiative/libelektra,e1528532/libelektra,e1528532/libelektra,mpranj/libelektra,petermax2/libelektra,ElektraInitiative/libelektra,mpranj/libelektra,mpranj/libelektra,ElektraInitiative/libelektra,BernhardDenner/libelektra
9fd8c99a43beea140d4656bc5871ed2b0ea3328c
#include "pg_query.h" #include "pg_query_internal.h" #include <mb/pg_wchar.h> const char* progname = "pg_query"; void pg_query_init(void) { MemoryContextInit(); SetDatabaseEncoding(PG_UTF8); }
#include "pg_query.h" #include "pg_query_internal.h" const char* progname = "pg_query"; void pg_query_init(void) { MemoryContextInit(); }
--- +++ @@ -1,9 +1,11 @@ #include "pg_query.h" #include "pg_query_internal.h" +#include <mb/pg_wchar.h> const char* progname = "pg_query"; void pg_query_init(void) { MemoryContextInit(); + SetDatabaseEncoding(PG_UTF8); }
Set database encoding to UTF8. Fixes error when parsing this statement: SELECT U&'\0441\043B\043E\043D' The error is: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8. Perhapes there could be an API to set the encoding used by the parser. But I think it makes sense to use UTF8 by default.
bsd-3-clause
lfittl/libpg_query,ranxian/peloton-frontend,lfittl/libpg_query,lfittl/libpg_query,ranxian/peloton-frontend,ranxian/peloton-frontend,ranxian/peloton-frontend,ranxian/peloton-frontend
743a89c5c27c3c17b87af5df8c381d95b00f2f42
#ifndef PHP_PHPIREDIS_H #define PHP_PHPIREDIS_H 1 #define PHP_PHPIREDIS_VERSION "1.0.0" #define PHP_PHPIREDIS_EXTNAME "phpiredis" PHP_MINIT_FUNCTION(phpiredis); PHP_FUNCTION(phpiredis_connect); PHP_FUNCTION(phpiredis_pconnect); PHP_FUNCTION(phpiredis_disconnect); PHP_FUNCTION(phpiredis_command_bs); PHP_FUNCTION(phpiredis_command); PHP_FUNCTION(phpiredis_multi_command); PHP_FUNCTION(phpiredis_multi_command_bs); PHP_FUNCTION(phpiredis_format_command); PHP_FUNCTION(phpiredis_reader_create); PHP_FUNCTION(phpiredis_reader_reset); PHP_FUNCTION(phpiredis_reader_feed); PHP_FUNCTION(phpiredis_reader_get_state); PHP_FUNCTION(phpiredis_reader_get_error); PHP_FUNCTION(phpiredis_reader_get_reply); PHP_FUNCTION(phpiredis_reader_destroy); PHP_FUNCTION(phpiredis_reader_set_error_handler); PHP_FUNCTION(phpiredis_reader_set_status_handler); extern zend_module_entry phpiredis_module_entry; #define phpext_phpiredis_ptr &phpiredis_module_entry #endif
#ifndef PHP_PHPIREDIS_H #define PHP_PHPIREDIS_H 1 #define PHP_PHPIREDIS_VERSION "1.0" #define PHP_PHPIREDIS_EXTNAME "phpiredis" PHP_MINIT_FUNCTION(phpiredis); PHP_FUNCTION(phpiredis_connect); PHP_FUNCTION(phpiredis_pconnect); PHP_FUNCTION(phpiredis_disconnect); PHP_FUNCTION(phpiredis_command_bs); PHP_FUNCTION(phpiredis_command); PHP_FUNCTION(phpiredis_multi_command); PHP_FUNCTION(phpiredis_multi_command_bs); PHP_FUNCTION(phpiredis_format_command); PHP_FUNCTION(phpiredis_reader_create); PHP_FUNCTION(phpiredis_reader_reset); PHP_FUNCTION(phpiredis_reader_feed); PHP_FUNCTION(phpiredis_reader_get_state); PHP_FUNCTION(phpiredis_reader_get_error); PHP_FUNCTION(phpiredis_reader_get_reply); PHP_FUNCTION(phpiredis_reader_destroy); PHP_FUNCTION(phpiredis_reader_set_error_handler); PHP_FUNCTION(phpiredis_reader_set_status_handler); extern zend_module_entry phpiredis_module_entry; #define phpext_phpiredis_ptr &phpiredis_module_entry #endif
--- +++ @@ -1,7 +1,7 @@ #ifndef PHP_PHPIREDIS_H #define PHP_PHPIREDIS_H 1 -#define PHP_PHPIREDIS_VERSION "1.0" +#define PHP_PHPIREDIS_VERSION "1.0.0" #define PHP_PHPIREDIS_EXTNAME "phpiredis" PHP_MINIT_FUNCTION(phpiredis);
Add patch release in PHP_PHPIREDIS_VERSION.
bsd-2-clause
jymsy/phpiredis,nrk/phpiredis,RustJason/phpiredis,Danack/phpiredis,RustJason/phpiredis,Danack/phpiredis,jymsy/phpiredis,RustJason/phpiredis,nrk/phpiredis,Danack/phpiredis,nrk/phpiredis
9a909d3e6778fd655397f304bf42cdce163e43a0
#include "redislite.h" #include <string.h> static void test_add_key(redislite *db) { int rnd = rand(); char key[14]; sprintf(key, "%d", rnd); int size = strlen(key); redislite_insert_key(db, key, size, 0); } int main() { redislite *db = redislite_open_database("test.db"); int i; for (i=0; i < 100; i++) test_add_key(db); redislite_close_database(db); return 0; }
#include "redislite.h" #include <string.h> static void test_add_key(redislite *db) { int rnd = arc4random(); char key[14]; sprintf(key, "%d", rnd); int size = strlen(key); redislite_insert_key(db, key, size, 0); } int main() { redislite *db = redislite_open_database("test.db"); int i; for (i=0; i < 100; i++) test_add_key(db); redislite_close_database(db); return 0; }
--- +++ @@ -3,7 +3,7 @@ static void test_add_key(redislite *db) { - int rnd = arc4random(); + int rnd = rand(); char key[14]; sprintf(key, "%d", rnd); int size = strlen(key);
Use rand instead of arc4random (linux doesn't support it)
bsd-2-clause
seppo0010/redislite,seppo0010/redislite,pombredanne/redislite,pombredanne/redislite
49b8e80371bfa380dd34168a92d98b639ca1202a
/* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/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. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #include "internal.h" #include "shims.h" #if !HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1; strncpy(dst, src, n); dst[n] = 0; } return res; } #endif
/* * Copyright (c) 2013-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/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. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #include "internal.h" #include "shims.h" #if !HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1; strncpy(dst, src, n); dst[n] = 0; } return res; } #endif
--- +++ @@ -22,7 +22,8 @@ #include "shims.h" #if !HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t size) { +size_t strlcpy(char *dst, const char *src, size_t size) +{ size_t res = strlen(dst) + strlen(src) + 1; if (size > 0) { size_t n = size - 1;
Fix formatting to match libdispatch coding style.
apache-2.0
apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch,apple/swift-corelibs-libdispatch
4ee60d1890ae12729a9afda7e64dd2c12d48776a
#ifndef iRRAM_MPFR_EXTENSION_H #define iRRAM_MPFR_EXTENSION_H #ifndef GMP_RNDN #include <mpfr.h> #endif #ifdef __cplusplus extern "C" { #endif void mpfr_ext_exp (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_log (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_sin (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_cos (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_tan (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_test (mpfr_ptr r, mpfr_srcptr u,int p,mp_rnd_t rnd_mode); #ifdef __cplusplus } #endif #endif
#ifndef iRRAM_MPFR_EXTENSION_H #define iRRAM_MPFR_EXTENSION_H #ifndef GMP_RNDN #include <mpfr.h> #endif #ifdef __cplusplus extern "C" { #endif void mpfr_ext_exp (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_log (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_sin (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_cos (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_tan (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_test (mpfr_ptr r, mpfr_srcptr u,int p,mp_rnd_t rnd_mode); void iRRAM_initialize(int argc,char **argv); #ifdef __cplusplus } #endif #endif
--- +++ @@ -17,8 +17,6 @@ void mpfr_ext_tan (mpfr_ptr r, mpfr_srcptr u,int p); void mpfr_ext_test (mpfr_ptr r, mpfr_srcptr u,int p,mp_rnd_t rnd_mode); -void iRRAM_initialize(int argc,char **argv); - #ifdef __cplusplus } #endif
Delete duplicate (and incompatible) declaration of iRRAM_initialize().
lgpl-2.1
norbert-mueller/iRRAM,norbert-mueller/iRRAM,norbert-mueller/iRRAM
77c380c9d57553e114b253630dcb1283c7096730
/* * Copyright 2008 Markus Prinz * Released unter an MIT licence * */ #include <ruby.h> #include <CoreMIDI/CoreMIDI.h> VALUE callback_proc = Qnil; MIDIPortRef inPort = NULL; MIDIClientRef client = NULL; static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon) { } static VALUE t_sources(VALUE self) { int number_of_sources = MIDIGetNumberOfSources(); VALUE source_ary = rb_ary_new2(number_of_sources); for(int idx = 0; idx < number_of_sources; ++idx) { MIDIEndpointRef src = MIDIGetSource(idx); CFStringRef pname; char name[64]; MIDIObjectGetStringProperty(src, kMIDIPropertyName, pname); CFStringGetCString(pname, name, sizeof(name), 0); CFRelease(pname); rb_ary_push(source_ary, rb_str_new2(name)); } return source_ary; } void Init_rbcoremidi (void) { // Add the initialization code of your module here. }
/* * Copyright 2008 Markus Prinz * Released unter an MIT licence * */ #include <ruby.h> #include <CoreMIDI/CoreMIDI.h> VALUE callback_proc = Qnil; MIDIPortRef inPort = NULL; MIDIClientRef client = NULL; static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon) { } void Init_rbcoremidi (void) { // Add the initialization code of your module here. }
--- +++ @@ -18,6 +18,28 @@ } +static VALUE t_sources(VALUE self) +{ + int number_of_sources = MIDIGetNumberOfSources(); + + VALUE source_ary = rb_ary_new2(number_of_sources); + + for(int idx = 0; idx < number_of_sources; ++idx) + { + MIDIEndpointRef src = MIDIGetSource(idx); + CFStringRef pname; + char name[64]; + + MIDIObjectGetStringProperty(src, kMIDIPropertyName, pname); + CFStringGetCString(pname, name, sizeof(name), 0); + CFRelease(pname); + + rb_ary_push(source_ary, rb_str_new2(name)); + } + + return source_ary; +} + void Init_rbcoremidi (void) { // Add the initialization code of your module here.
Add best guess at a method that returns an array with the names of all sources
mit
cypher/rbcoremidi,cypher/rbcoremidi
e1f21893cedcb02fc76415e2bb95b3d0c06d1abf
#ifndef _ASM_X86_NUMA_32_H #define _ASM_X86_NUMA_32_H extern int numa_off; extern int pxm_to_nid(int pxm); #ifdef CONFIG_NUMA extern int __cpuinit numa_cpu_node(int cpu); #else /* CONFIG_NUMA */ static inline int numa_cpu_node(int cpu) { return NUMA_NO_NODE; } #endif /* CONFIG_NUMA */ #ifdef CONFIG_HIGHMEM extern void set_highmem_pages_init(void); #else static inline void set_highmem_pages_init(void) { } #endif #endif /* _ASM_X86_NUMA_32_H */
#ifndef _ASM_X86_NUMA_32_H #define _ASM_X86_NUMA_32_H extern int numa_off; extern int pxm_to_nid(int pxm); #ifdef CONFIG_NUMA extern int __cpuinit numa_cpu_node(int apicid); #else /* CONFIG_NUMA */ static inline int numa_cpu_node(int cpu) { return NUMA_NO_NODE; } #endif /* CONFIG_NUMA */ #ifdef CONFIG_HIGHMEM extern void set_highmem_pages_init(void); #else static inline void set_highmem_pages_init(void) { } #endif #endif /* _ASM_X86_NUMA_32_H */
--- +++ @@ -6,7 +6,7 @@ extern int pxm_to_nid(int pxm); #ifdef CONFIG_NUMA -extern int __cpuinit numa_cpu_node(int apicid); +extern int __cpuinit numa_cpu_node(int cpu); #else /* CONFIG_NUMA */ static inline int numa_cpu_node(int cpu) { return NUMA_NO_NODE; } #endif /* CONFIG_NUMA */
x86: Rename incorrectly named parameter of numa_cpu_node() numa_cpu_node() prototype in numa_32.h has wrongly named parameter @apicid when it actually takes the CPU number. Change it to @cpu. Reported-by: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org> Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org> LKML-Reference: <f632a7ad4ac6ff59d2c90454ea4e3c237f8c7a30@htj.dyndns.org> Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
mit
KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas
eff9073790e1286aa12bf1c65814d3e0132b12e1
#pragma once #include "augs/math/declare_math.h" #include "augs/audio/distance_model.h" struct sound_effect_modifier { // GEN INTROSPECTOR struct sound_effect_modifier real32 gain = 1.f; real32 pitch = 1.f; real32 max_distance = -1.f; real32 reference_distance = -1.f; real32 doppler_factor = 1.f; char repetitions = 1; bool fade_on_exit = true; bool disable_velocity = false; bool always_direct_listener = false; augs::distance_model distance_model = augs::distance_model::NONE; // END GEN INTROSPECTOR };
#pragma once #include "augs/math/declare_math.h" #include "augs/audio/distance_model.h" struct sound_effect_modifier { // GEN INTROSPECTOR struct sound_effect_modifier real32 gain = 1.f; real32 pitch = 1.f; real32 max_distance = -1.f; real32 reference_distance = -1.f; real32 doppler_factor = 1.f; augs::distance_model distance_model = augs::distance_model::NONE; int repetitions = 1; bool fade_on_exit = true; bool disable_velocity = false; bool always_direct_listener = false; pad_bytes<1> pad; // END GEN INTROSPECTOR };
--- +++ @@ -9,11 +9,10 @@ real32 max_distance = -1.f; real32 reference_distance = -1.f; real32 doppler_factor = 1.f; - augs::distance_model distance_model = augs::distance_model::NONE; - int repetitions = 1; + char repetitions = 1; bool fade_on_exit = true; bool disable_velocity = false; bool always_direct_listener = false; - pad_bytes<1> pad; + augs::distance_model distance_model = augs::distance_model::NONE; // END GEN INTROSPECTOR };
FIx sound(..)modifier compaibility with old maps
agpl-3.0
TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia
f9b6386e1f69a8f5b4d69b0f1af75d242bcd71e9
static int parent_main(pid_t child_pid) { pid_t pid; int status; pid = wait4(child_pid, &status, WNOHANG, NULL); if (pid != 0) return (1); return (0); } int main(int argc, const char *argv[]) { pid_t child_pid; int retval; child_pid = fork(); switch (child_pid) { case -1: return (18); case 0: for (;;) ; return (0); default: break; } retval = parent_main(child_pid); kill(child_pid, SIGKILL); return (retval); }
static int parent_main(pid_t child_pid) { pid_t pid; int status; pid = wait4(child_pid, &status, WNOHANG, NULL); if (pid != 0) return (1); return (0); } static void signal_handler(int sig) { } int main(int argc, const char *argv[]) { struct sigaction act; struct timespec t; pid_t child_pid; int retval; act.sa_handler = signal_handler; act.sa_flags = 0; if (sigfillset(&act.sa_mask) == -1) return (16); if (sigaction(SIGTERM, &act, NULL) == -1) return (17); child_pid = fork(); switch (child_pid) { case -1: return (18); case 0: t.tv_sec = 8; t.tv_nsec = 0; nanosleep(&t, NULL); return (0); default: break; } retval = parent_main(child_pid); kill(child_pid, SIGTERM); return (retval); }
--- +++ @@ -12,34 +12,19 @@ return (0); } -static void -signal_handler(int sig) -{ -} - int main(int argc, const char *argv[]) { - struct sigaction act; - struct timespec t; pid_t child_pid; int retval; - - act.sa_handler = signal_handler; - act.sa_flags = 0; - if (sigfillset(&act.sa_mask) == -1) - return (16); - if (sigaction(SIGTERM, &act, NULL) == -1) - return (17); child_pid = fork(); switch (child_pid) { case -1: return (18); case 0: - t.tv_sec = 8; - t.tv_nsec = 0; - nanosleep(&t, NULL); + for (;;) + ; return (0); default: break; @@ -47,7 +32,7 @@ retval = parent_main(child_pid); - kill(child_pid, SIGTERM); + kill(child_pid, SIGKILL); return (retval); }
Simplify the test for wait4(2) with WNOHANG.
mit
SumiTomohiko/fsyscall2,SumiTomohiko/fsyscall2,SumiTomohiko/fsyscall2,SumiTomohiko/fsyscall2,SumiTomohiko/fsyscall2
c03ed8c4aa935e2490178b52fbaa73675137f626
#include <stdio.h> #define NUMERO_DE_TENTATIVAS 5 int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) { printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS); printf("Qual é o seu chute? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); if(chute < 0) { printf("Você não pode chutar números negativos!\n"); i--; continue; } int acertou = chute == numerosecreto; int maior = chute > numerosecreto; int menor = chute < numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); break; } else if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } } printf("Fim de jogo!\n"); }
#include <stdio.h> #define NUMERO_DE_TENTATIVAS 5 int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) { printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS); printf("Qual é o seu chute? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); int acertou = chute == numerosecreto; int maior = chute > numerosecreto; int menor = chute < numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); break; } else if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } } printf("Fim de jogo!\n"); }
--- +++ @@ -21,6 +21,13 @@ scanf("%d", &chute); printf("Seu chute foi %d\n", chute); + if(chute < 0) { + printf("Você não pode chutar números negativos!\n"); + i--; + + continue; + } + int acertou = chute == numerosecreto; int maior = chute > numerosecreto; int menor = chute < numerosecreto; @@ -28,6 +35,7 @@ if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); + break; }
Update files, Alura, Introdução a C, Aula 2.9
mit
fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs,fabriciofmsilva/labs
e8fad243e1003a0113dc229ed18bd16651c009b4
#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; }
#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; }
--- +++ @@ -20,7 +20,7 @@ warnx("No soundex code found for %s", dict[i++]); continue; } - fprintf(out, "%s\t%s\n", dict[i], soundex_code); + fprintf(out, "%s\t%s\n", soundex_code, dict[i]); free(soundex_code); }
Change the order of the strings First we should output the soundex code and then the string (makes the parsing of the file easier)
bsd-2-clause
abhinav-upadhyay/nbspell,abhinav-upadhyay/nbspell
a53a81ca5adc6febb775d912e8d326c9e69f584e
// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text -verify %s // Avoid the crash when finding the expression for tracking the origins // of the null pointer for path notes. void pr34373() { int *a = 0; // expected-note{{'a' initialized to a null pointer value}} (a + 0)[0]; // expected-warning{{Array access results in a null pointer dereference}} // expected-note@-1{{Array access results in a null pointer dereference}} }
// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text -verify %s // Avoid the crash when finding the expression for tracking the origins // of the null pointer for path notes. Apparently, not much actual tracking // needs to be done in this example. void pr34373() { int *a = 0; // expected-note{{'a' initialized to a null pointer value}} (a + 0)[0]; // expected-warning{{Array access results in a null pointer dereference}} // expected-note@-1{{Array access results in a null pointer dereference}} }
--- +++ @@ -1,8 +1,7 @@ // RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text -verify %s // Avoid the crash when finding the expression for tracking the origins -// of the null pointer for path notes. Apparently, not much actual tracking -// needs to be done in this example. +// of the null pointer for path notes. void pr34373() { int *a = 0; // expected-note{{'a' initialized to a null pointer value}} (a + 0)[0]; // expected-warning{{Array access results in a null pointer dereference}}
[analyzer] Fix an outdated comment in a test. NFC. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@314298 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang
9a1a3f47cc175cb4588451e2c6bf2147407e16f0
#ifndef __FILTERIMPORTEREXPORTER_H__ #define __FILTERIMPORTEREXPORTER_H__ #include <qvaluelist.h> class KMFilter; class KConfig; namespace KMail { /** @short Utility class that provides persisting of filters to/from KConfig. @author Till Adam <till@kdab.net> */ class FilterImporterExporter { public: FilterImporterExporter( bool popFilter = false ); virtual ~FilterImporterExporter(); /** Export the given filter rules to a file which * is asked from the user. The list to export is also * presented for confirmation/selection. */ void exportFilters( const QValueList<KMFilter*> & ); /** Import filters. Ask the user where to import them from * and which filters to import. */ QValueList<KMFilter*> importFilters(); static void writeFiltersToConfig( const QValueList<KMFilter*>& filters, KConfig* config, bool bPopFilter ); static QValueList<KMFilter*> readFiltersFromConfig( KConfig* config, bool bPopFilter ); private: bool mPopFilter; }; } #endif /* __FILTERIMPORTEREXPORTER_H__ */
#ifndef __FILTERIMPORTEREXPORTER_H__ #define __FILTERIMPORTEREXPORTER_H__ #include <qvalueList.h> class KMFilter; class KConfig; namespace KMail { /** @short Utility class that provides persisting of filters to/from KConfig. @author Till Adam <till@kdab.net> */ class FilterImporterExporter { public: FilterImporterExporter( bool popFilter = false ); virtual ~FilterImporterExporter(); /** Export the given filter rules to a file which * is asked from the user. The list to export is also * presented for confirmation/selection. */ void exportFilters( const QValueList<KMFilter*> & ); /** Import filters. Ask the user where to import them from * and which filters to import. */ QValueList<KMFilter*> importFilters(); static void writeFiltersToConfig( const QValueList<KMFilter*>& filters, KConfig* config, bool bPopFilter ); static QValueList<KMFilter*> readFiltersFromConfig( KConfig* config, bool bPopFilter ); private: bool mPopFilter; }; } #endif /* __FILTERIMPORTEREXPORTER_H__ */
--- +++ @@ -1,7 +1,7 @@ #ifndef __FILTERIMPORTEREXPORTER_H__ #define __FILTERIMPORTEREXPORTER_H__ -#include <qvalueList.h> +#include <qvaluelist.h> class KMFilter; class KConfig;
Fix compilation for case-sensitive file systems. svn path=/branches/kdepim/enterprise/kdepim/; revision=728559
lgpl-2.1
lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi
142b3a0aa1e6c5d0addb914a13c3dd8755f89010
/* * File: Curve.h * Author: cameron * * Created on October 22, 2013, 1:07 AM */ #ifndef CURVE_H #define CURVE_H #if (defined(__AVR__)) #include <avr\pgmspace.h> #else #include <pgmspace.h> #endif class Curve { static const uint8_t etable[] PROGMEM; public: static uint8_t exponential(uint8_t); static uint8_t linear(uint8_t); static uint8_t reverse(uint8_t); }; #endif /* CURVE_H */
/* * File: Curve.h * Author: cameron * * Created on October 22, 2013, 1:07 AM */ #ifndef CURVE_H #define CURVE_H #include <avr/pgmspace.h> class Curve { static const uint8_t etable[] PROGMEM; public: static uint8_t exponential(uint8_t); static uint8_t linear(uint8_t); static uint8_t reverse(uint8_t); }; #endif /* CURVE_H */
--- +++ @@ -8,7 +8,11 @@ #ifndef CURVE_H #define CURVE_H -#include <avr/pgmspace.h> +#if (defined(__AVR__)) +#include <avr\pgmspace.h> +#else +#include <pgmspace.h> +#endif class Curve { static const uint8_t etable[] PROGMEM;
Fix for eps8266 and athers non avr mcu :) Fix for eps8266 and athers non avr mcu :)
mit
jgillick/arduino-LEDFader
0f9d995ab74075c306b7c8b24ac930c4a93e76d0
void __VERIFIER_error() { abort(); } // Some files define __VERIFIER_assume, some declare as extern. What happens when redefined? void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; } // #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; } #define __VERIFIER_nondet2(X, Y) X __VERIFIER_nondet_##Y() { X val; return val; } #define __VERIFIER_nondet(X) __VERIFIER_nondet2(X, X) __VERIFIER_nondet2(_Bool, bool) __VERIFIER_nondet(char) __VERIFIER_nondet2(unsigned char, uchar) // int __VERIFIER_nondet_int() { int val; return val; } __VERIFIER_nondet(int) __VERIFIER_nondet2(unsigned int, uint) __VERIFIER_nondet(long) __VERIFIER_nondet2(unsigned long, ulong) // void* __VERIFIER_nondet_pointer() { void* val; return val; } __VERIFIER_nondet2(void*, pointer)
void __VERIFIER_error() { abort(); } int __VERIFIER_nondet_int() { int val; return val; }
--- +++ @@ -1,3 +1,19 @@ void __VERIFIER_error() { abort(); } -int __VERIFIER_nondet_int() { int val; return val; } +// Some files define __VERIFIER_assume, some declare as extern. What happens when redefined? +void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; } + +// #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; } +#define __VERIFIER_nondet2(X, Y) X __VERIFIER_nondet_##Y() { X val; return val; } +#define __VERIFIER_nondet(X) __VERIFIER_nondet2(X, X) + +__VERIFIER_nondet2(_Bool, bool) +__VERIFIER_nondet(char) +__VERIFIER_nondet2(unsigned char, uchar) +// int __VERIFIER_nondet_int() { int val; return val; } +__VERIFIER_nondet(int) +__VERIFIER_nondet2(unsigned int, uint) +__VERIFIER_nondet(long) +__VERIFIER_nondet2(unsigned long, ulong) +// void* __VERIFIER_nondet_pointer() { void* val; return val; } +__VERIFIER_nondet2(void*, pointer)
Add more common __VERIFIER functions
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
4a50f0e986c8e57fb734bd66a93f951e89fa370a
#include <polygon.h> int main(int argc, char* argv[]) { Polygon lol; lol=createPolygon(); lol=addPoint(lol, createPoint(12.6,-5.3)); lol=addPoint(lol, createPoint(-4.1,456.123)); printf("\n\ntaille : %d", lol.size); printf("\n\nx premier point : %f", lol.head->value.x); printf("\ny premier point : %f\n\n", lol.head->value.y); printf("\n\nx 2eme point : %f", lol.head->next->value.x); printf("\ny 2eme point : %f\n\n", lol.head->next->value.y); printf("\n\nx 3eme point : %f", lol.head->next->next->value.x); printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y); return EXIT_SUCCESS; }
#include <polygon.h> int main(int argc, char* argv[]) { Polygon lol; lol=createPolygon(); lol=addPoint(lol, createPoint(12.6,-5.3)); lol=addPoint(lol, createPoint(-4.1,456.123)); printf("\n\nx premier point : %f", lol->value.x); printf("\ny premier point : %f\n\n", lol->value.y); printf("\n\nx 2eme point : %f", lol->next->value.x); printf("\ny 2eme point : %f\n\n", lol->next->value.y); printf("\n\nx 3eme point : %f", lol->next->next->value.x); printf("\ny 3eme point : %f\n\n", lol->next->next->value.y); return EXIT_SUCCESS; }
--- +++ @@ -9,14 +9,16 @@ lol=addPoint(lol, createPoint(12.6,-5.3)); lol=addPoint(lol, createPoint(-4.1,456.123)); - printf("\n\nx premier point : %f", lol->value.x); - printf("\ny premier point : %f\n\n", lol->value.y); + printf("\n\ntaille : %d", lol.size); - printf("\n\nx 2eme point : %f", lol->next->value.x); - printf("\ny 2eme point : %f\n\n", lol->next->value.y); + printf("\n\nx premier point : %f", lol.head->value.x); + printf("\ny premier point : %f\n\n", lol.head->value.y); - printf("\n\nx 3eme point : %f", lol->next->next->value.x); - printf("\ny 3eme point : %f\n\n", lol->next->next->value.y); + printf("\n\nx 2eme point : %f", lol.head->next->value.x); + printf("\ny 2eme point : %f\n\n", lol.head->next->value.y); + + printf("\n\nx 3eme point : %f", lol.head->next->next->value.x); + printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y); return EXIT_SUCCESS;
Print the size of the polygon
mit
UTBroM/GeometricLib
facf0422c56fc82a3a6d9097c582228b54ff2846
/* * File: executeStage.h * Author: Alex Savarda */ #define INSTR_COUNT 16 // Possible size of the instruction set #ifndef EXECUTESTAGE_H #define EXECUTESTAGE_H typedef struct { unsigned int stat; unsigned int icode; unsigned int ifun; unsigned int valC; unsigned int valA; unsigned int valB; unsigned int dstE; unsigned int dstM; unsigned int srcA; unsigned int srcB; } eregister; struct E { unsigned int stat; unsigned int icode; unsigned int ifun; unsigned int valC; unsigned int valA; unsigned int valB; unsigned int dstE; unsigned int dstM; unsigned int srcA; unsigned int srcB; }; // Function prototypes eregister getEregister(void); void clearEregister(void); void executeStage(); void initFuncPtrArray(void); void updateEregister(unsigned int stat, unsigned int icode, unsigned int ifun, unsigned int valC, unsigned int valA, unsigned int valB, unsigned int dstE, unsigned int dstM, unsigned int srcA, unsigned int srcB); #endif /* EXECUTESTAGE_H */
/* * File: executeStage.h * Author: Alex Savarda */ #define INSTR_COUNT 16 // Possible size of the instruction set #ifndef EXECUTESTAGE_H #define EXECUTESTAGE_H typedef struct { unsigned int stat; unsigned int icode; unsigned int ifun; unsigned int valC; unsigned int valA; unsigned int valB; unsigned int dstE; unsigned int dstM; unsigned int srcA; unsigned int srcB; } eregister; struct E { unsigned int stat; unsigned int icode; unsigned int ifun; unsigned int valC; unsigned int valA; unsigned int valB; unsigned int dstE; unsigned int dstM; unsigned int srcA; unsigned int srcB; }; // Function prototypes eregister getEregister(void); void clearEregister(void); void executeStage(); void initFuncPtrArray(void); void updateEregister(unsigned int stat, unsigned int icode, unsigned int ifun, unsigned int valC, unsigned int valA, unsigned int valB, unsigned int dstE, unsigned int dstM, unsigned int srcA, unsigned int srcB); #endif /* EXECUTESTAGE_H */
--- +++ @@ -6,7 +6,7 @@ #define INSTR_COUNT 16 // Possible size of the instruction set #ifndef EXECUTESTAGE_H -#define EXECUTESTAGE_H +#define EXECUTESTAGE_H typedef struct { unsigned int stat;
Convert a tab into a space
isc
sbennett1990/YESS,sbennett1990/YESS,sbennett1990/YESS
d3464b2f5f46a6db68f66a62e9d130b744cc6594
#include <stdlib.h> #include <pwd.h> #include <string.h> #include <sys/stat.h> #include <gtk/gtk.h> #include "gh-main-window.h" char * data_dir_path () { uid_t uid = getuid (); struct passwd *pw = getpwuid (uid); char *home_dir = pw->pw_dir; char *data_dir = "/.ghighlighter-c"; int length = strlen (home_dir); length = length + strlen (data_dir); char *result = malloc (length + sizeof (char)); strcat (result, home_dir); strcat (result, data_dir); return result; } void setup_environment (char *data_dir) { mkdir (data_dir, 0755); } int main (int argc, char *argv[]) { char *data_dir = data_dir_path (); setup_environment (data_dir); free (data_dir); GtkWidget *window; gtk_init (&argc, &argv); window = gh_main_window_create (); gtk_widget_show_all (window); gtk_main (); return 0; }
#include <stdlib.h> #include <pwd.h> #include <string.h> #include <gtk/gtk.h> #include "gh-main-window.h" char * data_dir_path () { uid_t uid = getuid (); struct passwd *pw = getpwuid (uid); char *home_dir = pw->pw_dir; char *data_dir = "/.ghighlighter-c"; int length = strlen (home_dir); length = length + strlen (data_dir); char *result = malloc (length + sizeof (char)); strcat (result, home_dir); strcat (result, data_dir); return result; } int main (int argc, char *argv[]) { char *data_dir = data_dir_path (); free (data_dir); GtkWidget *window; gtk_init (&argc, &argv); window = gh_main_window_create (); gtk_widget_show_all (window); gtk_main (); return 0; }
--- +++ @@ -1,6 +1,7 @@ #include <stdlib.h> #include <pwd.h> #include <string.h> +#include <sys/stat.h> #include <gtk/gtk.h> #include "gh-main-window.h" @@ -23,10 +24,17 @@ return result; } +void +setup_environment (char *data_dir) +{ + mkdir (data_dir, 0755); +} + int main (int argc, char *argv[]) { char *data_dir = data_dir_path (); + setup_environment (data_dir); free (data_dir); GtkWidget *window;
Create data directory on startup
mit
chdorner/ghighlighter-c
88cf4c93e1fb0a39a2226abe4c869371ef0c6393
/* OCaml promise library * http://www.ocsigen.org/lwt * Copyright (C) 2009-2010 Jérémie Dimino * 2009 Mauricio Fernandez * 2010 Pierre Chambart * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, with linking exceptions; * either version 2.1 of the License, or (at your option) any later * version. See COPYING file for details. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #pragma once #include "lwt_config.h" /* * Included in: * - unix_mcast_modify_membership.c * - unix_mcast_set_loop.c * - unix_mcast_set_ttl.c * - unix_mcast_utils.c */ #if !defined(LWT_ON_WINDOWS) #include <caml/mlvalues.h> #include <caml/unixsupport.h> int socket_domain(int fd); #endif
/* OCaml promise library * http://www.ocsigen.org/lwt * Copyright (C) 2009-2010 Jérémie Dimino * 2009 Mauricio Fernandez * 2010 Pierre Chambart * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, with linking exceptions; * either version 2.1 of the License, or (at your option) any later * version. See COPYING file for details. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #pragma once #include "lwt_config.h" #if !defined(LWT_ON_WINDOWS) #include <caml/mlvalues.h> #include <caml/unixsupport.h> int socket_domain(int fd); #endif
--- +++ @@ -24,6 +24,14 @@ #pragma once #include "lwt_config.h" +/* + * Included in: + * - unix_mcast_modify_membership.c + * - unix_mcast_set_loop.c + * - unix_mcast_set_ttl.c + * - unix_mcast_utils.c + */ + #if !defined(LWT_ON_WINDOWS) #include <caml/mlvalues.h>
Add in comments the files that uses this header
mit
c-cube/lwt,ocsigen/lwt,rneswold/lwt,ocsigen/lwt,ocsigen/lwt,rneswold/lwt,c-cube/lwt,rneswold/lwt,c-cube/lwt
bd6796b0bde2d9ccdc55fdaf7747f1846ecd459d
// Copyright (c) 2015 The BitCoin Core developers // Copyright (c) 2016 The Silk Network developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Functionality for communicating with Tor. */ #ifndef SILK_TORCONTROL_H #define SILK_TORCONTROL_H #include "scheduler.h" extern const std::string DEFAULT_TOR_CONTROL; static const bool DEFAULT_LISTEN_ONION = false; void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler); void InterruptTorControl(); void StopTorControl(); #endif /* SILK_TORCONTROL_H */
// Copyright (c) 2015 The BitCoin Core developers // Copyright (c) 2016 The Silk Network developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Functionality for communicating with Tor. */ #ifndef SILK_TORCONTROL_H #define SILK_TORCONTROL_H #include "scheduler.h" extern const std::string DEFAULT_TOR_CONTROL; static const bool DEFAULT_LISTEN_ONION = true; void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler); void InterruptTorControl(); void StopTorControl(); #endif /* SILK_TORCONTROL_H */
--- +++ @@ -12,7 +12,7 @@ #include "scheduler.h" extern const std::string DEFAULT_TOR_CONTROL; -static const bool DEFAULT_LISTEN_ONION = true; +static const bool DEFAULT_LISTEN_ONION = false; void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler); void InterruptTorControl();
Set Tor Default Monitoring to False
mit
SilkNetwork/Silk-Core,duality-solutions/Sequence,SilkNetwork/Silk-Core,SilkNetwork/Silk-Core,duality-solutions/Sequence,duality-solutions/Sequence,SilkNetwork/Silk-Core,duality-solutions/Sequence,SilkNetwork/Silk-Core,duality-solutions/Sequence,SilkNetwork/Silk-Core,duality-solutions/Sequence
8f40a8f6eafed187bc8d5ed38b1d080c9dc2af98
//===- FuzzerRandom.h - Internal header for the Fuzzer ----------*- C++ -* ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // fuzzer::Random //===----------------------------------------------------------------------===// #ifndef LLVM_FUZZER_RANDOM_H #define LLVM_FUZZER_RANDOM_H #include <random> namespace fuzzer { class Random : public std::mt19937 { public: Random(unsigned int seed) : std::mt19937(seed) {} result_type operator()() { return this->std::mt19937::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } size_t operator()(size_t n) { return n ? Rand() % n : 0; } intptr_t operator()(intptr_t From, intptr_t To) { assert(From < To); intptr_t RangeSize = To - From + 1; return operator()(RangeSize) + From; } }; } // namespace fuzzer #endif // LLVM_FUZZER_RANDOM_H
//===- FuzzerRandom.h - Internal header for the Fuzzer ----------*- C++ -* ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // fuzzer::Random //===----------------------------------------------------------------------===// #ifndef LLVM_FUZZER_RANDOM_H #define LLVM_FUZZER_RANDOM_H #include <random> namespace fuzzer { class Random : public std::minstd_rand { public: Random(unsigned int seed) : std::minstd_rand(seed) {} result_type operator()() { return this->std::minstd_rand::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } size_t operator()(size_t n) { return n ? Rand() % n : 0; } intptr_t operator()(intptr_t From, intptr_t To) { assert(From < To); intptr_t RangeSize = To - From + 1; return operator()(RangeSize) + From; } }; } // namespace fuzzer #endif // LLVM_FUZZER_RANDOM_H
--- +++ @@ -14,10 +14,10 @@ #include <random> namespace fuzzer { -class Random : public std::minstd_rand { +class Random : public std::mt19937 { public: - Random(unsigned int seed) : std::minstd_rand(seed) {} - result_type operator()() { return this->std::minstd_rand::operator()(); } + Random(unsigned int seed) : std::mt19937(seed) {} + result_type operator()() { return this->std::mt19937::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } size_t operator()(size_t n) { return n ? Rand() % n : 0; }
Revert r352732: [libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand This causes a failure on the following bot as well as our internal ones: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/23103 git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@352747 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt
02815ad97a1a9cac9e580452c9dd24580f277062
#include <stdio.h> #include <stdarg.h> #include <string.h> static FILE* g_logfile = NULL; static unsigned char g_lastchar = '\n'; #ifdef _WIN32 #include <windows.h> static unsigned long g_timestamp; #else #include <sys/time.h> static struct timeval g_timestamp; #endif int message (const char* fmt, ...) { va_list ap; if (g_logfile) { if (g_lastchar == '\n') { #ifdef _WIN32 unsigned long timestamp = GetTickCount () - g_timestamp; unsigned long sec = timestamp / 1000L, msec = timestamp % 1000L; fprintf (g_logfile, "[%li.%03li] ", sec, msec); #else struct timeval now = {0}, timestamp = {0}; gettimeofday (&now, NULL); timersub (&now, &g_timestamp, &timestamp); fprintf (g_logfile, "[%lli.%06lli] ", (long long)timestamp.tv_sec, (long long)timestamp.tv_usec); #endif } size_t len = strlen (fmt); if (len > 0) g_lastchar = fmt[len - 1]; else g_lastchar = 0; va_start (ap, fmt); vfprintf (g_logfile, fmt, ap); va_end (ap); } va_start (ap, fmt); int rc = vfprintf (stdout, fmt, ap); va_end (ap); return rc; } void message_set_logfile (const char* filename) { if (g_logfile) { fclose (g_logfile); g_logfile = NULL; } if (filename) g_logfile = fopen (filename, "w"); if (g_logfile) { g_lastchar = '\n'; #ifdef _WIN32 g_timestamp = GetTickCount (); #else gettimeofday (&g_timestamp, NULL); #endif } }
#include <stdio.h> #include <stdarg.h> static FILE* g_logfile = NULL; int message (const char* fmt, ...) { va_list ap; if (g_logfile) { va_start (ap, fmt); vfprintf (g_logfile, fmt, ap); va_end (ap); } va_start (ap, fmt); int rc = vfprintf (stdout, fmt, ap); va_end (ap); return rc; } void message_set_logfile (const char* filename) { if (g_logfile) { fclose (g_logfile); g_logfile = NULL; } if (filename) g_logfile = fopen (filename, "w"); }
--- +++ @@ -1,22 +1,52 @@ #include <stdio.h> #include <stdarg.h> +#include <string.h> static FILE* g_logfile = NULL; + +static unsigned char g_lastchar = '\n'; + +#ifdef _WIN32 + #include <windows.h> + static unsigned long g_timestamp; +#else + #include <sys/time.h> + static struct timeval g_timestamp; +#endif int message (const char* fmt, ...) { va_list ap; - + if (g_logfile) { + if (g_lastchar == '\n') { +#ifdef _WIN32 + unsigned long timestamp = GetTickCount () - g_timestamp; + unsigned long sec = timestamp / 1000L, msec = timestamp % 1000L; + fprintf (g_logfile, "[%li.%03li] ", sec, msec); +#else + struct timeval now = {0}, timestamp = {0}; + gettimeofday (&now, NULL); + timersub (&now, &g_timestamp, &timestamp); + fprintf (g_logfile, "[%lli.%06lli] ", (long long)timestamp.tv_sec, (long long)timestamp.tv_usec); +#endif + } + + size_t len = strlen (fmt); + if (len > 0) + g_lastchar = fmt[len - 1]; + else + g_lastchar = 0; + va_start (ap, fmt); vfprintf (g_logfile, fmt, ap); va_end (ap); } - + va_start (ap, fmt); int rc = vfprintf (stdout, fmt, ap); va_end (ap); - + return rc; } @@ -26,7 +56,16 @@ fclose (g_logfile); g_logfile = NULL; } - + if (filename) g_logfile = fopen (filename, "w"); + + if (g_logfile) { + g_lastchar = '\n'; +#ifdef _WIN32 + g_timestamp = GetTickCount (); +#else + gettimeofday (&g_timestamp, NULL); +#endif + } }
Write timestamps to the logfile.
lgpl-2.1
josh-wambua/libdivecomputer,andysan/libdivecomputer,glance-/libdivecomputer,venkateshshukla/libdivecomputer,henrik242/libdivecomputer,Poltsi/libdivecomputer-vms,glance-/libdivecomputer,venkateshshukla/libdivecomputer,andysan/libdivecomputer,henrik242/libdivecomputer,josh-wambua/libdivecomputer
c938a893593fa7ea2e596ec41e186cdfbaee4e58
#if HAVE_CONFIG_H #include "config.h" #endif #include "dl.h" #include "util/macro.h" #include "util/logging.h" #include <stdlib.h> #include <dlfcn.h> #include <string.h> void *dl_dlopen ( const char* path ) { DEBUG(DBG_BDPLUS, "searching for library '%s' ...\n", path); void *result = dlopen(path, RTLD_LAZY); if (!result) { DEBUG(DBG_FILE | DBG_CRIT, "can't open library '%s': %s\n", path, dlerror()); } return result; } void *dl_dlsym ( void* handle, const char* symbol ) { void *result = dlsym(handle, symbol); if (!result) { DEBUG(DBG_FILE | DBG_CRIT, "dlsym(%p, '%s') failed: %s\n", handle, symbol, dlerror()); } return result; } int dl_dlclose ( void* handle ) { return dlclose(handle); }
#if HAVE_CONFIG_H #include "config.h" #endif #include "dl.h" #include "util/macro.h" #include "util/logging.h" #include <stdlib.h> #include <dlfcn.h> #include <string.h> // Note the dlopen takes just the name part. "aacs", internally we // translate to "libaacs.so" "libaacs.dylib" or "aacs.dll". void *dl_dlopen ( const char* name ) { char *path; int len; void *result; #ifdef __APPLE__ len = strlen(name) + 3 + 6 + 1; path = (char *) malloc(len); if (!path) return NULL; snprintf(path, len, "lib%s.dylib", name); #else len = strlen(name) + 3 + 3 + 1; path = (char *) malloc(len); if (!path) return NULL; snprintf(path, len, "lib%s.so", name); #endif DEBUG(DBG_BDPLUS, "searching for library '%s' ...\n", path); result = dlopen(path, RTLD_LAZY); if (!result) { DEBUG(DBG_FILE | DBG_CRIT, "can't open library '%s': %s\n", path, dlerror()); } free(path); return result; } void *dl_dlsym ( void* handle, const char* symbol ) { void *result = dlsym(handle, symbol); if (!result) { DEBUG(DBG_FILE | DBG_CRIT, "dlsym(%p, '%s') failed: %s\n", handle, symbol, dlerror()); } return result; } int dl_dlclose ( void* handle ) { return dlclose(handle); }
--- +++ @@ -10,31 +10,13 @@ #include <dlfcn.h> #include <string.h> -// Note the dlopen takes just the name part. "aacs", internally we -// translate to "libaacs.so" "libaacs.dylib" or "aacs.dll". -void *dl_dlopen ( const char* name ) +void *dl_dlopen ( const char* path ) { - char *path; - int len; - void *result; - -#ifdef __APPLE__ - len = strlen(name) + 3 + 6 + 1; - path = (char *) malloc(len); - if (!path) return NULL; - snprintf(path, len, "lib%s.dylib", name); -#else - len = strlen(name) + 3 + 3 + 1; - path = (char *) malloc(len); - if (!path) return NULL; - snprintf(path, len, "lib%s.so", name); -#endif DEBUG(DBG_BDPLUS, "searching for library '%s' ...\n", path); - result = dlopen(path, RTLD_LAZY); + void *result = dlopen(path, RTLD_LAZY); if (!result) { DEBUG(DBG_FILE | DBG_CRIT, "can't open library '%s': %s\n", path, dlerror()); } - free(path); return result; }
Change dlopening of libs to call libraries with their major version on linux systems
lgpl-2.1
ShiftMediaProject/libaacs,zxlooong/libaacs,mwgoldsmith/aacs,ShiftMediaProject/libaacs,mwgoldsmith/aacs,zxlooong/libaacs,rraptorr/libaacs,rraptorr/libaacs
15b5dd569501f0e4a66d7970238a1a87b0d9c4a7
#include "interface.h" #include "ecg.h" #include "AFE4400.h" SPI_Interface afe4400_spi(spi_c2); ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft); PulseOx spo2 = PulseOx(5,1,4,9,&afe4400_spi,PC8,PA9,PA8,PB7,&tft); void enableSignalAcquisition(void) { spo2.enable(); ecg.enable(); } void connectSignalsToScreen(Screen& s) { s.add(ecg.signalTrace); s.add((ScreenElement*) &spo2); }
#include "interface.h" #include "ecg.h" #include "AFE4400.h" SPI_Interface afe4400_spi(spi_c2); ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft); PulseOx spo2 = PulseOx(6,1,3,3,&afe4400_spi,PC8,PA9,PA8,PB7,&tft); void enableSignalAcquisition(void) { spo2.enable(); ecg.enable(); } void connectSignalsToScreen(Screen& s) { s.add(ecg.signalTrace); s.add((ScreenElement*) &spo2); }
--- +++ @@ -5,7 +5,7 @@ SPI_Interface afe4400_spi(spi_c2); ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft); -PulseOx spo2 = PulseOx(6,1,3,3,&afe4400_spi,PC8,PA9,PA8,PB7,&tft); +PulseOx spo2 = PulseOx(5,1,4,9,&afe4400_spi,PC8,PA9,PA8,PB7,&tft); void enableSignalAcquisition(void) { spo2.enable();
Adjust display position for pulse ox
mit
ReeceStevens/freepulse,ReeceStevens/freepulse,ReeceStevens/freepulse
0c2596f9c2142d8ba52065132a2b59745cf41fb2
#ifndef JOINABLE_IMPL #define JOINABLE_IMPL #include "joinable_types.h" #include "types/MediaObjectImpl.h" using ::com::kurento::kms::api::Joinable; using ::com::kurento::kms::api::Direction; using ::com::kurento::kms::api::StreamType; using ::com::kurento::kms::api::MediaSession; namespace com { namespace kurento { namespace kms { class JoinableImpl : public Joinable, public virtual MediaObjectImpl { public: JoinableImpl(MediaSession &session); ~JoinableImpl() throw() {}; void getStreams(std::vector<StreamType::type> &_return); void join(const JoinableImpl& to, const Direction::type direction); void unjoin(const JoinableImpl& to); void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction); void unjoin(const JoinableImpl& to, const StreamType::type stream); void getJoinees(std::vector<Joinable> &_return); void getDirectionJoiness(std::vector<Joinable> &_return, const Direction::type direction); void getJoinees(std::vector<Joinable> &_return, const StreamType::type stream); void getDirectionJoiness(std::vector<Joinable> &_return, const StreamType::type stream, const Direction::type direction); }; }}} // com::kurento::kms #endif /* JOINABLE_IMPL */
#ifndef JOINABLE_IMPL #define JOINABLE_IMPL #include "joinable_types.h" #include "types/MediaObjectImpl.h" using ::com::kurento::kms::api::Joinable; using ::com::kurento::kms::api::Direction; using ::com::kurento::kms::api::StreamType; using ::com::kurento::kms::api::MediaSession; namespace com { namespace kurento { namespace kms { class JoinableImpl : public Joinable, public virtual MediaObjectImpl { public: JoinableImpl(MediaSession &session); ~JoinableImpl() throw() {}; std::vector<StreamType::type> getStreams(const Joinable& joinable); void join(const JoinableImpl& to, const Direction::type direction); void unjoin(const JoinableImpl& to); void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction); void unjoin(const JoinableImpl& to, const StreamType::type stream); std::vector<Joinable> &getJoinees(); std::vector<Joinable> &getDirectionJoiness(const Direction::type direction); std::vector<Joinable> &getJoinees(const StreamType::type stream); std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction); }; }}} // com::kurento::kms #endif /* JOINABLE_IMPL */
--- +++ @@ -16,7 +16,7 @@ JoinableImpl(MediaSession &session); ~JoinableImpl() throw() {}; - std::vector<StreamType::type> getStreams(const Joinable& joinable); + void getStreams(std::vector<StreamType::type> &_return); void join(const JoinableImpl& to, const Direction::type direction); void unjoin(const JoinableImpl& to); @@ -24,11 +24,11 @@ void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction); void unjoin(const JoinableImpl& to, const StreamType::type stream); - std::vector<Joinable> &getJoinees(); - std::vector<Joinable> &getDirectionJoiness(const Direction::type direction); + void getJoinees(std::vector<Joinable> &_return); + void getDirectionJoiness(std::vector<Joinable> &_return, const Direction::type direction); - std::vector<Joinable> &getJoinees(const StreamType::type stream); - std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction); + void getJoinees(std::vector<Joinable> &_return, const StreamType::type stream); + void getDirectionJoiness(std::vector<Joinable> &_return, const StreamType::type stream, const Direction::type direction); }; }}} // com::kurento::kms
Make jonable methods to return vectors via reference
lgpl-2.1
mparis/kurento-media-server,Kurento/kurento-media-server,todotobe1/kurento-media-server,TribeMedia/kurento-media-server,lulufei/kurento-media-server,Kurento/kurento-media-server,shelsonjava/kurento-media-server,todotobe1/kurento-media-server,mparis/kurento-media-server,lulufei/kurento-media-server,shelsonjava/kurento-media-server,TribeMedia/kurento-media-server
633f65f6eed79b6a13d8fe76cfdb0ac19116e118