Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add support for i386 in cc1
#define TINT long long #define TUINT unsigned long long #define TFLOAT double #define L_SCHAR L_INT8 #define L_UCHAR L_UINT8 #define L_CHAR L_INT8 #define L_SHORT L_INT16 #define L_USHORT L_UINT16 #define L_INT L_INT32 #define L_UINT L_UINT32 #define L_LONG L_INT32 #define L_ULONG L_UINT32 #define L_LLONG L_INT64 #define L_ULLONG L_UINT64 #define L_BOOL 'B' #define L_FLOAT 'J' #define L_DOUBLE 'D' #define L_LDOUBLE 'H' #define L_ENUM L_INT
Fix error in example code
#include <cgreen/cgreen.h> #include <cgreen/mocks.h> void convert_to_uppercase(char *converted_string, const char *original_string) { mock(converted_string, original_string); } Ensure(setting_content_of_out_parameter) { expect(convert_to_uppercase, when(original_string, is_equal_to_string("upper case")), will_set_content_of_parameter(&converted_string, "UPPER CASE", 11)); }
#include <cgreen/cgreen.h> #include <cgreen/mocks.h> void convert_to_uppercase(char *converted_string, const char *original_string) { mock(converted_string, original_string); } Ensure(setting_content_of_out_parameter) { expect(convert_to_uppercase, when(original_string, is_equal_to_string("upper case")), will_set_content_of_parameter(converted_string, "UPPER CASE", 11)); }
Add DLL export attribute to |hir::InstructionVisitor| to use it in compiler.
// Copyright 2014-2015 Project Vogue. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ELANG_HIR_INSTRUCTION_VISITOR_H_ #define ELANG_HIR_INSTRUCTION_VISITOR_H_ #include "base/macros.h" #include "elang/hir/instructions_forward.h" namespace elang { namespace hir { ////////////////////////////////////////////////////////////////////// // // InstructionVisitor // class InstructionVisitor { public: #define V(Name, ...) virtual void Visit##Name(Name##Instruction* instruction); FOR_EACH_HIR_INSTRUCTION(V) #undef V protected: InstructionVisitor(); virtual ~InstructionVisitor(); virtual void DoDefaultVisit(Instruction* instruction); private: DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); }; } // namespace hir } // namespace elang #endif // ELANG_HIR_INSTRUCTION_VISITOR_H_
// Copyright 2014-2015 Project Vogue. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ELANG_HIR_INSTRUCTION_VISITOR_H_ #define ELANG_HIR_INSTRUCTION_VISITOR_H_ #include "base/macros.h" #include "elang/hir/hir_export.h" #include "elang/hir/instructions_forward.h" namespace elang { namespace hir { ////////////////////////////////////////////////////////////////////// // // InstructionVisitor // class ELANG_HIR_EXPORT InstructionVisitor { public: virtual ~InstructionVisitor(); #define V(Name, ...) virtual void Visit##Name(Name##Instruction* instruction); FOR_EACH_HIR_INSTRUCTION(V) #undef V protected: InstructionVisitor(); virtual void DoDefaultVisit(Instruction* instruction); private: DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); }; } // namespace hir } // namespace elang #endif // ELANG_HIR_INSTRUCTION_VISITOR_H_
Fix GCC_WARN_ABOUT_MISSING_NEWLINE in header file
// C SUGAR #define unless(condition) if(!(condition)) // OBJC SUGAR #import "NSNumber+ObjectiveSugar.h" #import "NSArray+ObjectiveSugar.h" #import "NSMutableArray+ObjectiveSugar.h" #import "NSDictionary+ObjectiveSugar.h" #import "NSSet+ObjectiveSugar.h" #import "NSString+ObjectiveSugar.h"
// C SUGAR #define unless(condition) if(!(condition)) // OBJC SUGAR #import "NSNumber+ObjectiveSugar.h" #import "NSArray+ObjectiveSugar.h" #import "NSMutableArray+ObjectiveSugar.h" #import "NSDictionary+ObjectiveSugar.h" #import "NSSet+ObjectiveSugar.h" #import "NSString+ObjectiveSugar.h"
Fix 30/03 by adding threadid and threadflag analyses
// PARAM: --sets solver td3 --enable ana.int.interval --enable exp.partition-arrays.enabled --enable exp.fast_global_inits --set ana.activated "['base','expRelation','mallocWrapper']" // Without fast_global_inits this takes >150s, when it is enabled < 0.1s int global_array[50][500][20]; int main(void) { for(int i =0; i < 50; i++) { assert(global_array[i][42][7] == 0); } }
// PARAM: --sets solver td3 --enable ana.int.interval --enable exp.partition-arrays.enabled --enable exp.fast_global_inits --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper']" // Without fast_global_inits this takes >150s, when it is enabled < 0.1s int global_array[50][500][20]; int main(void) { for(int i =0; i < 50; i++) { assert(global_array[i][42][7] == 0); } }
Remove absolute path form include test.
// RUN: %clang_cc1 -verify -E -frewrite-includes %s -o - | FileCheck -strict-whitespace %s #include "foobar.h" // expected-error {{'foobar.h' file not found}} // CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "foobar.h" // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 4 "/usr/local/google/home/blaikie/Development/llvm/src/tools/clang/test/Frontend/rewrite-includes-missing.c" 2{{$}}
// RUN: %clang_cc1 -verify -E -frewrite-includes %s -o - | FileCheck -strict-whitespace %s #include "foobar.h" // expected-error {{'foobar.h' file not found}} // CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "foobar.h" // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*}}rewrite-includes-missing.c" 2{{$}}
Add documentation to the SessionContext
#ifndef __MESSAGES__MESSAGE_CONTEXT_H__ #define __MESSAGES__MESSAGE_CONTEXT_H__ #include "request_message.h" #include "reply_message.h" #include "backend.h" namespace traffic { class SessionContext : public RequestVisitor { private: std::unique_ptr<ReplyMessage> _message; DataProvider::ptr_t _data_provider; protected: void visit(StatisticRequest const &request); void visit(SummaryRequest const &request); void visit(ErrorRequest const &request); public: bool process_data(void const *data, size_t const size); void encode_result(std::string &out); SessionContext(DataProvider::ptr_t provider); virtual ~SessionContext() { } }; } #endif
#ifndef __MESSAGES__MESSAGE_CONTEXT_H__ #define __MESSAGES__MESSAGE_CONTEXT_H__ #include "request_message.h" #include "reply_message.h" #include "backend.h" namespace traffic { /** * \brief This is the context for a request/reply session. * * This context is allocated for each request to process the data. It represents * the glue between the server, the messages and the backend. It uses the * RequestMessage interface to parse data to a request, implements the * RequestVisitor interface to select the correct backend method to query and * provide a interface to serialize the result to the wire format. */ class SessionContext : public RequestVisitor { private: std::unique_ptr<ReplyMessage> _message; DataProvider::ptr_t _data_provider; protected: void visit(StatisticRequest const &request); void visit(SummaryRequest const &request); void visit(ErrorRequest const &request); public: /** * \brief Process raw request data in wire format. * * This is the entry point for the context to process its request. It * gets the wire data of the request, transforms it to a request * instance and give it to the backend. The result from the backend will * be stored internally. * * \param data The pointer to the raw request data. * \param size The size of the request data. * \return false in case of error. */ bool process_data(void const *data, size_t const size); /** * \brief Encode the current reply data to the wire format. * * This serialize the current state (result from the backend or error * message) to the reply wire format and put the result into the given * string reference. * * \param out The string to write the result to. */ void encode_result(std::string &out); /** * \brief Creat a session context. * * This is done for every incomming data packet. * * \param provider The DataProvider to use for this request. */ SessionContext(DataProvider::ptr_t provider); virtual ~SessionContext() { } }; } #endif
Fix term_print_dec Would print a leading 0 if number wasn't a power of 10
// Print formatted output to the VGA terminal #include "vga.h" #include <stdarg.h> void term_print_dec(int x) { int divisor = 1; for (; divisor < x; divisor *= 10) ; for (; divisor > 0; divisor /= 10) term_putchar(((x / divisor) % 10) + '0'); } void term_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); for (int i = 0; fmt[i] != '\0'; i++) { if (fmt[i] != '%') { term_putchar(fmt[i]); } else { char fmt_type = fmt[++i]; switch (fmt_type) { case '%': term_putchar('%'); break; case 'd': term_print_dec(va_arg(args, int)); break; case 's': term_putsn(va_arg(args, char*)); break; case 'c': term_putchar(va_arg(args, int)); break; default: break; } } } va_end(args); }
// Print formatted output to the VGA terminal #include "vga.h" #include <stdarg.h> static void term_print_dec(int x) { int divisor = 1; for (; divisor <= x; divisor *= 10) ; divisor /= 10; for (; divisor > 0; divisor /= 10) term_putchar(((x / divisor) % 10) + '0'); } void term_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); for (int i = 0; fmt[i] != '\0'; i++) { if (fmt[i] != '%') { term_putchar(fmt[i]); } else { char fmt_type = fmt[++i]; switch (fmt_type) { case '%': term_putchar('%'); break; case 'd': term_print_dec(va_arg(args, int)); break; case 's': term_putsn(va_arg(args, char*)); break; case 'c': term_putchar(va_arg(args, int)); break; default: break; } } } va_end(args); }
Fix compile breakage for IBM/AMCC 4xx arch/ppc platforms
#include <linux/module.h> #include <asm/ocp.h> struct ocp_sys_info_data ocp_sys_info = { .opb_bus_freq = 50000000, /* OPB Bus Frequency (Hz) */ .ebc_bus_freq = 33333333, /* EBC Bus Frequency (Hz) */ }; EXPORT_SYMBOL(ocp_sys_info);
#include <linux/module.h> #include <asm/ibm4xx.h> #include <asm/ocp.h> struct ocp_sys_info_data ocp_sys_info = { .opb_bus_freq = 50000000, /* OPB Bus Frequency (Hz) */ .ebc_bus_freq = 33333333, /* EBC Bus Frequency (Hz) */ }; EXPORT_SYMBOL(ocp_sys_info);
Fix a problem with the RUN line of one of the PCH tests
// Test this without pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - && // Test with pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -o %t %S/va_arg.h && // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); }
// Test this without pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - && // Test with pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h && // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); }
Fix header file usage so that NULL is defined. NULL is needed by unicodedata_db.h.
/* ------------------------------------------------------------------------ unicodedatabase -- The Unicode 3.0 data base. Data was extracted from the Unicode 3.0 UnicodeData.txt file. Written by Marc-Andre Lemburg (mal@lemburg.com). Rewritten for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ #include <stdlib.h> #include "unicodedatabase.h" /* read the actual data from a separate file! */ #include "unicodedata_db.h" const _PyUnicode_DatabaseRecord * _PyUnicode_Database_GetRecord(int code) { int index; if (code < 0 || code >= 65536) index = 0; else { index = index1[(code>>SHIFT)]; index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))]; } return &_PyUnicode_Database_Records[index]; } const char * _PyUnicode_Database_GetDecomposition(int code) { int index; if (code < 0 || code >= 65536) index = 0; else { index = decomp_index1[(code>>DECOMP_SHIFT)]; index = decomp_index2[(index<<DECOMP_SHIFT)+ (code&((1<<DECOMP_SHIFT)-1))]; } return decomp_data[index]; }
/* ------------------------------------------------------------------------ unicodedatabase -- The Unicode 3.0 data base. Data was extracted from the Unicode 3.0 UnicodeData.txt file. Written by Marc-Andre Lemburg (mal@lemburg.com). Rewritten for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ #include "Python.h" #include "unicodedatabase.h" /* read the actual data from a separate file! */ #include "unicodedata_db.h" const _PyUnicode_DatabaseRecord * _PyUnicode_Database_GetRecord(int code) { int index; if (code < 0 || code >= 65536) index = 0; else { index = index1[(code>>SHIFT)]; index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))]; } return &_PyUnicode_Database_Records[index]; } const char * _PyUnicode_Database_GetDecomposition(int code) { int index; if (code < 0 || code >= 65536) index = 0; else { index = decomp_index1[(code>>DECOMP_SHIFT)]; index = decomp_index2[(index<<DECOMP_SHIFT)+ (code&((1<<DECOMP_SHIFT)-1))]; } return decomp_data[index]; }
Fix up cpu to node mapping in sysfs.
#include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/init.h> #include <linux/percpu.h> #include <linux/node.h> #include <linux/nodemask.h> static DEFINE_PER_CPU(struct cpu, cpu_devices); static int __init topology_init(void) { int i, ret; #ifdef CONFIG_NEED_MULTIPLE_NODES for_each_online_node(i) register_one_node(i); #endif for_each_present_cpu(i) { ret = register_cpu(&per_cpu(cpu_devices, i), i); if (unlikely(ret)) printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n", __FUNCTION__, i, ret); } return 0; } subsys_initcall(topology_init);
/* * arch/sh/kernel/topology.c * * Copyright (C) 2007 Paul Mundt * * 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. */ #include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/init.h> #include <linux/percpu.h> #include <linux/node.h> #include <linux/nodemask.h> static DEFINE_PER_CPU(struct cpu, cpu_devices); static int __init topology_init(void) { int i, ret; #ifdef CONFIG_NEED_MULTIPLE_NODES for_each_online_node(i) register_one_node(i); #endif for_each_present_cpu(i) { ret = register_cpu(&per_cpu(cpu_devices, i), i); if (unlikely(ret)) printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n", __FUNCTION__, i, ret); } #if defined(CONFIG_NUMA) && !defined(CONFIG_SMP) /* * In the UP case, make sure the CPU association is still * registered under each node. Without this, sysfs fails * to make the connection between nodes other than node0 * and cpu0. */ for_each_online_node(i) if (i != numa_node_id()) register_cpu_under_node(raw_smp_processor_id(), i); #endif return 0; } subsys_initcall(topology_init);
Remove obsolete defines from Android CDM file.
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WIDEVINE_CDM_VERSION_H_ #define WIDEVINE_CDM_VERSION_H_ #include "third_party/widevine/cdm/widevine_cdm_common.h" // Indicates that the Widevine CDM is available. #define WIDEVINE_CDM_AVAILABLE // Indicates that AVC1 decoding is available for ISO BMFF CENC. #define WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE // Indicates that AAC decoding is available for ISO BMFF CENC. #define WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE #endif // WIDEVINE_CDM_VERSION_H_
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WIDEVINE_CDM_VERSION_H_ #define WIDEVINE_CDM_VERSION_H_ #include "third_party/widevine/cdm/widevine_cdm_common.h" // Indicates that the Widevine CDM is available. #define WIDEVINE_CDM_AVAILABLE #endif // WIDEVINE_CDM_VERSION_H_
Add a consumer that just counts samples.
// --------------------------------------------------------------------- // // Copyright (C) 2019 by the SampleFlow authors. // // This file is part of the SampleFlow library. // // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // Public License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // The full text of the license can be found in the file LICENSE.md at // the top level directory of deal.II. // // --------------------------------------------------------------------- #ifndef SAMPLEFLOW_CONSUMERS_COUNT_SAMPLES_H #define SAMPLEFLOW_CONSUMERS_COUNT_SAMPLES_H #include <sampleflow/consumer.h> #include <mutex> namespace SampleFlow { namespace Consumers { /** * A Consumer class that simply counts how many samples it has received. * * * ### Threading model ### * * The implementation of this class is thread-safe, i.e., its * consume() member function can be called concurrently and from multiple * threads. * * * @tparam InputType The C++ type used for the samples $x_k$. */ template <typename InputType> class CountSamples : public Consumer<InputType> { public: /** * The type of the information generated by this class, i.e., the type * of the object returned by get(). This is just the type used to store * the index of samples. */ using value_type = types::sample_index; /** * Constructor. */ CountSamples (); /** * Process one sample by just incrementing the sample counter. * * @param[in] sample The sample to process. Since this class does * not care about the actual value of the sample, it simply * ignores its value. * @param[in] aux_data Auxiliary data about this sample. The current * class does not know what to do with any such data and consequently * simply ignores it. */ virtual void consume (InputType sample, AuxiliaryData aux_data) override; /** * A function that returns the number of samples received so far. * * @return The computed mean value. */ value_type get () const; private: /** * A mutex used to lock access to all member variables when running * on multiple threads. */ mutable std::mutex mutex; /** * The number of samples received so far. */ types::sample_index n_samples; }; template <typename InputType> CountSamples<InputType>:: CountSamples () : n_samples (0) {} template <typename InputType> void CountSamples<InputType>:: consume (InputType /*sample*/, AuxiliaryData /*aux_data*/) { std::lock_guard<std::mutex> lock(mutex); ++n_samples; } template <typename InputType> typename CountSamples<InputType>::value_type CountSamples<InputType>:: get () const { std::lock_guard<std::mutex> lock(mutex); return n_samples; } } } #endif
Add documentation for the Job class
/****************************************************************************** This source file is part of the MoleQueue project. Copyright 2011 Kitware, Inc. This source code is released under the New BSD License, (the "License"). Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ******************************************************************************/ #ifndef JOB_H #define JOB_H #include <QObject> namespace MoleQueue { class Queue; class Program; class Job : public QObject { Q_OBJECT public: explicit Job(const Program *program); ~Job(); void setName(const QString &name); QString name() const; void setTitle(const QString &title); QString title() const; const Program* program() const; const Queue* queue() const; private: QString m_name; QString m_title; const Program* m_program; }; } // end MoleQueue namespace #endif // JOB_H
/****************************************************************************** This source file is part of the MoleQueue project. Copyright 2011 Kitware, Inc. This source code is released under the New BSD License, (the "License"). Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ******************************************************************************/ #ifndef JOB_H #define JOB_H #include <QObject> namespace MoleQueue { class Queue; class Program; /** * Class to represent an execution of a Program. */ class Job : public QObject { Q_OBJECT public: /** Creates a new job. */ explicit Job(const Program *program); /* Destroys the job object. */ ~Job(); /** Set the name of the job to \p name. */ void setName(const QString &name); /** Returns the name of the job. */ QString name() const; /** Sets the title of the job to \p title. */ void setTitle(const QString &title); /** Returns the title for the job. */ QString title() const; /** Returns the program that the job is a type of. */ const Program* program() const; /** Returns the queue that the job is a member of. */ const Queue* queue() const; private: /** The name of the job. */ QString m_name; /** The title of the job. */ QString m_title; /** The program that the job is a type of. */ const Program* m_program; }; } // end MoleQueue namespace #endif // JOB_H
Fix componene debug build failure in chromium
/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ // This file is not part of the public Skia API. #ifndef SkSpinlock_DEFINED #define SkSpinlock_DEFINED #include "SkAtomics.h" #define SK_DECLARE_STATIC_SPINLOCK(name) namespace {} static SkPODSpinlock name // This class has no constructor and must be zero-initialized (the macro above does this). class SkPODSpinlock { public: void acquire() { // To act as a mutex, we need an acquire barrier if we take the lock. if (sk_atomic_exchange(&fLocked, true, sk_memory_order_acquire)) { // Lock was contended. Fall back to an out-of-line spin loop. this->contendedAcquire(); } } void release() { // To act as a mutex, we need a release barrier. sk_atomic_store(&fLocked, false, sk_memory_order_release); } private: void contendedAcquire(); bool fLocked; }; // For non-global-static use cases, this is normally what you want. class SkSpinlock : public SkPODSpinlock { public: SkSpinlock() { this->release(); } }; #endif//SkSpinlock_DEFINED
/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ // This file is not part of the public Skia API. #ifndef SkSpinlock_DEFINED #define SkSpinlock_DEFINED #include "SkAtomics.h" #define SK_DECLARE_STATIC_SPINLOCK(name) namespace {} static SkPODSpinlock name // This class has no constructor and must be zero-initialized (the macro above does this). class SK_API SkPODSpinlock { public: void acquire() { // To act as a mutex, we need an acquire barrier if we take the lock. if (sk_atomic_exchange(&fLocked, true, sk_memory_order_acquire)) { // Lock was contended. Fall back to an out-of-line spin loop. this->contendedAcquire(); } } void release() { // To act as a mutex, we need a release barrier. sk_atomic_store(&fLocked, false, sk_memory_order_release); } private: void contendedAcquire(); bool fLocked; }; // For non-global-static use cases, this is normally what you want. class SkSpinlock : public SkPODSpinlock { public: SkSpinlock() { this->release(); } }; #endif//SkSpinlock_DEFINED
Add intermediate TextureVideoFrame typedef for Chromium
/* * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H #define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H #include "webrtc/common_video/interface/i420_video_frame.h" // TODO(magjed): Remove this when all external dependencies are updated. namespace webrtc { typedef I420VideoFrame TextureVideoFrame; } // namespace webrtc #endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
Declare struct Center's member variables
#ifndef STRUCTURE_H #define STRUCTURE_H #include <vector> #include "Math/Vector2.h" enum class BiomeType { Snow, Tundra, Mountain, Taiga, Shrubland, TemprateDesert, TemprateRainForest, TemprateDeciduousForest, Grassland, TropicalRainForest, TropicalSeasonalForest, SubtropicalDesert, Ocean, Lake, Beach, Size, None }; // Forward Declaration struct Edge; struct Corner; #endif
#ifndef STRUCTURE_H #define STRUCTURE_H #include <vector> #include "Math/Vector2.h" enum class BiomeType { Snow, Tundra, Mountain, Taiga, Shrubland, TemprateDesert, TemprateRainForest, TemprateDeciduousForest, Grassland, TropicalRainForest, TropicalSeasonalForest, SubtropicalDesert, Ocean, Lake, Beach, Size, None }; // Forward Declaration struct Edge; struct Corner; struct Center { unsigned int m_index; Vector2 m_positon; bool m_water; bool m_ocean; bool m_coast; bool m_border; BiomeType m_biome; double m_elevation; double m_moisture; std::vector<Edge*> m_edges; std::vector<Corner*> m_corners; std::vector<Center*> m_centers; using CenterIterator = std::vector<Center*>::iterator; }; #endif
Fix Lth_Assert not using stderr
//----------------------------------------------------------------------------- // // Copyright © 2016 Project Golan // // See "LICENSE" for more information. // //----------------------------------------------------------------------------- // // Assertions. // //----------------------------------------------------------------------------- #ifndef lithos3__Lth_assert_h #define lithos3__Lth_assert_h #include <stdio.h> #ifdef NDEBUG #define Lth_assert(expression) ((void)0) #else #define Lth_assert(expression) \ if(!(expression)) \ printf("[lithos3] Assertion failed in %s (%s:%i): %s\n", \ __func__, __FILE__, __LINE__, #expression); \ else \ ((void)0) #endif #endif//lithos3__Lth_assert_h
//----------------------------------------------------------------------------- // // Copyright © 2016 Project Golan // // See "LICENSE" for more information. // //----------------------------------------------------------------------------- // // Assertions. // //----------------------------------------------------------------------------- #ifndef lithos3__Lth_assert_h #define lithos3__Lth_assert_h #include <stdio.h> #ifdef NDEBUG #define Lth_assert(expression) ((void)0) #else #define Lth_assert(expression) \ if(!(expression)) \ fprintf(stderr, "[lithos3] Assertion failed in %s (%s:%i): %s\n", \ __func__, __FILE__, __LINE__, #expression); \ else \ ((void)0) #endif #endif//lithos3__Lth_assert_h
Update version number to 8.03.01-k9.
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.03.01-k8" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 3 #define QLA_DRIVER_PATCH_VER 1 #define QLA_DRIVER_BETA_VER 0
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ /* * Driver version */ #define QLA2XXX_VERSION "8.03.01-k9" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 3 #define QLA_DRIVER_PATCH_VER 1 #define QLA_DRIVER_BETA_VER 0
Add fontBoundingDescent and Ascent and add constructor with them
#ifndef _TEXTMETRICS_H_ #define _TEXTMETRICS_H_ namespace canvas { class TextMetrics { public: TextMetrics() : width(0) { } TextMetrics(float _width) : width(_width) { } float width; #if 0 float ideographicBaseline; float alphabeticBaseline; float hangingBaseline; float emHeightDescent; float emHeightAscent; float actualBoundingBoxDescent; float actualBoundingBoxAscent; float fontBoundingBoxDescent; float fontBoundingBoxAscent; float actualBoundingBoxRight; float actualBoundingBoxLeft; #endif }; }; #endif
#ifndef _TEXTMETRICS_H_ #define _TEXTMETRICS_H_ namespace canvas { class TextMetrics { public: TextMetrics() : width(0) { } TextMetrics(float _width) : width(_width) { } TextMetrics(float _width, float fontBoundingBoxDescent, float _fontBoundingBoxAscent) : width(_width) fontBoundingBoxDescent(_fontBoundingBoxDescent) fontBoundingBoxAscent(_fontBoundingBoxAscent) { } float width; float fontBoundingBoxDescent; float fontBoundingBoxAscent; #if 0 float ideographicBaseline; float alphabeticBaseline; float hangingBaseline; float emHeightDescent; float emHeightAscent; float actualBoundingBoxDescent; float actualBoundingBoxAscent; float actualBoundingBoxRight; float actualBoundingBoxLeft; #endif }; }; #endif
Add CR_ prefix to header defines
#ifndef IPC_NS_H_ #define IPC_NS_H_ #include "crtools.h" extern void show_ipc_ns(int fd); extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset); extern int prepare_ipc_ns(int pid); #endif /* IPC_NS_H_ */
#ifndef CR_IPC_NS_H_ #define CR_IPC_NS_H_ #include "crtools.h" extern void show_ipc_ns(int fd); extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset); extern int prepare_ipc_ns(int pid); #endif /* CR_IPC_NS_H_ */
Fix path in tails_files C wrapper
#include <unistd.h> int main(int argc, char* argv) { setuid(0); // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery execl("/usr/bin/python2.7", "python2.7", "/home/vagrant/tails_files/test.py", (char*)NULL); return 0; }
#include <unistd.h> int main(int argc, char* argv) { setuid(0); // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery execl("/usr/bin/python2.7", "python2.7", "/home/amnesia/Persistent/.securedrop/securedrop_init.py", (char*)NULL); return 0; }
Fix types in CRC16 function
#include "modlib.h" uint16_t MODBUSSwapEndian( uint16_t Data ) { //Change big-endian to little-endian and vice versa uint8_t Swap; //Create 2 bytes long union union Conversion { uint16_t Data; uint8_t Bytes[2]; } Conversion; //Swap bytes Conversion.Data = Data; Swap = Conversion.Bytes[0]; Conversion.Bytes[0] = Conversion.Bytes[1]; Conversion.Bytes[1] = Swap; return Conversion.Data; } uint16_t MODBUSCRC16( uint16_t *Data, uint16_t Length ) { //Calculate CRC16 checksum using given data and length uint16_t CRC = 0xFFFF; uint16_t i; uint8_t j; for ( i = 0; i < Length; i++ ) { CRC ^= Data[i]; //XOR current data byte with CRC value for ( j = 8; j != 0; j-- ) { //For each bit //Is least-significant-bit is set? if ( ( CRC & 0x0001 ) != 0 ) { CRC >>= 1; //Shift to right and xor CRC ^= 0xA001; } else CRC >>= 1; } } return CRC; }
#include "modlib.h" uint16_t MODBUSSwapEndian( uint16_t Data ) { //Change big-endian to little-endian and vice versa uint8_t Swap; //Create 2 bytes long union union Conversion { uint16_t Data; uint8_t Bytes[2]; } Conversion; //Swap bytes Conversion.Data = Data; Swap = Conversion.Bytes[0]; Conversion.Bytes[0] = Conversion.Bytes[1]; Conversion.Bytes[1] = Swap; return Conversion.Data; } uint16_t MODBUSCRC16( uint8_t *Data, uint16_t Length ) { //Calculate CRC16 checksum using given data and length uint16_t CRC = 0xFFFF; uint16_t i; uint8_t j; for ( i = 0; i < Length; i++ ) { CRC ^= Data[i]; //XOR current data byte with CRC value for ( j = 8; j != 0; j-- ) { //For each bit //Is least-significant-bit is set? if ( ( CRC & 0x0001 ) != 0 ) { CRC >>= 1; //Shift to right and xor CRC ^= 0xA001; } else CRC >>= 1; } } return CRC; }
Exit with error on missing behavior.
#ifndef VAST_ACTOR_H #define VAST_ACTOR_H #include <cppa/event_based_actor.hpp> #include "vast/logger.h" namespace vast { namespace exit { constexpr uint32_t done = cppa::exit_reason::user_defined; constexpr uint32_t stop = cppa::exit_reason::user_defined + 1; constexpr uint32_t error = cppa::exit_reason::user_defined + 2; } // namespace exit /// An actor enhanced in template <typename Derived> class actor : public cppa::event_based_actor { public: /// Implements `cppa::event_based_actor::init`. virtual void init() override { VAST_LOG_ACTOR_VERBOSE(derived()->description(), "spawned"); derived()->act(); if (! has_behavior()) { VAST_LOG_ACTOR_ERROR(derived()->description(), "act() did not set a behavior, terminating"); quit(); } } /// Overrides `event_based_actor::on_exit`. virtual void on_exit() override { VAST_LOG_ACTOR_VERBOSE(derived()->description(), "terminated"); } private: Derived const* derived() const { return static_cast<Derived const*>(this); } Derived* derived() { return static_cast<Derived*>(this); } }; } // namespace vast #endif
#ifndef VAST_ACTOR_H #define VAST_ACTOR_H #include <cppa/event_based_actor.hpp> #include "vast/logger.h" namespace vast { namespace exit { constexpr uint32_t done = cppa::exit_reason::user_defined; constexpr uint32_t stop = cppa::exit_reason::user_defined + 1; constexpr uint32_t error = cppa::exit_reason::user_defined + 2; } // namespace exit /// An actor enhanced in template <typename Derived> class actor : public cppa::event_based_actor { public: /// Implements `cppa::event_based_actor::init`. virtual void init() override { VAST_LOG_ACTOR_VERBOSE(derived()->description(), "spawned"); derived()->act(); if (! has_behavior()) { VAST_LOG_ACTOR_ERROR(derived()->description(), "act() did not set a behavior, terminating"); quit(exit::error); } } /// Overrides `event_based_actor::on_exit`. virtual void on_exit() override { VAST_LOG_ACTOR_VERBOSE(derived()->description(), "terminated"); } private: Derived const* derived() const { return static_cast<Derived const*>(this); } Derived* derived() { return static_cast<Derived*>(this); } }; } // namespace vast #endif
Add function to read peek rss usage.
#ifdef ENABLE_STATS #include <stdio.h> #include <sys/resource.h> static size_t stats_peek_rss() { struct rusage rusage; getrusage( RUSAGE_SELF, &rusage ); return (size_t) (rusage.ru_maxrss * 1024L); } __attribute__((destructor)) void _print_stats(void) { size_t rss = stats_peek_rss(); printf("Maximum RSS: %ld KB\n", rss / 1024L); } #endif
Add WiFiNINA, Arduino MKR WiFi 1010 support
/** * @file BlynkSimpleWiFiNINA.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2018 Volodymyr Shymanskyy * @date Sep 2018 * @brief * */ #ifndef BlynkSimpleWiFiNINA_h #define BlynkSimpleWiFiNINA_h #ifndef BLYNK_INFO_CONNECTION #define BLYNK_INFO_CONNECTION "WiFiNINA" #endif #define BLYNK_SEND_ATOMIC //#define BLYNK_USE_SSL #include <WiFiNINA.h> #include <Adapters/BlynkWiFiCommon.h> //static WiFiSSLClient _blynkWifiClient; static WiFiClient _blynkWifiClient; static BlynkArduinoClient _blynkTransport(_blynkWifiClient); BlynkWifiCommon Blynk(_blynkTransport); #include <BlynkWidgets.h> #endif
Add third_party/ prefix to ppapi include for checkdeps.
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ #define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ #include "ppapi/c/pp_var.h" #define PPB_PRIVATE_INTERFACE "PPB_Private;1" typedef enum _ppb_ResourceString { PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0, } PP_ResourceString; typedef struct _ppb_Private { // Returns a localized string. PP_Var (*GetLocalizedString)(PP_ResourceString string_id); } PPB_Private; #endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ #define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ #include "third_party/ppapi/c/pp_var.h" #define PPB_PRIVATE_INTERFACE "PPB_Private;1" typedef enum _ppb_ResourceString { PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0, } PP_ResourceString; typedef struct _ppb_Private { // Returns a localized string. PP_Var (*GetLocalizedString)(PP_ResourceString string_id); } PPB_Private; #endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_
Fix bad fileformat (was DOS without a final line terminator)
#ifndef QXTFILTERDIALOG_P_H_INCLUDED #define QXTFILTERDIALOG_P_H_INCLUDED #include <QObject> #include <QModelIndex> #include <QRegExp> #include <QPointer> #include "qxtpimpl.h" class QxtFilterDialog; class QAbstractItemModel; class QTreeView; class QSortFilterProxyModel; class QLineEdit; class QCheckBox; class QComboBox; class QxtFilterDialogPrivate : public QObject, public QxtPrivate<QxtFilterDialog> { Q_OBJECT public: QxtFilterDialogPrivate(); QXT_DECLARE_PUBLIC(QxtFilterDialog); /*widgets*/ QCheckBox * matchCaseOption; QCheckBox * filterModeOption; QComboBox * filterMode; QTreeView * listingTreeView; QLineEdit * lineEditFilter; /*models*/ QPointer<QAbstractItemModel> model; QSortFilterProxyModel* proxyModel; /*properties*/ int lookupColumn; int lookupRole; QRegExp::PatternSyntax syntax; Qt::CaseSensitivity caseSensitivity; /*result*/ QModelIndex selectedIndex; /*member functions*/ void updateFilterPattern(); public slots: void createRegExpPattern(const QString &rawText); void filterModeOptionStateChanged(const int state); void matchCaseOptionStateChanged(const int state); void filterModeChoosen(int index); }; #endif
#ifndef QXTFILTERDIALOG_P_H_INCLUDED #define QXTFILTERDIALOG_P_H_INCLUDED #include <QObject> #include <QModelIndex> #include <QRegExp> #include <QPointer> #include "qxtpimpl.h" class QxtFilterDialog; class QAbstractItemModel; class QTreeView; class QSortFilterProxyModel; class QLineEdit; class QCheckBox; class QComboBox; class QxtFilterDialogPrivate : public QObject, public QxtPrivate<QxtFilterDialog> { Q_OBJECT public: QxtFilterDialogPrivate(); QXT_DECLARE_PUBLIC(QxtFilterDialog); /*widgets*/ QCheckBox * matchCaseOption; QCheckBox * filterModeOption; QComboBox * filterMode; QTreeView * listingTreeView; QLineEdit * lineEditFilter; /*models*/ QPointer<QAbstractItemModel> model; QSortFilterProxyModel* proxyModel; /*properties*/ int lookupColumn; int lookupRole; QRegExp::PatternSyntax syntax; Qt::CaseSensitivity caseSensitivity; /*result*/ QModelIndex selectedIndex; /*member functions*/ void updateFilterPattern(); public slots: void createRegExpPattern(const QString &rawText); void filterModeOptionStateChanged(const int state); void matchCaseOptionStateChanged(const int state); void filterModeChoosen(int index); }; #endif
Increase corpus buffer to 16MB
//#define DEBUG_INDEXER #define MAX_CORPUS_FILE_SZ (1024 * 8)
//#define DEBUG_INDEXER #define MAX_CORPUS_FILE_SZ (1024 * 1024 * 16)
Initialize fNPDGcodes to 0 to prevent sigsegv (Christian)
#ifndef ROOT_TMevSimConverter #define ROOT_TMevSimConverter /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ #include "TObject.h" class TMevSimConverter : public TObject { enum {kMaxParticles = 35}; Int_t fNPDGCodes; // Number of PDG codes known by G3 Int_t fPDGCode [kMaxParticles]; // Translation table of PDG codes void DefineParticles(); public: TMevSimConverter() {DefineParticles();} virtual ~TMevSimConverter() {} Int_t PDGFromId(Int_t gpid); Int_t IdFromPDG(Int_t pdg); ClassDef(TMevSimConverter,1) }; #endif
#ifndef ROOT_TMevSimConverter #define ROOT_TMevSimConverter /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ #include "TObject.h" class TMevSimConverter : public TObject { enum {kMaxParticles = 35}; Int_t fNPDGCodes; // Number of PDG codes known by G3 Int_t fPDGCode [kMaxParticles]; // Translation table of PDG codes void DefineParticles(); public: TMevSimConverter() : fNPDGCodes(0) {DefineParticles();} virtual ~TMevSimConverter() {} Int_t PDGFromId(Int_t gpid); Int_t IdFromPDG(Int_t pdg); ClassDef(TMevSimConverter,1) }; #endif
Move assert test of EOF to after testing if a filter is done.
#include "fitz_base.h" #include "fitz_stream.h" fz_error fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out) { fz_error reason; unsigned char *oldrp; unsigned char *oldwp; assert(!out->eof); oldrp = in->rp; oldwp = out->wp; if (f->done) return fz_iodone; reason = f->process(f, in, out); assert(in->rp <= in->wp); assert(out->wp <= out->ep); f->consumed = in->rp > oldrp; f->produced = out->wp > oldwp; f->count += out->wp - oldwp; /* iodone or error */ if (reason != fz_ioneedin && reason != fz_ioneedout) { if (reason != fz_iodone) reason = fz_rethrow(reason, "cannot process filter"); out->eof = 1; f->done = 1; } return reason; } fz_filter * fz_keepfilter(fz_filter *f) { f->refs ++; return f; } void fz_dropfilter(fz_filter *f) { if (--f->refs == 0) { if (f->drop) f->drop(f); fz_free(f); } }
#include "fitz_base.h" #include "fitz_stream.h" fz_error fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out) { fz_error reason; unsigned char *oldrp; unsigned char *oldwp; oldrp = in->rp; oldwp = out->wp; if (f->done) return fz_iodone; assert(!out->eof); reason = f->process(f, in, out); assert(in->rp <= in->wp); assert(out->wp <= out->ep); f->consumed = in->rp > oldrp; f->produced = out->wp > oldwp; f->count += out->wp - oldwp; /* iodone or error */ if (reason != fz_ioneedin && reason != fz_ioneedout) { if (reason != fz_iodone) reason = fz_rethrow(reason, "cannot process filter"); out->eof = 1; f->done = 1; } return reason; } fz_filter * fz_keepfilter(fz_filter *f) { f->refs ++; return f; } void fz_dropfilter(fz_filter *f) { if (--f->refs == 0) { if (f->drop) f->drop(f); fz_free(f); } }
Define MPI_Session for compatibility with current mpi4py main branch
/* Author: Lisandro Dalcin */ /* Contact: dalcinl@gmail.com */ #ifndef MPI_COMPAT_H #define MPI_COMPAT_H #include <mpi.h> #if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message) typedef void *PyMPI_MPI_Message; #define MPI_Message PyMPI_MPI_Message #endif #endif/*MPI_COMPAT_H*/
/* Author: Lisandro Dalcin */ /* Contact: dalcinl@gmail.com */ #ifndef MPI_COMPAT_H #define MPI_COMPAT_H #include <mpi.h> #if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message) typedef void *PyMPI_MPI_Message; #define MPI_Message PyMPI_MPI_Message #endif #if (MPI_VERSION < 4) && !defined(PyMPI_HAVE_MPI_Session) typedef void *PyMPI_MPI_Session; #define MPI_Session PyMPI_MPI_Session #endif #endif/*MPI_COMPAT_H*/
Mark Mine init privatization test TODO to make others pass
#include <pthread.h> #include <assert.h> int g; void *t_fun(void *arg) { return NULL; } void main() { pthread_t id; pthread_create(&id, NULL, t_fun, NULL); g = 1; assert(g); // Mine's analysis would succeed, our mine-W doesn't }
#include <pthread.h> #include <assert.h> int g; void *t_fun(void *arg) { return NULL; } void main() { pthread_t id; pthread_create(&id, NULL, t_fun, NULL); g = 1; assert(g); // TODO (Mine's analysis would succeed, our mine-W doesn't) }
Add more zero-width fields to bitfield padding test
// RUN: %layout_check %s struct A { int : 0; int a; int : 0; int b; int : 0; }; struct A a = { 1, 2 };
// RUN: %layout_check %s struct A { int : 0; int a; int : 0; int : 0; int : 0; int : 0; int b; int : 0; }; struct A a = { 1, 2 };
Fix a test case broken by my previous commit.
// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify _Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}} #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-extension" _Nonnull int *ptr2; // no-warning #pragma clang diagnostic pop #if __has_feature(nullability) # error Nullability should not be supported in C under -pedantic -std=c99 #endif #if !__has_extension(nullability) # error Nullability should always be supported as an extension #endif
// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify _Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}} #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-extension" _Nonnull int *ptr2; // no-warning #pragma clang diagnostic pop #if !__has_feature(nullability) # error Nullability should always be supported #endif #if !__has_extension(nullability) # error Nullability should always be supported as an extension #endif
Fix CPP issue on OS X
/* * Copyright (C) 2009 Cjacker Huang <jzhuang@redflag-linux.com>. * * 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; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef HS_WEBKIT_H #define HS_WEBKIT_H /* to avoid stdbool.h error in JavaScriptCore/JSBase.h*/ #define _Bool int #define WINAPI #define CALLBACK /* include webkit headers*/ #include <webkit/webkit.h> #include <webkit/webkitdom.h> #endif #include "events.h"
/* * Copyright (C) 2009 Cjacker Huang <jzhuang@redflag-linux.com>. * * 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; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifdef __BLOCKS__ #undef __BLOCKS__ #endif #ifndef HS_WEBKIT_H #define HS_WEBKIT_H /* to avoid stdbool.h error in JavaScriptCore/JSBase.h*/ #define _Bool int #define WINAPI #define CALLBACK /* include webkit headers*/ #include <webkit/webkit.h> #include <webkit/webkitdom.h> #endif #include "events.h"
Fix function prototype in airplay plugin.
#ifndef _NET_UTILS_H #define _NET_UTILS_H #include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <fcntl.h> char *get_local_addr(int fd); int set_sock_nonblock(int sockfd); int tcp_open(); int tcp_connect(int sock_fd, const char *host, unsigned int port); int tcp_write(int fd, const char *buf, int n); int tcp_read(int fd, char *buf, int n); #endif /* _NET_UTILS_H */
#ifndef _NET_UTILS_H #define _NET_UTILS_H #include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <fcntl.h> char *get_local_addr(int fd); int set_sock_nonblock(int sockfd); int tcp_open(void); int tcp_connect(int sock_fd, const char *host, unsigned int port); int tcp_write(int fd, const char *buf, int n); int tcp_read(int fd, char *buf, int n); #endif /* _NET_UTILS_H */
Allow mog to track shadows
#pragma once #include "types/process_filter.h" namespace TooManyPeeps { class BackgroundExtractor : public ProcessFilter { private: static const bool TRACK_SHADOWS = false; private: cv::Ptr<cv::BackgroundSubtractor> backgroundExtractor; public: BackgroundExtractor(const cv::Mat& original, cv::Mat& result, int historySize, double threshold); ~BackgroundExtractor(void); public: virtual void execute(void); }; };
#pragma once #include "types/process_filter.h" namespace TooManyPeeps { class BackgroundExtractor : public ProcessFilter { private: static const bool TRACK_SHADOWS = true; private: cv::Ptr<cv::BackgroundSubtractor> backgroundExtractor; public: BackgroundExtractor(const cv::Mat& original, cv::Mat& result, int historySize, double threshold); ~BackgroundExtractor(void); public: virtual void execute(void); }; };
Remove a "Created by" comment line
// // kjchess.h // kjchess // // Created by Kristopher Johnson on 3/11/17. // Copyright © 2017 Kristopher Johnson. All rights reserved. // #import <Cocoa/Cocoa.h> //! Project version number for kjchess. FOUNDATION_EXPORT double kjchessVersionNumber; //! Project version string for kjchess. FOUNDATION_EXPORT const unsigned char kjchessVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <kjchess/PublicHeader.h>
// // kjchess.h // kjchess // // Copyright © 2017 Kristopher Johnson. All rights reserved. // #import <Cocoa/Cocoa.h> //! Project version number for kjchess. FOUNDATION_EXPORT double kjchessVersionNumber; //! Project version string for kjchess. FOUNDATION_EXPORT const unsigned char kjchessVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <kjchess/PublicHeader.h>
Add run_in_mode prototype to util header
void osx_cf_run_loop_run();
void osx_cf_run_loop_run(); CFRunLoopRunResult osx_cf_run_loop_run_in_mode (CFStringRef mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled);
Use ftello/fseeko instead of ftell/fseek
/***************************************************************************** * internal.h: ***************************************************************************** * Copyright (C) 2010-2012 L-SMASH project * * Authors: Takashi Hirata <silverfilain@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *****************************************************************************/ /* This file is available under an ISC license. */ #ifndef INTERNAL_H #define INTERNAL_H #include "common/osdep.h" /* must be placed before stdio.h */ #include <stdio.h> #include <assert.h> #ifndef lsmash_fseek #define lsmash_fseek fseek #define lsmash_ftell ftell #endif #include "lsmash.h" #endif
/***************************************************************************** * internal.h: ***************************************************************************** * Copyright (C) 2010-2012 L-SMASH project * * Authors: Takashi Hirata <silverfilain@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *****************************************************************************/ /* This file is available under an ISC license. */ #ifndef INTERNAL_H #define INTERNAL_H #include "common/osdep.h" /* must be placed before stdio.h */ #include <stdio.h> #include <assert.h> #ifndef lsmash_fseek #define lsmash_fseek fseeko #define lsmash_ftell ftello #endif #include "lsmash.h" #endif
Convert to Linux kernel style
#include <stdio.h> #include "main.h" int main(int argc, char *argv[]) { usage(argv[0]); } void usage(char *utilname) { printf("Usage: %s <input_file> <output_file> [options]\n", utilname); printf("WARNING: UTILITY IS NOT FULLY FUNCTIONAL YET\n"); printf("Options:\n"); //TODO: add optional arguments for each filter option printf(" -b --blur Apply box blur\n"); printf(" -g --gaussian Apply Gaussian blur\n"); printf(" -s --sharpen Sharpen image\n"); printf(" -u --unsharpen Unsharpen image\n"); printf(" -o --outline Outline image\n"); printf(" -e --emboss Emboss image\n"); printf(" --topsobel Apply top Sobel filter\n"); printf(" --bottomsobel Apply bottom Sobel filter\n"); printf(" --rightsobel Apply right Sobel filter\n"); printf(" --leftsobel Apply left Sobel filter\n"); printf(" -c FILE --custom=FILE Apply custom filter\n"); }
#include <stdio.h> #include "main.h" int main(int argc, char *argv[]) { usage(argv[0]); } void usage(char *utilname) { printf("Usage: %s <input_file> <output_file> [options]\n", utilname); printf("WARNING: UTILITY IS NOT FULLY FUNCTIONAL YET\n"); printf("Options:\n"); /* TODO: add optional arguments for each filter option */ printf(" -b --blur Apply box blur\n"); printf(" -g --gaussian Apply Gaussian blur\n"); printf(" -s --sharpen Sharpen image\n"); printf(" -u --unsharpen Unsharpen image\n"); printf(" -o --outline Outline image\n"); printf(" -e --emboss Emboss image\n"); printf(" --topsobel Apply top Sobel filter\n"); printf(" --bottomsobel Apply bottom Sobel filter\n"); printf(" --rightsobel Apply right Sobel filter\n"); printf(" --leftsobel Apply left Sobel filter\n"); printf(" -c FILE --custom=FILE Apply custom filter\n"); }
Fix compile on some systems
#ifndef MAIN_H #define MAIN_H #include <cstdlib> #include <iostream> #include <tr1/unordered_map> #include <vector> #include <list> #include <set> #include <pthread.h> #endif
#ifndef MAIN_H #define MAIN_H #include <unistd.h> #include <cstdlib> #include <iostream> #include <tr1/unordered_map> #include <vector> #include <list> #include <set> #include <pthread.h> #endif
Add C-API bindings with initial methods. It can verify a blueprint and parse it into json or yaml.
#include <Python.h> #include <drafter/drafter.h> static PyObject *drafterpy_parse_blueprint_to(PyObject *self, PyObject *args){ char *blueprint; char *format; char *result = NULL; drafter_options options; options.sourcemap = true; if(!PyArg_ParseTuple(args, "ss", &blueprint, &format)) return NULL; if(strcmp("json", format) == 0) options.format = DRAFTER_SERIALIZE_JSON; else if (strcmp("yaml", format) == 0) options.format = DRAFTER_SERIALIZE_YAML; else { fprintf(stderr, "Fatal error: Invalid output format\n"); return NULL; } drafter_parse_blueprint_to(blueprint, &result, options); return Py_BuildValue("s", result); } static PyObject *drafterpy_check_blueprint(PyObject *self, PyObject *args){ char *blueprint; char *format; if(!PyArg_ParseTuple(args, "s", &blueprint)) return NULL; drafter_result* result = drafter_check_blueprint(blueprint); if (result == NULL) return Py_BuildValue("O", Py_True); drafter_free_result(result); return Py_BuildValue("O", Py_False); } static PyMethodDef drafterpy_methods[] = { {"parse_blueprint_to", (PyCFunction)drafterpy_parse_blueprint_to, METH_VARARGS, "Parses a blueprint into JSON or YAML."}, {"check_blueprint", (PyCFunction)drafterpy_check_blueprint, METH_VARARGS, "Verify given blueprint correctness."}, {NULL, NULL, 0, NULL} /* Sentinel */ }; static char drafterpy_docstring[] = "Python bindings for libdrafter.\nDrafter is a Snowcrash parser harness."; static struct PyModuleDef drafterpymodule = { PyModuleDef_HEAD_INIT, "drafterpy", drafterpy_docstring, -1, drafterpy_methods }; PyMODINIT_FUNC PyInit_drafterpy(void){ return PyModule_Create(&drafterpymodule); } int main(int argc, char *argv[]){ wchar_t *program = Py_DecodeLocale(argv[0], NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); } /* Add a built-in module, before Py_Initialize */ PyImport_AppendInittab("drafterpy", PyInit_drafterpy); /* Pass argv[0] to the Python interpreter. REQUIRED */ Py_SetProgramName(program); /* Initialize the Python Interpreter. REQUIRED */ Py_Initialize(); PyImport_ImportModule("drafterpy"); PyMem_RawFree(program); return 0; }
Fix a bunch of warnings due to missing inline keywords.
/* * 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 */
/* * 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 */
Add matrix routines for multi-qubit gates. Add required file.
// Copyright 2019 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef BITS_H_ #define BITS_H_ #ifdef __BMI2__ #include <immintrin.h> #include <cstdint> namespace qsim { namespace bits { inline uint32_t ExpandBits(uint32_t bits, unsigned n, uint32_t mask) { return _pdep_u32(bits, mask); } inline uint64_t ExpandBits(uint64_t bits, unsigned n, uint64_t mask) { return _pdep_u64(bits, mask); } inline uint32_t CompressBits(uint32_t bits, unsigned n, uint32_t mask) { return _pext_u32(bits, mask); } inline uint64_t CompressBits(uint64_t bits, unsigned n, uint64_t mask) { return _pext_u64(bits, mask); } } // namespace bits } // namespace qsim #else // __BMI2__ namespace qsim { namespace bits { template <typename I> inline I ExpandBits(I bits, unsigned n, I mask) { I ebits = 0; unsigned k = 0; for (unsigned i = 0; i < n; ++i) { if ((mask >> i) & 1) { ebits |= ((bits >> k) & 1) << i; ++k; } } return ebits; } template <typename I> inline I CompressBits(I bits, unsigned n, I mask) { I sbits = 0; unsigned k = 0; for (unsigned i = 0; i < n; ++i) { if ((mask >> i) & 1) { sbits |= ((bits >> i) & 1) << k; ++k; } } return sbits; } } // namespace bits } // namespace qsim #endif // __BMI2__ namespace qsim { namespace bits { template <typename I> inline I PermuteBits(I bits, unsigned n, const std::vector<unsigned>& perm) { I pbits = 0; for (unsigned i = 0; i < n; ++i) { pbits |= ((bits >> i) & 1) << perm[i]; } return pbits; } } // namespace bits } // namespace qsim #endif // BITS_H_
Remove sqlite3 * parameter from the spell function's declaration.
#ifndef LIBSPELL_H #define LIBSPELL_H char *spell(sqlite3*, char *); char *get_suggestions(char *); #endif
#ifndef LIBSPELL_H #define LIBSPELL_H char *spell(char *); char *get_suggestions(char *); #endif
Add missing '-no-canonical-prefixes' in test.
// REQUIRES: clang-driver // REQUIRES: powerpc-registered-target // REQUIRES: nvptx-registered-target // // Verify that CUDA device commands do not get OpenMP flags. // // RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \ // RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE // // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE: clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT: -fopenmp // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE: -fopenmp // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"
// REQUIRES: clang-driver // REQUIRES: powerpc-registered-target // REQUIRES: nvptx-registered-target // // Verify that CUDA device commands do not get OpenMP flags. // // RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \ // RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE // // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE: clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT: -fopenmp // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu" // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE: -fopenmp // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"
Add ability for Array to take ownership of its data
#pragma once #include <cassert> namespace Utilities { namespace Array { template <class T, class Size = unsigned int> class Array { public: Array(T* data, Size capacity) : data_(data), capacity_(capacity) { assert(data_); assert(capacity_ > 0); } T& operator[](Size index) { assert(index < capacity_); return data_[index]; } const T& operator[](Size index) const { assert(index < capacity_); return data_[index]; } T& operator*() { return *data_; } const T& operator*() const { return *data_; } T* data() { return data_; } const T* data() const { return data_; } /** * If T is primitive but not floating point, or if value is zero, the * caller should probably use memset on the raw pointer instead */ void assign(Size numElements, const T& value) { #pragma vector always assert for (Size i = 0; i < numElements; ++i) { data_[i] = value; } } void clear() { capacity_ = 0; } Size capacity() const { return capacity_; } Size size() const { return capacity_; } Size length() const { return capacity_; } private: T* data_; Size capacity_; }; } }
#pragma once #include <cassert> #include <functional> namespace Utilities { namespace Array { template <class T, class Size = unsigned int> class Array { public: Array(T*&& data, Size capacity, std::function<void(T**)>&& deleteData) : data_(std::move(data)), capacity_(capacity), deleteData_(std::move(deleteData)) { assert(data_); assert(capacity_ > 0); } Array(T* data, Size capacity) : data_(data), capacity_(capacity), deleteData_([](T**) {}) { assert(data_); assert(capacity_ > 0); } virtual ~Array() { deleteData_(&data_); } T& operator[](Size index) { assert(index < capacity_); return data_[index]; } const T& operator[](Size index) const { assert(index < capacity_); return data_[index]; } T& operator*() { return *data_; } const T& operator*() const { return *data_; } T* data() { return data_; } const T* data() const { return data_; } /** * If T is primitive but not floating point, or if value is zero, the * caller should probably use memset on the raw pointer instead */ void assign(Size numElements, const T& value) { #pragma vector always assert for (Size i = 0; i < numElements; ++i) { data_[i] = value; } } void clear() { capacity_ = 0; } Size capacity() const { return capacity_; } Size size() const { return capacity_; } Size length() const { return capacity_; } protected: T* data_; Size capacity_; std::function<void(T**)> deleteData_; }; } }
Fix build failure by adding virtual keyword.
/* * Represents an element which can be rendered as part of a scene. * Author: Dino Wernli */ #ifndef ELEMENT_H_ #define ELEMENT_H_ #include <cstddef> class IntersectionData; class Ray; class Element { public: virtual ~Element(); bool Intersect(const Ray& ray, IntersectionData* data = NULL) = 0; }; #endif /* ELEMENT_H_ */
/* * Represents an element which can be rendered as part of a scene. * Author: Dino Wernli */ #ifndef ELEMENT_H_ #define ELEMENT_H_ #include <cstddef> class IntersectionData; class Ray; class Element { public: virtual ~Element(); virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) = 0; }; #endif /* ELEMENT_H_ */
Mark the AFJSON* functions as 'extern'.
// AFJSONUtilities.h // // Copyright (c) 2011 Gowalla (http://gowalla.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <Foundation/Foundation.h> NSData * AFJSONEncode(id object, NSError **error); id AFJSONDecode(NSData *data, NSError **error);
// AFJSONUtilities.h // // Copyright (c) 2011 Gowalla (http://gowalla.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <Foundation/Foundation.h> extern NSData * AFJSONEncode(id object, NSError **error); extern id AFJSONDecode(NSData *data, NSError **error);
Fix buildbot failure from r373217 (don't match metadata id exactly)
// RUN: cat %s | %clang -emit-llvm -g -S \ // RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s // CHECK: ; ModuleID = 'test/foo.c' // CHECK: source_filename = "test/foo.c" // CHECK: !1 = !DIFile(filename: "test/foo.c" int main() {}
// RUN: cat %s | %clang -emit-llvm -g -S \ // RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s // CHECK: ; ModuleID = 'test/foo.c' // CHECK: source_filename = "test/foo.c" // CHECK: !DIFile(filename: "test/foo.c" int main() {}
Declare PPB_Core as a struct, not a class. (Prevents Clang warning)
// Copyright 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can // be found in the LICENSE file. #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_ #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_ #include "native_client/src/include/nacl_macros.h" class PPB_Core; namespace ppapi_proxy { // Implements the untrusted side of the PPB_Core interface. // We will also need an rpc service to implement the trusted side, which is a // very thin wrapper around the PPB_Core interface returned from the browser. class PluginCore { public: // Return an interface pointer usable by PPAPI plugins. static const PPB_Core* GetInterface(); // Mark the calling thread as the main thread for IsMainThread. static void MarkMainThread(); private: NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore); }; } // namespace ppapi_proxy #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_ #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_ #include "native_client/src/include/nacl_macros.h" struct PPB_Core; namespace ppapi_proxy { // Implements the untrusted side of the PPB_Core interface. // We will also need an rpc service to implement the trusted side, which is a // very thin wrapper around the PPB_Core interface returned from the browser. class PluginCore { public: // Return an interface pointer usable by PPAPI plugins. static const PPB_Core* GetInterface(); // Mark the calling thread as the main thread for IsMainThread. static void MarkMainThread(); private: NACL_DISALLOW_COPY_AND_ASSIGN(PluginCore); }; } // namespace ppapi_proxy #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_CORE_H_
Rename Render component to Sprite
#ifndef COMPONENTMANAGER_H_ #define COMPONENTMANAGER_H_ #include "entity/Entity.h" /** * Enumeration for each of our types of components */ enum component_t { Position, Render }; /** * Base class for all Component Managers. */ class ComponentManager { public: /** * Check if the given Entity has this manager's Component. * * @param e The Entity to test for. * * @return True if the Entity has this Component. */ virtual bool entityHasComponent(Entity e) = 0; /** * Add the Component (with default values) to the Entity. * * @param e The Entity to add the Component to. */ virtual void addComponent(Entity e) = 0; /** * Remove the Component from the Entity. * * @param e The Entity to remove it from. */ virtual void removeComponent(Entity e) = 0; /** * Gets the type of component that this ComponentManager subclass * manages. * * @return One of the component_t enumerations. */ virtual component_t getComponentType() = 0; protected: /** * This class must be inherited, it cannot be instantiated directly. * * NB: We actually gain this from having pure virtual methods already, * but it can't hurt to have an extra layer e.g. in case for any reason * we start to implement default versions of the above. */ ComponentManager() {}; }; #endif
#ifndef COMPONENTMANAGER_H_ #define COMPONENTMANAGER_H_ #include "entity/Entity.h" /** * Enumeration for each of our types of components */ enum component_t { Position, Sprite }; /** * Base class for all Component Managers. */ class ComponentManager { public: /** * Check if the given Entity has this manager's Component. * * @param e The Entity to test for. * * @return True if the Entity has this Component. */ virtual bool entityHasComponent(Entity e) = 0; /** * Add the Component (with default values) to the Entity. * * @param e The Entity to add the Component to. */ virtual void addComponent(Entity e) = 0; /** * Remove the Component from the Entity. * * @param e The Entity to remove it from. */ virtual void removeComponent(Entity e) = 0; /** * Gets the type of component that this ComponentManager subclass * manages. * * @return One of the component_t enumerations. */ virtual component_t getComponentType() = 0; protected: /** * This class must be inherited, it cannot be instantiated directly. * * NB: We actually gain this from having pure virtual methods already, * but it can't hurt to have an extra layer e.g. in case for any reason * we start to implement default versions of the above. */ ComponentManager() {}; }; #endif
Use "extern inline" in declarations (I think).
#ifndef INCLUDE_POD_NODE_H #define INCLUDE_POD_NODE_H #include <stddef.h> // A node is a place on a list. It simplifies doubly linked lists because the // header is just another node. Everything in Pod is a node, potentially a // part of a list or map. Header nodes should be initialized to point to // themselves. Otherwise, initialize them to NULL. // // For example: // pod_node header; // // header.previous = &header; // header.next = &header; struct pod_node; typedef struct pod_node pod_node; struct pod_node { pod_node *previous; pod_node *next; }; extern pod_node *pod_node_remove(pod_node *node); inline pod_node *pod_node_remove(pod_node *node) { pod_node *next; next = node->next; node->previous->next = node->next; node->next->previous = node->previous; node->previous = node->next = NULL; return next; } #endif /*INCLUDE_POD_NODE_H */
#ifndef INCLUDE_POD_NODE_H #define INCLUDE_POD_NODE_H #include <stddef.h> // A node is a place on a list. It simplifies doubly linked lists because the // header is just another node. Everything in Pod is a node, potentially a // part of a list or map. Header nodes should be initialized to point to // themselves. Otherwise, initialize them to NULL. // // For example: // pod_node header; // // header.previous = &header; // header.next = &header; struct pod_node; typedef struct pod_node pod_node; struct pod_node { pod_node *previous; pod_node *next; }; // Other pod_node related functions // extern pod_node *pod_node_remove(pod_node *node); extern inline pod_node *pod_node_remove(pod_node *node) { pod_node *next; next = node->next; node->previous->next = node->next; node->next->previous = node->previous; node->previous = node->next = NULL; return next; } #endif /*INCLUDE_POD_NODE_H */
Add a Python-like range macro for sequences.
/*! * This file defines a Python-like range function for sequences. * * @author Louis Dionne */ #ifndef JOY_INTERNAL_SEQRANGE_H #define JOY_INTERNAL_SEQRANGE_H #include <chaos/preprocessor/recursion/expr.h> #include <chaos/preprocessor/repetition/repeat_from_to.h> #define JOY_SEQRANGE(from, to) \ JOY_SEQRANGE_S(CHAOS_PP_STATE(), from, to) #define JOY_SEQRANGE_S(state, from, to) \ CHAOS_PP_EXPR_S(state)( \ CHAOS_PP_REPEAT_FROM_TO_S(state, from, to, JOY_I_SEQRANGE, ~) \ ) \ /**/ #define JOY_I_SEQRANGE(state, n, useless) (n) #endif /* !JOY_INTERNAL_SEQRANGE_H */
Add missing includes to fix Clang build.
#pragma once #include <functional> #include <boost/asio.hpp> // This class abstracts the boost::asio timer in order to provide a generic // facility for timeouts. Once constructed, this class will wait a certain // amount of time and then call the function. The timeout must be canceled // with cancel() before you invalidate your callback. // // You must start the timeout with start(). // // NOTE: The thread that calls the function is undefined. Ensure that your // callback is thread-safe. class Timeout : public std::enable_shared_from_this<Timeout> { public: Timeout(unsigned long ms, std::function<void()> f); ~Timeout(); inline void start() { reset(); } void reset(); // cancel() attempts to invalidate the callback and ensure that it will not // run. On success, returns true, guaranteeing that the callback has/will // not be triggered. On failure, returns false, indicating either that the // callback was already canceled, the callback has already finished // running, or the callback is (about to be) called. bool cancel(); private: boost::asio::deadline_timer m_timer; std::function<void()> m_callback; long m_timeout_interval; std::atomic<bool> m_callback_disabled; void timer_callback(const boost::system::error_code &ec); };
#pragma once #include <functional> #include <atomic> #include <memory> #include <boost/asio.hpp> // This class abstracts the boost::asio timer in order to provide a generic // facility for timeouts. Once constructed, this class will wait a certain // amount of time and then call the function. The timeout must be canceled // with cancel() before you invalidate your callback. // // You must start the timeout with start(). // // NOTE: The thread that calls the function is undefined. Ensure that your // callback is thread-safe. class Timeout : public std::enable_shared_from_this<Timeout> { public: Timeout(unsigned long ms, std::function<void()> f); ~Timeout(); inline void start() { reset(); } void reset(); // cancel() attempts to invalidate the callback and ensure that it will not // run. On success, returns true, guaranteeing that the callback has/will // not be triggered. On failure, returns false, indicating either that the // callback was already canceled, the callback has already finished // running, or the callback is (about to be) called. bool cancel(); private: boost::asio::deadline_timer m_timer; std::function<void()> m_callback; long m_timeout_interval; std::atomic<bool> m_callback_disabled; void timer_callback(const boost::system::error_code &ec); };
Add doxygen comment to IsRBFOptIn
// Copyright (c) 2016-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef SYSCOIN_POLICY_RBF_H #define SYSCOIN_POLICY_RBF_H #include <txmempool.h> enum class RBFTransactionState { UNKNOWN, REPLACEABLE_BIP125, FINAL }; // Determine whether an in-mempool transaction is signaling opt-in to RBF // according to BIP 125 // This involves checking sequence numbers of the transaction, as well // as the sequence numbers of all in-mempool ancestors. RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); // SYSCOIN RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx); #endif // SYSCOIN_POLICY_RBF_H
// Copyright (c) 2016-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef SYSCOIN_POLICY_RBF_H #define SYSCOIN_POLICY_RBF_H #include <txmempool.h> /** The rbf state of unconfirmed transactions */ enum class RBFTransactionState { /** Unconfirmed tx that does not signal rbf and is not in the mempool */ UNKNOWN, /** Either this tx or a mempool ancestor signals rbf */ REPLACEABLE_BIP125, /** Neither this tx nor a mempool ancestor signals rbf */ FINAL, }; /** * Determine whether an unconfirmed transaction is signaling opt-in to RBF * according to BIP 125 * This involves checking sequence numbers of the transaction, as well * as the sequence numbers of all in-mempool ancestors. * * @param tx The unconfirmed transaction * @param pool The mempool, which may contain the tx * * @return The rbf state */ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); // SYSCOIN RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx); #endif // SYSCOIN_POLICY_RBF_H
Allow user to pick render settings
#pragma once #if PLATFORM_WINDOWS #include "AllowWindowsPlatformTypes.h" #endif #include "include/cef_client.h" #include "include/cef_app.h" #if PLATFORM_WINDOWS #include "HideWindowsPlatformTypes.h" #endif class BLU_API BluManager : public CefApp { public: BluManager(); static void doBluMessageLoop(); static CefSettings settings; static CefMainArgs main_args; virtual void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr< CefCommandLine > command_line) override; IMPLEMENT_REFCOUNTING(BluManager) };
#pragma once #if PLATFORM_WINDOWS #include "AllowWindowsPlatformTypes.h" #endif #include "include/cef_client.h" #include "include/cef_app.h" #if PLATFORM_WINDOWS #include "HideWindowsPlatformTypes.h" #endif class BLU_API BluManager : public CefApp { public: BluManager(); static void doBluMessageLoop(); static CefSettings settings; static CefMainArgs main_args; static bool CPURenderSettings; virtual void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr< CefCommandLine > command_line) override; IMPLEMENT_REFCOUNTING(BluManager) };
Update Skia milestone to 75
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 74 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 75 #endif
Fix 13/32 to fail Mine even with thread ID partitioning
#include <pthread.h> #include <assert.h> int g = 0; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t C = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { pthread_mutex_lock(&A); pthread_mutex_lock(&C); pthread_mutex_lock(&B); g = 5; pthread_mutex_unlock(&B); pthread_mutex_lock(&B); g = 0; pthread_mutex_unlock(&B); pthread_mutex_unlock(&C); pthread_mutex_unlock(&A); return NULL; } int main(void) { pthread_t id; pthread_create(&id, NULL, t_fun, NULL); pthread_mutex_lock(&A); pthread_mutex_lock(&B); assert(g == 0); pthread_mutex_unlock(&B); pthread_mutex_unlock(&A); pthread_mutex_lock(&B); pthread_mutex_lock(&C); assert(g == 0); pthread_mutex_unlock(&C); pthread_mutex_unlock(&B); pthread_join(id, NULL); return 0; }
#include <pthread.h> #include <assert.h> int g = 0; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t C = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { pthread_mutex_lock(&A); pthread_mutex_lock(&C); pthread_mutex_lock(&B); g = 5; pthread_mutex_unlock(&B); pthread_mutex_lock(&B); g = 0; pthread_mutex_unlock(&B); pthread_mutex_unlock(&C); pthread_mutex_unlock(&A); return NULL; } int main(void) { pthread_t id; pthread_create(&id, NULL, t_fun, NULL); // This must be before the other to get Mine to fail for the other even with thread ID partitioning. pthread_mutex_lock(&B); pthread_mutex_lock(&C); assert(g == 0); pthread_mutex_unlock(&C); pthread_mutex_unlock(&B); pthread_mutex_lock(&A); pthread_mutex_lock(&B); assert(g == 0); pthread_mutex_unlock(&B); pthread_mutex_unlock(&A); pthread_join(id, NULL); return 0; }
Allow choice of D2D on compiler command line.
// Scintilla source code edit control /** @file PlatWin.h ** Implementation of platform facilities on Windows. **/ // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. extern bool IsNT(); extern void Platform_Initialise(void *hInstance); extern void Platform_Finalise(); #if defined(_MSC_VER) extern bool LoadD2D(); extern ID2D1Factory *pD2DFactory; extern IDWriteFactory *pIDWriteFactory; #endif
// Scintilla source code edit control /** @file PlatWin.h ** Implementation of platform facilities on Windows. **/ // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. extern bool IsNT(); extern void Platform_Initialise(void *hInstance); extern void Platform_Finalise(); #if defined(USE_D2D) extern bool LoadD2D(); extern ID2D1Factory *pD2DFactory; extern IDWriteFactory *pIDWriteFactory; #endif
Add constructor for addition to opt program
//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=// // // This pass is used to ensure that methods have at most one return instruction // in them. It also holds onto the return instruction of the last unified // method. // //===----------------------------------------------------------------------===// #ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H #define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H #include "llvm/Pass.h" struct UnifyMethodExitNodes : public MethodPass { BasicBlock *ExitNode; public: static AnalysisID ID; // Pass ID UnifyMethodExitNodes(AnalysisID id) : ExitNode(0) { assert(ID == id); } // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new // BasicBlock, and converting all returns to unconditional branches to this // new basic block. The singular exit node is returned in ExitNode. // // If there are no return stmts in the Method, a null pointer is returned. // static bool doit(Method *M, BasicBlock *&ExitNode); virtual bool runOnMethod(Method *M) { return doit(M, ExitNode); } BasicBlock *getExitNode() const { return ExitNode; } virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, Pass::AnalysisSet &Destroyed, Pass::AnalysisSet &Provided) { // FIXME: Should invalidate CFG Provided.push_back(ID); // Provide self! } }; #endif
//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=// // // This pass is used to ensure that methods have at most one return instruction // in them. It also holds onto the return instruction of the last unified // method. // //===----------------------------------------------------------------------===// #ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H #define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H #include "llvm/Pass.h" struct UnifyMethodExitNodes : public MethodPass { BasicBlock *ExitNode; public: static AnalysisID ID; // Pass ID UnifyMethodExitNodes(AnalysisID id = ID) : ExitNode(0) { assert(ID == id); } // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new // BasicBlock, and converting all returns to unconditional branches to this // new basic block. The singular exit node is returned in ExitNode. // // If there are no return stmts in the Method, a null pointer is returned. // static bool doit(Method *M, BasicBlock *&ExitNode); virtual bool runOnMethod(Method *M) { return doit(M, ExitNode); } BasicBlock *getExitNode() const { return ExitNode; } virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, Pass::AnalysisSet &Destroyed, Pass::AnalysisSet &Provided) { // FIXME: Should invalidate CFG Provided.push_back(ID); // Provide self! } }; #endif
Check that we can output to /dev/fd filesystem.
// Check that we can operate on files from /dev/fd. // REQUIRES: dev-fd-fs // Check reading from named pipes. We cat the input here instead of redirecting // it to ensure that /dev/fd/0 is a named pipe, not just a redirected file. // // RUN: cat %s | %clang -x c /dev/fd/0 -E > %t // RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s // DEV-FD-INPUT: int x; int x;
// Check that we can operate on files from /dev/fd. // REQUIRES: dev-fd-fs // Check reading from named pipes. We cat the input here instead of redirecting // it to ensure that /dev/fd/0 is a named pipe, not just a redirected file. // // RUN: cat %s | %clang -x c /dev/fd/0 -E > %t // RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s // // DEV-FD-INPUT: int x; // Check writing to /dev/fd named pipes. We use cat here as before to ensure we // get a named pipe. // // RUN: %clang -x c %s -E -o /dev/fd/1 | cat > %t // RUN: FileCheck --check-prefix DEV-FD-FIFO-OUTPUT < %t %s // // DEV-FD-FIFO-OUTPUT: int x; // Check writing to /dev/fd regular files. // // RUN: %clang -x c %s -E -o /dev/fd/1 > %t // RUN: FileCheck --check-prefix DEV-FD-REG-OUTPUT < %t %s // // DEV-FD-REG-OUTPUT: int x; int x;
Fix sort of second half
// -*- mode: c++ -*- // Copyright (c) 2014 Olaf Dietsche #ifndef __quick_sort_h_included__ #define __quick_sort_h_included__ #include <functional> #include <iterator> #include <utility> template<typename I, typename T, typename C> I quicksort_partition(I first, I last, C cmp) { --last; T pivot = *last; while (first < last) { while (first != last && cmp(*first, pivot)) ++first; while (first != last && cmp(pivot, *last)) --last; if (first != last) std::swap(*first, *last); } return first; } template<typename I, typename T = typename std::iterator_traits<I>::value_type, typename C = std::less<T>> void quick_sort(I first, I last, C cmp = C()) { if (last - first > 1) { I i = quicksort_partition<I, T, C>(first, last, cmp); quick_sort(first, i, cmp); quick_sort(i, last, cmp); } } #endif
// -*- mode: c++ -*- // Copyright (c) 2014 Olaf Dietsche #ifndef __quick_sort_h_included__ #define __quick_sort_h_included__ #include <functional> #include <iterator> #include <utility> template<typename I, typename T, typename C> I quicksort_partition(I first, I last, C cmp) { --last; T pivot = *last; while (first < last) { while (first != last && cmp(*first, pivot)) ++first; while (first != last && cmp(pivot, *last)) --last; if (first != last) std::swap(*first, *last); } return first; } template<typename I, typename T = typename std::iterator_traits<I>::value_type, typename C = std::less<T>> void quick_sort(I first, I last, C cmp = C()) { if (last - first > 1) { I i = quicksort_partition<I, T, C>(first, last, cmp); quick_sort(first, i, cmp); quick_sort(i + 1, last, cmp); } } #endif
Add a genlist to the panel test.
#include <Elementary.h> #ifndef ELM_LIB_QUICKLAUNCH void test_panel(void *data, Evas_Object *obj, void *event_info) { Evas_Object *win, *bg, *panel; win = elm_win_add(NULL, "panel", ELM_WIN_BASIC); elm_win_title_set(win, "Panel"); elm_win_autodel_set(win, 1); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); panel = elm_panel_add(win); elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT); evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(panel); evas_object_resize(win, 300, 300); evas_object_show(win); } #endif
#include <Elementary.h> #ifndef ELM_LIB_QUICKLAUNCH void test_panel(void *data, Evas_Object *obj, void *event_info) { Evas_Object *win, *bg, *panel; Evas_Object *list; win = elm_win_add(NULL, "panel", ELM_WIN_BASIC); elm_win_title_set(win, "Panel"); elm_win_autodel_set(win, 1); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); panel = elm_panel_add(win); elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT); evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(panel); list = elm_genlist_add(win); evas_object_resize(list, 100, 100); evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(list); elm_panel_content_set(panel, list); evas_object_resize(win, 300, 300); evas_object_show(win); } #endif
Declare an enum for git_delta_t
// // GTDiff.h // ObjectiveGitFramework // // Created by Danny Greg on 29/11/2012. // Copyright (c) 2012 GitHub, Inc. All rights reserved. // #import "git2.h" @class GTTree; @interface GTDiff : NSObject @property (nonatomic, readonly, assign) git_diff_list *git_diff_list; + (GTDiff *)diffOldTree:(GTTree *)oldTree withNewTree:(GTTree *)newTree options:(NSUInteger)options; + (GTDiff *)diffIndexToOldTree:(GTTree *)oldTree withOptions:(NSUInteger)options; + (GTDiff *)diffWorkingDirectoryToIndexWithOptions:(NSUInteger)options; + (GTDiff *)diffWorkingDirectoryToTree:(GTTree *)tree withOptions:(NSUInteger)options; @end
// // GTDiff.h // ObjectiveGitFramework // // Created by Danny Greg on 29/11/2012. // Copyright (c) 2012 GitHub, Inc. All rights reserved. // #import "git2.h" @class GTTree; typedef enum : git_delta_t { GTDiffFileDeltaUnmodified = GIT_DELTA_UNMODIFIED, GTDiffFileDeltaAdded = GIT_DELTA_ADDED, GTDiffFileDeltaDeleted = GIT_DELTA_DELETED, GTDiffFileDeltaModified = GIT_DELTA_MODIFIED, GTDiffFileDeltaRenamed = GIT_DELTA_RENAMED, GTDiffFileDeltaCopied = GIT_DELTA_COPIED, GTDiffFileDeltaIgnored = GIT_DELTA_IGNORED, GTDiffFileDeltaUntracked = GIT_DELTA_UNTRACKED, GTDiffFileDeltaTypeChange = GIT_DELTA_TYPECHANGE, } GTDiffFileDelta; @interface GTDiff : NSObject @property (nonatomic, readonly, assign) git_diff_list *git_diff_list; + (GTDiff *)diffOldTree:(GTTree *)oldTree withNewTree:(GTTree *)newTree options:(NSUInteger)options; + (GTDiff *)diffIndexToOldTree:(GTTree *)oldTree withOptions:(NSUInteger)options; + (GTDiff *)diffWorkingDirectoryToIndexWithOptions:(NSUInteger)options; + (GTDiff *)diffWorkingDirectoryToTree:(GTTree *)tree withOptions:(NSUInteger)options; @end
Return an error if CompositeImage fails
#include "composite.h" Image * compositeImage(Image *canvas, void *data, ExceptionInfo *ex) { CompositeData *d = data; if (!CompositeImage(canvas, d->composite, d->draw, d->x, d->y)) { } return canvas; }
#include "composite.h" Image * compositeImage(Image *canvas, void *data, ExceptionInfo *ex) { CompositeData *d = data; if (!CompositeImage(canvas, d->composite, d->draw, d->x, d->y)) { ex->severity = DrawError; return NULL; } return canvas; }
Fix build issue on Windows.
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. #pragma once #define NBIND_MULTIMETHOD(name, args, ...) definer.overloaded args ().method(name, ## __VA_ARGS__) #include "noconflict.h" #define function NBIND_FUNCTION #define multifunction NBIND_MULTIFUNCTION #define method(...) NBIND_METHOD(__VA_ARGS__) #define inherit(...) NBIND_INHERIT(__VA_ARGS__) #define args NBIND_ARGS #define multimethod NBIND_MULTIMETHOD #define construct NBIND_CONSTRUCT #define field(...) NBIND_FIELD(__VA_ARGS__) #define getter NBIND_GETTER #define getset NBIND_GETSET
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. #pragma once #define NBIND_MULTIMETHOD(name, args, ...) definer.overloaded args ().method(name, ## __VA_ARGS__) #include "noconflict.h" #define function NBIND_FUNCTION #define multifunction NBIND_MULTIFUNCTION #define method(...) NBIND_EXPAND(NBIND_METHOD(__VA_ARGS__)) #define inherit(...) NBIND_INHERIT(__VA_ARGS__) #define args NBIND_ARGS #define multimethod NBIND_MULTIMETHOD #define construct NBIND_CONSTRUCT #define field(...) NBIND_FIELD(__VA_ARGS__) #define getter NBIND_GETTER #define getset NBIND_GETSET
Fix newline at end of file
/* * * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */
/* * * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */
Add a missing "once" in .h
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). namespace rocksdb { // The helper function to assert the move from dynamic_cast<> to // static_cast<> is correct. This function is to deal with legacy code. // It is not recommanded to add new code to issue class casting. The preferred // solution is to implement the functionality without a need of casting. template <class DestClass, class SrcClass> inline DestClass* static_cast_with_check(SrcClass* x) { DestClass* ret = static_cast<DestClass*>(x); #ifdef ROCKSDB_USE_RTTI assert(ret == dynamic_cast<DestClass*>(x)); #endif return ret; } } // namespace rocksdb
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #pragma once namespace rocksdb { // The helper function to assert the move from dynamic_cast<> to // static_cast<> is correct. This function is to deal with legacy code. // It is not recommanded to add new code to issue class casting. The preferred // solution is to implement the functionality without a need of casting. template <class DestClass, class SrcClass> inline DestClass* static_cast_with_check(SrcClass* x) { DestClass* ret = static_cast<DestClass*>(x); #ifdef ROCKSDB_USE_RTTI assert(ret == dynamic_cast<DestClass*>(x)); #endif return ret; } } // namespace rocksdb
Address the non-portability of the PRINTF macro
#ifndef _HELPERS_H #define _HELPERS_H #include <stdarg.h> #include <stdio.h> #include <stdint.h> #define LENGTH(x) (sizeof(x) / sizeof(*x)) #define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B)) #define BOOLSTR(A) ((A) ? "true" : "false") #define MAXLEN 256 #define XCB_CONFIG_WINDOW_X_Y_WIDTH_HEIGHT XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT #define XCB_CONFIG_WINDOW_X_Y XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y #ifdef DEBUG # define PUTS(x) puts(x) # define PRINTF(x,...) printf(x, ##__VA_ARGS__) #else # define PUTS(x) ((void)0) # define PRINTF(x,...) ((void)0) #endif void logmsg(FILE *, char *, va_list); void warn(char *, ...); __attribute__((noreturn)) void die(char *, ...); uint32_t get_color(char *); #endif
#ifndef _HELPERS_H #define _HELPERS_H #include <stdarg.h> #include <stdio.h> #include <stdint.h> #define LENGTH(x) (sizeof(x) / sizeof(*x)) #define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B)) #define BOOLSTR(A) ((A) ? "true" : "false") #define MAXLEN 256 #define XCB_CONFIG_WINDOW_X_Y_WIDTH_HEIGHT XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT #define XCB_CONFIG_WINDOW_X_Y XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y #ifdef DEBUG # define PUTS(x) puts(x) # define PRINTF(x,...) printf(x, __VA_ARGS__) #else # define PUTS(x) ((void)0) # define PRINTF(x,...) ((void)0) #endif void logmsg(FILE *, char *, va_list); void warn(char *, ...); __attribute__((noreturn)) void die(char *, ...); uint32_t get_color(char *); #endif
Add new example based on set and word counts.
#include <stdio.h> #include "m-string.h" #include "m-dict.h" /* program that reads text from standard-input, and prints the total number of distinct words found in the text. */ DICT_SET_DEF2(str, string_t, STRING_OPLIST) int main(void) { M_LET(word, STRING_OPLIST) M_LET(wordcount, DICT_SET_OPLIST(str, STRING_OPLIST)) { while (string_fget_word(word, " \t\n,.!;:?", stdin)) dict_str_set_at(wordcount, word); printf ("Words: %lu\n", dict_str_size(wordcount)); } }
Use C99 stdint types, update prototypes.
#ifndef _RMD160_H_ #define _RMD160_H_ typedef struct { unsigned int rmd[5]; unsigned char buf[64]; unsigned int nbuf; } rmd160_context; void rmd160_init(rmd160_context *ctx); void rmd160_update(rmd160_context *ctx, const void *data, unsigned len); void rmd160_final(rmd160_context *ctx, void *digest); void rmd160_hash(const void *input, unsigned len, void *digest); // digest must be 20 bytes #endif /* !_RMD160_H_ */
#ifndef _RMD160_H_ #define _RMD160_H_ #include <stdint.h> typedef struct { uint64_t len; uint32_t rmd[5]; uint8_t buf[64]; uint32_t nbuf; } rmd160_context; void rmd160_init(rmd160_context *ctx); void rmd160_update(rmd160_context *ctx, const void *data, unsigned nbytes); void rmd160_final(rmd160_context *ctx, unsigned char digest[20]); void rmd160_hash(const void *input, unsigned len, unsigned char digest[20]); #endif /* !_RMD160_H_ */
Remove unused (and deprecated) declaration.
#ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H typedef struct _Status Status; typedef struct _Config Config; struct _Status { Evas_List *frequencies; Evas_List *governors; int cur_frequency; int can_set_frequency; char *cur_governor; unsigned char active; }; struct _Config { /* saved * loaded config values */ double poll_time; int restore_governor; const char *governor; /* just config state */ E_Module *module; Evas_List *instances; E_Menu *menu; E_Menu *menu_poll; E_Menu *menu_governor; E_Menu *menu_frequency; Status *status; char *set_exe_path; Ecore_Timer *frequency_check_timer; }; EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); EAPI int e_modapi_about (E_Module *m); #endif
#ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H typedef struct _Status Status; typedef struct _Config Config; struct _Status { Evas_List *frequencies; Evas_List *governors; int cur_frequency; int can_set_frequency; char *cur_governor; unsigned char active; }; struct _Config { /* saved * loaded config values */ double poll_time; int restore_governor; const char *governor; /* just config state */ E_Module *module; Evas_List *instances; E_Menu *menu; E_Menu *menu_poll; E_Menu *menu_governor; E_Menu *menu_frequency; Status *status; char *set_exe_path; Ecore_Timer *frequency_check_timer; }; EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); #endif
Fix C program - Leds were not toggling anymore
#include "nrf_delay.h" #include "nrf_gpio.h" int main(void){ nrf_gpio_range_cfg_output(21,22); while(1){ nrf_gpio_pin_write(21,1); nrf_gpio_pin_write(22,1); nrf_delay_ms(80); nrf_gpio_pin_write(21, 1); nrf_gpio_pin_write(22, 1); nrf_delay_ms(80); } }
#include "nrf_delay.h" #include "nrf_gpio.h" int main(void){ nrf_gpio_range_cfg_output(21,22); while(1){ nrf_gpio_pin_write(21,1); nrf_gpio_pin_write(22,0); nrf_delay_ms(80); nrf_gpio_pin_write(21, 0); nrf_gpio_pin_write(22, 1); nrf_delay_ms(80); } }
Add stub for legal notice.
#include "common.h" #include "arguments.h" TCHAR *get_version(void) { return _T("HostKit Agent PREALPHA\nCompiled at ") __TIME__ _T(" on ") __DATE__ _T("\n"); } int _tmain(int argc, TCHAR *argv[]) { int result; initialize_arguments(); if(parse_arguments(argv) != ARGS_OK || arguments.error) { _tprintf(_T("%s"), get_help()); quit(); } if(arguments.debug) { _ftprintf(stderr, _T("Debug log is enabled.\n")); } if(arguments.version == TRUE) { _tprintf(_T("%s"), get_version()); quit(); } if(arguments.service == TRUE) { result = servicize(); if(result != 0) { _ftprintf(stderr, _T("Unable to install as service.\n")); } quit(); } if(arguments.persistent == TRUE) { result = persist(); if(result != 0) { _ftprintf(stderr, _T("An occurred when running persistent.\n")); } quit(); } return 0; }
#include "common.h" #include "arguments.h" TCHAR *get_version(void) { return _T("HostKit Agent PREALPHA\nCompiled at ") __TIME__ _T(" on ") __DATE__ _T("\n"); } TCHAR *get_copyright(void) { return _T(""); } int _tmain(int argc, TCHAR *argv[]) { int result; initialize_arguments(); if(parse_arguments(argv) != ARGS_OK || arguments.error) { _tprintf(_T("%s"), get_help()); quit(); } if(arguments.debug) { _ftprintf(stderr, _T("Debug log is enabled.\n")); } if(arguments.version == TRUE) { _tprintf(_T("%s"), get_version()); _tprintf(_T("%s"), get_copyright()); quit(); } if(arguments.service == TRUE) { result = servicize(); if(result != 0) { _ftprintf(stderr, _T("Unable to install as service.\n")); } quit(); } if(arguments.persistent == TRUE) { result = persist(); if(result != 0) { _ftprintf(stderr, _T("An occurred when running persistent.\n")); } quit(); } return 0; }
Reorder UART transmission. Instead of waiting for cache to be empty and then sending the value, we first add the value to cache and then wait for transmission. This way no characters are lost during transmission
#include "uart.h" void uart_putchar(char c, FILE *stream) { if( c == '\n' ) uart_putchar( '\r', stream ); UDR0 = c; loop_until_bit_is_set(UCSR0A, TXC0); } static FILE uart_out = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); void uart_init(void) { UBRR0L = BAUDRATE&0xFF; UBRR0H = (BAUDRATE>>8); #if USE_2X UCSR0A |= _BV(U2X0); #else UCSR0A &= ~(_BV(U2X0)); #endif UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ stdout = &uart_out; }
#include "uart.h" void uart_putchar(char c, FILE *stream) { if( c == '\n' ) uart_putchar('\r', stream); loop_until_bit_is_set(UCSR0A, UDRE0); UDR0 = c; } static FILE uart_out = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); void uart_init(void) { UBRR0L = BAUDRATE&0xFF; UBRR0H = (BAUDRATE>>8); #if USE_2X UCSR0A |= _BV(U2X0); #else UCSR0A &= ~(_BV(U2X0)); #endif UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ stdout = &uart_out; }
Fix memory leak on regexp module load
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <haka/error.h> #include <haka/regexp_module.h> struct regexp_module *regexp_module_load(const char *module_name, struct parameters *args) { struct module *module = module_load(module_name, args); if (module == NULL || module->type != MODULE_REGEXP) { error(L"Module %s is not of type MODULE_REGEXP", module_name); return NULL; } return (struct regexp_module *)module; }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <haka/error.h> #include <haka/regexp_module.h> struct regexp_module *regexp_module_load(const char *module_name, struct parameters *args) { struct module *module = module_load(module_name, args); if (module == NULL || module->type != MODULE_REGEXP) { if (module != NULL) module_release(module); error(L"Module %s is not of type MODULE_REGEXP", module_name); return NULL; } return (struct regexp_module *)module; }
Fix the declaration of Cursor on Linux
// Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #pragma once #include <X11/keysym.h> #include <X11/XKBlib.h> #include <X11/cursorfont.h> #include <X11/X.h> #include "input/Input.h" namespace ouzel { class Engine; namespace input { class InputLinux: public Input { friend Engine; public: static KeyboardKey convertKeyCode(KeySym keyCode); static uint32_t getModifiers(unsigned int state); virtual ~InputLinux(); virtual void setCursorVisible(bool visible) override; virtual bool isCursorVisible() const override; virtual void setCursorLocked(bool locked) override; virtual bool isCursorLocked() const override; virtual void setCursorPosition(const Vector2& position) override; protected: InputLinux(); virtual bool init() override; bool cursorVisible = true; bool cursorLocked = false; Cursor emptyCursor = None; }; } // namespace input } // namespace ouzel
// Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #pragma once #include <X11/keysym.h> #include <X11/XKBlib.h> #include <X11/cursorfont.h> #include <X11/X.h> #include "input/Input.h" namespace ouzel { class Engine; namespace input { class InputLinux: public Input { friend Engine; public: static KeyboardKey convertKeyCode(KeySym keyCode); static uint32_t getModifiers(unsigned int state); virtual ~InputLinux(); virtual void setCursorVisible(bool visible) override; virtual bool isCursorVisible() const override; virtual void setCursorLocked(bool locked) override; virtual bool isCursorLocked() const override; virtual void setCursorPosition(const Vector2& position) override; protected: InputLinux(); virtual bool init() override; bool cursorVisible = true; bool cursorLocked = false; ::Cursor emptyCursor = None; }; } // namespace input } // namespace ouzel
Fix signed vs unsigned issue
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_FLIP_FLIP_BITMASKS_H_ #define NET_FLIP_FLIP_BITMASKS_H_ namespace flip { const int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader const int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader const int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME const int kLengthMask = 0xffffff; // Mask the lower 24 bits. } // flip #endif // NET_FLIP_FLIP_BITMASKS_H_
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_FLIP_FLIP_BITMASKS_H_ #define NET_FLIP_FLIP_BITMASKS_H_ namespace flip { const unsigned int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader const unsigned int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader const unsigned int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME const unsigned int kLengthMask = 0xffffff; // Mask the lower 24 bits. } // flip #endif // NET_FLIP_FLIP_BITMASKS_H_
Mark Devcoin release version 0.8.7.0.
#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 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 7 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source #define COPYRIGHT_YEAR 2014 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X #endif // CLIENTVERSION_H
Fix filesmodes multiple-inc and backslash-eof
#define FILEMODES \ X(preproc, "c", 'i') \ X(compile, "cpp-output", 's') \ X(assemb, "assembler", 'o') \ ALIAS(assemb, "asm") \ X(assemb_with_cpp, "assembler-with-cpp", 'o') \ ALIAS(assemb_with_cpp, "asm-with-cpp") \
#ifndef FILEMODES_H #define FILEMODES_H #define FILEMODES \ X(preproc, "c", 'i') \ X(compile, "cpp-output", 's') \ X(assemb, "assembler", 'o') \ ALIAS(assemb, "asm") \ X(assemb_with_cpp, "assembler-with-cpp", 'o') \ ALIAS(assemb_with_cpp, "asm-with-cpp") #endif
Fix class name spelling in class rule
// Author: Jakob Blomer CERN 10/2018 /************************************************************************* * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifdef __CLING__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ nestedtypedefs; #pragma link C++ nestedclasses; // Support for auto-loading in the RNTuple tutorials #pragma link C++ class ROOT::Experimental::Detail::RFieldBase-; #pragma link C++ class ROOT::Experimental::Detail::RFieldBase::RSchemaIterator-; #pragma link C++ class ROOT::Experimental::RFieldVector-; #pragma link C++ class ROOT::Experimental::RNTupleReader-; #pragma link C++ class ROOT::Experimental::RNTupleWriter-; #pragma link C++ class ROOT::Experimental::RNTupleModel-; #pragma link C++ class ROOT::Experimental::RNTuple+; #endif
// Author: Jakob Blomer CERN 10/2018 /************************************************************************* * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifdef __CLING__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ nestedtypedefs; #pragma link C++ nestedclasses; // Support for auto-loading in the RNTuple tutorials #pragma link C++ class ROOT::Experimental::Detail::RFieldBase-; #pragma link C++ class ROOT::Experimental::Detail::RFieldBase::RSchemaIterator-; #pragma link C++ class ROOT::Experimental::RVectorField-; #pragma link C++ class ROOT::Experimental::RNTupleReader-; #pragma link C++ class ROOT::Experimental::RNTupleWriter-; #pragma link C++ class ROOT::Experimental::RNTupleModel-; #pragma link C++ class ROOT::Experimental::RNTuple+; #endif
Debug failing test on PPC bot
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s #include "test.h" int var; void *Thread(void *x) { pthread_exit(&var); return 0; } int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); void *retval = 0; pthread_join(t, &retval); if (retval != &var) { fprintf(stderr, "Unexpected return value\n"); exit(1); } fprintf(stderr, "PASS\n"); return 0; } // CHECK-NOT: WARNING: ThreadSanitizer: // CHECK: PASS
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 // | FileCheck %s #include "test.h" int var; void *Thread(void *x) { fprintf(stderr, "Thread\n"); pthread_exit(&var); return 0; } int main() { fprintf(stderr, "MAIN\n"); pthread_t t; pthread_create(&t, 0, Thread, 0); void *retval = 0; fprintf(stderr, "JOIN\n"); pthread_join(t, &retval); if (retval != &var) { fprintf(stderr, "Unexpected return value\n"); exit(1); } fprintf(stderr, "PASS\n"); return 0; } // CHECK-NOT: WARNING: ThreadSanitizer: // CHECK: PASS
Add solution to Exercise 1-17.
/* Exercise 1-17: Write a program to print all input lines that are longer * than 80 characters. */ #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #define LINE_LIMIT 80 int main(int argc, char **argv) { uint32_t current_line_length = 0; int32_t buffer[LINE_LIMIT] = { 0 }; bool buffer_in_use = true; int32_t character = 0; while ((character = getchar()) != EOF) { if (character == '\n') { if (current_line_length > LINE_LIMIT) { putchar('\n'); } current_line_length = 0; buffer_in_use = true; } else { current_line_length++; if (current_line_length <= LINE_LIMIT) { buffer[current_line_length - 1] = character; } else { if (buffer_in_use == true) { uint32_t i; for (i = 0; i < LINE_LIMIT; ++i) { putchar(buffer[i]); } buffer_in_use = false; } putchar(character); } } } return EXIT_SUCCESS; }
Fix for short file names
/* Copyright (c) 2008-2019 the MRtrix3 contributors. * * 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/. * * Covered Software is provided under this License on an "as is" * basis, without warranty of any kind, either expressed, implied, or * statutory, including, without limitation, warranties that the * Covered Software is free of defects, merchantable, fit for a * particular purpose or non-infringing. * See the Mozilla Public License v. 2.0 for more details. * * For more details, see http://www.mrtrix.org/. */ #include <string> #include "types.h" namespace MR { namespace Formats { /*! basic convenience function to determine whether an image path * corresponds to a NIfTI-format image. */ inline bool is_nifti (const std::string& path) { static const vector<std::string> exts { ".nii", ".nii.gz", ".img" }; for (const auto& ext : exts) { if (path.substr (path.size() - ext.size()) == ext) return true; } return false; } } }
/* Copyright (c) 2008-2019 the MRtrix3 contributors. * * 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/. * * Covered Software is provided under this License on an "as is" * basis, without warranty of any kind, either expressed, implied, or * statutory, including, without limitation, warranties that the * Covered Software is free of defects, merchantable, fit for a * particular purpose or non-infringing. * See the Mozilla Public License v. 2.0 for more details. * * For more details, see http://www.mrtrix.org/. */ #include <string> #include "types.h" namespace MR { namespace Formats { /*! basic convenience function to determine whether an image path * corresponds to a NIfTI-format image. */ inline bool is_nifti (const std::string& path) { static const vector<std::string> exts { ".nii", ".nii.gz", ".img" }; for (const auto& ext : exts) { if (path.size() >= ext.size() && path.substr (path.size() - ext.size()) == ext) return true; } return false; } } }
Fix incorrect const pointer marking.
#pragma once #include "ffmpeg.h" #include <stddef.h> #include <stdint.h> struct Meta { char const* title; char const* artist; }; struct Meta retrieve_meta(AVFormatContext* ctx);
#pragma once #include "ffmpeg.h" #include <stddef.h> #include <stdint.h> struct Meta { const char const* title; const char const* artist; }; struct Meta retrieve_meta(AVFormatContext* ctx);
Remove wrong override for wantHandleItem
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual QString name() const = 0; virtual int wantHandleItem(const ModelNode &modelNode) const QTC_OVERRIDE = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
#ifndef QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #define QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H #include "abstractformeditortool.h" namespace QmlDesigner { class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool { public: AbstractCustomTool(); void selectedItemsChanged(const QList<FormEditorItem *> &itemList) QTC_OVERRIDE; virtual QString name() const = 0; virtual int wantHandleItem(const ModelNode &modelNode) const = 0; }; } // namespace QmlDesigner #endif // QMLDESIGNER_ABSTRACTSINGLESELECTIONTOOL_H
Fix this regex to match what llvmgcc4 produces also
// RUN: %llvmgcc -xc %s -S -o - | grep 'ctor_.* constant ' // The synthetic global made by the CFE for big initializer should be marked // constant. void bar(); void foo() { char Blah[] = "asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd"; bar(Blah); }
// RUN: %llvmgcc -xc %s -S -o - | grep 'internal constant ' // The synthetic global made by the CFE for big initializer should be marked // constant. void bar(); void foo() { char Blah[] = "asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd"; bar(Blah); }
Fix build breakage from a typo. Change: 111528530
q /* Copyright 2015 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_ #define TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_ // IWYU pragma: private, include "third_party/tensorflow/core/platform/stream_executor_util.h" // IWYU pragma: friend third_party/tensorflow/core/platform/stream_executor_util.h #include "tensorflow/stream_executor/lib/status.h" namespace tensorflow { namespace gpu = ::perftools::gputools; // On the open-source platform, stream_executor currently uses // tensorflow::Status inline Status FromStreamExecutorStatus( const perftools::gputools::port::Status& s) { return s; } } // namespace tensorflow #endif // TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_
/* Copyright 2015 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_ #define TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_ // IWYU pragma: private, include "third_party/tensorflow/core/platform/stream_executor_util.h" // IWYU pragma: friend third_party/tensorflow/core/platform/stream_executor_util.h #include "tensorflow/stream_executor/lib/status.h" namespace tensorflow { namespace gpu = ::perftools::gputools; // On the open-source platform, stream_executor currently uses // tensorflow::Status inline Status FromStreamExecutorStatus( const perftools::gputools::port::Status& s) { return s; } } // namespace tensorflow #endif // TENSORFLOW_PLATFORM_DEFAULT_STREAM_EXECUTOR_UTIL_H_
Add printing of distribution to catch.hpp integration
#pragma once #include <rapidcheck.h> #include <sstream> namespace rc { /// For use with `catch.hpp`. Use this function wherever you would use a /// `SECTION` for convenient checking of properties. /// /// @param description A description of the property. /// @param testable The object that implements the property. template <typename Testable> void prop(const std::string &description, Testable &&testable) { using namespace detail; SECTION(description) { const auto result = checkTestable(std::forward<Testable>(testable)); std::ostringstream ss; printResultMessage(result, ss); INFO(ss.str() << "\n"); if (!result.template is<SuccessResult>()) { FAIL(); } } } } // namespace rc
#pragma once #include <rapidcheck.h> #include <sstream> namespace rc { /// For use with `catch.hpp`. Use this function wherever you would use a /// `SECTION` for convenient checking of properties. /// /// @param description A description of the property. /// @param testable The object that implements the property. template <typename Testable> void prop(const std::string &description, Testable &&testable) { using namespace detail; SECTION(description) { const auto result = checkTestable(std::forward<Testable>(testable)); if (result.template is<SuccessResult>()) { const auto success = result.template get<SuccessResult>(); if (!success.distribution.empty()) { std::cout << "- " << description << std::endl; printResultMessage(result, std::cout); std::cout << std::endl; } } else { std::ostringstream ss; printResultMessage(result, ss); INFO(ss.str() << "\n"); FAIL(); } } } } // namespace rc
Fix my stupid error :/
#ifndef FIRMLAUNCH_H #define FIRMLAUNCH_H #include "types.h" int firm_setup(u32* FIRM, void* N3DSKey1, void* N3DSKey2); void firmlaunch(u32* FIRM); int patch(u32* FIRM, u32* search_size, u8* pattern, u8* patch_data, u32 pattern_size, u32 patch_size); #endif
#ifndef FIRMLAUNCH_H #define FIRMLAUNCH_H #include "types.h" int firm_setup(u32* FIRM, void* N3DSKey1, void* N3DSKey2); void firmlaunch(u32* FIRM); int patch(u32* FIRM, u32 search_size, u8* pattern, u8* patch_data, u32 pattern_size, u32 patch_size); #endif
Implement the inverse cosine function.
#include <pal.h> /** * * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input * values to acos must be in the range -1 to 1. The result values are in the * range 0 to pi. The function does not check for illegal input values. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ #include <math.h> void p_acos_f32(const float *a, float *c, int n) { int i; for (i = 0; i < n; i++) { *(c + i) = acosf(*(a + i)); } }
#include <math.h> #include <pal.h> static const float pi_2 = (float) M_PI / 2.f; /** * * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input * values to acos must be in the range -1 to 1. The result values are in the * range 0 to pi. The function does not check for illegal input values. * * @param a Pointer to input vector * * @param c Pointer to output vector * * @param n Size of 'a' and 'c' vector. * * @return None * */ void p_acos_f32(const float *a, float *c, int n) { int i; float tmp; /* acos x = pi/2 - asin x */ p_asin_f32(a, c, n); for (i = 0; i < n; i++) { tmp = pi_2 - c[i]; c[i] = tmp; } }
Add const modifier to post and put method of DataStore
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <stack> #include <memory> #include "task_typedefs.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { public: Transaction && begin(); static DataStore& get(); // Modifying methods void post(TaskId, SerializedTask&); void put(TaskId, SerializedTask&); void erase(TaskId); std::vector<SerializedTask> getAllTask(); void notify(); private: bool isServing = false; std::shared_ptr<Transaction> activeTransaction; std::stack<std::shared_ptr<Transaction> > transactionStack; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
#pragma once #ifndef YOU_DATASTORE_DATASTORE_H_ #define YOU_DATASTORE_DATASTORE_H_ #include <stack> #include <memory> #include "task_typedefs.h" #include "transaction.h" namespace You { namespace DataStore { namespace UnitTests {} class DataStore { public: Transaction && begin(); static DataStore& get(); // Modifying methods void post(TaskId, const SerializedTask&); void put(TaskId, const SerializedTask&); void erase(TaskId); std::vector<SerializedTask> getAllTask(); void notify(); private: bool isServing = false; std::shared_ptr<Transaction> activeTransaction; std::stack<std::shared_ptr<Transaction> > transactionStack; }; } // namespace DataStore } // namespace You #endif // YOU_DATASTORE_DATASTORE_H_
Correct the project for the move
#import <Foundation/Foundation.h> #import "OCDSpec/Protocols/DescriptionRunner.h" #import "OCDSpec/OCDSpecDescription.h" #import "OCDSpec/OCDSpecSharedResults.h" #import "OCDSpec/AbstractDescriptionRunner.h" @interface OCDSpecDescriptionRunner : NSObject { Class *classes; int classCount; id specProtocol; id baseClass; int successes; int failures; } @property(nonatomic, assign) id specProtocol; @property(nonatomic, assign) id baseClass; @property(readonly) int successes; @property(readonly) int failures; -(void) runAllDescriptions; @end #define CONTEXT(classname) \ void descriptionOf##classname();\ @interface TestRunner##classname : AbstractDescriptionRunner \ @end\ @implementation TestRunner##classname\ +(int) getFailures \ { \ return [[OCDSpecSharedResults sharedResults].failures intValue];\ } \ +(int)getSuccesses \ { \ return [[OCDSpecSharedResults sharedResults].successes intValue];\ } \ +(void) run \ { \ descriptionOf##classname(); \ } \ @end \ void descriptionOf##classname()
#import <Foundation/Foundation.h> #import "OCDSpec/Protocols/DescriptionRunner.h" #import "OCDSpec/OCDSpecDescription.h" #import "OCDSpec/OCDSpecSharedResults.h" #import "OCDSpec/Abstract/AbstractDescriptionRunner.h" @interface OCDSpecDescriptionRunner : NSObject { Class *classes; int classCount; id specProtocol; id baseClass; int successes; int failures; } @property(nonatomic, assign) id specProtocol; @property(nonatomic, assign) id baseClass; @property(readonly) int successes; @property(readonly) int failures; -(void) runAllDescriptions; @end #define CONTEXT(classname) \ void descriptionOf##classname();\ @interface TestRunner##classname : AbstractDescriptionRunner \ @end\ @implementation TestRunner##classname\ +(int) getFailures \ { \ return [[OCDSpecSharedResults sharedResults].failures intValue];\ } \ +(int)getSuccesses \ { \ return [[OCDSpecSharedResults sharedResults].successes intValue];\ } \ +(void) run \ { \ descriptionOf##classname(); \ } \ @end \ void descriptionOf##classname()
Fix Py_Logger to raise instances of Exception instead of strings
#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
#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
Add custom data role MidiValues
#ifndef ENUMS_H #define ENUMS_H #include <QtCore> enum MidiDataRole { MidiValueType = Qt::UserRole + 1, MidiValueMin, MidiValueMax }; enum MidiType { DefaultType, NoteType, ToggleType, StringType, ChannelType }; #endif
#ifndef ENUMS_H #define ENUMS_H #include <QtCore> enum MidiDataRole { MidiValueType = Qt::UserRole + 1, MidiValueMin, MidiValueMax, MidiValues }; enum MidiType { DefaultType, NoteType, ToggleType, StringType, ChannelType }; #endif
Convert from MPI_Send/Recv, to MPI_ISend/IRecv
#include <stdio.h> #include <mpi.h> #include "hello_mpi.h" int hello_mpi(void) { int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); // printf("Process %d on %s out of %d\n", rank, processor_name, numprocs); if (rank == 0) { printf("I'm master\n"); int slaves_rank = -1; int i; struct MPI_Status status; for (i = 1; i < numprocs; i++) { MPI_Recv(&slaves_rank, 1, MPI_INT, i,10111, MPI_COMM_WORLD, &status); printf("Master got reply from %d and status is: %d\n", slaves_rank, status.MPI_ERROR); } } else { printf("Only a slave\n"); MPI_Send((void*)&rank, 1, MPI_INT, 0, 10111, MPI_COMM_WORLD); } MPI_Finalize(); return 0; }
#include <stdio.h> #include <mpi.h> #include <unistd.h> #include "hello_mpi.h" int hello_mpi(void) { int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); // printf("Process %d on %s out of %d\n", rank, processor_name, numprocs); if (rank == 0) { printf("I'm master\n"); int slaves_rank = -1; int i; MPI_Status status; MPI_Request request; for (i = 1; i < numprocs; i++) { MPI_Irecv(&slaves_rank, 1, MPI_INT, i, 10111, MPI_COMM_WORLD, &request); MPI_Wait(&request, &status); printf("Master got reply from %d and request is: %d\n", slaves_rank, request); } } else { MPI_Request request; MPI_Isend((void*)&rank, 1, MPI_INT, 0, 10111, MPI_COMM_WORLD, &request); printf("Only a slave - with request %d\n", request); } MPI_Finalize(); return 0; }