text
stringlengths
4
6.14k
/* * Copyright 2014, General Dynamics C4 Systems * * This software may be distributed and modified according to the terms of * the GNU General Public License version 2. Note that NO WARRANTY is provided. * See "LICENSE_GPLv2.txt" for details. * * @TAG(GD_GPL) */ #ifndef __ARCH_KERNEL_LOCK_H #define __ARCH_KERNEL_LOCK_H #include <config.h> #ifdef CONFIG_PRINTING #include <types.h> typedef uint32_t lock_t; /* global spinlocks */ extern lock_t lock_debug; /* acquire/release lock */ static inline void lock_acquire(lock_t* lock) { asm volatile ( "1: \n" "movl $1, %%eax \n" "xchgl (%0), %%eax \n" "testl %%eax, %%eax \n" "jnz 1b \n" : : "r"(lock) : "%eax", "cc", "memory" ); } static inline void lock_release(lock_t* lock) { *lock = 0; } #endif /* CONFIG_PRINTING */ #endif
/* ChecksumHash.h - Checksum Hashing * * Author : Alexander J. Yee * Date Created : 12/26/2010 * Last Modified : 07/14/2014 * * The prime number used for this hash is 2^61 - 1. * * This file is intentionally lightweight since it's used in a lot of headers. * */ #pragma once #ifndef ymp_ChecksumHash_H #define ymp_ChecksumHash_H //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // Dependencies #include "PublicLibs/CompilerSettings.h" #include "PublicLibs/Types.h" namespace ymp{ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// class hash_t{ public: static const u64_t PRIME = 0x1fffffffffffffffull; public: YM_FORCE_INLINE hash_t() = default; YM_FORCE_INLINE hash_t(int x); YM_FORCE_INLINE hash_t(u32_t x); YM_FORCE_INLINE hash_t(u64_t x); public: YM_FORCE_INLINE u64_t value() const; public: friend bool operator==(hash_t a, hash_t b); friend bool operator!=(hash_t a, hash_t b); friend hash_t operator+(hash_t a); friend hash_t operator-(hash_t a); friend hash_t operator+(hash_t a, hash_t b); friend hash_t operator-(hash_t a, hash_t b); friend hash_t operator*(hash_t a, hash_t b); friend hash_t operator^(hash_t a, uiL_t pow); friend hash_t operator^(hash_t a, siL_t pow); void operator+=(hash_t b); void operator-=(hash_t b); void operator*=(hash_t b); void operator^=(uiL_t pow); void operator^=(siL_t pow); template <typename wtype> static hash_t word_power(siL_t pow); private: YM_FORCE_INLINE hash_t(u64_t x, void*) : m_hash(x) {} static u64_t reduce(u64_t x); static u64_t reduce(s64_t x); static u64_t reduce(u64_t L, u64_t H); private: // This internal hash is not fully reduced modulo 2^61 - 1. // But it is guaranteed to be inside the range [0, 2^63). u64_t m_hash; friend hash_t bp_hash(hash_t hash_in, const u32_t* T, upL_t L); friend hash_t bp_hash(hash_t hash_in, const u64_t* T, upL_t L); friend hash_t bp_hash_radix(hash_t hash_in, u32_t radix, const u32_t* T, upL_t L); friend hash_t bp_hash_radix(hash_t hash_in, u64_t radix, const u64_t* T, upL_t L); }; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // Implementations YM_FORCE_INLINE hash_t::hash_t(int x) : m_hash(x >= 0 ? x : x + PRIME) {} YM_FORCE_INLINE hash_t::hash_t(u32_t x) : m_hash(x) {} YM_FORCE_INLINE hash_t::hash_t(u64_t x) : m_hash(reduce(x)) {} YM_FORCE_INLINE u64_t hash_t::value() const{ u64_t x = reduce(m_hash); return x == PRIME ? 0 : x; } YM_FORCE_INLINE u64_t hash_t::reduce(u64_t x){ // Reduce any unsigned 64-bit integer into the range [0, 2^61 + 7). return (x >> 61) + (x & PRIME); } YM_FORCE_INLINE u64_t hash_t::reduce(s64_t x){ // Reduce any signed 64-bit integer into the range [-4, 2^61 + 3). return (x >> 61) + ((u64_t)x & PRIME); } YM_FORCE_INLINE u64_t hash_t::reduce(u64_t L, u64_t H){ L = (L >> 61) + (L & PRIME); L += H >> 58; L += (H << 3) & PRIME; return L; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// YM_FORCE_INLINE bool operator==(hash_t a, hash_t b){ return a.value() == b.value(); } YM_FORCE_INLINE bool operator!=(hash_t a, hash_t b){ return a.value() != b.value(); } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// YM_FORCE_INLINE hash_t operator+(hash_t a){ return a; } YM_FORCE_INLINE hash_t operator-(hash_t a){ return hash_t::reduce((u64_t)(0xfffffffffffffff8ull - a.m_hash)); } YM_FORCE_INLINE hash_t operator+(hash_t a, hash_t b){ a += b; return a; } YM_FORCE_INLINE hash_t operator-(hash_t a, hash_t b){ a -= b; return a; } YM_FORCE_INLINE hash_t operator*(hash_t a, hash_t b){ a *= b; return a; } YM_FORCE_INLINE hash_t operator^(hash_t a, uiL_t pow){ a ^= pow; return a; } YM_FORCE_INLINE hash_t operator^(hash_t a, siL_t pow){ a ^= pow; return a; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// YM_FORCE_INLINE void hash_t::operator+=(hash_t b){ m_hash = reduce(m_hash + b.m_hash); } YM_FORCE_INLINE void hash_t::operator-=(hash_t b){ m_hash = reduce((s64_t)m_hash - (s64_t)b.m_hash) + PRIME; } YM_FORCE_INLINE void hash_t::operator^=(siL_t pow){ if (pow < 0){ pow += PRIME - 1; } *this ^= (uiL_t)pow; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// } #endif
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Alessandro Tasora, Radu Serban, Rainer Gericke // ============================================================================= // // 2WD driveline model template based on ChShaft objects. This template can be // used to model either a FWD or a RWD driveline. // // ============================================================================= #ifndef CH_SHAFTS_DRIVELINE_2WD_H #define CH_SHAFTS_DRIVELINE_2WD_H #include "chrono_vehicle/ChApiVehicle.h" #include "chrono_vehicle/wheeled_vehicle/ChDrivelineWV.h" #include "chrono/physics/ChShaftsBody.h" #include "chrono/physics/ChShaftsClutch.h" #include "chrono/physics/ChShaftsGear.h" #include "chrono/physics/ChShaftsGearboxAngled.h" #include "chrono/physics/ChShaftsMotor.h" #include "chrono/physics/ChShaftsPlanetary.h" #include "chrono/physics/ChShaftsTorque.h" namespace chrono { namespace vehicle { /// @addtogroup vehicle_wheeled_driveline /// @{ /// 2WD driveline model template based on ChShaft objects. This template can be /// used to model either a FWD or a RWD driveline. class CH_VEHICLE_API ChShaftsDriveline2WD : public ChDrivelineWV { public: ChShaftsDriveline2WD(const std::string& name); virtual ~ChShaftsDriveline2WD() {} /// Get the name of the vehicle subsystem template. virtual std::string GetTemplateName() const override { return "ShaftsDriveline2WD"; } /// Set the direction of the motor block. /// This direction is a unit vector, relative to the chassis frame (for the /// ISO coordinate system, this is [1, 0, 0] for a longitudinal engine and /// [0, 1, 0] for a transversal engine). void SetMotorBlockDirection(const ChVector<>& dir) { m_dir_motor_block = dir; } /// Set the direction of the wheel axles. /// This direction is a unit vector, relative to the chassis frame. It must be /// specified for the design configuration (for the ISO vehicle coordinate /// system, this is typically [0, 1, 0]). void SetAxleDirection(const ChVector<>& dir) { m_dir_axle = dir; } /// Lock/unlock the differential on the specified axle. /// Differential locking is implemented through a friction torque between the output shafts /// of the differential. The locking effect is limited by a maximum locking torque. /// This function ignores the argument 'axle' and locks/unlocks its one and only differential. virtual void LockAxleDifferential(int axle, bool lock) override; virtual void LockCentralDifferential(int which, bool lock) override; /// Return the number of driven axles. /// A ChShaftsDriveline2WD driveline connects to a single axle. virtual int GetNumDrivenAxles() const final override { return 1; } /// Initialize the driveline subsystem. /// This function connects this driveline subsystem to the specified axle subsystems. virtual void Initialize(std::shared_ptr<ChChassis> chassis, ///< associated chassis subsystem const ChAxleList& axles, ///< list of all vehicle axle subsystems const std::vector<int>& driven_axles ///< indexes of the driven vehicle axles ) override; /// Get the motor torque to be applied to the specified spindle. virtual double GetSpindleTorque(int axle, VehicleSide side) const override; protected: /// Return the inertia of the driveshaft. virtual double GetDriveshaftInertia() const = 0; /// Return the inertia of the differential box. virtual double GetDifferentialBoxInertia() const = 0; /// Return the gear ratio for the conical gear. virtual double GetConicalGearRatio() const = 0; /// Return the gear ratio for the differential. virtual double GetDifferentialRatio() const = 0; /// Return the limit for the axle differential locking torque. virtual double GetAxleDifferentialLockingLimit() const = 0; private: std::shared_ptr<ChShaftsGearboxAngled> m_conicalgear; std::shared_ptr<ChShaft> m_differentialbox; std::shared_ptr<ChShaftsPlanetary> m_differential; std::shared_ptr<ChShaftsClutch> m_clutch; ChVector<> m_dir_motor_block; ChVector<> m_dir_axle; }; /// @} vehicle_wheeled_driveline } // end namespace vehicle } // end namespace chrono #endif
/* * Copyright (c) 2010 Dariusz Gadomski <dgadomski@gmail.com> * 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. * * 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 HOLDER 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. */ #ifndef NETSERIALIZER_H_ #define NETSERIALIZER_H_ #include <neural/neuralnet.h> #include <neural/layer.h> #include <string> #include <boost/shared_ptr.hpp> namespace models { namespace neural { class NetSerializer { public: NetSerializer(); virtual ~NetSerializer(); void saveToFile(const boost::shared_ptr<NeuralNet>& net, const std::string& filename); NeuralNet * loadFromFile(const std::string& filename); private: std::string getFieldValue(const std::string & line); boost::shared_ptr<Layer> createNewLayer(Layer::LayerType layerType, size_t numNeurons, const std::string& layerName); }; } } #endif /* NETSERIALIZER_H_ */
#ifndef INSTALL_H #define INSTALL_H void for_install_output(void); void for_output_set_log(int l); #endif
#pragma once #include "core/node.h" class DeepFlowDllExport GaborKernel : public Node { public: GaborKernel(deepflow::NodeParam *param); int minNumInputs() override { return 0; } int minNumOutputs() override { return 1; } std::string op_name() const override { return "gabor_kernel"; } void init() override; void forward() override; void backward() override; std::string to_cpp() const; private: void generate(); int _window_size; int _num_output_channels; int _num_orientations; int _num_scales; float *_d_orientations = nullptr; float *_d_scales = nullptr; float _sigma; float _phi; bool _apply_scale; };
/* ****************************************************************************** *\ INTEL CORPORATION PROPRIETARY INFORMATION This software is supplied under the terms of a license agreement or nondisclosure agreement with Intel Corporation and may not be copied or disclosed except in accordance with the terms of that agreement Copyright(c) 2007-2012 Intel Corporation. All Rights Reserved. File Name: mfxdefs.h \* ****************************************************************************** */ #ifndef __MFXDEFS_H__ #define __MFXDEFS_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if defined( _WIN32 ) || defined ( _WIN64 ) #define __INT64 __int64 #define __UINT64 unsigned __int64 #else #define __INT64 long long #define __UINT64 unsigned long long #endif #define MFX_INFINITE 0xFFFFFFFF typedef unsigned char mfxU8; typedef char mfxI8; typedef short mfxI16; typedef unsigned short mfxU16; typedef unsigned int mfxU32; typedef int mfxI32; #if defined( _WIN32 ) || defined ( _WIN64 ) typedef unsigned long mfxUL32; typedef long mfxL32; #else typedef unsigned int mfxUL32; typedef int mfxL32; #endif typedef float mfxF32; typedef double mfxF64; typedef __UINT64 mfxU64; typedef __INT64 mfxI64; typedef void* mfxHDL; typedef mfxHDL mfxMemId; typedef void* mfxThreadTask; typedef struct { mfxI16 x; mfxI16 y; } mfxI16Pair; typedef struct { mfxHDL first; mfxHDL second; } mfxHDLPair; /*********************************************************************************\ Error message \*********************************************************************************/ typedef enum { /* no error */ MFX_ERR_NONE = 0, /* no error */ /* reserved for unexpected errors */ MFX_ERR_UNKNOWN = -1, /* unknown error. */ /* error codes <0 */ MFX_ERR_NULL_PTR = -2, /* null pointer */ MFX_ERR_UNSUPPORTED = -3, /* undeveloped feature */ MFX_ERR_MEMORY_ALLOC = -4, /* failed to allocate memory */ MFX_ERR_NOT_ENOUGH_BUFFER = -5, /* insufficient buffer at input/output */ MFX_ERR_INVALID_HANDLE = -6, /* invalid handle */ MFX_ERR_LOCK_MEMORY = -7, /* failed to lock the memory block */ MFX_ERR_NOT_INITIALIZED = -8, /* member function called before initialization */ MFX_ERR_NOT_FOUND = -9, /* the specified object is not found */ MFX_ERR_MORE_DATA = -10, /* expect more data at input */ MFX_ERR_MORE_SURFACE = -11, /* expect more surface at output */ MFX_ERR_ABORTED = -12, /* operation aborted */ MFX_ERR_DEVICE_LOST = -13, /* lose the HW acceleration device */ MFX_ERR_INCOMPATIBLE_VIDEO_PARAM = -14, /* incompatible video parameters */ MFX_ERR_INVALID_VIDEO_PARAM = -15, /* invalid video parameters */ MFX_ERR_UNDEFINED_BEHAVIOR = -16, /* undefined behavior */ MFX_ERR_DEVICE_FAILED = -17, /* device operation failure */ MFX_ERR_MORE_BITSTREAM = -18, /* expect more bitstream buffers at output */ /* warnings >0 */ MFX_WRN_IN_EXECUTION = 1, /* the previous asynchrous operation is in execution */ MFX_WRN_DEVICE_BUSY = 2, /* the HW acceleration device is busy */ MFX_WRN_VIDEO_PARAM_CHANGED = 3, /* the video parameters are changed during decoding */ MFX_WRN_PARTIAL_ACCELERATION = 4, /* SW is used */ MFX_WRN_INCOMPATIBLE_VIDEO_PARAM = 5, /* incompatible video parameters */ MFX_WRN_VALUE_NOT_CHANGED = 6, /* the value is saturated based on its valid range */ MFX_WRN_OUT_OF_RANGE = 7, /* the value is out of valid range */ MFX_WRN_FILTER_SKIPPED = 10, /* one of requested filters has been skipped */ /* threading statuses */ MFX_TASK_DONE = MFX_ERR_NONE, /* task has been completed */ MFX_TASK_WORKING = 8, /* there is some more work to do */ MFX_TASK_BUSY = 9 /* task is waiting for resources */ } mfxStatus; #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __MFXDEFS_H__ */
/* $OpenBSD: param.h,v 1.7 1998/08/18 21:28:21 millert Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by TooLs GmbH. * 4. The name of TooLs GmbH may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. */ #ifdef _KERNEL #ifndef _LOCORE #include <machine/cpu.h> #endif /* _LOCORE */ #endif /* * Machine dependent constants for PowerPC (32-bit only currently) */ #define MACHINE "powerpc" #define _MACHINE powerpc #define MACHINE_ARCH "powerpc" #define _MACHINE_ARCH powerpc #define MID_MACHINE 0 /* None but has to be defined */ #define ALIGNBYTES (sizeof(double) - 1) #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) #define PGSHIFT 12 #define NBPG 4096 #define PGOFSET (NBPG - 1) #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1 << DEV_BSHIFT) #define BLKDEV_IOSIZE NBPG #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ #define CLSIZELOG2 0 #define CLSIZE (1 << CLSIZELOG2) #define UPAGES 4 #define USPACE (UPAGES * NBPG) #define KERNBASE 0x100000 /* * Constants related to network buffer management. * MCLBYTES must be no larger than CLBYTES (the software page size), and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. */ #define MSIZE 128 /* size of an mbuf */ #define MCLSHIFT 11 /* convert bytes to m_buf clusters */ #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ #define MCLOFSET (MCLBYTES - 1) #ifndef NMBCLUSTERS #ifdef GATEWAY #define NMBCLUSTERS 2048 /* map size, max cluster allocation */ #else #define NMBCLUSTERS 1024 /* map size, max cluster allocation */ #endif #endif /* * Size of kernel malloc arena in CLBYTES-sized logical pages. */ #ifndef NKMEMCLUSTERS #define NKMEMCLUSTERS (128 * 1024 * 1024 / CLBYTES) #endif /* * pages ("clicks") to disk blocks */ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) /* * bytes to pages */ #define ctob(x) ((x) << PGSHIFT) #define btoc(x) (((x) + PGOFSET) >> PGSHIFT) /* * bytes to disk blocks */ #define dbtob(x) ((x) << DEV_BSHIFT) #define btodb(x) ((x) >> DEV_BSHIFT) /* * Mach derived conversion macros */ #define powerpc_btop(x) ((unsigned)(x) >> PGSHIFT) #define powerpc_ptob(x) ((unsigned)(x) << PGSHIFT) /* * Segment handling stuff */ #define SEGMENT_LENGTH 0x10000000 #define SEGMENT_MASK 0xf0000000 /* * Fixed segments */ #define USER_SR 13 #define KERNEL_SR 14 #define KERNEL_SEGMENT (0xfffff0 + KERNEL_SR) #define EMPTY_SEGMENT 0xfffff0 #define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT)) /* * Some system constants */ #ifndef HTABENTS #define HTABENTS 1024 /* Number of hashslots in HTAB */ #endif #ifndef NPMAPS #define NPMAPS 32768 /* Number of pmaps in system */ #endif /* * Temporary kludge till we do (ov)bcopy in assembler */ #define ovbcopy bcopy
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class edu_vt_cbil_visda_comp_CFMCore */ #ifndef _Included_edu_vt_cbil_visda_comp_CFMCore #define _Included_edu_vt_cbil_visda_comp_CFMCore #ifdef __cplusplus extern "C" { #endif /* * Class: edu_vt_cbil_visda_comp_CFMCore * Method: veCov * Signature: (II[D[D[DD)I */ JNIEXPORT jint JNICALL Java_edu_vt_cbil_visda_comp_CFMCore_veCov (JNIEnv *, jobject, jint, jint, jdoubleArray, jdoubleArray, jdoubleArray, jdouble); /* * Class: edu_vt_cbil_visda_comp_CFMCore * Method: veModel * Signature: (III[D[D[D[D[D[D)I */ JNIEXPORT jint JNICALL Java_edu_vt_cbil_visda_comp_CFMCore_veModel (JNIEnv *, jobject, jint, jint, jint, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray); /* * Class: edu_vt_cbil_visda_comp_CFMCore * Method: veSubEM * Signature: (III[D[D[DD[D[D[D[D)I */ JNIEXPORT jint JNICALL Java_edu_vt_cbil_visda_comp_CFMCore_veSubEM (JNIEnv *, jobject, jint, jint, jint, jdoubleArray, jdoubleArray, jdoubleArray, jdouble, jdouble, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray, jdoubleArray); #ifdef __cplusplus } #endif #endif
/* * This file is part of the Soletta Project * * Copyright (c) 2015, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * 3. Neither the name of the copyright holder 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 HOLDER 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. */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "sol-gpio.h" /** * Pin logical value to be used */ enum mux_pin_val { PIN_LOW = 0, /**< Logical zero */ PIN_HIGH, /**< Logical one */ PIN_NONE, /**< Pin should be disable i.e. set to high impedance input */ PIN_MODE_0, PIN_MODE_1, PIN_MODE_2, PIN_MODE_3, PIN_MODE_4, PIN_MODE_5 }; /** * Mode in which the pin will be set to operate */ enum mux_mode { MODE_GPIO_INPUT_PULLUP = 0x01, /**< GPIO Input (Pull-up) */ MODE_GPIO_INPUT_PULLDOWN = 0x02, /**< GPIO Input (Pull-down) */ MODE_GPIO_INPUT_HIZ = 0x04, /**< GPIO Input (High impedance) */ MODE_GPIO_OUTPUT = 0x08, /**< GPIO Output */ MODE_PWM = 0x10, /**< PWM */ MODE_I2C = 0x20, /**< I2C */ MODE_ANALOG = 0x40, /**< Analog Reader */ MODE_UART = 0x80, /**< UART */ MODE_SPI = 0x100, /**< SPI */ MODE_SWITCH = 0x200, /**< SWITCH */ MODE_RESERVED = 0x400 /**< Reserved */ }; /* Combinations of the above for convenience */ #define MODE_GPIO_INPUT (MODE_GPIO_INPUT_PULLUP | MODE_GPIO_INPUT_PULLDOWN | MODE_GPIO_INPUT_HIZ) #define MODE_GPIO (MODE_GPIO_INPUT | MODE_GPIO_OUTPUT) struct mux_description { int gpio_pin; /**< GPIO pin that controls the mux */ enum mux_pin_val val; /**< Pin value */ enum mux_mode mode; /**< Combination of possible pin operation modes */ }; /**< Description of a rule to be applied to setup the multiplexer of a given pin */ /** * Structure containing recipes list for the controller's pin set. Controller is the 'chipset' * controlling a set of pins of a given protocol, mode or technology. */ struct mux_controller { unsigned int len; /**< Size of the pin set list */ struct mux_description **recipe; /**< A list of mux recipes for each pin */ }; void mux_shutdown(void); int mux_set_aio(const int device, const int pin, const struct mux_controller *ctl_list, const int s); int mux_set_gpio(const int pin, const enum sol_gpio_direction dir, struct mux_description **const desc_list, const int s); int mux_set_i2c(const uint8_t bus, struct mux_description * (*const desc_list)[2], const unsigned int s); int mux_set_pwm(const int device, const int channel, const struct mux_controller *ctl_list, const int s); #ifdef __cplusplus } #endif
// 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 CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_ #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_ #pragma once #include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" class BookmarksTabHelperDelegate; class TabContentsWrapper; // Per-tab class to manage bookmarks. class BookmarksTabHelper : public NotificationObserver, public TabContentsObserver { public: explicit BookmarksTabHelper(TabContentsWrapper* tab_contents); virtual ~BookmarksTabHelper(); bool is_starred() const { return is_starred_; } BookmarksTabHelperDelegate* delegate() const { return delegate_; } void set_delegate(BookmarksTabHelperDelegate* d) { delegate_ = d; } // TabContentsObserver overrides: virtual void DidNavigateMainFramePostCommit( const NavigationController::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; // NotificationObserver overrides: virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; private: // Updates the starred state from the bookmark bar model. If the state has // changed, the delegate is notified. void UpdateStarredStateForCurrentURL(); // Whether the current URL is starred. bool is_starred_; // Registers and unregisters us for notifications. NotificationRegistrar registrar_; // Owning TabContentsWrapper. TabContentsWrapper* tab_contents_wrapper_; // Delegate for notifying our owner (usually Browser) about stuff. Not owned // by us. BookmarksTabHelperDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(BookmarksTabHelper); }; #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_
// // VASandboxFileAccess.h // // Created by Vlad Alexa on 2/23/12. // #import <Foundation/Foundation.h> @interface VASandboxFileAccess : NSObject{ } +(BOOL)punchHoleInSandboxForPath:(NSString*)path denyNotice:(NSString*)denyNotice; +(NSURL*)sandboxFileHandle:(NSString*)path forced:(BOOL)forced denyNotice:(NSString*)denyNotice; +(BOOL)foundBookmarkForPath:(NSString*)path; +(NSString*)sandboxExpandTildeInPath:(NSString*)path; +(NSURL*)getSecurityBookmark:(NSURL*)url; +(BOOL)addSecurityBookmark:(NSURL*)url; +(BOOL)addRegularBookmark:(NSURL*)url; +(void)startAccessingSecurityScopedResource:(NSURL*)url; +(void)stopAccessingSecurityScopedResource:(NSURL*)url; +(void)willEncodeRestorableState:(NSCoder*)coder; +(void)didDecodeRestorableState:(NSCoder*)coder; +(void)pruneUnrestorableBookmarks; @end
// Version: $Id$ // // // Commentary: // // // Change Log: // // // Code: #pragma once #include <dtkDiscreteGeometryCoreExport.h> #include <QRunnable> #include <dtkCore> #include <cstddef> class dtkMeshPartitionMap; class dtkMesh; // /////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////// class DTKDISCRETEGEOMETRYCORE_EXPORT dtkMeshPartitioner : public QRunnable { public: virtual void setMesh(const dtkMesh *mesh) = 0; virtual void setBalance(double balance) = 0; virtual void setPartitionCount(std::size_t partition_count) = 0; virtual void setMeshPartitionMap(dtkMeshPartitionMap *map) = 0; virtual const dtkMeshPartitionMap *meshPartitionMap(void) const = 0; }; // /////////////////////////////////////////////////////////////////// DTK_DECLARE_OBJECT( dtkMeshPartitioner*); DTK_DECLARE_PLUGIN( dtkMeshPartitioner, DTKDISCRETEGEOMETRYCORE_EXPORT); DTK_DECLARE_PLUGIN_FACTORY(dtkMeshPartitioner, DTKDISCRETEGEOMETRYCORE_EXPORT); DTK_DECLARE_PLUGIN_MANAGER(dtkMeshPartitioner, DTKDISCRETEGEOMETRYCORE_EXPORT); // ///////////////////////////////////////////////////////////////// // Register to dtkDiscretegeometry layer // ///////////////////////////////////////////////////////////////// namespace dtkDiscreteGeometryCore { DTK_DECLARE_CONCEPT(dtkMeshPartitioner, DTKDISCRETEGEOMETRYCORE_EXPORT, meshPartitioner); } // // dtkMeshPartitioner.h ends here
/** * @file openssl/tls_tcp.c TLS/TCP backend using OpenSSL * * Copyright (C) 2010 Creytiv.com */ #define OPENSSL_NO_KRB5 1 #include <openssl/ssl.h> #include <openssl/err.h> #include <re_types.h> #include <re_fmt.h> #include <re_mem.h> #include <re_mbuf.h> #include <re_main.h> #include <re_sa.h> #include <re_net.h> #include <re_srtp.h> #include <re_tcp.h> #include <re_tls.h> #include "tls.h" #define DEBUG_MODULE "tls" #define DEBUG_LEVEL 5 #include <re_dbg.h> /* NOTE: shadow struct defined in tls_*.c */ struct tls_conn { SSL *ssl; BIO *sbio_out; BIO *sbio_in; struct tcp_helper *th; struct tcp_conn *tcp; bool active; bool up; }; static void destructor(void *arg) { struct tls_conn *tc = arg; if (tc->ssl) { int r = SSL_shutdown(tc->ssl); if (r <= 0) ERR_clear_error(); SSL_free(tc->ssl); } mem_deref(tc->th); mem_deref(tc->tcp); } static int bio_create(BIO *b) { b->init = 1; b->num = 0; b->ptr = NULL; b->flags = 0; return 1; } static int bio_destroy(BIO *b) { if (!b) return 0; b->ptr = NULL; b->init = 0; b->flags = 0; return 1; } static int bio_write(BIO *b, const char *buf, int len) { struct tls_conn *tc = b->ptr; struct mbuf mb; int err; mb.buf = (void *)buf; mb.pos = 0; mb.end = mb.size = len; err = tcp_send_helper(tc->tcp, &mb, tc->th); if (err) return -1; return len; } static long bio_ctrl(BIO *b, int cmd, long num, void *ptr) { (void)b; (void)num; (void)ptr; if (cmd == BIO_CTRL_FLUSH) { /* The OpenSSL library needs this */ return 1; } return 0; } static struct bio_method_st bio_tcp_send = { BIO_TYPE_SOURCE_SINK, "tcp_send", bio_write, 0, 0, 0, bio_ctrl, bio_create, bio_destroy, 0 }; static int tls_connect(struct tls_conn *tc) { int err = 0, r; ERR_clear_error(); r = SSL_connect(tc->ssl); if (r <= 0) { const int ssl_err = SSL_get_error(tc->ssl, r); ERR_clear_error(); switch (ssl_err) { case SSL_ERROR_WANT_READ: break; default: DEBUG_WARNING("connect: error (r=%d, ssl_err=%d)\n", r, ssl_err); err = EPROTO; break; } } return err; } static int tls_accept(struct tls_conn *tc) { int err = 0, r; ERR_clear_error(); r = SSL_accept(tc->ssl); if (r <= 0) { const int ssl_err = SSL_get_error(tc->ssl, r); ERR_clear_error(); switch (ssl_err) { case SSL_ERROR_WANT_READ: break; default: DEBUG_WARNING("accept error: (r=%d, ssl_err=%d)\n", r, ssl_err); err = EPROTO; break; } } return err; } static bool estab_handler(int *err, bool active, void *arg) { struct tls_conn *tc = arg; DEBUG_INFO("tcp established (active=%u)\n", active); if (!active) return true; tc->active = true; *err = tls_connect(tc); return true; } static bool recv_handler(int *err, struct mbuf *mb, bool *estab, void *arg) { struct tls_conn *tc = arg; int r; /* feed SSL data to the BIO */ r = BIO_write(tc->sbio_in, mbuf_buf(mb), (int)mbuf_get_left(mb)); if (r <= 0) { DEBUG_WARNING("recv: BIO_write %d\n", r); ERR_clear_error(); *err = ENOMEM; return true; } if (SSL_state(tc->ssl) != SSL_ST_OK) { if (tc->up) { *err = EPROTO; return true; } if (tc->active) { *err = tls_connect(tc); } else { *err = tls_accept(tc); } DEBUG_INFO("state=0x%04x\n", SSL_state(tc->ssl)); /* TLS connection is established */ if (SSL_state(tc->ssl) != SSL_ST_OK) return true; *estab = true; tc->up = true; } mbuf_set_pos(mb, 0); for (;;) { int n; if (mbuf_get_space(mb) < 4096) { *err = mbuf_resize(mb, mb->size + 8192); if (*err) return true; } ERR_clear_error(); n = SSL_read(tc->ssl, mbuf_buf(mb), (int)mbuf_get_space(mb)); if (n <= 0) { const int ssl_err = SSL_get_error(tc->ssl, n); ERR_clear_error(); switch (ssl_err) { case SSL_ERROR_WANT_READ: break; case SSL_ERROR_ZERO_RETURN: *err = ECONNRESET; return true; default: *err = EPROTO; return true; } break; } mb->pos += n; } mbuf_set_end(mb, mb->pos); mbuf_set_pos(mb, 0); return false; } static bool send_handler(int *err, struct mbuf *mb, void *arg) { struct tls_conn *tc = arg; int r; ERR_clear_error(); r = SSL_write(tc->ssl, mbuf_buf(mb), (int)mbuf_get_left(mb)); if (r <= 0) { DEBUG_WARNING("SSL_write: %d\n", SSL_get_error(tc->ssl, r)); ERR_clear_error(); *err = EPROTO; } return true; } /** * Start TLS on a TCP-connection * * @param ptc Pointer to allocated TLS connectioon * @param tls TLS Context * @param tcp TCP Connection * @param layer Protocol stack layer * * @return 0 if success, otherwise errorcode */ int tls_start_tcp(struct tls_conn **ptc, struct tls *tls, struct tcp_conn *tcp, int layer) { struct tls_conn *tc; int err; if (!ptc || !tls || !tcp) return EINVAL; tc = mem_zalloc(sizeof(*tc), destructor); if (!tc) return ENOMEM; err = tcp_register_helper(&tc->th, tcp, layer, estab_handler, send_handler, recv_handler, tc); if (err) goto out; tc->tcp = mem_ref(tcp); err = ENOMEM; /* Connect the SSL socket */ tc->ssl = SSL_new(tls->ctx); if (!tc->ssl) { DEBUG_WARNING("alloc: SSL_new() failed (ctx=%p)\n", tls->ctx); ERR_clear_error(); goto out; } tc->sbio_in = BIO_new(BIO_s_mem()); if (!tc->sbio_in) { DEBUG_WARNING("alloc: BIO_new() failed\n"); ERR_clear_error(); goto out; } tc->sbio_out = BIO_new(&bio_tcp_send); if (!tc->sbio_out) { DEBUG_WARNING("alloc: BIO_new_socket() failed\n"); ERR_clear_error(); BIO_free(tc->sbio_in); goto out; } tc->sbio_out->ptr = tc; SSL_set_bio(tc->ssl, tc->sbio_in, tc->sbio_out); err = 0; out: if (err) mem_deref(tc); else *ptc = tc; return err; }
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef PlyFileReaderService_h #define PlyFileReaderService_h #include <mitkAbstractFileReader.h> #include <mitkIOMimeTypes.h> namespace mitk { class BaseData; /** * @brief Used to read surfaces from the PLY format. * * This reader can read binary and ASCII versions of the format transparently. * * @ingroup IOExt */ class PlyFileReaderService : public AbstractFileReader { public: PlyFileReaderService(); ~PlyFileReaderService() override; using AbstractFileReader::Read; static mitk::CustomMimeType mimeType; protected: std::vector<itk::SmartPointer<BaseData>> DoRead() override; private: PlyFileReaderService *Clone() const override; }; } // namespace mitk #endif /* PlyFileReaderService_h */
/* * Copyright (c) 2019, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder 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 HOLDER 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. */ /** * @file * This file includes compile-time configurations for the DNS Client. * */ #ifndef CONFIG_DNS_CLIENT_H_ #define CONFIG_DNS_CLIENT_H_ /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE * * Define to 1 to enable DNS Client support. * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 0 #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE * * Define to 1 to enable DNS based Service Discovery (DNS-SD) client. * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE #define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS * * Specifies the default DNS server IPv6 address. * * It MUST be a C string representation of the server IPv6 address. * * Default value is set to "2001:4860:4860::8888" which is the Google Public DNS IPv6 address. * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS "2001:4860:4860::8888" #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT * * Specifies the default DNS server port number. * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT 53 #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT * * Specifies the default wait time that DNS client waits for a response from server (in milliseconds). * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT 6000 #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS * * Specifies the default maximum number of DNS query tx attempts with no response before reporting failure. * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS 3 #endif /** * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_NO_RECURSION_FLAG * * Specifies the default "recursion desired" flag (indicates whether the server can resolve the query recursively or * not). * */ #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RECURSION_DESIRED_FLAG #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RECURSION_DESIRED_FLAG 1 #endif #endif // CONFIG_DNS_CLIENT_H_
/* -*- mode: C -*- * * Copyright (c) 2007, 2008 The University of Utah * All rights reserved. * * This file is part of `randprog', a random generator of C programs. * * 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. * * 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. */ #ifndef RANDOM_RUNTIME_H #define RANDOM_RUNTIME_H /*****************************************************************************/ //#include <limits.h> #define CHAR_BIT 8 #define INT_MAX 2147483647 #define UINT_MAX 4294967295U /* * Our piddly runtime! */ #ifndef DEPUTY #define COUNT(n) #define TC #define SAFE #endif /*****************************************************************************/ static uint16_t crcByte(uint16_t crc, uint8_t b) { uint8_t i; crc = crc ^ b << 8; i = 8; do { if (crc & 0x8000) crc = crc << 1 ^ 0x1021; else crc = crc << 1; } while (--i); return crc; } static void crcBytes(uint32_t val) { uint8_t *tmp = (uint8_t *COUNT(4))TC(&val); int len; for (len=4; len > 0; len--) { context = crcByte(context, *tmp++); } } /*****************************************************************************/ static inline int lshift_s_s(int left, int right) { if ((left < 0) || (right < 0) || (right >= sizeof(int)*CHAR_BIT) || (left > (INT_MAX >> right))) { /* Avoid undefined behavior. */ return left; } return left << right; } static inline int lshift_s_u(int left, unsigned int right) { if ((left < 0) || (right >= sizeof(int)*CHAR_BIT) || (left > (INT_MAX >> right))) { /* Avoid undefined behavior. */ return left; } return left << right; } static inline unsigned int lshift_u_s(unsigned int left, int right) { if ((right < 0) || (right >= sizeof(unsigned int)*CHAR_BIT) || (left > (UINT_MAX >> right))) { /* Avoid undefined behavior. */ return left; } return left << right; } static inline unsigned int lshift_u_u(unsigned int left, unsigned int right) { if ((right >= sizeof(unsigned int)*CHAR_BIT) || (left > (UINT_MAX >> right))) { /* Avoid undefined behavior. */ return left; } return left << right; } static inline int rshift_s_s(int left, int right) { if ((left < 0) || (right < 0) || (right >= sizeof(int)*CHAR_BIT)) { /* Avoid implementation-defined and undefined behavior. */ return left; } return left >> right; } static inline int rshift_s_u(int left, unsigned int right) { if ((left < 0) || (right >= sizeof(int)*CHAR_BIT)) { /* Avoid implementation-defined and undefined behavior. */ return left; } return left >> right; } static inline unsigned int rshift_u_s(unsigned int left, int right) { if ((right < 0) || (right >= sizeof(unsigned int)*CHAR_BIT)) { /* Avoid undefined behavior. */ return left; } return left >> right; } static inline unsigned int rshift_u_u(unsigned int left, unsigned int right) { if (right >= sizeof(unsigned int)*CHAR_BIT) { /* Avoid undefined behavior. */ return left; } return left >> right; } /*****************************************************************************/ static inline unsigned long int mod_rhs(const long int rhs) { if (rhs == 0) return 1; return rhs; } static inline unsigned long int div_rhs(const long int rhs) { if (rhs == 0) return 1; return rhs; } /*****************************************************************************/ #endif /* RANDOM_RUNTIME_H */ /* * Local Variables: * c-basic-offset: 4 * tab-width: 4 * End: */ /* End of file. */
/* * opencurry: tests/test_type_base_tval.h * * Copyright (c) 2015, Byron James Johnson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder 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 HOLDER 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. */ /* * tests/test_type_base_tval.h * ------ */ #ifndef TESTS_TEST_TYPE_BASE_TVAL_H #define TESTS_TEST_TYPE_BASE_TVAL_H #include "../base.h" #include "testing.h" #include "../util.h" int test_type_base_tval_cli(int argc, char **argv); extern unit_test_t type_base_tval_test; extern unit_test_t *type_base_tval_tests[]; unit_test_result_t test_type_base_tval_run(unit_test_context_t *context); /* ---------------------------------------------------------------- */ extern unit_test_t tval_typeof_variant_equalities_test; unit_test_result_t tval_typeof_variant_equalities_test_run(unit_test_context_t *context); extern unit_test_t tval_typeof_equivalences_test; unit_test_result_t tval_typeof_equivalences_test_run(unit_test_context_t *context); extern unit_test_t tval_typedof_equivalences_test; unit_test_result_t tval_typedof_equivalences_test_run(unit_test_context_t *context); extern unit_test_t tval_typeof_edge_cases_test; unit_test_result_t tval_typeof_edge_cases_test_run(unit_test_context_t *context); extern unit_test_t tval_typedof_edge_cases_test; unit_test_result_t tval_typedof_edge_cases_test_run(unit_test_context_t *context); #endif /* ifndef TESTS_TEST_TYPE_BASE_TVAL_H */
/* Xwindows_Interface - dummy */ #include "xdexterns.h" FUNCTION X_Interface( Unit, Function, par1, par2, par3, par4, par5, par6, par7, par8, par9, par10 ) int *Unit, Function; int par1, par2, par3, par4, par5, par6, par7, par8, par9, par10; { return ( 0 ); }
// Copyright (c) 2012 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_MEDIA_CRYPTO_PPAPI_CDM_VIDEO_DECODER_H_ #define WEBKIT_MEDIA_CRYPTO_PPAPI_CDM_VIDEO_DECODER_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h" namespace webkit_media { class CdmVideoDecoder { public: virtual ~CdmVideoDecoder() {} virtual bool Initialize(const cdm::VideoDecoderConfig& config) = 0; virtual void Deinitialize() = 0; virtual void Reset() = 0; virtual bool is_initialized() const = 0; // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and // returns |cdm::kSuccess| when an output frame is available. Returns // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output // frame. Returns |cdm::kDecodeError| when decoding fails. // // A null |compressed_frame| will attempt to flush the decoder of any // remaining frames. |compressed_frame_size| and |timestamp| are ignored. virtual cdm::Status DecodeFrame(const uint8_t* compressed_frame, int32_t compressed_frame_size, int64_t timestamp, cdm::VideoFrame* decoded_frame) = 0; }; // Initializes appropriate video decoder based on GYP flags and the value of // |config.codec|. Returns a scoped_ptr containing a non-null initialized // CdmVideoDecoder* upon success. scoped_ptr<CdmVideoDecoder> CreateVideoDecoder( cdm::Allocator* allocator, const cdm::VideoDecoderConfig& config); } // namespace webkit_media #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CDM_VIDEO_DECODER_H_
/****************************************************************************** ** ** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com> ** All rights reserved. ** ** This file is a part of the chemkit project. For more information ** see <http://www.chemkit.org>. ** ** 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 the chemkit project 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. ** ******************************************************************************/ #ifndef CHEMKIT_PROTEINDATABANK_H #define CHEMKIT_PROTEINDATABANK_H #include "web.h" #include <QtCore> #ifndef Q_MOC_RUN #include <boost/shared_ptr.hpp> #endif namespace chemkit { class Polymer; class Molecule; class PolymerFile; class ProteinDataBankPrivate; class CHEMKIT_WEB_EXPORT ProteinDataBank { public: // construction and destruction ProteinDataBank(); ~ProteinDataBank(); // properties void setUrl(const QUrl &url); QUrl url() const; // downloads boost::shared_ptr<Polymer> downloadPolymer(const QString &id) const; boost::shared_ptr<Molecule> downloadLigand(const QString &name) const; PolymerFile* downloadFile(const QString &id) const; QByteArray downloadFileData(const QString &id, const QString &format) const; // error handling QString errorString() const; private: void setErrorString(const QString &error); private: ProteinDataBankPrivate* const d; }; } // end chemkit namespace #endif // CHEMKIT_PROTEINDATABANK_H
/* * squareball: A general-purpose library for C99. * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br> * * This program can be distributed under the terms of the BSD License. * See the file LICENSE. */ #ifndef _SQUAREBALL_H #define _SQUAREBALL_H /** * @file squareball.h * @brief Main library header. * * This header includes all the other public headers exposed by the library. * * @{ */ #include <squareball/sb-compat.h> #include <squareball/sb-configparser.h> #include <squareball/sb-error.h> #include <squareball/sb-file.h> #include <squareball/sb-mem.h> #include <squareball/sb-parsererror.h> #include <squareball/sb-shell.h> #include <squareball/sb-slist.h> #include <squareball/sb-stdin.h> #include <squareball/sb-strerror.h> #include <squareball/sb-strfuncs.h> #include <squareball/sb-string.h> #include <squareball/sb-trie.h> #include <squareball/sb-utf8.h> /** @} */ #endif /* _SQUAREBALL_H */
/** * Copyright (c) 2015-present, Horcrux. * All rights reserved. * * This source code is licensed under the MIT-style license found in the * LICENSE file in the root directory of this source tree. */ #import <QuartzCore/QuartzCore.h> #import <CoreText/CoreText.h> #import "ABI39_0_0RCTConvert+RNSVG.h" #import <ABI39_0_0React/ABI39_0_0RCTConvert.h> #import "ABI39_0_0RNSVGCGFCRule.h" #import "ABI39_0_0RNSVGVBMOS.h" #import "ABI39_0_0RNSVGUnits.h" #import "ABI39_0_0RNSVGLength.h" #import "ABI39_0_0RNSVGPathParser.h" @class ABI39_0_0RNSVGBrush; @interface ABI39_0_0RCTConvert (ABI39_0_0RNSVG) + (ABI39_0_0RNSVGLength*)ABI39_0_0RNSVGLength:(id)json; + (NSArray<ABI39_0_0RNSVGLength *>*)ABI39_0_0RNSVGLengthArray:(id)json; + (ABI39_0_0RNSVGCGFCRule)ABI39_0_0RNSVGCGFCRule:(id)json; + (ABI39_0_0RNSVGVBMOS)ABI39_0_0RNSVGVBMOS:(id)json; + (ABI39_0_0RNSVGUnits)ABI39_0_0RNSVGUnits:(id)json; + (ABI39_0_0RNSVGBrush *)ABI39_0_0RNSVGBrush:(id)json; + (ABI39_0_0RNSVGPathParser *)ABI39_0_0RNSVGCGPath:(NSString *)d; + (CGRect)ABI39_0_0RNSVGCGRect:(id)json offset:(NSUInteger)offset; + (CGColorRef)ABI39_0_0RNSVGCGColor:(id)json offset:(NSUInteger)offset; + (CGGradientRef)ABI39_0_0RNSVGCGGradient:(id)json; @end
/* Copyright (c) 2006, NIF File Format Library and Tools All rights reserved. Please see niflib.h for license. */ //-----------------------------------NOTICE----------------------------------// // Some of this file is automatically filled in by a Python script. Only // // add custom code in the designated areas or it will be overwritten during // // the next update. // //-----------------------------------NOTICE----------------------------------// #ifndef _NIBSANIMATIONNODE_H_ #define _NIBSANIMATIONNODE_H_ //--BEGIN FILE HEAD CUSTOM CODE--// //--END CUSTOM CODE--// #include "NiNode.h" namespace Niflib { class NiBSAnimationNode; typedef Ref<NiBSAnimationNode> NiBSAnimationNodeRef; /*! * Bethesda-specific extension of Node with animation properties stored in the * flags, often 42? */ class NiBSAnimationNode : public NiNode { public: /*! Constructor */ NIFLIB_API NiBSAnimationNode(); /*! Destructor */ NIFLIB_API virtual ~NiBSAnimationNode(); /*! * A constant value which uniquly identifies objects of this type. */ NIFLIB_API static const Type TYPE; /*! * A factory function used during file reading to create an instance of this type of object. * \return A pointer to a newly allocated instance of this type of object. */ NIFLIB_API static NiObject * Create(); /*! * Summarizes the information contained in this object in English. * \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out. * \return A string containing a summary of the information within the object in English. This is the function that Niflyze calls to generate its analysis, so the output is the same. */ NIFLIB_API virtual string asString(bool verbose = false) const; /*! * Used to determine the type of a particular instance of this object. * \return The type constant for the actual type of the object. */ NIFLIB_API virtual const Type & GetType() const; //--This object has no eligable attributes. No example implementation generated--// //--BEGIN MISC CUSTOM CODE--// //--END CUSTOM CODE--// public: /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void Read(istream& in, list<unsigned int> & link_stack, const NifInfo & info); /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void Write(ostream& out, const map<NiObjectRef, unsigned int> & link_map, list<NiObject *> & missing_link_stack, const NifInfo & info) const; /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void FixLinks(const map<unsigned int, NiObjectRef> & objects, list<unsigned int> & link_stack, list<NiObjectRef> & missing_link_stack, const NifInfo & info); /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const; /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual list<NiObject *> GetPtrs() const; }; //--BEGIN FILE FOOT CUSTOM CODE--// //--END CUSTOM CODE--// } //End Niflib namespace #endif
/* * Copyright (C) 2013 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. */ #ifndef CompositorAnimations_h #define CompositorAnimations_h #include "core/CoreExport.h" #include "core/animation/AnimationEffect.h" #include "core/animation/Timing.h" #include "platform/animation/TimingFunction.h" #include "wtf/Vector.h" namespace blink { class AnimationPlayer; class Element; class FloatBox; class CORE_EXPORT CompositorAnimations { public: static CompositorAnimations* instance() { return instance(0); } static void setInstanceForTesting(CompositorAnimations* newInstance) { instance(newInstance); } static bool isCompositableProperty(CSSPropertyID property) { return property == CSSPropertyOpacity || property == CSSPropertyTransform || property == CSSPropertyWebkitFilter; } static CSSPropertyID CompositableProperties[3]; virtual bool isCandidateForAnimationOnCompositor(const Timing&, const Element&, const AnimationPlayer*, const AnimationEffect&, double playerPlaybackRate); virtual void cancelIncompatibleAnimationsOnCompositor(const Element&, const AnimationPlayer&, const AnimationEffect&); virtual bool canStartAnimationOnCompositor(const Element&); // FIXME: This should return void. We should know ahead of time whether these animations can be started. virtual bool startAnimationOnCompositor(const Element&, int group, double startTime, double timeOffset, const Timing&, const AnimationPlayer&, const AnimationEffect&, Vector<int>& startedAnimationIds, double playerPlaybackRate); virtual void cancelAnimationOnCompositor(const Element&, const AnimationPlayer&, int id); virtual void pauseAnimationForTestingOnCompositor(const Element&, const AnimationPlayer&, int id, double pauseTime); virtual bool canAttachCompositedLayers(const Element&, const AnimationPlayer&); virtual void attachCompositedLayers(const Element&, const AnimationPlayer&); virtual bool getAnimatedBoundingBox(FloatBox&, const AnimationEffect&, double minValue, double maxValue) const; protected: CompositorAnimations() { } private: static CompositorAnimations* instance(CompositorAnimations* newInstance) { static CompositorAnimations* instance = new CompositorAnimations(); if (newInstance) { instance = newInstance; } return instance; } }; } // namespace blink #endif
// Filename: ParallelEdgeMap.h // Created on 28 Jun 2010 by Boyce Griffith // // Copyright (c) 2002-2013, Boyce Griffith // 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 New York University 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 HOLDER 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. #ifndef included_ParallelEdgeMap #define included_ParallelEdgeMap /////////////////////////////// INCLUDES ///////////////////////////////////// #include <map> #include <utility> #include "tbox/DescribedClass.h" /////////////////////////////// CLASS DEFINITION ///////////////////////////// namespace IBTK { /*! * \brief Class ParallelEdgeMap is a utility class for managing edge maps (i.e., * maps from vertices to links between vertices) in parallel. * * \note This class is deprecated and has been superseded by class ParallelMap. */ class ParallelEdgeMap : public SAMRAI::tbox::DescribedClass { public: /*! * \brief Default constructor. */ ParallelEdgeMap(); /*! * \brief Destructor. */ ~ParallelEdgeMap(); /*! * \brief Add an edge to the edge map. * * \return The master node index to be associated with the edge in the edge * map. * * \note This method is not collective (i.e., it does not have to be called * by all MPI tasks); however, it is necessary to call the collective * function ParallelEdgeMap::communicateData() to finalize all parallel * communication. * * \note By default, the master index associated with each edge is the * vertex with minimum index in the link. */ int addEdge( const std::pair<int,int>& link, int mastr_idx=-1); /*! * \brief Remove an edge from the edge map. * * \note This method is not collective (i.e., it does not have to be called * by all MPI tasks); however, it is necessary to call the collective * function ParallelEdgeMap::communicateData() to finalize all parallel * communication. * * \note The master index argument is optional and is only used as a hint to * attempt to find the link in the link table. */ void removeEdge( const std::pair<int,int>& link, int mastr_idx=-1); /*! * \brief Communicate data to (re-)initialize the edge map. */ void communicateData(); /*! * \brief Return a const reference to the edge map. */ const std::multimap<int,std::pair<int,int> >& getEdgeMap() const; private: /*! * \brief Copy constructor. * * \param from The value to copy to this object. * * \note This constructor is not implemented and should not be used. */ ParallelEdgeMap( const ParallelEdgeMap& from); /*! * \brief Assignment operator. * * \note This operator is not implemented and should not be used. * * \param that The value to assign to this object. * * \return A reference to this object. */ ParallelEdgeMap& operator=( const ParallelEdgeMap& that); // Member data. std::multimap<int,std::pair<int,int> > d_edge_map; std::multimap<int,std::pair<int,int> > d_pending_additions, d_pending_removals; }; }// namespace IBTK ////////////////////////////////////////////////////////////////////////////// #endif //#ifndef included_ParallelEdgeMap
// // Settings.h // MacUnwand // // Created by Moiz Merchant on 11/9/11. // Copyright 2011 Bunnies on Acid. All rights reserved. // // // NOTE: This class is not being used, left in place for reference only. // //----------------------------------------------------------------------------- // imports //----------------------------------------------------------------------------- #import <Cocoa/Cocoa.h> //----------------------------------------------------------------------------- // interface definition //----------------------------------------------------------------------------- @interface Settings : NSObject { BOOL mShowConfigPanel; BOOL mAutoLoadDefaultWandFile; } //----------------------------------------------------------------------------- @property(assign) BOOL showConfigPanel; @property(assign) BOOL autoLoadDefaultWandFile; //----------------------------------------------------------------------------- + (Settings*) getSettings; - (void) save; //----------------------------------------------------------------------------- @end
/* * Software License Agreement (GNU General Public License) * * Copyright (c) 2011, Thomas Mörwald * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @author thomas.moerwald * */ #ifndef TG_QUATERNION #define TG_QUATERNION #include <math.h> #include "tgMathlib.h" namespace TomGine{ /** @brief Quaternion representing rotations (avoiding singularity locks). */ class tgQuaternion { public: float x,y,z,w; ///< x,y,z,w Coefficients of the quaternion. /** @brief Creates quaternion with coefficients (0,0,0,1). */ tgQuaternion(); /** @brief Creates quaternion with coefficients specified. */ tgQuaternion(float x, float y, float z, float w); /** @brief Normalises the coefficients of the quaternion. */ void normalise(); /** @brief Calculates the conjungate of the quaternion. */ tgQuaternion getConjugate() const; /** @brief Compares two quaternions for equality wrt. rotation. */ bool operator==(const tgQuaternion &q) const; /** @brief Add coefficients. */ tgQuaternion operator+ (const tgQuaternion &q2) const; /** @brief Subtract coefficients. */ tgQuaternion operator- (const tgQuaternion &q2) const; /** @brief Multiplying rq with q applies the rotation q to rq. */ tgQuaternion operator* (const tgQuaternion &rq); /** @brief Multiply coefficients with scalar f. */ tgQuaternion operator* (const float f); /** @brief Multiplying quaternion q with a vector v applies the rotation to v. */ vec3 operator* (vec3 v); /** @brief Get coefficients of quaternion from axis-angle representation. */ void fromAxis(const vec3 &v, float angle); /** @brief Get coefficients of quaternion from Euler angles. */ void fromEuler(float pitch, float yaw, float roll); /** @brief Get coefficients of quaternion from 3x3 matrix. */ void fromMatrix(mat3 m); /** @brief Get coefficients of quaternion from 4x4 matrix. */ void fromMatrix(mat4 m); /** @brief Get 4x4 matrix from quaternion representation. */ mat4 getMatrix4() const; /** @brief Get 3x3 matrix from quaternion representation. */ mat3 getMatrix3() const; /** @brief Get axis-angle representation from quaternion. */ void getAxisAngle(vec3& axis, float& angle) const; /** @brief Print the coefficients of the quaternion to console. */ void print() const; void printAxisAngle() const; }; } // namespace TomGine #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkTDxMotionEventInfo.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkTDxMotionEventInfo - Store motion information from a 3DConnexion input device // .SECTION Description // vtkTDxMotionEventInfo is a data structure that stores the information about // a motion event from a 3DConnexion input device. // // .SECTION See Also // vtkTDxDevice #ifndef __vtkTDxMotionEventInfo_h #define __vtkTDxMotionEventInfo_h #include "vtkRenderingCoreExport.h" // For export macro #include "vtkObject.h" // for the export macro class VTKRENDERINGCORE_EXPORT vtkTDxMotionEventInfo { public: // Description: // Translation coordinates double X; double Y; double Z; // Description: // Rotation angle. // The angle is in arbitrary unit. // It makes sense to have arbitrary unit // because the data comes from a device // where the information can be scaled by // the end-user. double Angle; // Description: // Rotation axis expressed as a unit vector. double AxisX; double AxisY; double AxisZ; }; #endif
#ifndef CGAL_SNC_WALLS_H #define CGAL_SNC_WALLS_H #include <CGAL/Nef_3/SNC_decorator.h> #include <CGAL/Nef_3/SNC_intersection.h> #include <CGAL/Nef_S2/SM_walls.h> namespace CGAL { template<typename SNC_> class SNC_walls : public SNC_decorator<SNC_> { typedef SNC_ SNC_structure; typedef CGAL::SNC_decorator<SNC_structure> Base; typedef CGAL::SNC_point_locator<Base> SNC_point_locator; typedef CGAL::SNC_intersection<SNC_structure> SNC_intersection; typedef CGAL::SNC_constructor<SNC_structure> SNC_constructor; typedef typename SNC_structure::Sphere_map Sphere_map; typedef CGAL::SM_decorator<Sphere_map> SM_decorator; typedef CGAL::SM_point_locator<SM_decorator> SM_point_locator; typedef CGAL::SM_walls<Sphere_map> SM_walls; typedef typename Base::Segment_3 Segment_3; typedef typename Base::Point_3 Point_3; typedef typename Base::Ray_3 Ray_3; typedef typename Base::Vector_3 Vector_3; typedef typename Base::Sphere_point Sphere_point; typedef typename Base::Vertex_handle Vertex_handle; typedef typename Base::Halfedge_handle Halfedge_handle; typedef typename Base::Halffacet_handle Halffacet_handle; typedef typename Base::SVertex_handle SVertex_handle; typedef typename Base::SHalfedge_handle SHalfedge_handle; typedef typename Base::SHalfloop_handle SHalfloop_handle; typedef typename Base::SFace_handle SFace_handle; typedef typename Base::Object_handle Object_handle; SNC_point_locator* pl; public: SNC_walls(SNC_structure& S, SNC_point_locator* spl) : Base(S), pl(spl) {} /* Vector_3 dir; Unique_hash_map<Vertex_handle, Vertex_handle> opposite_up; Unique_hash_map<Vertex_handle, Vertex_handle> opposite_down; Unique_hash_map<Vertex_handle, Object_handle> object_up; Unique_hash_map<Vertex_handle, Object_handle> object_down; Vertex_handle create_opposite_vertex(Vertex_const_handle v, bool opp) { Vector_3 vec = opp ? dir.opposite : dir; Object_handle o; if(!opp) o = object_up[vi]; else o = object_down[vi]; SVertex_handle svh; if(assign(svh,o)) return svh->twin()->source(); int hit = 0; Object_handle o2 = pl()->shoot(vec); Vertex_handle vh; Halfedge_handle eh; Halffacet_handle fh; if(assign(fh,o2)) hit = 1; else if(assign(eh,o2)) hit = 2; else if(assign(vh,o2)) hit = 3; else return Vertex_handle(); SHalfedge_handle seh; SFace_handle sfh; if(assign(sfh,o)) { SM_walls SW(vi); SW.insert_new_svertex_into_sface(sfh, Sphere_point(vec - CGAL::ORIGIN)); } else if(assign(seh,o)) { SM_walls SW(vi); SW.insert_new_svertex_into_sedge(seh, Sphere_point(vec - CGAL::ORIGIN)); } else CGAL_assertio_msg(false,"wrong object"); switch(hit) { case 1 : Point_3 ip; SNC_intersection I; I.does_intersect_internally(Ray_3(v->point(),vec), fh, ip); SM_walls SW(new_vertex(ip),fh->mark()); SW.create_opposite_vertex_on_facet(fh, vi, Sphere_point(CGAL::ORIGIN-vec)); break; case 2 : Point_3 ip; SNC_intersection I; I.does_intersect_internally(Ray_3(v->point(),vec), Segment(eh), ip); SM_walls SW(new_vertex(ip),fh->mark()); SW.create_opposite_vertex_on_edge(eh, vi, Sphere_point(CGAL::ORIGIN-vec)); break; case 3 : SM_walls SW(new_vertex(ip),fh->mark()); SW.extend_vertex_by_inner_walls(vh, vi, Sphere_point(CGAL::ORIGIN-vec)); break; default : CGAL_error_msg( "not implemented yet"); } return Vertex_handle(); } */ void create_single_wall(Halfedge_handle ein, Vector_3 dir) { Vertex_handle origin[2]; Vertex_handle opposite[2]; origin[0] = ein->source(); origin[1] = ein->target(); for(int i=0; i<2; ++i) { SM_point_locator P(&*origin[i]); Object_handle o = P.locate(Sphere_point(dir)); SVertex_handle sv; SHalfedge_handle se; SHalfloop_handle sl; SFace_handle sf; if(assign(sv,o)) { opposite[i]=sv->twin()->source(); std::cerr << " Found svertex directly !!!! " << std::endl; } else { Vertex_handle v; Halfedge_handle e; Halffacet_handle f; Ray_3 r(origin[i]->point(),dir); Object_handle o2 = pl->shoot(r); if(assign(f,o2)) std::cerr << "Found facet " << std::endl; else if(assign(e,o2)) { std::cerr << "Found edge " << std::endl; Point_3 ip; SNC_intersection I; I.does_intersect_internally(r, Segment_3(e->source()->point(), e->twin()->source()->point()), ip); SNC_constructor C(*sncp()); opposite[i] = C.create_from_edge(e,ip); SM_walls SMW(&*opposite[i]); SMW.add_two(i==0?ein->point():ein->twin()->point(), Sphere_point(CGAL::ORIGIN - dir)); } else if(assign(v,o2)) { std::cerr << "Found vertex " << std::endl; opposite[i] = v; SM_walls SMW(&*opposite[i]); SMW.add_two(i==0?ein->point():ein->twin()->point(), Sphere_point(CGAL::ORIGIN - dir)); } else { std::cerr << "Found nothing " << std::endl; opposite[i] = origin[i]; } } } SNC_constructor C(*sncp(),pl); C.build_external_structure(); } /* void create_walls() { Vertex_iterator vi; CGAL_forall_vertices(vi, *this) { SM_point_locator P(vi); object_up[vi] = P.shoot(dir); object_up[vi] = P.shoot(dir.opposite()); } Vertex_iterator vi; CGAL_forall_vertices(vi, *this) { opposite_up[vi] = create_opposite_vertex(vi, dir); opposite_down[vi] = create_opposite_vertex(vi, dir.opposite()); } Halfedge_iterator ei; CGAL_forall_vertices(ei, *this) { create_opposite_halfedge_up(opposite_up[ei->source()], opposite_up[ei->twin()->source()]); create_opposite_halfedge3_down(opposite_down[ei->source()], opposite_down[ei->twin()->source()]); } } */ }; } //namespace CGAL #endif //CGAL_SNC_WALLS_H
/* * * 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. * */ #ifndef NET_GRPC_PHP_GRPC_CALL_H_ #define NET_GRPC_PHP_GRPC_CALL_H_ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "php_grpc.h" #include "grpc/grpc.h" // Throw an exception if error_code is not OK #define MAYBE_THROW_CALL_ERROR(func_name, error_code) \ do { \ if (error_code != GRPC_CALL_OK) { \ zend_throw_exception(spl_ce_LogicException, \ #func_name " was called incorrectly", \ (long)error_code TSRMLS_CC); \ return; \ } \ } while (0) /* Class entry for the Call PHP class */ extern zend_class_entry *grpc_ce_call; /* Wrapper struct for grpc_call that can be associated with a PHP object */ typedef struct wrapped_grpc_call { zend_object std; bool owned; grpc_call *wrapped; } wrapped_grpc_call; /* Initializes the Call PHP class */ void grpc_init_call(TSRMLS_D); /* Creates a Call object that wraps the given grpc_call struct */ zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned); /* Creates and returns a PHP associative array of metadata from a C array of * call metadata */ zval *grpc_call_create_metadata_array(int count, grpc_metadata *elements); #endif /* NET_GRPC_PHP_GRPC_CHANNEL_H_ */
// // VELViewDragAndDropTests.h // Velvet // // Created by Justin Spahr-Summers on 10.01.12. // Copyright (c) 2012 Bitswift. All rights reserved. // // Application unit tests contain unit test code that must be injected into an application to run correctly. #import <SenTestingKit/SenTestingKit.h> @interface VELViewDragAndDropTests : SenTestCase @end
/* * Copyright (c) 1997-2004 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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. */ #include "rsh_locl.h" RCSID("$Id$"); #if defined(KRB5) #ifdef KRB5 int key_usage = 1026; void *ivec_in[2]; void *ivec_out[2]; void init_ivecs(int client, int have_errsock) { size_t blocksize; krb5_crypto_getblocksize(context, crypto, &blocksize); ivec_in[0] = malloc(blocksize); memset(ivec_in[0], client, blocksize); if(have_errsock) { ivec_in[1] = malloc(blocksize); memset(ivec_in[1], 2 | client, blocksize); } else ivec_in[1] = ivec_in[0]; ivec_out[0] = malloc(blocksize); memset(ivec_out[0], !client, blocksize); if(have_errsock) { ivec_out[1] = malloc(blocksize); memset(ivec_out[1], 2 | !client, blocksize); } else ivec_out[1] = ivec_out[0]; } #endif ssize_t do_read (int fd, void *buf, size_t sz, void *ivec) { if (do_encrypt) { #ifdef KRB5 if(auth_method == AUTH_KRB5) { krb5_error_code ret; uint32_t len, outer_len; int status; krb5_data data; void *edata; ret = krb5_net_read (context, &fd, &len, 4); if (ret <= 0) return ret; len = ntohl(len); if (len > sz) abort (); /* ivec will be non null for protocol version 2 */ if(ivec != NULL) outer_len = krb5_get_wrapped_length (context, crypto, len + 4); else outer_len = krb5_get_wrapped_length (context, crypto, len); edata = malloc (outer_len); if (edata == NULL) errx (1, "malloc: cannot allocate %u bytes", outer_len); ret = krb5_net_read (context, &fd, edata, outer_len); if (ret <= 0) { free(edata); return ret; } status = krb5_decrypt_ivec(context, crypto, key_usage, edata, outer_len, &data, ivec); free (edata); if (status) krb5_err (context, 1, status, "decrypting data"); if(ivec != NULL) { unsigned long l; if(data.length < len + 4) errx (1, "data received is too short"); _krb5_get_int(data.data, &l, 4); if(l != len) errx (1, "inconsistency in received data"); memcpy (buf, (unsigned char *)data.data+4, len); } else memcpy (buf, data.data, len); krb5_data_free (&data); return len; } else #endif /* KRB5 */ abort (); } else return read (fd, buf, sz); } ssize_t do_write (int fd, void *buf, size_t sz, void *ivec) { if (do_encrypt) { #ifdef KRB5 if(auth_method == AUTH_KRB5) { krb5_error_code status; krb5_data data; unsigned char len[4]; int ret; _krb5_put_int(len, sz, 4); if(ivec != NULL) { unsigned char *tmp = malloc(sz + 4); if(tmp == NULL) err(1, "malloc"); _krb5_put_int(tmp, sz, 4); memcpy(tmp + 4, buf, sz); status = krb5_encrypt_ivec(context, crypto, key_usage, tmp, sz + 4, &data, ivec); free(tmp); } else status = krb5_encrypt_ivec(context, crypto, key_usage, buf, sz, &data, ivec); if (status) krb5_err(context, 1, status, "encrypting data"); ret = krb5_net_write (context, &fd, len, 4); if (ret != 4) return ret; ret = krb5_net_write (context, &fd, data.data, data.length); if (ret != data.length) return ret; free (data.data); return sz; } else #endif /* KRB5 */ abort(); } else return write (fd, buf, sz); } #endif /* KRB5 */
/* * Copyright (c) 2006 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <stdlib.h> #include <dh.h> #include <roken.h> #include "tfm.h" static void BN2mpz(fp_int *s, const BIGNUM *bn) { size_t len; void *p; len = BN_num_bytes(bn); p = malloc(len); BN_bn2bin(bn, p); fp_read_unsigned_bin(s, p, len); free(p); } static BIGNUM * mpz2BN(fp_int *s) { size_t size; BIGNUM *bn; void *p; size = fp_unsigned_bin_size(s); p = malloc(size); if (p == NULL && size != 0) return NULL; fp_to_unsigned_bin(s, p); bn = BN_bin2bn(p, size, NULL); free(p); return bn; } /* * */ #define DH_NUM_TRIES 10 static int tfm_dh_generate_key(DH *dh) { fp_int pub, priv_key, g, p; int have_private_key = (dh->priv_key != NULL); int codes, times = 0; int res; if (dh->p == NULL || dh->g == NULL) return 0; while (times++ < DH_NUM_TRIES) { if (!have_private_key) { size_t bits = BN_num_bits(dh->p); if (dh->priv_key) BN_free(dh->priv_key); dh->priv_key = BN_new(); if (dh->priv_key == NULL) return 0; if (!BN_rand(dh->priv_key, bits - 1, 0, 0)) { BN_clear_free(dh->priv_key); dh->priv_key = NULL; return 0; } } if (dh->pub_key) BN_free(dh->pub_key); fp_init_multi(&pub, &priv_key, &g, &p, NULL); BN2mpz(&priv_key, dh->priv_key); BN2mpz(&g, dh->g); BN2mpz(&p, dh->p); res = fp_exptmod(&g, &priv_key, &p, &pub); fp_zero(&priv_key); fp_zero(&g); fp_zero(&p); if (res != 0) continue; dh->pub_key = mpz2BN(&pub); fp_zero(&pub); if (dh->pub_key == NULL) return 0; if (DH_check_pubkey(dh, dh->pub_key, &codes) && codes == 0) break; if (have_private_key) return 0; } if (times >= DH_NUM_TRIES) { if (!have_private_key && dh->priv_key) { BN_free(dh->priv_key); dh->priv_key = NULL; } if (dh->pub_key) { BN_free(dh->pub_key); dh->pub_key = NULL; } return 0; } return 1; } static int tfm_dh_compute_key(unsigned char *shared, const BIGNUM * pub, DH *dh) { fp_int s, priv_key, p, peer_pub; size_t size = 0; int ret; if (dh->pub_key == NULL || dh->g == NULL || dh->priv_key == NULL) return -1; fp_init(&p); BN2mpz(&p, dh->p); fp_init(&peer_pub); BN2mpz(&peer_pub, pub); /* check if peers pubkey is reasonable */ if (fp_isneg(&peer_pub) || fp_cmp(&peer_pub, &p) >= 0 || fp_cmp_d(&peer_pub, 1) <= 0) { fp_zero(&p); fp_zero(&peer_pub); return -1; } fp_init(&priv_key); BN2mpz(&priv_key, dh->priv_key); fp_init(&s); ret = fp_exptmod(&peer_pub, &priv_key, &p, &s); fp_zero(&p); fp_zero(&peer_pub); fp_zero(&priv_key); if (ret != 0) return -1; size = fp_unsigned_bin_size(&s); fp_to_unsigned_bin(&s, shared); fp_zero(&s); return size; } static int tfm_dh_generate_params(DH *dh, int a, int b, BN_GENCB *callback) { /* groups should already be known, we don't care about this */ return 0; } static int tfm_dh_init(DH *dh) { return 1; } static int tfm_dh_finish(DH *dh) { return 1; } /* * */ const DH_METHOD _hc_dh_tfm_method = { "hcrypto tfm DH", tfm_dh_generate_key, tfm_dh_compute_key, NULL, tfm_dh_init, tfm_dh_finish, 0, NULL, tfm_dh_generate_params }; /** * DH implementation using libimath. * * @return the DH_METHOD for the DH implementation using libimath. * * @ingroup hcrypto_dh */ const DH_METHOD * DH_tfm_method(void) { return &_hc_dh_tfm_method; }
// bindgen-flags: --default-enum-style=bitfield --constified-enum-module=Neg enum Foo { Bar = 0, Qux }; enum Neg { MinusOne = -1, One = 1, };
// Copyright 2021 The Cobalt Authors. 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 STARBOARD_SHARED_LINUX_SYSTEM_NETWORK_STATUS_H_ #define STARBOARD_SHARED_LINUX_SYSTEM_NETWORK_STATUS_H_ #if SB_API_VERSION >= 13 #include "starboard/shared/linux/singleton.h" #include "starboard/system.h" #include "starboard/thread.h" class NetworkNotifier : public starboard::Singleton<NetworkNotifier> { public: bool Initialize(); static void* NotifierThreadEntry(void* context); bool is_online() { return is_online_; } void set_online(bool is_online) { is_online_ = is_online; } private: SbThread notifier_thread_; bool is_online_ = true; }; #endif // SB_API_VERSION >= 13 #endif // STARBOARD_SHARED_LINUX_SYSTEM_NETWORK_STATUS_H_
/* * ng_iface.h */ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; * provided, however, that: * 1. Any and all reproductions of the source or object code must include the * copyright notice above and the following disclaimer of warranties; and * 2. No rights are granted, in any manner or form, to use Whistle * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER 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 WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * Author: Archie Cobbs <archie@freebsd.org> * * $FreeBSD: releng/9.3/sys/netgraph/ng_iface.h 187495 2009-01-20 22:26:09Z mav $ * $Whistle: ng_iface.h,v 1.5 1999/01/20 00:22:13 archie Exp $ */ #ifndef _NETGRAPH_NG_IFACE_H_ #define _NETGRAPH_NG_IFACE_H_ /* Node type name and magic cookie */ #define NG_IFACE_NODE_TYPE "iface" #define NGM_IFACE_COOKIE 1108312559 /* Interface base name */ #define NG_IFACE_IFACE_NAME "ng" /* My hook names */ #define NG_IFACE_HOOK_INET "inet" #define NG_IFACE_HOOK_INET6 "inet6" #define NG_IFACE_HOOK_ATALK "atalk" /* AppleTalk phase 2 */ #define NG_IFACE_HOOK_IPX "ipx" #define NG_IFACE_HOOK_ATM "atm" #define NG_IFACE_HOOK_NATM "natm" /* MTU bounds */ #define NG_IFACE_MTU_MIN 72 #define NG_IFACE_MTU_MAX 65535 #define NG_IFACE_MTU_DEFAULT 1500 /* Netgraph commands */ enum { NGM_IFACE_GET_IFNAME = 1, NGM_IFACE_POINT2POINT, NGM_IFACE_BROADCAST, NGM_IFACE_GET_IFINDEX, }; #define MTAG_NGIF NGM_IFACE_COOKIE #define MTAG_NGIF_CALLED 0 | MTAG_PERSISTENT #endif /* _NETGRAPH_NG_IFACE_H_ */
#ifndef __SECTRANSFORM_INTERNAL__ #define __SECTRANSFORM_INTERNAL__ #ifdef __cplusplus extern "C" { #endif #include "SecTransform.h" CFErrorRef SecTransformConnectTransformsInternal(SecGroupTransformRef groupRef, SecTransformRef sourceTransformRef, CFStringRef sourceAttributeName, SecTransformRef destinationTransformRef, CFStringRef destinationAttributeName); // note: if destinationTransformRef is orphaned (i.e. left with nothing connecting to it and connecting to nothing, it will be removed // from the group. CFErrorRef SecTransformDisconnectTransforms(SecTransformRef destinationTransformRef, CFStringRef destinationAttributeName, SecTransformRef sourceTransformRef, CFStringRef sourceAttributeName); SecTransformRef SecGroupTransformFindLastTransform(SecGroupTransformRef groupTransform); SecTransformRef SecGroupTransformFindMonitor(SecGroupTransformRef groupTransform); bool SecGroupTransformHasMember(SecGroupTransformRef groupTransform, SecTransformRef transform); CF_EXPORT CFStringRef SecTransformDotForDebugging(SecTransformRef transformRef); #ifdef __cplusplus }; #endif #endif
// OpenTissue Template Library // // A generic toolbox for physics based modeling and simulation. // Copyright (c) 2008 Department of Computer Science, University of Copenhagen. // // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php. #ifndef OPENTISSUE_FEM_INITIALIZE_STIFFNESS_PLASTICITY_H #define OPENTISSUE_FEM_INITIALIZE_STIFFNESS_PLASTICITY_H #include <opentissue/configuration.h> #include <opentissue/fem/compute_centroid.h> #include <opentissue/fem/compute_volume.h> #include <opentissue/fem/compute_b.h> #include <opentissue/fem/compute_isotropic_elasticity.h> #include <opentissue/fem/compute_ke.h> #include <tbb/parallel_for.h> namespace opentissue { namespace fem { namespace detail { template<typename fem_mesh, typename real_type> inline void initialize_stiffness_plasticity(fem_mesh &mesh, real_type const &density, real_type const &poisson, real_type const &young, real_type const &c_yield, real_type const &c_max_yield, real_type const &c_creep) { typedef typename fem_mesh::node_iterator node_iterator; typedef typename fem_mesh::tetrahedron_iterator tetrahedron_iterator; node_iterator nbegin = mesh.node_begin(); node_iterator nend = mesh.node_end(); for (node_iterator n = nbegin; n != nend; n++) n->m_world_coord = n->m_coord; tbb::parallel_for(size_t(0), mesh.size_tetrahedra(), [&](size_t i) { tetrahedron_iterator tet = mesh.tetrahedron(i); tet->m_density = density; tet->m_poisson = poisson; tet->m_young = young; tet->m_yield = c_yield; tet->m_max_yield = c_max_yield; tet->m_creep = c_creep; tet->m_e10 = tet->j()->m_coord - tet->i()->m_coord; tet->m_e20 = tet->k()->m_coord - tet->i()->m_coord; tet->m_e30 = tet->m()->m_coord - tet->i()->m_coord; tet->m_volume0 = compute_volume(tet->m_e10, tet->m_e20, tet->m_e30); tet->m_volume = tet->m_volume0; compute_centroid(tet); compute_b(tet); compute_isotropic_elasticity(tet); compute_ke(tet); for (unsigned int i = 0; i < 6; i++) tet->m_plastic[i] = 0; }); } } } } #endif
// Copyright 2014 The Cobalt Authors. 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 COBALT_DOM_HTML_BODY_ELEMENT_H_ #define COBALT_DOM_HTML_BODY_ELEMENT_H_ #include <string> #include "cobalt/dom/html_element.h" namespace cobalt { namespace dom { class Document; // The body element represents the content of the document. // https://www.w3.org/TR/html50/sections.html#the-body-element class HTMLBodyElement : public HTMLElement { public: static const char kTagName[]; explicit HTMLBodyElement(Document* document) : HTMLElement(document, base::Token(kTagName)) {} // Custom, not in any spec. scoped_refptr<HTMLBodyElement> AsHTMLBodyElement() override { return this; } DEFINE_WRAPPABLE_TYPE(HTMLBodyElement); private: ~HTMLBodyElement() override {} }; } // namespace dom } // namespace cobalt #endif // COBALT_DOM_HTML_BODY_ELEMENT_H_
// Copyright 2017 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. // Implementation of SafeBrowsing for WebSockets. This code runs inside the // render process, calling the interface defined in safe_browsing.mojom to // communicate with the SafeBrowsing service. #ifndef COMPONENTS_SAFE_BROWSING_CONTENT_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_ #define COMPONENTS_SAFE_BROWSING_CONTENT_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_ #include <memory> #include "base/macros.h" #include "components/safe_browsing/content/common/safe_browsing.mojom.h" #include "components/safe_browsing/core/common/safe_browsing_url_checker.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/platform/websocket_handshake_throttle.h" #include "url/gurl.h" namespace safe_browsing { class WebSocketSBHandshakeThrottle : public blink::WebSocketHandshakeThrottle, public mojom::UrlCheckNotifier { public: WebSocketSBHandshakeThrottle(mojom::SafeBrowsing* safe_browsing, int render_frame_id); WebSocketSBHandshakeThrottle(const WebSocketSBHandshakeThrottle&) = delete; WebSocketSBHandshakeThrottle& operator=(const WebSocketSBHandshakeThrottle&) = delete; ~WebSocketSBHandshakeThrottle() override; void ThrottleHandshake(const blink::WebURL& url, blink::WebSocketHandshakeThrottle::OnCompletion completion_callback) override; private: enum class State { kInitial, kStarted, kSafe, kBlocked, kNotSupported, }; // mojom::UrlCheckNotifier implementation. void OnCompleteCheck(bool proceed, bool showed_interstitial) override; void OnCheckResult( mojo::PendingReceiver<mojom::UrlCheckNotifier> slow_check_notifier, bool proceed, bool showed_interstitial); void OnMojoDisconnect(); const int render_frame_id_; GURL url_; blink::WebSocketHandshakeThrottle::OnCompletion completion_callback_; mojo::Remote<mojom::SafeBrowsingUrlChecker> url_checker_; mojom::SafeBrowsing* safe_browsing_; std::unique_ptr<mojo::Receiver<mojom::UrlCheckNotifier>> notifier_receiver_; // |state_| is used to validate that events happen in the right order. It // isn't used to control the behaviour of the class. State state_ = State::kInitial; base::WeakPtrFactory<WebSocketSBHandshakeThrottle> weak_factory_{this}; }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CONTENT_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_
/*========================================================================= Program: Visualization Toolkit Module: vtkInformationInformationVectorKey.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkInformationInformationVectorKey - Key for vtkInformation vectors. // .SECTION Description // vtkInformationInformationVectorKey is used to represent keys in // vtkInformation for vectors of other vtkInformation objects. #ifndef vtkInformationInformationVectorKey_h #define vtkInformationInformationVectorKey_h #include "vtkCommonCoreModule.h" // For export macro #include "vtkInformationKey.h" #include "vtkCommonInformationKeyManager.h" // Manage instances of this type. class vtkInformationVector; class VTKCOMMONCORE_EXPORT vtkInformationInformationVectorKey : public vtkInformationKey { public: vtkTypeMacro(vtkInformationInformationVectorKey,vtkInformationKey); void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE; vtkInformationInformationVectorKey(const char* name, const char* location); ~vtkInformationInformationVectorKey(); // Description: // Get/Set the value associated with this key in the given // information object. void Set(vtkInformation* info, vtkInformationVector*); vtkInformationVector* Get(vtkInformation* info); // Description: // Copy the entry associated with this key from one information // object to another. If there is no entry in the first information // object for this key, the value is removed from the second. void ShallowCopy(vtkInformation* from, vtkInformation* to) VTK_OVERRIDE; // Description: // Duplicate (new instance created) the entry associated with this key from // one information object to another (new instances of any contained // vtkInformation and vtkInformationVector objects are created). void DeepCopy(vtkInformation* from, vtkInformation* to) VTK_OVERRIDE; // Description: // Report a reference this key has in the given information object. void Report(vtkInformation* info, vtkGarbageCollector* collector) VTK_OVERRIDE; private: vtkInformationInformationVectorKey(const vtkInformationInformationVectorKey&) VTK_DELETE_FUNCTION; void operator=(const vtkInformationInformationVectorKey&) VTK_DELETE_FUNCTION; }; #endif
// Copyright (c) 2012 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. // // A class that manages a connection to an XMPP server. #ifndef JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ #define JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_ #include <memory> #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "jingle/glue/network_service_config.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" #include "third_party/webrtc/rtc_base/third_party/sigslot/sigslot.h" namespace jingle_xmpp { class PreXmppAuth; class XmlElement; class XmppClientSettings; class XmppTaskParentInterface; } // namespace jingle_xmpp namespace jingle_glue { class TaskPump; } // namespace jingle_glue namespace notifier { class WeakXmppClient; class XmppConnection : public sigslot::has_slots<> { public: class Delegate { public: // Called (at most once) when a connection has been established. // |base_task| can be used by the client as the parent of any Task // it creates as long as it is valid (i.e., non-NULL). virtual void OnConnect( base::WeakPtr<jingle_xmpp::XmppTaskParentInterface> base_task) = 0; // Called if an error has occurred (either before or after a call // to OnConnect()). No calls to the delegate will be made after // this call. Invalidates any weak pointers passed to the client // by OnConnect(). // // |error| is the code for the raised error. |subcode| is an // error-dependent subcode (0 if not applicable). |stream_error| // is non-NULL iff |error| == ERROR_STREAM. |stream_error| is // valid only for the lifetime of this function. // // Ideally, |error| would always be set to something that is not // ERROR_NONE, but due to inconsistent error-handling this doesn't // always happen. virtual void OnError(jingle_xmpp::XmppEngine::Error error, int subcode, const jingle_xmpp::XmlElement* stream_error) = 0; protected: virtual ~Delegate(); }; // Does not take ownership of |delegate|, which must not be // NULL. Takes ownership of |pre_xmpp_auth|, which may be NULL. // // TODO(akalin): Avoid the need for |pre_xmpp_auth|. XmppConnection(const jingle_xmpp::XmppClientSettings& xmpp_client_settings, jingle_glue::GetProxyResolvingSocketFactoryCallback get_socket_factory_callback, Delegate* delegate, jingle_xmpp::PreXmppAuth* pre_xmpp_auth, const net::NetworkTrafficAnnotationTag& traffic_annotation); XmppConnection(const XmppConnection&) = delete; XmppConnection& operator=(const XmppConnection&) = delete; // Invalidates any weak pointers passed to the delegate by // OnConnect(), but does not trigger a call to the delegate's // OnError() function. ~XmppConnection() override; private: FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, RaisedError); FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, Connect); FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, MultipleConnect); FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, ConnectThenError); FRIEND_TEST_ALL_PREFIXES(XmppConnectionTest, TasksDontRunAfterXmppConnectionDestructor); void OnStateChange(jingle_xmpp::XmppEngine::State state); void OnInputLog(const char* data, int len); void OnOutputLog(const char* data, int len); void ClearClient(); std::unique_ptr<jingle_glue::TaskPump> task_pump_; base::WeakPtr<WeakXmppClient> weak_xmpp_client_; bool on_connect_called_; Delegate* delegate_; SEQUENCE_CHECKER(sequence_checker_); }; } // namespace notifier #endif // JINGLE_NOTIFIER_BASE_XMPP_CONNECTION_H_
// Copyright 2017 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 COMPONENTS_OS_CRYPT_KEY_STORAGE_CONFIG_LINUX_H_ #define COMPONENTS_OS_CRYPT_KEY_STORAGE_CONFIG_LINUX_H_ #include <memory> #include <string> #include "base/component_export.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/task/single_thread_task_runner.h" namespace os_crypt { // A container for all the initialisation parameters for OSCrypt. struct COMPONENT_EXPORT(OS_CRYPT) Config { public: Config(); Config(const Config&) = delete; Config& operator=(const Config&) = delete; ~Config(); // Force OSCrypt to use a specific linux password store. std::string store; // The product name to use for permission prompts. std::string product_name; // The application name to store the key under. For Chromium/Chrome builds // leave this unset and it will default correctly. This config option is // for embedders to provide their application name in place of "Chromium". // Only used when the allow_runtime_configurable_key_storage feature is // enabled. std::string application_name; // A runner on the main thread for gnome-keyring to be called from. // TODO(crbug/466975): Libsecret and KWallet don't need this. We can remove // this when we stop supporting keyring. scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner; // Controls whether preference on using or ignoring backends is used. bool should_use_preference; // Preferences are stored in a separate file in the user data directory. base::FilePath user_data_path; }; } // namespace os_crypt #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_CONFIG_LINUX_H_
// Copyright 2018-present 650 Industries. All rights reserved. #import <ABI42_0_0UMCore/ABI42_0_0UMExportedModule.h> #import <ABI42_0_0UMCore/ABI42_0_0UMModuleRegistryConsumer.h> #import <ABI42_0_0UMCore/ABI42_0_0UMEventEmitter.h> #import <ABI42_0_0UMCore/ABI42_0_0UMEventEmitterService.h> @import AuthenticationServices; @interface ABI42_0_0EXAppleAuthentication : ABI42_0_0UMExportedModule <ABI42_0_0UMModuleRegistryConsumer, ABI42_0_0UMEventEmitter> @end
/* * Epsilon - Core * * Type definitions for the X11 platform. * * 07 June 2004 * Coded by Andy Friesen * See license.txt for redistribution terms. */ #ifndef EPS_CORE_TYPES_WIN32_H #define EPS_CORE_TYPES_WIN32_H #if !defined(EPS_X11) # error How did you get here? This is X11 code. #endif // config.h? #ifdef __cplusplus # define EPS_EXTERN_C extern "C" #else # define EPS_EXTERN_C #endif // combinatorics are a real bitch #if defined(EPS_WINDOWS) # if defined(_USRDLL) # if defined(EPS_EXPORTING) # define EPS_EXPORT(type) EPS_EXTERN_C __declspec(dllexport) type __stdcall # else # define EPS_EXPORT(type) EPS_EXTERN_C __declspec(dllimport) type __stdcall # endif # else # define EPS_EXPORT(type) EPS_EXTERN_C type __stdcall # endif #else # define EPS_EXPORT(type) EPS_EXTERN_C type #endif #if defined (__GNUC__) // GCC #ifdef EPS_UNICODE typedef wchar_t eps_char; #else typedef char eps_char; #endif typedef unsigned char eps_u8; typedef signed char eps_s8; typedef unsigned short int eps_u16; typedef signed short int eps_s16; typedef unsigned int eps_u32; typedef signed int eps_s32; typedef unsigned long long eps_u64; typedef long long eps_s64; typedef unsigned int eps_uint; typedef signed int eps_int; typedef eps_uint eps_bool; typedef struct { eps_u16 low, high; } eps_u16_x2; typedef struct { eps_s16 low, high; } eps_s16_x2; #else # error Unsupported compiler! Fixme! #endif #endif
// Copyright 2010-2016, 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. #ifndef MOZC_CONFIG_STATS_CONFIG_UTIL_MOCK_H_ #define MOZC_CONFIG_STATS_CONFIG_UTIL_MOCK_H_ #include "config/stats_config_util.h" namespace mozc { namespace config { class StatsConfigUtilMock : public StatsConfigUtilInterface { public: StatsConfigUtilMock() : is_enabled_(true) {} virtual ~StatsConfigUtilMock() {} virtual bool IsEnabled() { return is_enabled_; } virtual bool SetEnabled(bool val) { is_enabled_ = val; return true; } private: bool is_enabled_; }; } // namespace config } // namespace mozc #endif // MOZC_CONFIG_STATS_CONFIG_UTIL_MOCK_H_
/***************************************************************************** Copyright (c) 2011, Intel Corp. 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 Intel Corporation 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. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function sgges * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_sgges( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int ldvsl, float* vsr, lapack_int ldvsr ) { lapack_int info = 0; lapack_int lwork = -1; lapack_logical* bwork = NULL; float* work = NULL; float work_query; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sgges", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_order, n, n, a, lda ) ) { return -7; } if( LAPACKE_sge_nancheck( matrix_order, n, n, b, ldb ) ) { return -9; } #endif /* Allocate memory for working array(s) */ if( LAPACKE_lsame( sort, 's' ) ) { bwork = (lapack_logical*) LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) ); if( bwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } } /* Query optimal working array(s) size */ info = LAPACKE_sgges_work( matrix_order, jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr, &work_query, lwork, bwork ); if( info != 0 ) { goto exit_level_1; } lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sgges_work( matrix_order, jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, bwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: if( LAPACKE_lsame( sort, 's' ) ) { LAPACKE_free( bwork ); } exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sgges", info ); } return info; }
// Copyright 2016 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 ForeignFetchRespondWithObserver_h #define ForeignFetchRespondWithObserver_h #include "modules/serviceworkers/RespondWithObserver.h" namespace blink { // This class observes the service worker's handling of a ForeignFetchEvent and // notifies the client. class MODULES_EXPORT ForeignFetchRespondWithObserver final : public RespondWithObserver { public: static ForeignFetchRespondWithObserver* create(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext); void responseWasFulfilled(const ScriptValue&) override; private: ForeignFetchRespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext); }; } // namespace blink #endif // ForeignFetchRespondWithObserver_h
#include <stdlib.h> /* malloc, free, rand, system */ #include "sdk_config.h" #include "sems.h" #include "ble_services.h" #include "ble_action_service.h" #include "ble_srv_common.h" #include "sdk_common.h" #include "nrf_log.h" #include "nrf_log_ctrl.h" #include "pb_decode.h" static ble_action_service_t ble_service; static sems_action_handler action_handler; static void on_write(ble_evt_t * p_ble_evt) { if(p_ble_evt->evt.gatts_evt.params.write.handle==ble_service.action_char_handles.value_handle) { NRF_LOG_INFO("receive value called \n"); ble_gatts_evt_write_t *p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; NRF_LOG_INFO("receive value length %d \n",p_evt_write->len); sems_ActionData action_data=sems_ActionData_init_zero; pb_istream_t stream = pb_istream_from_buffer(p_evt_write->data, p_evt_write->len); bool status = pb_decode(&stream, sems_ActionData_fields, &action_data); NRF_LOG_INFO("decode status %d \n",status); NRF_LOG_FLUSH(); if(status==true){ if(action_handler!=NULL) { action_handler(&action_data); } } } } void sems_ble_on_action_evt(ble_evt_t * p_ble_evt) { switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: ble_on_connect(&ble_service.conn_handle,p_ble_evt); break; case BLE_GAP_EVT_DISCONNECTED: ble_on_disconnect(&ble_service.conn_handle,p_ble_evt); break; case BLE_GATTS_EVT_WRITE: on_write(p_ble_evt); break; default: // No implementation needed. break; } } uint32_t sems_ble_action_service_init() { uint32_t err_code; ble_service.conn_handle=BLE_CONN_HANDLE_INVALID; // Add service. err_code=sems_add_service_uuid(LBS_UUID_ACTION_SERVICE,&ble_service.uuid_type,&ble_service.service_handle); VERIFY_SUCCESS(err_code); // Add characteristics. err_code = sems_add_char_uuid(LBS_UUID_ACTION_CHAR,&ble_service.uuid_type,&ble_service.service_handle,&ble_service.action_char_handles,0,1,30); VERIFY_SUCCESS(err_code); return NRF_SUCCESS; } void sems_set_action_handler(sems_action_handler handler) { action_handler=handler; }
// Copyright (c) 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef QUICHE_QUIC_TOOLS_EPOLL_CLIENT_FACTORY_H_ #define QUICHE_QUIC_TOOLS_EPOLL_CLIENT_FACTORY_H_ #include "net/third_party/quiche/src/quic/platform/api/quic_epoll.h" #include "net/third_party/quiche/src/quic/tools/quic_toy_client.h" namespace quic { // Factory creating QuicClient instances. class QuicEpollClientFactory : public QuicToyClient::ClientFactory { public: std::unique_ptr<QuicSpdyClientBase> CreateClient( std::string host_for_handshake, std::string host_for_lookup, uint16_t port, ParsedQuicVersionVector versions, std::unique_ptr<ProofVerifier> verifier) override; private: QuicEpollServer epoll_server_; }; } // namespace quic #endif // QUICHE_QUIC_TOOLS_EPOLL_CLIENT_FACTORY_H_
// Copyright © 2019 650 Industries. All rights reserved. #import <EXUpdates/EXUpdatesUpdate.h> NS_ASSUME_NONNULL_BEGIN @protocol EXUpdatesAppLauncher @property (nullable, nonatomic, strong, readonly) EXUpdatesUpdate *launchedUpdate; @property (nullable, nonatomic, strong, readonly) NSURL *launchAssetUrl; @property (nullable, nonatomic, strong, readonly) NSDictionary *assetFilesMap; @property (nonatomic, assign, readonly) BOOL isUsingEmbeddedAssets; @end NS_ASSUME_NONNULL_END
/* * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ #ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedCalculationCollectionType #define _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedCalculationCollectionType namespace AIMXML { class CreferencedCalculationCollectionType : public TypeBase { public: AIMXML_EXPORT CreferencedCalculationCollectionType(xercesc::DOMNode* const& init); AIMXML_EXPORT CreferencedCalculationCollectionType(CreferencedCalculationCollectionType const& init); void operator=(CreferencedCalculationCollectionType const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_altova_CreferencedCalculationCollectionType); } MemberElement<CReferencedCalculation, _altova_mi_altova_CreferencedCalculationCollectionType_altova_ReferencedCalculation> ReferencedCalculation; struct ReferencedCalculation { typedef Iterator<CReferencedCalculation> iterator; }; }; } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA__ALTOVA_CreferencedCalculationCollectionType
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-54a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sink: w32_spawnv * BadSink : execute command with spawnv * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54b_badSink(char * data); void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54_bad() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; char *replace; SOCKET connectSocket = INVALID_SOCKET; size_t dataLen = strlen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a connect socket */ connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* Abort on error or the connection was closed */ recvResult = recv(connectSocket, (char *)(data + dataLen), sizeof(char) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(char)] = '\0'; /* Eliminate CRLF */ replace = strchr(data, '\r'); if (replace) { *replace = '\0'; } replace = strchr(data, '\n'); if (replace) { *replace = '\0'; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54b_goodG2BSink(char * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54b_goodG2BSink(data); } void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_54_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__short_rand_predec_54a.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-54a.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: rand Set data to result of rand() * GoodSource: Set data to a small, non-zero number (negative two) * Sinks: decrement * GoodSink: Ensure there will not be an underflow before decrementing data * BadSink : Decrement data, which can cause an Underflow * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD /* bad function declaration */ void CWE191_Integer_Underflow__short_rand_predec_54b_badSink(short data); void CWE191_Integer_Underflow__short_rand_predec_54_bad() { short data; data = 0; /* POTENTIAL FLAW: Use a random value */ data = (short)RAND32(); CWE191_Integer_Underflow__short_rand_predec_54b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE191_Integer_Underflow__short_rand_predec_54b_goodG2BSink(short data); static void goodG2B() { short data; data = 0; /* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */ data = -2; CWE191_Integer_Underflow__short_rand_predec_54b_goodG2BSink(data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE191_Integer_Underflow__short_rand_predec_54b_goodB2GSink(short data); static void goodB2G() { short data; data = 0; /* POTENTIAL FLAW: Use a random value */ data = (short)RAND32(); CWE191_Integer_Underflow__short_rand_predec_54b_goodB2GSink(data); } void CWE191_Integer_Underflow__short_rand_predec_54_good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE191_Integer_Underflow__short_rand_predec_54_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE191_Integer_Underflow__short_rand_predec_54_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ #include <stddef.h> #include <memory> #include <set> #include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "extensions/common/extension_id.h" #include "extensions/common/features/feature.h" #include "extensions/renderer/renderer_extension_registry.h" #include "extensions/renderer/script_context_set_iterable.h" #include "url/gurl.h" #include "v8/include/v8-forward.h" class GURL; namespace blink { class WebLocalFrame; class WebSecurityOrigin; } namespace content { class RenderFrame; } namespace extensions { class Extension; class ScriptContext; // A container of ScriptContexts, responsible for both creating and managing // them. // // Since calling JavaScript within a context can cause any number of contexts // to be created or destroyed, this has additional smarts to help with the set // changing underneath callers. class ScriptContextSet : public ScriptContextSetIterable { public: explicit ScriptContextSet( // Set of the IDs of extensions that are active in this process. // Must outlive this. TODO(kalman): Combine this and |extensions|. ExtensionIdSet* active_extension_ids); ScriptContextSet(const ScriptContextSet&) = delete; ScriptContextSet& operator=(const ScriptContextSet&) = delete; ~ScriptContextSet() override; // Returns the number of contexts being tracked by this set. // This may also include invalid contexts. TODO(kalman): Useful? size_t size() const { return contexts_.size(); } const std::set<ScriptContext*>& contexts() const { return contexts_; } // Creates and starts managing a new ScriptContext. Ownership is held. // Returns a weak reference to the new ScriptContext. ScriptContext* Register(blink::WebLocalFrame* frame, const v8::Local<v8::Context>& v8_context, int32_t world_id); // If the specified context is contained in this set, remove it, then delete // it asynchronously. After this call returns the context object will still // be valid, but its frame() pointer will be cleared. void Remove(ScriptContext* context); // Gets the ScriptContext corresponding to v8::Context::GetCurrent(), or // NULL if no such context exists. ScriptContext* GetCurrent() const; // Gets the ScriptContext corresponding to the specified // v8::Context or NULL if no such context exists. ScriptContext* GetByV8Context(const v8::Local<v8::Context>& context) const; // Static equivalent of the above. static ScriptContext* GetContextByV8Context( const v8::Local<v8::Context>& context); // Returns the ScriptContext corresponding to the V8 context that created the // given |object|. // Note: The provided |object| may belong to a v8::Context in another frame, // as can happen when a parent frame uses an object of an embedded iframe. // In this case, there may be no associated ScriptContext, since the child // frame can be hosted in another process. Thus, callers of this need to // null-check the result (and should also always check whether or not the // context has access to the other context). static ScriptContext* GetContextByObject(const v8::Local<v8::Object>& object); // Returns the ScriptContext corresponding to the main world of the // |render_frame|. static ScriptContext* GetMainWorldContextForFrame( content::RenderFrame* render_frame); // ScriptContextIterable: void ForEach( const std::string& extension_id, content::RenderFrame* render_frame, const base::RepeatingCallback<void(ScriptContext*)>& callback) override; // Cleans up contexts belonging to an unloaded extension. void OnExtensionUnloaded(const std::string& extension_id); void set_is_lock_screen_context(bool is_lock_screen_context) { is_lock_screen_context_ = is_lock_screen_context; } // Adds the given |context| for testing purposes. void AddForTesting(std::unique_ptr<ScriptContext> context); private: // Finds the extension for the JavaScript context associated with the // specified |frame| and isolated world. If |world_id| is zero, finds the // extension ID associated with the main world's JavaScript context. If the // JavaScript context isn't from an extension, returns empty string. const Extension* GetExtensionFromFrameAndWorld(blink::WebLocalFrame* frame, int32_t world_id, bool use_effective_url); // Returns the Feature::Context type of context for a JavaScript context. Feature::Context ClassifyJavaScriptContext( const Extension* extension, int32_t world_id, const GURL& url, const blink::WebSecurityOrigin& origin, const blink::WebLocalFrame* frame = nullptr ); // Weak reference to all installed Extensions that are also active in this // process. ExtensionIdSet* active_extension_ids_; // The set of all ScriptContexts we own. std::set<ScriptContext*> contexts_; // Whether the script context set is associated with the renderer active on // the Chrome OS lock screen. bool is_lock_screen_context_ = false; }; } // namespace extensions #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_06.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__CWE131.label.xml Template File: sources-sink-06.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate memory without using sizeof(int) * GoodSource: Allocate memory using sizeof(int) * Sink: loop * BadSink : Copy array to data using a loop * Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5) * * */ #include "std_testcase.h" /* The variable below is declared "const", so a tool should be able * to identify that reads of this will always give its initialized value. */ static const int STATIC_CONST_FIVE = 5; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_06_bad() { int * data; data = NULL; if(STATIC_CONST_FIVE==5) { /* FLAW: Allocate memory without using sizeof(int) */ data = (int *)malloc(10); if (data == NULL) {exit(-1);} } { int source[10] = {0}; size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ for (i = 0; i < 10; i++) { data[i] = source[i]; } printIntLine(data[0]); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */ static void goodG2B1() { int * data; data = NULL; if(STATIC_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Allocate memory using sizeof(int) */ data = (int *)malloc(10*sizeof(int)); if (data == NULL) {exit(-1);} } { int source[10] = {0}; size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ for (i = 0; i < 10; i++) { data[i] = source[i]; } printIntLine(data[0]); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { int * data; data = NULL; if(STATIC_CONST_FIVE==5) { /* FIX: Allocate memory using sizeof(int) */ data = (int *)malloc(10*sizeof(int)); if (data == NULL) {exit(-1);} } { int source[10] = {0}; size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */ for (i = 0; i < 10; i++) { data[i] = source[i]; } printIntLine(data[0]); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_06_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_06_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__CWE131_loop_06_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2015 The Cobalt Authors. 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 COBALT_ACCOUNT_ACCOUNT_MANAGER_H_ #define COBALT_ACCOUNT_ACCOUNT_MANAGER_H_ #include <string> namespace cobalt { namespace account { // Glue for h5vcc to get properties for the current user. // The AccountManager will be owned by BrowserModule. class AccountManager { public: AccountManager(); AccountManager(const AccountManager&) = delete; AccountManager& operator=(const AccountManager&) = delete; ~AccountManager() {} // Get the avatar URL associated with the account, if any. std::string GetAvatarURL(); // Get the username associated with the account. Due to restrictions on // some platforms, this may return the user ID or an empty string. std::string GetUsername(); // Get the user ID associated with the account. std::string GetUserId(); }; } // namespace account } // namespace cobalt #endif // COBALT_ACCOUNT_ACCOUNT_MANAGER_H_
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * * THE BSD LICENSE * * 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 the 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. */ #ifndef LIBXSD2CPP_INTEGER_H #define LIBXSD2CPP_INTEGER_H #include "nspr.h" #include "libxsd2cpp.h" #include "Simple.h" namespace LIBXSD2CPP_NAMESPACE { //----------------------------------------------------------------------------- // Integer //----------------------------------------------------------------------------- /** * Integer is an Element that accepts only integral values. */ class LIBXSD2CPP_EXPORT Integer : public Simple { public: /** * Instantiates an Integer object based on an element from a DOM tree. */ static Integer *createIntegerInstance(const DOMElement *elementArg) { return new Integer(elementArg); } /** * Instantiates an Integer object based on an element from a DOM tree. */ Integer(const DOMElement *elementArg); /** * Returns the Integer's value in the range [PR_INT32_MIN, PR_INT32_MAX]. */ PRInt32 getInt32Value() const; /** * Returns the Integer's value. */ PRInt64 getInt64Value() const { return int64Value; } /** * Returns the Integer's value. */ operator PRInt64() const { return int64Value; } private: PRInt64 int64Value; }; } // namespace LIBXSD2CPP_NAMESPACE #endif // LIBXSD2CPP_INTEGER_H
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_WINDOW_WINDOW_BUTTON_ORDER_PROVIDER_H_ #define UI_VIEWS_WINDOW_WINDOW_BUTTON_ORDER_PROVIDER_H_ #include <vector> #include "base/macros.h" #include "ui/views/views_export.h" #include "ui/views/window/frame_buttons.h" namespace views { // Stores the ordering of window control buttons. Provides a default ordering // of |kMinimize|, |FrameButton::kMaximize|, |FrameButton::kClose|, where all // controls are on the trailing end of a window. // // On Linux users can provide configuration files to control the ordering. This // configuration is checked and overrides the defaults. class VIEWS_EXPORT WindowButtonOrderProvider { public: static WindowButtonOrderProvider* GetInstance(); const std::vector<views::FrameButton>& leading_buttons() const { return leading_buttons_; } const std::vector<views::FrameButton>& trailing_buttons() const { return trailing_buttons_; } void SetWindowButtonOrder( const std::vector<views::FrameButton>& leading_buttons, const std::vector<views::FrameButton>& trailing_buttons); protected: WindowButtonOrderProvider(); virtual ~WindowButtonOrderProvider(); private: static WindowButtonOrderProvider* instance_; // Layout arrangement of the window caption buttons. On linux these will be // set via a WindowButtonOrderObserver. On other platforms a default // arrangement of a trailing minimize, maximize, close, will be set. std::vector<views::FrameButton> leading_buttons_; std::vector<views::FrameButton> trailing_buttons_; DISALLOW_COPY_AND_ASSIGN(WindowButtonOrderProvider); }; } // namespace views #endif // UI_VIEWS_WINDOW_WINDOW_BUTTON_ORDER_PROVIDER_H_
#include "common.h" #include <sys/types.h> #include <sys/socket.h> #include <netinet/tcp.h> /* These functions provide data and function callback support */ memcached_return memcached_callback_set(memcached_st *ptr, memcached_callback flag, void *data) { switch (flag) { case MEMCACHED_CALLBACK_PREFIX_KEY: { char *key= (char *)data; if (key) { size_t key_length= strlen(key); if (memcachd_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED) { return MEMCACHED_BAD_KEY_PROVIDED; } if ((key_length > MEMCACHED_PREFIX_KEY_MAX_SIZE -1) || (strcpy(ptr->prefix_key, key) == NULL)) { ptr->prefix_key_length= 0; return MEMCACHED_BAD_KEY_PROVIDED; } else { ptr->prefix_key_length= key_length; } } else { memset(ptr->prefix_key, 0, MEMCACHED_PREFIX_KEY_MAX_SIZE); ptr->prefix_key_length= 0; } break; } case MEMCACHED_CALLBACK_USER_DATA: { ptr->user_data= data; break; } case MEMCACHED_CALLBACK_CLEANUP_FUNCTION: { memcached_cleanup_func func= (memcached_cleanup_func)data; ptr->on_cleanup= func; break; } case MEMCACHED_CALLBACK_CLONE_FUNCTION: { memcached_clone_func func= (memcached_clone_func)data; ptr->on_clone= func; break; } case MEMCACHED_CALLBACK_MALLOC_FUNCTION: { memcached_malloc_function func= (memcached_malloc_function)data; ptr->call_malloc= func; break; } case MEMCACHED_CALLBACK_REALLOC_FUNCTION: { memcached_realloc_function func= (memcached_realloc_function)data; ptr->call_realloc= func; break; } case MEMCACHED_CALLBACK_FREE_FUNCTION: { memcached_free_function func= (memcached_free_function)data; ptr->call_free= func; break; } case MEMCACHED_CALLBACK_GET_FAILURE: { memcached_trigger_key func= (memcached_trigger_key)data; ptr->get_key_failure= func; break; } case MEMCACHED_CALLBACK_DELETE_TRIGGER: { memcached_trigger_delete_key func= (memcached_trigger_delete_key)data; ptr->delete_trigger= func; break; } default: return MEMCACHED_FAILURE; } return MEMCACHED_SUCCESS; } void *memcached_callback_get(memcached_st *ptr, memcached_callback flag, memcached_return *error) { memcached_return local_error; if (!error) error = &local_error; switch (flag) { case MEMCACHED_CALLBACK_PREFIX_KEY: { if (ptr->prefix_key[0] == 0) { *error= MEMCACHED_FAILURE; return NULL; } else { *error= MEMCACHED_SUCCESS; return (void *)ptr->prefix_key; } } case MEMCACHED_CALLBACK_USER_DATA: { *error= ptr->user_data ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->user_data; } case MEMCACHED_CALLBACK_CLEANUP_FUNCTION: { *error= ptr->on_cleanup ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->on_cleanup; } case MEMCACHED_CALLBACK_CLONE_FUNCTION: { *error= ptr->on_clone ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->on_clone; } case MEMCACHED_CALLBACK_MALLOC_FUNCTION: { *error= ptr->call_malloc ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->call_malloc; } case MEMCACHED_CALLBACK_REALLOC_FUNCTION: { *error= ptr->call_realloc ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->call_realloc; } case MEMCACHED_CALLBACK_FREE_FUNCTION: { *error= ptr->call_free ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->call_free; } case MEMCACHED_CALLBACK_GET_FAILURE: { *error= ptr->get_key_failure ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->get_key_failure; } case MEMCACHED_CALLBACK_DELETE_TRIGGER: { *error= ptr->delete_trigger ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE; return (void *)ptr->delete_trigger; } default: WATCHPOINT_ASSERT(0); *error= MEMCACHED_FAILURE; return NULL; } }
// Copyright 2016 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 COMPONENTS_EMBEDDER_SUPPORT_ORIGIN_TRIALS_ORIGIN_TRIAL_POLICY_IMPL_H_ #define COMPONENTS_EMBEDDER_SUPPORT_ORIGIN_TRIALS_ORIGIN_TRIAL_POLICY_IMPL_H_ #include <set> #include <string> #include "base/macros.h" #include "base/strings/string_piece.h" #include "third_party/blink/public/common/origin_trials/origin_trial_policy.h" namespace embedder_support { // This class is instantiated on the main/ui thread, but its methods can be // accessed from any thread. class OriginTrialPolicyImpl : public blink::OriginTrialPolicy { public: OriginTrialPolicyImpl(); ~OriginTrialPolicyImpl() override; // blink::OriginTrialPolicy interface bool IsOriginTrialsSupported() const override; std::vector<base::StringPiece> GetPublicKeys() const override; bool IsFeatureDisabled(base::StringPiece feature) const override; bool IsTokenDisabled(base::StringPiece token_signature) const override; bool IsOriginSecure(const GURL& url) const override; bool SetPublicKeysFromASCIIString(const std::string& ascii_public_key); bool SetDisabledFeatures(const std::string& disabled_feature_list); bool SetDisabledTokens(const std::string& disabled_token_list); private: std::vector<std::string> public_keys_; std::set<std::string> disabled_features_; std::set<std::string> disabled_tokens_; DISALLOW_COPY_AND_ASSIGN(OriginTrialPolicyImpl); }; } // namespace embedder_support #endif // COMPONENTS_EMBEDDER_SUPPORT_ORIGIN_TRIALS_ORIGIN_TRIAL_POLICY_IMPL_H_
// ============================================================================ #ifndef OSTAP_TREEGETTER_H #define OSTAP_TREEGETTER_H 1 // ============================================================================ // Include files // ============================================================================ /// STD&STL // ============================================================================ #include <memory> #include <vector> #include <string> // ============================================================================ // Ostap // ============================================================================ #include "Ostap/Notifier.h" #include "Ostap/Formula.h" #include "Ostap/StatusCode.h" // ============================================================================ // Forward declarations // ============================================================================ class TTree ; // ROOT // ============================================================================ namespace Ostap { // ========================================================================== namespace Trees { // ======================================================================== /** @class Getter * Helper class to get value for the certains expressions * @author Vanya BELYAEV Ivan.Belyaev@itep.ru * @date 2021-09-22 */ class Getter { public: // ====================================================================== /// constuctor form the tree and list of expressions Getter ( TTree* tree , const std::vector<std::string>& expressions ) ; /// constructor from the tree and expression Getter ( TTree* tree , const std::string& expression ) ; /// constructor from the tree and expressions Getter ( TTree* tree , const std::string& expression1 , const std::string& expression2 ) ; /// constructor from the tree and expressions Getter ( TTree* tree , const std::string& expression1 , const std::string& expression2 , const std::string& expression3 ) ; /// constructor from the tree and expressions Getter ( TTree* tree , const std::string& expression1 , const std::string& expression2 , const std::string& expression3 , const std::string& expression4 ) ; /// constructor from the tree and expressions Getter ( TTree* tree , const std::string& expression1 , const std::string& expression2 , const std::string& expression3 , const std::string& expression4 , const std::string& expression5 ) ; // ====================================================================== /// copy constructor Getter ( const Getter& ) = delete ; /// move constructor Getter ( Getter&& ) ; // ====================================================================== public: // ====================================================================== /// get the tree TTree* tree() const { return m_tree ; } // ====================================================================== /// get the results Ostap::StatusCode eval ( std::vector<double>& result ) const ; // ====================================================================== private: // ====================================================================== /// The tree TTree* m_tree { nullptr } ; /// notifier for the formulas and the tree std::unique_ptr<Ostap::Utils::Notifier> m_notifier { nullptr } ; // list of formulas std::vector<std::unique_ptr<Ostap::Formula> > m_formulas {} ; // ====================================================================== } ; } // The end of namespace Ostap::Trees // ========================================================================== } // The end of namesapce Ostap // ============================================================================ // The END // ============================================================================ #endif // OSTAP_TREEGETTER_H // ============================================================================
#include <stdio.h> void swap ( int a, int b ); void swap_p ( int *a, int *b ); int c = 8; int d = 10; void main () { int i = 0; int j = 0; int a = 5; int b = 7; printf ( "before swap a = %d; b = %d;\n", a, b ); swap ( a, b ); printf ( "after swap a = %d; b = %d;\n", a, b ); printf ( "------------------------------------\n" ); printf ( "before swap c = %d; d = %d;\n", c, d ); swap ( c, d ); printf ( "after swap c = %d; d = %d;\n", c, d ); printf ( "------------------------------------\n" ); printf ( "------------------------------------\n" ); printf ( "before swap c = %d; d = %d;\n", c, d ); swap_p ( &c, &d ); printf ( "after swap c = %d; d = %d;\n", c, d ); printf ( "------------------------------------\n" ); } void swap ( int a, int b ) { int temp = 0; printf ( "in func before swap a = %d; b = %d;\n", a, b ); temp = a; a = b; b = temp; printf ( "in func after swap a = %d; b = %d;\n", a, b ); } void swap_p ( int *a, int *b ) { int temp = 0; printf ( "in func before swap *a = %d; *b = %d;\n", *a, *b ); temp = *a; *a = *b; *b = temp; printf ( "in func after swap *a = %d; *b = %d;\n", *a, *b ); }
#include "minig.h" void entity_update_sprite(entity_t* ent, uint x, uint y) { uint maxx = ent->sprite->count_x; uint maxy = ent->sprite->count_y; uint mult = ent->sprite->pixs; // float x0,y0, x1, y1; float fmultx = (float)mult / (float)ent->texture->x; float fmulty = (float)mult / (float)ent->texture->y; ent->tex_coord[0] = ((x % maxx) ) * fmultx; ent->tex_coord[1] = ((y % maxy) ) * fmulty; ent->tex_coord[2] = ((x % maxx) +1) * fmultx; ent->tex_coord[3] = ((y % maxy) ) * fmulty; ent->tex_coord[4] = ((x % maxx) ) * fmultx; ent->tex_coord[5] = ((y % maxy) +1) * fmulty; ent->tex_coord[6] = ((x % maxx) +1) * fmultx; ent->tex_coord[7] = ((y % maxy) +1) * fmulty; } static bool particle_created = false; static texture_t* ent_particle_tex = NULL; static sprite_t* ent_particle_sprite = NULL; entity_t* entity_create_particle(void) { if (!particle_created) { ent_particle_tex = texture_create("particles_sprite_sheet_x2_smooth.png"); ent_particle_sprite = malloc(sizeof(sprite_t)); ent_particle_sprite->count_x = 32; ent_particle_sprite->count_y = 11; // ent_particle_sprite->pixs = 16*2; ent_particle_sprite->pixs = 32; particle_created = true; } entity_t* ent = malloc(sizeof(entity_t)); ent->pos_x = 0.0; ent->pos_y = 0.0; ent->texture = ent_particle_tex; ent->sprite = ent_particle_sprite; ent->sprite_x = 0; ent->sprite_y = 0; glGenBuffers(1, &ent->tex_coord_buffer); return ent; } void entity_delete(entity_t* ent){ glDeleteBuffers(1, &ent->tex_coord_buffer); free(ent); ent = NULL; } void entity_particle_init(void) { if (!particle_created) { ent_particle_tex = texture_create("particles_sprite_sheet_x2_smooth.png"); ent_particle_sprite = malloc(sizeof(sprite_t)); ent_particle_sprite->count_x = 32; ent_particle_sprite->count_y = 11; ent_particle_sprite->pixs = 16*2; particle_created = true; } } void entity_particle_quit(void) { if (particle_created) { texture_delete(ent_particle_tex); ent_particle_tex = NULL; free(ent_particle_sprite); ent_particle_sprite = NULL; particle_created = false; } }
// Copyright 2018 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 ASH_SYSTEM_UNIFIED_UNIFIED_SYSTEM_TRAY_MODEL_H_ #define ASH_SYSTEM_UNIFIED_UNIFIED_SYSTEM_TRAY_MODEL_H_ #include "ash/ash_export.h" #include "ash/public/cpp/pagination/pagination_model.h" #include "base/observer_list.h" #include "chromeos/dbus/power/power_manager_client.h" namespace ash { // Model class that stores UnifiedSystemTray's UI specific variables. Owned by // UnifiedSystemTray status area button. Not to be confused with UI agnostic // SystemTrayModel. class ASH_EXPORT UnifiedSystemTrayModel { public: enum class StateOnOpen { // The user has not made any changes to the quick settings state. UNSET, // Quick settings has been explicitly set to collapsed by the user. COLLAPSED, // Quick settings has been explicitly set to expanded by the user. EXPANDED }; enum class NotificationTargetMode { // Notification list scrolls to the last notification. LAST_NOTIFICATION, // Notification list scrolls to the last scroll position. LAST_POSITION, // Notification list scrolls to the specified notification defined by // |SetTargetNotification(notification_id)|. NOTIFICATION_ID, }; class Observer { public: virtual ~Observer() {} // |by_user| is true when brightness is changed by user action. virtual void OnDisplayBrightnessChanged(bool by_user) {} virtual void OnKeyboardBrightnessChanged(bool by_user) {} }; explicit UnifiedSystemTrayModel(views::View* owner_view); ~UnifiedSystemTrayModel(); void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); // Returns true if the tray should be expanded when initially opened. bool IsExpandedOnOpen() const; // Returns true if the user explicity set the tray to its // expanded state. bool IsExplicitlyExpanded() const; // Returns empty if it's not manually expanded/collapsed. Otherwise, the value // is true if the notification is manually expanded, and false if it's // manually collapsed. base::Optional<bool> GetNotificationExpanded( const std::string& notification_id) const; // Sets a notification of |notification_id| is manually |expanded|. void SetNotificationExpanded(const std::string& notification_id, bool expanded); // Removes the state of the notification of |notification_id|. void RemoveNotificationExpanded(const std::string& notification_id); // Clears all changes by SetNotificatinExpanded(). void ClearNotificationChanges(); // Set the notification id of the target. This sets target mode as // NOTIFICATION_ID. void SetTargetNotification(const std::string& notification_id); float display_brightness() const { return display_brightness_; } float keyboard_brightness() const { return keyboard_brightness_; } void set_expanded_on_open(StateOnOpen expanded_on_open) { expanded_on_open_ = expanded_on_open; } void set_notification_target_mode(NotificationTargetMode mode) { notification_target_mode_ = mode; } NotificationTargetMode notification_target_mode() const { return notification_target_mode_; } const std::string& notification_target_id() const { return notification_target_id_; } PaginationModel* pagination_model() { return pagination_model_.get(); } private: class DBusObserver; void DisplayBrightnessChanged(float brightness, bool by_user); void KeyboardBrightnessChanged(float brightness, bool by_user); // Target mode which is used to decide the scroll position of the message // center on opening. See the comment in |NotificationTargetMode|. NotificationTargetMode notification_target_mode_ = NotificationTargetMode::LAST_NOTIFICATION; // Set the notification id of the target. This id is used if the target mode // is NOTIFICATION_ID. std::string notification_target_id_; // If UnifiedSystemTray bubble is expanded on its open. It's expanded by // default, and if a user collapses manually, it remembers previous state. StateOnOpen expanded_on_open_ = StateOnOpen::UNSET; // The last value of the display brightness slider. Between 0.0 and 1.0. float display_brightness_ = 1.f; // The last value of the keyboard brightness slider. Between 0.0 and 1.0. float keyboard_brightness_ = 1.f; // Stores Manual changes to notification expanded / collapsed state in order // to restore on reopen. // <notification ID, if notification is manually expanded> std::map<std::string, bool> notification_changes_; std::unique_ptr<DBusObserver> dbus_observer_; base::ObserverList<Observer>::Unchecked observers_; std::unique_ptr<PaginationModel> pagination_model_; DISALLOW_COPY_AND_ASSIGN(UnifiedSystemTrayModel); }; } // namespace ash #endif // ASH_SYSTEM_UNIFIED_UNIFIED_SYSTEM_TRAY_MODEL_H_
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROMEOS_DBUS_FAKE_LORGNETTE_MANAGER_CLIENT_H_ #define CHROMEOS_DBUS_FAKE_LORGNETTE_MANAGER_CLIENT_H_ #include <map> #include <string> #include <tuple> #include "base/macros.h" #include "chromeos/dbus/lorgnette_manager_client.h" namespace chromeos { // Lorgnette LorgnetteManagerClient implementation used on Linux desktop, // which does nothing. class COMPONENT_EXPORT(CHROMEOS_DBUS) FakeLorgnetteManagerClient : public LorgnetteManagerClient { public: FakeLorgnetteManagerClient(); ~FakeLorgnetteManagerClient() override; void Init(dbus::Bus* bus) override; void ListScanners(DBusMethodCallback<ScannerTable> callback) override; void ScanImageToString(std::string device_name, const ScanProperties& properties, DBusMethodCallback<std::string> callback) override; // Adds a fake scanner table entry, which will be returned by ListScanners(). void AddScannerTableEntry(const std::string& device_name, const ScannerTableEntry& entry); // Adds a fake scan data, which will be returned by ScanImageToString(), // if |device_name| and |properties| are matched. void AddScanData(const std::string& device_name, const ScanProperties& properties, const std::string& data); private: ScannerTable scanner_table_; // Use tuple for a map below, which has pre-defined "less", for convenience. using ScanDataKey = std::tuple<std::string /* device_name */, std::string /* ScanProperties.mode */, int /* Scanproperties.resolution_dpi */>; std::map<ScanDataKey, std::string /* data */> scan_data_; DISALLOW_COPY_AND_ASSIGN(FakeLorgnetteManagerClient); }; } // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_LORGNETTE_MANAGER_CLIENT_H_
/*========================================================================= Program: Visualization Toolkit Module: vtkPolyDataSource.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkPolyDataSource - abstract class whose subclasses generate polygonal data // .SECTION Description // vtkPolyDataSource is an abstract class whose subclasses generate polygonal // data. // .SECTION See Also // vtkPolyDataReader vtkAxes vtkBYUReader vtkConeSource vtkCubeSource // vtkCursor3D vtkCyberReader vtkCylinderSource vtkDiskSource vtkLineSource // vtkMCubesReader vtkOutlineSource vtkPlaneSource vtkPointSource vtkSTLReader // vtkSphereSource vtkTextSource vtkUGFacetReader vtkVectorText #ifndef __vtkPolyDataSource_h #define __vtkPolyDataSource_h #include "vtkSource.h" class vtkPolyData; class VTK_FILTERING_EXPORT vtkPolyDataSource : public vtkSource { public: vtkTypeRevisionMacro(vtkPolyDataSource,vtkSource); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Get the output of this source. vtkPolyData *GetOutput(); vtkPolyData *GetOutput(int idx); void SetOutput(vtkPolyData *output); protected: vtkPolyDataSource(); ~vtkPolyDataSource() {}; // Update extent of PolyData is specified in pieces. // Since all DataObjects should be able to set UpdateExent as pieces, // just copy output->UpdateExtent all Inputs. void ComputeInputUpdateExtents(vtkDataObject *output); // Used by streaming: The extent of the output being processed // by the execute method. Set in the ComputeInputUpdateExtents method. int ExecutePiece; int ExecuteNumberOfPieces; int ExecuteGhostLevel; virtual int FillOutputPortInformation(int, vtkInformation*); private: vtkPolyDataSource(const vtkPolyDataSource&); // Not implemented. void operator=(const vtkPolyDataSource&); // Not implemented. }; #endif
/****************************************************************************** * BRICS_3D - 3D Perception and Modeling Library * Copyright (c) 2016, KU Leuven * * Author: Sebastian Blumenthal * * * This software is published under a dual-license: GNU Lesser General Public * License LGPL 2.1 and Modified BSD license. The dual-license implies that * users of this code may choose which terms they prefer. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License LGPL and the BSD license for * more details. * ******************************************************************************/ #ifndef RSG_ISCENEGRAPHERROROBSERVER_H_ #define RSG_ISCENEGRAPHERROROBSERVER_H_ namespace brics_3d { namespace rsg { /** * @brief Interface to observe potential errors of the scenegraph * @ingroup sceneGraph */ class ISceneGraphErrorObserver { public: enum SceneGraphErrorCode { RSG_ERR_NO_ERROR = 0, RSG_ERR_ID_EXISTS_ALREADY = 1, // Warning. Cf. "Forced ID ... cannot be assigned. Probably another object with that ID exists already!"; RSG_ERR_ID_DOES_NOT_EXIST = 2, // Error. The node is missing - indicates data loss RSG_ERR_PARENT_ID_DOES_NOT_EXIST = 3, // Error. The parent node is missing - indicates data loss, or wrong order of traversal in case of initial creation RSG_ERR_UPDATE_IS_NOT_NEWER = 4, // Warning. Ensures temporal order of updates (for Attributes) RSG_ERR_UPDATE_IS_IDENTICAL = 5, // Warning. Prevents ping pong of same attribute updates RSG_ERR_GRAPH_CYCLE_DETECTED = 6, // Error. Prevents insertion of cycles in a DAG RSG_ERR_NODE_IS_OF_DIFFERENT_TYPE = 7 // Error. The caller expect a different type }; virtual void onError(SceneGraphErrorCode code) = 0; }; } } #endif /* RSG_ISCENEGRAPHUPDATEOBSERVER_H_ */ /* EOF */
// Copyright 2016 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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTES_HELPER_H_ #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTES_HELPER_H_ #include <map> #include "dbus/object_path.h" namespace dbus { class MessageReader; } namespace bluez { // Helper methods used from various GATT attribute providers and clients. bool ReadOptions(dbus::MessageReader* reader, std::map<std::string, dbus::MessageReader>* options); } // namespace bluez #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTES_HELPER_H_
// Copyright 2018 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 MOJO_PUBLIC_CPP_PLATFORM_PLATFORM_CHANNEL_H_ #define MOJO_PUBLIC_CPP_PLATFORM_PLATFORM_CHANNEL_H_ #include "base/command_line.h" #include "base/component_export.h" #include "base/macros.h" #include "base/process/launch.h" #include "build/build_config.h" #include "mojo/public/cpp/platform/platform_channel_endpoint.h" namespace mojo { // PlatformChannel encapsulates construction and ownership of two entangled // endpoints of a platform-specific communication primitive, e.g. a Windows // pipe, a Unix domain socket, or a macOS Mach port pair. One endpoint is // designated as the "local" endpoint and should be retained by the creating // process; the other endpoint is designated as the "remote" endpoint and // should be passed to an external process. // // PlatformChannels can be used to bootstrap Mojo IPC between one process and // another. Typically the other process is a child of this process, and there // are helper methods for passing the endpoint to a child as such; but this // arrangement is not strictly necessary on all platforms. // // For a channel which allows clients to connect by name (i.e. a named pipe // or socket server, supported only on Windows and POSIX systems) see // NamedPlatformChannel. class COMPONENT_EXPORT(MOJO_CPP_PLATFORM) PlatformChannel { public: // A common helper constant that is used to pass handle values on the // command line when the relevant methods are used on this class. static const char kHandleSwitch[]; // Unfortunately base process support code has no unified handle-passing // data pipe, so we have this. #if defined(OS_WIN) using HandlePassingInfo = base::HandlesToInheritVector; #elif defined(OS_FUCHSIA) using HandlePassingInfo = base::HandlesToTransferVector; #elif defined(OS_MACOSX) && !defined(OS_IOS) using HandlePassingInfo = base::MachPortsForRendezvous; #elif defined(OS_POSIX) using HandlePassingInfo = base::FileHandleMappingVector; #else #error "Unsupported platform." #endif PlatformChannel(); PlatformChannel(PlatformChannel&& other); ~PlatformChannel(); PlatformChannel& operator=(PlatformChannel&& other); const PlatformChannelEndpoint& local_endpoint() const { return local_endpoint_; } const PlatformChannelEndpoint& remote_endpoint() const { return remote_endpoint_; } PlatformChannelEndpoint TakeLocalEndpoint() WARN_UNUSED_RESULT { return std::move(local_endpoint_); } PlatformChannelEndpoint TakeRemoteEndpoint() WARN_UNUSED_RESULT { return std::move(remote_endpoint_); } // Prepares to pass the remote endpoint handle to a process that will soon be // launched. Returns a string that can be used in the remote process with // |RecoverPassedEndpointFromString()| (see below). The string can e.g. be // passed on the new process's command line. // // **NOTE**: If this method is called it is important to also call // |RemoteProcessLaunchAttempted()| on this PlatformChannel *after* attempting // to launch the new process, regardless of whether the attempt succeeded. // Failing to do so can result in leaked handles. void PrepareToPassRemoteEndpoint(HandlePassingInfo* info, std::string* value); // Like above but modifies |*command_line| to include the endpoint string // via the |kHandleSwitch| flag. void PrepareToPassRemoteEndpoint(HandlePassingInfo* info, base::CommandLine* command_line); // Like above but adds handle-passing information directly to // |*launch_options|, eliminating the potential need for callers to write // platform-specific code to do the same. void PrepareToPassRemoteEndpoint(base::LaunchOptions* options, base::CommandLine* command_line); // Must be called after the corresponding process launch attempt if // |PrepareToPassRemoteEndpoint()| was used. void RemoteProcessLaunchAttempted(); // Recovers an endpoint handle which was passed to the calling process by // its creator. |value| is a string returned by // |PrepareToPassRemoteEndpoint()| in the creator's process. static PlatformChannelEndpoint RecoverPassedEndpointFromString( base::StringPiece value) WARN_UNUSED_RESULT; // Like above but extracts the input string from |command_line| via the // |kHandleSwitch| flag. static PlatformChannelEndpoint RecoverPassedEndpointFromCommandLine( const base::CommandLine& command_line) WARN_UNUSED_RESULT; private: PlatformChannelEndpoint local_endpoint_; PlatformChannelEndpoint remote_endpoint_; DISALLOW_COPY_AND_ASSIGN(PlatformChannel); }; } // namespace mojo #endif // MOJO_PUBLIC_CPP_PLATFORM_PLATFORM_CHANNEL_H_
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd 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 the Vodafone Group Services Ltd 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 HOLDER 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. */ #ifndef SETTINGSLISTBOX_H #define SETTINGSLISTBOX_H // INCLUDES #include <aknsettingitemlist.h> // FORWARD DECLARATIONS class CSettingsData; namespace isab{ class Log; } // CLASS DECLARATION /** * CSettingsContainer container control class. */ class CSettingsListBox : public CAknSettingItemList { public: CSettingsListBox(TBool ReleaseVersion, TBool OneLanguageVersion, isab::Log* aLog, CSettingsData *aData) : iData(aData), iRelease(ReleaseVersion), iOneLanguage(OneLanguageVersion), iLog(aLog) {} CAknSettingItem* CreateSettingItemL( TInt identifier ); TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); private: void SizeChanged(); private: CSettingsData* iData; TBool iRelease; TBool iOneLanguage; isab::Log* iLog; }; #endif // End of File
// Copyright 2018-present 650 Industries. All rights reserved. @protocol ABI38_0_0UMMagnetometerInterface - (void)sensorModuleDidSubscribeForMagnetometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock; - (void)sensorModuleDidUnsubscribeForMagnetometerUpdates:(id)scopedSensorModule; - (void)setMagnetometerUpdateInterval:(NSTimeInterval)intervalMs; - (BOOL)isMagnetometerAvailable; @end
// // RandomTest.h // // $Id$ // // Definition of the RandomTest class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef RandomTest_INCLUDED #define RandomTest_INCLUDED #include "Poco/Foundation.h" #include "CppUnit/TestCase.h" class RandomTest: public CppUnit::TestCase { public: RandomTest(const std::string& name); ~RandomTest(); void testSequence1(); void testSequence2(); void testDistribution1(); void testDistribution2(); void testDistribution3(); void setUp(); void tearDown(); static CppUnit::Test* suite(); private: }; #endif // RandomTest_INCLUDED
/* mbed Microcontroller Library * Copyright (c) 2015-2016 Nuvoton * * 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 MBED_DEVICE_H #define MBED_DEVICE_H #define DEVICE_ID_LENGTH 24 #include "objects.h" #endif
//functionality replaced by mvfunctor - scheduled for deletion #if 0 /* NOTE: Do *not* add #ifndef header protector since this file is designed to be included more than once This header file is used to generate functors for functions and subroutines that have arguments that cannot be represented by vars eg ("inarray" arguments) For example, the following function cannot be handled by the standard exodus functor because it contains a dim which cannot be converted to a var. function xyz(in arg1,inarray arg2) Wherease, the following function CAN be handled by the standard exodus functor because all its arguments are vars function xyz(in arg1,in arg2) This header (the one you are reading) is designed to be included with macro parameters to generate classes that implement "functors" ie "function-like" objects to simulate mv external functions and subroutines with any combination of arguments it is included ONCE PER FUNCTION/SUBROUTINE used to generate multiple versions of the class to implement different number of arguments. each version of the class is assigned a different classname the last line of this file instantiates a specific object that can be used like a function/subroutine ==== header lib1.h ==== NB this header is generated AUTOMATICALLY by the command "compile lib1" #define EXODUSLIBNAME "lib1" #define EXODUSFUNCNAME "subr3" #define EXODUSFUNCNAME subr3 #define EXODUSFUNCRETURN void #define EXODUSFUNCRETURNVOID 1 #define EXODUSFUNCARGS in arg1 #define EXODUSFUNCARGS2 arg1 #define EXODUSFUNCTORCLASSNAME ExodusFunctor_subr3 #define EXODUSFUNCTYPE ExodusDynamic_subr3 #include <exodus/mvlink.h> */ //NB do NOT protect this from multiple inclusion since //if can be called multiple time with different macro parameters //to create multiple classes with/for different functor argument signatures #include "mvfunctor.h" //mostly not template so dont require that parameter #ifndef EXODUSFUNCTORTEMPLATE #define EXODUSFUNCTORTEMPLATE #endif namespace exodus { EXODUSFUNCTORTEMPLATE class EXODUSFUNCTORCLASSNAME : private ExodusFunctorBase { public: //base constructors are not inherited but can be called with an initialiser list EXODUSFUNCTORCLASSNAME(const std::string libname,const std::string funcname) : ExodusFunctorBase(libname,funcname){} EXODUSFUNCRETURN operator() (EXODUSFUNCARGS) { checkload(); // declare DLL/SO function type EXODUSFUNCTYPE typedef EXODUSFUNCRETURN (*EXODUSFUNCTYPE)(EXODUSFUNCARGS); #if EXODUSFUNCRETURNVOID == 1 ((EXODUSFUNCTYPE) pfunction_)(EXODUSFUNCARGS2); return; #else return ((EXODUSFUNCTYPE) pfunction_)(EXODUSFUNCARGS2); #endif } }; //if not building a template //define a functor object so the function can be called like aaa=func1(a,b,c) //with automatic just in time loading of the shared library (dll/so etc) //ExodusFunctor_func1 func1("lib1","func1"); #ifdef EXODUSLIBNAME EXODUSFUNCTORCLASSNAME EXODUSFUNCNAME0(EXODUSLIBNAME,EXODUSFUNCNAME); #endif #undef EXODUSFUNCTORTEMPLATE #undef EXODUSLIBNAME #undef EXODUSFUNCNAME #undef EXODUSFUNCNAME0 #undef EXODUSFUNCRETURN #undef EXODUSFUNCRETURNVOID #undef EXODUSFUNCARGS #undef EXODUSFUNCARGS2 #undef EXODUSFUNCTORCLASSNAME #undef EXODUSFUNCTYPE #undef EXODUSCLASSNAME }//namespace exodus #endif
// The MIT License (MIT) // Copyright (c) 2016, Microsoft // 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. #pragma once #include "BitFunnel/Utilities/IObjectFormatter.h" namespace BitFunnel { namespace ObjectFormatter { template <class NODE> void FormatListHelper(IObjectFormatter& formatter, NODE const * node) { if (node != nullptr) { FormatListHelper(formatter, node->GetNext()); formatter.OpenListItem(); node->GetValue().Format(formatter); } } template <class LIST> void FormatListField(IObjectFormatter& formatter, const char* name, const LIST& list) { formatter.OpenObjectField(name); formatter.OpenList(); const typename LIST::Node* node = list.GetHead(); FormatListHelper<LIST::Node>(formatter, node); formatter.CloseList(); } } }
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #pragma once #include "ifcpp/model/BasicTypes.h" #include "ifcpp/model/BuildingObject.h" class IFCQUERY_EXPORT TypeFactory { public: static shared_ptr<BuildingObject> createTypeObject( const std::wstring& class_name_upper, const std::wstring& type_arg, const std::map<int, shared_ptr<BuildingEntity> >& map_entities ); static void emptyMapOfTypes(); };
#include <math.h> #define NRANSI #include "nrutil.h" #define EPS 1.0e-10 #define FPMIN 1.0e-30 #define MAXIT 10000 #define XMIN 2.0 #define PI 3.141592653589793 void bessjy(float x, float xnu, float *rj, float *ry, float *rjp, float *ryp) { void beschb(double x, double *gam1, double *gam2, double *gampl, double *gammi); int i,isign,l,nl; double a,b,br,bi,c,cr,ci,d,del,del1,den,di,dlr,dli,dr,e,f,fact,fact2, fact3,ff,gam,gam1,gam2,gammi,gampl,h,p,pimu,pimu2,q,r,rjl, rjl1,rjmu,rjp1,rjpl,rjtemp,ry1,rymu,rymup,rytemp,sum,sum1, temp,w,x2,xi,xi2,xmu,xmu2; if (x <= 0.0 || xnu < 0.0) nrerror("bad arguments in bessjy"); nl=(x < XMIN ? (int)(xnu+0.5) : IMAX(0,(int)(xnu-x+1.5))); xmu=xnu-nl; xmu2=xmu*xmu; xi=1.0/x; xi2=2.0*xi; w=xi2/PI; isign=1; h=xnu*xi; if (h < FPMIN) h=FPMIN; b=xi2*xnu; d=0.0; c=h; for (i=1;i<=MAXIT;i++) { b += xi2; d=b-d; if (fabs(d) < FPMIN) d=FPMIN; c=b-1.0/c; if (fabs(c) < FPMIN) c=FPMIN; d=1.0/d; del=c*d; h=del*h; if (d < 0.0) isign = -isign; if (fabs(del-1.0) < EPS) break; } if (i > MAXIT) nrerror("x too large in bessjy; try asymptotic expansion"); rjl=isign*FPMIN; rjpl=h*rjl; rjl1=rjl; rjp1=rjpl; fact=xnu*xi; for (l=nl;l>=1;l--) { rjtemp=fact*rjl+rjpl; fact -= xi; rjpl=fact*rjtemp-rjl; rjl=rjtemp; } if (rjl == 0.0) rjl=EPS; f=rjpl/rjl; if (x < XMIN) { x2=0.5*x; pimu=PI*xmu; fact = (fabs(pimu) < EPS ? 1.0 : pimu/sin(pimu)); d = -log(x2); e=xmu*d; fact2 = (fabs(e) < EPS ? 1.0 : sinh(e)/e); beschb(xmu,&gam1,&gam2,&gampl,&gammi); ff=2.0/PI*fact*(gam1*cosh(e)+gam2*fact2*d); e=exp(e); p=e/(gampl*PI); q=1.0/(e*PI*gammi); pimu2=0.5*pimu; fact3 = (fabs(pimu2) < EPS ? 1.0 : sin(pimu2)/pimu2); r=PI*pimu2*fact3*fact3; c=1.0; d = -x2*x2; sum=ff+r*q; sum1=p; for (i=1;i<=MAXIT;i++) { ff=(i*ff+p+q)/(i*i-xmu2); c *= (d/i); p /= (i-xmu); q /= (i+xmu); del=c*(ff+r*q); sum += del; del1=c*p-i*del; sum1 += del1; if (fabs(del) < (1.0+fabs(sum))*EPS) break; } if (i > MAXIT) nrerror("bessy series failed to converge"); rymu = -sum; ry1 = -sum1*xi2; rymup=xmu*xi*rymu-ry1; rjmu=w/(rymup-f*rymu); } else { a=0.25-xmu2; p = -0.5*xi; q=1.0; br=2.0*x; bi=2.0; fact=a*xi/(p*p+q*q); cr=br+q*fact; ci=bi+p*fact; den=br*br+bi*bi; dr=br/den; di = -bi/den; dlr=cr*dr-ci*di; dli=cr*di+ci*dr; temp=p*dlr-q*dli; q=p*dli+q*dlr; p=temp; for (i=2;i<=MAXIT;i++) { a += 2*(i-1); bi += 2.0; dr=a*dr+br; di=a*di+bi; if (fabs(dr)+fabs(di) < FPMIN) dr=FPMIN; fact=a/(cr*cr+ci*ci); cr=br+cr*fact; ci=bi-ci*fact; if (fabs(cr)+fabs(ci) < FPMIN) cr=FPMIN; den=dr*dr+di*di; dr /= den; di /= -den; dlr=cr*dr-ci*di; dli=cr*di+ci*dr; temp=p*dlr-q*dli; q=p*dli+q*dlr; p=temp; if (fabs(dlr-1.0)+fabs(dli) < EPS) break; } if (i > MAXIT) nrerror("cf2 failed in bessjy"); gam=(p-f)/q; rjmu=sqrt(w/((p-f)*gam+q)); rjmu=SIGN(rjmu,rjl); rymu=rjmu*gam; rymup=rymu*(p+q/gam); ry1=xmu*xi*rymu-rymup; } fact=rjmu/rjl; *rj=rjl1*fact; *rjp=rjp1*fact; for (i=1;i<=nl;i++) { rytemp=(xmu+i)*xi2*ry1-rymu; rymu=ry1; ry1=rytemp; } *ry=rymu; *ryp=xnu*xi*rymu-ry1; } #undef EPS #undef FPMIN #undef MAXIT #undef XMIN #undef PI #undef NRANSI
// // MZTimerLabel.h // Version 0.5.1 // Created by MineS Chan on 2013-10-16 // Updated 2014-12-15 // This code is distributed under the terms and conditions of the MIT license. // Copyright (c) 2014 MineS Chan // // 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 <UIKit/UIKit.h> /********************************************** MZTimerLabel TimerType Enum **********************************************/ typedef enum{ MZTimerLabelTypeStopWatch, MZTimerLabelTypeTimer }MZTimerLabelType; /********************************************** Delegate Methods @optional - timerLabel:finshedCountDownTimerWithTimeWithTime: ** MZTimerLabel Delegate method for finish of countdown timer - timerLabel:countingTo:timertype: ** MZTimerLabel Delegate method for monitering the current counting progress - timerlabel:customTextToDisplayAtTime: ** MZTimerLabel Delegate method for overriding the text displaying at the time, implement this for your very custom display formmat **********************************************/ @class MZTimerLabel; @protocol MZTimerLabelDelegate <NSObject> @optional -(void)timerLabel:(MZTimerLabel*)timerLabel finshedCountDownTimerWithTime:(NSTimeInterval)countTime; -(void)timerLabel:(MZTimerLabel*)timerLabel countingTo:(NSTimeInterval)time timertype:(MZTimerLabelType)timerType; -(NSString*)timerLabel:(MZTimerLabel*)timerLabel customTextToDisplayAtTime:(NSTimeInterval)time; -(NSAttributedString*)timerLabel:(MZTimerLabel*)timerLabel customAttributedTextToDisplayAtTime:(NSTimeInterval)time; @end /********************************************** MZTimerLabel Class Defination **********************************************/ @interface MZTimerLabel : UILabel; /*Delegate for finish of countdown timer */ @property (nonatomic,weak) id<MZTimerLabelDelegate> delegate; /*Time format wish to display in label*/ @property (nonatomic,copy) NSString *timeFormat; /*Target label obejct, default self if you do not initWithLabel nor set*/ @property (nonatomic,strong) UILabel *timeLabel; /*Used for replace text in range */ @property (nonatomic, assign) NSRange textRange; @property (nonatomic, strong) NSDictionary *attributedDictionaryForTextInRange; /*Type to choose from stopwatch or timer*/ @property (assign) MZTimerLabelType timerType; /*Is The Timer Running?*/ @property (assign,readonly) BOOL counting; /*Do you want to reset the Timer after countdown?*/ @property (assign) BOOL resetTimerAfterFinish; /*Do you want the timer to count beyond the HH limit from 0-23 e.g. 25:23:12 (HH:mm:ss) */ @property (assign,nonatomic) BOOL shouldCountBeyondHHLimit; #if NS_BLOCKS_AVAILABLE @property (copy) void (^endedBlock)(NSTimeInterval); #endif /*--------Init methods to choose*/ -(id)initWithTimerType:(MZTimerLabelType)theType; -(id)initWithLabel:(UILabel*)theLabel andTimerType:(MZTimerLabelType)theType; -(id)initWithLabel:(UILabel*)theLabel; /*--------designated Initializer*/ -(id)initWithFrame:(CGRect)frame label:(UILabel*)theLabel andTimerType:(MZTimerLabelType)theType; /*--------Timer control methods to use*/ -(void)start; #if NS_BLOCKS_AVAILABLE -(void)startWithEndingBlock:(void(^)(NSTimeInterval countTime))end; //use it if you are not going to use delegate #endif -(void)pause; -(void)reset; /*--------Setter methods*/ -(void)setCountDownTime:(NSTimeInterval)time; -(void)setStopWatchTime:(NSTimeInterval)time; -(void)setCountDownToDate:(NSDate*)date; -(void)addTimeCountedByTime:(NSTimeInterval)timeToAdd; /*--------Getter methods*/ - (NSTimeInterval)getTimeCounted; - (NSTimeInterval)getTimeRemaining; - (NSTimeInterval)getCountDownTime; @end
/* The MIT License (MIT) Copyright (c) 2016 Alexey Yegorov 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. */ #ifndef UI_CONTROLS_LABEL_H_INCLUDED #define UI_CONTROLS_LABEL_H_INCLUDED #include "ui/freetype/forwards.h" #include "ui/control.h" #include "rendering/core/program.h" #include "rendering/core/texture.h" #include "rendering/primitives/square.h" #include "math/types.h" namespace eps { namespace ui { class label : public control { public: explicit label(control * parent = nullptr); void draw() override; bool set_font(const std::string & ttf_asset, int height); bool set_text(const std::string & text); void set_color(const math::vec4 & color); void set_alignment(halignment haling, valignment valign); private: rendering::program program_face_; rendering::texture texture_face_; rendering::primitive::square square_; freetype::face_handle font_; math::vec4 color_; int height_; valignment valignment_; halignment halignment_; }; } /* ui */ } /* eps */ #endif // UI_CONTROLS_LABEL_H_INCLUDED
// // MJRefreshConst.h // MJRefresh // // Created by mj on 14-1-3. // Copyright (c) 2014年 itcast. All rights reserved. // #ifdef DEBUG #define MJLog(...) NSLog(__VA_ARGS__) #else #define MJLog(...) #endif #import <AVFoundation/AVFoundation.h> // 文字颜色 #define MJRefreshLabelTextColor [UIColor colorWithRed:150/255.0 green:150/255.0 blue:150/255.0 alpha:1.0] extern const CGFloat MJRefreshViewHeight; extern const CGFloat MJRefreshAnimationDuration; extern NSString *const MJRefreshBundleName; #define kSrcName(file) [MJRefreshBundleName stringByAppendingPathComponent:file] extern NSString *const MJRefreshFooterPullToRefresh; extern NSString *const MJRefreshFooterReleaseToRefresh; extern NSString *const MJRefreshFooterRefreshing; extern NSString *const MJRefreshHeaderPullToRefresh; extern NSString *const MJRefreshHeaderReleaseToRefresh; extern NSString *const MJRefreshHeaderRefreshing; extern NSString *const MJRefreshHeaderTimeKey; extern NSString *const MJRefreshContentOffset; extern NSString *const MJRefreshContentSize;
// Copyright (c) 2011-2015 The Presidentielcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PRESIDENTIELCOIN_QT_PRESIDENTIELCOINAMOUNTFIELD_H #define PRESIDENTIELCOIN_QT_PRESIDENTIELCOINAMOUNTFIELD_H #include "amount.h" #include <QWidget> class AmountSpinBox; QT_BEGIN_NAMESPACE class QValueComboBox; QT_END_NAMESPACE /** Widget for entering presidentielcoin amounts. */ class PresidentielcoinAmountField: public QWidget { Q_OBJECT // ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected // discussion: https://github.com/presidentielcoin/presidentielcoin2/pull/5117 Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) public: explicit PresidentielcoinAmountField(QWidget *parent = 0); CAmount value(bool *value=0) const; void setValue(const CAmount& value); /** Set single step in satoshis **/ void setSingleStep(const CAmount& step); /** Make read-only **/ void setReadOnly(bool fReadOnly); /** Mark current value as invalid in UI. */ void setValid(bool valid); /** Perform input validation, mark field as invalid if entered value is not valid. */ bool validate(); /** Change unit used to display amount. */ void setDisplayUnit(int unit); /** Make field empty and ready for new input. */ void clear(); /** Enable/Disable. */ void setEnabled(bool fEnabled); /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907), in these cases we have to set it up manually. */ QWidget *setupTabChain(QWidget *prev); Q_SIGNALS: void valueChanged(); protected: /** Intercept focus-in event and ',' key presses */ bool eventFilter(QObject *object, QEvent *event); private: AmountSpinBox *amount; QValueComboBox *unit; private Q_SLOTS: void unitChanged(int idx); }; #endif // PRESIDENTIELCOIN_QT_PRESIDENTIELCOINAMOUNTFIELD_H
// // LNTextInputAlertController.h // // Created by Leo Natan on 2015-01-26. // // #import <UIKit/UIKit.h> @interface LNTextInputAlertController : UIAlertController //@property (nonatomic, copy) NSString* placeholder; @property (nonatomic, readonly) NSString* text; @end
// AHProxy.h // // Copyright (c) 2014 Eldon Ahrold // // 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> /** * Proxy Type */ typedef NS_ENUM(NSInteger, AHProxyType) { /** * Undefined type */ kAHProxyTypeUnknown, /** * HTTP type */ kAHProxyTypeHTTP, /** * HTTPS type */ kAHProxyTypeHTTPS, /** * FTP type */ kAHProxyTypeFTP, /** * SOCKS type */ kAHProxyTypeSOCKS, }; /** * Proxy Object */ @interface AHProxy : NSObject /** * Proxy Server URL */ @property (copy, nonatomic, readonly) NSString *server; /** * Proxy Server Port */ @property (copy, nonatomic, readonly) NSNumber *port; /** * Proxy Server User */ @property (copy, nonatomic, readonly) NSString *user; /** * Proxy Server Password */ @property (copy, nonatomic, readonly) NSString *password; /** * Type of Proxy Server */ @property (assign, nonatomic, readonly) AHProxyType type; /** * export string appropriate for shell (url encoded) */ @property (copy, nonatomic, readonly) NSString *exportString; @end
//================================================================================== // Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved. // /// \author AMD Developer Tools Team /// \file gaSingletonsDelete.h /// //================================================================================== //------------------------------ gaSingletonsDelete.h ------------------------------ #ifndef __GASINGLETONSDELETE #define __GASINGLETONSDELETE // ---------------------------------------------------------------------------------- // Class Name: gaSingletonsDelete // General Description: // Deletes all the singleton objects. // Thus removes redundant memory leak reports. // // Implementation notes: // We hold a single instance of this class. Its destructor is called when the // process that holds it terminates. This is an excellent timing to delete all the // existing singleton objects. // // Author: Yaki Tebeka // Creation Date: 21/04/2004 // ---------------------------------------------------------------------------------- class gaSingletonsDelete { public: gaSingletonsDelete() {}; ~gaSingletonsDelete(); }; #endif // __GASINGLETONSDELETE
#pragma once /**************************************************************************** Copyright (c) 2009, Radon Labs GmbH Copyright (c) 2011-2013,WebJet Business Division,CYOU http://www.genesis-3d.com.cn 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. ****************************************************************************/ #include "net/tcpclient.h" #include "net/tcpmessagecodec.h" #include "io/memorystream.h" #include "util/queue.h" //------------------------------------------------------------------------------ namespace Net { class MessageClient : public TcpClient { __DeclareClass(MessageClient); public: /// constructor MessageClient(); /// destructor virtual ~MessageClient(); /// establish a connection with the server virtual Result Connect(); /// disconnect from the server virtual void Disconnect(); /// send accumulated content of send stream to server virtual bool Send(); /// access to send stream virtual const GPtr<IO::Stream>& GetSendStream(); /// receive data from server into recv stream virtual bool Recv(); /// access to recv stream virtual const GPtr<IO::Stream>& GetRecvStream(); private: TcpMessageCodec codec; GPtr<IO::Stream> sendMessageStream; GPtr<IO::Stream> recvMessageStream; Util::Queue<GPtr<IO::Stream> > msgQueue; }; //------------------------------------------------------------------------------ } // namespace Net
// // ShopdetailModel.h // YuWa // // Created by 黄佳峰 on 2016/11/3. // Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved. // #import <Foundation/Foundation.h> @interface ShopdetailModel : NSObject //"customer_content" = 非常不满意 我不管 就是个巨坑 , // "score" = 5.0, // "ctime" = 1480502640, // "id" = 16, // "customer_name" = bbb, // "customer_img" = http://114.215.252.104/Public/Upload/20161121/14797210839275.png, // "img_url" = [{"title":"\u6d4b\u8bd51","url":"http:\/\/114.215.252.104\/Public\/Upload\/20161103\/1.jpg"},{"title":"\u6d4b\u8bd5122","url":"http:\/\/114.215.252.104\/Public\/Upload\/20161103\/2.jpg"}], // "customer_uid" = 12, @property(nonatomic,strong)NSString*customer_name; @property(nonatomic,strong)NSString*customer_img; @property(nonatomic,strong)NSString*score; @property(nonatomic,strong)NSString*ctime; @property(nonatomic,strong)NSString*customer_content; @property(nonatomic,strong)NSString*customer_uid; //这个没用 @property(nonatomic,strong)NSString*id;//回复的id @property(nonatomic,strong)NSString*seller_content; //商家评论字段 @property(nonatomic,strong)NSArray*img_url; @property(nonatomic,strong)NSArray * rep_list;//回复数组 @end
#include<stdio.h> #include<conio.h> #include<locale.h> int fat(int n); main(){ setlocale(LC_ALL,"Portuguese"); int num; printf("Digite uma número inteiro positivo: "); scanf("%d",&num); fat(num); printf("%d",fat(num)); getch(); } int fat(int n){ if((n == 1) || (n == 0)){ return 1; }else{ return n * fat(n - 1); } }
/* * Copyright (c) 2014 Roman Kuznetsov * * 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 (including the next * paragraph) 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. */ #ifndef __STORAGE_BUFFER_H__ #define __STORAGE_BUFFER_H__ namespace framework { class StorageBuffer : public Destroyable { friend class Application; public: StorageBuffer(); virtual ~StorageBuffer(); bool init(size_t elementSize, size_t count); bool isValid() const; void bind(int bindingIndex); private: virtual void destroy(); GLuint m_buffer; }; } #endif
#include "errors.h" void lexerr(struct MachineResult *result, struct ParserData *parser_data) { // output to console fprintf (stderr, "%-8s%s on line %d: \"%s\"\n", "LEXERR", attribute_to_str(result->token->attribute), result->line_no, result->lexeme); // listing file if (parser_data->listing != NULL) fprintf (parser_data->listing, "%-8s%-30s%s\n", "LEXERR", attribute_to_str(result->token->attribute), result->lexeme); parser_data->result |= PARSER_RESULT_LEXERR; } void output_synerr(enum TokenType *expected, int len, struct MachineResult *found, FILE *out) { fprintf (out, "%-8sExpecting ", "SYNERR" ); for (int i = 0; i < len; i++) { fprintf (out, "\"%s\"", token_type_to_str(expected[i])); if (i < len - 1) { if (len > 2) fprintf (out, ", "); if (i == len - 2) fprintf (out, " or "); } } fprintf (out, " but received \"%s\"", token_type_to_str(found->token->type)); if (out == stderr) fprintf (out, " on line %d", found->line_no); fprintf (out, "\n"); } void synerr(enum TokenType *expected, int len, struct MachineResult *found, struct ParserData *parser_data) { // output to console output_synerr(expected, len, found, stderr); // output to listing file output_synerr(expected, len, found, parser_data->listing); parser_data->result |= PARSER_RESULT_SYNERR; } void semerr(char *err, int line_no, struct ParserData *parser_data) { // output to console fprintf (stderr, "%-8s%s on line %d\n", "SEMERR", err, line_no); // listing file if (parser_data->listing != NULL) fprintf (parser_data->listing, "%-8s%s\n", "SEMERR", err); parser_data->result |= PARSER_RESULT_SEMERR; }
// // MeiTuanAnnotation.h // BaiDuMap_Demo // // Created by ZZBelieve on 16/8/24. // Copyright © 2016年 ZZBelieve. All rights reserved. // #import <BaiduMapAPI_Map/BMKMapComponent.h> @class MeiTuanModel; @interface MeiTuanAnnotation : BMKPointAnnotation @property(nonatomic,strong)MeiTuanModel *model; @property(nonatomic,assign)int type; @end
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) { unsigned int state[1] ; unsigned int local1 ; unsigned short copy11 ; { state[0UL] = (input[0UL] + 914778474UL) - 981234615U; local1 = 0UL; while (local1 < 0U) { if (state[0UL] < local1) { if (state[0UL] != local1) { copy11 = *((unsigned short *)(& state[local1]) + 0); *((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 1); *((unsigned short *)(& state[local1]) + 1) = copy11; } else { state[0UL] = state[local1] + state[local1]; state[0UL] += state[0UL]; } } else { state[0UL] = state[local1] + state[local1]; } local1 ++; } output[0UL] = (state[0UL] + 469123144UL) + 888641092U; } } void megaInit(void) { { } } int main(int argc , char *argv[] ) { unsigned int input[1] ; unsigned int output[1] ; int randomFuns_i5 ; unsigned int randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 4242424242U) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } }
/* * Quicktime Planar RGB (8BPS) Video Decoder * Copyright (C) 2003 Roberto Togni * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * QT 8BPS Video Decoder by Roberto Togni * For more information about the 8BPS format, visit: * http://www.pcisys.net/~melanson/codecs/ * * Supports: PAL8 (RGB 8bpp, paletted) * : BGR24 (RGB 24bpp) (can also output it as RGB32) * : RGB32 (RGB 32bpp, 4th plane is alpha) * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "internal.h" static const enum AVPixelFormat pixfmt_rgb24[] = { AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE }; typedef struct EightBpsContext { AVCodecContext *avctx; unsigned char planes; unsigned char planemap[4]; uint32_t pal[256]; } EightBpsContext; static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; EightBpsContext * const c = avctx->priv_data; const unsigned char *encoded = buf; unsigned char *pixptr, *pixptr_end; unsigned int height = avctx->height; // Real image height unsigned int dlen, p, row; const unsigned char *lp, *dp, *ep; unsigned char count; unsigned int planes = c->planes; unsigned char *planemap = c->planemap; int ret; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ep = encoded + buf_size; /* Set data pointer after line lengths */ dp = encoded + planes * (height << 1); for (p = 0; p < planes; p++) { /* Lines length pointer for this plane */ lp = encoded + p * (height << 1); /* Decode a plane */ for (row = 0; row < height; row++) { pixptr = frame->data[0] + row * frame->linesize[0] + planemap[p]; pixptr_end = pixptr + frame->linesize[0]; if (ep - lp < row * 2 + 2) return AVERROR_INVALIDDATA; dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2)); /* Decode a row of this plane */ while (dlen > 0) { if (ep - dp <= 1) return AVERROR_INVALIDDATA; if ((count = *dp++) <= 127) { count++; dlen -= count + 1; if (pixptr_end - pixptr < count * planes) break; if (ep - dp < count) return AVERROR_INVALIDDATA; while (count--) { *pixptr = *dp++; pixptr += planes; } } else { count = 257 - count; if (pixptr_end - pixptr < count * planes) break; while (count--) { *pixptr = *dp; pixptr += planes; } dp++; dlen -= 2; } } } } if ((avctx->bits_per_coded_sample & 0x1f) <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { frame->palette_has_changed = 1; memcpy(c->pal, pal, AVPALETTE_SIZE); } memcpy (frame->data[1], c->pal, AVPALETTE_SIZE); } *got_frame = 1; /* always report that the buffer was completely consumed */ return buf_size; } static av_cold int decode_init(AVCodecContext *avctx) { EightBpsContext * const c = avctx->priv_data; c->avctx = avctx; switch (avctx->bits_per_coded_sample) { case 8: avctx->pix_fmt = AV_PIX_FMT_PAL8; c->planes = 1; c->planemap[0] = 0; // 1st plane is palette indexes break; case 24: avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24); c->planes = 3; c->planemap[0] = 2; // 1st plane is red c->planemap[1] = 1; // 2nd plane is green c->planemap[2] = 0; // 3rd plane is blue break; case 32: avctx->pix_fmt = AV_PIX_FMT_RGB32; c->planes = 4; /* handle planemap setup later for decoding rgb24 data as rbg32 */ break; default: av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample); return AVERROR_INVALIDDATA; } if (avctx->pix_fmt == AV_PIX_FMT_RGB32) { c->planemap[0] = HAVE_BIGENDIAN ? 1 : 2; // 1st plane is red c->planemap[1] = HAVE_BIGENDIAN ? 2 : 1; // 2nd plane is green c->planemap[2] = HAVE_BIGENDIAN ? 3 : 0; // 3rd plane is blue c->planemap[3] = HAVE_BIGENDIAN ? 0 : 3; // 4th plane is alpha } return 0; } AVCodec ff_eightbps_decoder = { .name = "8bps", .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_8BPS, .priv_data_size = sizeof(EightBpsContext), .init = decode_init, .decode = decode_frame, .capabilities = CODEC_CAP_DR1, };
// // XFComponentRoutable.h // XFLegoVIPER // // Created by Yizzuide on 2016/11/25. // Copyright © 2016年 Yizzuide. All rights reserved. // #import "XFComponentReflect.h" #import "XFComponentUI.h" #import "XFUIBus.h" #import "XFEventReceivable.h" // 注册键盘弹出通知 #define XF_RegisterKeyboardNotifaction \ XF_RegisterMVxNotis_(UIKeyboardWillChangeFrameNotification) // 处理键盘弹出通知 #define XF_HandleKeyboardNotifaction \ XF_EventIs_(UIKeyboardWillChangeFrameNotification, { \ NSDictionary *dict = intentData; \ CGFloat y = [dict[UIKeyboardFrameEndUserInfoKey] CGRectValue].origin.y; \ UIViewController<XFComponentUI> *ui = (id)[XFComponentReflect uInterfaceForComponent:self]; \ if ([ui respondsToSelector:@selector(needUpdateInputUInterfaceY:durationTime:)]) { \ [ui needUpdateInputUInterfaceY:y durationTime:[dict[UIKeyboardAnimationDurationUserInfoKey] floatValue]]; \ } \ }) \ // 自动处理通用键盘弹出通知 #define XF_AutoHandleKeyboardNotifaction \ - (void)registerMVxNotifactions \ { \ XF_RegisterKeyboardNotifaction \ } \ - (void)receiveComponentEventName:(NSString *)eventName intentData:(id)intentData \ { \ XF_HandleKeyboardNotifaction \ } /** * 一个组件可运行接口 */ NS_ASSUME_NONNULL_BEGIN @protocol XFComponentRoutable <XFEventReceivable> @optional /** * 上一个组件(来源组件) */ @property (nonatomic, weak, readonly) __kindof id<XFComponentRoutable> fromComponentRoutable; /** * 下一个组件 */ @property (nonatomic, weak, readonly) __kindof id<XFComponentRoutable> nextComponentRoutable; /** * 上一个URL组件传递过来的URL参数 */ @property (nonatomic, copy, nullable) NSDictionary *URLParams; /** * 上一个URL组件传递过来的自定义数据对象 */ @property (nonatomic, copy, nullable) id componentData; /** * 预设要传递给其它组件的意图数据 */ @property (nonatomic, copy, nullable) id intentData; /** * 接收到上一个组件的回传意图数据 * * @param intentData 消息数据 */ - (void)onNewIntent:(id)intentData; /** * 组件将获得焦点 */ - (void)componentWillBecomeFocus; /** * 组件将失去焦点 */ - (void)componentWillResignFocus; /** * 定时器循环运行方法 */ - (void)run; @end NS_ASSUME_NONNULL_END
// // NSString+LFExtendedStringDrawing.h // LFImagePickerController // // Created by LamTsanFeng on 2020/9/29. // Copyright © 2020 LamTsanFeng. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface NSString (LFExtendedStringDrawing) /** 计算文字大小 */ - (CGSize)lf_boundingSizeWithSize:(CGSize)size font:(UIFont *)font; - (CGSize)lf_boundingSizeWithSize:(CGSize)size attributes:(nullable NSDictionary<NSAttributedStringKey, id> *)attributes; - (CGSize)lf_boundingSizeWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(nullable NSDictionary<NSAttributedStringKey, id> *)attributes; - (CGSize)lf_boundingSizeWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(nullable NSDictionary<NSAttributedStringKey, id> *)attributes context:(nullable NSStringDrawingContext *)context; @end NS_ASSUME_NONNULL_END
// // YLScanVC.h // DragonUperClouds // // Created by AngerDragon on 14-1-6. // Copyright (c) 2014年 AngerDragon. All rights reserved. // #import <UIKit/UIKit.h> #import "UIScannerView.h" typedef void (^YLScanResultBlock)(NSString *scanResult,NSString *scanType); typedef void (^YLScanCancelBlock)(); @interface YLScanVC : UIViewController<UIScannerViewDelegate> @property (nonatomic, copy) YLScanResultBlock resultBlock; @property (nonatomic, copy) YLScanCancelBlock cancelBlock; @end
// // BXCore.h // lingdang // // Created by zengming on 13-8-17. // Copyright (c) 2013年 baixing.com. All rights reserved. // #ifndef lingdang_BXCore_h #define lingdang_BXCore_h #define kConstPassword @"baixinger" #define kDBColName @"name" #define kCacheIsAdminMode @"kCacheIsAdminMode" #define kCacheFoodsBy(shopId) [NSString stringWithFormat:@"kCacheFoods_shop_%@", (shopId)] #define kCacheAllShops @"kCacheAllShops" #define kNotificationGoMyOrder @"kNotificationGoMyOrder" #define kColorEaterYellow [UIColor colorWithRed:255.0/255.0 green:214.0/255.0 blue:82.0/255.0 alpha:1.0] #define kColorAdminRed [UIColor redColor] #define TagFromSctionAndRow(section, row) (section*10000 + row) #define SectionFromTag(tag) (tag / 10000) #define RowFromTag(tag) (tag % 10000) #endif
// // AppController.h // Snapback // // Created by Steve Cook on 4/3/06. // Copyright 2006 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> #import <ApplicationServices/ApplicationServices.h> #import "BezelWindow.h" #import "SRRecorderControl.h" #import "SRKeyCodeTransformer.h" #import "JumpcutStore.h" #import "SGHotKey.h" #import "DBSyncPromptDelegate.h" @class SGHotKey; @interface AppController : NSObject <NSMenuDelegate> { BezelWindow *bezel; SGHotKey *mainHotKey; IBOutlet SRRecorderControl *mainRecorder; IBOutlet NSPanel *prefsPanel; int mainHotkeyModifiers; SRKeyCodeTransformer *srTransformer; BOOL isBezelDisplayed; BOOL isBezelPinned; // Currently not used NSString *currentKeycodeCharacter; int stackPosition; int favoritesStackPosition; int stashedStackPosition; // The below were pulled in from JumpcutController JumpcutStore *clippingStore; JumpcutStore *favoritesStore; JumpcutStore *stashedStore; // Status item -- the little icon in the menu bar NSStatusItem *statusItem; NSString *statusItemText; NSImage *statusItemImage; // The menu attatched to same IBOutlet NSMenu *jcMenu; int jcMenuBaseItemsCount; IBOutlet NSSearchField *searchBox; NSResponder *menuFirstResponder; NSRunningApplication *currentRunningApplication; NSEvent *menuOpenEvent; IBOutlet NSSlider * heightSlider; IBOutlet NSSlider * widthSlider; // A timer which will let us check the pasteboard; // this should default to every .5 seconds but be user-configurable NSTimer *pollPBTimer; // We want an interface to the pasteboard NSPasteboard *jcPasteboard; // Track the clipboard count so we only act when its contents change NSNumber *pbCount; BOOL disableStore; //stores PasteboardCount for internal Jumpcut pasteboard actions so they don't trigger any events NSNumber *pbBlockCount; //Preferences NSDictionary *standardPreferences; int jcDisplayNum; BOOL issuedRememberResizeWarning; BOOL dropboxSync; IBOutlet NSButtonCell * dropboxCheckbox; } //@property(retain, nonatomic) IBOutlet NSButtonCell * dropboxCheckbox; // Basic functionality -(void) pollPB:(NSTimer *)timer; -(BOOL) addClipToPasteboardFromCount:(int)indexInt; -(void) setPBBlockCount:(NSNumber *)newPBBlockCount; -(void) hideApp; -(void) pasteFromStack; -(void) saveFromStack; -(void) fakeCommandV; -(void) stackUp; -(void) stackDown; -(IBAction)clearClippingList:(id)sender; -(IBAction)mergeClippingList:(id)sender; -(void)controlTextDidChange:(NSNotification *)aNotification; -(BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector; -(IBAction)searchItems:(id)sender; // Stack related -(BOOL) isValidClippingNumber:(NSNumber *)number; -(NSString *) clippingStringWithCount:(int)count; // Save and load -(void) saveEngine; -(void) loadEngineFromPList; // Hotkey related -(void)hitMainHotKey:(SGHotKey *)hotKey; // Bezel related -(void) updateBezel; -(void) showBezel; -(void) hideBezel; -(void) processBezelKeyDown:(NSEvent *)theEvent; -(void) metaKeysReleased; // Menu related -(void) updateMenu; -(IBAction) processMenuClippingSelection:(id)sender; -(IBAction) activateAndOrderFrontStandardAboutPanel:(id)sender; -(BOOL) dropboxSync; -(void)setDropboxSync:(BOOL)enable; // Preference related -(IBAction) showPreferencePanel:(id)sender; -(IBAction) setRememberNumPref:(id)sender; -(IBAction) setFavoritesRememberNumPref:(id)sender; -(IBAction) setDisplayNumPref:(id)sender; -(IBAction) setBezelAlpha:(id)sender; -(IBAction) setBezelHeight:(id)sender; -(IBAction) setBezelWidth:(id)sender; -(IBAction) switchMenuIcon:(id)sender; -(IBAction) toggleLoadOnStartup:(id)sender; -(IBAction) toggleMainHotKey:(id)sender; -(void) setHotKeyPreferenceForRecorder:(SRRecorderControl *)aRecorder; @end
/* * Copyright © 2014 Intel Corporation * * 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 (including the next * paragraph) 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. * */ #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include "drmtest.h" #include "igt_debugfs.h" #include "igt_kms.h" #include "intel_chipset.h" #include "intel_batchbuffer.h" #include "ioctl_wrappers.h" typedef struct { int drm_fd; igt_display_t display; } data_t; IGT_TEST_DESCRIPTION( "This test tries to provoke the kernel into leaking a pending page flip " "event when the fd is closed before the flip has completed. The test " "itself won't fail even if the kernel leaks the event, but the resulting " "dmesg WARN will indicate a failure."); static bool test(data_t *data, enum pipe pipe, igt_output_t *output) { igt_plane_t *primary; drmModeModeInfo *mode; struct igt_fb fb[2]; int fd, ret; /* select the pipe we want to use */ igt_output_set_pipe(output, pipe); igt_display_commit(&data->display); if (!output->valid) { igt_output_set_pipe(output, PIPE_ANY); igt_display_commit(&data->display); return false; } primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); mode = igt_output_get_mode(output); igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, true, /* tiled */ 0.0, 0.0, 0.0, &fb[0]); igt_plane_set_fb(primary, &fb[0]); igt_display_commit2(&data->display, COMMIT_LEGACY); fd = drm_open_any(); ret = drmDropMaster(data->drm_fd); igt_assert(ret == 0); ret = drmSetMaster(fd); igt_assert(ret == 0); igt_create_color_fb(fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, true, /* tiled */ 0.0, 0.0, 0.0, &fb[1]); ret = drmModePageFlip(fd, output->config.crtc->crtc_id, fb[1].fb_id, DRM_MODE_PAGE_FLIP_EVENT, data); igt_assert(ret == 0); ret = close(fd); igt_assert(ret == 0); ret = drmSetMaster(data->drm_fd); igt_assert(ret == 0); igt_plane_set_fb(primary, NULL); igt_output_set_pipe(output, PIPE_ANY); igt_display_commit(&data->display); igt_remove_fb(data->drm_fd, &fb[0]); return true; } igt_simple_main { data_t data = {}; igt_output_t *output; int valid_tests = 0; enum pipe pipe; igt_skip_on_simulation(); data.drm_fd = drm_open_any_master(); kmstest_set_vt_graphics_mode(); igt_display_init(&data.display, data.drm_fd); for (pipe = 0; pipe < 3; pipe++) { for_each_connected_output(&data.display, output) { if (test(&data, pipe, output)) valid_tests++; } } igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); igt_display_fini(&data.display); }