text
stringlengths
4
6.14k
/* * +----------------------------------------------------------+ * | +------------------------------------------------------+ | * | | Quafios Calculator. | | * | | -> Boolean header. | | * | +------------------------------------------------------+ | * +----------------------------------------------------------+ * * This file is part of Quafios 2.0.1 source code. * Copyright (C) 2015 Mostafa Abd El-Aziz Mohamed. * * 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 Quafios. If not, see <http://www.gnu.org/licenses/>. * * Visit http://www.quafios.com/ for contact information. * */ #ifndef BOOLEAN_H #define BOOLEAN_H typedef unsigned char bool; #define true 1 #define false 0 #endif
/* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mbed_assert.h" #include "gpio_api.h" #include "pinmap.h" uint32_t gpio_set(PinName pin) { MBED_ASSERT(pin != (PinName)NC); pin_function(pin, 1); return 1 << ((pin & 0x7F) >> 2); } void gpio_init(gpio_t *obj, PinName pin) { obj->pin = pin; if (pin == (PinName)NC) return; obj->mask = gpio_set(pin); unsigned int port = (unsigned int)pin >> PORT_SHIFT; GPIO_Type *reg = (GPIO_Type *)(PTA_BASE + port * 0x40); obj->reg_set = &reg->PSOR; obj->reg_clr = &reg->PCOR; obj->reg_in = &reg->PDIR; obj->reg_dir = &reg->PDDR; } void gpio_mode(gpio_t *obj, PinMode mode) { pin_mode(obj->pin, mode); } void gpio_dir(gpio_t *obj, PinDirection direction) { MBED_ASSERT(obj->pin != (PinName)NC); switch (direction) { case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break; case PIN_OUTPUT: *obj->reg_dir |= obj->mask; break; } }
// ************************************************************************** // // // BornAgain: simulate and fit scattering at grazing incidence // //! @file GUI/coregui/Views/JobWidgets/ProjectionsToolBar.h //! @brief Defines class ProjectionsToolBar //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) //! @copyright Forschungszentrum Jülich GmbH 2018 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) // // ************************************************************************** // #ifndef PROJECTIONSTOOLBAR_H #define PROJECTIONSTOOLBAR_H #include "WinDllMacros.h" #include "MaskEditorFlags.h" #include <QToolBar> class ProjectionsEditorActions; class QButtonGroup; //! Toolbar with projections buttons (horizontal projections, vertical projections, select, zoom) //! located at the right-hand side of ProjectionsEditor (part of JobProjectionsWidget). class ProjectionsToolBar : public QToolBar { Q_OBJECT public: ProjectionsToolBar(ProjectionsEditorActions* editorActions, QWidget* parent = 0); public slots: void onChangeActivityRequest(MaskEditorFlags::Activity value); void onProjectionTabChange(MaskEditorFlags::Activity value); signals: void activityModeChanged(MaskEditorFlags::Activity); private slots: void onActivityGroupChange(int); private: void setup_selection_group(); void setup_shapes_group(); void setup_extratools_group(); void add_separator(); MaskEditorFlags::Activity currentActivity() const; void setCurrentActivity(MaskEditorFlags::Activity value); ProjectionsEditorActions* m_editorActions; QButtonGroup* m_activityButtonGroup; MaskEditorFlags::Activity m_previousActivity; }; #endif // PROJECTIONSTOOLBAR_H
/* LeDiscovery.h Interactex Designer Created by Juan Haladjian on 05/10/2013. Interactex Designer is a configuration tool to easily setup, simulate and connect e-Textile hardware with smartphone functionality. Interactex Client is an app to store and replay projects made with Interactex Designer. www.interactex.org Copyright (C) 2013 TU Munich, Munich, Germany; DRLab, University of the Arts Berlin, Berlin, Germany; Telekom Innovation Laboratories, Berlin, Germany Contacts: juan.haladjian@cs.tum.edu katharina.bredies@udk-berlin.de opensource@telekom.de The first version of the software was designed and implemented as part of "Wearable M2M", a joint project of UdK Berlin and TU Munich, which was founded by Telekom Innovation Laboratories Berlin. It has been extended with funding from EIT ICT, as part of the activity "Connected Textiles". Interactex is built using the Tango framework developed by TU Munich. In the Interactex software, we use the GHUnit (a test framework for iOS developed by Gabriel Handford) and cocos2D libraries (a framework for building 2D games and graphical applications developed by Zynga Inc.). www.cocos2d-iphone.org github.com/gabriel/gh-unit Interactex also implements the Firmata protocol. Its software serial library is based on the original Arduino Firmata library. www.firmata.org All hardware part graphics in Interactex Designer are reproduced with kind permission from Fritzing. Fritzing is an open-source hardware initiative to support designers, artists, researchers and hobbyists to work creatively with interactive electronics. www.frizting.org Martijn ten Bhömer from TU Eindhoven contributed PureData support. Contact: m.t.bhomer@tue.nl. 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/>. */ #import <Foundation/Foundation.h> #import <CoreBluetooth/CoreBluetooth.h> #import "BleService.h" @protocol LeDiscoveryDelegate <NSObject> - (void) discoveryDidRefresh; - (void) discoveryStatePoweredOff; - (void) peripheralDiscovered:(CBPeripheral*) peripheral; @end @interface LeDiscovery : NSObject <CBCentralManagerDelegate, CBPeripheralDelegate> { CBCentralManager *centralManager; BOOL pendingInit; } + (id) sharedInstance; - (void) startScanningForUUIDString:(NSString *)uuidString; - (void) stopScanning; - (void) connectPeripheral:(CBPeripheral*)peripheral; - (void) disconnectPeripheral:(CBPeripheral*)peripheral; @property (nonatomic, assign) id<LeDiscoveryDelegate> discoveryDelegate; @property (nonatomic, assign) id<BleServiceDelegate> peripheralDelegate; @property (retain, nonatomic) NSMutableArray * foundPeripherals; @property (retain, nonatomic) NSMutableArray * connectedServices; @end
class Move { public: Move() {} Move( const InputState& inInputState, float inTimestamp, float inDeltaTime ) : mInputState( inInputState ), mTimestamp( inTimestamp ), mDeltaTime( inDeltaTime ) {} const InputState& GetInputState() const { return mInputState; } float GetTimestamp() const { return mTimestamp; } float GetDeltaTime() const { return mDeltaTime; } bool Write( OutputMemoryBitStream& inOutputStream ) const; bool Read( InputMemoryBitStream& inInputStream ); private: InputState mInputState; float mTimestamp; float mDeltaTime; };
#include "backupfile.h" #include <stdbool.h> extern char *backupfile_internal (int, char const *, enum backup_type, bool);
// // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // NS_ASSUME_NONNULL_BEGIN @protocol ContactsManagerProtocol; @class OWSMessageSender; @protocol NotificationsProtocol; @protocol OWSCallMessageHandler; @interface TextSecureKitEnv : NSObject - (instancetype)initWithCallMessageHandler:(id<OWSCallMessageHandler>)callMessageHandler contactsManager:(id<ContactsManagerProtocol>)contactsManager messageSender:(OWSMessageSender *)messageSender notificationsManager:(id<NotificationsProtocol>)notificationsManager NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; + (instancetype)sharedEnv; + (void)setSharedEnv:(TextSecureKitEnv *)env; @property (nonatomic, readonly) id<OWSCallMessageHandler> callMessageHandler; @property (nonatomic, readonly) id<ContactsManagerProtocol> contactsManager; @property (nonatomic, readonly) OWSMessageSender *messageSender; @property (nonatomic, readonly) id<NotificationsProtocol> notificationsManager; @end NS_ASSUME_NONNULL_END
/* Copyright_License { Copyright (C) 2016 VirtualFlightRadar-Backend A detailed list of copyright holders can be found in the file "AUTHORS". This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } */ #pragma once #include <string> #include "object/Wind.h" #include "util/defines.h" #include "Data.hpp" namespace data { /** * @brief Store wind information. */ class WindData : public Data { public: DEFAULT_DTOR(WindData) WindData(); /** * @brief Constructor * @param wind The initial wind information */ explicit WindData(const object::Wind& wind); /** * @brief Get the MWV sentence. * @note The wind info is invalid after this operation. * @param dest The destination string to append data * @threadsafe */ void get_serialized(std::string& dest) override; /** * @brief Update the wind information. * @param wind The new wind information. * @return true on success, else false * @threadsafe */ bool update(object::Object&& wind) override; private: /// The Wind information object::Wind m_wind; }; } // namespace data
/* This file is part of solidity. solidity 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. solidity 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 solidity. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <libsolidity/analysis/TypeChecker.h> #include <libsolidity/ast/Types.h> #include <libsolidity/ast/ASTAnnotations.h> #include <libsolidity/ast/ASTForward.h> #include <libsolidity/ast/ASTVisitor.h> namespace dev { namespace solidity { class ErrorReporter; /** * This module performs analyses on the AST that are done after type checking and assignments of types: * - whether there are circular references in constant state variables * @TODO factor out each use-case into an individual class (but do the traversal only once) */ class PostTypeChecker: private ASTConstVisitor { public: /// @param _errors the reference to the list of errors and warnings to add them found during type checking. PostTypeChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {} bool check(ASTNode const& _astRoot); private: /// Adds a new error to the list of errors. void typeError(SourceLocation const& _location, std::string const& _description); virtual bool visit(ContractDefinition const& _contract) override; virtual void endVisit(ContractDefinition const& _contract) override; virtual bool visit(VariableDeclaration const& _declaration) override; virtual void endVisit(VariableDeclaration const& _declaration) override; virtual bool visit(Identifier const& _identifier) override; VariableDeclaration const* findCycle( VariableDeclaration const* _startingFrom, std::set<VariableDeclaration const*> const& _seen = std::set<VariableDeclaration const*>{} ); ErrorReporter& m_errorReporter; VariableDeclaration const* m_currentConstVariable = nullptr; std::vector<VariableDeclaration const*> m_constVariables; ///< Required for determinism. std::map<VariableDeclaration const*, std::set<VariableDeclaration const*>> m_constVariableDependencies; }; } }
/* Copyright (C) 2011 Statoil ASA, Norway. The file 'gen_data.h' is part of ERT - Ensemble based Reservoir Tool. ERT 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. ERT 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 at <http://www.gnu.org/licenses/gpl.html> for more details. */ #ifndef ERT_GEN_DATA_H #define ERT_GEN_DATA_H #ifdef __cplusplus extern "C" { #endif #include <ert/util/util.h> #include <ert/util/bool_vector.h> #include <ert/util/double_vector.h> #include <ert/util/buffer.h> #include <ert/ecl/ecl_sum.h> #include <ert/ecl/ecl_file.h> #include <ert/enkf/enkf_macros.h> #include <ert/enkf/gen_data_common.h> #include <ert/enkf/gen_data_config.h> #include <ert/enkf/forward_load_context.h> void gen_data_assert_size( gen_data_type * gen_data , int size , int report_step); bool gen_data_forward_load(gen_data_type * gen_data , const char * ecl_file , const forward_load_context_type * load_context); void gen_data_free(gen_data_type * ); double gen_data_iget_double(const gen_data_type * , int ); void gen_data_iset_double(gen_data_type * , int , double); gen_data_config_type * gen_data_get_config(const gen_data_type * ); const bool_vector_type * gen_data_get_forward_mask( const gen_data_type * gen_data ); int gen_data_get_size(const gen_data_type * ); double gen_data_iget_double(const gen_data_type * , int ); void gen_data_export(const gen_data_type * gen_data , const char * full_path , gen_data_file_format_type export_type , fortio_type * fortio); void gen_data_export_data(const gen_data_type * gen_data , double_vector_type * export_data); gen_data_file_format_type gen_data_guess_export_type( const gen_data_type * gen_data ); const char * gen_data_get_key( const gen_data_type * gen_data); void gen_data_upgrade_103(const char * filename); int gen_data_get_size( const gen_data_type * gen_data ); void gen_data_copy_to_double_vector(const gen_data_type * gen_data , double_vector_type * vector); bool gen_data_fload_with_report_step( gen_data_type * gen_data , const char * filename , const forward_load_context_type * load_context); UTIL_SAFE_CAST_HEADER(gen_data); UTIL_SAFE_CAST_HEADER_CONST(gen_data); VOID_USER_GET_HEADER(gen_data); VOID_ALLOC_HEADER(gen_data); VOID_FREE_HEADER(gen_data); VOID_COPY_HEADER (gen_data); VOID_ECL_WRITE_HEADER(gen_data); VOID_FORWARD_LOAD_HEADER(gen_data); VOID_INITIALIZE_HEADER(gen_data); VOID_READ_FROM_BUFFER_HEADER(gen_data); VOID_WRITE_TO_BUFFER_HEADER(gen_data); VOID_SERIALIZE_HEADER(gen_data) VOID_DESERIALIZE_HEADER(gen_data) VOID_SET_INFLATION_HEADER(gen_data); VOID_CLEAR_HEADER(gen_data); VOID_IMUL_HEADER(gen_data); VOID_IADD_HEADER(gen_data); VOID_IADDSQR_HEADER(gen_data); VOID_SCALE_HEADER(gen_data); VOID_ISQRT_HEADER(gen_data); #ifdef __cplusplus } #endif #endif
/* gb-project-tree-actions.h * * Copyright © 2015 Christian Hergert <christian@hergert.me> * * 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/>. */ #pragma once #include "gb-project-tree.h" G_BEGIN_DECLS void gb_project_tree_actions_init (GbProjectTree *self); void gb_project_tree_actions_update (GbProjectTree *self); G_END_DECLS
#pragma once #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class ExplorerCollectionIndexesDir : public ExplorerTreeItem { Q_OBJECT public: using BaseClass = ExplorerTreeItem; static const QString labelText; explicit ExplorerCollectionIndexesDir(QTreeWidgetItem *parent); void expand(); private Q_SLOTS: void ui_addIndex(); void ui_reIndex(); void ui_viewIndex(); void ui_refreshIndex(); }; }
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "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 Qt Company 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 ** 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." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef ARROWPAD_H #define ARROWPAD_H #include <QWidget> QT_BEGIN_NAMESPACE class QPushButton; QT_END_NAMESPACE //! [0] class ArrowPad : public QWidget //! [0] //! [1] { //! [1] //! [2] Q_OBJECT //! [2] public: ArrowPad(QWidget *parent = 0); private: QPushButton *upButton; QPushButton *downButton; QPushButton *leftButton; QPushButton *rightButton; }; #endif
// Copyright 2016 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef CORE_FXGE_CFX_FONTMAPPER_H_ #define CORE_FXGE_CFX_FONTMAPPER_H_ #include <memory> #include <vector> #include "core/fxge/cfx_fontmgr.h" #include "core/fxge/fx_font.h" class CFX_SubstFont; class CFX_FontMapper { public: explicit CFX_FontMapper(CFX_FontMgr* mgr); ~CFX_FontMapper(); void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); } void AddInstalledFont(const CFX_ByteString& name, int charset); void LoadInstalledFonts(); FXFT_Face FindSubstFont(const CFX_ByteString& face_name, bool bTrueType, uint32_t flags, int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont); #ifdef PDF_ENABLE_XFA FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, uint32_t flags, int weight, int italic_angle); #endif // PDF_ENABLE_XFA bool IsBuiltinFace(const FXFT_Face face) const; int GetFaceSize() const; CFX_ByteString GetFaceName(int index) const { return m_FaceArray[index].name; } std::vector<CFX_ByteString> m_InstalledTTFonts; std::vector<std::pair<CFX_ByteString, CFX_ByteString>> m_LocalizedTTFonts; private: static const size_t MM_FACE_COUNT = 2; static const size_t FOXIT_FACE_COUNT = 14; CFX_ByteString GetPSNameFromTT(void* hFont); CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily); FXFT_Face GetCachedTTCFace(void* hFont, const uint32_t tableTTCF, uint32_t ttc_size, uint32_t font_size); FXFT_Face GetCachedFace(void* hFont, CFX_ByteString SubstName, int weight, bool bItalic, uint32_t font_size); struct FaceData { CFX_ByteString name; uint32_t charset; }; bool m_bListLoaded; FXFT_Face m_MMFaces[MM_FACE_COUNT]; CFX_ByteString m_LastFamily; std::vector<FaceData> m_FaceArray; std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo; FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; CFX_FontMgr* const m_pFontMgr; }; #endif // CORE_FXGE_CFX_FONTMAPPER_H_
//*************************************************************************** // // Copyright (c) 1999 - 2006 Intel Corporation // // 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. // //*************************************************************************** /** @file ParentData.h This header defines the ... functionality. @note */ #ifndef ParentData_H #define ParentData_H //*************************************************************************** // Includes //*************************************************************************** #include "IFXString.h" #include "IFXMatrix4x4.h" namespace U3D_IDTF { //*************************************************************************** // Defines //*************************************************************************** //*************************************************************************** // Constants //*************************************************************************** //*************************************************************************** // Enumerations //*************************************************************************** //*************************************************************************** // Classes, structures and types //*************************************************************************** /** This is the implementation of a class that is used to @todo: usage. It supports the following interfaces: @todo: interfaces. */ class ParentData { public: ParentData() {}; virtual ~ParentData() {}; /** Set parent name */ void SetParentName( const IFXString& rParentName ); const IFXString& GetParentName() const; void SetParentTM( const IFXMatrix4x4& rMatrix ); const IFXMatrix4x4& GetParentTM() const; protected: private: IFXString m_parentName; IFXMatrix4x4 m_parentTM; }; //*************************************************************************** // Inline functions //*************************************************************************** IFXFORCEINLINE void ParentData::SetParentName( const IFXString& rParentName ) { m_parentName = rParentName; } IFXFORCEINLINE const IFXString& ParentData::GetParentName() const { return m_parentName; } IFXFORCEINLINE void ParentData::SetParentTM( const IFXMatrix4x4& rMatrix ) { m_parentTM = rMatrix; } IFXFORCEINLINE const IFXMatrix4x4& ParentData::GetParentTM() const { return m_parentTM; } //*************************************************************************** // Global function prototypes //*************************************************************************** //*************************************************************************** // Global data //*************************************************************************** } #endif
#ifndef TICSCOUNTER_H #define TICSCOUNTER_H #include <linux/hpet.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <signal.h> #include <time.h> #include <atomic> #include <stdlib.h> #include <fcntl.h> #include <stdint.h> #include <sys/ioctl.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include "agentoptions.h" class AgentOptions; using namespace std; /** # set timer freq limit to 10 microseconds $ sudo echo 100000 > /proc/sys/dev/hpet/max-user-freq need permissions to /dev/hpet sudo chmod 666 /dev/hpet A simple chgrp might not be persistent across reboots - to make the change last, create a new 40-timer-permissions.rules file in /etc/udev/rules.d with the following lines: KERNEL=="rtc0", GROUP="audio" KERNEL=="hpet", GROUP="audio" /etc/sysctl.conf (or something like /etc/sysctl.d/60-max-user-freq.conf): dev.hpet.max-user-freq=100000 Start-up script or /etc/rc.local: echo 100000 > /proc/sys/dev/hpet/max-user-freq */ class TicksCounter { public: TicksCounter(AgentOptions *option); virtual ~TicksCounter(); void increaseCounter(); unsigned long long getCounter(); protected: private: int fd=-1; struct sigaction old_, new_; atomic<unsigned long long> counter = {0}; void fallback(); }; #endif // TICSCOUNTER_H
/** * Copyright (c) 2006-2016 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #ifndef LOVE_LUASOCKET_LUASOCKET_H #define LOVE_LUASOCKET_LUASOCKET_H // LOVE #include <common/runtime.h> namespace love { namespace luasocket { int __open(lua_State * L); // Loaders for all lua files. We want to be able // to load these dynamically. (Identical in the LuaSocket // documentation. These functions wrap the parsing of code, etc). int __open_luasocket_socket(lua_State * L); int __open_luasocket_ftp(lua_State * L); int __open_luasocket_http(lua_State * L); int __open_luasocket_ltn12(lua_State * L); int __open_luasocket_mime(lua_State * L); int __open_luasocket_smtp(lua_State * L); int __open_luasocket_tp(lua_State * L); int __open_luasocket_url(lua_State * L); } // luasocket } // love #endif // LOVE_LUASOCKET_LUASOCKET_H
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-generic256.h" #include "../common/hc2cfdftv_8.c"
/* large.h - Handles binary manipulation of large numbers */ /* libzint - the open source barcode library Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com> 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 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. */ /* vim: set ts=4 sw=4 et : */ #ifndef __LARGE_H #define __LARGE_H #ifndef _MSC_VER #include <stdint.h> #else #include "ms_stdint.h" #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef struct { uint64_t lo; uint64_t hi; } large_int; #define large_lo(s) ((s)->lo) #define large_hi(s) ((s)->hi) /* Set 128-bit `t` from 128-bit `s` */ #define large_load(t, s) do { (t)->lo = (s)->lo; (t)->hi = (s)->hi; } while (0) /* Set 128-bit `t` from 64-bit `s` */ #define large_load_u64(t, s) do { (t)->lo = (s); (t)->hi = 0; } while (0) INTERNAL void large_load_str_u64(large_int *t, const unsigned char *s, const int length); INTERNAL void large_add(large_int *t, const large_int *s); INTERNAL void large_add_u64(large_int *t, const uint64_t s); INTERNAL void large_sub_u64(large_int *t, const uint64_t s); INTERNAL void large_mul_u64(large_int *t, const uint64_t s); INTERNAL uint64_t large_div_u64(large_int *t, uint64_t v); INTERNAL void large_unset_bit(large_int *t, const int bit); INTERNAL void large_uint_array(const large_int *t, unsigned int *uint_array, const int size, int bits); INTERNAL void large_uchar_array(const large_int *t, unsigned char *uchar_array, const int size, int bits); INTERNAL void large_print(const large_int *t); INTERNAL char *large_dump(const large_int *t, char *buf); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __LARGE_H */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_GenericFactory_h #define mozilla_GenericFactory_h #include "mozilla/Attributes.h" #include "mozilla/Module.h" namespace mozilla { /** * A generic factory which uses a constructor function to create instances. * This class is intended for use by the component manager and the generic * module. */ class GenericFactory final : public nsIFactory { ~GenericFactory() {} public: typedef Module::ConstructorProcPtr ConstructorProcPtr; NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFACTORY explicit GenericFactory(ConstructorProcPtr aCtor) : mCtor(aCtor) { NS_ASSERTION(mCtor, "GenericFactory with no constructor"); } private: ConstructorProcPtr mCtor; }; } // namespace mozilla #endif // mozilla_GenericFactory_h
/* NUI3 - C++ cross-platform GUI framework for OpenGL based applications Copyright (C) 2002-2003 Sebastien Metrot licence: see nui3/LICENCE.TXT */ #pragma once #include "nuiMainWindow.h" class MainWindow : public nuiMainWindow { public: MainWindow(const nglContextInfo& rContext, const nglWindowInfo& rInfo, bool ShowFPS = false, const nglContext* pShared = NULL); ~MainWindow(); void OnCreation(); void OnClose(); private: nuiEventSink<MainWindow> mEventSink; };
#pragma once #include "augs/templates/maybe_const.h" template <class, class> class component_synchronizer; template <class, class> class synchronizer_base; template <class H> void construct_pre_inference(H); class write_synchronized_component_access { template <class, class> friend class synchronizer_base; template <class, class> friend class component_synchronizer; template <class H> friend void construct_pre_inference(H); friend struct perform_transfer_impl; write_synchronized_component_access() {} }; template <class entity_handle_type, class component_type> class synchronizer_base { protected: /* A value of nullptr means that the entity has no such component. */ static constexpr bool is_const = is_handle_const_v<entity_handle_type>; using component_pointer = maybe_const_ptr_t<is_const, component_type>; const component_pointer component; const entity_handle_type handle; public: auto& get_raw_component(write_synchronized_component_access) const { return *component; } const auto& get_raw_component() const { return *component; } auto get_handle() const { return handle; } bool operator==(const std::nullptr_t) const { return component == nullptr; } bool operator!=(const std::nullptr_t) const { return component != nullptr; } explicit operator bool() const { return component != nullptr; } auto* operator->() const { return this; } synchronizer_base( const component_pointer c, const entity_handle_type& h ) : component(c), handle(h) {} };
/*****************************************************************************/ /* File: include.h (Khepera Simulator) */ /* Author: Olivier MICHEL <om@alto.unice.fr> */ /* Date: Wed Feb 14 10:05:32 MET 1996 */ /* Description: include file (to be included by user.c) */ /* */ /* Copyright (c) 1995 */ /* Olivier MICHEL */ /* MAGE team, i3S laboratory, */ /* CNRS, University of Nice - Sophia Antipolis, FRANCE */ /* */ /* Permission is hereby granted to copy this package for free distribution. */ /* The author's name and this copyright notice must be included in any copy. */ /* Commercial use is forbidden. */ /*****************************************************************************/ #ifndef INCLUDE_H #define INCLUDE_H #include "header.h" #include "context.h" #include "colors.h" #include "robot.h" #define X_O 603 #define Y_O 185 #define INFO_WIDTH 502 #define INFO_HEIGHT 337 #define Color(c) XSetForeground(display,gc,color[c].pixel) #define DrawPoint(x,y) XDrawPoint(display,window,gc,x+X_O,y+Y_O) #define DrawLine(x1,y1,x2,y2) XDrawLine(display,window,gc,x1+X_O,y1+Y_O,x2+X_O,y2+Y_O) #define DrawRectangle(x,y,w,h) XDrawRectangle(display,window,gc,x+X_O,y+Y_O,w,h) #define FillRectangle(x,y,w,h) XFillRectangle(display,window,gc,x+X_O,y+Y_O,w,h) #define FillArc(x,y,w,h,a,b) XFillArc(display,window,gc,x+X_O,y+Y_O,w,h,a,b) #define DrawArc(x,y,w,h,a,b) XDrawArc(display,window,gc,x+X_O,y+Y_O,w,h,a,b) #define DrawText(x,y,t) XDrawString(display,window,gc,x+X_O,y+Y_O,t,strlen(t)) #define UndrawText(x,y,t); {Color(GREY_69); XFillRectangle(display,window,gc,x+X_O-1,y+Y_O-10,2+strlen(t)*8,14);} #define WriteComment(t) DisplayComment(context,t) #define EraseComment() UndisplayComment(context) #define FastRunRobot(r) RobotRunFast(context) #define RunRobot(r) RobotRun(context) #define StopCommand() UnpressButton(context,context->Buttons) #define ShowUserInfo(i,p) ShowInfoUser(context,i,p) #define GetUserInfo() (context->Info) #define GetUserInfoPage() ((context->Info==0) ? context->InfoAbout + 1 : context->InfoUser[context->Info-1] + 1) #define DrawRobot(robot) DrawLittleRobot(robot,robot) #define RIGHT 0 #define LEFT 1 extern struct Context *context; extern Display *display; extern Window window; extern GC gc; extern XColor color[NUMBER_OF_COLORS]; extern void DisplayComment(struct Context *c,char *text); extern void UndisplayComment(struct Context *c); extern void RobotRunFast(struct Context *c); extern boolean RobotRun(struct Context *c); extern boolean UnpressButton(struct Context *c,struct Button *b); extern void ShowInfoUser(struct Context *c,u_char info,u_char page); extern void DrawLittleRobot(struct Robot *r1,struct Robot *r2); #endif
/* Implements > for _Decimal64 Copyright (C) 2018 Free Software Foundation, Inc. This file is part of the Decimal Floating Point C Library. The Decimal Floating Point C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1. The Decimal Floating Point C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License version 2.1 for more details. You should have received a copy of the GNU Lesser General Public License version 2.1 along with the Decimal Floating Point C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. Please see libdfp/COPYING.txt for more information. */ #define _DECIMAL_SIZE 64 #include "isgreaterd32.c"
// // Copyright (C) 2004-2006 SIPfoundry Inc. // Licensed by SIPfoundry under the LGPL license. // // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved. // Licensed to SIPfoundry under a Contributor Agreement. // // $$ /////////////////////////////////////////////////////////////////////////////// #if !defined(AFX_SIPLINECREDENTIALS_H__8B43463B_8F7F_426B_94F5_B60164A76DF3__INCLUDED_) #define AFX_SIPLINECREDENTIALS_H__8B43463B_8F7F_426B_94F5_B60164A76DF3__INCLUDED_ #include <net/Url.h> #include <net/HttpMessage.h> class SipLineCredentials : public UtlString { public: SipLineCredentials(const UtlString realm, const UtlString userId, const UtlString passwordToken, const UtlString type); virtual ~SipLineCredentials(); void getRealm(UtlString* realm); void getUserId(UtlString* UserId); void getPasswordToken(UtlString* passToken); void getType(UtlString* type); private: UtlString mType; UtlString mPasswordToken; UtlString mUserId; UtlString mRealm; }; #endif // !defined(AFX_SIPLINECREDENTIALS_H__8B43463B_8F7F_426B_94F5_B60164A76DF3__INCLUDED_)
/* Copyright (C) 2011, 2010 Sebastian Pancratz Copyright (C) 2009 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpz_mod_poly.h" #include "ulong_extras.h" int main(void) { int i, result; fmpz_mod_ctx_t ctx; FLINT_TEST_INIT(state); flint_printf("evaluate_fmpz...."); fflush(stdout); fmpz_mod_ctx_init_ui(ctx, 2); /* Check aliasing */ for (i = 0; i < 1000 * flint_test_multiplier(); i++) { fmpz_t a, b, p; fmpz_mod_poly_t f; fmpz_init(p); fmpz_randtest_unsigned(p, state, 2 * FLINT_BITS); fmpz_add_ui(p, p, 2); fmpz_mod_ctx_set_modulus(ctx, p); fmpz_init(a); fmpz_init(b); fmpz_randm(a, state, p); fmpz_mod_poly_init(f, ctx); fmpz_mod_poly_randtest(f, state, n_randint(state, 100), ctx); fmpz_mod_poly_evaluate_fmpz(b, f, a, ctx); fmpz_mod_poly_evaluate_fmpz(a, f, a, ctx); result = (fmpz_equal(a, b)); if (!result) { flint_printf("FAIL:\n"); fmpz_mod_poly_print(f, ctx), flint_printf("\n\n"); fmpz_print(a), flint_printf("\n\n"); fmpz_print(b), flint_printf("\n\n"); fflush(stdout); flint_abort(); } fmpz_mod_poly_clear(f, ctx); fmpz_clear(a); fmpz_clear(b); fmpz_clear(p); } /* Check that the result agrees with Z[X] */ for (i = 0; i < 1000 * flint_test_multiplier(); i++) { fmpz_t a, b, c, p; fmpz_mod_poly_t f; fmpz_poly_t g; fmpz_init(p); fmpz_randtest_unsigned(p, state, 2 * FLINT_BITS); fmpz_add_ui(p, p, 2); fmpz_mod_ctx_set_modulus(ctx, p); fmpz_init(a); fmpz_init(b); fmpz_init(c); fmpz_mod_poly_init(f, ctx); fmpz_poly_init(g); fmpz_randm(a, state, p); fmpz_mod_poly_randtest(f, state, n_randint(state, 100), ctx); fmpz_mod_poly_get_fmpz_poly(g, f, ctx); fmpz_mod_poly_evaluate_fmpz(b, f, a, ctx); fmpz_poly_evaluate_fmpz(c, g, a); fmpz_mod(c, c, p); result = (fmpz_equal(b, c)); if (!result) { flint_printf("FAIL (cmp with fmpz_poly):\n"); fmpz_mod_poly_print(f, ctx), flint_printf("\n\n"); fmpz_poly_print(g), flint_printf("\n\n"); fmpz_print(a), flint_printf("\n\n"); fmpz_print(b), flint_printf("\n\n"); fmpz_print(c), flint_printf("\n\n"); fflush(stdout); flint_abort(); } fmpz_clear(a); fmpz_clear(b); fmpz_clear(c); fmpz_clear(p); fmpz_mod_poly_clear(f, ctx); fmpz_poly_clear(g); } fmpz_mod_ctx_clear(ctx); FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }
/* * ivykis, an event handling library * Copyright (C) 2013 Lennert Buytenhek * Dedicated to Marija Kulikova. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version * 2.1 as published by the Free Software Foundation. * * 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 version 2.1 for more details. * * You should have received a copy of the GNU Lesser General Public * License version 2.1 along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, * Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> #include <iv.h> static int success; static struct iv_task task; static struct iv_timer timer; static void handler_task(void *_t) { iv_timer_register(&timer); } static void handler_timer(void *_t) { success = 1; } int main() { alarm(5); iv_init(); IV_TASK_INIT(&task); task.handler = handler_task; iv_task_register(&task); IV_TIMER_INIT(&timer); iv_validate_now(); timer.expires = iv_now; timer.expires.tv_sec--; timer.handler = handler_timer; iv_main(); iv_deinit(); return !success; }
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /* plaincodemarker.h */ #ifndef PLAINCODEMARKER_H #define PLAINCODEMARKER_H #include "codemarker.h" QT_BEGIN_NAMESPACE class PlainCodeMarker : public CodeMarker { public: PlainCodeMarker(); ~PlainCodeMarker(); bool recognizeCode( const QString& code ); bool recognizeExtension( const QString& ext ); bool recognizeLanguage( const QString& lang ); Atom::Type atomType() const; QString plainName( const Node *node ); QString plainFullName( const Node *node, const Node *relative ); QString markedUpCode( const QString& code, const Node *relative, const Location &location ); QString markedUpSynopsis( const Node *node, const Node *relative, SynopsisStyle style ); QString markedUpName( const Node *node ); QString markedUpFullName( const Node *node, const Node *relative ); QString markedUpEnumValue(const QString &enumValue, const Node *relative); QString markedUpIncludes( const QStringList& includes ); QString functionBeginRegExp( const QString& funcName ); QString functionEndRegExp( const QString& funcName ); QList<Section> sections(const InnerNode *innerNode, SynopsisStyle style, Status status); }; QT_END_NAMESPACE #endif
////////////////////////////////////////////////////////////////////// // // Pixie // // Copyright © 1999 - 2003, Okan Arikan // // Contact: okan@cs.utexas.edu // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // // File : fileResource.h // Classes : CFileResource // Description : Any class that reads from a file must be derived from this class // //////////////////////////////////////////////////////////////////////// #ifndef FILERESOURCE_H #define FILERESOURCE_H #include <stdio.h> #include "common/global.h" // The global header file // Come textual definitions for various binary files extern const char *filePhotonMap; extern const char *fileIrradianceCache; extern const char *fileGatherCache; extern const char *fileTransparencyShadow; extern const char *filePointCloud; extern const char *fileBrickMap; const unsigned int magicNumber = 123456789; const unsigned int magicNumberReversed = ((magicNumber & 0xFF000000) >> 24) | ((magicNumber & 0xFF0000) >> 8) | ((magicNumber & 0xFF00) << 8) | ((magicNumber & 0xFF) << 24); /////////////////////////////////////////////////////////////////////// // Class : CFileResource // Description : Any class that is read or written to a file must derive from this class // Comments : class CFileResource { public: CFileResource(const char *); virtual ~CFileResource(); const char *name; }; FILE *ropen(const char *,const char *,const char *,int probe=FALSE); FILE *ropen(const char *,char *); #endif
/** * @file _httpsetpriority.h * @brief Internal declarations for HttpSetPriority * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2012, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef _LLCORE_HTTP_SETPRIORITY_H_ #define _LLCORE_HTTP_SETPRIORITY_H_ #include "httpcommon.h" #include "httprequest.h" #include "_httpoperation.h" #include "_refcounted.h" namespace LLCore { /// HttpOpSetPriority is an immediate request that /// searches the various queues looking for a given /// request handle and changing it's priority if /// found. /// /// *NOTE: This will very likely be removed in the near future /// when priority is removed from the library. class HttpOpSetPriority : public HttpOperation { public: HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority); protected: virtual ~HttpOpSetPriority(); private: HttpOpSetPriority(const HttpOpSetPriority &); // Not defined void operator=(const HttpOpSetPriority &); // Not defined public: virtual void stageFromRequest(HttpService *); protected: // Request Data HttpHandle mHandle; HttpRequest::priority_t mPriority; }; // end class HttpOpSetPriority } // end namespace LLCore #endif // _LLCORE_HTTP_SETPRIORITY_H_
#include <stdlib.h> /* Provides exit */ #include <stdio.h> /* Provides printf, scanf, sscanf */ #include <unistd.h> /* Provides isatty */ #include "io_frontend.h" int ISATTY; /* Standard Input procedures **************/ _Bool _get_bool(FILE* file, char* n){ char b[512]; int r = 0; int s = 1; char c; do { if(ISATTY) { if((s != 1)||(r == -1)) printf("\a"); printf("%s (1,t,T/0,f,F) ? ", n); } if(scanf("%s", b)==EOF) exit(0); s = sscanf(b, "%c", &c); r = -1; if((c == '0') || (c == 'f') || (c == 'F')) r = 0; if((c == '1') || (c == 't') || (c == 'T')) r = 1; } while((s != 1) || (r == -1)); fprintf(file, "%i\n",r); return (_Bool)r; } int _get_int(FILE* file, char* n){ char b[512]; int r; int s = 1; do { if(ISATTY) { if(s != 1) printf("\a"); printf("%s (integer) ? ", n); } if(scanf("%s", b)==EOF) exit(0); s = sscanf(b, "%d", &r); } while(s != 1); fprintf(file, "%d\n", r); return r; } double _get_double(FILE* file, char* n){ char b[512]; double r; int s = 1; do { if(ISATTY) { if(s != 1) printf("\a"); printf("%s (double) ? ", n); } if(scanf("%s", b)==EOF) exit(0); s = sscanf(b, "%lf", &r); } while(s != 1); fprintf(file, "%f\n", r); return r; } /* Standard Output procedures **************/ void _put_bool(FILE* file, char* n, _Bool _V){ if(ISATTY) { printf("%s = ", n); } else { printf("'%s': ", n); }; printf("'%i' ", (_V)? 1 : 0); printf("\n"); fprintf(file, "%i\n", _V); fflush(file); } void _put_int(FILE* file, char* n, int _V){ if(ISATTY) { printf("%s = ", n); } else { printf("'%s': ", n); }; printf("'%d' ", _V); printf("\n"); fprintf(file, "%d\n", _V); fflush(file); } void _put_float(FILE* file, char* n, float _V, int PREC){ if(ISATTY) { printf("%s = ", n); } else { printf("'%s': ", n); }; printf("'%.*f' ", PREC, _V); printf("\n"); fprintf(file, "%.*f\n", PREC, _V); fflush(file); } void _put_double(FILE* file, char* n, double _V, int PREC){ if(ISATTY) { printf("%s = ", n); } else { printf("'%s': ", n); }; printf("'%.*f' ", PREC, _V); printf("\n"); fprintf(file, "%.*f\n", PREC, _V); fflush(file); }
/** * \file * * \brief Chip-specific sleep manager configuration * * Copyright (c) 2014 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * 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. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ #ifndef CONF_SLEEPMGR_INCLUDED #define CONF_SLEEPMGR_INCLUDED // Sleep manager options #define CONFIG_SLEEPMGR_ENABLE #endif /* CONF_SLEEPMGR_INCLUDED */
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. #ifndef Patternist_SchemaTypeFactory_H #define Patternist_SchemaTypeFactory_H #include <QSharedData> #include "qreportcontext_p.h" #include "qitemtype_p.h" #include "qschematype_p.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE namespace QPatternist { /** * @short A factory creating schema types. * * @ingroup Patternist_types * @author Frans Englich <frans.englich@nokia.com> */ class SchemaTypeFactory : public QSharedData { public: typedef QExplicitlySharedDataPointer<SchemaTypeFactory> Ptr; SchemaTypeFactory(); virtual ~SchemaTypeFactory(); /** * @returns a schema type for name @p name. If no schema type exists for @p name, @c null * is returned */ virtual SchemaType::Ptr createSchemaType(const QXmlName name) const = 0; /** * @returns a dictionary containing the types this factory serves. The key * is the type's QName in Clark name syntax. */ virtual SchemaType::Hash types() const = 0; private: Q_DISABLE_COPY(SchemaTypeFactory) }; } QT_END_NAMESPACE QT_END_HEADER #endif
/* Copyright (C) 2011 Sebastian Pancratz This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "ulong_extras.h" int main(void) { int i, result; FLINT_TEST_INIT(state); flint_printf("sqrtmod_primepow...."); fflush(stdout); for (i = 0; i < 1000 * flint_test_multiplier(); i++) /* Test random squares mod a power of 2 */ { mp_limb_t a, b, p, pow, pow2, pinv; slong exp, num, i; mp_limb_t * sqrt; int btest; p = 2; exp = n_randint(state, FLINT_BITS - 1) + 1; pow = n_pow(p, exp); b = n_randtest(state) % pow; pow2 = p; while (FLINT_BIT_COUNT(p*pow2) <= 12) pow2 *= p; if ((b % (p*pow2)) == 0) { b += pow2; b %= pow; } pinv = n_preinvert_limb(pow); a = n_mulmod2_preinv(b, b, pow, pinv); num = n_sqrtmod_primepow(&sqrt, a, p, exp); btest = 0; for (i = 0; i < num; i++) { if (a != n_mulmod2_preinv(sqrt[i], sqrt[i], pow, pinv)) break; if (sqrt[i] == b) btest = 1; } result = btest & (i == num); if (!result) { flint_printf("FAIL:\n"); flint_printf("p = %wu\n", p); flint_printf("exp = %wd\n", exp); flint_printf("a = %wu\n", a); flint_printf("b = %wu\n", b); flint_printf("num = %wd\n", num); if (!btest) flint_printf("Square root not found.\n"); if (i != num) flint_printf("%wu not a square root of %wu mod %wu\n", sqrt[i], a, pow); abort(); } flint_free(sqrt); } for (i = 0; i < 1000 * flint_test_multiplier(); i++) /* Test random squares mod other prime powers */ { mp_limb_t a, b, p, pow, pow2, pinv; slong exp, maxexp, num, i; mp_bitcnt_t bits; mp_limb_t * sqrt; int btest; bits = n_randint(state, 18) + 2; p = n_randprime(state, bits, 0); maxexp = FLINT_BITS/bits; exp = n_randint(state, maxexp) + 1; pow = n_pow(p, exp); b = n_randtest(state) % pow; if (bits <= FLINT_BITS/2) { pow2 = p; while (FLINT_BIT_COUNT(p*pow2) <= 12) pow2 *= p; if ((b % (p*pow2)) == 0) b += pow2; b %= pow; } pinv = n_preinvert_limb(pow); a = n_mulmod2_preinv(b, b, pow, pinv); num = n_sqrtmod_primepow(&sqrt, a, p, exp); btest = 0; for (i = 0; i < num; i++) { if (a != n_mulmod2_preinv(sqrt[i], sqrt[i], pow, pinv)) break; if (sqrt[i] == b) btest = 1; } result = btest & (i == num); if (!result) { flint_printf("FAIL:\n"); flint_printf("p = %wu\n", p); flint_printf("exp = %wd\n", exp); flint_printf("a = %wu\n", a); flint_printf("b = %wu\n", b); flint_printf("num = %wd\n", num); if (!btest) flint_printf("Square root not found.\n"); if (i != num) flint_printf("%wu not a square root of %wu mod %wu\n", sqrt[i], a, pow); abort(); } flint_free(sqrt); } for (i = 0; i < 500 * flint_test_multiplier(); i++) /* Test random nonsquares */ { mp_limb_t a, b, p, pow, pinv; slong exp, maxexp; mp_bitcnt_t bits; mp_limb_t * sqrt; bits = n_randint(state, 18) + 2; p = n_randprime(state, bits, 0); maxexp = 20/bits; exp = n_randint(state, maxexp) + 1 + (p == 2); pow = n_pow(p, exp); pinv = n_preinvert_limb(pow); a = n_randtest(state) % pow; while (n_sqrtmod_primepow(&sqrt, a, p, exp)) { if (n_mulmod2_preinv(sqrt[0], sqrt[0], pow, pinv) != a) { flint_printf("FAIL:\n"); flint_printf("%wu^2 is not %wu mod %wu\n", sqrt[0], a, pow); abort(); } flint_free(sqrt); a = n_randtest(state) % pow; } for (b = 0; b < pow; b++) { if (n_mulmod2_preinv(b, b, pow, pinv) == a) break; } result = (b == pow); if (!result) { flint_printf("FAIL:\n"); flint_printf("p = %wu\n", p); flint_printf("exp = %wd\n", exp); flint_printf("a = %wu\n", a); flint_printf("b = %wu\n", b); abort(); } flint_free(sqrt); } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }
#ifndef __RARBUG_H__ #define __RARBUG_H__ #include <openssl/sha.h> void SHA1_Update_WithRARBug(SHA_CTX *ctx,void *bytes,unsigned long length,int bug); #endif
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2009-2012 * All rights reserved * * This file is part of GPAC / Dummy input module * * GPAC 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, or (at your option) * any later version. * * GPAC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include <gpac/modules/codec.h> #include <gpac/scenegraph_vrml.h> static Bool DEV_RegisterDevice(struct __input_device *ifce, const char *urn, GF_BitStream *dsi, void (*AddField)(struct __input_device *_this, u32 fieldType, const char *name)) { if (strcmp(urn, "DemoSensor")) return 0; AddField(ifce, GF_SG_VRML_SFSTRING, "content"); return 1; } static void DEV_Start(struct __input_device *ifce) { GF_BitStream *bs; char *buf, *szWord; u32 len, val, i, buf_size; szWord = "Hello InputSensor!"; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); /*HTK sensor buffer format: SFString - SFInt32 - SFFloat*/ gf_bs_write_int(bs, 1, 1); len = strlen(szWord); val = gf_get_bit_size(len); gf_bs_write_int(bs, val, 5); gf_bs_write_int(bs, len, val); for (i=0; i<len; i++) gf_bs_write_int(bs, szWord[i], 8); gf_bs_align(bs); gf_bs_get_content(bs, &buf, &buf_size); gf_bs_del(bs); ifce->DispatchFrame(ifce, buf, buf_size); gf_free(buf); } static void DEV_Stop(struct __input_device *ifce) { } GPAC_MODULE_EXPORT const u32 *QueryInterfaces() { static u32 si [] = { GF_INPUT_DEVICE_INTERFACE, 0 }; return si; } GPAC_MODULE_EXPORT GF_BaseInterface *LoadInterface(u32 InterfaceType) { GF_InputSensorDevice *plug; if (InterfaceType != GF_INPUT_DEVICE_INTERFACE) return NULL; GF_SAFEALLOC(plug, GF_InputSensorDevice); GF_REGISTER_MODULE_INTERFACE(plug, GF_INPUT_DEVICE_INTERFACE, "GPAC Demo InputSensor", "gpac distribution") plug->RegisterDevice = DEV_RegisterDevice; plug->Start = DEV_Start; plug->Stop = DEV_Stop; return (GF_BaseInterface *)plug; } GPAC_MODULE_EXPORT void ShutdownInterface(GF_BaseInterface *bi) { GF_InputSensorDevice *ifcn = (GF_InputSensorDevice*)bi; if (ifcn->InterfaceType==GF_INPUT_DEVICE_INTERFACE) { gf_free(bi); } } GPAC_MODULE_STATIC_DELARATION( demo_is )
static char rcsid[] = "$Id$"; /* * $TSUKUBA_Release: Omni OpenMP Compiler 3 $ * $TSUKUBA_Copyright: * PLEASE DESCRIBE LICENSE AGREEMENT HERE * $ */ /* error case of parallel for 003: * do while ¤ËÂФ·¤Æ¡¢parallel for ¤ò»ØÄꤷ¤¿¾ì¹ç */ #include <omp.h> main () { int true = 1; #pragma omp parallel for do { true = 0; } while (true); printf ("err_parallel_for 003 : FAILED, can not compile this program.\n"); return 1; }
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "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 Nokia Corporation and its Subsidiary(-ies) 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." ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef CAR_H #define CAR_H #include <QGraphicsObject> #include <QBrush> class Car : public QGraphicsObject { Q_OBJECT public: Car(); QRectF boundingRect() const; public Q_SLOTS: void accelerate(); void decelerate(); void turnLeft(); void turnRight(); Q_SIGNALS: void crashed(); protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void timerEvent(QTimerEvent *event); private: QBrush color; qreal wheelsAngle; // used when applying rotation qreal speed; // delta movement along the body axis }; #endif // CAR_H
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: android/libcore/luni/src/main/java/libcore/io/ErrnoException.java // #ifndef _LibcoreIoErrnoException_H_ #define _LibcoreIoErrnoException_H_ @class JavaIoIOException; @class JavaLangThrowable; @class JavaNetSocketException; #include "J2ObjC_header.h" #include "java/lang/Exception.h" @interface LibcoreIoErrnoException : JavaLangException { @public jint errno__; } - (instancetype)initWithNSString:(NSString *)functionName withInt:(jint)errno_; - (instancetype)initWithNSString:(NSString *)functionName withInt:(jint)errno_ withJavaLangThrowable:(JavaLangThrowable *)cause; - (NSString *)getMessage; - (JavaIoIOException *)rethrowAsIOException; - (JavaNetSocketException *)rethrowAsSocketException; @end J2OBJC_EMPTY_STATIC_INIT(LibcoreIoErrnoException) CF_EXTERN_C_BEGIN CF_EXTERN_C_END J2OBJC_TYPE_LITERAL_HEADER(LibcoreIoErrnoException) #endif // _LibcoreIoErrnoException_H_
// // MNSGetCreateMetadataOptions.h // // Copyright 2014 MediaNet Software // This file is part of MNSJiraRESTClient. // // MNSJiraRESTClient 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 3 of the License. // // MNSJiraRESTClient 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 MNSJiraRESTClient. If not, see <http://www.gnu.org/licenses/>. #import <Foundation/Foundation.h> @interface MNSGetCreateIssueMetadataOptions : NSObject @property (nonatomic, strong) NSArray *projectIds; @property (nonatomic, strong) NSArray *projectKeys; @property (nonatomic, strong) NSArray *issueTypeIds; @property (nonatomic, strong) NSArray *issueTypeNames; @property (nonatomic, strong) NSArray *expandos; //list of expandables fields + (MNSGetCreateIssueMetadataOptions *)createMetaDataOptionsWithProjectIds:(NSArray *)projectIds projectKeys:(NSArray *)projectKeys issueTypeIds:(NSArray *)issueTypeIds issueTypeNames:(NSArray *)issueTypeNames expandos:(NSArray *)expandos; @end
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "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 Nokia Corporation and its Subsidiary(-ies) 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." ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef TONEGENERATORDIALOG_H #define TONEGENERATORDIALOG_H #include "spectrum.h" #include <QDialog> #include <QtMultimedia/QAudioDeviceInfo> QT_FORWARD_DECLARE_CLASS(QCheckBox) QT_FORWARD_DECLARE_CLASS(QSlider) QT_FORWARD_DECLARE_CLASS(QSpinBox) QT_FORWARD_DECLARE_CLASS(QGridLayout) /** * Dialog which controls the parameters of the tone generator. */ class ToneGeneratorDialog : public QDialog { Q_OBJECT public: ToneGeneratorDialog(QWidget *parent = 0); ~ToneGeneratorDialog(); bool isFrequencySweepEnabled() const; qreal frequency() const; qreal amplitude() const; private slots: void frequencySweepEnabled(bool enabled); private: QCheckBox* m_toneGeneratorSweepCheckBox; bool m_frequencySweepEnabled; QWidget* m_toneGeneratorControl; QWidget* m_toneGeneratorFrequencyControl; QSlider* m_frequencySlider; QSpinBox* m_frequencySpinBox; qreal m_frequency; QSlider* m_amplitudeSlider; }; #endif // TONEGENERATORDIALOG_H
/**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QT3DQUICK3DCOREPLUGIN_H #define QT3DQUICK3DCOREPLUGIN_H #include <QtQml/QQmlExtensionPlugin> QT_BEGIN_NAMESPACE class Qt3DQuick3DCorePlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: Qt3DQuick3DCorePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } ~Qt3DQuick3DCorePlugin(); void registerTypes(const char *uri) override; }; QT_END_NAMESPACE #endif // QT3DQUICK3DCOREPLUGIN_H
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include <spdlog/sinks/stdout_sinks.h> #endif #include <spdlog/details/console_globals.h> #include <spdlog/pattern_formatter.h> #include <memory> #ifdef _WIN32 // under windows using fwrite to non-binary stream results in \r\r\n (see issue #1675) // so instead we use ::FileWrite #include <spdlog/details/windows_include.h> #include <fileapi.h> // WriteFile (..) #include <io.h> // _get_osfhandle(..) #include <stdio.h> // _fileno(..) #endif // WIN32 namespace spdlog { namespace sinks { template<typename ConsoleMutex> SPDLOG_INLINE stdout_sink_base<ConsoleMutex>::stdout_sink_base(FILE *file) : mutex_(ConsoleMutex::mutex()) , file_(file) , formatter_(details::make_unique<spdlog::pattern_formatter>()) { #ifdef _WIN32 // get windows handle from the FILE* object handle_ = (HANDLE)::_get_osfhandle(::_fileno(file_)); // don't throw to support cases where no console is attached, // and let the log method to do nothing if (handle_ == INVALID_HANDLE_VALUE). // throw only if non stdout/stderr target is requested (probably regular file and not console). if (handle_ == INVALID_HANDLE_VALUE && file != stdout && file != stderr) { throw_spdlog_ex("spdlog::stdout_sink_base: _get_osfhandle() failed", errno); } #endif // WIN32 } template<typename ConsoleMutex> SPDLOG_INLINE void stdout_sink_base<ConsoleMutex>::log(const details::log_msg &msg) { #ifdef _WIN32 if (handle_ == INVALID_HANDLE_VALUE) { return; } std::lock_guard<mutex_t> lock(mutex_); memory_buf_t formatted; formatter_->format(msg, formatted); ::fflush(file_); // flush in case there is somthing in this file_ already auto size = static_cast<DWORD>(formatted.size()); DWORD bytes_written = 0; bool ok = ::WriteFile(handle_, formatted.data(), size, &bytes_written, nullptr) != 0; if (!ok) { throw_spdlog_ex("stdout_sink_base: WriteFile() failed. GetLastError(): " + std::to_string(::GetLastError())); } #else std::lock_guard<mutex_t> lock(mutex_); memory_buf_t formatted; formatter_->format(msg, formatted); ::fwrite(formatted.data(), sizeof(char), formatted.size(), file_); ::fflush(file_); // flush every line to terminal #endif // WIN32 } template<typename ConsoleMutex> SPDLOG_INLINE void stdout_sink_base<ConsoleMutex>::flush() { std::lock_guard<mutex_t> lock(mutex_); fflush(file_); } template<typename ConsoleMutex> SPDLOG_INLINE void stdout_sink_base<ConsoleMutex>::set_pattern(const std::string &pattern) { std::lock_guard<mutex_t> lock(mutex_); formatter_ = std::unique_ptr<spdlog::formatter>(new pattern_formatter(pattern)); } template<typename ConsoleMutex> SPDLOG_INLINE void stdout_sink_base<ConsoleMutex>::set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) { std::lock_guard<mutex_t> lock(mutex_); formatter_ = std::move(sink_formatter); } // stdout sink template<typename ConsoleMutex> SPDLOG_INLINE stdout_sink<ConsoleMutex>::stdout_sink() : stdout_sink_base<ConsoleMutex>(stdout) {} // stderr sink template<typename ConsoleMutex> SPDLOG_INLINE stderr_sink<ConsoleMutex>::stderr_sink() : stdout_sink_base<ConsoleMutex>(stderr) {} } // namespace sinks // factory methods template<typename Factory> SPDLOG_INLINE std::shared_ptr<logger> stdout_logger_mt(const std::string &logger_name) { return Factory::template create<sinks::stdout_sink_mt>(logger_name); } template<typename Factory> SPDLOG_INLINE std::shared_ptr<logger> stdout_logger_st(const std::string &logger_name) { return Factory::template create<sinks::stdout_sink_st>(logger_name); } template<typename Factory> SPDLOG_INLINE std::shared_ptr<logger> stderr_logger_mt(const std::string &logger_name) { return Factory::template create<sinks::stderr_sink_mt>(logger_name); } template<typename Factory> SPDLOG_INLINE std::shared_ptr<logger> stderr_logger_st(const std::string &logger_name) { return Factory::template create<sinks::stderr_sink_st>(logger_name); } } // namespace spdlog
#pragma once #include "types.h" #include "player.h" #include "qgameitem.h" class Player; class Block; class Block : public QGameItem { Q_OBJECT protected: int position; BlockType::Type block_type; virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); public: Block(QGameItem * parent); virtual ~Block(); BlockType::Type getType() const; void setPosition(int position); int getPosition(); virtual void enter(Player* player) = 0; signals: void blockClicked(Block * block); };
/* * Copyright 2013 MongoDB, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mongoc-trace.h" #include "pymongoc-client.h" #include "pymongoc-client-pool.h" static void pymongoc_client_pool_tp_dealloc (PyObject *self) { pymongoc_client_pool_t *pool = (pymongoc_client_pool_t *)self; ENTRY; mongoc_client_pool_destroy (pool->client_pool); self->ob_type->tp_free (self); EXIT; } static PyTypeObject pymongoc_client_pool_type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "pymongc.ClientPool", /*tp_name*/ sizeof(pymongoc_client_pool_t), /*tp_basicsize*/ 0, /*tp_itemsize*/ pymongoc_client_pool_tp_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "A MongoDB Client Pool.", /*tp_doc*/ }; static PyObject * pymongoc_client_pool_tp_new (PyTypeObject *self, PyObject *args, PyObject *kwargs) { pymongoc_client_pool_t *pyclient_pool; mongoc_uri_t *uri; const char *uri_str; PyObject *key = NULL; PyObject *pyuri = NULL; PyObject *ret = NULL; if (kwargs) { key = PyString_FromStringAndSize("uri", 3); if (PyDict_Contains(kwargs, key)) { if (!(pyuri = PyDict_GetItem(kwargs, key))) { goto cleanup; } else if (!PyString_Check(pyuri)) { PyErr_SetString(PyExc_TypeError, "uri must be a string."); goto cleanup; } } } uri_str = pyuri ? PyString_AsString(pyuri) : NULL; uri = mongoc_uri_new (uri_str); pyclient_pool = (pymongoc_client_pool_t *) PyType_GenericNew (&pymongoc_client_pool_type, NULL, NULL); if (!pyclient_pool) { goto cleanup; } pyclient_pool->client_pool = mongoc_client_pool_new (uri); if (!pyclient_pool->client_pool) { PyErr_SetString (PyExc_TypeError, "Invalid URI string."); Py_DECREF (pyclient_pool); pyclient_pool = NULL; goto cleanup; } ret = (PyObject *)pyclient_pool; cleanup: if (uri) { mongoc_uri_destroy (uri); } Py_XDECREF (key); Py_XDECREF (pyuri); return ret; } static PyObject * pymongoc_client_pool_pop (PyObject *self, PyObject *args) { pymongoc_client_pool_t *client_pool = (pymongoc_client_pool_t *)self; mongoc_client_t *client; if (!pymongoc_client_pool_check (self)) { PyErr_SetString (PyExc_TypeError, "self must be a pymongoc.ClientPool"); return NULL; } BSON_ASSERT (client_pool->client_pool); client = mongoc_client_pool_pop (client_pool->client_pool); return pymongoc_client_new (client, false); } static PyObject * pymongoc_client_pool_push (PyObject *self, PyObject *args) { pymongoc_client_pool_t *client_pool = (pymongoc_client_pool_t *)self; pymongoc_client_t *pyclient = NULL; if (!PyArg_ParseTuple (args, "O", &pyclient)) { return NULL; } if (!pymongoc_client_check (pyclient)) { PyErr_SetString (PyExc_TypeError, "pymongoc.ClientPool.push only accepts a " "pymongoc.Client."); return NULL; } if (pyclient->client) { mongoc_client_pool_push (client_pool->client_pool, pyclient->client); pyclient->client = NULL; } Py_INCREF (Py_None); return Py_None; } static PyMethodDef pymongoc_client_pool_methods[] = { { "pop", pymongoc_client_pool_pop, METH_VARARGS, "Pop a pymongoc.Client from the client pool, possibly blocking " "until one is available." }, { "push", pymongoc_client_pool_push, METH_VARARGS, "Return a pymongoc.Client to the client pool, possibly allowing " "another thread to steal the client." }, { NULL } }; PyTypeObject * pymongoc_client_pool_get_type (void) { static bool initialized; if (!initialized) { pymongoc_client_pool_type.tp_new = pymongoc_client_pool_tp_new; pymongoc_client_pool_type.tp_methods = pymongoc_client_pool_methods; if (PyType_Ready (&pymongoc_client_pool_type) < 0) { return NULL; } initialized = true; } return &pymongoc_client_pool_type; }
// // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // #include <lua.h> #include <lauxlib.h> #include <stdlib.h> #include <math.h> #include <inttypes.h> #include <string.h> extern const char * LONG_NUM_TYPE; extern int64_t lualongnumber_checklong(lua_State *L, int index); extern int64_t lualongnumber_pushlong(lua_State *L, int64_t *val); //////////////////////////////////////////////////////////////////////////////// static void l_serialize(char *buf, int len, int64_t val) { snprintf(buf, len, "%"PRId64, val); } static int64_t l_deserialize(const char *buf) { int64_t data; int rv; // Support hex prefixed with '0x' if (strstr(buf, "0x") == buf) { rv = sscanf(buf, "%"PRIx64, &data); } else { rv = sscanf(buf, "%"PRId64, &data); } if (rv == 1) { return data; } return 0; // Failed } //////////////////////////////////////////////////////////////////////////////// static int l_new(lua_State *L) { int64_t val; const char *str = NULL; if (lua_type(L, 1) == LUA_TSTRING) { str = lua_tostring(L, 1); val = l_deserialize(str); } else if (lua_type(L, 1) == LUA_TNUMBER) { val = (int64_t)lua_tonumber(L, 1); str = (const char *)1; } lualongnumber_pushlong(L, (str ? &val : NULL)); return 1; } //////////////////////////////////////////////////////////////////////////////// // a + b static int l_add(lua_State *L) { int64_t a, b, c; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); c = a + b; lualongnumber_pushlong(L, &c); return 1; } // a / b static int l_div(lua_State *L) { int64_t a, b, c; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); c = a / b; lualongnumber_pushlong(L, &c); return 1; } // a == b (both a and b are lualongnumber's) static int l_eq(lua_State *L) { int64_t a, b; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); lua_pushboolean(L, (a == b ? 1 : 0)); return 1; } // garbage collection static int l_gc(lua_State *L) { lua_pushnil(L); lua_setmetatable(L, 1); return 0; } // a < b static int l_lt(lua_State *L) { int64_t a, b; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); lua_pushboolean(L, (a < b ? 1 : 0)); return 1; } // a <= b static int l_le(lua_State *L) { int64_t a, b; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); lua_pushboolean(L, (a <= b ? 1 : 0)); return 1; } // a % b static int l_mod(lua_State *L) { int64_t a, b, c; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); c = a % b; lualongnumber_pushlong(L, &c); return 1; } // a * b static int l_mul(lua_State *L) { int64_t a, b, c; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); c = a * b; lualongnumber_pushlong(L, &c); return 1; } // a ^ b static int l_pow(lua_State *L) { long double a, b; int64_t c; a = (long double)lualongnumber_checklong(L, 1); b = (long double)lualongnumber_checklong(L, 2); c = (int64_t)pow(a, b); lualongnumber_pushlong(L, &c); return 1; } // a - b static int l_sub(lua_State *L) { int64_t a, b, c; a = lualongnumber_checklong(L, 1); b = lualongnumber_checklong(L, 2); c = a - b; lualongnumber_pushlong(L, &c); return 1; } // tostring() static int l_tostring(lua_State *L) { int64_t a; char str[256]; l_serialize(str, 256, lualongnumber_checklong(L, 1)); lua_pushstring(L, str); return 1; } // -a static int l_unm(lua_State *L) { int64_t a, c; a = lualongnumber_checklong(L, 1); c = -a; lualongnumber_pushlong(L, &c); return 1; } //////////////////////////////////////////////////////////////////////////////// static const luaL_Reg methods[] = { {"__add", l_add}, {"__div", l_div}, {"__eq", l_eq}, {"__gc", l_gc}, {"__lt", l_lt}, {"__le", l_le}, {"__mod", l_mod}, {"__mul", l_mul}, {"__pow", l_pow}, {"__sub", l_sub}, {"__tostring", l_tostring}, {"__unm", l_unm}, }; static const luaL_Reg funcs[] = { {"new", l_new}, {NULL, NULL} }; //////////////////////////////////////////////////////////////////////////////// static void set_methods(lua_State *L, const char *metatablename, const struct luaL_Reg *methods) { luaL_getmetatable(L, metatablename); // mt // No need for a __index table since everything is __* for (; methods->name; methods++) { lua_pushstring(L, methods->name); // mt, "name" lua_pushcfunction(L, methods->func); // mt, "name", func lua_rawset(L, -3); // mt } lua_pop(L, 1); } LUALIB_API int luaopen_lualongnumber(lua_State *L) { luaL_newmetatable(L, LONG_NUM_TYPE); lua_pop(L, 1); set_methods(L, LONG_NUM_TYPE, methods); luaL_register(L, "lualongnumber", funcs); return 1; }
/* * Copyright (c) 2015 Magnet Systems, Inc. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ #import "MMXMessage.h" @class MMXPubSubMessage; @interface MMXMessage () @property (nonatomic, readwrite) MMXMessageType messageType; @property(nonatomic, readwrite) NSString *messageID; @property(nonatomic, readwrite) NSDate *timestamp; @property(nonatomic, readwrite) MMUser *sender; @property(nonatomic, copy) NSString *senderDeviceID; @property (nonatomic, readwrite) MMXChannel *channel; @property(nonatomic, readwrite) NSSet *recipients; @property(nonatomic, readwrite) NSDictionary *messageContent; + (instancetype)messageFromPubSubMessage:(MMXPubSubMessage *)pubSubMessage sender:(MMUser *)sender; @end
/* Copyright (C) 2013-2015 Computer Sciences Corporation * * 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 EZBAKE_SECURITY_CORE_COMMONUTILS_H_ #define EZBAKE_SECURITY_CORE_COMMONUTILS_H_ #include <chrono> namespace ezbake { namespace security { namespace core { namespace CommonUtils { /** * Returns the current time in milliseconds */ inline int64_t currentTimeMillis() { return static_cast<int64_t>(::std::chrono::system_clock::now().time_since_epoch() / ::std::chrono::milliseconds(1)); } }}}} // namespace ezbake::security::core::CommonUtils #endif /* EZBAKE_SECURITY_CORE_COMMONUTILS_H_ */
// // DiffMatchPatch_iOSTests.h // DiffMatchPatch iOSTests // // Created by Harry Jordan on 12/04/2013. // // #import <SenTestingKit/SenTestingKit.h> @interface DiffMatchPatch_iOSTests : SenTestCase @end
/* * Copyright (c) 2011 Yeecco Limited */ #import <Foundation/Foundation.h> #import <StellaGraphics/StellaGraphics.h> #import "StellaKitExport.h" #import "SVView.h" #import "SVButton.h" #import "SVBarItem.h" #import "SVInterface.h" #import "SVControl.h" #import "SVGeometry.h" typedef enum { UIBarButtonSystemItemDone, UIBarButtonSystemItemCancel, UIBarButtonSystemItemEdit, UIBarButtonSystemItemSave, UIBarButtonSystemItemAdd, UIBarButtonSystemItemFlexibleSpace, UIBarButtonSystemItemFixedSpace, UIBarButtonSystemItemCompose, UIBarButtonSystemItemReply, UIBarButtonSystemItemAction, UIBarButtonSystemItemOrganize, UIBarButtonSystemItemBookmarks, UIBarButtonSystemItemSearch, UIBarButtonSystemItemRefresh, UIBarButtonSystemItemStop, UIBarButtonSystemItemCamera, UIBarButtonSystemItemTrash, UIBarButtonSystemItemPlay, UIBarButtonSystemItemPause, UIBarButtonSystemItemRewind, UIBarButtonSystemItemFastForward, UIBarButtonSystemItemUndo, UIBarButtonSystemItemRedo, } UIBarButtonSystemItem; typedef enum { UIBarButtonItemStylePlain, UIBarButtonItemStyleBordered, UIBarButtonItemStyleDone, } UIBarButtonItemStyle; typedef enum { UIBarMetricsDefault, UIBarMetricsLandscapePhone, } UIBarMetrics; @class UIColor; @class UIView; @class UIImage; @class UIBarButtonItemButton; @class SVFlippedView; @interface UIBarButtonItem : UIBarItem @property(nonatomic, assign) id target; @property(nonatomic) SEL action; @property(nonatomic) UIBarButtonItemStyle style; @property(nonatomic, copy) NSSet * possibleTitles; @property(nonatomic) CGFloat width; @property(nonatomic, retain) UIView * customView; @property(nonatomic, retain) UIColor * tintColor; - (id) initWithBarButtonSystemItem: (UIBarButtonSystemItem) systemItem target: (id) target action: (SEL) action; - (id) initWithCustomView: (UIView *) customView; - (id) initWithImage: (UIImage *) image style: (UIBarButtonItemStyle) style target: (id) target action: (SEL) action; - (id) initWithTitle: (NSString *) title style: (UIBarButtonItemStyle) style target: (id) target action: (SEL) action; - (id) initWithImage: (UIImage *) image landscapeImagePhone: (UIImage *) landscapeImagePhone style: (UIBarButtonItemStyle) style target: (id) target action: (SEL) action; - (UIImage *) backButtonBackgroundImageForState: (UIControlState) state barMetrics: (UIBarMetrics) barMetrics; - (void) setBackButtonBackgroundImage: (UIImage *) backgroundImage forState: (UIControlState) state barMetrics: (UIBarMetrics) barMetrics; - (UIOffset) backButtonTitlePositionAdjustmentForBarMetrics: (UIBarMetrics) barMetrics; - (void) setBackButtonTitlePositionAdjustment: (UIOffset) adjustment forBarMetrics: (UIBarMetrics) barMetrics; - (CGFloat) backButtonBackgroundVerticalPositionAdjustmentForBarMetrics: (UIBarMetrics) barMetrics; - (void) setBackButtonBackgroundVerticalPositionAdjustment: (CGFloat) adjustment forBarMetrics: (UIBarMetrics) barMetrics; - (CGFloat) backgroundVerticalPositionAdjustmentForBarMetrics: (UIBarMetrics) barMetrics; - (void) setBackgroundVerticalPositionAdjustment: (CGFloat) adjustment forBarMetrics: (UIBarMetrics) barMetrics; - (UIImage *) backgroundImageForState: (UIControlState) state barMetrics: (UIBarMetrics) barMetrics; - (void) setBackgroundImage: (UIImage *) backgroundImage forState: (UIControlState) state barMetrics: (UIBarMetrics) barMetrics; - (UIImage *) backgroundImageForState: (UIControlState) state style: (UIBarButtonItemStyle) style barMetrics: (UIBarMetrics) barMetrics; - (void) setBackgroundImage: (UIImage *) backgroundImage forState: (UIControlState) state style: (UIBarButtonItemStyle) style barMetrics: (UIBarMetrics) barMetrics; - (UIOffset) titlePositionAdjustmentForBarMetrics: (UIBarMetrics) barMetrics; - (void) setTitlePositionAdjustment: (UIOffset) adjustment forBarMetrics: (UIBarMetrics) barMetrics; @end
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** Conform to `IGListTransitionDelegate` to provide customized layout information for a collection view. */ @protocol IGListTransitionDelegate <NSObject> /** Asks the delegate to customize and return the starting layout information for an item being inserted into the collection view. @param listAdapter The adapter controlling the list. @param attributes The starting layout information for an item being inserted into the collection view. @param sectionController The section controller to perform the transition on. @param index The index of the item being inserted. */ - (UICollectionViewLayoutAttributes *)listAdapter:(IGListAdapter *)listAdapter customizedInitialLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes sectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index; /** Asks the delegate to customize and return the final layout information for an item that is about to be removed from the collection view. @param listAdapter The adapter controlling the list. @param attributes The final layout information for an item that is about to be removed from the collection view. @param sectionController The section controller to perform the transition on. @param index The index of the item being deleted. */ - (UICollectionViewLayoutAttributes *)listAdapter:(IGListAdapter *)listAdapter customizedFinalLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes sectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index; @end
/*! @file int16_to_float.h * @brief int16 to float converter. * @author Markovtsev Vadim <v.markovtsev@samsung.com> * @version 1.0 * * @section Notes * This code partially conforms to <a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">Google C++ Style Guide</a>. * * @section Copyright * Copyright © 2013 Samsung R&D Institute Russia * * @section License * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 SRC_FORMATS_INT16_TO_FLOAT_H_ #define SRC_FORMATS_INT16_TO_FLOAT_H_ #include "src/formats/array_format.h" #include "src/formats/array_format_converter_base.h" namespace sound_feature_extraction { namespace formats { class Int16ToFloatRaw : public ArrayFormatConverterBase<ArrayFormat16, ArrayFormatF> { protected: virtual void Do(const int16_t* in, float* out) const noexcept override; }; } // namespace formats } // namespace sound_feature_extraction #endif // SRC_FORMATS_INT16_TO_FLOAT_H_
/* * Copyright (C) 2009-2012 Texas Instruments, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _SOSAL_IMAGE_H_ #define _SOSAL_IMAGE_H_ /*! \file * \brief The SOSAL Image API. * \author Erik Rainey <erik.rainey@ti.com> */ #include <sosal/types.h> #include <sosal/fourcc.h> /*! \brief The \ref image_t plane definition. * \ingroup group_image_t */ typedef struct _plane_t { uint8_t *ptr; /**< Plane Data Pointer */ uint32_t xdim; /**< Plane x dimension in pixels */ uint32_t ydim; /**< Plane y dimension in pixels */ uint32_t xscale; /**< Plane x scale */ uint32_t yscale; /**< Plane y scale */ int32_t xstride; /**< Plane x stride between pixels in bytes */ int32_t ystride; /**< Plane y stride between pixels in bytes */ int32_t xstep; /**< Plane x step between pixels, if macro pixel, then > 1 */ uint32_t numBytes;/**< Number of bytes in the plane */ } plane_t; /*! \brief The definition of a multiplanar, multidimensional image. * \ingroup group_image_t */ typedef struct _image_t { fourcc_t color; /*!< \brief Color space. \see fourcc_t */ plane_t plane[4]; /*!< \brief Plane information */ uint32_t numPlanes; /*!< \brief This indicates the active number of planes */ } image_t; #ifdef __cplusplus extern "C" { #endif /*! \brief This computes the pixel pointer at the given co-ordinates. * \param [in] img The image pointer * \param [in] p The plane index * \param [in] x The x dimension * \param [in] y The y dimension * \pre \ref image_allocate * \pre \ref image_back * \ingroup group_image_t */ #define image_pixel(img, p, x, y) &img->plane[p].ptr[(img->plane[p].ystride*(y/img->plane[p].yscale))+(img->plane[p].xstride*(x/img->plane[p].xscale))] /*! \brief This function is used to determine if an image_t can be made of a particular format. * \param [in] color The desired format. * \ingroup group_image_t */ bool_e image_query_format(fourcc_t color); /*! \brief Frees an image and destroys the pointer. * \param [in,out] pimg The pointer to the image_t pointer. This will be NULLed by the function. * \pre \ref image_unback * \ingroup group_image_t */ void image_free(image_t **pimg); /*! \brief Allocates an image meta-data structure with the given attributes. * \param [in] width Width in pixels. * \param [in] height Height in pixels. * \param [in] color The FOURCC color code. * \pre \ref image_query_format To determine if the format is possible. * \post \ref image_back * \ingroup group_image_t * \retval NULL The allocation failed. */ image_t *image_allocate(uint32_t width, uint32_t height, fourcc_t color); /*! \brief This function will fill the image with the data in a, b, or c based * on the format of the image. * \param [in] img The pointer to the image. * \param [in] a Most formats will use this field. FOURCC_Y800 will only use this field. * \param [in] b Most formats will use this field. * \param [in] c Most formats will use this field. * \pre \ref image_back * \ingroup group_image_t */ void image_fill(image_t *img, uint8_t a, uint8_t b, uint8_t c); /*! \brief This functions copies an image from source to destintation. * \note If a conversion is required, some conversion will occur. See \iref image_convert for details. * \param [out] dst Destination image. Must be pre-allocated. * \param [in] src Source image. * \pre \ref image_back * \ingroup group_image_t */ uint32_t image_copy(image_t *dst, image_t *src); /*! \brief This function will convert one image format into another if it supports this. * \param [out] dst The Destination image, must be pre-allocated. * \param [in] src The source image. * \pre \ref image_back * \ingroup group_image_t */ void image_convert(image_t *dst, image_t *src); /*! \brief This function prints the meta-data of the image. * \param [in] img The image to print. * \pre \ref image_back * \ingroup group_image_t */ void image_print(image_t *img); /*! \brief This function "backs" an an image meta-data structure with actual memory. * \param [in] img The image to "back". * \pre \ref image_allocate * \post \ref image_unback * \ingroup group_image_t */ bool_e image_back(image_t *img); /*! \brief This function removes the memory "backing" the image meta-data structure. * \param [in] img The image to "unback". * \pre \ref image_back * \post \ref image_free * \ingroup group_image_t */ void image_unback(image_t *img); #ifdef __cplusplus } #endif #endif
// Generated by generate_test_data.py using TFL version 2.6.0 as reference. #pragma once #include <stdint.h> const q7_t depthwise_2_weights[108] = { 31, -60, 10, 19, -70, 125, 35, 93, 22, -42, -54, -73, -24, -19, -99, 98, 58, -96, -18, 52, 10, -127, -44, 103, -46, -63, 51, 127, 93, 81, -15, -31, -81, 65, -127, 75, 25, -103, 5, -108, 26, 54, -127, 77, -104, 58, -127, -40, 112, 103, 116, -89, 25, 104, 117, 60, 45, -77, 107, 32, -52, 32, -127, 115, 121, 16, -12, 37, -26, 6, -55, -36, 105, -15, -127, 3, -127, -83, -118, -7, 97, -16, 36, -76, -87, -41, -127, -114, -71, -77, -76, -29, -22, 58, -23, -70, -1, 10, 93, 39, -26, 113, 50, 85, 67, -43, -14, -109};
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. // // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, // copy, modify, and distribute this software in source code or binary form for use // in connection with the web services and APIs provided by Facebook. // // As with any software that integrates with the Facebook platform, your use of // this software is subject to the Facebook Developer Principles and Policies // [http://developers.facebook.com/policy/]. This copyright 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 "TargetConditionals.h" #if !TARGET_OS_TV #import "FBSDKApplicationObserving.h" #import "FBSDKBridgeAPI.h" NS_ASSUME_NONNULL_BEGIN @interface FBSDKBridgeAPI () <FBSDKApplicationObserving> @end NS_ASSUME_NONNULL_END #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. #ifndef CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_ #define CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_ #include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/strings/string_piece.h" #include "chrome/browser/google_apis/test_server/http_request.h" namespace net { class StreamListenSocket; } namespace google_apis { namespace test_server { class HttpConnection; class HttpResponse; // Calblack called when a request is parsed. Response should be sent // using HttpConnection::SendResponse() on the |connection| argument. typedef base::Callback<void(HttpConnection* connection, scoped_ptr<HttpRequest> request)> HandleRequestCallback; // Wraps the connection socket. Accepts incoming data and sends responses. // If a valid request is parsed, then |callback_| is invoked. class HttpConnection { public: HttpConnection(net::StreamListenSocket* socket, const HandleRequestCallback& callback); ~HttpConnection(); // Sends the HTTP response to the client. void SendResponse(scoped_ptr<HttpResponse> response) const; private: friend class HttpServer; // Accepts raw chunk of data from the client. Internally, passes it to the // HttpRequestParser class. If a request is parsed, then |callback_| is // called. void ReceiveData(const base::StringPiece& data); scoped_refptr<net::StreamListenSocket> socket_; const HandleRequestCallback callback_; HttpRequestParser request_parser_; DISALLOW_COPY_AND_ASSIGN(HttpConnection); }; } // namespace test_server } // namespace google_apis #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_CONNECTION_H_
/***************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * * This is an example application source code using the multi interface * to do a multipart formpost without "blocking". */ #include <stdio.h> #include <string.h> #include <sys/time.h> #include <curl/curl.h> int main(int argc, char *argv[]) { CURL *curl; CURLM *multi_handle; int still_running; struct curl_httppost *formpost=NULL; struct curl_httppost *lastptr=NULL; struct curl_slist *headerlist=NULL; static const char buf[] = "Expect:"; /* Fill in the file upload field. This makes libcurl load data from the given file name when curl_easy_perform() is called. */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "sendfile", CURLFORM_FILE, "postit2.c", CURLFORM_END); /* Fill in the filename field */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "filename", CURLFORM_COPYCONTENTS, "postit2.c", CURLFORM_END); /* Fill in the submit field too, even if this is rarely needed */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "send", CURLFORM_END); curl = curl_easy_init(); multi_handle = curl_multi_init(); /* initalize custom header list (stating that Expect: 100-continue is not wanted */ headerlist = curl_slist_append(headerlist, buf); if(curl && multi_handle) { /* what URL that receives this POST */ curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); curl_multi_add_handle(multi_handle, curl); curl_multi_perform(multi_handle, &still_running); while(still_running) { struct timeval timeout; int rc; /* select() return code */ fd_set fdread; fd_set fdwrite; fd_set fdexcep; int maxfd = -1; long curl_timeo = -1; FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); /* set a suitable timeout to play around with */ timeout.tv_sec = 1; timeout.tv_usec = 0; curl_multi_timeout(multi_handle, &curl_timeo); if(curl_timeo >= 0) { timeout.tv_sec = curl_timeo / 1000; if(timeout.tv_sec > 1) timeout.tv_sec = 1; else timeout.tv_usec = (curl_timeo % 1000) * 1000; } /* get file descriptors from the transfers */ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); /* In a real-world program you OF COURSE check the return code of the function calls. On success, the value of maxfd is guaranteed to be greater or equal than -1. We call select(maxfd + 1, ...), specially in case of (maxfd == -1), we call select(0, ...), which is basically equal to sleep. */ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { case -1: /* select error */ break; case 0: printf("timeout!\n"); default: /* timeout or readable/writable sockets */ printf("perform!\n"); curl_multi_perform(multi_handle, &still_running); printf("running: %d!\n", still_running); break; } } curl_multi_cleanup(multi_handle); /* always cleanup */ curl_easy_cleanup(curl); /* then cleanup the formpost chain */ curl_formfree(formpost); /* free slist */ curl_slist_free_all (headerlist); } return 0; }
/********************************** (C) COPYRIGHT ******************************* * File Name : ch32f20x_crc.c * Author : WCH * Version : V1.0.0 * Date : 2021/08/08 * Description : This file provides all the CRC firmware functions. *******************************************************************************/ #include "ch32f20x_crc.h" /******************************************************************************* * Function Name : CRC_ResetDR * Description : Resets the CRC Data register (DR). * Input : None * Return : None *******************************************************************************/ void CRC_ResetDR(void) { CRC->CTLR = CRC_CTLR_RESET; } /******************************************************************************* * Function Name : CRC_CalcCRC * Description : Computes the 32-bit CRC of a given data word(32-bit). * Input : Data: data word(32-bit) to compute its CRC. * Return : 32-bit CRC. *******************************************************************************/ uint32_t CRC_CalcCRC(uint32_t Data) { CRC->DATAR = Data; return (CRC->DATAR); } /******************************************************************************* * Function Name : CRC_CalcBlockCRC * Description : Computes the 32-bit CRC of a given buffer of data word(32-bit). * Input : pBuffer: pointer to the buffer containing the data to be computed. * BufferLength: length of the buffer to be computed. * Return : 32-bit CRC. *******************************************************************************/ uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) { uint32_t index = 0; for(index = 0; index < BufferLength; index++) { CRC->DATAR = pBuffer[index]; } return (CRC->DATAR); } /******************************************************************************* * Function Name : CRC_GetCRC * Description : Returns the current CRC value. * Input : None * Return : 32-bit CRC. *******************************************************************************/ uint32_t CRC_GetCRC(void) { return (CRC->IDATAR); } /******************************************************************************* * Function Name : CRC_SetIDRegister * Description : Stores a 8-bit data in the Independent Data(ID) register. * Input : IDValue: 8-bit value to be stored in the ID register. * Return : None *******************************************************************************/ void CRC_SetIDRegister(uint8_t IDValue) { CRC->IDATAR = IDValue; } /******************************************************************************* * Function Name : CRC_GetIDRegister * Description : Returns the 8-bit data stored in the Independent Data(ID) register. * Input : None * Return : 8-bit value of the ID register. *******************************************************************************/ uint8_t CRC_GetIDRegister(void) { return (CRC->IDATAR); }
/* Copyright 2007-2015 QReal Research Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <kitBase/robotModel/robotParts/button.h> #include <utils/robotCommunication/robotCommunicator.h> namespace ev3 { namespace robotModel { namespace real { namespace parts { class Button : public kitBase::robotModel::robotParts::Button { Q_OBJECT public: Button(const kitBase::robotModel::DeviceInfo &info , const kitBase::robotModel::PortInfo &port , utils::robotCommunication::RobotCommunicator &robotCommunicator); void read() override; private: char parsePort(const QString &portName); utils::robotCommunication::RobotCommunicator &mRobotCommunicator; }; } } } }
#include <sys/cdefs.h> #include <lib.h> #include "namespace.h" #include <string.h> #include <sys/time.h> #include <sys/select.h> int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) { message m; memset(&m, 0, sizeof(m)); m.m_lc_vfs_select.nfds = nfds; m.m_lc_vfs_select.readfds = readfds; m.m_lc_vfs_select.writefds = writefds; m.m_lc_vfs_select.errorfds = errorfds; m.m_lc_vfs_select.timeout = (vir_bytes)timeout; return (_syscall(VFS_PROC_NR, VFS_SELECT, &m)); } #if defined(__minix) && defined(__weak_alias) __weak_alias(select, __select50) #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/chime-sdk-messaging/ChimeSDKMessaging_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/chime-sdk-messaging/model/ChannelSummary.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace ChimeSDKMessaging { namespace Model { class AWS_CHIMESDKMESSAGING_API ListChannelsResult { public: ListChannelsResult(); ListChannelsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ListChannelsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The information about each channel.</p> */ inline const Aws::Vector<ChannelSummary>& GetChannels() const{ return m_channels; } /** * <p>The information about each channel.</p> */ inline void SetChannels(const Aws::Vector<ChannelSummary>& value) { m_channels = value; } /** * <p>The information about each channel.</p> */ inline void SetChannels(Aws::Vector<ChannelSummary>&& value) { m_channels = std::move(value); } /** * <p>The information about each channel.</p> */ inline ListChannelsResult& WithChannels(const Aws::Vector<ChannelSummary>& value) { SetChannels(value); return *this;} /** * <p>The information about each channel.</p> */ inline ListChannelsResult& WithChannels(Aws::Vector<ChannelSummary>&& value) { SetChannels(std::move(value)); return *this;} /** * <p>The information about each channel.</p> */ inline ListChannelsResult& AddChannels(const ChannelSummary& value) { m_channels.push_back(value); return *this; } /** * <p>The information about each channel.</p> */ inline ListChannelsResult& AddChannels(ChannelSummary&& value) { m_channels.push_back(std::move(value)); return *this; } /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline const Aws::String& GetNextToken() const{ return m_nextToken; } /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline void SetNextToken(const char* value) { m_nextToken.assign(value); } /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline ListChannelsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline ListChannelsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} /** * <p>The token returned from previous API requests until the number of channels is * reached.</p> */ inline ListChannelsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} private: Aws::Vector<ChannelSummary> m_channels; Aws::String m_nextToken; }; } // namespace Model } // namespace ChimeSDKMessaging } // namespace Aws
/******************************************************************************* * * Copyright 2013 Bess Siegal * * 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. * ******************************************************************************/ #import <Foundation/Foundation.h> #import "cocos2d.h" @interface Progress : NSObject @property (readonly) CCProgressTimer* timeBar; /** * The sprite of the background bar */ @property (readonly) CCSprite* spriteBg; /** * The action of the progress bar running */ @property (readonly) CCFiniteTimeAction* progressAction; /** * Start the progress bar * @param duration of progress * @param target where callback is located * @param callback selector of callback */ -(void) startWithDuration:(int)duration target:(id)target callback:(SEL)callback; /** * Reset the progress bar */ -(void) resetBar; @end
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include "os_test_priv.h" /* Test case to test case for speak and listen */ TEST_CASE_SELF(callout_test_speak) { /* Initialize the sending task */ os_task_init(&callout_task_struct_speak, "callout_task_speak", callout_task_stop_speak, NULL, SPEAK_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER, callout_task_stack_speak, CALLOUT_STACK_SIZE); /* Initialize the receive task */ os_task_init(&callout_task_struct_listen, "callout_task_listen", callout_task_stop_listen, NULL, LISTEN_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER, callout_task_stack_listen, CALLOUT_STACK_SIZE); os_eventq_init(&callout_evq); /* Initialize the callout function */ os_callout_init(&callout_speak, &callout_evq, my_callout_speak_func, NULL); }
#include <stdint.h> #include <stddef.h> #include <assert.h> #include <nnpack.h> #include <nnpack/macros.h> #include <nnpack/utils.h> #include <nnpack/hwinfo.h> #include <nnpack/activations.h> #include <nnpack/validation.h> struct NNP_CACHE_ALIGN relu_context { nnp_relu_function relu_function; const float* input; float* output; float negative_slope; }; static void compute_relu_output( const struct relu_context context[restrict static 1], size_t block_start, size_t block_size) { nnp_relu_function relu = context->relu_function; const float* input = context->input; float* output = context->output; float negative_slope = context->negative_slope; relu(input + block_start, output + block_start, block_size, negative_slope); } struct NNP_CACHE_ALIGN inplace_relu_context { nnp_inplace_relu_function relu_function; float* data; float negative_slope; }; static void compute_inplace_relu_output( const struct inplace_relu_context context[restrict static 1], size_t block_start, size_t block_size) { nnp_inplace_relu_function relu = context->relu_function; float* data = context->data; float negative_slope = context->negative_slope; relu(data + block_start, block_size, negative_slope); } enum nnp_status nnp_relu_output( size_t batch_size, size_t channels, const float input[], float output[], float negative_slope, pthreadpool_t threadpool) { enum nnp_status status = validate_relu_arguments(batch_size, channels); if (status != nnp_status_success) { return status; } size_t elements = batch_size * channels; const size_t simd_width = nnp_hwinfo.simd_width; assert(((uintptr_t) input) % sizeof(float) == 0); assert(((uintptr_t) output) % sizeof(float) == 0); const size_t prologue_elements = min((size_t) (-(((uintptr_t) output) / sizeof(float)) % simd_width), elements); for (size_t i = 0; i < prologue_elements; i++) { output[i] = relu(input[i], negative_slope); } elements -= prologue_elements; input += prologue_elements; output += prologue_elements; const size_t epilogue_elements = elements % simd_width; for (size_t i = 0; i < epilogue_elements; i++) { output[elements - epilogue_elements + i] = relu(input[elements - epilogue_elements + i], negative_slope); } elements -= epilogue_elements; if (input != output) { /* Out-of-place transformation */ struct relu_context relu_context = { .relu_function = nnp_hwinfo.activations.relu, .input = input, .output = output, .negative_slope = negative_slope, }; pthreadpool_compute_1d_tiled(threadpool, (pthreadpool_function_1d_tiled_t) compute_relu_output, &relu_context, elements, round_down(nnp_hwinfo.blocking.l1 / sizeof(float), simd_width)); } else { /* In-place transformation */ struct inplace_relu_context inplace_relu_context = { .relu_function = nnp_hwinfo.activations.inplace_relu, .data = output, .negative_slope = negative_slope, }; pthreadpool_compute_1d_tiled(threadpool, (pthreadpool_function_1d_tiled_t) compute_inplace_relu_output, &inplace_relu_context, elements, round_down(nnp_hwinfo.blocking.l1 / sizeof(float), simd_width)); } return nnp_status_success; }
#ifndef _FALCLIB_H #define _FALCLIB_H #include "F4Vu.h" #pragma pack(1) typedef struct { ushort size; ushort type; } EventIdData; #pragma pack () extern FILE* F4EventFile; // ================================== // Falcon 4 Event stuff // ================================== class FalconEvent : public VuMessage{ public: enum HandlingThread { NoThread = 0x0, // This would be rather pointless SimThread = 0x1, CampaignThread = 0x2, UIThread = 0x4, VuThread = 0x8, // Realtime thread! carefull with what you send here AllThreads = 0xff }; HandlingThread handlingThread; virtual int Size() const; virtual int Decode(VU_BYTE **buf, long *rem); virtual int Encode(VU_BYTE **buf); protected: FalconEvent( VU_MSG_TYPE type, HandlingThread threadID, VU_ID entityId, VuTargetEntity *target, VU_BOOL loopback=TRUE ); FalconEvent( VU_MSG_TYPE type, HandlingThread threadID, VU_ID senderid, VU_ID target ); virtual ~FalconEvent (void); virtual int Activate(VuEntity *ent); virtual int Process(uchar autodisp) = 0; private: virtual int LocalSize() const; }; // ================================== // Falcon 4 Message filter // ================================== // sfr: why must all threads process Deletes?? #define MF_DONT_PROCESS_DELETE 1 class FalconMessageFilter : public VuMessageFilter { public: #if VU_USE_ENUM_FOR_TYPES /** which thread should get these messages and shall it process vu messages? */ FalconMessageFilter(FalconEvent::HandlingThread theThread, bool processVu = false); #else FalconMessageFilter(FalconEvent::HandlingThread theThread, ulong vuMessageBits); #endif virtual ~FalconMessageFilter(); virtual VU_BOOL Test(VuMessage *event) const; virtual VuMessageFilter *Copy() const; private: FalconEvent::HandlingThread filterThread; #if VU_USE_ENUM_FOR_TYPES bool processVu; #else ulong vuFilterBits; #endif }; // ================================== // Functions // ================================== void FalconSendMessage (VuMessage* theEvent, BOOL reliableTransmit = FALSE); #endif
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #define BUFFER_SIZE 4096 char buffer[BUFFER_SIZE]; #define CPUINFO_PATH "/proc/cpuinfo" int main(int argc, char** argv) { int file = open(CPUINFO_PATH, O_RDONLY); if (file == -1) { fprintf(stderr, "Error: failed to open %s: %s\n", CPUINFO_PATH, strerror(errno)); exit(EXIT_FAILURE); } /* Only used for error reporting */ size_t position = 0; char* data_start = buffer; ssize_t bytes_read; do { bytes_read = read(file, buffer, BUFFER_SIZE); if (bytes_read < 0) { fprintf(stderr, "Error: failed to read file %s at position %zu: %s\n", CPUINFO_PATH, position, strerror(errno)); exit(EXIT_FAILURE); } position += (size_t) bytes_read; if (bytes_read > 0) { fwrite(buffer, 1, (size_t) bytes_read, stdout); } } while (bytes_read != 0); if (close(file) != 0) { fprintf(stderr, "Error: failed to close %s: %s\n", CPUINFO_PATH, strerror(errno)); exit(EXIT_FAILURE); } return EXIT_SUCCESS; }
int main() { 2 + 3 * 5; return 0; }
/* * Copyright (c) 1983, 1993 * The Regents of the University of California. 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. * 4. Neither the name of the 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 REGENTS 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 REGENTS 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 <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/usr.bin/talk/get_addrs.c 216413 2010-12-11 08:32:16Z joel $"); #ifndef lint static const char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93"; #endif #include <err.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include "talk.h" #include "talk_ctl.h" void get_addrs(const char *my_machine_name __unused, const char *his_machine_name) { struct hostent *hp; struct servent *sp; msg.pid = htonl(getpid()); hp = gethostbyname(his_machine_name); if (hp == NULL) errx(1, "%s: %s", his_machine_name, hstrerror(h_errno)); bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length); if (get_iface(&his_machine_addr, &my_machine_addr) == -1) err(1, "failed to find my interface address"); /* find the server's port */ sp = getservbyname("ntalk", "udp"); if (sp == 0) errx(1, "ntalk/udp: service is not registered"); daemon_port = sp->s_port; }
/*- * Copyright (C) 1999 WIDE Project. * 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 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 PROJECT 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 PROJECT 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. * * $KAME: ip_ecn.h,v 1.5 2000/03/27 04:58:38 sumikawa Exp $ * $FreeBSD: soc2013/dpl/head/sys/netinet6/ip6_ecn.h 174553 2007-12-10 16:03:40Z obrien $ */ /* * ECN consideration on tunnel ingress/egress operation. * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt */ #ifdef _KERNEL extern void ip6_ecn_ingress(int, u_int32_t *, const u_int32_t *); extern int ip6_ecn_egress(int, const u_int32_t *, u_int32_t *); #endif
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // 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 "CIMFixtureBase.h" class UNIX_PrintSupplyFixture : public CIMFixtureBase { public: UNIX_PrintSupplyFixture(); ~UNIX_PrintSupplyFixture(); virtual void Run(); };
// OCHamcrest by Jon Reid, https://qualitycoding.org // Copyright 2021 hamcrest. See LICENSE.txt #import <OCHamcrest/HCBaseMatcher.h> NS_ASSUME_NONNULL_BEGIN /*! * @abstract Base class for matchers that generate mismatch descriptions during the matching. * @discussion Some matching algorithms have several "no match" paths. It helps to make the mismatch * description as precise as possible, but we don't want to have to repeat the matching logic to do * so. For such matchers, subclass HCDiagnosingMatcher and implement HCMatcher's * <code>-matches:describingMismatchTo:</code>. */ @interface HCDiagnosingMatcher : HCBaseMatcher @end NS_ASSUME_NONNULL_END
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE400_Resource_Exhaustion__fgets_fwrite_84.h Label Definition File: CWE400_Resource_Exhaustion.label.xml Template File: sources-sinks-84.tmpl.h */ /* * @description * CWE: 400 Resource Exhaustion * BadSource: fgets Read data from the console using fgets() * GoodSource: Assign count to be a relatively small number * Sinks: fwrite * GoodSink: Write to a file count number of times, but first validate count * BadSink : Write to a file count number of times * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use * * */ #include "std_testcase.h" namespace CWE400_Resource_Exhaustion__fgets_fwrite_84 { #ifndef OMITBAD class CWE400_Resource_Exhaustion__fgets_fwrite_84_bad { public: CWE400_Resource_Exhaustion__fgets_fwrite_84_bad(int countCopy); ~CWE400_Resource_Exhaustion__fgets_fwrite_84_bad(); private: int count; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE400_Resource_Exhaustion__fgets_fwrite_84_goodG2B { public: CWE400_Resource_Exhaustion__fgets_fwrite_84_goodG2B(int countCopy); ~CWE400_Resource_Exhaustion__fgets_fwrite_84_goodG2B(); private: int count; }; class CWE400_Resource_Exhaustion__fgets_fwrite_84_goodB2G { public: CWE400_Resource_Exhaustion__fgets_fwrite_84_goodB2G(int countCopy); ~CWE400_Resource_Exhaustion__fgets_fwrite_84_goodB2G(); private: int count; }; #endif /* OMITGOOD */ }
// Copyright 2010-2021, 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_BASE_CRASH_REPORT_HANDLER_H_ #define MOZC_BASE_CRASH_REPORT_HANDLER_H_ #ifdef OS_WIN #include <windows.h> #endif // OS_WIN #include <string> namespace mozc { class CrashReportHandler { public: // For official branding build, installs breakpad regardless of the // usagestats settings. You must call this method when and only when the // usagestats is enabled. // For non-official branding build, does nothing. // This method increments the reference count for per-process ExceptionHandler // and initialize it if it does not exist. // Returns true if a new ExceptionHandler is created. // |check_address| is supported only on Windows and ignored on other // platforms. // If |check_address| is true the address where exception occurrs is checked // and the crash report is not sent if the address is out of the module. // This function is thread-safe only if the critical section is set by // SetCriticalSection on Windows and NOT thread-safe on Mac. // |check_address| is just ignored on Mac. static bool Initialize(bool check_address); // Returns true if ExceptionHandler is installed and available. static bool IsInitialized(); // Decrements the reference count for per-process ExceptionHandler and delete // it if the reference count reaches zero. // Returns true if ExceptionHandler is deleted. // This function is thread-safe only if the critical section is set by // SetCriticalSection on Windows and NOT thread-safe on Mac. static bool Uninitialize(); #ifdef OS_WIN // Set the CRITICAL_SECTION struct used when initializing or uninitializing // ExceptionHandler. static void SetCriticalSection(CRITICAL_SECTION *critical_section); #endif // OS_WIN private: // Disallow all constructors, destructors, and operator=. CrashReportHandler(); ~CrashReportHandler(); }; } // namespace mozc #endif // MOZC_BASE_CRASH_REPORT_HANDLER_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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_ #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_ #include <set> #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" #include "net/base/host_port_pair.h" #include "net/base/network_change_notifier.h" namespace net { class URLRequest; } namespace data_reduction_proxy { class DataReductionProxyEventStore; class DataReductionProxyParams; // Class responsible for determining when a response should or should not cause // the data reduction proxy to be bypassed, and to what degree. Owned by the // DataReductionProxyInterceptor. class DataReductionProxyBypassProtocol : public net::NetworkChangeNotifier::IPAddressObserver { public: // Constructs a DataReductionProxyBypassProtocol object. |params| and // |event_store| must be non-NULL and outlive |this|. DataReductionProxyBypassProtocol(DataReductionProxyParams* params, DataReductionProxyEventStore* event_store); ~DataReductionProxyBypassProtocol() override; // Decides whether to mark the data reduction proxy as temporarily bad and // put it on the proxy retry map, which is maintained by the ProxyService of // the URLRequestContext. Returns true if the request should be retried. // Updates the load flags in |request| for some bypass types, e.g., // "block-once". Returns the DataReductionProxyBypassType (if not NULL). bool MaybeBypassProxyAndPrepareToRetry( net::URLRequest* request, DataReductionProxyBypassType* proxy_bypass_type); // Returns true if the request method is idempotent. Only idempotent requests // are retried on a bypass. Visible as part of the public API for testing. static bool IsRequestIdempotent(const net::URLRequest* request); private: // Override from NetworkChangeNotifier::IPAddressObserver: void OnIPAddressChanged() override; // Must outlive |this|. DataReductionProxyParams* params_; // Must outlive |this|. DataReductionProxyEventStore* event_store_; // The set of data reduction proxies through which a response has come back // with the data reduction proxy via header since the last network change. // This is only used if the client is part of the field trial to relax the // bypass logic around missing via headers in non-4xx responses. std::set<net::HostPortPair> via_header_producing_proxies_; DISALLOW_COPY_AND_ASSIGN(DataReductionProxyBypassProtocol); }; } // namespace data_reduction_proxy #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_
/* Copyright 2020 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* ite_evb baseboard configuration */ #include "clock.h" #include "common.h" #include "console.h" #include "fan.h" #include "gpio.h" #include "hooks.h" #include "i2c.h" #include "intc.h" #include "keyboard_scan.h" #include "lid_switch.h" #include "lpc.h" #include "power_button.h" #include "pwm_chip.h" #include "registers.h" #include "spi.h" #include "switch.h" #include "system.h" #include "task.h" #include "timer.h" #include "uart.h" #include "util.h" #include "gpio_list.h" #if defined(CONFIG_FANS) || defined(CONFIG_PWM) const struct fan_conf fan_conf_0 = { .flags = FAN_USE_RPM_MODE, .ch = 0, /* Use MFT id to control fan */ .pgood_gpio = -1, .enable_gpio = -1, }; const struct fan_rpm fan_rpm_0 = { .rpm_min = 1500, .rpm_start = 1500, .rpm_max = 6500, }; const struct fan_t fans[] = { { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); /* * PWM HW channelx binding tachometer channelx for fan control. * Four tachometer input pins but two tachometer modules only, * so always binding [TACH_CH_TACH0A | TACH_CH_TACH0B] and/or * [TACH_CH_TACH1A | TACH_CH_TACH1B] */ const struct fan_tach_t fan_tach[] = { [PWM_HW_CH_DCR0] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR1] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR2] = { .ch_tach = TACH_CH_TACH1A, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR3] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR4] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR5] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR6] = { .ch_tach = TACH_CH_NULL, .fan_p = -1, .rpm_re = -1, .s_duty = -1, }, [PWM_HW_CH_DCR7] = { .ch_tach = TACH_CH_TACH0A, .fan_p = 2, .rpm_re = 50, .s_duty = 30, }, }; BUILD_ASSERT(ARRAY_SIZE(fan_tach) == PWM_HW_CH_TOTAL); #endif /* defined(CONFIG_FANS) || defined(CONFIG_PWM) */ /* Keyboard scan setting */ __override struct keyboard_scan_config keyscan_config = { .output_settle_us = 35, .debounce_down_us = 5 * MSEC, .debounce_up_us = 40 * MSEC, .scan_period_us = 3 * MSEC, .min_post_scan_delay_us = 1000, .poll_timeout_us = 100 * MSEC, .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */ }, }; #if defined(CONFIG_SPI_FLASH_PORT) /* SPI devices */ const struct spi_device_t spi_devices[] = { [CONFIG_SPI_FLASH_PORT] = { .port = CONFIG_SPI_FLASH_PORT, .div = 0, .gpio_cs = -1 }, }; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); #endif /* Initialize board. */ static void board_init(void) { } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /* Wake-up pins for hibernate */ const enum gpio_signal hibernate_wake_pins[] = { GPIO_POWER_BUTTON_L, GPIO_LID_OPEN }; const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /* * I2C channels (A, B, and C) are using the same timing registers (00h~07h) * at default. * In order to set frequency independently for each channels, * We use timing registers 09h~0Bh, and the supported frequency will be: * 50KHz, 100KHz, 400KHz, or 1MHz. * I2C channels (D, E and F) can be set different frequency on different ports. * The I2C(D/E/F) frequency depend on the frequency of SMBus Module and * the individual prescale register. * The frequency of SMBus module is 24MHz on default. * The allowed range of I2C(D/E/F) frequency is as following setting. * SMBus Module Freq = PLL_CLOCK / ((IT83XX_ECPM_SCDCR2 & 0x0F) + 1) * (SMBus Module Freq / 510) <= I2C Freq <= (SMBus Module Freq / 8) * Channel D has multi-function and can be used as UART interface. * Channel F is reserved for EC debug. */ /* I2C ports */ const struct i2c_port_t i2c_ports[] = { { .name = "battery", .port = I2C_PORT_BATTERY, .kbps = 100, .scl = GPIO_I2C_C_SCL, .sda = GPIO_I2C_C_SDA, }, { .name = "evb-1", .port = IT83XX_I2C_CH_A, .kbps = 100, .scl = GPIO_I2C_A_SCL, .sda = GPIO_I2C_A_SDA, }, { .name = "evb-2", .port = IT83XX_I2C_CH_B, .kbps = 100, .scl = GPIO_I2C_B_SCL, .sda = GPIO_I2C_B_SDA, }, { .name = "opt-4", .port = IT83XX_I2C_CH_E, .kbps = 100, .scl = GPIO_I2C_E_SCL, .sda = GPIO_I2C_E_SDA, }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE843_Type_Confusion__short_51b.c Label Definition File: CWE843_Type_Confusion.label.xml Template File: sources-sink-51b.tmpl.c */ /* * @description * CWE: 843 Type Confusion * BadSource: short Point data to a short data type * GoodSource: Point data to an int data type * Sink: * BadSink : Attempt to access data as an int * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files * * */ #include "std_testcase.h" /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE843_Type_Confusion__short_51b_badSink(void * data) { /* POTENTIAL FLAW: Attempt to access data as an int */ printIntLine(*((int*)data)); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE843_Type_Confusion__short_51b_goodG2BSink(void * data) { /* POTENTIAL FLAW: Attempt to access data as an int */ printIntLine(*((int*)data)); } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__new_free_int_81.h Label Definition File: CWE762_Mismatched_Memory_Management_Routines__new_free.label.xml Template File: sources-sinks-81.tmpl.h */ /* * @description * CWE: 762 Mismatched Memory Management Routines * BadSource: Allocate data using new * GoodSource: Allocate data using malloc() * Sinks: * GoodSink: Deallocate data using delete * BadSink : Deallocate data using free() * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference * * */ #include "std_testcase.h" namespace CWE762_Mismatched_Memory_Management_Routines__new_free_int_81 { class CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_base { public: /* pure virtual function */ virtual void action(int * data) const = 0; }; #ifndef OMITBAD class CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_bad : public CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_base { public: void action(int * data) const; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_goodG2B : public CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_base { public: void action(int * data) const; }; class CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_goodB2G : public CWE762_Mismatched_Memory_Management_Routines__new_free_int_81_base { public: void action(int * data) const; }; #endif /* OMITGOOD */ }
/* Copyright 2022 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Tune the MP2964 IMVP9.1 parameters for brya */ #include "common.h" #include "compile_time_macros.h" #include "console.h" #include "hooks.h" #include "mp2964.h" const static struct mp2964_reg_val rail_a[] = { { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ }; const static struct mp2964_reg_val rail_b[] = { { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ }; static void mp2964_on_startup(void) { static int chip_updated; int status; if (get_board_id() != 1) return; if (chip_updated) return; chip_updated = 1; ccprintf("%s: attempting to tune PMIC\n", __func__); status = mp2964_tune(rail_a, ARRAY_SIZE(rail_a), rail_b, ARRAY_SIZE(rail_b)); if (status != EC_SUCCESS) ccprintf("%s: could not update all settings\n", __func__); } DECLARE_HOOK(HOOK_CHIPSET_STARTUP, mp2964_on_startup, HOOK_PRIO_FIRST);
// 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 MEDIA_CAST_SENDER_VPX_ENCODER_H_ #define MEDIA_CAST_SENDER_VPX_ENCODER_H_ #include <stdint.h> #include "base/macros.h" #include "base/threading/thread_checker.h" #include "media/base/feedback_signal_accumulator.h" #include "media/cast/cast_config.h" #include "media/cast/sender/software_video_encoder.h" #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" #include "ui/gfx/geometry/size.h" namespace media { class VideoFrame; } namespace media { namespace cast { class VpxEncoder final : public SoftwareVideoEncoder { public: explicit VpxEncoder(const FrameSenderConfig& video_config); ~VpxEncoder() final; VpxEncoder(const VpxEncoder&) = delete; VpxEncoder& operator=(const VpxEncoder&) = delete; VpxEncoder(VpxEncoder&&) = delete; VpxEncoder& operator=(VpxEncoder&&) = delete; // SoftwareVideoEncoder implementations. void Initialize() final; void Encode(scoped_refptr<media::VideoFrame> video_frame, base::TimeTicks reference_time, SenderEncodedFrame* encoded_frame) final; void UpdateRates(uint32_t new_bitrate) final; void GenerateKeyFrame() final; private: bool is_initialized() const { // ConfigureForNewFrameSize() sets the timebase denominator value to // non-zero if the encoder is successfully initialized, and it is zero // otherwise. return config_.g_timebase.den != 0; } // If the |encoder_| is live, attempt reconfiguration to allow it to encode // frames at a new |frame_size|. Otherwise, tear it down and re-create a new // |encoder_| instance. void ConfigureForNewFrameSize(const gfx::Size& frame_size); const FrameSenderConfig cast_config_; const double target_encoder_utilization_; // VPX internal objects. These are valid for use only while is_initialized() // returns true. vpx_codec_enc_cfg_t config_; vpx_codec_ctx_t encoder_; // Set to true to request the next frame emitted by VpxEncoder be a key frame. bool key_frame_requested_; // Saves the current bitrate setting, for when the |encoder_| is reconfigured // for different frame sizes. int bitrate_kbit_; // The |VideoFrame::timestamp()| of the last encoded frame. This is used to // predict the duration of the next frame. base::TimeDelta last_frame_timestamp_; // The ID for the next frame to be emitted. FrameId next_frame_id_; // This is bound to the thread where Initialize() is called. THREAD_CHECKER(thread_checker_); // The accumulator (time averaging) of the encoding speed. FeedbackSignalAccumulator<base::TimeDelta> encoding_speed_acc_; // The higher the speed, the less CPU usage, and the lower quality. int encoding_speed_; }; } // namespace cast } // namespace media #endif // MEDIA_CAST_SENDER_VPX_ENCODER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef PPAPI_PROXY_TCP_SERVER_SOCKET_PRIVATE_RESOURCE_H_ #define PPAPI_PROXY_TCP_SERVER_SOCKET_PRIVATE_RESOURCE_H_ #include <stdint.h> #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" namespace ppapi { namespace proxy { class PPAPI_PROXY_EXPORT TCPServerSocketPrivateResource : public PluginResource, public thunk::PPB_TCPServerSocket_Private_API { public: TCPServerSocketPrivateResource(Connection connection, PP_Instance instance); TCPServerSocketPrivateResource(const TCPServerSocketPrivateResource&) = delete; TCPServerSocketPrivateResource& operator=( const TCPServerSocketPrivateResource&) = delete; ~TCPServerSocketPrivateResource() override; // PluginResource implementation. thunk::PPB_TCPServerSocket_Private_API* AsPPB_TCPServerSocket_Private_API() override; // PPB_TCPServerSocket_Private_API implementation. int32_t Listen(const PP_NetAddress_Private* addr, int32_t backlog, scoped_refptr<TrackedCallback> callback) override; int32_t Accept(PP_Resource* tcp_socket, scoped_refptr<TrackedCallback> callback) override; int32_t GetLocalAddress(PP_NetAddress_Private* addr) override; void StopListening() override; private: enum State { STATE_BEFORE_LISTENING, STATE_LISTENING, STATE_CLOSED }; // IPC message handlers. void OnPluginMsgListenReply(const ResourceMessageReplyParams& params, const PP_NetAddress_Private& local_addr); void OnPluginMsgAcceptReply(PP_Resource* tcp_socket, const ResourceMessageReplyParams& params, int pending_resource_id, const PP_NetAddress_Private& local_addr, const PP_NetAddress_Private& remote_addr); State state_; PP_NetAddress_Private local_addr_; scoped_refptr<TrackedCallback> listen_callback_; scoped_refptr<TrackedCallback> accept_callback_; }; } // namespace proxy } // namespace ppapi #endif // PPAPI_PROXY_TCP_SERVER_SOCKET_PRIVATE_RESOURCE_H_
/* see copyright notice in squirrel.h */ #ifndef _SQPCHEADER_H_ #define _SQPCHEADER_H_ #if defined(_MSC_VER) && defined(_DEBUG) #include <crtdbg.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> //#include <new> //squirrel stuff #include <squirrel.h> #include "sqobject.h" #include "sqstate.h" #endif //_SQPCHEADER_H_
enum { SXSIMEDIA_SASITYPE = 0x07, SXSIMEDIA_INVSASI = 0x08 }; typedef struct { UINT8 sectors; UINT8 surfaces; UINT16 cylinders; } SASIHDD; typedef struct { UINT8 cylinders[2]; } THDHDR; typedef struct { char sig[16]; char comment[0x100]; UINT8 headersize[4]; UINT8 cylinders[4]; UINT8 surfaces[2]; UINT8 sectors[2]; UINT8 sectorsize[2]; UINT8 reserved[0xe2]; } NHDHDR; typedef struct { UINT8 dummy[4]; UINT8 hddtype[4]; UINT8 headersize[4]; UINT8 hddsize[4]; UINT8 sectorsize[4]; UINT8 sectors[4]; UINT8 surfaces[4]; UINT8 cylinders[4]; } HDIHDR; typedef struct { char sig[3]; char ver[4]; char delimita; char comment[128]; UINT8 padding1[4]; UINT8 mbsize[2]; UINT8 sectorsize[2]; UINT8 sectors; UINT8 surfaces; UINT8 cylinders[2]; UINT8 totals[4]; UINT8 padding2[0x44]; } VHDHDR; #ifdef __cplusplus extern "C" { #endif extern const char sig_vhd[8]; extern const char sig_nhd[15]; extern const SASIHDD sasihdd[7]; BRESULT sxsihdd_open(SXSIDEV sxsi, const OEMCHAR *fname); #ifdef __cplusplus } #endif
/* / _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ \____ \| ___ | (_ _) ___ |/ ___) _ \ _____) ) ____| | | || |_| ____( (___| | | | (______/|_____)_|_|_| \__)_____)\____)_| |_| (C)2013 Semtech Description: Generic driver for the GPS receiver UP501 License: Revised BSD License, see LICENSE.TXT file include in the project Maintainer: Miguel Luis and Gregory Cristian */ #ifndef __GPS_H__ #define __GPS_H__ /* Structure to handle the GPS parsed data in ASCII */ typedef struct { char NmeaDataType[6]; char NmeaUtcTime[11]; char NmeaDataStatus[2]; char NmeaLatitude[10]; char NmeaLatitudePole[2]; char NmeaLongitude[11]; char NmeaLongitudePole[2]; char NmeaFixQuality[2]; char NmeaSatelliteTracked[3]; char NmeaHorizontalDilution[6]; char NmeaAltitude[8]; char NmeaAltitudeUnit[2]; char NmeaHeightGeoid[8]; char NmeaHeightGeoidUnit[2]; char NmeaSpeed[8]; char NmeaDetectionAngle[8]; char NmeaDate[8]; }tNmeaGpsData; extern tNmeaGpsData NmeaGpsData; /*! * \brief Initializes the handling of the GPS receiver */ void GpsInit( void ); /*! * \brief Switch ON the GPS */ void GpsStart( void ); /*! * \brief Switch OFF the GPS */ void GpsStop( void ); /*! * Updates the GPS status */ void GpsProcess( void ); /*! * \brief PPS signal handling function */ void GpsPpsHandler( bool *parseData ); /*! * \brief PPS signal handling function * * \retval ppsDetected State of PPS signal. */ bool GpsGetPpsDetectedState( void ); /*! * \brief Indicates if GPS has fix * * \retval hasFix */ bool GpsHasFix( void ); /*! * \brief Converts the latest Position (latitude and longitude) into a binary * number */ void GpsConvertPositionIntoBinary( void ); /*! * \brief Converts the latest Position (latitude and Longitude) from ASCII into * DMS numerical format */ void GpsConvertPositionFromStringToNumerical( void ); /*! * \brief Gets the latest Position (latitude and Longitude) as two double values * if available * * \param [OUT] lati Latitude value * \param [OUT] longi Longitude value * * \retval status [SUCCESS, FAIL] */ uint8_t GpsGetLatestGpsPositionDouble ( double *lati, double *longi ); /*! * \brief Gets the latest Position (latitude and Longitude) as two binary values * if available * * \param [OUT] latiBin Latitude value * \param [OUT] longiBin Longitude value * * \retval status [SUCCESS, FAIL] */ uint8_t GpsGetLatestGpsPositionBinary ( int32_t *latiBin, int32_t *longiBin ); /*! * \brief Parses the NMEA sentence. * * \remark Only parses GPGGA and GPRMC sentences * * \param [IN] rxBuffer Data buffer to be parsed * \param [IN] rxBufferSize Size of data buffer * * \retval status [SUCCESS, FAIL] */ uint8_t GpsParseGpsData( int8_t *rxBuffer, int32_t rxBufferSize ); /*! * \brief Returns the latest altitude from the parsed NMEA sentence * * \retval altitude */ int16_t GpsGetLatestGpsAltitude( void ); /*! * \brief Format GPS data into numeric and binary formats */ void GpsFormatGpsData( void ); /*! * \brief Resets the GPS position variables */ void GpsResetPosition( void ); #endif // __GPS_H__
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83.h Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE806.label.xml Template File: sources-sink-83.tmpl.h */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sinks: ncpy * BadSink : Copy data to string using strncpy * Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83 { #ifndef OMITBAD class CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_bad { public: CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_bad(char * dataCopy); ~CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_bad(); private: char * data; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_goodG2B { public: CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_goodG2B(char * dataCopy); ~CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncpy_83_goodG2B(); private: char * data; }; #endif /* OMITGOOD */ }
/*========================================================================= Program: Visualization Toolkit Module: vtkInteractorStyleTrackballCamera.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 vtkInteractorStyleTrackballCamera - interactive manipulation of the camera // .SECTION Description // vtkInteractorStyleTrackballCamera allows the user to interactively // manipulate (rotate, pan, etc.) the camera, the viewpoint of the scene. In // trackball interaction, the magnitude of the mouse motion is proportional // to the camera motion associated with a particular mouse binding. For // example, small left-button motions cause small changes in the rotation of // the camera around its focal point. For a 3-button mouse, the left button // is for rotation, the right button for zooming, the middle button for // panning, and ctrl + left button for spinning. (With fewer mouse buttons, // ctrl + shift + left button is for zooming, and shift + left button is for // panning.) // .SECTION See Also // vtkInteractorStyleTrackballActor vtkInteractorStyleJoystickCamera // vtkInteractorStyleJoystickActor #ifndef vtkInteractorStyleTrackballCamera_h #define vtkInteractorStyleTrackballCamera_h #include "vtkInteractionStyleModule.h" // For export macro #include "vtkInteractorStyle.h" class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleTrackballCamera : public vtkInteractorStyle { public: static vtkInteractorStyleTrackballCamera *New(); vtkTypeMacro(vtkInteractorStyleTrackballCamera,vtkInteractorStyle); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Event bindings controlling the effects of pressing mouse buttons // or moving the mouse. virtual void OnMouseMove(); virtual void OnLeftButtonDown(); virtual void OnLeftButtonUp(); virtual void OnMiddleButtonDown(); virtual void OnMiddleButtonUp(); virtual void OnRightButtonDown(); virtual void OnRightButtonUp(); virtual void OnMouseWheelForward(); virtual void OnMouseWheelBackward(); // These methods for the different interactions in different modes // are overridden in subclasses to perform the correct motion. Since // they are called by OnTimer, they do not have mouse coord parameters // (use interactor's GetEventPosition and GetLastEventPosition) virtual void Rotate(); virtual void Spin(); virtual void Pan(); virtual void Dolly(); // Description: // Set the apparent sensitivity of the interactor style to mouse motion. vtkSetMacro(MotionFactor,double); vtkGetMacro(MotionFactor,double); protected: vtkInteractorStyleTrackballCamera(); ~vtkInteractorStyleTrackballCamera(); double MotionFactor; virtual void Dolly(double factor); private: vtkInteractorStyleTrackballCamera(const vtkInteractorStyleTrackballCamera&) VTK_DELETE_FUNCTION; void operator=(const vtkInteractorStyleTrackballCamera&) VTK_DELETE_FUNCTION; }; #endif
/*- * Copyright (c) 1992, 1993, 1994 * The Regents of the University of California. All rights reserved. * Copyright (c) 1992, 1993, 1994, 1995, 1996 * Keith Bostic. All rights reserved. * * See the LICENSE file for redistribution information. */ #include "config.h" #ifndef lint static const char sccsid[] = "$Id: v_match.c,v 10.11 2012/02/11 00:33:46 zy Exp $"; #endif /* not lint */ #include <sys/types.h> #include <sys/queue.h> #include <sys/time.h> #include <bitstring.h> #include <ctype.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../common/common.h" #include "vi.h" /* * v_match -- % * Search to matching character. * * PUBLIC: int v_match __P((SCR *, VICMD *)); */ int v_match(SCR *sp, VICMD *vp) { VCS cs; MARK *mp; size_t cno, len, off; int cnt, isempty, matchc, startc, (*gc)__P((SCR *, VCS *)); CHAR_T *p; CHAR_T *cp; const CHAR_T *match_chars; /* * Historically vi would match (), {} and [] however * an update included <>. This is ok for editing HTML * but a pain in the butt for C source. * Making it an option lets the user decide what is 'right'. */ match_chars = VIP(sp)->mcs; /* * !!! * Historic practice; ignore the count. * * !!! * Historical practice was to search for the initial character in the * forward direction only. */ if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) { if (isempty) goto nomatch; return (1); } for (off = vp->m_start.cno;; ++off) { if (off >= len) { nomatch: msgq(sp, M_BERR, "184|No match character on this line"); return (1); } startc = p[off]; cp = STRCHR(match_chars, startc); if (cp != NULL) { cnt = cp - match_chars; matchc = match_chars[cnt ^ 1]; gc = cnt & 1 ? cs_prev : cs_next; break; } } cs.cs_lno = vp->m_start.lno; cs.cs_cno = off; if (cs_init(sp, &cs)) return (1); for (cnt = 1;;) { if (gc(sp, &cs)) return (1); if (cs.cs_flags != 0) { if (cs.cs_flags == CS_EOF || cs.cs_flags == CS_SOF) break; continue; } if (cs.cs_ch == startc) ++cnt; else if (cs.cs_ch == matchc && --cnt == 0) break; } if (cnt) { msgq(sp, M_BERR, "185|Matching character not found"); return (1); } vp->m_stop.lno = cs.cs_lno; vp->m_stop.cno = cs.cs_cno; /* * If moving right, non-motion commands move to the end of the range. * Delete and yank stay at the start. * * If moving left, all commands move to the end of the range. * * !!! * Don't correct for leftward movement -- historic vi deleted the * starting cursor position when deleting to a match. */ if (vp->m_start.lno < vp->m_stop.lno || (vp->m_start.lno == vp->m_stop.lno && vp->m_start.cno < vp->m_stop.cno)) vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; else vp->m_final = vp->m_stop; /* * !!! * If the motion is across lines, and the earliest cursor position * is at or before any non-blank characters in the line, i.e. the * movement is cutting all of the line's text, and the later cursor * position has nothing other than whitespace characters between it * and the end of its line, the buffer is in line mode. */ if (!ISMOTION(vp) || vp->m_start.lno == vp->m_stop.lno) return (0); mp = vp->m_start.lno < vp->m_stop.lno ? &vp->m_start : &vp->m_stop; if (mp->cno != 0) { cno = 0; if (nonblank(sp, mp->lno, &cno)) return (1); if (cno < mp->cno) return (0); } mp = vp->m_start.lno < vp->m_stop.lno ? &vp->m_stop : &vp->m_start; if (db_get(sp, mp->lno, DBG_FATAL, &p, &len)) return (1); for (p += mp->cno + 1, len -= mp->cno; --len; ++p) if (!isblank(*p)) return (0); F_SET(vp, VM_LMODE); return (0); } /* * v_buildmcs -- * Build the match character list. * * PUBLIC: int v_buildmcs __P((SCR *, char *)); */ int v_buildmcs(SCR *sp, char *str) { CHAR_T **mp = &VIP(sp)->mcs; size_t len = strlen(str) + 1; if (*mp != NULL) free(*mp); MALLOC(sp, *mp, CHAR_T *, len * sizeof(CHAR_T)); if (*mp == NULL) return (1); #ifdef USE_WIDECHAR if (mbstowcs(*mp, str, len) == (size_t)-1) return (1); #else memcpy(*mp, str, len); #endif return (0); }
// @TEST-IGNORE #include <stdio.h> #include <libhilti.h> #include "callable.hlt.h" int main() { hlt_init(); hlt_execution_context* ctx = hlt_global_execution_context(); hlt_exception* excpt = 0; /// hlt_callable* c = foo_create_void(&excpt, ctx); HLT_CALLABLE_RUN(c, 0, Foo_MyCallableVoid, &excpt, ctx); /// fprintf(stdout, "===\n"); c = foo_create_result(&excpt, ctx); hlt_bytes* b = hlt_bytes_new_from_data_copy((const int8_t*)"ABCDE", 5, &excpt, ctx); int64_t i = 10000; hlt_string s; HLT_CALLABLE_RUN(c, &s, Foo_MyCallableResult, &b, &i, &excpt, ctx); fprintf(stdout, "C: "); hlt_string_print(stdout, s, true, &excpt, ctx); // return 0; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE590_Free_Memory_Not_on_Heap__free_int_declare_44.c Label Definition File: CWE590_Free_Memory_Not_on_Heap__free.label.xml Template File: sources-sink-44.tmpl.c */ /* * @description * CWE: 590 Free Memory Not on Heap * BadSource: declare Data buffer is declared on the stack * GoodSource: Allocate memory on the heap * Sinks: * BadSink : Print then free data * Flow Variant: 44 Data/control flow: data passed as an argument from one function to a function in the same source file called via a function pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD static void badSink(int * data) { printIntLine(data[0]); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } void CWE590_Free_Memory_Not_on_Heap__free_int_declare_44_bad() { int * data; /* define a function pointer */ void (*funcPtr) (int *) = badSink; data = NULL; /* Initialize data */ { /* FLAW: data is allocated on the stack and deallocated in the BadSink */ int dataBuffer[100]; { size_t i; for (i = 0; i < 100; i++) { dataBuffer[i] = 5; } } data = dataBuffer; } /* use the function pointer */ funcPtr(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2BSink(int * data) { printIntLine(data[0]); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } static void goodG2B() { int * data; void (*funcPtr) (int *) = goodG2BSink; data = NULL; /* Initialize data */ { /* FIX: data is allocated on the heap and deallocated in the BadSink */ int * dataBuffer = (int *)malloc(100*sizeof(int)); if (dataBuffer == NULL) { printLine("malloc() failed"); exit(1); } { size_t i; for (i = 0; i < 100; i++) { dataBuffer[i] = 5; } } data = dataBuffer; } funcPtr(data); } void CWE590_Free_Memory_Not_on_Heap__free_int_declare_44_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()..."); CWE590_Free_Memory_Not_on_Heap__free_int_declare_44_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE590_Free_Memory_Not_on_Heap__free_int_declare_44_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* Copyright 2017 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* I2C module driver depends on chip series for Chrome EC */ #include "i2c.h" #include "i2c_chip.h" #include "registers.h" #include "util.h" /*****************************************************************************/ /* IC specific low-level driver depends on chip series */ int i2c_port_to_controller(int port) { if (port < 0 || port >= I2C_PORT_COUNT) return -1; return (port == NPCX_I2C_PORT0_0) ? 0 : port - 1; } void i2c_select_port(int port) { /* * I2C0_1 uses port 1 of controller 0. All other I2C pin sets * use port 0. */ if (port > NPCX_I2C_PORT0_1) return; /* Select IO pins for multi-ports I2C controllers */ UPDATE_BIT(NPCX_GLUE_SMBSEL, NPCX_SMBSEL_SMB0SEL, (port == NPCX_I2C_PORT0_1)); } int i2c_is_raw_mode(int port) { int bit = (port > NPCX_I2C_PORT0_1) ? ((port - 1) * 2) : port; if (IS_BIT_SET(NPCX_DEVALT(2), bit)) return 0; else return 1; }
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_TRACING_TRACE_CATEGORIES_H_ #define V8_TRACING_TRACE_CATEGORIES_H_ #include "src/base/macros.h" #if defined(V8_USE_PERFETTO) // Exports tracks events into the v8 namespace to avoid conflicts with embedders // like Chrome. #define PERFETTO_TRACK_EVENT_NAMESPACE v8 // Export trace categories and the track event data source in components builds. #define PERFETTO_COMPONENT_EXPORT V8_EXPORT_PRIVATE // For now most of v8 uses legacy trace events. #define PERFETTO_ENABLE_LEGACY_TRACE_EVENTS 1 #include "perfetto/tracing.h" // Trace category prefixes used in tests. PERFETTO_DEFINE_TEST_CATEGORY_PREFIXES("v8-cat", "cat", "v8.Test2"); // List of categories used by built-in V8 trace events. // clang-format off PERFETTO_DEFINE_CATEGORIES( perfetto::Category("V8.HandleInterrupts"), perfetto::Category("v8"), perfetto::Category("v8.console"), perfetto::Category("v8.execute"), perfetto::Category("v8.runtime"), perfetto::Category("v8.wasm"), perfetto::Category::Group("devtools.timeline,v8"), perfetto::Category::Group("devtools.timeline," TRACE_DISABLED_BY_DEFAULT("v8.gc")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("devtools.timeline")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.compile")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.gc")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.ic_stats")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats_sampling")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.stack_trace")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.turbofan")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")), perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.zone_stats")), perfetto::Category::Group("v8,devtools.timeline"), perfetto::Category::Group(TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"))); // clang-format on #endif // defined(V8_USE_PERFETTO) #endif // V8_TRACING_TRACE_CATEGORIES_H_
/* Copyright (c) 2016, Apple 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: 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(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. No license is granted to the trademarks of the copyright holders even if such marks are included in this software. 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. */ #import <CareKit/CareKit.h> @interface MainTableViewController : UITableViewController <OCKSymptomTrackerViewControllerDelegate, OCKConnectViewControllerDelegate, OCKCareCardViewControllerDelegate> @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE690_NULL_Deref_From_Return__long_realloc_67b.c Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml Template File: source-sinks-67b.tmpl.c */ /* * @description * CWE: 690 Unchecked Return Value To NULL Pointer * BadSource: realloc Allocate data using realloc() * Sinks: * GoodSink: Check to see if the data allocation failed and if not, use data * BadSink : Don't check for NULL and use data * Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> typedef struct _CWE690_NULL_Deref_From_Return__long_realloc_67_structType { long * structFirst; } CWE690_NULL_Deref_From_Return__long_realloc_67_structType; #ifndef OMITBAD void CWE690_NULL_Deref_From_Return__long_realloc_67b_badSink(CWE690_NULL_Deref_From_Return__long_realloc_67_structType myStruct) { long * data = myStruct.structFirst; /* FLAW: Initialize memory buffer without checking to see if the memory allocation function failed */ data[0] = 5L; printLongLine(data[0]); free(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G uses the BadSource with the GoodSink */ void CWE690_NULL_Deref_From_Return__long_realloc_67b_goodB2GSink(CWE690_NULL_Deref_From_Return__long_realloc_67_structType myStruct) { long * data = myStruct.structFirst; /* FIX: Check to see if the memory allocation function was successful before initializing the memory buffer */ if (data != NULL) { data[0] = 5L; printLongLine(data[0]); free(data); } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__int_large_to_short_65a.c Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml Template File: sources-sink-65a.tmpl.c */ /* * @description * CWE: 197 Numeric Truncation Error * BadSource: large Set data to a number larger than SHRT_MAX * GoodSource: Less than CHAR_MAX * Sinks: to_short * BadSink : Convert data to a short * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #ifndef OMITBAD /* bad function declaration */ void CWE197_Numeric_Truncation_Error__int_large_to_short_65b_badSink(int data); void CWE197_Numeric_Truncation_Error__int_large_to_short_65_bad() { int data; /* define a function pointer */ void (*funcPtr) (int) = CWE197_Numeric_Truncation_Error__int_large_to_short_65b_badSink; /* Initialize data */ data = -1; /* FLAW: Use a number larger than SHRT_MAX */ data = SHRT_MAX + 5; /* use the function pointer */ funcPtr(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE197_Numeric_Truncation_Error__int_large_to_short_65b_goodG2BSink(int data); static void goodG2B() { int data; void (*funcPtr) (int) = CWE197_Numeric_Truncation_Error__int_large_to_short_65b_goodG2BSink; /* Initialize data */ data = -1; /* FIX: Use a positive integer less than CHAR_MAX*/ data = CHAR_MAX-5; funcPtr(data); } void CWE197_Numeric_Truncation_Error__int_large_to_short_65_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()..."); CWE197_Numeric_Truncation_Error__int_large_to_short_65_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE197_Numeric_Truncation_Error__int_large_to_short_65_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file bulletShape.h * @author enn0x * @date 2010-01-23 */ #ifndef __BULLET_SHAPE_H__ #define __BULLET_SHAPE_H__ #include "pandabase.h" #include "bullet_includes.h" #include "typedReferenceCount.h" #include "boundingSphere.h" /** * */ class EXPCL_PANDABULLET BulletShape : public TypedWritableReferenceCount { protected: INLINE BulletShape() {}; PUBLISHED: INLINE virtual ~BulletShape(); INLINE bool is_polyhedral() const; INLINE bool is_convex() const; INLINE bool is_convex_2d() const; INLINE bool is_concave() const; INLINE bool is_infinite() const; INLINE bool is_non_moving() const; INLINE bool is_soft_body() const; void set_margin(PN_stdfloat margin); const char *get_name() const; PN_stdfloat get_margin() const; BoundingSphere get_shape_bounds() const; MAKE_PROPERTY(polyhedral, is_polyhedral); MAKE_PROPERTY(convex, is_convex); MAKE_PROPERTY(convex_2d, is_convex_2d); MAKE_PROPERTY(concave, is_concave); MAKE_PROPERTY(infinite, is_infinite); MAKE_PROPERTY(non_moving, is_non_moving); MAKE_PROPERTY(soft_body, is_soft_body); MAKE_PROPERTY(margin, get_margin, set_margin); MAKE_PROPERTY(name, get_name); MAKE_PROPERTY(shape_bounds, get_shape_bounds); public: virtual btCollisionShape *ptr() const = 0; LVecBase3 get_local_scale() const; void set_local_scale(const LVecBase3 &scale); public: static TypeHandle get_class_type() { return _type_handle; } static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "BulletShape", TypedWritableReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); } virtual TypeHandle force_init_type() { init_type(); return get_class_type(); } private: static TypeHandle _type_handle; }; #include "bulletShape.I" #endif // __BULLET_SHAPE_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 CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ #define CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ #include <stddef.h> #include <memory> #include <string> #include <vector> #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/task/sequenced_task_runner.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "services/preferences/public/mojom/preferences.mojom-forward.h" #include "services/preferences/public/mojom/tracked_preference_validation_delegate.mojom-forward.h" class PersistentPrefStore; class PrefService; namespace base { class DictionaryValue; } // namespace base namespace service_manager { class Connector; } namespace user_prefs { class PrefRegistrySyncable; } // namespace user_prefs // Provides a facade through which the user preference store may be accessed and // managed. class ProfilePrefStoreManager { public: // Instantiates a ProfilePrefStoreManager with the configuration required to // manage the user preferences of the profile at |profile_path|. // |seed| and |legacy_device_id| are used to track preference value changes // and must be the same on each launch in order to verify loaded preference // values. ProfilePrefStoreManager(const base::FilePath& profile_path, const std::string& seed, const std::string& legacy_device_id); ProfilePrefStoreManager(const ProfilePrefStoreManager&) = delete; ProfilePrefStoreManager& operator=(const ProfilePrefStoreManager&) = delete; ~ProfilePrefStoreManager(); static const bool kPlatformSupportsPreferenceTracking; // Register user prefs used by the profile preferences system. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); // Retrieves the time of the last preference reset event, if any, for // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that // was built by ProfilePrefStoreManager. // If no reset has occurred, returns a null |Time|. static base::Time GetResetTime(PrefService* pref_service); // Clears the time of the last preference reset event, if any, for // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that // was built by ProfilePrefStoreManager. static void ClearResetTime(PrefService* pref_service); #if defined(OS_WIN) // Call before startup tasks kick in to use a different registry path for // storing and validating tracked preference MACs. Callers are responsible // for ensuring that the key is deleted on shutdown. For testing only. static void SetPreferenceValidationRegistryPathForTesting( const std::wstring* path); #endif // Creates a PersistentPrefStore providing access to the user preferences of // the managed profile. If |reset_on_load_observer| is provided, it will be // notified if a reset occurs as a result of loading the profile's prefs. An // optional |validation_delegate| will be notified of the status of each // tracked preference as they are checked. // |tracking_configuration| is used for preference tracking. // |reporting_ids_count| is the count of all possible tracked preference IDs // (possibly greater than |tracking_configuration.size()|). PersistentPrefStore* CreateProfilePrefStore( std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> tracking_configuration, size_t reporting_ids_count, scoped_refptr<base::SequencedTaskRunner> io_task_runner, mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver> reset_on_load_observer, mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate> validation_delegate); // Initializes the preferences for the managed profile with the preference // values in |master_prefs|. Acts synchronously, including blocking IO. // Returns true on success. bool InitializePrefsFromMasterPrefs( std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> tracking_configuration, size_t reporting_ids_count, std::unique_ptr<base::DictionaryValue> master_prefs); private: // Connects to the pref service over mojo and configures it. void ConfigurePrefService( std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> tracking_configuration, size_t reporting_ids_count, mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver> reset_on_load_observer, mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate> validation_delegate, service_manager::Connector* connector); prefs::mojom::TrackedPersistentPrefStoreConfigurationPtr CreateTrackedPrefStoreConfiguration( std::vector<prefs::mojom::TrackedPreferenceMetadataPtr> tracking_configuration, size_t reporting_ids_count, mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver> reset_on_load_observer, mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate> validation_delegate); const base::FilePath profile_path_; const std::string seed_; const std::string legacy_device_id_; }; #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81.h Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805.label.xml Template File: sources-sink-81.tmpl.h */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using new[] and set data pointer to a small buffer * GoodSource: Allocate using new[] and set data pointer to a large buffer * Sinks: loop * BadSink : Copy TwoIntsClass array to data using a loop * Flow Variant: 81 Data flow: data passed in a parameter to a virtual method called via a reference * * */ #include "std_testcase.h" namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81 { class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81_base { public: /* pure virtual function */ virtual void action(TwoIntsClass * data) const = 0; }; #ifndef OMITBAD class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81_bad : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81_base { public: void action(TwoIntsClass * data) const; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_class_loop_81_base { public: void action(TwoIntsClass * data) const; }; #endif /* OMITGOOD */ }
/* * pg_bulkload: lib/writer.c * * Copyright (c) 2011-2015, NIPPON TELEGRAPH AND TELEPHONE CORPORATION */ /** * @file * @brief Implementation of writer module */ #include "pg_bulkload.h" #include "utils/builtins.h" #include "utils/lsyscache.h" #include "pg_strutil.h" #include "logger.h" #include "reader.h" #include "writer.h" const char *ON_DUPLICATE_NAMES[] = { "NEW", "OLD" }; /** * @brief Create Writer */ Writer * WriterCreate(char *writer, bool multi_process) { const char *keys[] = { "DIRECT", "BUFFERED", "BINARY" }; const CreateWriter values[] = { CreateDirectWriter, CreateBufferedWriter, CreateBinaryWriter }; Writer *self; /* default of writer is DIRECT */ if (writer == NULL) writer = "DIRECT"; /* alias for backward compatibility. */ if (pg_strcasecmp(writer, "PARALLEL") == 0) { multi_process = true; writer = "DIRECT"; } self = values[choice("WRITER", writer, keys, lengthof(keys))](NULL); if (multi_process) self = CreateParallelWriter(self); self->multi_process = multi_process; return self; } void WriterInit(Writer *self) { self->init(self); } /** * @brief Parse a line in control file. */ bool WriterParam(Writer *self, const char *keyword, char *value) { if (CompareKeyword(keyword, "VERBOSE")) { self->verbose = ParseBoolean(value); } else if (!self->param(self, keyword, value)) return false; return true; } void WriterDumpParams(Writer *self) { char *str; StringInfoData buf; initStringInfo(&buf); str = QuoteString(self->output); appendStringInfo(&buf, "OUTPUT = %s\n", str); pfree(str); appendStringInfo(&buf, "MULTI_PROCESS = %s\n", self->multi_process ? "YES" : "NO"); appendStringInfo(&buf, "VERBOSE = %s\n", self->verbose ? "YES" : "NO"); LoggerLog(INFO, buf.data, 0); pfree(buf.data); self->dumpParams(self); } WriterResult WriterClose(Writer *self, bool onError) { if (self->dup_badfile != NULL) pfree(self->dup_badfile); self->dup_badfile = NULL; return self->close(self, onError); } char * get_relation_name(Oid relid) { return quote_qualified_identifier( get_namespace_name(get_rel_namespace(relid)), get_rel_name(relid)); }
// 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 SERVICES_DEVICE_GENERIC_SENSOR_ABSOLUTE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_MAGNETOMETER_H_ #define SERVICES_DEVICE_GENERIC_SENSOR_ABSOLUTE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_MAGNETOMETER_H_ #include "base/macros.h" #include "services/device/generic_sensor/platform_sensor_fusion_algorithm.h" namespace device { // Sensor fusion algorithm for implementing ABSOLUTE_ORIENTATION_EULER_ANGLES // using ACCELEROMETER and MAGNETOMETER. class AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer : public PlatformSensorFusionAlgorithm { public: AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer(); AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer( const AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer&) = delete; AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer& operator=( const AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer&) = delete; ~AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer() override; protected: bool GetFusedDataInternal(mojom::SensorType which_sensor_changed, SensorReading* fused_reading) override; }; } // namespace device #endif // SERVICES_DEVICE_GENERIC_SENSOR_ABSOLUTE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_MAGNETOMETER_H_
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #ifndef RUNTIME_VM_HEAP_SWEEPER_H_ #define RUNTIME_VM_HEAP_SWEEPER_H_ #include "vm/globals.h" namespace dart { // Forward declarations. class FreeList; class Heap; class OldPage; class IsolateGroup; class PageSpace; // The class GCSweeper is used to visit the heap after marking to reclaim unused // memory. class GCSweeper { public: GCSweeper() {} ~GCSweeper() {} // Sweep the memory area for the page while clearing the mark bits and adding // all the unmarked objects to the freelist. Whether the freelist is // pre-locked is indicated by the locked parameter. // Returns true if the page is in use. Freelist is untouched if page is not // in use. bool SweepPage(OldPage* page, FreeList* freelist, bool locked); // Returns the number of words from page->object_start() to the end of the // last marked object. intptr_t SweepLargePage(OldPage* page); // Sweep the large and regular sized data pages. static void SweepConcurrent(IsolateGroup* isolate_group); }; } // namespace dart #endif // RUNTIME_VM_HEAP_SWEEPER_H_
/* $Id: alloc.c,v 1.1 2003/05/16 21:48:12 fredette Exp $ */ /* libtme/alloc.c - memory allocation utility functions: */ /* * Copyright (c) 2003 Matt Fredette * 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 Matt Fredette. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 <tme/common.h> _TME_RCSID("$Id: alloc.c,v 1.1 2003/05/16 21:48:12 fredette Exp $"); /* includes: */ #include <stdlib.h> void * tme_malloc(unsigned int size) { void *p; p = malloc(size); if (p == NULL) { abort(); } return (p); } void * tme_malloc0(unsigned int size) { void *p; p = tme_malloc(size); memset(p, 0, size); return (p); } void * tme_realloc(void *p, unsigned int size) { p = realloc(p, size); if (p == NULL) { abort(); } return (p); } void * tme_memdup(const void *p1, unsigned int size) { void *p2; p2 = tme_malloc(size); memcpy(p2, p1, size); return (p2); } void tme_free(void *p) { free(p); } char * tme_strdup(const char *s) { return (tme_memdup(s, strlen(s) + 1)); }