text
stringlengths
4
6.14k
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-avx2.h" #include "../common/n2sv_64.c"
/* Adrenaline Copyright (C) 2016-2018, TheFloW 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/>. */ #ifndef __MAIN_H__ #define __MAIN_H__ typedef struct { u32 addr; u32 size; } SceSysmemPartInfo; typedef struct { u32 memSize; u32 unk4; u32 unk8; SceSysmemPartInfo other1; // 12 SceSysmemPartInfo other2; // 20 SceSysmemPartInfo vshell; // 28 SceSysmemPartInfo scUser; // 36 SceSysmemPartInfo meUser; // 44 SceSysmemPartInfo extSc2Kernel; // 52 SceSysmemPartInfo extScKernel; // 60 SceSysmemPartInfo extMeKernel; // 68 SceSysmemPartInfo extVshell; // 76 } SceSysmemPartTable; #endif
/* * * (C) 2013-21 - ntop.org * * * This program is free software; you can addresstribute 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, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _SCANNERS_H_ #define _SCANNERS_H_ #include "ntop_includes.h" class Scanners { private: ScannersAddressTree *inline_scanners_ptree, *offline_scanners_ptree; public: Scanners(); ~Scanners(); void inlineIncScanner(const IpAddress *ipa, u_int32_t weight); void inlineRefreshScanners(); void getScanners(lua_State *vm); }; #endif /* _SCANNERS_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 QT3DRENDER_QTECHNIQUEFILTER_H #define QT3DRENDER_QTECHNIQUEFILTER_H #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qframegraphnode.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { class QTechniqueFilterPrivate; class QFilterKey; class QParameter; class QT3DRENDERSHARED_EXPORT QTechniqueFilter : public QFrameGraphNode { Q_OBJECT public: explicit QTechniqueFilter(Qt3DCore::QNode *parent = nullptr); ~QTechniqueFilter(); QVector<QFilterKey*> matchAll() const; void addMatch(QFilterKey *filterKey); void removeMatch(QFilterKey *filterKey); void addParameter(QParameter *p); void removeParameter(QParameter *p); QVector<QParameter *> parameters() const; protected: QTechniqueFilter(QTechniqueFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr); private: Q_DECLARE_PRIVATE(QTechniqueFilter) Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; } // namespace Qt3DRender QT_END_NAMESPACE #endif // QT3DRENDER_QTECHNIQUEFILTER_H
#pragma once namespace Game{ namespace Texas{ class CPoker { public: enum{ PT_CLUB, PT_SQUARE, PT_SPADE, PT_HERT }; private: byte m_value; // 1~13 byte m_type; // Hert, Spade, Square, Club bool m_bOut; // Have been sent public: byte Value(){ return m_value; } byte Type(){ return m_type; } bool IsOut(){ return m_bOut; } void SetOut(bool b){ m_bOut = b; } public: CPoker(byte val, byte type); ~CPoker(); }; } }
#ifndef MANTID_API_FILEFINDER_H_ #define MANTID_API_FILEFINDER_H_ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- #include "MantidKernel/SingletonHolder.h" #include "MantidAPI/DllConfig.h" #include "MantidAPI/IArchiveSearch.h" #include <vector> #include <set> namespace Mantid { //--------------------------------------------------------------------------- // Forward declarations //--------------------------------------------------------------------------- namespace Kernel { class InstrumentInfo; } namespace API { /** This class finds data files given an instrument name (optionally) and a run number @author Roman Tolchenov, Tessella plc @date 23/07/2010 Copyright &copy; 2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid 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. Mantid 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/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ class MANTID_API_DLL FileFinderImpl { public: std::string getFullPath(const std::string &filename, const bool ignoreDirs = false) const; std::string getPath(const std::vector<IArchiveSearch_sptr> &archs, const std::set<std::string> &filenames, const std::vector<std::string> &exts) const; /// DO NOT USE! MADE PUBLIC FOR TESTING ONLY. std::string makeFileName(const std::string &hint, const Kernel::InstrumentInfo &instrument) const; void setCaseSensitive(const bool cs); bool getCaseSensitive() const; std::string findRun(const std::string &hintstr, const std::set<std::string> &exts) const; std::string findRun( const std::string &hintstr, const std::vector<std::string> &exts = std::vector<std::string>()) const; std::vector<std::string> findRuns(const std::string &hintstr) const; /// DO NOT USE! MADE PUBLIC FOR TESTING ONLY. const Kernel::InstrumentInfo getInstrument(const std::string &hint) const; /// DO NOT USE! MADE PUBLIC FOR TESTING ONLY. std::string getExtension(const std::string &filename, const std::vector<std::string> &exts) const; private: friend struct Mantid::Kernel::CreateUsingNew<FileFinderImpl>; /// a string that is allowed at the end of any run number static const std::string ALLOWED_SUFFIX; /// Default constructor FileFinderImpl(); /// Copy constructor FileFinderImpl(const FileFinderImpl &); /// Assignment operator FileFinderImpl &operator=(const FileFinderImpl &); std::string extractAllowedSuffix(std::string &userString) const; std::pair<std::string, std::string> toInstrumentAndNumber(const std::string &hint) const; std::string getArchivePath(const std::vector<IArchiveSearch_sptr> &archs, const std::set<std::string> &filenames, const std::vector<std::string> &exts) const; std::string toUpper(const std::string &src) const; /// glob option - set to case sensitive or insensitive int m_globOption; }; typedef Mantid::Kernel::SingletonHolder<FileFinderImpl> FileFinder; } } namespace Mantid { namespace Kernel { EXTERN_MANTID_API template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<Mantid::API::FileFinderImpl>; } } #endif // MANTID_API_FILEFINDER_H_
/* THPaletteViewController.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 <UIKit/UIKit.h> #import "THPaletteItem.h" #import "THPalette.h" #import "THTabbarSection.h" #import "THTabbarView.h" #import "THEditor.h" @class PaletteItemContainer; @class THDraggedPaletteItem; @class THTabbarSection; @class THTabbarView; typedef enum { kDraggingInTab, kDraggingInEditor } TFDraggingState; @interface THPaletteViewController : UIViewController <THPaletteDragDelegate, THPaletteEditionDelegate, THEditorDragDelegate, TFTabbarViewDataSource, TFTabBarViewDelegate> { THDraggedPaletteItem * _dragView; THDraggedPaletteItem * _editorDragView; NSMutableArray * _customPaletteItems; THTabbarSection * _selectedSection; } @property (nonatomic, weak) id<TFPaletteViewControllerDelegate> delegate; @property (nonatomic, readonly) THPaletteItem * currentPaletteItem; @property (nonatomic, readonly) THTabbarView * tabView; @property (nonatomic) BOOL isEditing; @property (nonatomic, strong) NSArray * clothesSectionArray; @property (nonatomic, strong) NSArray * uiSectionArray; @property (nonatomic, strong) NSArray * boardsSectionArray; @property (nonatomic, strong) NSArray * hardwareSectionArray; @property (nonatomic, strong) NSArray * variablesSectionArray; @property (nonatomic, strong) NSArray * programmingSectionArray; @property (nonatomic, strong) NSArray * signalProcessingArray; @property (nonatomic, strong) NSArray * comparisonOperatorsArray; @property (nonatomic, strong) NSArray * arithmeticSectionArray; @property (nonatomic, strong) NSMutableArray * customComponentsSectionArray; @property (nonatomic, copy) NSString * clothesSectionName; @property (nonatomic, copy) NSString * uiSectionArrayName; @property (nonatomic, copy) NSString * boardsSectionName; @property (nonatomic, copy) NSString * hardwareSectionName; @property (nonatomic, copy) NSString * variablesSectionName; @property (nonatomic, copy) NSString * programmingSectionName; @property (nonatomic, copy) NSString * signalProcessingName; @property (nonatomic, copy) NSString * comparisonOperatorsSectionName; @property (nonatomic, copy) NSString * arithmeticSectionName; @property (nonatomic, copy) NSString * customComponentsSectionName; @property (nonatomic, strong) NSMutableArray * sections; @property (nonatomic, strong) NSMutableArray * sectionNames; -(void) reloadCustomProgrammingObjects; -(void) reloadPalettes; -(void) useDefaultPaletteSections; -(void) addCustomPaletteItems; -(void) save; -(void) prepareToDie; @end
// // LUConsoleEntryLookupTable.h // // Lunar Unity Mobile Console // https://github.com/SpaceMadness/lunar-unity-console // // Copyright 2016 Alex Lementuev, SpaceMadness. // // 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> @class LUConsoleEntry; @class LUConsoleCollapsedEntry; @interface LUConsoleEntryLookupTable : NSObject - (LUConsoleCollapsedEntry *)addEntry:(LUConsoleEntry *)entry; - (void)removeEntry:(LUConsoleCollapsedEntry *)entry; - (void)clear; @end
/* * EquipmentEditor.h is part of Brewtarget, and is Copyright the following * authors 2009-2015 * - David Grundberg <individ@acc.umu.se> * - Jeff Bailey <skydvr38@verizon.net> * - Mik Firestone <mikfire@gmail.com> * - Philip Greggory Lee <rocketman768@gmail.com> * * Brewtarget 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. * * Brewtarget 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/>. */ #ifndef _EQUIPMENTEDITOR_H #define _EQUIPMENTEDITOR_H #include <QDialog> #include <QMetaProperty> #include <QVariant> #include <QVBoxLayout> #include <QHBoxLayout> #include <QLabel> #include <QComboBox> #include <QPushButton> #include <QSpacerItem> #include <QCheckBox> #include <QGroupBox> #include <QFormLayout> #include <QLineEdit> #include <QTextEdit> #include "BtLabel.h" // Forward declarations class BtGenericEdit; class BtMassEdit; class BtMassLabel; class BtTemperatureEdit; class BtTimeLabel; class BtTimeEdit; class BtVolumeLabel; class BtVolumeEdit; class Equipment; class EquipmentListModel; class BeerXMLSortProxyModel; /*! * \class EquipmentEditor * \author Philip G. Lee * * \brief This is a dialog that edits an equipment record. */ class EquipmentEditor : public QDialog { Q_OBJECT public: //! \param singleEquipEditor true if you do not want the necessary elements for viewing all the database elements. EquipmentEditor( QWidget *parent=0, bool singleEquipEditor=false ); virtual ~EquipmentEditor() {} //! \name Public UI Variables //! @{ QVBoxLayout *verticalLayout_6; QVBoxLayout *topVLayout; QHBoxLayout *horizontalLayout_equipments; QLabel *label; QComboBox *equipmentComboBox; QPushButton *pushButton_remove; QSpacerItem *horizontalSpacer; QCheckBox *checkBox_defaultEquipment; QHBoxLayout *horizontalLayout; QVBoxLayout *vLayout_left; QGroupBox *groupBox_required; QVBoxLayout *verticalLayout; QFormLayout *formLayout; QLabel *label_name; QLineEdit *lineEdit_name; BtVolumeLabel *label_boilSize; BtVolumeEdit *lineEdit_boilSize; QLabel *label_calcBoilVolume; QCheckBox *checkBox_calcBoilVolume; BtVolumeLabel *label_batchSize; BtVolumeEdit *lineEdit_batchSize; QGroupBox *groupBox_water; QVBoxLayout *verticalLayout_3; QFormLayout *formLayout_water; BtTimeLabel *label_boilTime; BtTimeEdit *lineEdit_boilTime; BtVolumeLabel *label_evaporationRate; BtVolumeEdit *lineEdit_evaporationRate; BtVolumeLabel *label_topUpKettle; BtVolumeEdit *lineEdit_topUpKettle; BtVolumeLabel *label_topUpWater; BtVolumeEdit *lineEdit_topUpWater; QLabel *label_absorption; BtGenericEdit *lineEdit_grainAbsorption; QPushButton *pushButton_absorption; BtTemperatureEdit *lineEdit_boilingPoint; QLabel *label_hopUtilization; BtGenericEdit *lineEdit_hopUtilization; BtTemperatureLabel *label_boilingPoint; QSpacerItem *verticalSpacer_2; QVBoxLayout *vLayout_right; QGroupBox *groupBox_mashTun; QFormLayout *formLayout_mashTun; BtVolumeLabel *label_tunVolume; BtVolumeEdit *lineEdit_tunVolume; BtMassLabel *label_tunWeight; BtMassEdit *lineEdit_tunWeight; QLabel *label_tunSpecificHeat; BtGenericEdit *lineEdit_tunSpecificHeat; QGroupBox *groupBox_losses; QVBoxLayout *verticalLayout_4; QFormLayout *formLayout_losses; BtVolumeLabel *label_trubChillerLoss; BtVolumeEdit *lineEdit_trubChillerLoss; BtVolumeLabel *label_lauterDeadspace; BtVolumeEdit *lineEdit_lauterDeadspace; QGroupBox *groupBox_notes; QVBoxLayout *verticalLayout_notes; QTextEdit *textEdit_notes; QSpacerItem *verticalSpacer; QHBoxLayout *hLayout_buttons; QSpacerItem *horizontalSpacer_2; QPushButton *pushButton_new; QPushButton *pushButton_save; QPushButton *pushButton_cancel; //! @} //! Edit the given equipment. void setEquipment( Equipment* e ); void newEquipment(QString folder); public slots: //! Save the changes to the equipment. void save(); //! Create a new equipment record. void newEquipment(); //! Delete the equipment from the database. void removeEquipment(); //! Set the equipment to default values. void clear(); //! Close the dialog, throwing away changes. void cancel(); //! Set absorption back to default. void resetAbsorption(); //! Edit the equipment currently selected in our combobox. void equipmentSelected(); //! If state==Qt::Checked, set the "calculate boil volume" checkbox. Otherwise, unset. void updateCheckboxRecord(); //! \brief set the default equipment, or unset the current equipment as the default void updateDefaultEquipment(int state); void changed(QMetaProperty,QVariant); double calcBatchSize(); protected: //! User closed the dialog void closeEvent(QCloseEvent *event); virtual void changeEvent(QEvent* event) { if(event->type() == QEvent::LanguageChange) retranslateUi(); QDialog::changeEvent(event); } private: Equipment* obsEquip; EquipmentListModel* equipmentListModel; BeerXMLSortProxyModel* equipmentSortProxyModel; void showChanges(); void doLayout(); void retranslateUi(); }; #endif /* _EQUIPMENTEDITOR_H */
/**************************************************************************** ** ** Copyright (C) 2016 Orgad Shaneh <orgads@gmail.com>. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** 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 General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** 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-3.0.html. ** ****************************************************************************/ #pragma once #include <texteditor/basefilefind.h> #include <QCoreApplication> QT_FORWARD_DECLARE_CLASS(QCheckBox) namespace Utils { class FancyLineEdit; } namespace Git { namespace Internal { class GitGrep : public TextEditor::FileFindExtension { Q_DECLARE_TR_FUNCTIONS(GitGrep) public: GitGrep(); ~GitGrep() override; QString title() const override; QString toolTip() const override; QWidget *widget() const override; bool isEnabled() const override; bool isEnabled(const TextEditor::FileFindParameters &parameters) const override; QVariant parameters() const override; void readSettings(QSettings *settings) override; void writeSettings(QSettings *settings) const override; QFuture<Utils::FileSearchResultList> executeSearch( const TextEditor::FileFindParameters &parameters) override; Core::IEditor *openEditor(const Core::SearchResultItem &item, const TextEditor::FileFindParameters &parameters) override; private: QWidget *m_widget; QCheckBox *m_enabledCheckBox; Utils::FancyLineEdit *m_treeLineEdit; }; } // namespace Internal } // namespace Git
/* * This file is part of RawTherapee. * * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> * * RawTherapee 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. * * RawTherapee 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 RawTherapee. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PPARAMSCHANGELISTENER_ #define _PPARAMSCHANGELISTENER_ #include "../rtengine/rtengine.h" #include <glibmm.h> #include "paramsedited.h" class PParamsChangeListener { public: virtual ~PParamsChangeListener() = default; virtual void procParamsChanged( const rtengine::procparams::ProcParams* params, const rtengine::ProcEvent& ev, const Glib::ustring& descr, const ParamsEdited* paramsEdited = nullptr ) = 0; virtual void clearParamChanges() = 0; }; class BatchPParamsChangeListener { public: virtual ~BatchPParamsChangeListener() = default; virtual void beginBatchPParamsChange(int numberOfEntries) = 0; virtual void endBatchPParamsChange() = 0; }; #endif
// membuf.h -- Thatcher Ulrich 2005 // This source code has been donated to the Public Domain. Do // whatever you want with it. // A simple memory buffer. Similar to a string, but can hold null // characters. #ifndef MEMBUF_H #define MEMBUF_H #include "base/tu_config.h" #include "base/utility.h" class tu_string; struct membuf { membuf(); membuf(const void* data, int size); membuf(const membuf& buf); membuf(const tu_string& str); ~membuf(); // Construct a read-only membuf that points at the given data, // instead of copying it. enum read_only_enum { READ_ONLY }; membuf(read_only_enum e, const void* data, int size); int size() const { return m_size; } const void* data() const { return m_data; } void* data() { assert(!m_read_only); return m_data; } // Don't call these mutators on read-only membufs. void resize(int new_size); void append(const void* data, int size); void append(const membuf& buf); void append(Uint8 byte); // We do not append the terminating '\0'. void append(const tu_string& str); Uint8& operator[](int index); const Uint8& operator[](int index) const; void operator=(const membuf& buf); bool operator==(const membuf& buf) const; bool operator!=(const membuf& buf) const; private: int m_size; int m_capacity; void* m_data; bool m_read_only; }; #endif // MEMBUF_H // Local Variables: // mode: C++ // c-basic-offset: 8 // tab-width: 8 // indent-tabs-mode: t // End:
/* * Copyright (C) 2000, 2001, 2004-2007, 2014, 2016 Internet Systems Consortium, Inc. ("ISC") * * 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/. */ /* $Id: lwresd.h,v 1.19 2007/06/19 23:46:59 tbox Exp $ */ #ifndef NAMED_LWRESD_H #define NAMED_LWRESD_H 1 /*! \file */ #include <isc/types.h> #include <isc/sockaddr.h> #include <isccfg/cfg.h> #include <dns/types.h> struct ns_lwresd { unsigned int magic; isc_mutex_t lock; dns_view_t *view; ns_lwsearchlist_t *search; unsigned int ndots; unsigned int ntasks; unsigned int nclients; isc_mem_t *mctx; isc_boolean_t shutting_down; unsigned int refs; }; struct ns_lwreslistener { unsigned int magic; isc_mutex_t lock; isc_mem_t *mctx; isc_sockaddr_t address; ns_lwresd_t *manager; isc_socket_t *sock; unsigned int refs; ISC_LIST(ns_lwdclientmgr_t) cmgrs; ISC_LINK(ns_lwreslistener_t) link; }; /*% * Configure lwresd. */ isc_result_t ns_lwresd_configure(isc_mem_t *mctx, const cfg_obj_t *config); isc_result_t ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx, cfg_obj_t **configp); /*% * Trigger shutdown. */ void ns_lwresd_shutdown(void); /* * Manager functions */ /*% create manager */ isc_result_t ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres, ns_lwresd_t **lwresdp); /*% attach to manager */ void ns_lwdmanager_attach(ns_lwresd_t *source, ns_lwresd_t **targetp); /*% detach from manager */ void ns_lwdmanager_detach(ns_lwresd_t **lwresdp); /* * Listener functions */ /*% attach to listener */ void ns_lwreslistener_attach(ns_lwreslistener_t *source, ns_lwreslistener_t **targetp); /*% detach from lister */ void ns_lwreslistener_detach(ns_lwreslistener_t **listenerp); /*% link client manager */ void ns_lwreslistener_unlinkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm); /*% unlink client manager */ void ns_lwreslistener_linkcm(ns_lwreslistener_t *listener, ns_lwdclientmgr_t *cm); /* * INTERNAL FUNCTIONS. */ void * ns__lwresd_memalloc(void *arg, size_t size); void ns__lwresd_memfree(void *arg, void *mem, size_t size); #endif /* NAMED_LWRESD_H */
#include "globals.h" #include "local_proto.h" int edge(int x0, int y0, int x1, int y1) { float m; float x; if (y0 == y1) return 0; x = x0; m = (float)(x0 - x1) / (float)(y0 - y1); if (y0 < y1) while (++y0 < y1) { x0 = (x += m) + .5; edge_point(x0, y0); } else while (--y0 > y1) { x0 = (x -= m) + .5; edge_point(x0, y0); } return 0; }
#ifndef SPACENAVIGATORDRIVER_H #define SPACENAVIGATORDRIVER_H #ifndef BALL_COMMON_GLOBAL_H # include <BALL/COMMON/global.h> #endif #include <BALL/VIEW/INPUT/inputDeviceDriver.h> #include <QtCore/QThread> namespace BALL { namespace VIEW { class SpaceNavigatorDriver : public InputDeviceDriver, protected QThread { public: SpaceNavigatorDriver(QWidget* receiver); bool setUp(); bool tearDown(); void setEnabled(bool enabled); private: void run(); int deadzone(int x); }; } } #endif //SPACENAVIGATORDRIVER_H
/* Copyright (C) 2009 William Hart Copyright (C) 2010 Sebastian Pancratz Copyright (C) 2011 Fredrik Johansson 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 "fmpz.h" #include "fmpq_poly.h" #include "fmpq_poly.h" #include "ulong_extras.h" int main(void) { int i, result; ulong cflags = UWORD(0); FLINT_TEST_INIT(state); flint_printf("invsqrt_series...."); fflush(stdout); /* Check aliasing of a and c */ for (i = 0; i < 50 * flint_test_multiplier(); i++) { fmpq_poly_t a, b; slong n = n_randint(state, 50) + 1; fmpq_poly_init(a); fmpq_poly_init(b); fmpq_poly_randtest_not_zero(a, state, n_randint(state, 50) + 1, 50); fmpq_poly_set_coeff_ui(a, 0, UWORD(1)); fmpq_poly_canonicalise(a); fmpq_poly_invsqrt_series(b, a, n); fmpq_poly_invsqrt_series(a, a, n); cflags |= fmpq_poly_is_canonical(a) ? 0 : 1; cflags |= fmpq_poly_is_canonical(b) ? 0 : 2; result = (fmpq_poly_equal(a, b) && !cflags); if (!result) { flint_printf("FAIL:\n"); fmpq_poly_debug(a), flint_printf("\n\n"); fmpq_poly_debug(b), flint_printf("\n\n"); flint_printf("cflags = %wu\n\n", cflags); abort(); } fmpq_poly_clear(a); fmpq_poly_clear(b); } /* Check 1/((1/sqrt(a))^2) = a */ for (i = 0; i < 50 * flint_test_multiplier(); i++) { fmpq_poly_t a, b, c; slong n = n_randint(state, 80) + 1; fmpq_poly_init(a); fmpq_poly_init(b); fmpq_poly_init(c); fmpq_poly_randtest_not_zero(a, state, n_randint(state, 80) + 1, 80); fmpq_poly_set_coeff_ui(a, 0, UWORD(1)); fmpq_poly_invsqrt_series(b, a, n); fmpq_poly_mullow(c, b, b, n); fmpq_poly_inv_series(c, c, n); fmpq_poly_truncate(a, n); cflags |= fmpq_poly_is_canonical(b) ? 0 : 1; result = (fmpq_poly_equal(c, a) && !cflags); if (!result) { flint_printf("FAIL:\n"); flint_printf("a = "), fmpq_poly_debug(a), flint_printf("\n\n"); flint_printf("b = "), fmpq_poly_debug(b), flint_printf("\n\n"); flint_printf("c = "), fmpq_poly_debug(c), flint_printf("\n\n"); flint_printf("cflags = %wu\n\n", cflags); abort(); } fmpq_poly_clear(a); fmpq_poly_clear(b); fmpq_poly_clear(c); } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Designer 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$ ** ****************************************************************************/ #ifndef Q3LISTBOX_PLUGIN_H #define Q3LISTBOX_PLUGIN_H #include <QtDesigner/QDesignerCustomWidgetInterface> QT_BEGIN_NAMESPACE class Q3ListBoxPlugin: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: explicit Q3ListBoxPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; virtual QString toolTip() const; virtual QString whatsThis() const; virtual QString includeFile() const; virtual QIcon icon() const; virtual bool isContainer() const; virtual QWidget *createWidget(QWidget *parent); virtual bool isInitialized() const; virtual void initialize(QDesignerFormEditorInterface *core); virtual QString codeTemplate() const; virtual QString domXml() const; private: bool m_initialized; QIcon m_icon; }; QT_END_NAMESPACE #endif // Q3LISTBOX_PLUGIN_H
// --------------------------------------------------------------------- // // Copyright (C) 1999 - 2017 by the deal.II authors // // This file is part of the deal.II library. // // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // Public License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // The full text of the license can be found in the file LICENSE at // the top level of the deal.II distribution. // // --------------------------------------------------------------------- #ifndef dealii_tensor_function_templates_h #define dealii_tensor_function_templates_h #include <deal.II/base/tensor_function.h> #include <deal.II/base/tensor.h> #include <deal.II/lac/vector.h> #include <vector> #include <cmath> DEAL_II_NAMESPACE_OPEN template <int rank, int dim, typename Number> TensorFunction<rank, dim, Number>::TensorFunction (const Number initial_time) : FunctionTime<Number> (initial_time) {} template <int rank, int dim, typename Number> typename TensorFunction<rank, dim, Number>::value_type TensorFunction<rank, dim, Number>::value (const Point<dim> &) const { Assert (false, ExcPureFunctionCalled()); return Tensor<rank,dim, Number>(); } template <int rank, int dim, typename Number> void TensorFunction<rank, dim, Number>::value_list ( const std::vector<Point<dim> > &points, std::vector<value_type> &values) const { Assert (values.size() == points.size(), ExcDimensionMismatch(values.size(), points.size())); for (unsigned int i=0; i<points.size(); ++i) values[i] = this->value (points[i]); } template <int rank, int dim, typename Number> typename TensorFunction<rank, dim, Number>::gradient_type TensorFunction<rank, dim, Number>::gradient (const Point<dim> &) const { Assert (false, ExcPureFunctionCalled()); return Tensor<rank+1,dim, Number>(); } template <int rank, int dim, typename Number> void TensorFunction<rank, dim, Number>::gradient_list ( const std::vector<Point<dim> > &points, std::vector<gradient_type> &gradients) const { Assert (gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); for (unsigned int i=0; i<points.size(); ++i) gradients[i] = gradient(points[i]); } template <int rank, int dim, typename Number> ConstantTensorFunction<rank, dim, Number>::ConstantTensorFunction ( const Tensor<rank, dim, Number> &value, const Number initial_time) : TensorFunction<rank, dim, Number> (initial_time), _value(value) {} template <int rank, int dim, typename Number> typename TensorFunction<rank, dim, Number>::value_type ConstantTensorFunction<rank, dim, Number>::value ( const Point<dim> &/*point*/) const { return _value; } template <int rank, int dim, typename Number> void ConstantTensorFunction<rank, dim, Number>::value_list ( const std::vector<Point<dim> > &points, std::vector<typename TensorFunction<rank, dim, Number>::value_type> &values) const { (void)points; Assert (values.size() == points.size(), ExcDimensionMismatch(values.size(), points.size())); for (unsigned int i=0; i<values.size(); ++i) values[i] = _value; } template <int rank, int dim, typename Number> typename TensorFunction<rank, dim, Number>::gradient_type ConstantTensorFunction<rank, dim, Number>::gradient (const Point<dim> &) const { static const Tensor<rank+1, dim, Number> zero; return zero; } template <int rank, int dim, typename Number> void ConstantTensorFunction<rank, dim, Number>::gradient_list ( const std::vector<Point<dim> > &points, std::vector<typename TensorFunction<rank, dim, Number>::gradient_type> &gradients) const { (void)points; Assert (gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); static const Tensor<rank+1, dim, Number> zero; for (unsigned int i=0; i<gradients.size(); ++i) gradients[i] = zero; } template <int rank, int dim, typename Number> ZeroTensorFunction<rank, dim, Number>::ZeroTensorFunction (const Number initial_time) : ConstantTensorFunction<rank, dim, Number> (dealii::Tensor<rank, dim, Number>(), initial_time) {} DEAL_II_NAMESPACE_CLOSE #endif /* dealii_tensor_function_templates_h */
#include <cgreen/cgreen.h> #include <cgreen/mocks.h> #include "words.h" #include <string.h> Ensure(word_count_is_returned_from_split) { char *sentence = strdup("Birds of a feather"); int word_count = split_words(sentence); assert_that(word_count, is_equal_to(4)); free(sentence); } Ensure(spaces_are_converted_to_zeroes) { char *sentence = strdup("Birds of a feather"); split_words(sentence); int comparison = memcmp("Birds\0of\0a\0feather", sentence, strlen(sentence)); assert_that(comparison, is_equal_to(0)); free(sentence); } TestSuite *words_tests() { TestSuite *suite = create_test_suite(); add_test(suite, word_count_is_returned_from_split); add_test(suite, spaces_are_converted_to_zeroes); return suite; }
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. // // --------------------------------------------------------------------------- // // This file was generated by the CEF translator tool. If making changes by // hand only do so within the body of existing method and function // implementations. See the translator.README.txt file in the tools directory // for more information. // #ifndef CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_ #define CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_ #pragma once #ifndef USING_CEF_SHARED #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") #else // USING_CEF_SHARED #include "include/cef_auth_callback.h" #include "include/capi/cef_auth_callback_capi.h" #include "libcef_dll/ctocpp/ctocpp.h" // Wrap a C structure with a C++ class. // This class may be instantiated and accessed wrapper-side only. class CefAuthCallbackCToCpp : public CefCToCpp<CefAuthCallbackCToCpp, CefAuthCallback, cef_auth_callback_t> { public: explicit CefAuthCallbackCToCpp(cef_auth_callback_t* str) : CefCToCpp<CefAuthCallbackCToCpp, CefAuthCallback, cef_auth_callback_t>( str) {} virtual ~CefAuthCallbackCToCpp() {} // CefAuthCallback methods virtual void Continue(const CefString& username, const CefString& password) OVERRIDE; virtual void Cancel() OVERRIDE; }; #endif // USING_CEF_SHARED #endif // CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_
/** * @file llunits.h * @brief Unit definitions * * $LicenseInfo:firstyear=2001&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 LL_LLUNITTYPE_H #define LL_LLUNITTYPE_H #include "stdtypes.h" #include "llunittype.h" // // Unit declarations // namespace LLUnits { LL_DECLARE_BASE_UNIT(Bytes, "B"); // technically, these are kibibytes, mibibytes, etc. but we should stick with commonly accepted terminology LL_DECLARE_DERIVED_UNIT(Kilobytes, "KB", Bytes, / 1024); LL_DECLARE_DERIVED_UNIT(Megabytes, "MB", Kilobytes, / 1024); LL_DECLARE_DERIVED_UNIT(Gigabytes, "GB", Megabytes, / 1024); } LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bytes); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobytes); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabytes); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabytes); namespace LLUnits { // technically, these are kibibits, mibibits, etc. but we should stick with commonly accepted terminology LL_DECLARE_DERIVED_UNIT(Bits, "b", Bytes, * 8 ); LL_DECLARE_DERIVED_UNIT(Kilobits, "Kb", Bits, / 1024); LL_DECLARE_DERIVED_UNIT(Megabits, "Mb", Kilobits, / 1024); LL_DECLARE_DERIVED_UNIT(Gigabits, "Gb", Megabits, / 1024); } LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bits); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobits); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabits); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabits); namespace LLUnits { LL_DECLARE_BASE_UNIT(Seconds, "s"); LL_DECLARE_DERIVED_UNIT(Minutes, "min", Seconds, / 60); LL_DECLARE_DERIVED_UNIT(Hours, "h", Minutes, / 60); LL_DECLARE_DERIVED_UNIT(Days, "d", Hours, / 24); LL_DECLARE_DERIVED_UNIT(Milliseconds, "ms", Seconds, * 1000); LL_DECLARE_DERIVED_UNIT(Microseconds, "\x09\x3cs", Milliseconds, * 1000); LL_DECLARE_DERIVED_UNIT(Nanoseconds, "ns", Microseconds, * 1000); } LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Seconds); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Minutes); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hours); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Days); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Milliseconds); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Microseconds); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Nanoseconds); namespace LLUnits { LL_DECLARE_BASE_UNIT(Meters, "m"); LL_DECLARE_DERIVED_UNIT(Kilometers, "km", Meters, / 1000); LL_DECLARE_DERIVED_UNIT(Centimeters, "cm", Meters, * 100); LL_DECLARE_DERIVED_UNIT(Millimeters, "mm", Meters, * 1000); } LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Meters); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilometers); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Centimeters); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Millimeters); namespace LLUnits { // rare units LL_DECLARE_BASE_UNIT(Hertz, "Hz"); LL_DECLARE_DERIVED_UNIT(Kilohertz, "KHz", Hertz, / 1000); LL_DECLARE_DERIVED_UNIT(Megahertz, "MHz", Kilohertz, / 1000); LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, / 1000); LL_DECLARE_BASE_UNIT(Radians, "rad"); LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 57.29578f); LL_DECLARE_BASE_UNIT(Percent, "%"); LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100); LL_DECLARE_BASE_UNIT(Triangles, "tris"); LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, / 1000); } // namespace LLUnits // rare units LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hertz); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilohertz); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megahertz); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigahertz); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Radians); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Degrees); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Percent); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Ratio); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Triangles); LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilotriangles); #endif // LL_LLUNITTYPE_H
/* GIO - GLib Input, Output and Streaming Library * * Copyright (C) 2006-2007 Red Hat, 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; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 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., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * Author: Alexander Larsson <alexl@redhat.com> */ #include <config.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <glib.h> #include <glib/gi18n.h> #include "gvfswritechannel.h" #include "gvfsjobclosewrite.h" #include "gvfsdaemonutils.h" G_DEFINE_TYPE (GVfsJobCloseWrite, g_vfs_job_close_write, G_VFS_TYPE_JOB) static void run (GVfsJob *job); static gboolean try (GVfsJob *job); static void send_reply (GVfsJob *job); static void g_vfs_job_close_write_finalize (GObject *object) { GVfsJobCloseWrite *job; job = G_VFS_JOB_CLOSE_WRITE (object); g_object_unref (job->channel); g_free (job->etag); if (G_OBJECT_CLASS (g_vfs_job_close_write_parent_class)->finalize) (*G_OBJECT_CLASS (g_vfs_job_close_write_parent_class)->finalize) (object); } static void g_vfs_job_close_write_class_init (GVfsJobCloseWriteClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GVfsJobClass *job_class = G_VFS_JOB_CLASS (klass); gobject_class->finalize = g_vfs_job_close_write_finalize; job_class->run = run; job_class->try = try; job_class->send_reply = send_reply; } static void g_vfs_job_close_write_init (GVfsJobCloseWrite *job) { } GVfsJob * g_vfs_job_close_write_new (GVfsWriteChannel *channel, GVfsBackendHandle handle, GVfsBackend *backend) { GVfsJobCloseWrite *job; job = g_object_new (G_VFS_TYPE_JOB_CLOSE_WRITE, NULL); job->channel = g_object_ref (channel); job->backend = backend; job->handle = handle; return G_VFS_JOB (job); } void g_vfs_job_close_write_set_etag (GVfsJobCloseWrite *job, const char *etag) { job->etag = g_strdup (etag); } /* Might be called on an i/o thwrite */ static void send_reply (GVfsJob *job) { GVfsJobCloseWrite *op_job = G_VFS_JOB_CLOSE_WRITE (job); g_debug ("job_close_write send reply\n"); if (job->failed) g_vfs_channel_send_error (G_VFS_CHANNEL (op_job->channel), job->error); else g_vfs_write_channel_send_closed (op_job->channel, op_job->etag ? op_job->etag : ""); } static void run (GVfsJob *job) { GVfsJobCloseWrite *op_job = G_VFS_JOB_CLOSE_WRITE (job); GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); if (class->close_write == NULL) { g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Operation not supported by backend")); return; } class->close_write (op_job->backend, op_job, op_job->handle); } static gboolean try (GVfsJob *job) { GVfsJobCloseWrite *op_job = G_VFS_JOB_CLOSE_WRITE (job); GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); if (class->try_close_write == NULL) return FALSE; return class->try_close_write (op_job->backend, op_job, op_job->handle); }
// --------------------------------------------------------------------- // // Copyright (C) 2008 - 2013 by the deal.II authors // // This file is part of the deal.II library. // // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // Public License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // The full text of the license can be found in the file LICENSE at // the top level of the deal.II distribution. // // --------------------------------------------------------------------- // check #include "../tests.h" #include <deal.II/lac/trilinos_sparsity_pattern.h> #include "../lac/testmatrix.h" const unsigned int N = 15; // reinitialize sparsity patterns for 5-point star void do_reinit (TrilinosWrappers::SparsityPattern &sp) { sp.reinit((N-1)*(N-1), (N-1)*(N-1)); } void build_sparsity (TrilinosWrappers::SparsityPattern &sparsity_pattern) { // generate usual 5-point sparsity pattern do_reinit (sparsity_pattern); FDMatrix(N,N).five_point_structure (sparsity_pattern); sparsity_pattern.compress (); deallog << sparsity_pattern.n_rows() << " " << sparsity_pattern.n_cols() << " " << sparsity_pattern.bandwidth() << " " << sparsity_pattern.n_nonzero_elements() << std::endl; } void row_length () { TrilinosWrappers::SparsityPattern sparsity_pattern; build_sparsity (sparsity_pattern); for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i) deallog << sparsity_pattern.row_length(i) << std::endl; deallog << "OK" << std::endl; } void print_gnuplot () { TrilinosWrappers::SparsityPattern sparsity_pattern; build_sparsity (sparsity_pattern); sparsity_pattern.print_gnuplot(deallog.get_file_stream()); deallog << "OK" << std::endl; } void print () { TrilinosWrappers::SparsityPattern sparsity_pattern; build_sparsity (sparsity_pattern); sparsity_pattern.print(deallog.get_file_stream()); deallog << "OK" << std::endl; }
/* Copyright (C) 2009 William Hart Copyright (C) 2010 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 <gmp.h> #include "flint.h" #include "ulong_extras.h" mp_limb_t n_pow(mp_limb_t n, ulong exp) { ulong i; mp_limb_t res; res = UWORD(1); for (i = 0; i < exp; i++) res *= n; return res; }
/* * LibCGI base64 manipulation functions is extremely based on the work of Bob Tower, * from its projec http://base64.sourceforge.net. The functions were a bit modicated. * * Copyright (c) 2001 Bob Trower, Trantor Standard Systems Inc. * * SPDX-License-Identifier: MIT * License-Filename: LICENSES/MIT.txt */ #include <stdlib.h> #include <string.h> #include "libcgi/error.h" static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; void encodeblock( unsigned char in[3], unsigned char out[4], int len ) { out[0] = cb64[ in[0] >> 2 ]; out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; out[2] = (unsigned char) (len > 1 ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='); out[3] = (unsigned char) (len > 2 ? cb64[ in[2] & 0x3f ] : '='); } void decodeblock( unsigned char in[4], unsigned char out[3] ) { out[0] = (unsigned char ) (in[0] << 2 | in[1] >> 4); out[1] = (unsigned char ) (in[1] << 4 | in[2] >> 2); out[2] = (unsigned char ) (((in[2] << 6) & 0xc0) | in[3]); } /** * @ingroup libcgi_string */ /** * Encodes a given string to its base64 form. * * @param *str String to convert * @return Base64 encoded String * @see str_base64_decode **/ char *str_base64_encode(char *str) { unsigned char in[3], out[4]; unsigned int i, len, blocksout = 0, linesize = strlen(str); char *tmp = str; char *result = (char *)malloc((linesize + 3 - linesize % 3) * 4 / 3 + 1); if (!result) libcgi_error(E_MEMORY, "Failed to alloc memory at base64.c"); while (*tmp) { len = 0; for( i = 0; i < 3; i++ ) { in[i] = (unsigned char)(*tmp); if (*tmp) len++; else in[i] = 0; tmp++; } if( len ) { encodeblock( in, out, len); for( i = 0; i < 4; i++ ) result[blocksout++] = out[i]; } } result[blocksout] = '\0'; return result; } /** * @ingroup libcgi_string */ /** * Decode a base64 encoded string. * * @param *str Encoded String to decode * @return The decoded string * @see str_base64_encode **/ char *str_base64_decode(char *str) { unsigned char in[4], out[3], v; unsigned int i, len, pos = 0; char *tmp = str; char *result = (char *)malloc(strlen(str) + 1); if (!result) libcgi_error(E_MEMORY, "Failed to alloc memory at base64.c"); while(*tmp) { for( len = 0, i = 0; i < 4 && *tmp; i++ ) { v = 0; while(*tmp && v == 0 ) { v = (unsigned char)(*tmp); v = (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]); if( v ) v = (unsigned char) ((v == '$') ? 0 : v - 61); tmp++; } if(*tmp) { len++; if( v ) in[i] = (unsigned char) (v - 1); } else in[i] = 0; } if(len) { decodeblock( in, out ); for( i = 0; i < len - 1; i++ ) result[pos++] = out[i]; } } result[pos] = '\0'; return result; }
/* Copyright (C) 2013 Mike Hansen 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 "fq_zech_poly.h" #ifdef T #undef T #endif #define T fq_zech #define CAP_T FQ_ZECH #include "fq_poly_factor_templates/test/t-factor_cantor_zassenhaus.c" #undef CAP_T #undef T
/* * This file is part of Cockpit. * * Copyright (C) 2013 Red Hat, Inc. * * Cockpit 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. * * Cockpit 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 Cockpit; If not, see <http://www.gnu.org/licenses/>. */ #ifndef __COCKPIT_WEB_SERVER_H__ #define __COCKPIT_WEB_SERVER_H__ #include <gio/gio.h> G_BEGIN_DECLS #define COCKPIT_TYPE_WEB_SERVER (cockpit_web_server_get_type ()) G_DECLARE_FINAL_TYPE(CockpitWebServer, cockpit_web_server, COCKPIT, WEB_SERVER, GObject) extern guint cockpit_webserver_request_timeout; typedef enum { COCKPIT_WEB_SERVER_NONE = 0, COCKPIT_WEB_SERVER_FOR_TLS_PROXY = 1 << 0, /* http → https redirection for non-localhost addresses */ COCKPIT_WEB_SERVER_REDIRECT_TLS = 1 << 1, /* http → https redirection for reverse proxy setups: Look at Host: header instead of connection IP */ COCKPIT_WEB_SERVER_REDIRECT_TLS_PROXY = 1 << 2, COCKPIT_WEB_SERVER_FLAGS_MAX = 1 << 3 } CockpitWebServerFlags; CockpitWebServer * cockpit_web_server_new (const gchar *address, gint port, GTlsCertificate *certificate, CockpitWebServerFlags flags, GCancellable *cancellable, GError **error); void cockpit_web_server_start (CockpitWebServer *self); gboolean cockpit_web_server_add_socket (CockpitWebServer *self, GSocket *socket, GError **error); GHashTable * cockpit_web_server_new_table (void); gchar * cockpit_web_server_parse_cookie (GHashTable *headers, const gchar *name); gchar ** cockpit_web_server_parse_languages (GHashTable *headers, const gchar *first); gboolean cockpit_web_server_get_socket_activated (CockpitWebServer *self); gint cockpit_web_server_get_port (CockpitWebServer *self); CockpitWebServerFlags cockpit_web_server_get_flags (CockpitWebServer *self); G_END_DECLS #endif /* __COCKPIT_WEB_SERVER_H__ */
/* vi: set sw=4 ts=4: */ /* * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org> * * GNU Lesser General Public License version 2.1 or later. */ #ifndef _LD_HASH_H_ #define _LD_HASH_H_ #ifndef RTLD_NEXT #define RTLD_NEXT ((void*)-1) #endif struct init_fini { struct elf_resolve **init_fini; unsigned long nlist; /* Number of entries in init_fini */ }; struct dyn_elf { struct elf_resolve * dyn; struct dyn_elf * next_handle; /* Used by dlopen et al. */ struct init_fini init_fini; struct dyn_elf * next; struct dyn_elf * prev; }; struct elf_resolve { /* These entries must be in this order to be compatible with the interface used by gdb to obtain the list of symbols. */ DL_LOADADDR_TYPE loadaddr; /* Base address shared object is loaded at. */ char *libname; /* Absolute file name object was found in. */ ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */ struct elf_resolve * next; struct elf_resolve * prev; /* Nothing after this address is used by gdb. */ DL_LOADADDR_TYPE mapaddr; /* Address at which ELF segments (either main app and DSO) are mapped into */ enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype; struct dyn_elf * symbol_scope; unsigned short usage_count; unsigned short int init_flag; unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */ Elf_Symndx nbucket; Elf_Symndx *elf_buckets; struct init_fini_list *init_fini; struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */ /* * These are only used with ELF style shared libraries */ Elf_Symndx nchain; Elf_Symndx *chains; unsigned long dynamic_info[DYNAMIC_SIZE]; unsigned long n_phent; ElfW(Phdr) * ppnt; ElfW(Addr) relro_addr; size_t relro_size; dev_t st_dev; /* device */ ino_t st_ino; /* inode */ #ifdef __powerpc__ /* this is used to store the address of relocation data words, so * we don't have to calculate it every time, which requires a divide */ unsigned long data_words; #endif }; #define RELOCS_DONE 0x000001 #define JMP_RELOCS_DONE 0x000002 #define INIT_FUNCS_CALLED 0x000004 #define FINI_FUNCS_CALLED 0x000008 #define DL_OPENED 0x000010 extern struct dyn_elf * _dl_symbol_tables; extern struct elf_resolve * _dl_loaded_modules; extern struct dyn_elf * _dl_handles; extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, DL_LOADADDR_TYPE loadaddr, unsigned long * dynamic_info, unsigned long dynamic_addr, unsigned long dynamic_size); extern char * _dl_find_hash(const char * name, struct dyn_elf * rpnt1, struct elf_resolve *mytpnt, int type_class); extern int _dl_linux_dynamic_link(void); extern char * _dl_library_path; extern char * _dl_not_lazy; static inline int _dl_symbol(char * name) { if (name[0] != '_' || name[1] != 'd' || name[2] != 'l' || name[3] != '_') return 0; return 1; } #define LD_ERROR_NOFILE 1 #define LD_ERROR_NOZERO 2 #define LD_ERROR_NOTELF 3 #define LD_ERROR_NOTMAGIC 4 #define LD_ERROR_NOTDYN 5 #define LD_ERROR_MMAP_FAILED 6 #define LD_ERROR_NODYNAMIC 7 #define LD_WRONG_RELOCS 8 #define LD_BAD_HANDLE 9 #define LD_NO_SYMBOL 10 #endif /* _LD_HASH_H_ */
/* Copyright (C) 2011 Fredrik Johansson 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 "fmpz_mat.h" void fmpz_mat_multi_CRT_ui_precomp(fmpz_mat_t mat, nmod_mat_t * const residues, slong nres, const fmpz_comb_t comb, fmpz_comb_temp_t temp, int sign) { slong i, j, k; mp_ptr r; r = _nmod_vec_init(nres); for (i = 0; i < fmpz_mat_nrows(mat); i++) { for (j = 0; j < fmpz_mat_ncols(mat); j++) { for (k = 0; k < nres; k++) r[k] = nmod_mat_entry(residues[k], i, j); fmpz_multi_CRT_ui(fmpz_mat_entry(mat, i, j), r, comb, temp, sign); } } _nmod_vec_clear(r); } void fmpz_mat_multi_CRT_ui(fmpz_mat_t mat, nmod_mat_t * const residues, slong nres, int sign) { fmpz_comb_t comb; fmpz_comb_temp_t temp; mp_ptr primes; slong i; primes = _nmod_vec_init(nres); for (i = 0; i < nres; i++) primes[i] = residues[i]->mod.n; fmpz_comb_init(comb, primes, nres); fmpz_comb_temp_init(temp, comb); fmpz_mat_multi_CRT_ui_precomp(mat, residues, nres, comb, temp, sign); fmpz_comb_clear(comb); fmpz_comb_temp_clear(temp); _nmod_vec_clear(primes); }
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $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$ ** ****************************************************************************/ #ifndef EVR9VIDEOWINDOWCONTROL_H #define EVR9VIDEOWINDOWCONTROL_H #include "../../src/multimedia/qvideowindowcontrol.h" #include <Mfidl.h> #include <d3d9.h> #include <Evr9.h> QT_USE_NAMESPACE class Evr9VideoWindowControl : public QVideoWindowControl { Q_OBJECT public: Evr9VideoWindowControl(QObject *parent = 0); ~Evr9VideoWindowControl(); WId winId() const; void setWinId(WId id); QRect displayRect() const; void setDisplayRect(const QRect &rect); bool isFullScreen() const; void setFullScreen(bool fullScreen); void repaint(); QSize nativeSize() const; Qt::AspectRatioMode aspectRatioMode() const; void setAspectRatioMode(Qt::AspectRatioMode mode); int brightness() const; void setBrightness(int brightness); int contrast() const; void setContrast(int contrast); int hue() const; void setHue(int hue); int saturation() const; void setSaturation(int saturation); IMFActivate* currentActivate() const; private: void setProcAmpValues(); DXVA2_Fixed32 scaleProcAmpValue(DWORD prop, int value) const; WId m_windowId; COLORREF m_windowColor; DWORD m_dirtyValues; Qt::AspectRatioMode m_aspectRatioMode; QRect m_displayRect; int m_brightness; int m_contrast; int m_hue; int m_saturation; bool m_fullScreen; IMFActivate *m_currentActivate; IMFMediaSink *m_evrSink; IMFVideoDisplayControl *m_displayControl; IMFVideoProcessor *m_processor; }; #endif
/**************************************************************************** ** ** 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_ApplyTemplate_H #define Patternist_ApplyTemplate_H #include "qtemplatemode_p.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE namespace QPatternist { /** * @short When combined with other components, implements * @c xsl:apply-templates. * * Note that ApplyTemplate isn't named ApplyTemplates. The reason for this * is that ApplyTemplate doesn't do the iteration part. An @c * <xsl:apply-templates/> instruction is rewritten into: * * @code * child::node/() map apply-template() * @endcode * * Hence, this expression requires a focus, although it can consist of * atomic values. * * @since 4.5 * @author Frans Englich <frans.englich@nokia.com> * @ingroup Patternist_expressions */ class ApplyTemplate : public TemplateInvoker { public: typedef QExplicitlySharedDataPointer<ApplyTemplate> Ptr; /** * @short @p mode may be @c null. If it is, ApplyTemplate interprets * that as that it should use the #current mode. * * @see StaticContext::currentTemplateMode() */ ApplyTemplate(const TemplateMode::Ptr &mode, const WithParam::Hash &withParams, const TemplateMode::Ptr &defaultMode); virtual Item::Iterator::Ptr evaluateSequence(const DynamicContext::Ptr &context) const; virtual SequenceType::Ptr staticType() const; virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const; virtual Properties properties() const; /** * The only reason this function exists, is in order to convert * QXmlNodeModelIndex to QPatternist::Item. So, this is a huge * performance setback. It applies for one of the builtin templates. */ inline Item mapToItem(const QXmlNodeModelIndex &node, const DynamicContext::Ptr &context) const; inline Item::Iterator::Ptr mapToSequence(const Item &item, const DynamicContext::Ptr &context) const; inline TemplateMode::Ptr mode() const; virtual bool configureRecursion(const CallTargetDescription::Ptr &sign); virtual Expression::Ptr body() const; virtual CallTargetDescription::Ptr callTargetDescription() const; Expression::Ptr compress(const StaticContext::Ptr &context); private: typedef QExplicitlySharedDataPointer<const ApplyTemplate> ConstPtr; Template::Ptr findTemplate(const DynamicContext::Ptr &context, const TemplateMode::Ptr &templateMode) const; /** * @note You typically want to use effectiveMode(). */ const TemplateMode::Ptr m_mode; TemplateMode::Ptr m_defaultMode; inline TemplateMode::Ptr effectiveMode(const DynamicContext::Ptr &context) const; }; TemplateMode::Ptr ApplyTemplate::mode() const { return m_mode; } } QT_END_NAMESPACE QT_END_HEADER #endif
#include <clutter/clutter.h> #include "clutter-box2d.h" #include "blockbox.h" static void paint_circle (ClutterActor *actor) { gfloat radius = MIN (clutter_actor_get_width (actor), clutter_actor_get_height (actor)) / 2.f; cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff); cogl_path_arc (radius, radius, radius, radius, 0, 360); cogl_path_fill (); } static ClutterActor * create_circle (gfloat radius) { const ClutterColor transp = { 0, }; ClutterActor *circle = clutter_rectangle_new_with_color (&transp); clutter_actor_set_size (circle, radius * 2, radius * 2); g_signal_connect (circle, "paint", G_CALLBACK (paint_circle), NULL); return circle; } void scene_pulley_joint (Scene *scene) { ClutterActor *stage; ClutterActor *box2d; stage = clutter_stage_get_default (); box2d = clutter_box2d_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), box2d); scene->group = box2d; add_cage (box2d, FALSE); { ClutterVertex v1, v2, v3; ClutterActor *joint1, *joint2, *box1, *box2; /* Create platform 1 */ joint1 = create_circle (10); clutter_actor_set_position (joint1, 110, 250); clutter_container_add_actor (CLUTTER_CONTAINER (box2d), joint1); clutter_box2d_child_set_is_circle (CLUTTER_BOX2D (box2d), joint1, TRUE); clutter_box2d_child_set_mode (CLUTTER_BOX2D (box2d), joint1, CLUTTER_BOX2D_DYNAMIC); clutter_box2d_child_set_manipulatable (CLUTTER_BOX2D (box2d), joint1, TRUE); box1 = clutter_rectangle_new (); clutter_actor_set_size (box1, 200, 20); clutter_actor_set_position (box1, 10, 350); clutter_container_add_actor (CLUTTER_CONTAINER (box2d), box1); clutter_box2d_child_set_mode (CLUTTER_BOX2D (box2d), box1, CLUTTER_BOX2D_DYNAMIC); clutter_box2d_child_set_manipulatable (CLUTTER_BOX2D (box2d), box1, TRUE); add_hand (box2d, 20, 350 - 62); add_hand (box2d, 210 - 58, 350 - 62); v1 = (ClutterVertex){10, 10, 0}; v2 = (ClutterVertex){0, 0, 0}; v3 = (ClutterVertex){200, 0, 0}; clutter_box2d_add_distance_joint (CLUTTER_BOX2D (box2d), joint1, box1, &v1, &v2, 150, 0, 0); clutter_box2d_add_distance_joint (CLUTTER_BOX2D (box2d), joint1, box1, &v1, &v3, 150, 0, 0); /* Create platform 2 */ joint2 = create_circle (10); clutter_actor_set_position (joint2, 530, 250); clutter_container_add_actor (CLUTTER_CONTAINER (box2d), joint2); clutter_box2d_child_set_is_circle (CLUTTER_BOX2D (box2d), joint2, TRUE); clutter_box2d_child_set_mode (CLUTTER_BOX2D (box2d), joint2, CLUTTER_BOX2D_DYNAMIC); clutter_box2d_child_set_manipulatable (CLUTTER_BOX2D (box2d), joint2, TRUE); box2 = clutter_rectangle_new (); clutter_actor_set_size (box2, 200, 20); clutter_actor_set_position (box2, 430, 350); clutter_container_add_actor (CLUTTER_CONTAINER (box2d), box2); clutter_box2d_child_set_mode (CLUTTER_BOX2D (box2d), box2, CLUTTER_BOX2D_DYNAMIC); clutter_box2d_child_set_manipulatable (CLUTTER_BOX2D (box2d), box2, TRUE); add_hand (box2d, 440, 350 - 62); add_hand (box2d, 640 - 58, 350 - 62); clutter_box2d_add_distance_joint (CLUTTER_BOX2D (box2d), joint2, box2, &v1, &v2, 150, 0, 0); clutter_box2d_add_distance_joint (CLUTTER_BOX2D (box2d), joint2, box2, &v1, &v3, 150, 0, 0); /* Create pulley joint */ v1 = (ClutterVertex){ 10, 10, 0 }; v2 = (ClutterVertex){ 120, 50, 0}; v3 = (ClutterVertex){ 540, 50, 0}; clutter_box2d_add_pulley_joint (CLUTTER_BOX2D (box2d), joint1, joint2, &v1, &v1, &v2, &v3, 210, 210, 400, 400, 1.0); } clutter_box2d_set_simulating (CLUTTER_BOX2D (box2d), simulating); }
/* Linuxthreads - a simple clone()-based implementation of Posix */ /* threads for Linux. */ /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU Library General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This 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 Library General Public License for more details. */ /* mods for uClibc: removed strong alias and defined funcs properly */ /* The "atfork" stuff */ #include <errno.h> #ifdef __ARCH_USE_MMU__ #include <bits/uClibc_mutex.h> #include <stddef.h> #include <stdlib.h> #include <unistd.h> #include "pthread.h" #include "internals.h" struct handler_list { void (*handler)(void); struct handler_list * next; }; static pthread_mutex_t pthread_atfork_lock = PTHREAD_MUTEX_INITIALIZER; static struct handler_list * pthread_atfork_prepare = NULL; static struct handler_list * pthread_atfork_parent = NULL; static struct handler_list * pthread_atfork_child = NULL; #ifdef __MALLOC__ __UCLIBC_MUTEX_EXTERN(__malloc_heap_lock); __UCLIBC_MUTEX_EXTERN(__malloc_sbrk_lock); #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ __UCLIBC_MUTEX_EXTERN(__malloc_mmb_heap_lock); #endif #elif defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) __UCLIBC_MUTEX_EXTERN(__malloc_lock); #endif static void pthread_insert_list(struct handler_list ** list, void (*handler)(void), struct handler_list * newlist, int at_end) { if (handler == NULL) return; if (at_end) { while(*list != NULL) list = &((*list)->next); } newlist->handler = handler; newlist->next = *list; *list = newlist; } struct handler_list_block { struct handler_list prepare, parent, child; }; int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) { struct handler_list_block * block = (struct handler_list_block *) malloc(sizeof(struct handler_list_block)); if (block == NULL) return ENOMEM; __pthread_mutex_lock(&pthread_atfork_lock); /* "prepare" handlers are called in LIFO */ pthread_insert_list(&pthread_atfork_prepare, prepare, &block->prepare, 0); /* "parent" handlers are called in FIFO */ pthread_insert_list(&pthread_atfork_parent, parent, &block->parent, 1); /* "child" handlers are called in FIFO */ pthread_insert_list(&pthread_atfork_child, child, &block->child, 1); __pthread_mutex_unlock(&pthread_atfork_lock); return 0; } /*strong_alias (__pthread_atfork, pthread_atfork)*/ static __inline__ void pthread_call_handlers(struct handler_list * list) { for (/*nothing*/; list != NULL; list = list->next) (list->handler)(); } void __pthread_once_fork_prepare(void); void __pthread_once_fork_child(void); void __pthread_once_fork_parent(void); static pid_t __fork(void) { pid_t pid; struct handler_list * prepare, * child, * parent; __pthread_mutex_lock(&pthread_atfork_lock); prepare = pthread_atfork_prepare; child = pthread_atfork_child; parent = pthread_atfork_parent; pthread_call_handlers(prepare); __pthread_once_fork_prepare(); #ifdef __MALLOC__ __pthread_mutex_lock(&__malloc_sbrk_lock); __pthread_mutex_lock(&__malloc_heap_lock); #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ __pthread_mutex_lock(&__malloc_mmb_heap_lock); #endif #elif defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) __pthread_mutex_lock(&__malloc_lock); #endif pid = __libc_fork(); if (pid == 0) { #if defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) __libc_lock_init_recursive(__malloc_lock); #elif defined(__MALLOC__) #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ __libc_lock_init_adaptive(__malloc_mmb_heap_lock); #endif __libc_lock_init_adaptive(__malloc_heap_lock); __libc_lock_init(__malloc_sbrk_lock); #endif __libc_lock_init_adaptive(pthread_atfork_lock); __pthread_reset_main_thread(); __fresetlockfiles(); __pthread_once_fork_child(); pthread_call_handlers(child); } else { #if defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) __pthread_mutex_unlock(&__malloc_lock); #elif defined(__MALLOC__) #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ __pthread_mutex_unlock(&__malloc_mmb_heap_lock); #endif __pthread_mutex_unlock(&__malloc_heap_lock); __pthread_mutex_unlock(&__malloc_sbrk_lock); #endif __pthread_mutex_unlock(&pthread_atfork_lock); __pthread_once_fork_parent(); pthread_call_handlers(parent); } return pid; } strong_alias(__fork,fork) strong_alias(__fork,vfork) #else /* We can't support pthread_atfork without MMU, since we don't have fork(), and we can't offer the correct semantics for vfork(). But instead of failing, just provide a dummy */ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) { return 0; } #endif
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples 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$ ** ****************************************************************************/ #ifndef MANDELBROTWIDGET_H #define MANDELBROTWIDGET_H #include <QPixmap> #include <QWidget> #include "renderthread.h" //! [0] class MandelbrotWidget : public QWidget { Q_OBJECT public: MandelbrotWidget(QWidget *parent = 0); protected: void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *event); void wheelEvent(QWheelEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); private slots: void updatePixmap(const QImage &image, double scaleFactor); private: void zoom(double zoomFactor); void scroll(int deltaX, int deltaY); RenderThread thread; QPixmap pixmap; QPoint pixmapOffset; QPoint lastDragPos; double centerX; double centerY; double pixmapScale; double curScale; }; //! [0] #endif
/* * Lightwave Object version 2 loader for Open Scene Graph * Version 2 introduced in Lightwave v6.0 * * Copyright (C) 2002 Pavel Moloshtan <pasha@moloshtan.com> * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for * real-time rendering of large 3D photo-realistic models. * The OSG homepage is http://www.openscenegraph.org/ */ #ifndef LWO2_H #define LWO2_H 1 #include <vector> #include <map> #include <string> #include <osg/Referenced> #include <osg/Vec2> #include <osg/Vec3> #include <osg/Geometry> #include <osg/Group> #include <osg/Notify> #include <osgDB/fstream> using namespace osg; using namespace std; class Lwo2Layer; struct Lwo2Surface; struct Lwo2PolygonMapping; typedef vector< string >::iterator IteratorString; typedef map< int, Lwo2Layer* >::iterator IteratorLayers; typedef map< string, Lwo2Surface* >::iterator IteratorSurfaces; typedef pair< const short, Lwo2PolygonMapping > PairVMAD; class Lwo2 { public: Lwo2(); ~Lwo2(); bool ReadFile( const string& filename ); bool GenerateGroup( Group& ); private: map< int, Lwo2Layer* > _layers; map< string, Lwo2Surface* > _surfaces; Lwo2Layer* _current_layer; vector< string > _tags; vector< string > _images; osgDB::ifstream _fin; unsigned char _read_char(); unsigned short _read_short(); unsigned int _read_uint(); float _read_float(); string& _read_string(string&); bool _successfully_read; void _print_tag(unsigned int, unsigned int); void _print_type(unsigned int); void _read_tag_strings(unsigned long); void _read_layer(unsigned long); void _read_points(unsigned long); void _read_vertex_mapping(unsigned long); void _read_polygons(unsigned long); void _read_polygons_mapping(unsigned long); void _read_polygon_tag_mapping(unsigned long); void _read_image_definition(unsigned long); void _read_surface(unsigned long); // generate StateSets for each surface void _generate_statesets_from_surfaces(); }; #endif
/**************************************************************************** ** ** Copyright (C) 2016 Paul Lemire ** 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 QT3DRENDER_RENDER_FILTERENTITYBYCOMPONENTJOB_H #define QT3DRENDER_RENDER_FILTERENTITYBYCOMPONENTJOB_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <Qt3DCore/qaspectjob.h> #include <Qt3DCore/qnodeid.h> #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/entity_p.h> #include <Qt3DRender/private/job_common_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { namespace Render { class Entity; class EntityManager; template<typename T, typename ... Ts> class FilterEntityByComponentJob : public Qt3DCore::QAspectJob { public: FilterEntityByComponentJob() : Qt3DCore::QAspectJob() , m_manager(nullptr) { SET_JOB_RUN_STAT_TYPE(this, JobTypes::EntityComponentTypeFiltering, 0) } inline void setManager(EntityManager *manager) noexcept { m_manager = manager; } inline std::vector<Entity *> &filteredEntities() noexcept { return m_filteredEntities; } void run() override { m_filteredEntities.clear(); const std::vector<HEntity> &handles = m_manager->activeHandles(); m_filteredEntities.reserve(handles.size()); for (const HEntity &handle : handles) { Entity *e = m_manager->data(handle); if (e->containsComponentsOfType<T, Ts...>()) m_filteredEntities.push_back(e); } } private: EntityManager *m_manager; std::vector<Entity *> m_filteredEntities; }; template<typename T, typename ... Ts> using FilterEntityByComponentJobPtr = QSharedPointer<FilterEntityByComponentJob<T, Ts...>>; } // Render } // Qt3DRender QT_END_NAMESPACE #endif // QT3DRENDER_RENDER_FILTERENTITYBYCOMPONENTJOB_H
/* * @BEGIN LICENSE * * Psi4: an open-source quantum chemistry software package * * Copyright (c) 2007-2017 The Psi4 Developers. * * The copyrights for code used from other parties are included in * the corresponding files. * * This file is part of Psi4. * * Psi4 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 3. * * Psi4 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 Psi4; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * @END LICENSE */ #ifndef DEFINES_ #define DEFINES_ #define ID(x) ints->DPD_ID(x) #define index2(i,j) ((i>j) ? ((i*(i+1)/2)+j) : ((j*(j+1)/2)+i)) #define index4(i,j,k,l) index2(index2(i,j),index2(k,l)) #define MIN0(a,b) (((a)<(b)) ? (a) : (b)) #define MAX0(a,b) (((a)>(b)) ? (a) : (b)) #define DIIS_MIN_DET 1.0E-16 #define DIVERGE 1.0E+3 #endif /* DEFINES_ */
/* This provides unification of code over STM32 subfamilies */ /* * This file is part of the libopencm3 project. * * 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 3 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, see <http://www.gnu.org/licenses/>. */ #include <libopencm3/cm3/common.h> #include <libopencm3/stm32/memorymap.h> #if defined(STM32F2) # include <libopencm3/stm32/f2/rng.h> #elif defined(STM32F4) # include <libopencm3/stm32/f4/rng.h> #elif defined(STM32F7) # include <libopencm3/stm32/f7/rng.h> #elif defined(STM32H7) # include <libopencm3/stm32/h7/rng.h> #elif defined(STM32L0) # include <libopencm3/stm32/l0/rng.h> #elif defined(STM32L4) # include <libopencm3/stm32/l4/rng.h> #elif defined(STM32G0) # include <libopencm3/stm32/g0/rng.h> #else # error "stm32 family not defined." #endif
/*************************************************************************\ * Copyright (C) Michael Kerrisk, 2015. * * * * This program is free software. You may use, modify, and redistribute it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation, either version 3 or (at your option) any * * later version. This program is distributed without any warranty. See * * the file COPYING.gpl-v3 for details. * \*************************************************************************/ /* Solution for Exercise 49-1 */ #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include "tlpi_hdr.h" int main(int argc, char *argv[]) { char *src, *dst; int fdSrc, fdDst; struct stat sb; if (argc != 3) usageErr("%s source-file dest-file\n", argv[0]); fdSrc = open(argv[1], O_RDONLY); if (fdSrc == -1) errExit("open"); /* Use fstat() to obtain size of file: we use this to specify the size of the two mappings */ if (fstat(fdSrc, &sb) == -1) errExit("fstat"); /* Handle zero-length file specially, since specifying a size of zero to mmap() will fail with the error EINVAL */ if (sb.st_size == 0) exit(EXIT_SUCCESS); src = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fdSrc, 0); if (src == MAP_FAILED) errExit("mmap"); fdDst = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (fdDst == -1) errExit("open"); if (ftruncate(fdDst, sb.st_size) == -1) errExit("ftruncate"); dst = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdDst, 0); if (dst == MAP_FAILED) errExit("mmap"); memcpy(dst, src, sb.st_size); /* Copy bytes between mappings */ if (msync(dst, sb.st_size, MS_SYNC) == -1) errExit("msync"); exit(EXIT_SUCCESS); }
/* COSTA: Problem solving environment for data assimilation Copyright (C) 2005 Nils van Velzen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file cta_time.h \brief Interface description of the default COSTA time component. A time object describes a time span (time of start, time of end). Utility functions are provided for changing and evaluating or comparing time spans. */ #ifndef CTA_TIME_H #define CTA_TIME_H #include "cta_system.h" #include "cta_handles.h" #include "cta_datatypes.h" /* Function Handle */ #ifdef __cplusplus extern "C" { #endif typedef CTA_Handle CTA_Time; /* functions */ /** \brief Create a time object. * * \param htime O receives handle of newly created time object * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_Create(CTA_Time *htime); /** \brief Free a time object. * * \param htime IO handle of time object to be freed, replaced by CTA_NULL on return. * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_Free(CTA_Time *htime); /** \brief Set the time span. * * \param htime IO time object of which to set time span * \param tstart I starting time * \param tend I ending time * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_SetSpan(CTA_Time htime,double tstart, double tend); /** \brief Get the time span. * * \param htime I time object of which to get time span * \param tstart O receives the starting time * \param tend O receives ending time * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_GetSpan(CTA_Time htime,double *tstart, double *tend); /** \brief Set the time step. * * \param htime IO time object of which to set time step * \param tstep I new time step * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_SetStep(CTA_Time htime,double tstep); /** \brief Get time step. * * \param htime IO time object of which to get time step * \param tstep O receives time step * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_GetStep(CTA_Time htime,double *tstep); /** \brief Count number of timesteps in time * * \param htime I time object (see function description) * \param nsteps O number of timesteps * * \return error status: CTA_OK if successful * * \note number of steps is rounded to nearest integer */ CTAEXPORT int CTA_Time_CountSteps(CTA_Time htime, int *nsteps); /** \brief Get interval of i-th step * * \param htime I time object (see function description) * \param istep I interval of step * \param hstep O time step of model * * \return error status: CTA_OK if successful * * \note intervals are counted from 1 to nsteps */ CTAEXPORT int CTA_Time_GetTimeStep(CTA_Time htime, int istep, CTA_Time hstep); /** \brief Check whether htimesub is within time span of htime. * * \param htimesub I time object (see function description) * \param htime I time object (see function description) * \param inspan O receives TRUE if htimesub is within time span of htime or FALSE otherwise * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_InSpan(CTA_Time htimesub, CTA_Time htime, BOOL *inspan); /** \brief Check whether time step of time object equals t * * \param htime I time object * \param t I time step to compare * \param isstep O receives TRUE if t equals time step of time object or FALSE otherwise * * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_IsStep(CTA_Time htime, double t, BOOL *isstep); /** \brief Copy a time object. * * \param hfrom I time object to copy from * \param hto O handle of time object that receives copy, must exist before calling * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_Copy(CTA_Time hfrom, CTA_Time hto); /** \brief Export a time object. * exports the whole internal state of the time object to given target * CTA_FILE will export the time component in a MATLAB/OCTAVE readable form * CTA_PACK will pack the content * * \param htime I time object to export * \param hexport I target for export (CTA_FILE or CTA_PACK) * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_Export(CTA_Time htime, CTA_Handle hexport); /** \brief Import a time object. * imports the whole internal state of the time object from given source * * \param htime I time object to import to * \param himport I source of import (CTA_PACK) * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_Import(CTA_Time htime, CTA_Handle himport); /** \brief Returns whether time object describes an timespan or a single * instance. * * \param htime I time object to import to * \param isspan O time object is a time timespan (CTA_TRUE/CTA_FALSE) * \return error status: CTA_OK if successful */ CTAEXPORT int CTA_Time_IsSpan(CTA_Time htime, int *isspan); #ifdef __cplusplus } #endif #endif
/**************************************************************************** ** ** 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 QtDBus module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** 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, Nokia gives you certain additional ** rights. These rights are described in the Nokia 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. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of the QLibrary class. This header file may change from // version to version without notice, or even be removed. // // We mean it. // #ifndef QDBUSUTIL_H #define QDBUSUTIL_H #include <QtCore/qstring.h> #include <QtCore/qvariant.h> #include <QtDBus/qdbusmacros.h> #include <QtDBus/qdbuserror.h> #ifndef QT_NO_DBUS QT_BEGIN_HEADER QT_BEGIN_NAMESPACE namespace QDBusUtil { Q_DBUS_EXPORT bool isValidInterfaceName(const QString &ifaceName); Q_DBUS_EXPORT bool isValidUniqueConnectionName(const QString &busName); Q_DBUS_EXPORT bool isValidBusName(const QString &busName); Q_DBUS_EXPORT bool isValidMemberName(const QString &memberName); Q_DBUS_EXPORT bool isValidErrorName(const QString &errorName); Q_DBUS_EXPORT bool isValidPartOfObjectPath(const QString &path); Q_DBUS_EXPORT bool isValidObjectPath(const QString &path); Q_DBUS_EXPORT bool isValidSignature(const QString &signature); Q_DBUS_EXPORT bool isValidSingleSignature(const QString &signature); Q_DBUS_EXPORT QString argumentToString(const QVariant &variant); enum AllowEmptyFlag { EmptyAllowed, EmptyNotAllowed }; inline bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error) { if (name.isEmpty()) { if (empty == EmptyAllowed) return true; *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Interface name cannot be empty")); return false; } if (isValidInterfaceName(name)) return true; *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid interface class: %1").arg(name)); return false; } inline bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error) { if (name.isEmpty()) { if (empty == EmptyAllowed) return true; *error = QDBusError(QDBusError::InvalidService, QLatin1String("Service name cannot be empty")); return false; } if (isValidBusName(name)) return true; *error = QDBusError(QDBusError::InvalidService, QString::fromLatin1("Invalid service name: %1").arg(name)); return false; } inline bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error) { if (path.isEmpty()) { if (empty == EmptyAllowed) return true; *error = QDBusError(QDBusError::InvalidObjectPath, QLatin1String("Object path cannot be empty")); return false; } if (isValidObjectPath(path)) return true; *error = QDBusError(QDBusError::InvalidObjectPath, QString::fromLatin1("Invalid object path: %1").arg(path)); return false; } inline bool checkMemberName(const QString &name, AllowEmptyFlag empty, QDBusError *error, const char *nameType = 0) { if (!nameType) nameType = "member"; if (name.isEmpty()) { if (empty == EmptyAllowed) return true; *error = QDBusError(QDBusError::InvalidMember, QLatin1String(nameType) + QLatin1String(" name cannot be empty")); return false; } if (isValidMemberName(name)) return true; *error = QDBusError(QDBusError::InvalidMember, QString::fromLatin1("Invalid %1 name: %2") .arg(QString::fromLatin1(nameType), name)); return false; } inline bool checkErrorName(const QString &name, AllowEmptyFlag empty, QDBusError *error) { if (name.isEmpty()) { if (empty == EmptyAllowed) return true; *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Error name cannot be empty")); return false; } if (isValidErrorName(name)) return true; *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid error name: %1").arg(name)); return false; } } QT_END_NAMESPACE QT_END_HEADER #endif // QT_NO_DBUS #endif
#ifndef CALCULATOR_H #define CALCULATOR_H typedef struct oneitem{ char operate; char *number; struct oneitem *left; struct oneitem *right; struct oneitem *parent; }oneitem; typedef struct oneitem equalist; double calculate(oneitem *equal, double x); equalist *createlist(char *equal); void freelist(oneitem *); void printlist(oneitem *); int ishigh(char first, char second); oneitem * getsuitposition(char operate, oneitem * list); oneitem * create_oneitem(); double string2float(char *s); int isoperator(char); char * getsubstring(const char * s, int start, int end); oneitem * gettop(oneitem *); #endif //CALCULATOR_H
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_openda_resultwriters_NetcdfResultWriterNative */ #ifndef _Included_org_openda_resultwriters_NetcdfResultWriterNative #define _Included_org_openda_resultwriters_NetcdfResultWriterNative #ifdef __cplusplus extern "C" { #endif /* * Class: org_openda_resultwriters_NetcdfResultWriterNative * Method: ctaNetcdfInit * Signature: (Ljava/lang/String;Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_openda_resultwriters_NetcdfResultWriterNative_ctaNetcdfInit (JNIEnv *, jobject, jstring, jstring); /* * Class: org_openda_resultwriters_NetcdfResultWriterNative * Method: ctaNetcdfClose * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_openda_resultwriters_NetcdfResultWriterNative_ctaNetcdfClose (JNIEnv *, jobject, jint); #ifdef __cplusplus } #endif #endif
#if !defined(AFX_EXLISTBOX_H__CE3B8328_FA4D_4F60_B4A6_7E8B91C54B52__INCLUDED_) #define AFX_EXLISTBOX_H__CE3B8328_FA4D_4F60_B4A6_7E8B91C54B52__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // ExListBox.h : header file // ///////////////////////////////////////////////////////////////////////////// // CExListBox window class CExListBox : public CListBox { // Construction public: CExListBox(); // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CExListBox) //}}AFX_VIRTUAL // Implementation public: virtual ~CExListBox(); int AddString( LPCTSTR lpszItem ); // Generated message map functions protected: //{{AFX_MSG(CExListBox) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG int m_nMaxWidth; DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_EXLISTBOX_H__CE3B8328_FA4D_4F60_B4A6_7E8B91C54B52__INCLUDED_)
/**************************************************************************** * * Copyright 2016 Samsung Electronics 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. * ****************************************************************************/ /**************************************************************************** * include/tinyara/spawn.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * 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 NuttX 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. * ****************************************************************************/ ///@file tinyara/spawn.h ///@brief SPAWN APIs #ifndef __INCLUDE_TINYARA_SPAWN_H #define __INCLUDE_TINYARA_SPAWN_H /**************************************************************************** * Included Files ****************************************************************************/ #include <tinyara/config.h> #include <spawn.h> /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** * Type Definitions ****************************************************************************/ /* This enumerator identifies a file action */ /** * @ingroup SPAWN_LIBC * @brief enum of spawn_file_action */ enum spawn_file_actions_e { SPAWN_FILE_ACTION_NONE = 0, SPAWN_FILE_ACTION_CLOSE, SPAWN_FILE_ACTION_DUP2, SPAWN_FILE_ACTION_OPEN }; /* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), * and posix_spawn_file_actions_addopen() will allocate memory and append * a new file action to an instance of posix_spawn_file_actions_t. The * internal representation of these structures are defined below: */ /** * @ingroup SPAWN_LIBC * @brief structure for general file action */ struct spawn_general_file_action_s { FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ enum spawn_file_actions_e action; /* A member of enum spawn_file_actions_e */ }; /** * @ingroup SPAWN_LIBC * @brief structure for spawn close file action */ struct spawn_close_file_action_s { FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_CLOSE */ int fd; /* The file descriptor to close */ }; /** * @ingroup SPAWN_LIBC * @brief structure for spawn dup2 file action */ struct spawn_dup2_file_action_s { FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_DUP2 */ int fd1; /* The first file descriptor for dup2() */ int fd2; /* The second file descriptor for dup2() */ }; /** * @ingroup SPAWN_LIBC * @brief structure for spawn open file action */ struct spawn_open_file_action_s { FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_OPEN */ int fd; /* The file descriptor after opening */ int oflags; /* Open flags */ mode_t mode; /* File creation mode */ char path[1]; /* Start of the path to be * opened */ }; #define SIZEOF_OPEN_FILE_ACTION_S(n) \ (sizeof(struct spawn_open_file_action_s) + (n)) /**************************************************************************** * Public Function Prototypes ****************************************************************************/ #ifdef __cplusplus extern "C" { #endif /** * @ingroup SPAWN_LIBC * @brief Add the file action to the end for the file action list. * * @details @b #include <tinyara/spawn.h> * @param[in] file_action The head of the file action list. * @param[in] entry The file action to be added * @return none * @since TizenRT v1.0 */ void add_file_action(FAR posix_spawn_file_actions_t *file_action, FAR struct spawn_general_file_action_s *entry); #ifdef __cplusplus } #endif #endif /* __INCLUDE_TINYARA_SPAWN_H */
// Copyright 2015 Charles D. Aylward // // 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. // // A (possibly updated) copy of of this software is available at // https://github.com/cdaylward/libappc #pragma once #include <regex> #include "appc/schema/common.h" namespace appc { namespace schema { const unsigned int max_ac_name_length = 512; template<typename T> struct ACName : StringType<T> { explicit ACName<T>(const std::string& name) : StringType<T>(name) {} virtual Status validate() const { if (this->value.empty()) { return Invalid("ACName must not be empty."); } if (this->value.size() > max_ac_name_length) { return Invalid("ACName must not be longer than " + std::to_string(max_ac_name_length)); } const std::regex pattern("^[A-Za-z0-9]+([-./][A-Za-z0-9]+)*$", std::regex::ECMAScript); if (!std::regex_match(this->value, pattern)) { return Invalid("ACName must comply with rfc1123 + allow '/'"); } return Valid(); } }; } // namespace schema } // namespace appc
/* * Example RSA key generation program * * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved * * This file is part of mbed TLS (https://tls.mbed.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #if !defined(MBEDTLS_CONFIG_FILE) #include "mbedtls/config.h" #else #include MBEDTLS_CONFIG_FILE #endif #if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" #else #include <stdio.h> #define mbedtls_printf printf #endif #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_ENTROPY_C) && \ defined(MBEDTLS_RSA_C) && defined(MBEDTLS_GENPRIME) && \ defined(MBEDTLS_FS_IO) && defined(MBEDTLS_CTR_DRBG_C) #include "mbedtls/entropy.h" #include "mbedtls/ctr_drbg.h" #include "mbedtls/bignum.h" #include "mbedtls/x509.h" #include "mbedtls/rsa.h" #include <stdio.h> #include <string.h> #endif #define KEY_SIZE 1024 #define EXPONENT 65537 #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_GENPRIME) || \ !defined(MBEDTLS_FS_IO) || !defined(MBEDTLS_CTR_DRBG_C) int main( void ) { mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or " "MBEDTLS_RSA_C and/or MBEDTLS_GENPRIME and/or " "MBEDTLS_FS_IO and/or MBEDTLS_CTR_DRBG_C not defined.\n"); return( 0 ); } #else int main( void ) { int ret; mbedtls_rsa_context rsa; mbedtls_entropy_context entropy; mbedtls_ctr_drbg_context ctr_drbg; FILE *fpub = NULL; FILE *fpriv = NULL; const char *pers = "rsa_genkey"; mbedtls_ctr_drbg_init( &ctr_drbg ); mbedtls_printf( "\n . Seeding the random number generator..." ); fflush( stdout ); mbedtls_entropy_init( &entropy ); if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, (const unsigned char *) pers, strlen( pers ) ) ) != 0 ) { mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); goto exit; } mbedtls_printf( " ok\n . Generating the RSA key [ %d-bit ]...", KEY_SIZE ); fflush( stdout ); mbedtls_rsa_init( &rsa, MBEDTLS_RSA_PKCS_V15, 0 ); if( ( ret = mbedtls_rsa_gen_key( &rsa, mbedtls_ctr_drbg_random, &ctr_drbg, KEY_SIZE, EXPONENT ) ) != 0 ) { mbedtls_printf( " failed\n ! mbedtls_rsa_gen_key returned %d\n\n", ret ); goto exit; } mbedtls_printf( " ok\n . Exporting the public key in rsa_pub.txt...." ); fflush( stdout ); if( ( fpub = fopen( "rsa_pub.txt", "wb+" ) ) == NULL ) { mbedtls_printf( " failed\n ! could not open rsa_pub.txt for writing\n\n" ); ret = 1; goto exit; } if( ( ret = mbedtls_mpi_write_file( "N = ", &rsa.N, 16, fpub ) ) != 0 || ( ret = mbedtls_mpi_write_file( "E = ", &rsa.E, 16, fpub ) ) != 0 ) { mbedtls_printf( " failed\n ! mbedtls_mpi_write_file returned %d\n\n", ret ); goto exit; } mbedtls_printf( " ok\n . Exporting the private key in rsa_priv.txt..." ); fflush( stdout ); if( ( fpriv = fopen( "rsa_priv.txt", "wb+" ) ) == NULL ) { mbedtls_printf( " failed\n ! could not open rsa_priv.txt for writing\n" ); ret = 1; goto exit; } if( ( ret = mbedtls_mpi_write_file( "N = " , &rsa.N , 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "E = " , &rsa.E , 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "D = " , &rsa.D , 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "P = " , &rsa.P , 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "Q = " , &rsa.Q , 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "DP = ", &rsa.DP, 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "DQ = ", &rsa.DQ, 16, fpriv ) ) != 0 || ( ret = mbedtls_mpi_write_file( "QP = ", &rsa.QP, 16, fpriv ) ) != 0 ) { mbedtls_printf( " failed\n ! mbedtls_mpi_write_file returned %d\n\n", ret ); goto exit; } /* mbedtls_printf( " ok\n . Generating the certificate..." ); x509write_init_raw( &cert ); x509write_add_pubkey( &cert, &rsa ); x509write_add_subject( &cert, "CN='localhost'" ); x509write_add_validity( &cert, "2007-09-06 17:00:32", "2010-09-06 17:00:32" ); x509write_create_selfsign( &cert, &rsa ); x509write_crtfile( &cert, "cert.der", X509_OUTPUT_DER ); x509write_crtfile( &cert, "cert.pem", X509_OUTPUT_PEM ); x509write_free_raw( &cert ); */ mbedtls_printf( " ok\n\n" ); exit: if( fpub != NULL ) fclose( fpub ); if( fpriv != NULL ) fclose( fpriv ); mbedtls_rsa_free( &rsa ); mbedtls_ctr_drbg_free( &ctr_drbg ); mbedtls_entropy_free( &entropy ); #if defined(_WIN32) mbedtls_printf( " Press Enter to exit this program.\n" ); fflush( stdout ); getchar(); #endif return( ret ); } #endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_RSA_C && MBEDTLS_GENPRIME && MBEDTLS_FS_IO && MBEDTLS_CTR_DRBG_C */
/** * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC * * 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. */ #if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW) #import <UIKit/UIKit.h> // Map modification note: // using categories with static libraries don't seem to work // right on device with iphone - probably a symbol issue // turn this into a static function (from what was a category to UIImage // originally) UIImage* AddImageReflection(UIImage *src, CGFloat reflectionFraction); #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/ssm/SSM_EXPORTS.h> #include <aws/ssm/model/ParameterTier.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace SSM { namespace Model { class AWS_SSM_API PutParameterResult { public: PutParameterResult(); PutParameterResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); PutParameterResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The new version number of a parameter. If you edit a parameter value, * Parameter Store automatically creates a new version and assigns this new version * a unique ID. You can reference a parameter version ID in API operations or in * Systems Manager documents (SSM documents). By default, if you don't specify a * specific version, the system returns the latest parameter value when a parameter * is called.</p> */ inline long long GetVersion() const{ return m_version; } /** * <p>The new version number of a parameter. If you edit a parameter value, * Parameter Store automatically creates a new version and assigns this new version * a unique ID. You can reference a parameter version ID in API operations or in * Systems Manager documents (SSM documents). By default, if you don't specify a * specific version, the system returns the latest parameter value when a parameter * is called.</p> */ inline void SetVersion(long long value) { m_version = value; } /** * <p>The new version number of a parameter. If you edit a parameter value, * Parameter Store automatically creates a new version and assigns this new version * a unique ID. You can reference a parameter version ID in API operations or in * Systems Manager documents (SSM documents). By default, if you don't specify a * specific version, the system returns the latest parameter value when a parameter * is called.</p> */ inline PutParameterResult& WithVersion(long long value) { SetVersion(value); return *this;} /** * <p>The tier assigned to the parameter.</p> */ inline const ParameterTier& GetTier() const{ return m_tier; } /** * <p>The tier assigned to the parameter.</p> */ inline void SetTier(const ParameterTier& value) { m_tier = value; } /** * <p>The tier assigned to the parameter.</p> */ inline void SetTier(ParameterTier&& value) { m_tier = std::move(value); } /** * <p>The tier assigned to the parameter.</p> */ inline PutParameterResult& WithTier(const ParameterTier& value) { SetTier(value); return *this;} /** * <p>The tier assigned to the parameter.</p> */ inline PutParameterResult& WithTier(ParameterTier&& value) { SetTier(std::move(value)); return *this;} private: long long m_version; ParameterTier m_tier; }; } // namespace Model } // namespace SSM } // namespace Aws
/* * Copyright 2018 Google * * 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 FIRESTORE_CORE_SRC_LOCAL_LEVELDB_TARGET_CACHE_H_ #define FIRESTORE_CORE_SRC_LOCAL_LEVELDB_TARGET_CACHE_H_ #include <unordered_map> #include <unordered_set> #include "Firestore/Protos/nanopb/firestore/local/target.nanopb.h" #include "Firestore/core/src/local/target_cache.h" #include "Firestore/core/src/model/model_fwd.h" #include "Firestore/core/src/model/snapshot_version.h" #include "Firestore/core/src/nanopb/message.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "leveldb/db.h" namespace firebase { namespace firestore { namespace local { class LevelDbPersistence; class LocalSerializer; class TargetData; /** Cached Queries backed by LevelDB. */ class LevelDbTargetCache : public TargetCache { public: /** * Retrieves the global singleton metadata row from the given database. If the * metadata row doesn't exist, this will result in an assertion failure. * * TODO(gsoltis): remove this method once fully ported to transactions. */ static nanopb::Message<firestore_client_TargetGlobal> ReadMetadata( leveldb::DB* db); /** * Test-only -- same as `ReadMetadata`, but returns an empty optional if the * metadata row doesn't exist. */ static absl::optional<nanopb::Message<firestore_client_TargetGlobal>> TryReadMetadata(leveldb::DB* db); /** * Creates a new target cache in the given LevelDB. * * @param db The LevelDB in which to create the cache. */ LevelDbTargetCache(LevelDbPersistence* db, LocalSerializer* serializer); // Target-related methods void AddTarget(const TargetData& target_data) override; void UpdateTarget(const TargetData& target_data) override; void RemoveTarget(const TargetData& target_data) override; absl::optional<TargetData> GetTarget(const core::Target& target) override; void EnumerateSequenceNumbers( const SequenceNumberCallback& callback) override; size_t RemoveTargets(model::ListenSequenceNumber upper_bound, const std::unordered_map<model::TargetId, TargetData>& live_targets) override; // Key-related methods /** * Adds the given document keys to cached query results of the given target * ID. */ void AddMatchingKeys(const model::DocumentKeySet& keys, model::TargetId target_id) override; /** Removes the given document keys from the cached query results of the given * target ID. */ void RemoveMatchingKeys(const model::DocumentKeySet& keys, model::TargetId target_id) override; /** Removes all document keys in the query results of the given target ID. */ void RemoveMatchingKeysForTarget(model::TargetId target_id) override; model::DocumentKeySet GetMatchingKeys(model::TargetId target_id) override; /** * Checks to see if there are any references to a document with the given key. */ bool Contains(const model::DocumentKey& key) override; // Other methods and accessors size_t size() const override { return metadata_->target_count; } model::TargetId highest_target_id() const override { return metadata_->highest_target_id; } model::ListenSequenceNumber highest_listen_sequence_number() const override { return metadata_->highest_listen_sequence_number; } const model::SnapshotVersion& GetLastRemoteSnapshotVersion() const override; void SetLastRemoteSnapshotVersion(model::SnapshotVersion version) override; // Non-interface methods void Start(); void EnumerateOrphanedDocuments(const OrphanedDocumentCallback& callback); private: void Save(const TargetData& target_data); bool UpdateMetadata(const TargetData& target_data); void SaveMetadata(); /** Parses the given bytes as a `firestore_client_Target` protocol buffer. */ nanopb::Message<firestore_client_Target> DecodeTargetProto( nanopb::Reader* reader); /** * Parses the given bytes as a `firestore_client_Target` protocol buffer and * then converts to the equivalent target data. */ TargetData DecodeTarget(absl::string_view encoded); /** Removes the given targets from the query to target mapping. */ void RemoveQueryTargetKeyForTargets( const std::unordered_set<model::TargetId>& target_id); // The LevelDbTargetCache is owned by LevelDbPersistence. LevelDbPersistence* db_; // Owned by LevelDbPersistence. LocalSerializer* serializer_ = nullptr; /** A write-through cached copy of the metadata for the target cache. */ nanopb::Message<firestore_client_TargetGlobal> metadata_; model::SnapshotVersion last_remote_snapshot_version_; }; } // namespace local } // namespace firestore } // namespace firebase #endif // FIRESTORE_CORE_SRC_LOCAL_LEVELDB_TARGET_CACHE_H_
/* * Copyright 2016 The Cartographer Authors * * 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 CPP_GRPC_COMMON_BLOCKING_QUEUE_H_ #define CPP_GRPC_COMMON_BLOCKING_QUEUE_H_ #include <cstddef> #include <deque> #include <memory> #include "async_grpc/common/mutex.h" #include "async_grpc/common/port.h" #include "async_grpc/common/time.h" #include "glog/logging.h" namespace async_grpc { namespace common { // A thread-safe blocking queue that is useful for producer/consumer patterns. // 'T' must be movable. template <typename T> class BlockingQueue { public: static constexpr size_t kInfiniteQueueSize = 0; // Constructs a blocking queue with infinite queue size. BlockingQueue() : BlockingQueue(kInfiniteQueueSize) {} BlockingQueue(const BlockingQueue&) = delete; BlockingQueue& operator=(const BlockingQueue&) = delete; // Constructs a blocking queue with a size of 'queue_size'. explicit BlockingQueue(const size_t queue_size) : queue_size_(queue_size) {} // Pushes a value onto the queue. Blocks if the queue is full. void Push(T t) { MutexLocker lock(&mutex_); lock.Await([this]() REQUIRES(mutex_) { return QueueNotFullCondition(); }); deque_.push_back(std::move(t)); } // Like push, but returns false if 'timeout' is reached. bool PushWithTimeout(T t, const common::Duration timeout) { MutexLocker lock(&mutex_); if (!lock.AwaitWithTimeout( [this]() REQUIRES(mutex_) { return QueueNotFullCondition(); }, timeout)) { return false; } deque_.push_back(std::move(t)); return true; } // Pops the next value from the queue. Blocks until a value is available. T Pop() { MutexLocker lock(&mutex_); lock.Await([this]() REQUIRES(mutex_) { return !QueueEmptyCondition(); }); T t = std::move(deque_.front()); deque_.pop_front(); return t; } // Like Pop, but can timeout. Returns nullptr in this case. T PopWithTimeout(const common::Duration timeout) { MutexLocker lock(&mutex_); if (!lock.AwaitWithTimeout( [this]() REQUIRES(mutex_) { return !QueueEmptyCondition(); }, timeout)) { return nullptr; } T t = std::move(deque_.front()); deque_.pop_front(); return t; } // Returns the next value in the queue or nullptr if the queue is empty. // Maintains ownership. This assumes a member function get() that returns // a pointer to the given type R. template <typename R> const R* Peek() { MutexLocker lock(&mutex_); if (deque_.empty()) { return nullptr; } return deque_.front().get(); } // Returns the number of items currently in the queue. size_t Size() { MutexLocker lock(&mutex_); return deque_.size(); } // Blocks until the queue is empty. void WaitUntilEmpty() { MutexLocker lock(&mutex_); lock.Await([this]() REQUIRES(mutex_) { return QueueEmptyCondition(); }); } private: // Returns true iff the queue is empty. bool QueueEmptyCondition() REQUIRES(mutex_) { return deque_.empty(); } // Returns true iff the queue is not full. bool QueueNotFullCondition() REQUIRES(mutex_) { return queue_size_ == kInfiniteQueueSize || deque_.size() < queue_size_; } Mutex mutex_; const size_t queue_size_ GUARDED_BY(mutex_); std::deque<T> deque_ GUARDED_BY(mutex_); }; } // namespace common } // namespace async_grpc #endif // CPP_GRPC_COMMON_BLOCKING_QUEUE_H_
/* Copyright (c) 2007 Cyrus Daboo. 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. */ // CLog: allows logging of network related comms #ifndef __CLOG__MULBERRY__ #define __CLOG__MULBERRY__ #define CLOG_LOGTHROW(_type, _param) \ CLog::LogThrow(#_type, _param, __FUNCTION__, __FILE__, __LINE__) #define CLOG_LOGCATCH(_type) \ CLog::LogCatch(#_type, __FUNCTION__, __FILE__, __LINE__) #define CLOG_LOGRETHROW \ CLog::LogRethrow(__FUNCTION__, __FILE__, __LINE__) #define CLOG_LOGERROR(_err) \ CLog::LogError(__FUNCTION__, __FILE__, __LINE__, _err) #include "cdfstream.h" class CLog { public: enum ELogType { eLogNone, eLogTypeFirst, eLogIMAP = eLogTypeFirst, eLogPOP3, eLogIMSP, eLogACAP, eLogSMTP, eLogHTTP, eLogPlugin, eLogFilters, eLogExceptions, eLogTypeLast }; struct SLogOptions { bool mEnable[eLogTypeLast]; bool mAuthentication; bool mPlayback; bool mOverwrite; bool mUserCWD; bool mActivate; }; CLog() { mType = eLogNone; mSessionID = 0; mPartial = false; } ~CLog() {} static void StartLogging(); // Create all logfiles if required static void ChangeLogging(const SLogOptions& options); // Change logging options static void FlushLogs(); // Flush logs now static void ClearLogs(); // Clear logs now static void StopLogging(); // Close all logfiles static void ActivateLogging(); // Suspend logging without changing prefs static void DeactivateLogging(); // Suspend logging without changing prefs static void ReadOptions(); static void WriteOptions(); static void BeginLog(cdofstream*& log, const char* name, bool user_start = false); static void EndLog(cdofstream*& log, bool user_stop = false); static bool AnyActiveLogs(); static void DisableActiveLogs(); static void LogThrow(const char* type, int err, const char* func, const char* file, int line); static void LogCatch(const char* type, const char* func, const char* file, int line); static void LogRethrow(const char* func, const char* file, int line); static void LogError(const char* func, const char* file, int line, const char* err); void StartLog(ELogType type, // Set type and bump session ID const char* desc = NULL); void StopLog(); // Stop logging bool DoLog(); // Can log this type? long GetSessionID() // Get ID for this log session { return mSessionID; } cdofstream* GetLog(); // Get log stream void LogEntry(const char* log); // Write an entry to log void AddEntry(const char* log); // Write an entry to log void StartPartialEntry(); void LogPartialEntry(const char* log); // Write an entry to log void StopPartialEntry(); static bool AllowAuthenticationLog() { return sAllowAuthenticationLog; } static bool AllowPlaybackLog() { return sAllowPlaybackLog; } static void DoLoggingOptions(); // Do dialog to change logging options private: static CLog sExceptionLog; ELogType mType; long mSessionID; bool mPartial; struct SLogInfo { bool mDoLog; cdofstream* mLog; long mSessionID; SLogInfo() { mDoLog = false; mLog = NULL; mSessionID = 1; } }; static SLogInfo sLogInfo[eLogTypeLast]; static bool sLoggingActive; static bool sAllowAuthenticationLog; static bool sAllowPlaybackLog; static bool sOverwrite; static bool sUserCWD; void PuntPartial(); }; #endif
/****************************************************************************** * Copyright 2017 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ /** * @file **/ #pragma once #include "modules/common/status/status.h" #include "modules/planning/common/speed/speed_data.h" #include "modules/planning/common/st_graph_data.h" #include "modules/planning/tasks/task.h" namespace apollo { namespace planning { class SpeedOptimizer : public Task { public: explicit SpeedOptimizer(const TaskConfig& config); virtual ~SpeedOptimizer() = default; apollo::common::Status Execute( Frame* frame, ReferenceLineInfo* reference_line_info) override; protected: virtual apollo::common::Status Process( const SLBoundary& adc_sl_boundary, const PathData& path_data, const common::TrajectoryPoint& init_point, const ReferenceLine& reference_line, const SpeedData& reference_speed_data, PathDecision* const path_decision, SpeedData* const speed_data) = 0; void RecordDebugInfo(const SpeedData& speed_data); void RecordDebugInfo(const SpeedData& speed_data, planning_internal::STGraphDebug* st_graph_debug); }; } // namespace planning } // namespace apollo
/* Copyright (c) 2007 Cyrus Daboo. 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. */ // CPrefsPOP3Options.h : header file // #ifndef __CPREFSPOP3OPTIONS__MULBERRY__ #define __CPREFSPOP3OPTIONS__MULBERRY__ #include "CTabPanel.h" ///////////////////////////////////////////////////////////////////////////// // CPrefsPOP3Options dialog class CPrefsPOP3Options : public CTabPanel { DECLARE_DYNAMIC(CPrefsPOP3Options) // Construction public: CPrefsPOP3Options(); // standard constructor // Dialog Data //{{AFX_DATA(CPrefsPOP3Options) enum { IDD = IDD_PREFS_ACCOUNT_POP3_Options }; BOOL mLeaveOnServer; CButton mLeaveOnServerCtrl; BOOL mDeleteAfter; CButton mDeleteAfterCtrl; UINT mDeleteDays; CEdit mDeleteDaysCtrl; BOOL mDeleteExpunged; CButton mDeleteExpungedCtrl; BOOL mUseMaxSize; CButton mUseMaxSizeCtrl; UINT mMaxSize; CEdit mMaxSizeCtrl; BOOL mUseAPOP; //}}AFX_DATA virtual void SetContent(void* data); // Set data virtual bool UpdateContent(void* data); // Force update of data // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPrefsPOP3Options) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CPrefsPOP3Options) afx_msg void OnPrefsAccountPOP3LeaveMail(); afx_msg void OnPrefsAccountPOP3DeleteAfter(); afx_msg void OnPrefsAccountPOP3UseMaxSize(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: virtual void SetLeaveOnServer(bool on); }; #endif
//--------------------------------------------------------------------------- // Greenplum Database // Copyright (C) 2008 - 2010, Greenplum, Inc. // // @filename: // CMessageTable.h // // @doc: // Error message table; //--------------------------------------------------------------------------- #ifndef GPOS_CMessageTable_H #define GPOS_CMessageTable_H #include "gpos/error/CMessage.h" #define GPOS_MSGTAB_SIZE 4096 namespace gpos { //--------------------------------------------------------------------------- // @class: // CMessageTable // // @doc: // Maintains error messages for a given locale // //--------------------------------------------------------------------------- class CMessageTable { // short hand for message tables typedef CSyncHashtable< CMessage, CException, CSpinlockOS> MT; // short hand for message table accessor typedef CSyncHashtableAccessByKey< CMessage, CException, CSpinlockOS> MTAccessor; // message hashtable MT m_sht; // private copy ctor CMessageTable(const CMessageTable&); public: // ctor CMessageTable(IMemoryPool *pmp, ULONG ulSize, ELocale eloc); // lookup message by error/local CMessage *PmsgLookup(CException exc); // insert message void AddMessage(CMessage *pmsg); // simple comparison BOOL operator == ( const CMessageTable &mt ) const { return m_eloc == mt.m_eloc; } // equality function -- needed for hashtable static BOOL FEqual ( const ELocale &eloc, const ELocale &elocOther ) { return eloc == elocOther; } // basic hash function static ULONG UlHash ( const ELocale &eloc ) { return (ULONG) eloc; } // link object SLink m_link; // locale ELocale m_eloc; // invalid locale static const ELocale m_elocInvalid; }; // class CMessageTable } #endif // !GPOS_CMessageTable_H // EOF
/****************************************************************** * * Copyright 2014 Samsung Electronics All Rights Reserved. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************/ #ifndef PUBLIC_BLE_H_ #define PUBLIC_BLE_H_ #define REF_NAME "reference" void ble_init( void (*func)(void *) ); void proximity_init( void *(*func)(void *) ); void proximity_loop( void *param ); #endif /* PUBLIC_BLE_H_ */
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/iotsitewise/IoTSiteWise_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace IoTSiteWise { namespace Model { enum class CapabilitySyncStatus { NOT_SET, IN_SYNC, OUT_OF_SYNC, SYNC_FAILED, UNKNOWN }; namespace CapabilitySyncStatusMapper { AWS_IOTSITEWISE_API CapabilitySyncStatus GetCapabilitySyncStatusForName(const Aws::String& name); AWS_IOTSITEWISE_API Aws::String GetNameForCapabilitySyncStatus(CapabilitySyncStatus value); } // namespace CapabilitySyncStatusMapper } // namespace Model } // namespace IoTSiteWise } // namespace Aws
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/lambda/Lambda_EXPORTS.h> #include <aws/lambda/model/AccountLimit.h> #include <aws/lambda/model/AccountUsage.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace Lambda { namespace Model { class AWS_LAMBDA_API GetAccountSettingsResult { public: GetAccountSettingsResult(); GetAccountSettingsResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); GetAccountSettingsResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); inline const AccountLimit& GetAccountLimit() const{ return m_accountLimit; } inline void SetAccountLimit(const AccountLimit& value) { m_accountLimit = value; } inline void SetAccountLimit(AccountLimit&& value) { m_accountLimit = std::move(value); } inline GetAccountSettingsResult& WithAccountLimit(const AccountLimit& value) { SetAccountLimit(value); return *this;} inline GetAccountSettingsResult& WithAccountLimit(AccountLimit&& value) { SetAccountLimit(std::move(value)); return *this;} inline const AccountUsage& GetAccountUsage() const{ return m_accountUsage; } inline void SetAccountUsage(const AccountUsage& value) { m_accountUsage = value; } inline void SetAccountUsage(AccountUsage&& value) { m_accountUsage = std::move(value); } inline GetAccountSettingsResult& WithAccountUsage(const AccountUsage& value) { SetAccountUsage(value); return *this;} inline GetAccountSettingsResult& WithAccountUsage(AccountUsage&& value) { SetAccountUsage(std::move(value)); return *this;} private: AccountLimit m_accountLimit; AccountUsage m_accountUsage; }; } // namespace Model } // namespace Lambda } // namespace Aws
/* * local.h - Define the clinet's buffers and callbacks * * Copyright (C) 2013 - 2015, Max Lv <max.c.lv@gmail.com> * * This file is part of the shadowsocks-libev. * * shadowsocks-libev 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. * * shadowsocks-libev 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 shadowsocks-libev; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. */ #ifndef _LOCAL_H #define _LOCAL_H #include "ev.h" #include "libcork/ds.h" #include "encrypt.h" #include "jconf.h" #include "common.h" struct listen_ctx { ev_io io; char *iface; int remote_num; int method; int timeout; int fd; struct sockaddr **remote_addr; }; struct server_ctx { ev_io io; int connected; struct server *server; }; struct server { int fd; ssize_t buf_len; ssize_t buf_idx; char *buf; // server send from, remote recv into char stage; struct enc_ctx *e_ctx; struct enc_ctx *d_ctx; struct server_ctx *recv_ctx; struct server_ctx *send_ctx; struct listen_ctx *listener; struct remote *remote; struct cork_dllist_item entries; }; struct remote_ctx { ev_io io; ev_timer watcher; int connected; struct remote *remote; }; struct remote { int fd; ssize_t buf_len; ssize_t buf_idx; int direct; char *buf; // remote send from, server recv into struct remote_ctx *recv_ctx; struct remote_ctx *send_ctx; struct server *server; struct sockaddr_storage addr; int addr_len; }; #endif // _LOCAL_H
/* * Copyright 2008-2012 NVIDIA 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. */ #pragma once #include <thrust/detail/config.h> // the purpose of this header is to #include the iter_swap.h header // of the host and device systems. It should be #included in any // code which uses adl to dispatch iter_swap #define __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/iter_swap.h> #include __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER #undef __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER #define __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/iter_swap.h> #include __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER #undef __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER
/* * Copyright 2013-2016 Luke Dashjr * * 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. See COPYING for more details. */ #include "config.h" #include <limits.h> #include <stdbool.h> #include <stdint.h> #include <string.h> #include "miner.h" #include "util.h" #include "work2d.h" #define MAX_DIVISIONS WORK2D_MAX_DIVISIONS static bool work2d_reserved[MAX_DIVISIONS + 1] = { true }; int work2d_xnonce1sz; int work2d_xnonce2sz; void work2d_init() { RUNONCE(); for (uint64_t n = MAX_DIVISIONS; n; n >>= 8) ++work2d_xnonce1sz; work2d_xnonce2sz = 2; } bool reserve_work2d_(uint32_t * const xnonce1_p) { uint32_t xnonce1; for (xnonce1 = MAX_DIVISIONS; work2d_reserved[xnonce1]; --xnonce1) if (!xnonce1) return false; work2d_reserved[xnonce1] = true; *xnonce1_p = htole32(xnonce1); return true; } void release_work2d_(uint32_t xnonce1) { xnonce1 = le32toh(xnonce1); work2d_reserved[xnonce1] = false; } int work2d_pad_xnonce_size(const struct stratum_work * const swork) { return swork->n2size - work2d_xnonce1sz - work2d_xnonce2sz; } void *work2d_pad_xnonce(void * const buf_, const struct stratum_work * const swork, const bool hex) { uint8_t * const buf = buf_; int pad = work2d_pad_xnonce_size(swork); if (pad < 0) return NULL; if (hex) { pad *= 2; memset(buf, 'b', pad); } else memset(buf, '\xbb', pad); return &buf[pad]; } static void work2d_gen_dummy_work_prepare(struct work * const work, struct stratum_work * const swork, const struct timeval * const tvp_prepared) { *work = (struct work){ .pool = swork->pool, .work_restart_id = swork->work_restart_id, .tv_staged = *tvp_prepared, }; } void work2d_gen_dummy_work(struct work * const work, struct stratum_work * const swork, const struct timeval * const tvp_prepared, const void * const xnonce2, const uint32_t xnonce1) { uint8_t *p, *s; work2d_gen_dummy_work_prepare(work, swork, tvp_prepared); bytes_resize(&work->nonce2, swork->n2size); s = bytes_buf(&work->nonce2); p = &s[swork->n2size - work2d_xnonce2sz]; if (xnonce2) memcpy(p, xnonce2, work2d_xnonce2sz); #ifndef __OPTIMIZE__ else memset(p, '\0', work2d_xnonce2sz); #endif p -= work2d_xnonce1sz; memcpy(p, &xnonce1, work2d_xnonce1sz); work2d_pad_xnonce(s, swork, false); gen_stratum_work2(work, swork); } void work2d_gen_dummy_work_for_stale_check(struct work * const work, struct stratum_work * const swork, const struct timeval * const tvp_prepared, cglock_t * const data_lock_p) { work2d_gen_dummy_work_prepare(work, swork, tvp_prepared); gen_stratum_work3(work, swork, data_lock_p); } bool work2d_submit_nonce(struct thr_info * const thr, struct stratum_work * const swork, const struct timeval * const tvp_prepared, const void * const xnonce2, const uint32_t xnonce1, const uint32_t nonce, const uint32_t ntime, bool * const out_is_stale, const float nonce_diff) { struct work _work, *work; bool rv; // Generate dummy work work = &_work; work2d_gen_dummy_work(work, swork, tvp_prepared, xnonce2, xnonce1); *(uint32_t *)&work->data[68] = htobe32(ntime); work->nonce_diff = nonce_diff; work->rolltime = INT_MAX; // FIXME // Check if it's stale, if desired if (out_is_stale) *out_is_stale = stale_work(work, true); // Submit nonce rv = submit_nonce(thr, work, nonce); clean_work(work); return rv; }
#include "pm.h" #include <assert.h> #include <minix/callnr.h> #include <minix/com.h> #include <minix/config.h> #include <minix/sched.h> #include <minix/sysinfo.h> #include <minix/type.h> #include <machine/archtypes.h> #include <lib.h> #include "mproc.h" #include <machine/archtypes.h> #include <minix/timers.h> #include "kernel/proc.h" /*===========================================================================* * init_scheduling * *===========================================================================*/ void sched_init(void) { struct mproc *trmp; endpoint_t parent_e; int proc_nr, s; for (proc_nr=0, trmp=mproc; proc_nr < NR_PROCS; proc_nr++, trmp++) { /* Don't take over system processes. When the system starts, * init is blocked on RTS_NO_QUANTUM until PM assigns a * scheduler, from which other. Given that all other user * processes are forked from init and system processes are * managed by RS, there should be no other process that needs * to be assigned a scheduler here */ if (trmp->mp_flags & IN_USE && !(trmp->mp_flags & PRIV_PROC)) { assert(_ENDPOINT_P(trmp->mp_endpoint) == INIT_PROC_NR); parent_e = mproc[trmp->mp_parent].mp_endpoint; assert(parent_e == trmp->mp_endpoint); s = sched_start(SCHED_PROC_NR, /* scheduler_e */ trmp->mp_endpoint, /* schedulee_e */ parent_e, /* parent_e */ USER_Q, /* maxprio */ USER_QUANTUM, /* quantum */ -1, /* don't change cpu */ &trmp->mp_scheduler); /* *newsched_e */ if (s != OK) { printf("PM: SCHED denied taking over scheduling of %s: %d\n", trmp->mp_name, s); } } } } /*===========================================================================* * sched_start_user * *===========================================================================*/ int sched_start_user(endpoint_t ep, struct mproc *rmp) { unsigned maxprio; endpoint_t inherit_from; int rv; /* convert nice to priority */ if ((rv = nice_to_priority(rmp->mp_nice, &maxprio)) != OK) { return rv; } /* scheduler must know the parent, which is not the case for a child * of a system process created by a regular fork; in this case the * scheduler should inherit settings from init rather than the real * parent */ if (mproc[rmp->mp_parent].mp_flags & PRIV_PROC) { assert(mproc[rmp->mp_parent].mp_scheduler == NONE); inherit_from = INIT_PROC_NR; } else { inherit_from = mproc[rmp->mp_parent].mp_endpoint; } /* inherit quantum */ return sched_inherit(ep, /* scheduler_e */ rmp->mp_endpoint, /* schedulee_e */ inherit_from, /* parent_e */ maxprio, /* maxprio */ &rmp->mp_scheduler); /* *newsched_e */ } /*===========================================================================* * sched_nice * *===========================================================================*/ int sched_nice(struct mproc *rmp, int nice) { int rv; message m; unsigned maxprio; /* If the kernel is the scheduler, we don't allow messing with the * priority. If you want to control process priority, assign the process * to a user-space scheduler */ if (rmp->mp_scheduler == KERNEL || rmp->mp_scheduler == NONE) return (EINVAL); if ((rv = nice_to_priority(nice, &maxprio)) != OK) { return rv; } m.m_pm_sched_scheduling_set_nice.endpoint = rmp->mp_endpoint; m.m_pm_sched_scheduling_set_nice.maxprio = maxprio; if ((rv = _taskcall(rmp->mp_scheduler, SCHEDULING_SET_NICE, &m))) { return rv; } return (OK); }
/* Copyright (c) 2008-2014, Avian Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. There is NO WARRANTY for this software. See license.txt for details. */ #ifndef AVIAN_ENVIRONMENT_H #define AVIAN_ENVIRONMENT_H #ifndef AVIAN_TARGET_FORMAT #error build system should have defined AVIAN_TARGET_FORMAT #endif #ifndef AVIAN_TARGET_ARCH #error build system should have defined AVIAN_TARGET_ARCH #endif #define AVIAN_FORMAT_UNKNOWN 0 #define AVIAN_FORMAT_ELF 1 #define AVIAN_FORMAT_PE 2 #define AVIAN_FORMAT_MACHO 3 #define AVIAN_ARCH_UNKNOWN 0 #define AVIAN_ARCH_X86 (1 << 8) #define AVIAN_ARCH_X86_64 (2 << 8) #define AVIAN_ARCH_ARM (3 << 8) #endif
/* * 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/mynewt.h" #if MYNEWT_VAL(STATS_PERSIST) #include <assert.h> #include <stdio.h> #include "base64/base64.h" #include "config/config.h" #include "stats/stats.h" #include "stats_priv.h" static char *stats_conf_get(int argc, char **argv, char *buf, int max_len); static int stats_conf_set(int argc, char **argv, char *val); static int stats_conf_commit(void); static int stats_conf_export(void (*func)(char *name, char *val), enum conf_export_tgt tgt); static struct conf_handler stats_conf_handler = { .ch_name = "stat", .ch_get = stats_conf_get, .ch_set = stats_conf_set, .ch_commit = stats_conf_commit, .ch_export = stats_conf_export }; static int stats_conf_snprintf_name(const struct stats_hdr *hdr, size_t max_len, char *buf) { return snprintf(buf, max_len, "stat/%s", hdr->s_name); } static void stats_conf_name(const struct stats_hdr *hdr, char *buf) { stats_conf_snprintf_name(hdr, MYNEWT_VAL(STATS_PERSIST_MAX_NAME_SIZE), buf); } static void stats_conf_serialize(const struct stats_hdr *hdr, void *buf) { size_t rawlen; void *data; rawlen = stats_size(hdr); data = stats_data(hdr); conf_str_from_bytes(data, rawlen, buf, MYNEWT_VAL(STATS_PERSIST_BUF_SIZE)); } /** Converts in-RAM setting to a config-friendly string. */ static char * stats_conf_get(int argc, char **argv, char *buf, int max_len) { const struct stats_hdr *hdr; if (argc == 1) { hdr = stats_group_find(argv[0]); if (hdr != NULL) { stats_conf_serialize(hdr, buf); } } return NULL; } /** Converts config string to binary in-RAM value. */ static int stats_conf_set(int argc, char **argv, char *val) { struct stats_hdr *hdr; size_t size; void *data; if (argc == 1) { hdr = stats_group_find(argv[0]); if (hdr != NULL) { size = stats_size(hdr); data = stats_data(hdr); memset(data, 0, size); base64_decode_maxlen(val, data, size); return 0; } } return OS_ENOENT; } static int stats_conf_commit(void) { return 0; } /** * This structure just holds a pointer to walk callback. It is undefined * behavior to cast a function pointer to `void *`, so we wrap it with * something that can be safely converted. */ struct stats_conf_export_walk_arg { void (*func)(char *name, char *val); }; static int stats_conf_export_walk(struct stats_hdr *hdr, void *arg) { char name[MYNEWT_VAL(STATS_PERSIST_MAX_NAME_SIZE)]; char data[MYNEWT_VAL(STATS_PERSIST_BUF_SIZE)]; struct stats_conf_export_walk_arg *walk_arg; walk_arg = arg; if (!(hdr->s_flags & STATS_HDR_F_PERSIST)) { return 0; } stats_conf_name(hdr, name); stats_conf_serialize(hdr, data); walk_arg->func(name, data); return 0; } static int stats_conf_export(void (*func)(char *name, char *val), enum conf_export_tgt tgt) { struct stats_conf_export_walk_arg arg = { func }; int rc; rc = stats_group_walk(stats_conf_export_walk, &arg); return rc; } int stats_conf_save_group(const struct stats_hdr *hdr) { char name[MYNEWT_VAL(STATS_PERSIST_MAX_NAME_SIZE)]; char data[MYNEWT_VAL(STATS_PERSIST_BUF_SIZE)]; stats_conf_name(hdr, name); stats_conf_serialize(hdr, data); return conf_save_one(name, data); } void stats_conf_assert_valid(const struct stats_hdr *hdr) { size_t rawlen; size_t enclen; rawlen = stats_size(hdr); enclen = BASE64_ENCODE_SIZE(rawlen); assert(enclen <= MYNEWT_VAL(STATS_PERSIST_BUF_SIZE)); rawlen = stats_conf_snprintf_name(hdr, 0, NULL); assert(rawlen < MYNEWT_VAL(STATS_PERSIST_MAX_NAME_SIZE)); } void stats_conf_init(void) { int rc; rc = conf_register(&stats_conf_handler); SYSINIT_PANIC_ASSERT(rc == 0); } #endif
/* Copyright 1991, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <X11/X.h> #include <X11/Xproto.h> #include <X11/fonts/fontmisc.h> #include <X11/fonts/fontstruct.h> #include <X11/fonts/fntfilio.h> #include <X11/fonts/fntfil.h> #include <X11/fonts/bdfint.h> #include <X11/fonts/pcf.h> #include <stdio.h> #include <X11/Xos.h> int main(int argc, char *argv[]) { FontRec font = { 0 }; FontFilePtr input, output; char *input_name = NULL, *output_name = NULL; char *program_name; int bit, byte, glyph, scan; FontDefaultFormat(&bit, &byte, &glyph, &scan); program_name = argv[0]; argc--, argv++; while (argc-- > 0) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 'p': switch (argv[0][2]) { case '1': case '2': case '4': case '8': if (argv[0][3] != '\0') goto usage; glyph = argv[0][2] - '0'; break; default: goto usage; } break; case 'u': switch (argv[0][2]) { case '1': case '2': case '4': if (argv[0][3] != '\0') goto usage; scan = argv[0][2] - '0'; break; default: goto usage; } break; case 'm': if (argv[0][2] != '\0') goto usage; bit = MSBFirst; break; case 'l': if (argv[0][2] != '\0') goto usage; bit = LSBFirst; break; case 'M': if (argv[0][2] != '\0') goto usage; byte = MSBFirst; break; case 'L': if (argv[0][2] != '\0') goto usage; byte = LSBFirst; break; case 't': /* attempt to make terminal fonts if possible */ if (argv[0][2] != '\0') goto usage; break; case 'i': /* inhibit ink metric computation */ if (argv[0][2] != '\0') goto usage; break; case 'o': if (argv[0][2]) output_name = argv[0] + 2; else { if (!argv[1]) goto usage; argv++; argc--; output_name = argv[0]; } break; case 'v': printf("%s\n", PACKAGE_STRING); exit(0); default: goto usage; } } else { if (input_name) { usage: fprintf(stderr, "usage: %s [-p#] [-u#] [-m] [-l] [-M] [-L] [-t] [-i] [-o pcf file] [bdf file]\n" " where # for -p is 1, 2, 4, or 8\n" " and # for -s is 1, 2, or 4\n", program_name); exit(1); } input_name = argv[0]; } argv++; } if (input_name) { input = FontFileOpen(input_name); if (!input) { fprintf(stderr, "%s: can't open bdf source file %s\n", program_name, input_name); exit(1); } } else input = FontFileOpenFd(STDIN_FILENO); if (bdfReadFont(&font, input, bit, byte, glyph, scan) != Successful) { fprintf(stderr, "%s: bdf input, %s, corrupt\n", program_name, input_name ? input_name : "<stdin>"); exit(1); } if (output_name) { output = FontFileOpenWrite(output_name); if (!output) { fprintf(stderr, "%s: can't open pcf sink file %s\n", program_name, output_name); exit(1); } } else output = FontFileOpenWriteFd(STDOUT_FILENO); if (pcfWriteFont(&font, output) != Successful) { fprintf(stderr, "%s: can't write pcf file %s\n", program_name, output_name ? output_name : "<stdout>"); if (output_name) remove(output_name); exit(1); } else FontFileClose(output); return (0); }
// ----------------------------------------------------------------------------- // Copyright 2011-2012 Patrick Näf (herzbube@herzbube.ch) // // 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. // ----------------------------------------------------------------------------- // Forward declarations @class NSString; // ----------------------------------------------------------------------------- /// @brief The DocumentGenerator class parses a text file and generates a set /// of HTML documents from the file content. The HTML documents can then be /// conveniently displayed in a UIWebView. /// /// DocumentGenerator assumes that the text file is structured according to /// the following rules: /// - The document is partitioned into groups and sections /// - Sections are the main structuring element of the text file, while groups /// are a simple means to provide sections with a common heading /// - DocumentGenerator creates one HTML document for each section /// - A section has a title and a content; the section title can be used to /// refer to the HTML document in the GUI, the section content is also the /// content of the HTML document /// - The leadin for a section is a separator line that begins with 3 or more /// dashes, i.e. "---" /// - The single line below the separator is the section title /// - If another separator line is found below the section title it is ignored /// - All lines below the separator, until either the next group title, section /// title or until end-of-file, form the section content /// - Group titles are defined exactly the same as section titles, with the /// exception that separator lines begin with 3 or more asterisks, i.e. "***" /// - If the text file does not contain an explicit group title, /// DocumentGenerator still adds one implicit group, albeit without a title /// /// DocumentGenerator parses the section content lines for a few patterns to /// generate the following markup within the section's HTML document: /// - Subsection titles /// - A specially marked up title paragraph is created if a separator line is /// found that begins with 3 or more equal signs, i.e. "===" /// - The single line below the separator is the subsection title /// - If another separator line is found below the subsection title it is /// ignored /// - An empty line, or a line that contains only whitespace, starts a new /// paragraph /// - Lists /// - A line that starts with "- " starts a new unnumberd list, or a new list /// item if a list has already been started by a previous item /// - The list is terminated by an empty line, or a line that contains only /// whitespace /// - Ditto for numbered lists, but the line must start with "1. " /// - URLs (e.g. http://) are used to create anchor HTML elements // ----------------------------------------------------------------------------- @interface DocumentGenerator : NSObject { } - (id) initWithFileContent:(NSString*)fileContent; - (NSString*) titleForGroup:(int)groupIndex; - (int) numberOfSectionsInGroup:(int)groupIndex; - (NSString*) titleForSection:(int)sectionIndex inGroup:(int)groupIndex; - (NSString*) contentForSection:(int)sectionIndex inGroup:(int)groupIndex; @property(nonatomic, assign, readonly) int numberOfGroups; @end
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/elasticloadbalancingv2/ElasticLoadBalancingv2_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/elasticloadbalancingv2/model/ResponseMetadata.h> #include <aws/elasticloadbalancingv2/model/Rule.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Xml { class XmlDocument; } // namespace Xml } // namespace Utils namespace ElasticLoadBalancingv2 { namespace Model { class AWS_ELASTICLOADBALANCINGV2_API SetRulePrioritiesResult { public: SetRulePrioritiesResult(); SetRulePrioritiesResult(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); SetRulePrioritiesResult& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); /** * <p>Information about the rules.</p> */ inline const Aws::Vector<Rule>& GetRules() const{ return m_rules; } /** * <p>Information about the rules.</p> */ inline void SetRules(const Aws::Vector<Rule>& value) { m_rules = value; } /** * <p>Information about the rules.</p> */ inline void SetRules(Aws::Vector<Rule>&& value) { m_rules = std::move(value); } /** * <p>Information about the rules.</p> */ inline SetRulePrioritiesResult& WithRules(const Aws::Vector<Rule>& value) { SetRules(value); return *this;} /** * <p>Information about the rules.</p> */ inline SetRulePrioritiesResult& WithRules(Aws::Vector<Rule>&& value) { SetRules(std::move(value)); return *this;} /** * <p>Information about the rules.</p> */ inline SetRulePrioritiesResult& AddRules(const Rule& value) { m_rules.push_back(value); return *this; } /** * <p>Information about the rules.</p> */ inline SetRulePrioritiesResult& AddRules(Rule&& value) { m_rules.push_back(std::move(value)); return *this; } inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } inline SetRulePrioritiesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} inline SetRulePrioritiesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} private: Aws::Vector<Rule> m_rules; ResponseMetadata m_responseMetadata; }; } // namespace Model } // namespace ElasticLoadBalancingv2 } // namespace Aws
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// 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. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Daniel H. Larkin //////////////////////////////////////////////////////////////////////////////// #ifndef ARANGOD_REST_HANDLER_REST_ADMIN_ROUTING_HANDLER_H #define ARANGOD_REST_HANDLER_REST_ADMIN_ROUTING_HANDLER_H 1 #include "Basics/Common.h" #include "RestHandler/RestVocbaseBaseHandler.h" namespace arangodb { class RestAdminRoutingHandler : public RestVocbaseBaseHandler { public: RestAdminRoutingHandler(GeneralRequest*, GeneralResponse*); public: RestStatus execute() override final; char const* name() const override final { return "RestAdminRoutingHandler"; } protected: void reloadRouting(); }; } #endif
#ifndef COUNT_H #define COUNT_H #include <string> #include <vector> #include <getopt.h> //-- Include hash_map #ifdef __GNUC__ #if __GNUC__ < 3 #include <hash_map.h> namespace Sgi { using ::hash_map; }; // inherit globals #define HASHMAP std #elif __GNUC__ == 3 #include <ext/hash_map> #if __GNUC_MINOR__ == 0 namespace Sgi = std; // GCC 3.0 #define HASHMAP std #else namespace Sgi = ::__gnu_cxx; // GCC 3.1 and later #define HASHMAP __gnu_cxx #endif #elif __GNUC__ > 3 #include <ext/hash_map> namespace Sgi = ::__gnu_cxx; // GCC 4.0 and later #define HASHMAP __gnu_cxx #endif #else // ... there are other compilers, right? namespace Sgi = std; #define HASHMAP std #endif using namespace::std; using namespace::HASHMAP; typedef long long unsigned Mer_t; extern Mer_t Forward_Mask; ////////////////////////////////////////////////////////////////////// // options ////////////////////////////////////////////////////////////////////// extern const char* myopts; // -f extern char * fastqfile; // -k extern int Kmer_Len; // -m extern int min_count; // -l extern float gb_limit; ////////////////////////////////////////////////////////////////////// // constants ////////////////////////////////////////////////////////////////////// extern int COUNT; extern int LEN; extern int BAD_CHAR; extern int PRINT_SIMPLE; extern const char * bintoascii; extern int bytes_per_kmer; // limit size ////////////////////////////////////////////////////////////////////// // methods ////////////////////////////////////////////////////////////////////// void InitMer(Mer_t & mer); unsigned Char_To_Binary (char ch); void Forward_Add_Ch (Mer_t & mer, char ch); void Reverse_Add_Ch (Mer_t & mer, char ch); void MerToAscii(Mer_t mer, string & s); bool Fastq_Read(FILE * fp, string & s, string & hdr, string & q); #endif
/*- * Copyright (c) 2011-2015 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 <stdlib.h> #include <string.h> #include <errno.h> #include <syslog.h> #include <assert.h> #include <xbps.h> #include "defs.h" int state_cb(const struct xbps_state_cb_data *xscd, void *cbdata _unused) { xbps_dictionary_t pkgd; const char *instver, *newver; char *pkgname; int rv = 0; bool slog = false; if ((xscd->xhp->flags & XBPS_FLAG_DISABLE_SYSLOG) == 0) { slog = true; openlog("xbps-install", 0, LOG_USER); } switch (xscd->state) { /* notifications */ case XBPS_STATE_TRANS_DOWNLOAD: printf("\n[*] Downloading binary packages\n"); break; case XBPS_STATE_TRANS_VERIFY: printf("\n[*] Verifying package integrity\n"); break; case XBPS_STATE_TRANS_RUN: printf("\n[*] Running transaction tasks\n"); break; case XBPS_STATE_TRANS_CONFIGURE: printf("\n[*] Configuring unpacked packages\n"); break; case XBPS_STATE_PKGDB: printf("[*] pkgdb upgrade in progress, please wait...\n"); break; case XBPS_STATE_REPOSYNC: printf("[*] Updating `%s' ...\n", xscd->arg); break; case XBPS_STATE_TRANS_ADDPKG: if (xscd->xhp->flags & XBPS_FLAG_VERBOSE) printf("%s\n", xscd->desc); break; case XBPS_STATE_VERIFY: printf("%s\n", xscd->desc); break; case XBPS_STATE_CONFIG_FILE: if (xscd->desc != NULL) printf("%s\n", xscd->desc); break; case XBPS_STATE_REMOVE: printf("%s: removing ...\n", xscd->arg); break; case XBPS_STATE_CONFIGURE: printf("%s: configuring ...\n", xscd->arg); break; case XBPS_STATE_CONFIGURE_DONE: /* empty */ break; case XBPS_STATE_UNPACK: printf("%s: unpacking ...\n", xscd->arg); break; case XBPS_STATE_INSTALL: case XBPS_STATE_DOWNLOAD: /* empty */ break; case XBPS_STATE_UPDATE: pkgname = xbps_pkg_name(xscd->arg); assert(pkgname); newver = xbps_pkg_version(xscd->arg); pkgd = xbps_pkgdb_get_pkg(xscd->xhp, pkgname); xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &instver); printf("%s: updating to %s ...\n", instver, newver); if (slog) { syslog(LOG_NOTICE, "%s: updating to %s ... " "(rootdir: %s)\n", instver, newver, xscd->xhp->rootdir); } free(pkgname); break; /* success */ case XBPS_STATE_REMOVE_FILE: case XBPS_STATE_REMOVE_FILE_OBSOLETE: if (xscd->xhp->flags & XBPS_FLAG_VERBOSE) printf("%s\n", xscd->desc); else { printf("%s\n", xscd->desc); printf("\033[1A\033[K"); } break; case XBPS_STATE_INSTALL_DONE: printf("%s: installed successfully.\n", xscd->arg); if (slog) { syslog(LOG_NOTICE, "Installed `%s' successfully " "(rootdir: %s).", xscd->arg, xscd->xhp->rootdir); } break; case XBPS_STATE_UPDATE_DONE: printf("%s: updated successfully.\n", xscd->arg); if (slog) { syslog(LOG_NOTICE, "Updated `%s' successfully " "(rootdir: %s).", xscd->arg, xscd->xhp->rootdir); } break; case XBPS_STATE_REMOVE_DONE: printf("%s: removed successfully.\n", xscd->arg); if (slog) { syslog(LOG_NOTICE, "Removed `%s' successfully " "(rootdir: %s).", xscd->arg, xscd->xhp->rootdir); } break; case XBPS_STATE_PKGDB_DONE: printf("The pkgdb file has been upgraded successfully, please reexec " "the command again.\n"); break; case XBPS_STATE_REPO_KEY_IMPORT: printf("%s\n", xscd->desc); printf("Fingerprint: %s\n", xscd->arg); rv = yesno("Do you want to import this public key?"); break; case XBPS_STATE_SHOW_INSTALL_MSG: printf("%s: post-install message:\n", xscd->arg); printf("========================================================================\n"); printf("%s", xscd->desc); printf("========================================================================\n"); break; case XBPS_STATE_UNPACK_FILE_PRESERVED: printf("%s\n", xscd->desc); break; /* errors */ case XBPS_STATE_UNPACK_FAIL: case XBPS_STATE_UPDATE_FAIL: case XBPS_STATE_CONFIGURE_FAIL: case XBPS_STATE_REMOVE_FAIL: case XBPS_STATE_VERIFY_FAIL: case XBPS_STATE_DOWNLOAD_FAIL: case XBPS_STATE_REPOSYNC_FAIL: case XBPS_STATE_CONFIG_FILE_FAIL: xbps_error_printf("%s\n", xscd->desc); if (slog) { syslog(LOG_ERR, "%s", xscd->desc); } break; case XBPS_STATE_REMOVE_FILE_FAIL: case XBPS_STATE_REMOVE_FILE_HASH_FAIL: case XBPS_STATE_REMOVE_FILE_OBSOLETE_FAIL: /* Ignore errors due to not empty directories */ if (xscd->err == ENOTEMPTY) return 0; xbps_error_printf("%s\n", xscd->desc); if (slog) { syslog(LOG_ERR, "%s", xscd->desc); } break; default: if (xscd->desc) printf("%s\n", xscd->desc); else xbps_dbg_printf(xscd->xhp, "%s: unknown state %d\n", xscd->arg, xscd->state); break; } return rv; }
//=========================================== // PC-BSD source code // Copyright (c) 2015, PC-BSD Software/iXsystems // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== #ifndef __PCBSD_LIB_UTILS_FILESYSTEM_H #define __PCBSD_LIB_UTILS_FILESYSTEM_H #include "sysadm-global.h" namespace sysadm{ class FS{ public: static QJsonObject list_dir(QJsonObject jsin); }; }//end of sysadm namespace #endif
/* * vr_compat.h - compatibility definitions * * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ #ifndef __VRCOMPAT_H__ #define __VRCOMPAT_H__ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) #if (! (defined(RHEL_MAJOR) && defined(RHEL_MINOR) && \ (RHEL_MAJOR == 6) && (RHEL_MINOR == 5))) typedef u64 netdev_features_t; #endif #endif /* * As per lxr, skb_get_rxhash exists in 3.13 versions and disappeared in * 3.14. We do not know of in between versions. However, the ubuntu * sources for 3.13.0-32 does not have it (for which the LINUX_VERSION * CODE is 199947, which corresponds to 3.13.11) and hence the following */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,11)) static inline __u32 skb_get_rxhash(struct sk_buff *skb) { return skb_get_hash(skb); } #endif #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) static inline __u32 skb_get_rxhash(struct sk_buff *skb) { #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) && \ (RHEL_MAJOR == 6) && (RHEL_MINOR == 4) struct iphdr *ip; u32 ports = 0; if (skb->rxhash) { return skb->rxhash; } if (skb->protocol != (htons(ETH_P_IP))) { return 0; } if (!pskb_may_pull(skb, sizeof(*ip))) { return 0; } ip = (struct iphdr *) skb->data; switch (ip->protocol) { case IPPROTO_TCP: case IPPROTO_UDP: if (vr_ip_transport_header_valid((struct vr_ip *) ip)) { /* * Not a fragment, so pull in the source and dest ports */ if (pskb_may_pull(skb, ip->ihl*4 + 4)) { ports = *((u32 *) (skb->data + (ip->ihl*4))); } } break; default: break; } if (hashrnd_inited == 0) { get_random_bytes(&vr_hashrnd, sizeof(vr_hashrnd)); hashrnd_inited = 1; } skb->rxhash = jhash_3words(ip->saddr, ip->daddr, ports, vr_hashrnd) >> 16; if (!skb->rxhash) { skb->rxhash = 1; } return skb->rxhash; #else return 0; #endif } #if (RHEL_MAJOR != 6) && (RHEL_MINOR != 4) && defined(CONFIG_XEN) static inline struct page *skb_frag_page(const skb_frag_t *frag) { return frag->page; } static inline unsigned int skb_frag_size(const skb_frag_t *frag) { return frag->size; } static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) { frag->size -= delta; } #endif #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) enum rx_handler_result { RX_HANDLER_CONSUMED, RX_HANDLER_ANOTHER, RX_HANDLER_EXACT, RX_HANDLER_PASS, }; typedef enum rx_handler_result rx_handler_result_t; #define VLAN_CFI_MASK 0x1000 #define VLAN_TAG_PRESENT VLAN_CFI_MASK #define ARPHRD_VOID 0xFFFF #if (RHEL_MAJOR != 6) && (RHEL_MINOR != 4) #define alloc_netdev_mqs(sizeof_priv, name, setup, count1, count2) \ alloc_netdev_mq(sizeof_priv, name, setup, count1) static inline void skb_reset_mac_len(struct sk_buff *skb) { skb->mac_len = skb->network_header - skb->mac_header; } #endif #ifndef ISRHOSKERNEL #if (! (defined(RHEL_MAJOR) && defined(RHEL_MINOR) && \ (RHEL_MAJOR == 6) && (RHEL_MINOR == 5))) static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) { return ((features & NETIF_F_GEN_CSUM) || ((features & NETIF_F_V4_CSUM) && protocol == htons(ETH_P_IP)) || ((features & NETIF_F_V6_CSUM) && protocol == htons(ETH_P_IPV6)) || ((features & NETIF_F_FCOE_CRC) && protocol == htons(ETH_P_FCOE))); } static netdev_features_t harmonize_features(struct sk_buff *skb, __be16 protocol, netdev_features_t features) { if (skb->ip_summed != CHECKSUM_NONE && !can_checksum_protocol(features, protocol)) { features &= ~NETIF_F_ALL_CSUM; features &= ~NETIF_F_SG; } return features; } static inline netdev_features_t netif_skb_features(struct sk_buff *skb) { __be16 protocol = skb->protocol; netdev_features_t features = skb->dev->features; features &= ~NETIF_F_GSO_MASK; if (protocol == htons(ETH_P_8021Q)) { struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; protocol = veh->h_vlan_encapsulated_proto; } else if (!vlan_tx_tag_present(skb)) { return harmonize_features(skb, protocol, features); } features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX); if (protocol != htons(ETH_P_8021Q)) { return harmonize_features(skb, protocol, features); } else { features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX; return harmonize_features(skb, protocol, features); } } #endif #endif #endif #endif
/* * Copyright (c) 2012, Massachusetts Institute of Technology * Released under the BSD 2-Clause License * http://opensource.org/licenses/BSD-2-Clause */ #include "HidPunk.h" #include "jniOsxHidDevice.h" JNIEXPORT jlong JNICALL Java_bits_hidpunk_osx_OsxHidDevice_getHidDictionary (JNIEnv* env, jclass clazz, jlong ptr) { kern_return_t kret; CFMutableDictionaryRef dict; io_object_t dev = (io_object_t)ptr; if(dev == 0) { hidpunk_throwNullPointerException(env, "Null device"); return 0; } kret = IORegistryEntryCreateCFProperties (dev, &dict, kCFAllocatorDefault, kNilOptions); if(kret != KERN_SUCCESS || dict == NULL) { hidpunk_throwIOKitException(env, "Failed to create device properties dictionary."); return 0; } return *(jlong*)&dict; } JNIEXPORT jlong JNICALL Java_bits_hidpunk_osx_OsxHidDevice_getUsbDictionary (JNIEnv* env, jclass clazz, jlong ptr) { CFMutableDictionaryRef dict; io_registry_entry_t parent1, parent2; io_object_t dev = (io_object_t)ptr; if(dev == 0) { hidpunk_throwNullPointerException(env, "Null device"); return 0; } if( IORegistryEntryGetParentEntry(dev, kIOServicePlane, &parent1) != KERN_SUCCESS || IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2) != KERN_SUCCESS || IORegistryEntryCreateCFProperties(parent2, &dict, kCFAllocatorDefault, kNilOptions) || dict == NULL) { hidpunk_throwIOKitException(env, "Failed to create device properties dictionary."); return 0; } return *(jlong*)&dict; } JNIEXPORT void JNICALL Java_bits_hidpunk_osx_OsxHidDevice_queryDeviceInfo (JNIEnv* env, jclass clazz, jlong devPtr, jlong hidDictPtr, jlong usbDictPtr, jobject outBuf) { char* buf; CFMutableDictionaryRef usbDict; CFMutableDictionaryRef hidDict; CFTypeRef ref; int bufIdx = 0; io_object_t dev = (io_object_t)devPtr; if(dev == 0) { hidpunk_throwNullPointerException(env, "NULL device"); return; } usbDict = *(CFMutableDictionaryRef*)&usbDictPtr; hidDict = *(CFMutableDictionaryRef*)&hidDictPtr; if(usbDict == NULL || hidDict == NULL) { hidpunk_throwNullPointerException(env, "NULL dictionary"); return; } buf = (char*)(*env)->GetDirectBufferAddress(env, outBuf); if(buf == NULL) { hidpunk_throwNullPointerException(env, "NULL buffer"); return; } //Get transport. ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDTransportKey)); if(ref) CFStringGetCString(ref, buf + bufIdx, 256, kCFStringEncodingUTF8); bufIdx += 256; //VendorID ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDVendorIDKey)); if(!ref) ref = CFDictionaryGetValue(usbDict, CFSTR("idVendor")); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; //ProductID ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDProductIDKey)); if(!ref) ref = CFDictionaryGetValue(usbDict, CFSTR("idProduct")); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; //Product version. ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDVersionNumberKey)); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; //Manufacturer name ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDManufacturerKey)); if(ref) ref = CFDictionaryGetValue(usbDict, CFSTR("USB Vendor Name")); if(ref) CFStringGetCString(ref, buf + bufIdx, 256, kCFStringEncodingUTF8); bufIdx += 256; //Product name ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDProductKey)); if(!ref) ref = CFDictionaryGetValue(usbDict, CFSTR("USB Product Name")); if(ref) CFStringGetCString(ref, buf + bufIdx, 256, kCFStringEncodingUTF8); bufIdx += 256; //Serial ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDSerialNumberKey)); if(ref) CFStringGetCString(ref, buf + bufIdx, 256, kCFStringEncodingUTF8); bufIdx += 256; //LocationID ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDLocationIDKey)); if(!ref) ref = CFDictionaryGetValue(usbDict, CFSTR("locationID")); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; //Usage page ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDPrimaryUsagePageKey)); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; //Usage ref = CFDictionaryGetValue(hidDict, CFSTR(kIOHIDPrimaryUsageKey)); if(ref) CFNumberGetValue(ref, kCFNumberLongType, buf + bufIdx); bufIdx += 4; } JNIEXPORT jlong JNICALL Java_bits_hidpunk_osx_OsxHidDevice_openInterface (JNIEnv* env, jclass clazz, jlong ptr) { IOReturn ioret; HRESULT plugret; IOCFPlugInInterface** plugin = NULL; IOHIDDeviceInterface ** interface = NULL; SInt32 score = 0; io_object_t dev = (io_object_t)ptr; if(dev == 0) { hidpunk_throwNullPointerException(env, "Null device"); return 0; } //Create intermediate plugin. ioret = IOCreatePlugInInterfaceForService( dev, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugin, &score); if(ioret != kIOReturnSuccess) { hidpunk_throwIOKitException(env, "Failed at IOCreatePlugInInterfaceForService"); return 0; } //Use plugin to create device interface. plugret = (*plugin)->QueryInterface( plugin, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void*)&interface ); IODestroyPlugInInterface(plugin); if(plugret != S_OK || interface == NULL) { hidpunk_throwIOKitException(env, "Failed to query HID device interface from plugin interface"); return 0; } ioret = (*interface)->open(interface, 0); if(ioret != kIOReturnSuccess) { hidpunk_throwIOKitException(env, "Failed to open interface."); return 0; } return *(jlong*)&interface; }
// Copyright 2015 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_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_ #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_ #include <map> #include <memory> #include <string> #include <vector> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" #include "components/component_updater/timer.h" namespace base { class TimeTicks; } namespace component_updater { class OnDemandUpdater; using CrxInstaller = update_client::CrxInstaller; using UpdateClient = update_client::UpdateClient; class CrxUpdateService : public ComponentUpdateService, public ComponentUpdateService::Observer, public OnDemandUpdater { using Observer = ComponentUpdateService::Observer; public: CrxUpdateService(const scoped_refptr<Configurator>& config, const scoped_refptr<UpdateClient>& update_client); ~CrxUpdateService() override; // Overrides for ComponentUpdateService. void AddObserver(Observer* observer) override; void RemoveObserver(Observer* observer) override; bool RegisterComponent(const CrxComponent& component) override; bool UnregisterComponent(const std::string& id) override; std::vector<std::string> GetComponentIDs() const override; std::unique_ptr<ComponentInfo> GetComponentForMimeType( const std::string& id) const override; OnDemandUpdater& GetOnDemandUpdater() override; void MaybeThrottle(const std::string& id, const base::Closure& callback) override; scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() override; bool GetComponentDetails(const std::string& id, CrxUpdateItem* item) const override; // Overrides for Observer. void OnEvent(Events event, const std::string& id) override; // Overrides for OnDemandUpdater. void OnDemandUpdate(const std::string& id, CompletionCallback callback) override; private: void Start(); void Stop(); bool CheckForUpdates(); void OnDemandUpdateInternal(const std::string& id, CompletionCallback callback); bool OnDemandUpdateWithCooldown(const std::string& id); bool DoUnregisterComponent(const CrxComponent& component); const CrxComponent* GetComponent(const std::string& id) const; const CrxUpdateItem* GetComponentState(const std::string& id) const; void OnUpdate(const std::vector<std::string>& ids, std::vector<CrxComponent>* components); void OnUpdateComplete(CompletionCallback callback, const base::TimeTicks& start_time, int error); // Returns the map of installer attributes for the recovery component // installer. This data corresponds to the Omaha updater state and it is // serialized as part of the update check for the recovery component. update_client::InstallerAttributes GetInstallerAttributesForRecoveryComponentInstaller( const CrxComponent& crx_component) const; base::ThreadChecker thread_checker_; scoped_refptr<Configurator> config_; scoped_refptr<UpdateClient> update_client_; Timer timer_; // A collection of every registered component. using Components = std::map<std::string, CrxComponent>; Components components_; // Maintains the order in which components have been registered. The position // of a component id in this sequence indicates the priority of the component. // The sooner the component gets registered, the higher its priority, and // the closer this component is to the beginning of the vector. std::vector<std::string> components_order_; // Contains the components pending unregistration. If a component is not // busy installing or updating, it can be unregistered right away. Otherwise, // the component will be lazily unregistered after the its operations have // completed. std::vector<std::string> components_pending_unregistration_; // Contains the active resource throttles associated with a given component. using ResourceThrottleCallbacks = std::multimap<std::string, base::Closure>; ResourceThrottleCallbacks ready_callbacks_; // Contains the state of the component. using ComponentStates = std::map<std::string, CrxUpdateItem>; ComponentStates component_states_; // Contains a map of media types to the component that implements a handler // for that media type. Only the most recently-registered component is // tracked. May include the IDs of un-registered components. std::map<std::string, std::string> component_ids_by_mime_type_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; DISALLOW_COPY_AND_ASSIGN(CrxUpdateService); }; } // namespace component_updater #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_
/* Copyright (c) 2013+ Pavel Šimerda, Red Hat, Inc. (psimerda at redhat.com) and others * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE 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. */ #include <netresolve-private.h> static enum netresolve_log_level log_level = 0; enum netresolve_log_level netresolve_get_log_level(void) { return log_level; } void netresolve_set_log_level(enum netresolve_log_level new_log_level) { log_level = new_log_level; } void netresolve_log(int level, const char *fmt, ...) { if (level <= netresolve_get_log_level()) { va_list ap; size_t len = strlen(fmt); char fmtnl[len + 2]; memcpy(fmtnl, fmt, len); fmtnl[len] = '\n'; fmtnl[len + 1] = '\0'; va_start(ap, fmt); vfprintf(stderr, fmtnl, ap); va_end(ap); } }
/*- * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org> * 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(s), this list of conditions and the following disclaimer as * the first lines of this file unmodified other than the possible * addition of one or more copyright notices. * 2. Redistributions in binary form must reproduce the above copyright * notice(s), this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * $FreeBSD: release/9.1.0/sys/sys/_sx.h 179025 2008-05-15 20:10:06Z attilio $ */ #ifndef _SYS__SX_H_ #define _SYS__SX_H_ /* * Shared/exclusive lock main structure definition. */ struct sx { struct lock_object lock_object; volatile uintptr_t sx_lock; }; #endif /* !_SYS__SX_H_ */
/*--------------------------------------------------------------- * Programmer(s): Daniel R. Reynolds @ SMU *--------------------------------------------------------------- * LLNS/SMU Copyright Start * Copyright (c) 2015, Southern Methodist University and * Lawrence Livermore National Security * * This work was performed under the auspices of the U.S. Department * of Energy by Southern Methodist University and Lawrence Livermore * National Laboratory under Contract DE-AC52-07NA27344. * Produced at Southern Methodist University and the Lawrence * Livermore National Laboratory. * * All rights reserved. * For details, see the LICENSE file. * LLNS/SMU Copyright End *--------------------------------------------------------------- * Fortran/C interface routines for ARKODE/ARKDENSE, for the case * of a user-supplied Jacobian approximation routine. *--------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include "farkode.h" #include "arkode_impl.h" #include <arkode/arkode_dense.h> /*=============================================================*/ /* Prototype of the Fortran routine */ #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif extern void FARK_DJAC(long int *N, realtype *T, realtype *Y, realtype *FY, realtype *DJAC, realtype *H, long int *IPAR, realtype *RPAR, realtype *V1, realtype *V2, realtype *V3, int *ier); #ifdef __cplusplus } #endif /*=============================================================*/ /* Fortran interface to C routine ARKDlsSetDenseJacFn; see farkode.h for additional information */ void FARK_DENSESETJAC(int *flag, int *ier) { if (*flag == 0) { *ier = ARKDlsSetDenseJacFn(ARK_arkodemem, NULL); } else { *ier = ARKDlsSetDenseJacFn(ARK_arkodemem, FARKDenseJac); } return; } /*=============================================================*/ /* C interface to user-supplied Fortran routine FARKDJAC; see farkode.h for additional information */ int FARKDenseJac(long int N, realtype t, N_Vector y, N_Vector fy, DlsMat J, void *user_data, N_Vector vtemp1, N_Vector vtemp2, N_Vector vtemp3) { int ier; realtype *ydata, *fydata, *jacdata, *v1data, *v2data, *v3data; realtype h; FARKUserData ARK_userdata; ARKodeGetLastStep(ARK_arkodemem, &h); ydata = N_VGetArrayPointer(y); fydata = N_VGetArrayPointer(fy); v1data = N_VGetArrayPointer(vtemp1); v2data = N_VGetArrayPointer(vtemp2); v3data = N_VGetArrayPointer(vtemp3); jacdata = DENSE_COL(J,0); ARK_userdata = (FARKUserData) user_data; FARK_DJAC(&N, &t, ydata, fydata, jacdata, &h, ARK_userdata->ipar, ARK_userdata->rpar, v1data, v2data, v3data, &ier); return(ier); } /*=============================================================== EOF ===============================================================*/
// Copyright 2015 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef FPGA_STRING_UTILS_H #define FPGA_STRING_UTILS_H #include <string> #include <vector> #include <sstream> #include <string.h> #include "lib/cstring.h" namespace FPGA { /// Return `source` as a_string_in_snake_case. /// https://en.wikipedia.org/wiki/Snake_case cstring SnakeCase(const cstring& source); /// Return `source` as AStringInCamelCase. /// https://en.wikipedia.org/wiki/CamelCase cstring CamelCase(const cstring& source); /// Return `source` as aStringInCamelCase. cstring camelCase(const cstring& source); /// Return `source` as ASTRINGINUPPERCASE. cstring UpperCase(const cstring& source); /// Return `source` with '.' replaced with '$' cstring RemoveDot(const cstring& source); // join a vector of elements by a delimiter object. ostream<< must be defined // for both class S and T and an ostream, as it is e.g. in the case of strings // and character arrays template<class S, class T> std::string join(std::vector<T>& elems, S& delim) { std::stringstream ss; typename std::vector<T>::iterator e = elems.begin(); ss << *e++; for (; e != elems.end(); ++e) { ss << delim << *e; } return ss.str(); } } // namespace FPGA #endif // FPGA_STRING_UTILS_H
/* * Copyright (C) 2014 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 SystemSleepListenerMac_h #define SystemSleepListenerMac_h #if PLATFORM(MAC) #include "SystemSleepListener.h" #include <wtf/WeakPtr.h> namespace WebCore { class SystemSleepListenerMac : public SystemSleepListener { protected: SystemSleepListenerMac(Client&); virtual ~SystemSleepListenerMac(); friend std::unique_ptr<SystemSleepListener> SystemSleepListener::create(Client&); WeakPtrFactory<SystemSleepListenerMac> m_weakPtrFactory; id m_sleepObserver; id m_wakeObserver; }; } #endif // PLATFORM(MAC) #endif // SystemSleepListenerMac_h
// // Copyright 2015 The ANGLE 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. // // WindowSurfaceCGL.h: CGL implementation of egl::Surface for windows #ifndef LIBANGLE_RENDERER_GL_CGL_WINDOWSURFACECGL_H_ #define LIBANGLE_RENDERER_GL_CGL_WINDOWSURFACECGL_H_ #include "libANGLE/renderer/gl/SurfaceGL.h" struct _CGLContextObject; typedef _CGLContextObject *CGLContextObj; @class CALayer; struct __IOSurface; typedef __IOSurface *IOSurfaceRef; // WebKit's build process requires that every Objective-C class name has the prefix "Web". @class WebSwapLayerCGL; namespace rx { class DisplayCGL; class FramebufferGL; class FunctionsGL; class RendererGL; class StateManagerGL; struct SharedSwapState { struct SwapTexture { GLuint texture; unsigned int width; unsigned int height; uint64_t swapId; }; SwapTexture textures[3]; // This code path is not going to be used by Chrome so we take the liberty // to use pthreads directly instead of using mutexes and condition variables // via the Platform API. pthread_mutex_t mutex; // The following members should be accessed only when holding the mutex // (or doing construction / destruction) SwapTexture *beingRendered; SwapTexture *lastRendered; SwapTexture *beingPresented; }; class WindowSurfaceCGL : public SurfaceGL { public: WindowSurfaceCGL(const egl::SurfaceState &state, RendererGL *renderer, EGLNativeWindowType layer, CGLContextObj context); ~WindowSurfaceCGL() override; egl::Error initialize(const egl::Display *display) override; egl::Error makeCurrent(const gl::Context *context) override; egl::Error swap(const gl::Context *context) override; egl::Error postSubBuffer(const gl::Context *context, EGLint x, EGLint y, EGLint width, EGLint height) override; egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override; egl::Error bindTexImage(const gl::Context *context, gl::Texture *texture, EGLint buffer) override; egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override; void setSwapInterval(EGLint interval) override; EGLint getWidth() const override; EGLint getHeight() const override; EGLint isPostSubBufferSupported() const override; EGLint getSwapBehavior() const override; FramebufferImpl *createDefaultFramebuffer(const gl::Context *context, const gl::FramebufferState &state) override; private: WebSwapLayerCGL *mSwapLayer; SharedSwapState mSwapState; uint64_t mCurrentSwapId; CALayer *mLayer; CGLContextObj mContext; const FunctionsGL *mFunctions; StateManagerGL *mStateManager; GLuint mDSRenderbuffer; }; } // namespace rx #endif // LIBANGLE_RENDERER_GL_CGL_WINDOWSURFACECGL_H_
// Copyright 2010 Susumu Yata <syata@acm.org> #ifndef NWC_TOOLKIT_CETR_LINE_H_ #define NWC_TOOLKIT_CETR_LINE_H_ #include "./cetr-unit.h" #include "./string.h" namespace nwc_toolkit { class CetrLine { public: CetrLine() : units_(NULL), num_units_(0), num_tags_(0), num_chars_(0), num_text_chars_(0) {} ~CetrLine() { Clear(); } CetrLine(const CetrLine &line) : units_(line.units_), num_units_(line.num_units_), num_tags_(line.num_tags_), num_chars_(line.num_chars_), num_text_chars_(line.num_text_chars_) {} CetrLine &operator=(const CetrLine &line) { units_ = line.units_; num_units_ = line.num_units_; num_tags_ = line.num_tags_; num_chars_ = line.num_chars_; num_text_chars_ = line.num_text_chars_; return *this; } const CetrUnit &unit(std::size_t id) const { return units_[id]; } std::size_t num_units() const { return num_units_; } std::size_t num_tags() const { return num_tags_; } std::size_t num_chars() const { return num_chars_; } std::size_t num_text_chars() const { return num_text_chars_; } void set_units(const CetrUnit *units) { units_ = units; } void set_num_units(std::size_t num_units) { num_units_ = num_units; } void set_num_tags(std::size_t num_tags) { num_tags_ = num_tags; } void set_num_chars(std::size_t num_chars) { num_chars_ = num_chars; } void set_num_text_chars(std::size_t num_text_chars) { num_text_chars_ = num_text_chars; } void Clear() { units_ = NULL; num_units_ = 0; num_tags_ = 0; num_chars_ = 0; num_text_chars_ = 0; } private: const CetrUnit *units_; std::size_t num_units_; std::size_t num_tags_; std::size_t num_chars_; std::size_t num_text_chars_; // Copyable. }; } // namespace nwc_toolkit #endif // NWC_TOOLKIT_CETR_LINE_H_
/* * nd.h * * Written by: Ullrich Hafner * * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> */ /* * $Date: 2000/06/14 20:50:31 $ * $Author: hafner $ * $Revision: 5.1 $ * $State: Exp $ */ #ifndef _ND_H #define _ND_H #include "wfa.h" #include "bit-io.h" void write_nd (const wfa_t *wfa, bitfile_t *output); #endif /* not _ND_H */
/* * Copyright (c) 2016, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL CORPORATION 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. */ /* * Sensor Subsystem (SS) Low Power Sensing Standby (LPSS) State * * This application configures the ARC to be ready for LPSS. * LPSS will be enabled by a state transition to C2/C2LP from the x86 core * after this application has executed on ARC. * * In order to enter LPSS, this application can run in conjonction with its * x86 counterpart located in examples/quark_se/configure_lpss/. * * Any application on x86 which requires LPSS can use this example. * * Refer to the x86 example for more details. */ #include "qm_interrupt.h" #include "qm_isr.h" #include "ss_power_states.h" /* Mask for all comparator lines */ #define QM_AC_COMPARATORS_MASK (0x7FFFF) /* Empty ISR, the real handling will be performed by the x86 core. */ static QM_ISR_DECLARE(dummy_isr) { } int main(void) { /* * All interrupts to wake up from LPSS state need * to be registered to transition again to LPSS. * * The only wake events for LPSS are RTC, AON GPIO, * AON Counter and AON Comparator. * * All interrupts below will wake up the Sensor Subsystem. */ qm_irq_request(QM_IRQ_RTC_0_INT, dummy_isr); qm_irq_request(QM_IRQ_COMPARATOR_0_INT, dummy_isr); qm_irq_request(QM_IRQ_AONPT_0_INT, dummy_isr); qm_irq_request(QM_IRQ_AON_GPIO_0_INT, dummy_isr); /* Unmask comparator interrupts for the Sensor Subsystenm */ QM_INTERRUPT_ROUTER->comparator_0_ss_halt_int_mask &= ~QM_AC_COMPARATORS_MASK; /* * Enable LPSS by the Sensor Subsystem. * This will clock gate sensor peripherals. */ ss_power_soc_lpss_enable(); /* Loop on SS2 to be ready for LPSS even after wake-up. */ while (1) { ss_power_cpu_ss2(); } return 0; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__int_large_to_char_67b.c Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml Template File: sources-sink-67b.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_char * BadSink : Convert data to a char * Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" typedef struct _CWE197_Numeric_Truncation_Error__int_large_to_char_67_structType { int structFirst; } CWE197_Numeric_Truncation_Error__int_large_to_char_67_structType; #ifndef OMITBAD void CWE197_Numeric_Truncation_Error__int_large_to_char_67b_badSink(CWE197_Numeric_Truncation_Error__int_large_to_char_67_structType myStruct) { int data = myStruct.structFirst; { /* POTENTIAL FLAW: Convert data to a char, possibly causing a truncation error */ char charData = (char)data; printHexCharLine(charData); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE197_Numeric_Truncation_Error__int_large_to_char_67b_goodG2BSink(CWE197_Numeric_Truncation_Error__int_large_to_char_67_structType myStruct) { int data = myStruct.structFirst; { /* POTENTIAL FLAW: Convert data to a char, possibly causing a truncation error */ char charData = (char)data; printHexCharLine(charData); } } #endif /* OMITGOOD */
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2017, Image Engine Design 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 John Haddon nor the names of // any other contributors to this software 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 GAFFERIMAGE_CATALOGUE_H #define GAFFERIMAGE_CATALOGUE_H #include "GafferImage/ImageNode.h" #include "Gaffer/NumericPlug.h" #include "Gaffer/StringPlug.h" #include "Gaffer/Switch.h" #include "IECoreImage/DisplayDriver.h" #include "IECoreImage/DisplayDriverServer.h" namespace GafferImage { class GAFFERIMAGE_API Catalogue : public ImageNode { public : GAFFER_GRAPHCOMPONENT_DECLARE_TYPE( GafferImage::Catalogue, CatalogueTypeId, ImageNode ); Catalogue( const std::string &name = defaultName<Catalogue>() ); ~Catalogue() override; /// Plug type used to represent an image in the catalogue. class Image : public Gaffer::Plug { public : GAFFER_PLUG_DECLARE_TYPE( GafferImage::Catalogue::Image, CatalogueImageTypeId, Gaffer::Plug ); Image( const std::string &name = defaultName<Image>(), Direction direction = In, unsigned flags = Default ); Gaffer::StringPlug *fileNamePlug(); const Gaffer::StringPlug *fileNamePlug() const; Gaffer::StringPlug *descriptionPlug(); const Gaffer::StringPlug *descriptionPlug() const; /// Primarily used to take a snapshot of a live render. /// This image must have have been added to a Catalogue /// before calling. The snapshot will be saved to disk /// asynchronously. void copyFrom( const Image *other ); static Ptr load( const std::string &fileName ); void save( const std::string &fileName ) const; Gaffer::PlugPtr createCounterpart( const std::string &name, Direction direction ) const override; private : // The Catalogue needs to know the name of each image // so it can support the `catalogue:imageName` context // variable. But computes can only depend on plugs, // so we transfer the name into this private plug // each time it changes. void nameChanged(); Gaffer::StringPlug *namePlug(); const Gaffer::StringPlug *namePlug() const; friend class Catalogue; }; typedef Gaffer::FilteredChildIterator<Gaffer::PlugPredicate<Gaffer::Plug::Invalid, Image> > ImageIterator; Gaffer::Plug *imagesPlug(); const Gaffer::Plug *imagesPlug() const; Gaffer::IntPlug *imageIndexPlug(); const Gaffer::IntPlug *imageIndexPlug() const; Gaffer::StringPlug *namePlug(); const Gaffer::StringPlug *namePlug() const; Gaffer::StringPlug *directoryPlug(); const Gaffer::StringPlug *directoryPlug() const; /// All Catalogues share a single DisplayDriverServer instance /// to receive rendered images. To send an image to the catalogues, /// use an IECoreImage::ClientDisplayDriver with the "displayPort" parameter /// set to match `Catalogue::displayDriverServer()->portNumber()`. static IECoreImage::DisplayDriverServer *displayDriverServer(); /// Generates a filename that could be used for storing /// a particular image locally in this Catalogue's directory. /// Primarily exists to be used in the UI. std::string generateFileName( const Image *image ) const; std::string generateFileName( const ImagePlug *image ) const; void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const override; private : Gaffer::IntPlug *internalImageIndexPlug(); const Gaffer::IntPlug *internalImageIndexPlug() const; Gaffer::Switch *imageSwitch(); const Gaffer::Switch *imageSwitch() const; IE_CORE_FORWARDDECLARE( InternalImage ); static InternalImage *imageNode( Image *image ); static const InternalImage *imageNode( const Image *image ); void imageAdded( GraphComponent *graphComponent ); void imageRemoved( GraphComponent *graphComponent ); void driverCreated( IECoreImage::DisplayDriver *driver, const IECore::CompoundData *parameters ); void imageReceived( Gaffer::Plug *plug ); void hash( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const override; void compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const override; static size_t g_firstPlugIndex; }; IE_CORE_DECLAREPTR( Catalogue ); } // namespace GafferImage #endif // GAFFERIMAGE_CATALOGUE_H
// Copyright 2014 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd // // Defines Muxer flags. #ifndef APP_MUXER_FLAGS_H_ #define APP_MUXER_FLAGS_H_ #include <gflags/gflags.h> DECLARE_string(profile); DECLARE_double(clear_lead); DECLARE_bool(single_segment); DECLARE_double(segment_duration); DECLARE_bool(segment_sap_aligned); DECLARE_double(fragment_duration); DECLARE_bool(fragment_sap_aligned); DECLARE_int32(num_subsegments_per_sidx); DECLARE_string(temp_dir); #endif // APP_MUXER_FLAGS_H_
#ifndef __TOKENIZER_H__ #define __TOKENIZER_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> /** * Control structure for a string tokenizer. Maintains the * tokenizer's state. */ typedef struct tokenizer { char *str; /* the string to parse */ char *pos; /* position in string */ } TOKENIZER; /** * Initializes the tokenizer * * @param string the string that will be tokenized. Should be non-NULL. * @return an initialized string tokenizer on success, NULL on error. */ TOKENIZER *init_tokenizer( char *string ); /** * Deallocates space used by the tokenizer. * @param tokenizer a non-NULL, initialized string tokenizer */ void free_tokenizer( TOKENIZER *tokenizer ); /** * Retrieves the next token in the string. The returned token is * malloc'd in this function, so you should free it when done. * * @param tokenizer an initiated string tokenizer * @return the next token */ char *get_next_token( TOKENIZER *tokenizer ); #endif
/* * Copyright (c) 2010, 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. * * 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 WebGLContextAttributes_h #define WebGLContextAttributes_h #include "bindings/core/v8/ScriptWrappable.h" #include "core/html/canvas/CanvasContextAttributes.h" #include "public/platform/WebGraphicsContext3D.h" #include "wtf/PassRefPtr.h" namespace blink { class Settings; class WebGLContextAttributes final : public CanvasContextAttributes, public ScriptWrappable { DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(WebGLContextAttributes); DEFINE_WRAPPERTYPEINFO(); public: // Create a new attributes object static PassRefPtrWillBeRawPtr<WebGLContextAttributes> create(); // Create a copy of this object. PassRefPtrWillBeRawPtr<WebGLContextAttributes> clone() const; // Whether or not the drawing buffer has an alpha channel; default=true bool alpha() const; void setAlpha(bool); // Whether or not the drawing buffer has a depth buffer; default=true bool depth() const; void setDepth(bool); // Whether or not the drawing buffer has a stencil buffer; default=false bool stencil() const; void setStencil(bool); // Whether or not the drawing buffer is antialiased; default=true bool antialias() const; void setAntialias(bool); // Whether or not to treat the values in the drawing buffer as // though their alpha channel has already been multiplied into the // color channels; default=true bool premultipliedAlpha() const; void setPremultipliedAlpha(bool); // Whether or not to preserve the drawing buffer after presentation to the // screen; default=false bool preserveDrawingBuffer() const; void setPreserveDrawingBuffer(bool); // Whether or not to fail context creation if performance will be // significantly degraded compared to a native GL context; default=false bool failIfMajorPerformanceCaveat() const; void setFailIfMajorPerformanceCaveat(bool); // Set up the attributes that can be used to initialize a WebGraphicsContext3D. // It's mostly based on WebGLContextAttributes, but would be adjusted based // on settings. blink::WebGraphicsContext3D::Attributes attributes(const blink::WebString&, Settings*, unsigned webGLVersion) const; protected: WebGLContextAttributes(); WebGLContextAttributes(const WebGLContextAttributes&); private: bool m_alpha; bool m_depth; bool m_stencil; bool m_antialias; bool m_premultipliedAlpha; bool m_preserveDrawingBuffer; bool m_failIfMajorPerformanceCaveat; }; } // namespace blink #endif // WebGLContextAttributes_h
// 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 REMOTING_PROTOCOL_SESSION_H_ #define REMOTING_PROTOCOL_SESSION_H_ #include <memory> #include <string> #include "base/macros.h" #include "remoting/protocol/errors.h" #include "remoting/protocol/session_config.h" #include "remoting/protocol/transport.h" namespace remoting { namespace protocol { class SessionPlugin; class Transport; // Session is responsible for initializing and authenticating both incoming and // outgoing connections. It uses TransportInfoSink interface to pass // transport-info messages to the transport. class Session { public: enum State { // Created, but not connecting yet. INITIALIZING, // Sent session-initiate, but haven't received session-accept. CONNECTING, // Received session-initiate, but haven't sent session-accept. ACCEPTING, // Session has been accepted and is pending authentication. ACCEPTED, // Session has started authenticating. AUTHENTICATING, // Session has been connected and authenticated. AUTHENTICATED, // Session has been closed. CLOSED, // Connection has failed. FAILED, }; class EventHandler { public: EventHandler() {} virtual ~EventHandler() {} // Called after session state has changed. It is safe to destroy // the session from within the handler if |state| is AUTHENTICATING // or CLOSED or FAILED. virtual void OnSessionStateChange(State state) = 0; }; Session() {} Session(const Session&) = delete; Session& operator=(const Session&) = delete; virtual ~Session() {} // Set event handler for this session. |event_handler| must outlive // this object. virtual void SetEventHandler(EventHandler* event_handler) = 0; // Returns error code for a failed session. virtual ErrorCode error() = 0; // JID of the other side. virtual const std::string& jid() = 0; // Protocol configuration. Can be called only after session has been accepted. // Returned pointer is valid until connection is closed. virtual const SessionConfig& config() = 0; // Sets Transport to be used by the session. Must be called before the // session becomes AUTHENTICATED. The transport must outlive the session. virtual void SetTransport(Transport* transport) = 0; // Closes connection. EventHandler is guaranteed not to be called after this // method returns. |error| specifies the error code in case when the session // is being closed due to an error. virtual void Close(ErrorCode error) = 0; // Adds a SessionPlugin to handle attachments. To ensure plugin attachments // are processed correctly for session-initiate message, this function must be // called immediately after SessionManager::Connect() for outgoing connections // or in the IncomingSessionCallback handler for incoming connections. virtual void AddPlugin(SessionPlugin* plugin) = 0; }; } // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_SESSION_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE506_Embedded_Malicious_Code__file_transfer_connect_socket_09.c Label Definition File: CWE506_Embedded_Malicious_Code__file_transfer.badonly.label.xml Template File: point-flaw-badonly-09.tmpl.c */ /* * @description * CWE: 506 Embedded Malicious Code * Sinks: connect_socket * BadSink : Send file contents using a connect socket (client side) * BadOnly (No GoodSink) * Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) * * */ #include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define FILENAME "conf.txt" #ifndef OMITBAD void CWE506_Embedded_Malicious_Code__file_transfer_connect_socket_09_bad() { if(GLOBAL_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char contents[65536]; /* Assume file contents is less than 65k to make this test case easier to implement */ FILE * pFile; pFile = fopen(FILENAME, "r"); if (pFile != NULL) { if (fgets(contents, (int)(65535), pFile) == NULL) { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ contents[0] = '\0'; } fclose(pFile); } do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* FLAW: Send the contents of a file over the network */ if (send(connectSocket, contents, strlen(contents), 0) != strlen(contents)) { break; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } } #endif /* OMITBAD */ /* 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 OMITBAD printLine("Calling bad()..."); CWE506_Embedded_Malicious_Code__file_transfer_connect_socket_09_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #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_UI_VIEWS_TEST_VIEW_EVENT_TEST_BASE_H_ #define CHROME_BROWSER_UI_VIEWS_TEST_VIEW_EVENT_TEST_BASE_H_ // We only want to use ViewEventTestBase in test targets which properly // isolate each test case by running each test in a separate process. // This way if a test hangs the test launcher can reliably terminate it. #if !defined(HAS_OUT_OF_PROC_TEST_RUNNER) #error Can't reliably terminate hanging event tests without OOP test runner. #endif #include <memory> #include "base/bind.h" #include "base/callback.h" #include "base/run_loop.h" #include "base/threading/thread.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/test/views/chrome_views_test_base.h" #if defined(USE_AURA) && !BUILDFLAG(IS_CHROMEOS_ASH) namespace display { class Screen; } #endif namespace gfx { class Size; } class TestBaseWidgetDelegate; // Base class for Views based tests that dispatch events. // // As views based event test involves waiting for events to be processed, // writing a views based test is slightly different than that of writing // other unit tests. In particular when the test fails or is done you need // to stop the message loop. This can be done by way of invoking the Done // method. // // Any delayed callbacks should be done by way of CreateEventTask. // CreateEventTask checks to see if ASSERT_XXX has been invoked after invoking // the task. If there was a failure Done is invoked and the test stops. // // ViewEventTestBase creates a Window with the View returned from // CreateContentsView. The preferred size for the view can be customized by // overriding GetPreferredSizeForContents. If you do not override // GetPreferredSizeForContents the preferred size of the view returned from // CreateContentsView is used. // // Subclasses of ViewEventTestBase must implement two methods: // . DoTestOnMessageLoop: invoked when the message loop is running. Run your // test here, invoke Done when done. // . CreateContentsView: returns the view to place in the window. // // Once you have created a ViewEventTestBase use the macro VIEW_TEST to define // the fixture. // // Testing drag and drop is tricky because the mouse move that initiates drag // and drop may trigger a nested native event loop that waits for more mouse // messages. Once a drag begins, all UI events until the drag ends must be // driven from observer callbacks and posted on the task runner returned by // GetDragTaskRunner(). class ViewEventTestBase : public ChromeViewsTestBase { public: ViewEventTestBase(); ViewEventTestBase(const ViewEventTestBase&) = delete; ViewEventTestBase& operator=(const ViewEventTestBase&) = delete; ~ViewEventTestBase() override; static void SetUpTestCase(); // ChromeViewsTestBase: void SetUp() override; void TearDown() override; views::Widget::InitParams CreateParams( views::Widget::InitParams::Type type) override; // Returns the view that is added to the window. virtual std::unique_ptr<views::View> CreateContentsView() = 0; // Returns an empty Size. Subclasses that want a preferred size other than // that of the View returned by CreateContentsView should override this // appropriately. virtual gfx::Size GetPreferredSizeForContents() const; // Invoke when done either because of failure or success. Quits the message // loop. void Done(); views::Widget* window() { return window_; } protected: // Called once the message loop is running. virtual void DoTestOnMessageLoop() = 0; // Invoke from test main. Shows the window, starts the message loop and // schedules a task that invokes DoTestOnMessageLoop. void StartMessageLoopAndRunTest(); // Creates a task that calls the specified method back. The specified // method is called in such a way that if there are any test failures // Done is invoked. template <class T, class Method> base::OnceClosure CreateEventTask(T* target, Method method) { return base::BindOnce(&ViewEventTestBase::RunTestMethod, base::Unretained(this), base::BindOnce(method, base::Unretained(target))); } // Returns a task runner to use for drag-related mouse events. scoped_refptr<base::SingleThreadTaskRunner> GetDragTaskRunner(); private: friend class TestBaseWidgetDelegate; // Callback from CreateEventTask. Runs the supplied task and if there are // failures invokes Done. void RunTestMethod(base::OnceClosure task); #if defined(USE_AURA) && !BUILDFLAG(IS_CHROMEOS_ASH) std::unique_ptr<display::Screen> screen_; #endif // Thread for posting background drag events. std::unique_ptr<base::Thread> drag_event_thread_; base::RunLoop run_loop_; views::Widget* window_ = nullptr; }; // Convenience macro for defining a ViewEventTestBase. See class description // of ViewEventTestBase for details. #define VIEW_TEST(test_class, name) \ TEST_F(test_class, name) { StartMessageLoopAndRunTest(); } #endif // CHROME_BROWSER_UI_VIEWS_TEST_VIEW_EVENT_TEST_BASE_H_
/****************************************************************** * * Round for C * * Copyright (C) Satoshi Konno 2015 * * This is licensed under BSD-style license, see file COPYING. * ******************************************************************/ #ifndef _ROUND_UTIL_BASE64_H_ #define _ROUND_UTIL_BASE64_H_ #include <round/typedef.h> #ifdef __cplusplus extern "C" { #endif /**************************************** * Function ****************************************/ ssize_t round_base64_encode(const byte *rawBytes, size_t rawByteLen, char **encodedStr); ssize_t round_base64_decode(const char *encodedStr, byte **decordedBytes); #ifdef __cplusplus } #endif #endif
#include "f2c.h" extern integer s_cmp(); shortint h_sign(a,b) shortint *a, *b; { shortint x; x = (*a >= 0 ? *a : - *a); return( *b >= 0 ? x : -x); }
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This class helps to remember what domains may be needed to be resolved when a // navigation takes place to a given URL. This information is gathered when a // navigation to a subresource identifies a referring URL. // When future navigations take place to known referrer sites, then we // speculatively either pre-warm a TCP/IP conneciton, or at a minimum, resolve // the host name via DNS. // All access to this class is performed via the Predictor class, which only // operates on the IO thread. #ifndef CHROME_BROWSER_NET_REFERRER_H_ #define CHROME_BROWSER_NET_REFERRER_H_ #include <map> #include <stdint.h> #include "base/macros.h" #include "base/time/time.h" #include "net/base/host_port_pair.h" #include "url/gurl.h" namespace base { class Value; } namespace chrome_browser_net { //------------------------------------------------------------------------------ // For each hostname in a Referrer, we have a ReferrerValue. It indicates // exactly how much value (re: latency reduction, or connection use) has // resulted from having this entry. class ReferrerValue { public: ReferrerValue(); // Used during deserialization. void SetSubresourceUseRate(double rate) { subresource_use_rate_ = rate; } base::Time birth_time() const { return birth_time_; } // Record the fact that we navigated to the associated subresource URL. This // will increase the value of the expected subresource_use_rate_ void SubresourceIsNeeded(); // Record the fact that the referrer of this subresource was observed. This // will diminish the expected subresource_use_rate_ (and will only be // counteracted later if we really needed this subresource as a consequence // of our associated referrer.) void ReferrerWasObserved(); int64_t navigation_count() const { return navigation_count_; } double subresource_use_rate() const { return subresource_use_rate_; } int64_t preconnection_count() const { return preconnection_count_; } void IncrementPreconnectionCount() { ++preconnection_count_; } int64_t preresolution_count() const { return preresolution_count_; } void preresolution_increment() { ++preresolution_count_; } private: const base::Time birth_time_; // The number of times this item was navigated to with the fixed referrer. int64_t navigation_count_; // The number of times this item was preconnected as a consequence of its // referrer. int64_t preconnection_count_; // The number of times this item was pre-resolved (via DNS) as a consequence // of its referrer. int64_t preresolution_count_; // A smoothed estimate of the expected number of connections that will be made // to this subresource. double subresource_use_rate_; }; //------------------------------------------------------------------------------ // A list of domain names to pre-resolve. The names are the keys to this map, // and the values indicate the amount of benefit derived from having each name // around. typedef std::map<GURL, ReferrerValue> SubresourceMap; //------------------------------------------------------------------------------ // There is one Referrer instance for each hostname that has acted as an HTTP // referer (note mispelling is intentional) for a hostname that was otherwise // unexpectedly navgated towards ("unexpected" in the sense that the hostname // was probably needed as a subresource of a page, and was not otherwise // predictable until the content with the reference arrived). Most typically, // an outer page was a page fetched by the user, and this instance lists names // in SubresourceMap which are subresources and that were needed to complete the // rendering of the outer page. class Referrer : public SubresourceMap { public: Referrer(); void IncrementUseCount() { ++use_count_; } int64_t use_count() const { return use_count_; } // Add the indicated url to the list that are resolved via DNS when the user // navigates to this referrer. Note that if the list is long, an entry may be // discarded to make room for this insertion. void SuggestHost(const GURL& url); // Provide methods for persisting, and restoring contents into a Value class. base::Value* Serialize() const; void Deserialize(const base::Value& referrers); private: // Helper function for pruning list. Metric for usefulness is "large accrued // value," in the form of latency_ savings associated with a host name. We // also give credit for a name being newly added, by scalling latency per // lifetime (time since birth). For instance, when two names have accrued // the same latency_ savings, the older one is less valuable as it didn't // accrue savings as quickly. void DeleteLeastUseful(); // The number of times this referer had its subresources scanned for possible // preconnection or DNS preresolution. int64_t use_count_; // We put these into a std::map<>, so we need copy constructors. // DISALLOW_COPY_AND_ASSIGN(Referrer); // TODO(jar): Consider optimization to use pointers to these instances, and // avoid deep copies during re-alloc of the containing map. }; } // namespace chrome_browser_net #endif // CHROME_BROWSER_NET_REFERRER_H_
#ifndef SHOW_H #define SHOW_H #include "UI/Common/AppBase.h" #include "UI/Common/ScrollBar.h" #include "UI/Common/Button.h" #include "Common/AppListWidget.h" typedef struct softButton{ bool b_isHighlighted; int i_softButtonID; std::string str_text; softButton() { b_isHighlighted = false; i_softButtonID = 0; str_text.clear(); } }SSoftButton; class Show : public AppBase { Q_OBJECT public: explicit Show(AppListInterface * pList, QWidget *parent = 0); ~Show(); typedef enum {INIT=0,NOT_USED,IN_USE,CLOCK_WAIT,CLOCK_END}MediaClock_STATUS; void UpdateMediaColckTimer(); signals: void moreClicked(); void returnAppLink(); void startMediaClock(bool); //void softButtonClicked(int btID, int mode); public slots: void onListSelect(const QModelIndex &index); void btnOneClickedSlots(int); void btnTwoClickedSlots(int); void btnThrClickedSlots(int); void btnFourClickedSlots(); void btnThrClickedLongSlots(int btID); void btnTwoClickedLongSlots(int btID); void btnOneClickedLongSlots(int btID); void mediaClockSlots(bool); void timerEvent(QTimerEvent *e); protected: virtual void showEvent(QShowEvent * e); private: void setAlignment(int type); void setMediaTrack(bool isShow, QString text); void setMediaClock(bool isShow, QString text); void setSoftButtons(std::vector<SSoftButton> vec_softButtons); void initLayout(); void addListItem(); QLabel m_lab_icon; AppListWidget *m_listWidget; QLabel m_lab_mediaTrack; QLabel m_lab_mediaClock; MediaClock_STATUS m_mediaClock_status; CButton *m_btn_one; CButton *m_btn_two; CButton *m_btn_thr; CButton *m_btn_fou; QVector <QLabel *> m_vec_listLabel; std::vector<SSoftButton> m_vec_softButtons; int m_i_totalNum; int m_i_currentNo; int m_timerId; // QTimer *m_timer_mediaClock; QTime nowMeidaClockTime; int m_i_startH; int m_i_startM; int m_i_startS; int m_i_endH; int m_i_endM; int m_i_endS; bool m_b_countup; }; #endif // SHOW_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE127_Buffer_Underread__char_declare_memmove_53c.c Label Definition File: CWE127_Buffer_Underread.stack.label.xml Template File: sources-sink-53c.tmpl.c */ /* * @description * CWE: 127 Buffer Under-read * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sink: memmove * BadSink : Copy data to string using memmove * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE127_Buffer_Underread__char_declare_memmove_53d_badSink(char * data); void CWE127_Buffer_Underread__char_declare_memmove_53c_badSink(char * data) { CWE127_Buffer_Underread__char_declare_memmove_53d_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE127_Buffer_Underread__char_declare_memmove_53d_goodG2BSink(char * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE127_Buffer_Underread__char_declare_memmove_53c_goodG2BSink(char * data) { CWE127_Buffer_Underread__char_declare_memmove_53d_goodG2BSink(data); } #endif /* OMITGOOD */
// 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_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_H_ #define CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_H_ #pragma once #include "ui/gfx/rect.h" // Encapsulates the logic to provide display settings support, including the // information for: // 1) Work area // 2) Auto-hiding desktop bars, like Windows taskbar and MacOSX dock. class DisplaySettingsProvider { public: // Indicates which screen edge the desktop bar is aligned to. // We do not care about the desktop aligned to the top screen edge. enum DesktopBarAlignment { DESKTOP_BAR_ALIGNED_BOTTOM = 0, DESKTOP_BAR_ALIGNED_LEFT = 1, DESKTOP_BAR_ALIGNED_RIGHT = 2 }; // Indicates current visibility state of the desktop bar. enum DesktopBarVisibility { DESKTOP_BAR_VISIBLE, DESKTOP_BAR_ANIMATING, DESKTOP_BAR_HIDDEN }; // Observer can listen to various events regarding the desktop bar changes. class Observer { public: // Called when any of the desktop bars get their thickness changed. // Note that if an auto-hiding desktop bar is moved from one edge // to another edge, it will cause thickness changes to both edges. virtual void OnAutoHidingDesktopBarThicknessChanged() = 0; // Called when an auto-hiding desktop bar has its visibility changed. virtual void OnAutoHidingDesktopBarVisibilityChanged( DesktopBarAlignment alignment, DesktopBarVisibility visibility) = 0; }; static DisplaySettingsProvider* Create(Observer* observer); virtual ~DisplaySettingsProvider(); // Returns the bounds of the work area. virtual gfx::Rect GetWorkArea(); // Returns true if there is a desktop bar that is aligned to the specified // screen edge and set to auto-hide. virtual bool IsAutoHidingDesktopBarEnabled(DesktopBarAlignment alignment); // Returns the thickness of the desktop bar that is aligned to the specified // screen edge, when it is visible. When the desktop bar is aligned to bottom // edge, this is the height of the bar. If the desktop bar is aligned to // left or right edge, this is the width of the bar. virtual int GetDesktopBarThickness(DesktopBarAlignment alignment) const; // Returns the visibility state of the desktop bar that is aligned to the // specified screen edge. virtual DesktopBarVisibility GetDesktopBarVisibility( DesktopBarAlignment alignment) const; #ifdef UNIT_TEST void set_work_area(const gfx::Rect& work_area) { work_area_ = work_area; } #endif protected: explicit DisplaySettingsProvider(Observer* observer); // Invoked when the work area is changed in order to update the information // about the desktop bars. We only care about the desktop bars that sit on // the screen that hosts the specified work area. virtual void OnWorkAreaChanged(); Observer* observer_; gfx::Rect work_area_; }; #endif // CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81.h Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-81.tmpl.h */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sinks: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81 { class CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81_base { public: /* pure virtual function */ virtual void action(wchar_t * data) const = 0; }; #ifndef OMITBAD class CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81_bad : public CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81_base { public: void action(wchar_t * data) const; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memcpy_81_base { public: void action(wchar_t * data) const; }; #endif /* OMITGOOD */ }
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ** following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, this list of conditions and the ** following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ** following disclaimer in the documentation and/or other materials provided with the distribution. ** * Neither the name of the ETH Zurich nor the names of its contributors may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** **********************************************************************************************************************/ #pragma once #define ModelBase_VisitorDefinition #include "Visitor.h"
/*------------------------------------------------------------------------- * * pqsignal.h * Backend signal(2) support (see also src/port/pqsignal.c) * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/pqsignal.h * *------------------------------------------------------------------------- */ #ifndef PQSIGNAL_H #define PQSIGNAL_H #include <signal.h> #ifndef WIN32 #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) #else /* Emulate POSIX sigset_t APIs on Windows */ typedef int sigset_t; extern int pqsigsetmask(int mask); #define PG_SETMASK(mask) pqsigsetmask(*(mask)) #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~0) #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) #endif /* WIN32 */ extern sigset_t UnBlockSig, BlockSig, StartupBlockSig; extern void pqinitmask(void); /* pqsigfunc is declared in src/include/port.h */ extern pqsigfunc pqsignal_pm(int signo, pqsigfunc func); #endif /* PQSIGNAL_H */