text
stringlengths
4
6.14k
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include <string> #include <vector> #include <memory> class Model; class ModelManager; struct CADWriter; namespace ModelToCAD { std::unique_ptr<CADWriter> Create(std::string fileName, std::string const& type); bool ExportCAD(Model* m, std::string filePath, std::string const& type); bool ExportCAD(ModelManager* allmodels, std::string filePath, std::string const& type); };
/****************************************************************************/ /* Entropic (Shanghai) Co, LTD */ /* SOFTWARE FILE/MODULE HEADER */ /* Copyright Entropic Co, LTD */ /* All Rights Reserved */ /****************************************************************************/ /* * Filename: cs_fs_plus.c * * * Description: API implementation for COSHIP interface layer . * * *------------------------------------------------------------------------------- *ENTROPIC COMMENTS ON COSHIP HEADER FILE: 2013/11/06 The APIs in this header file are required for Android DVB-S2 plus OTT project. This module is used for the production test application. *------------------------------------------------------------------------------- ****************************************************************************/ #include "udi2_error.h" #include "udi2_public.h" #include "udi2_typedef.h" #include "udidrv_log.h" #include "cs_fs_plus.h" /** @brief FS³õʼ»¯ @return - CSHDI_ERROR_ALREADY_INITIALIZED£ºFS֮ǰÒѾ­±»³õʼ»¯¹ýÁË¡£ - CSHDI_FAILURE£ºFS³õʼ»¯Ê§°Ü¡£ - CSHDI_SUCCESS£ºFS³õʼ»¯³É¹¦¡£ */ CSUDI_Error_Code CSUDIFSInit(void) { UDIDRV_LOGI("%s %s begin\n", __FUNCTION__, UDIDRV_IMPLEMENTED); CSUDI_Error_Code Retcode = CSUDI_SUCCESS; UDIDRV_LOGI("%s (Retcode =%d)end\n", __FUNCTION__, Retcode); return Retcode; } /** @brief ÏòFSÖÐÔö¼ÓÒ»¸ö·ÇÈȲå°Î·ÖÇø,ÒÔʹFS×Ô¶¯¹ÒÔØ¸Ã·ÖÇø @param[in] szPartition ·ÖÇøÃû @param[in] eFsType ·ÖÇøµÄÀàÐÍ @return - CSHDI_FAILURE£ºÏòFSÖÐÔö¼Ó´Ë·ÖÇøÊ§°Ü - CSHDI_SUCCESS£ºÏòFSÖÐÔö¼Ó´Ë·ÖÇø³É¹¦¡£ - CSHDI_ERROR_FEATURE_NOT_SUPPORTED : ²»Ö§³ÖµÄÎļþϵͳÀàÐÍ @note ¸Ãº¯ÊýÔÚCSUDIFSInitºóµ÷Óã¬ÓÃÓÚ¸æÖªFS×Ô¶¯¹ÒÔØÖ¸¶¨µÄ·ÖÇøÉ豸¡£ ͨ³£FS¶ÔÓÚ¸ÃÖÖÉ豸ÎÞ·¨¼ì²âµ½»òÕßÎÞ·¨¾ö¶¨Ê¹ÓᣠÀýÈçÏòFSÖмÓÈëjffs¡¢cramfsµÈÀàÐ͵ÄÉ豸¡£ */ CSUDI_Error_Code CSUDIFSAddPartition(const char * szPartition, CSUDIFSPartitionType_E eFsType) { UDIDRV_LOGI("%s %s begin\n", __FUNCTION__, UDIDRV_IMPLEMENTED); CSUDI_Error_Code Retcode = CSUDI_SUCCESS; UDIDRV_LOGI("%s (Retcode =%d)end\n", __FUNCTION__, Retcode); return Retcode; }
/* * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com> * * This file is part of CasparCG (www.casparcg.com). * * CasparCG 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. * * CasparCG 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 CasparCG. If not, see <http://www.gnu.org/licenses/>. * * Author: Robert Nagy, ronag89@gmail.com */ #pragma once #include "log.h" #ifdef _MSC_VER #define _CASPAR_DBG_BREAK _CrtDbgBreak() #else #define _CASPAR_DBG_BREAK #endif #define CASPAR_VERIFY_EXPR_STR(str) #str #define CASPAR_VERIFY(expr) do{if(!(expr)){ CASPAR_LOG(warning) << "Assertion Failed: " << \ CASPAR_VERIFY_EXPR_STR(expr) << " " \ << "file:" << __FILE__ << " " \ << "line:" << __LINE__ << " "; \ _CASPAR_DBG_BREAK;\ }}while(0); #ifdef _DEBUG #define CASPAR_ASSERT(expr) CASPAR_VERIFY(expr) #else #define CASPAR_ASSERT(expr) #endif
#pragma once #include <thread> class ComputationThread { public: void Start(); protected: std::thread mThread; virtual ~ComputationThread(); virtual void Calculate() = 0; public: void join(); };
/* * Unix SMB/CIFS implementation. * Samba system utilities * Copyright (C) Jeremy Allison 2000 * * 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 __LIB_SYS_POPEN_H__ #define __LIB_SYS_POPEN_H__ int sys_popenv(char * const argl[]); int sys_pclose(int fd); #endif
#ifndef WID_PROJEKTI_H #define WID_PROJEKTI_H #include <QWidget> namespace Ui { class wid_projekti; } class wid_projekti : public QWidget { Q_OBJECT public: explicit wid_projekti(QWidget *parent = 0); ~wid_projekti(); private slots: void on_cb_stranka_currentIndexChanged(); void on_cb_mesec_currentIndexChanged(); void on_cb_leto_currentIndexChanged(); void on_cb_projekt_currentIndexChanged(); void on_tbl_projekti_doubleClicked(); void on_btn_nov_clicked(); void on_btn_brisi_clicked(); void on_btn_kopiraj_clicked(); void osvezi(QString beseda); void napolni(); QString pretvori(QString besedilo); QString prevedi(QString besedilo); signals: void prenos(QString beseda); private: Ui::wid_projekti *ui; }; #endif // WID_PROJEKTI_H
/** * @file ol_player_mpris.h * @author Tiger Soldier <tigersoldi@gmail.com> * @date Sun Jun 7 16:53:56 2009 * * @brief Supports all players that provides MPRIS interface * */ #ifndef _OL_PLAYER_MPRIS_H_ #define _OL_PLAYER_MPRIS_H_ #include "ol_music_info.h" typedef struct { DBusGProxy *proxy; gchar *name; } OlPlayerMpris; /** * @brief Creates a new MPRIS Player context * * @param service The service name of the player on dbus * * @return The created MPRIS Player context, should be destroyed by g_free */ OlPlayerMpris* ol_player_mpris_new (const char *service); gboolean ol_player_mpris_get_music_info (OlPlayerMpris *mpris, OlMusicInfo *info); gboolean ol_player_mpris_get_played_time (OlPlayerMpris *mpris, int *played_time); gboolean ol_player_mpris_get_music_length (OlPlayerMpris *mpris, int *len); gboolean ol_player_mpris_get_activated (OlPlayerMpris *mpris); int ol_player_mpris_get_capacity (OlPlayerMpris *mpris); enum OlPlayerStatus ol_player_mpris_get_status (OlPlayerMpris *mpris); gboolean ol_player_mpris_play (OlPlayerMpris *mpris); gboolean ol_player_mpris_pause (OlPlayerMpris *mpris); gboolean ol_player_mpris_stop (OlPlayerMpris *mpris); gboolean ol_player_mpris_prev (OlPlayerMpris *mpris); gboolean ol_player_mpris_next (OlPlayerMpris *mpris); gboolean ol_player_mpris_seek (OlPlayerMpris *mpris, int pos_ms); #endif /* _OL_PLAYER_MPRIS_H_ */
/* Copyright (C) 2013 Statoil ASA, Norway. The file 'ecl_kw_equal.c' is part of ERT - Ensemble based Reservoir Tool. ERT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ERT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> for more details. */ #include <stdlib.h> #include <stdbool.h> #include <ert/util/test_util.h> #include <ert/util/util.h> #include <ert/ecl/ecl_kw.h> int main(int argc , char ** argv) { ecl_kw_type * ecl_kw1 = ecl_kw_alloc( "KW" , 10 , ECL_INT_TYPE ); int data[10]; int i; for (i=0; i < 10; i++) { ecl_kw_iset_int(ecl_kw1 , i , i ); data[i] = i; } { ecl_kw_type * ecl_kw2 = ecl_kw_alloc_copy( ecl_kw1 ); test_assert_true( ecl_kw_equal( ecl_kw1 , ecl_kw2 )); ecl_kw_iset_int( ecl_kw2 , 1 , 77 ); test_assert_false( ecl_kw_equal( ecl_kw1 , ecl_kw2 )); ecl_kw_iset_int( ecl_kw2 , 1 , 1 ); test_assert_true( ecl_kw_equal( ecl_kw1 , ecl_kw2 )); ecl_kw_set_header_name( ecl_kw2 , "TEST" ); test_assert_false( ecl_kw_equal( ecl_kw1 , ecl_kw2 )); test_assert_true( ecl_kw_content_equal( ecl_kw1 , ecl_kw2 )); ecl_kw_free( ecl_kw2 ); } { ecl_kw_type * ecl_ikw = ecl_kw_alloc_new_shared( "KW" , 10 , ECL_INT_TYPE , data); ecl_kw_type * ecl_fkw = ecl_kw_alloc_new_shared( "KW" , 10 , ECL_FLOAT_TYPE , data); test_assert_true( ecl_kw_content_equal( ecl_kw1 , ecl_ikw )); test_assert_false( ecl_kw_content_equal( ecl_kw1 , ecl_fkw )); } test_assert_true( ecl_kw_data_equal( ecl_kw1 , data )); data[0] = 99; test_assert_false( ecl_kw_data_equal( ecl_kw1 , data )); }
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * 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. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): 2008,2009 Joshua Leung (Animation Cleanup, Animation Systme Recode) * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BKE_IPO_H__ #define __BKE_IPO_H__ /** \file BKE_ipo.h * \ingroup bke * \since March 2001 * \author nzc * \author Joshua Leung */ #ifdef __cplusplus extern "C" { #endif struct Main; struct Ipo; void do_versions_ipos_to_animato(struct Main *main); /* --------------------- xxx stuff ------------------------ */ void BKE_ipo_free(struct Ipo *ipo); #ifdef __cplusplus }; #endif #endif
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifndef LMP_FORCE_H #define LMP_FORCE_H #include "pointers.h" #include <map> #include <string> namespace LAMMPS_NS { class Force : protected Pointers { public: double boltz; // Boltzmann constant (eng/degree-K) double hplanck; // Planck's constant (energy-time) double mvv2e; // conversion of mv^2 to energy double ftm2v; // conversion of ft/m to velocity double mv2d; // conversion of mass/volume to density double nktv2p; // conversion of NkT/V to pressure double qqr2e; // conversion of q^2/r to energy double qe2f; // conversion of qE to force double vxmu2f; // conversion of vx dynamic-visc to force double xxt2kmu; // conversion of xx/t to kinematic-visc double dielectric; // dielectric constant double qqrd2e; // q^2/r to energy w/ dielectric constant double e_mass; // electron mass double hhmrr2e; // conversion of (hbar)^2/(mr^2) to energy double mvh2r; // conversion of mv/hbar to distance // hbar = h/(2*pi) double angstrom; // 1 angstrom in native units double femtosecond; // 1 femtosecond in native units double qelectron; // 1 electron charge abs() in native units int newton,newton_pair,newton_bond; // Newton's 3rd law settings class Pair *pair; char *pair_style; typedef Pair *(*PairCreator)(LAMMPS *); std::map<std::string,PairCreator> *pair_map; class Bond *bond; char *bond_style; class Angle *angle; char *angle_style; class Dihedral *dihedral; char *dihedral_style; class Improper *improper; char *improper_style; class KSpace *kspace; char *kspace_style; // index [0] is not used in these arrays double special_lj[4]; // 1-2, 1-3, 1-4 prefactors for LJ double special_coul[4]; // 1-2, 1-3, 1-4 prefactors for Coulombics int special_angle; // 0 if defined angles are ignored // 1 if only weight 1,3 atoms if in an angle int special_dihedral; // 0 if defined dihedrals are ignored // 1 if only weight 1,4 atoms if in a dihedral int special_extra; // extra space for added bonds Force(class LAMMPS *); ~Force(); void init(); void create_pair(const char *, const char *suffix = NULL); class Pair *new_pair(const char *, const char *, int &); class Pair *pair_match(const char *, int); void create_bond(const char *, const char *suffix = NULL); class Bond *new_bond(const char *, const char *, int &); class Bond *bond_match(const char *); void create_angle(const char *, const char *suffix = NULL); class Angle *new_angle(const char *, const char *, int &); void create_dihedral(const char *, const char *suffix = NULL); class Dihedral *new_dihedral(const char *, const char *, int &); void create_improper(const char *, const char *suffix = NULL); class Improper *new_improper(const char *, const char *, int &); void create_kspace(int, char **, const char *suffix = NULL); class KSpace *new_kspace(int, char **, const char *, int &); class KSpace *kspace_match(const char *, int); void set_special(int, char **); void bounds(char *, int, int &, int &, int nmin=1); double numeric(const char *, int, char *); int inumeric(const char *, int, char *); bigint memory_usage(); private: template <typename T> static Pair *pair_creator(LAMMPS *); }; } #endif /* ERROR/WARNING messages: E: Invalid pair style The choice of pair style is unknown. E: Invalid bond style The choice of bond style is unknown. E: Invalid angle style The choice of angle style is unknown. E: Invalid dihedral style The choice of dihedral style is unknown. E: Invalid improper style The choice of improper style is unknown. E: Invalid kspace style The choice of kspace style is unknown. E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Numeric index is out of bounds A command with an argument that specifies an integer or range of integers is using a value that is less than 1 or greater than the maximum allowed limit. U: Expected floating point parameter in input script or data file The quantity being read is an integer on non-numeric value. U: Expected integer parameter in input script or data file The quantity being read is a floating point or non-numeric value. */
/* ** PCDebugger ** ** Copyright (c) 2008 ** ** Author: Gregory Casamento <greg_casamento@yahoo.com> ** ** 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import <stdio.h> #import <AppKit/AppKit.h> #import <Foundation/Foundation.h> #import <Protocols/CodeDebugger.h> @interface PCDebugger : NSObject <CodeDebugger> { id debuggerView; id debuggerWindow; id statusField; NSString *path; NSString *debuggerPath; } - (void) setStatus: (NSString *) status; - (NSString *) status; @end
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Linguist of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef SIMTEXTH_H #define SIMTEXTH_H const int textSimilarityThreshold = 190; #include <QString> #include <QList> QT_BEGIN_NAMESPACE class Translator; struct Candidate { Candidate() {} Candidate(const QString& source0, const QString &target0) : source(source0), target(target0) {} QString source; QString target; }; inline bool operator==( const Candidate& c, const Candidate& d ) { return c.target == d.target && c.source == d.source; } inline bool operator!=( const Candidate& c, const Candidate& d ) { return !operator==( c, d ); } typedef QList<Candidate> CandidateList; struct CoMatrix { CoMatrix(const QString &str); CoMatrix() {} /* The matrix has 20 * 20 = 400 entries. This requires 50 bytes, or 13 words. Some operations are performed on words for more efficiency. */ union { quint8 b[52]; quint32 w[13]; }; }; /** * This class is more efficient for searching through a large array of candidate strings, since we only * have to construct the CoMatrix for the \a stringToMatch once, * after that we just call getSimilarityScore(strCandidate). * \sa getSimilarityScore */ class StringSimilarityMatcher { public: StringSimilarityMatcher(const QString &stringToMatch); int getSimilarityScore(const QString &strCandidate); private: CoMatrix m_cm; int m_length; }; /** * Checks how similar two strings are. * The return value is the score, and a higher score is more similar * than one with a low score. * Linguist considers a score over 190 to be a good match. * \sa StringSimilarityMatcher */ static inline int getSimilarityScore(const QString &str1, const QString &str2) { return StringSimilarityMatcher(str1).getSimilarityScore(str2); } CandidateList similarTextHeuristicCandidates( const Translator *tor, const QString &text, int maxCandidates ); QT_END_NAMESPACE #endif
/* Test suite for version-etc. Copyright (C) 2009-2019 Free Software Foundation, Inc. This file is part of the GNUlib Library. 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 <https://www.gnu.org/licenses/>. */ #include <config.h> #include "version-etc.h" #define AUTHORS "Sergey Poznyakoff", "Eric Blake" int main (int argc _GL_UNUSED, char **argv) { version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS, (const char *) NULL); return 0; }
#ifndef MANTID_CRYSTAL_DISJOINTELEMENTTEST_H_ #define MANTID_CRYSTAL_DISJOINTELEMENTTEST_H_ #include <cxxtest/TestSuite.h> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include "MantidCrystal/DisjointElement.h" using Mantid::Crystal::DisjointElement; class DisjointElementTest : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests static DisjointElementTest *createSuite() { return new DisjointElementTest(); } static void destroySuite(DisjointElementTest *suite) { delete suite; } void test_default_constructor() { DisjointElement item; TSM_ASSERT("Should be empty", item.isEmpty()); } void test_make_first_of_cluster() { DisjointElement item(12); TS_ASSERT_EQUALS(12, item.getId()); TS_ASSERT_EQUALS(0, item.getRank()); TS_ASSERT(!item.isEmpty()); TS_ASSERT_EQUALS(&item, item.getParent()); } void test_set_id() { DisjointElement item; TS_ASSERT(item.isEmpty()); item.setId(2); TS_ASSERT(!item.isEmpty()); TS_ASSERT_EQUALS(2.0, item.getId()); } void test_copy() { DisjointElement item(1); DisjointElement copy = item; TS_ASSERT_EQUALS(item.getId(), copy.getId()); TS_ASSERT_EQUALS(item.getRank(), copy.getRank()); TS_ASSERT_DIFFERS(item.getParent(), copy.getParent()); } void test_assign() { DisjointElement a(1); DisjointElement b = a; TS_ASSERT_EQUALS(a.getId(), b.getId()); TS_ASSERT_EQUALS(a.getRank(), b.getRank()); TS_ASSERT_DIFFERS(a.getParent(), b.getParent()); } void test_increment_rank() { DisjointElement item(0); TS_ASSERT_EQUALS(0, item.getRank()); item.incrementRank(); TS_ASSERT_EQUALS(1, item.getRank()); item.incrementRank(); TS_ASSERT_EQUALS(2, item.getRank()); } void test_union_two_singleton_sets() { DisjointElement item1(0); DisjointElement item2(1); // We now have two singletons. Diagram shows parents are selves. /* * item1 item2 * | | * item1 item2 */ item1.unionWith(&item2); TS_ASSERT_EQUALS(0, item1.getRank()); TSM_ASSERT_EQUALS( "Same rank, but different parents, so item2, should take ownership", 1, item2.getRank()); TSM_ASSERT_EQUALS("item2 should be parent", item1.getParent(), &item2); } void test_union_with_same_root() { DisjointElement child1(0); DisjointElement child2(1); DisjointElement base(2); child1.unionWith(&base); child2.unionWith(&base); TS_ASSERT_EQUALS(1, base.getRank()); // We now have /* * base * / \ * child1 child2 */ // Try to union child1 and child2. Nothing should change. child1.unionWith(&child2); TS_ASSERT_EQUALS(0, child1.getRank()); TS_ASSERT_EQUALS(0, child2.getRank()); TSM_ASSERT_EQUALS("base should be parent", child1.getParent(), &base); TSM_ASSERT_EQUALS("base should be parent", child2.getParent(), &base); } void test_union_with_different_roots() { DisjointElement a(0); DisjointElement b(1); DisjointElement c(2); b.unionWith(&a); TS_ASSERT_EQUALS(1, a.getRank()); // We now have two trees. One is singleton. /* * a c * | | * b c */ c.unionWith(&b); // We should get /* * a * / \ * b c * */ TS_ASSERT_EQUALS(0, b.getRank()); TS_ASSERT_EQUALS(0, c.getRank()); TSM_ASSERT_EQUALS("b should be parent of a", c.getParent(), &a); TSM_ASSERT_EQUALS("a should be parent of b", b.getParent(), &a); TSM_ASSERT_EQUALS("b and c should have a common root", b.getRoot(), c.getRoot()); } void test_complex() { typedef boost::shared_ptr<DisjointElement> DisjointElement_sptr; typedef std::vector<DisjointElement_sptr> VecDisjointElement; // Create elements from 0-9 VecDisjointElement vecElements; for (int i = 0; i < 10; ++i) { vecElements.push_back(boost::make_shared<DisjointElement>(i)); } // Merge selected sets. vecElements[3]->unionWith(vecElements[1].get()); vecElements[1]->unionWith(vecElements[2].get()); vecElements[2]->unionWith(vecElements[4].get()); vecElements[0]->unionWith(vecElements[7].get()); vecElements[8]->unionWith(vecElements[9].get()); // Should get this. /* * 7 1 5 6 9 * / / | \ | * 0 2 3 4 8 * */ TS_ASSERT_EQUALS(7, vecElements[0]->getRoot()); TS_ASSERT_EQUALS(1, vecElements[2]->getRoot()); TS_ASSERT_EQUALS(1, vecElements[3]->getRoot()); TS_ASSERT_EQUALS(1, vecElements[4]->getRoot()); TS_ASSERT_EQUALS(9, vecElements[8]->getRoot()); TS_ASSERT_EQUALS(7, vecElements[7]->getRoot()); TS_ASSERT_EQUALS(1, vecElements[1]->getRoot()); TS_ASSERT_EQUALS(5, vecElements[5]->getRoot()); TS_ASSERT_EQUALS(6, vecElements[6]->getRoot()); TS_ASSERT_EQUALS(9, vecElements[9]->getRoot()); } }; #endif /* MANTID_CRYSTAL_DISJOINTELEMENTTEST_H_ */
//Copyright 2015 Roger Bassons #include <SDL2/SDL.h> class Paddle { public: Paddle(); void setSize(int width, int height); void setPosition(int x, int y); int getX() const; int getY() const; int getWidth() const; int getHeight() const; void accelerateUp(); void accelerateDown(); void stop(); void move(int max); void draw(SDL_Renderer *ren) const; private: SDL_Rect p_; int move_,speed_; };
#ifndef AUTOSTART_H #define AUTOSTART_H #include <QDialog> #include "../component/kylinlistwidget.h" #include "../component/kylintitlebar.h" #include "../component/autogroup.h" //class KylinTitleBar; //#include <QScrollArea> //#include "../component/kylinscrollarea.h" #include "../component/testscrollwidget.h" class MainWindow; class SessionDispatcher; class AutoStart :public QDialog { Q_OBJECT public: AutoStart(QWidget *parent = 0, SessionDispatcher *proxy = 0); ~AutoStart(); // void setParentWindow(MainWindow *From) { mainwindow = From;} void setLanguage(); void initConnect(); void initData(); public slots: void onCloseButtonClicked(); void onMinButtonClicked(); void setCurrentItemAutoStatus(QString dekstopName); void readyReciveData(const QStringList &data); void readyShowUI(); private: void initTitleBar(); private: SessionDispatcher *sessionproxy; // MainWindow *mainwindow; KylinTitleBar *title_bar; // QWidget *bottom_widget; // KylinListWidget *list_widget; // QList<AutoGroup *> auto_list; QList<QStringList> data_list; // QScrollArea *scrollArea; // QWidget *panel; // KylinScrollArea *scroll_widget; TestScrollWidget *scroll_widget; }; #endif // AUTOSTART_H
/* * Copyright (C) 2007-2013 Dyson Technology Ltd, all rights reserved. * * 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 NEWELEMENTWIZARD_H #define NEWELEMENTWIZARD_H #include <QtGui/QWizard> #include <QtGui/QLineEdit> #include <QtGui/QLabel> #include "Collection.h" class CameraHardware; class NewElementWizardPage : public QWizardPage { protected: static const QString mandatoryFieldSuffix; }; class WizardStartPage : public NewElementWizardPage { public: WizardStartPage( const Collection& collection, const QString& title ); virtual void initializePage(); virtual bool isComplete() const; static const QString nameField; private: QLabel* m_explanationIcon; QLabel* m_explanationInfo; QLineEdit* m_nameEdit; Collection m_collection; }; class NewElementWizard : public QWizard { Q_OBJECT public: NewElementWizard( const Collection& collection, const QString& elementType, QWidget* const parent = 0 ); }; class RenameElementWizard : public QWizard { Q_OBJECT public: RenameElementWizard( const Collection& collection, const QString& elementType, QWidget* const parent = 0 ); }; #endif // NEWELEMENTWIZARD_H
// // TVHDebugLytics.h // TvhClient // // Created by Luis Fernandes on 01/11/13. // Copyright (c) 2013 Luis Fernandes. // // 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/. // #import <Foundation/Foundation.h> @interface TVHDebugLytics : NSObject + (void)setObjectValue:(id)value forKey:(NSString*)key; + (void)setIntValue:(int)value forKey:(NSString*)key; @end
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jit_CompilerRoot_h #define jit_CompilerRoot_h #ifdef JS_ION #include "jscntxt.h" #include "jit/Ion.h" #include "jit/IonAllocPolicy.h" #include "js/RootingAPI.h" namespace js { namespace jit { // Roots a read-only GCThing for the lifetime of a single compilation. // Each root is maintained in a linked list that is walked over during tracing. // The CompilerRoot must be heap-allocated and may not go out of scope. template <typename T> class CompilerRoot : public CompilerRootNode { public: CompilerRoot(T ptr) : CompilerRootNode(nullptr) { if (ptr) { JS_ASSERT(!GetIonContext()->runtime->isInsideNursery(ptr)); setRoot(ptr); } } public: // Sets the pointer and inserts into root list. The pointer becomes read-only. void setRoot(T root) { CompilerRootNode *&rootList = GetIonContext()->temp->rootList(); JS_ASSERT(!ptr_); ptr_ = root; next = rootList; rootList = this; } public: operator T () const { return static_cast<T>(ptr_); } T operator ->() const { return static_cast<T>(ptr_); } private: CompilerRoot() MOZ_DELETE; CompilerRoot(const CompilerRoot<T> &) MOZ_DELETE; CompilerRoot<T> &operator =(const CompilerRoot<T> &) MOZ_DELETE; }; typedef CompilerRoot<JSObject*> CompilerRootObject; typedef CompilerRoot<JSFunction*> CompilerRootFunction; typedef CompilerRoot<JSScript*> CompilerRootScript; typedef CompilerRoot<PropertyName*> CompilerRootPropertyName; typedef CompilerRoot<Shape*> CompilerRootShape; typedef CompilerRoot<Value> CompilerRootValue; } // namespace jit } // namespace js #endif // JS_ION #endif /* jit_CompilerRoot_h */
// ======================================================================== // // Copyright 2009-2014 Intel Corporation // // // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // // You may obtain a copy of the License at // // // // http://www.apache.org/licenses/LICENSE-2.0 // // // // Unless required by applicable law or agreed to in writing, software // // distributed under the License is distributed on an "AS IS" BASIS, // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // // limitations under the License. // // ======================================================================== // #pragma once #include "accel.h" #include "builder.h" namespace embree { class AccelInstance : public Accel { public: AccelInstance (AccelData* accel, Builder* builder, Intersectors& intersectors) : accel(accel), builder(builder), Accel(intersectors) {} void immutable () { delete builder; builder = NULL; } ~AccelInstance() { delete builder; builder = NULL; // delete builder first! delete accel; accel = NULL; } public: void build (size_t threadIndex, size_t threadCount) { if (builder) builder->build(threadIndex,threadCount); bounds = accel->bounds; } private: AccelData* accel; Builder* builder; }; }
#ifndef _ARCH_I386_PIC_H #define _ARCH_I386_PIC_H #include <stdint.h> #include <arch/i386/portio.h> #define PIC_MASTER 0x20 #define PIC_SLAVE 0xA0 #define PIC_COMMAND 0x00 #define PIC_DATA 0x01 #define PIC_CMD_ENDINTR 0x20 #define PIC_ICW1_ICW4 0x01 #define PIC_ICW1_SINGLE 0x02 #define PIC_ICW1_INTERVAL4 0x04 #define PIC_ICW1_LEVEL 0x08 #define PIC_CMD_INIT 0x10 #define PIC_MODE_8086 0x01 #define PIC_MODE_AUDO 0x02 #define PIC_MODE_BUF_SLAVE 0x08 #define PIC_MODE_BUF_MASTRE 0x0C #define PIC_MODE_SFNM 0x10 #define PIC_READ_IRR 0x0A #define PIC_READ_ISR 0x0B typedef struct regs { uint32_t ds; uint32_t edi; uint32_t esi; uint32_t ebp; uint32_t esp; uint32_t ebx; uint32_t edx; uint32_t ecx; uint32_t eax; uint32_t int_no; uint32_t err_code; uint32_t eip; uint32_t cs; uint32_t eflags; uint32_t useresp; uint32_t ss; } regs_t; typedef void (*inthandler_t) (regs_t *); int request_isr (int, inthandler_t); int free_isr (int); int request_irq (int, inthandler_t); int free_irq (int); void pic_remap (); static inline void pic_eoi_master () { outb (PIC_MASTER, PIC_CMD_ENDINTR); } static inline void pic_eoi_slave () { outb (PIC_SLAVE, PIC_CMD_ENDINTR); } #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** Commercial Usage ** ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at http://qt.nokia.com/contact. ** **************************************************************************/ #ifndef PROJECTMANAGERINTERFACE_H #define PROJECTMANAGERINTERFACE_H #include "projectexplorer_export.h" #include <QtCore/QObject> namespace ProjectExplorer { class Project; class PROJECTEXPLORER_EXPORT IProjectManager : public QObject { Q_OBJECT public: IProjectManager() {} virtual int projectContext() const = 0; //TODO move into project virtual int projectLanguage() const = 0; //TODO move into project virtual QString mimeType() const = 0; virtual Project *openProject(const QString &fileName) = 0; }; } // namespace ProjectExplorer #endif //PROJECTMANAGERINTERFACE_H
/* Copyright (C) 2010 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */ #include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpz_poly.h" int _fmpz_poly_bit_unpack(fmpz * poly, slong len, mp_srcptr arr, flint_bitcnt_t bit_size, int negate) { flint_bitcnt_t bits = 0; mp_size_t limbs = 0; flint_bitcnt_t b = bit_size % FLINT_BITS; mp_size_t l = bit_size / FLINT_BITS; int borrow = 0; slong i; for (i = 0; i < len; i++) { borrow = fmpz_bit_unpack(poly + i, arr + limbs, bits, bit_size, negate, borrow); limbs += l; bits += b; if (bits >= FLINT_BITS) { bits -= FLINT_BITS; limbs++; } } return borrow; } void _fmpz_poly_bit_unpack_unsigned(fmpz * poly, slong len, mp_srcptr arr, flint_bitcnt_t bit_size) { flint_bitcnt_t bits = 0; mp_size_t limbs = 0; flint_bitcnt_t b = bit_size % FLINT_BITS; mp_size_t l = bit_size / FLINT_BITS; slong i; for (i = 0; i < len; i++) { fmpz_bit_unpack_unsigned(poly + i, arr + limbs, bits, bit_size); limbs += l; bits += b; if (bits >= FLINT_BITS) { bits -= FLINT_BITS; limbs++; } } } void fmpz_poly_bit_unpack_unsigned(fmpz_poly_t poly, const fmpz_t f, flint_bitcnt_t bit_size) { slong len; mpz_t tmp; if (fmpz_sgn(f) < 0) { flint_printf("Exception (fmpz_poly_bit_unpack_unsigned). Expected an unsigned value.\n"); flint_abort(); } if (bit_size == 0 || fmpz_is_zero(f)) { fmpz_poly_zero(poly); return; } len = (fmpz_bits(f) + bit_size - 1) / bit_size; mpz_init2(tmp, bit_size*len); flint_mpn_zero(tmp->_mp_d, tmp->_mp_alloc); fmpz_get_mpz(tmp, f); fmpz_poly_fit_length(poly, len); _fmpz_poly_bit_unpack_unsigned(poly->coeffs, len, tmp->_mp_d, bit_size); _fmpz_poly_set_length(poly, len); _fmpz_poly_normalise(poly); mpz_clear(tmp); } void fmpz_poly_bit_unpack(fmpz_poly_t poly, const fmpz_t f, flint_bitcnt_t bit_size) { slong len; mpz_t tmp; int negate, borrow; if (bit_size == 0 || fmpz_is_zero(f)) { fmpz_poly_zero(poly); return; } /* Round up */ len = (fmpz_bits(f) + bit_size - 1) / bit_size; negate = (fmpz_sgn(f) < 0) ? -1 : 0; mpz_init2(tmp, bit_size*len); /* TODO: avoid all this wastefulness */ flint_mpn_zero(tmp->_mp_d, tmp->_mp_alloc); fmpz_get_mpz(tmp, f); fmpz_poly_fit_length(poly, len + 1); borrow = _fmpz_poly_bit_unpack(poly->coeffs, len, tmp->_mp_d, bit_size, negate); if (borrow) { fmpz_set_si(poly->coeffs + len, negate ? WORD(-1) : WORD(1)); _fmpz_poly_set_length(poly, len + 1); } else { _fmpz_poly_set_length(poly, len); _fmpz_poly_normalise(poly); } mpz_clear(tmp); }
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** 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 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. ** ****************************************************************************/ #ifndef GLSLDITORACTIONHANDLER_H #define GLSLDITORACTIONHANDLER_H #include <texteditor/texteditoractionhandler.h> namespace GLSLEditor { namespace Internal { class GLSLEditorActionHandler : public TextEditor::TextEditorActionHandler { Q_OBJECT public: GLSLEditorActionHandler(); void createActions(); }; } // namespace Internal } // namespace GLSLEditor #endif // GLSLDITORACTIONHANDLER_H
/* * libvirt-sandbox-console.h: libvirt sandbox console * * Copyright (C) 2011 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.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Author: Daniel P. Berrange <berrange@redhat.com> */ #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) #error "Only <libvirt-sandbox/libvirt-sandbox.h> can be included directly." #endif #ifndef __LIBVIRT_SANDBOX_CONSOLE_H__ #define __LIBVIRT_SANDBOX_CONSOLE_H__ #include <gio/gunixinputstream.h> #include <gio/gunixoutputstream.h> G_BEGIN_DECLS #define GVIR_SANDBOX_TYPE_CONSOLE (gvir_sandbox_console_get_type ()) #define GVIR_SANDBOX_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONSOLE, GVirSandboxConsole)) #define GVIR_SANDBOX_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONSOLE, GVirSandboxConsoleClass)) #define GVIR_SANDBOX_IS_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONSOLE)) #define GVIR_SANDBOX_IS_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONSOLE)) #define GVIR_SANDBOX_CONSOLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONSOLE, GVirSandboxConsoleClass)) #define GVIR_SANDBOX_TYPE_CONSOLE_HANDLE (gvir_sandbox_console_handle_get_type ()) typedef struct _GVirSandboxConsole GVirSandboxConsole; typedef struct _GVirSandboxConsolePrivate GVirSandboxConsolePrivate; typedef struct _GVirSandboxConsoleClass GVirSandboxConsoleClass; struct _GVirSandboxConsole { GObject parent; GVirSandboxConsolePrivate *priv; /* Do not add fields to this struct */ }; struct _GVirSandboxConsoleClass { GObjectClass parent_class; /* signals */ void (*closed)(GVirSandboxConsole *console, gboolean err); /* class methods */ gboolean (*attach)(GVirSandboxConsole *console, GUnixInputStream *localStdin, GUnixOutputStream *localStdout, GUnixOutputStream *localStderr, GError **error); gboolean (*detach)(GVirSandboxConsole *console, GError **error); }; GType gvir_sandbox_console_get_type(void); gboolean gvir_sandbox_console_attach_stdio(GVirSandboxConsole *console, GError **error); gboolean gvir_sandbox_console_attach_stderr(GVirSandboxConsole *console, GError **error); gboolean gvir_sandbox_console_attach(GVirSandboxConsole *console, GUnixInputStream *localStdin, GUnixOutputStream *localStdout, GUnixOutputStream *localStderr, GError **error); gboolean gvir_sandbox_console_detach(GVirSandboxConsole *console, GError **error); void gvir_sandbox_console_set_escape(GVirSandboxConsole *console, gchar escape); gchar gvir_sandbox_console_get_escape(GVirSandboxConsole *console); G_END_DECLS #endif /* __LIBVIRT_SANDBOX_CONSOLE_H__ */
/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */ /* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */ #ifndef TEST_H #define TEST_H #include <QString> #include <QPointer> #include <MApplication> #include <MButton> #include <alerttone.h> class MApplicationWindow; class MApplicationPage; class MyApplication : public MApplication { Q_OBJECT public: MyApplication (int &argc, char **argv); public slots: void startBrowser (); void closeBrowser (); void valueChanged (); private: MApplicationWindow *mainwindow; QPointer<MApplicationPage> page1; QPointer<MApplicationPage> page2; QPointer<AlertTone> alertTone; int count; }; #endif
/* ugens5.h: Copyright (C) 1991 Barry Vercoe, John ffitch, Gabriel Maldonado This file is part of Csound. The Csound 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. Csound 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 Csound; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "lpc.h" /* UGENS5.H */ typedef struct { OPDS h; MYFLT *kr, *ksig, *ihtim, *isig; double c1, c2, yt1; MYFLT ihtim_old; } PORT; typedef struct { OPDS h; MYFLT *ar, *asig, *khp, *istor; double c1, c2, yt1, prvhp; } TONE; typedef struct { OPDS h; MYFLT *ar, *asig, *kcf, *kbw, *iscl, *istor; int scale; double c1, c2, c3, yt1, yt2, cosf, prvcf, prvbw; int asigf, asigw; } RESON; typedef struct { OPDS h; MYFLT *ar, *asig, *khp, *ord, *istor; double c1, c2, *yt1, prvhp; int loop; AUXCH aux; } TONEX; typedef struct { OPDS h; MYFLT *ar, *asig, *kcf, *kbw, *ord, *iscl, *istor; int scale, loop; double c1, c2, c3, *yt1, *yt2, cosf, prvcf, prvbw; AUXCH aux; } RESONX; typedef struct { OPDS h; MYFLT *krmr, *krmo, *kerr, *kcps, *ktimpt, *ifilcod, *inpoles, *ifrmrate; int32 headlen, npoles, nvals, lastfram16, lastmsg; MYFLT *kcoefs, framrat16; int storePoles ; MEMFIL *mfp; AUXCH aux; } LPREAD; typedef struct { OPDS h; MYFLT *ar, *asig; MYFLT *circbuf, *circjp, *jp2lim; LPREAD *lpread; AUXCH aux; } LPRESON; typedef struct { OPDS h; MYFLT *kcf,*kbw, *kfor; LPREAD *lpread; AUXCH aux; } LPFORM; typedef struct { OPDS h; MYFLT *ar, *asig, *kfrqratio; MYFLT *past, prvratio, d, prvout; LPREAD *lpread; AUXCH aux; } LPFRESON; typedef struct { OPDS h; MYFLT *kr, *asig, *ihp, *istor; double c1, c2, prvq; } RMS; typedef struct { OPDS h; MYFLT *ar, *asig, *krms, *ihp, *istor; double c1, c2, prvq, prva; } GAIN; typedef struct { OPDS h; MYFLT *ar, *asig, *csig, *ihp, *istor; double c1, c2, prvq, prvr, prva; } BALANCE; typedef struct { OPDS h; MYFLT *islotnum ; /* Assume sizeof(int)== sizeof(MYFLT) */ } LPSLOT ; typedef struct { OPDS h; MYFLT *islot1 ; MYFLT *islot2 ; /* Assume sizeof(pointer)== sizeof(MYFLT) */ MYFLT *kmix ; MYFLT *fpad[5]; /* Pad for kcoef correctly put (Mighty dangerous) */ int32 lpad,npoles ; LPREAD *lp1,*lp2 ; int32 lastmsg; MYFLT *kcoefs/*[MAXPOLES*2]*/, framrat16; int storePoles ; AUXCH aux; } LPINTERPOL ; typedef struct { OPDS h; MYFLT *ans, *sig, *min, *max; } LIMIT; typedef PORT KPORT; typedef TONE KTONE; typedef RESON KRESON; int kporset(CSOUND*,PORT *p); int kport(CSOUND*,PORT *p); int ktonset(CSOUND*,TONE *p); int ktone(CSOUND*,TONE *p); int katone(CSOUND*,TONE *p); int krsnset(CSOUND*,RESON *p); int kreson(CSOUND*,RESON *p); int kareson(CSOUND*,RESON *p); int klimit(CSOUND*,LIMIT *p); int limit(CSOUND*,LIMIT *p);
/* Copyright (C) 2012, 2013 Fredrik Johansson This file is part of Arb. Arb 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 "arb_poly.h" int main() { slong iter; flint_rand_t state; flint_printf("sin_cos_series_basecase...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { slong m, n, qbits, rbits1, rbits2; fmpq_poly_t A, B; arb_poly_t a, b, c, d, e; int times_pi; qbits = 2 + n_randint(state, 200); rbits1 = 2 + n_randint(state, 200); rbits2 = 2 + n_randint(state, 200); m = 1 + n_randint(state, 30); n = 1 + n_randint(state, 30); times_pi = n_randint(state, 2); fmpq_poly_init(A); fmpq_poly_init(B); arb_poly_init(a); arb_poly_init(b); arb_poly_init(c); arb_poly_init(d); arb_poly_init(e); fmpq_poly_randtest(A, state, m, qbits); arb_poly_set_fmpq_poly(a, A, rbits1); arb_poly_sin_cos_series_basecase(b, c, a, n, rbits2, times_pi); /* Check sin(x)^2 + cos(x)^2 = 1 */ arb_poly_mullow(d, b, b, n, rbits2); arb_poly_mullow(e, c, c, n, rbits2); arb_poly_add(d, d, e, rbits2); fmpq_poly_one(B); if (!arb_poly_contains_fmpq_poly(d, B)) { flint_printf("FAIL\n\n"); flint_printf("bits2 = %wd\n", rbits2); flint_printf("A = "); fmpq_poly_print(A); flint_printf("\n\n"); flint_printf("a = "); arb_poly_printd(a, 15); flint_printf("\n\n"); flint_printf("b = "); arb_poly_printd(b, 15); flint_printf("\n\n"); flint_printf("c = "); arb_poly_printd(c, 15); flint_printf("\n\n"); flint_printf("d = "); arb_poly_printd(d, 15); flint_printf("\n\n"); flint_abort(); } arb_poly_set(d, a); arb_poly_sin_cos_series_basecase(d, c, d, n, rbits2, times_pi); if (!arb_poly_equal(b, d)) { flint_printf("FAIL (aliasing 1)\n\n"); flint_abort(); } arb_poly_set(d, a); arb_poly_sin_cos_series_basecase(b, d, d, n, rbits2, times_pi); if (!arb_poly_equal(c, d)) { flint_printf("FAIL (aliasing 2)\n\n"); flint_abort(); } fmpq_poly_clear(A); fmpq_poly_clear(B); arb_poly_clear(a); arb_poly_clear(b); arb_poly_clear(c); arb_poly_clear(d); arb_poly_clear(e); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
/* * Copyright 2016 Red Hat Inc., Durham, North Carolina. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "rpm-helper.h" #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifdef RPM46_FOUND int rpmErrorCb (rpmlogRec rec, rpmlogCallbackData data) { dE("RPM: %s", rpmlogRecMessage(rec)); return RPMLOG_DEFAULT; } #endif #ifndef HAVE_RPMVERIFYFILE int rpmVerifyFile(const rpmts ts, const rpmfi fi, rpmVerifyAttrs * res, rpmVerifyAttrs omitMask) { rpmVerifyAttrs vfy = rpmfiVerify(fi, omitMask); if (res) *res = vfy; return (vfy & RPMVERIFY_LSTATFAIL) ? 1 : 0; } #endif void rpmLibsPreload() { // Don't load rpmrc files. The are useless for us, // because we only need to preload libraries const char* rcfiles = ""; rpmReadConfigFiles(rcfiles, NULL); }
//===-- MBlazeMCTargetDesc.h - MBlaze Target Descriptions -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file provides MBlaze specific target descriptions. // //===----------------------------------------------------------------------===// #ifndef MBLAZEMCTARGETDESC_H #define MBLAZEMCTARGETDESC_H #include "llvm/Support/DataTypes.h" namespace llvm { class MCAsmBackend; class MCContext; class MCCodeEmitter; class MCInstrInfo; class MCObjectWriter; class MCRegisterInfo; class MCSubtargetInfo; class Target; class StringRef; class raw_ostream; extern Target TheMBlazeTarget; MCCodeEmitter *createMBlazeMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, const MCSubtargetInfo &STI, MCContext &Ctx); MCAsmBackend *createMBlazeAsmBackend(const Target &T, StringRef TT); MCObjectWriter *createMBlazeELFObjectWriter(raw_ostream &OS, uint8_t OSABI); } // End llvm namespace // Defines symbolic names for MBlaze registers. This defines a mapping from // register name to register number. #define GET_REGINFO_ENUM #include "MBlazeGenRegisterInfo.inc" // Defines symbolic names for the MBlaze instructions. #define GET_INSTRINFO_ENUM #include "MBlazeGenInstrInfo.inc" #define GET_SUBTARGETINFO_ENUM #include "MBlazeGenSubtargetInfo.inc" #endif
#ifndef _ASM_RISCV_SETUP_H #define _ASM_RISCV_SETUP_H #include <asm-generic/setup.h> #endif /* _ASM_RISCV_SETUP_H */
/* cstool.h -- Generated automatically; do not edit. */ #ifndef __CSTOOL_H__ #define __CSTOOL_H__ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /**@file * Directory master header. This header file includes all headers in a * subdirectory of the top Crystal Space include directory. */ #include "cssysdef.h" #include "cstool/basetexfact.h" #include "cstool/bitmasktostr.h" #include "cstool/collider.h" #include "cstool/csanim2d.h" #include "cstool/csapplicationframework.h" #include "cstool/csfxscr.h" #include "cstool/cspixmap.h" #include "cstool/csview.h" #include "cstool/debugimagewriter.h" #include "cstool/enginetools.h" #include "cstool/fogmath.h" #include "cstool/framedataholder.h" #include "cstool/genmeshbuilder.h" #include "cstool/identstrings.h" #include "cstool/importkit.h" #include "cstool/initapp.h" #include "cstool/keyval.h" #include "cstool/mapnode.h" #include "cstool/materialbuilder.h" #include "cstool/meshfilter.h" #include "cstool/meshobjtmpl.h" #include "cstool/normalcalc.h" #include "cstool/numberedfilenamehelper.h" #include "cstool/objmodel.h" #include "cstool/pen.h" #include "cstool/primitives.h" #include "cstool/procmesh.h" #include "cstool/proctex.h" #include "cstool/proctxtanim.h" #include "cstool/rbuflock.h" #include "cstool/rendermeshholder.h" #include "cstool/rendermeshlist.h" #include "cstool/rviewclipper.h" #include "cstool/saverfile.h" #include "cstool/saverref.h" #include "cstool/simplestaticlighter.h" #include "cstool/smartfileopen.h" #include "cstool/uberscreenshot.h" #include "cstool/unusedresourcehelper.h" #include "cstool/userrndbuf.h" #include "cstool/vertexcompress.h" #include "cstool/vfsdirchange.h" #endif /* __CSTOOL_H__ */
/* Copyright (C) 2020 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */ #ifdef T #include "templates.h" int TEMPLATE(T, sqrt)(TEMPLATE(T, t) rop, const TEMPLATE(T, t) op, const TEMPLATE(T, ctx_t) ctx) { int res = 1; if (TEMPLATE(T, is_zero)(op, ctx) || TEMPLATE(T, is_one)(op, ctx)) TEMPLATE(T, set)(rop, op, ctx); else if (fmpz_cmp_ui(TEMPLATE(T, ctx_prime)(ctx), 2) == 0) TEMPLATE(T, pth_root)(rop, op, ctx); else { TEMPLATE(T, t) z, c, t, b, temp; fmpz_t ord, Q, Q2; flint_bitcnt_t S; slong M, i, j; TEMPLATE(T, init)(z, ctx); TEMPLATE(T, init)(c, ctx); TEMPLATE(T, init)(t, ctx); TEMPLATE(T, init)(b, ctx); TEMPLATE(T, init)(temp, ctx); fmpz_init(ord); fmpz_init(Q); fmpz_init(Q2); if (ctx->is_conway) TEMPLATE(T, gen)(z, ctx); else { flint_rand_t state; flint_randinit(state); while (TEMPLATE(T, is_square)(z, ctx)) TEMPLATE(T, rand)(z, state, ctx); flint_randclear(state); } TEMPLATE(T, ctx_order)(ord, ctx); fmpz_sub_ui(ord, ord, 1); S = fmpz_val2(ord); fmpz_tdiv_q_2exp(Q, ord, S); fmpz_add_ui(Q2, Q, 1); fmpz_tdiv_q_2exp(Q2, Q2, 1); M = S; TEMPLATE(T, pow)(c, z, Q, ctx); TEMPLATE(T, pow)(t, op, Q, ctx); TEMPLATE(T, pow)(rop, op, Q2, ctx); while (1) { if (TEMPLATE(T, is_zero)(t, ctx)) { TEMPLATE(T, zero)(rop, ctx); break; } if (TEMPLATE(T, is_one)(t, ctx)) break; i = 1; TEMPLATE(T, sqr)(temp, t, ctx); while (i < M && !TEMPLATE(T, is_one)(temp, ctx)) { TEMPLATE(T, sqr)(temp, temp, ctx); i++; } if (i == M) { res = 0; break; } TEMPLATE(T, set)(b, c, ctx); for (j = 0; j < M - i - 1; j++) TEMPLATE(T, sqr)(b, b, ctx); M = i; TEMPLATE(T, sqr)(c, b, ctx); TEMPLATE(T, mul)(t, t, c, ctx); TEMPLATE(T, mul)(rop, rop, b, ctx); } fmpz_clear(Q2); fmpz_clear(Q); fmpz_clear(ord); TEMPLATE(T, clear)(temp, ctx); TEMPLATE(T, clear)(b, ctx); TEMPLATE(T, clear)(t, ctx); TEMPLATE(T, clear)(c, ctx); TEMPLATE(T, clear)(z, ctx); } return res; } #endif
// -*- Mode: C++; tab-width: 2; -*- // vi: set ts=2: // #ifndef BALL_VIEW_RENDERING_TILINGRENDERER_H #define BALL_VIEW_RENDERING_TILINGRENDERER_H #ifndef BALL_VIEW_RENDERING_RENDERERS_RENDERER_H # include <BALL/VIEW/RENDERING/RENDERERS/renderer.h> #endif #ifndef BALL_VIEW_RENDERING_RENDERTARGET_H # include <BALL/VIEW/RENDERING/renderTarget.h> #endif namespace BALL { namespace VIEW { /** Offscreen rendering with arbitrary resolution. This class encapsulates a renderer object which it uses to render a number of individual tiles to compose them into a full image. This can be used to render very large images into files. The idea behind this renderer is heavily based on the extremely useful open-source TR library for tile rendering by Brian Paul (http://www.mesa3d.org/brianp/TR.html). \ingroup ViewRendering */ class BALL_VIEW_EXPORT TilingRenderer : public Renderer { public: /** @name Constructors and Destructors */ //@{ /** Detailed Constructor. * * @param real_renderer the renderer to encapsulate * @param final_width the width of the generated image * @param final_height the height of the generated image * @param border an optional border around each tile * */ TilingRenderer(Renderer* real_renderer, Size final_width, Size final_height, Size border = 0); /** Copy constructor. */ TilingRenderer(const TilingRenderer& renderer); /** Destructor */ virtual ~TilingRenderer() {} /// Set the light sources according to the stage virtual void setLights(bool reset_all = false); /** Update the camera position either from a given Camera, or from the default Stage. */ virtual void updateCamera(const Camera* camera = 0); /// Update the background color from the stage virtual void updateBackgroundColor(); /// virtual bool finish(); /** Compute the 3D position on the view plane corresponding * to point (x,y) on the view port */ virtual Vector3 mapViewportTo3D(Position x, Position y); /** Compute the 2D position on the screen corresponding * to the 3D point vec */ virtual Vector2 map3DToViewport(const Vector3& vec); //@} /** @name Accessors */ //@{ /** Render a Representation. */ virtual bool renderOneRepresentation(const Representation& representation); /** Buffer a Representation for later rendering. */ virtual void bufferRepresentation(const Representation& rep); /** Remove a representation from the buffer. */ virtual void removeRepresentation(const Representation& rep); /// Set the size of the display virtual void setSize(float width, float height); /** Render a ruler. * * If supported by the renderer implementation, this function will produce * a simple ruler that is rendered together with the other representations. * The main use of this function is in the edit mode, where it can help to * straighten-up structures and to correctly estimate angles and distances. */ virtual void renderRuler(); //@} /** @name Predicates */ //@{ /// virtual void renderToBuffer(RenderTarget* target); /// Wrapper for the renderering of special GeometricObjects virtual void render_(const GeometricObject* object); protected: void computeTilingSetup_(); /// The renderer used for rendering the individual tiles Renderer* real_renderer_; /// The desired width of the final image Size final_width_; /// The desired height of the final image Size final_height_; /// The border oversampled for each tile Size border_; Size num_cols_; Size num_rows_; }; } } #endif // BALL_VIEW_RENDERING_TILINGRENDERER_H
#ifndef _CONFIG_H_ #define _CONFIG_H_ #define USE_COMPACT_KISS_FFT //#define USE_KISS_FFT #ifdef WIN32 //#define FIXED_POINT #define inline __inline #define restrict #elif defined (__TCS__) #define FIXED_POINT #define PREPROCESS_MDF_FLOAT #define TM_ASM #define TM_DEBUGMEM_ALIGNNMENT 1 #define TM_PROFILE 1 #define TM_PROFILE_FIRMEM16 0 #define TM_PROFILE_IIRMEM16 0 #define TM_PROFILE_FILTERMEM16 0 #define TM_PROFILE_VQNBEST 0 #define TM_PROFILE_VQNBESTSIGN 0 #define TM_PROFILE_COMPUTEQUANTWEIGHTS 0 #define TM_PROFILE_LSPQUANT 0 #define TM_PROFILE_LSPWEIGHTQUANT 0 #define TM_PROFILE_LSPENFORCEMARGIN 0 #define TM_PROFILE_LSPTOLPC 0 #define TM_PROFILE_INNERPROD 0 #define TM_PROFILE_PITCHXCORR 0 #define TM_PROFILE_LSP_INTERPOLATE 0 #define TM_PROFILE_CHEBPOLYEVA 0 #define TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK 0 #define TM_PROFILE_TARGETUPDATE 0 #define TM_PROFILE_SPXAUTOCORR 0 #define TM_PROFILE_COMPUTEPITCHERROR 0 #define TM_PROFILE_COMPUTERMS16 0 #define TM_PROFILE_NORMALIZE16 0 #define TM_PROFILE_BWLPC 0 #define TM_PROFILE_HIGHPASS 0 #define TM_PROFILE_SIGNALMUL 0 #define TM_PROFILE_SIGNALDIV 0 #define TM_PROFILE_COMPUTEIMPULSERESPONSE 0 #define TM_PROFILE_PITCHGAINSEARCH3TAPVQ 0 #define TM_PROFILE_OPENLOOPNBESTPITCH 0 #define TM_PROFILE_PREPROCESSANALYSIS 0 #define TM_PROFILE_UPDATENOISEPROB 0 #define TM_PROFILE_COMPUTEGAINFLOOR 0 #define TM_PROFILE_FILTERDCNOTCH16 0 #define TM_PROFILE_MDFINNERPROD 0 #define TM_PROFILE_SPECTRALMULACCUM 0 #define TM_PROFILE_WEIGHTEDSPECTRALMULCONJ 0 #define TM_PROFILE_MDFADJUSTPROP 0 #define TM_PROFILE_SPEEXECHOGETRESIDUAL 0 #define TM_PROFILE_MAXIMIZERANGE 0 #define TM_PROFILE_RENORMRANGE 0 #define TM_PROFILE_POWERSPECTRUM 0 #define TM_PROFILE_QMFSYNTH 0 #define TM_PROFILE_QMFDECOMP 0 #define TM_PROFILE_FILTERBANKCOMPUTEBANK32 0 #define TM_PROFILE_FILTERBANKCOMPUTEPSD16 0 #define TM_UNROLL 1 #define TM_UNROLL_FILTER 1 #define TM_UNROLL_IIR 1 #define TM_UNROLL_FIR 1 #define TM_UNROLL_HIGHPASS 1 #define TM_UNROLL_SIGNALMUL 1 #define TM_UNROLL_SIGNALDIV 1 #define TM_UNROLL_VQNBEST 1 #define TM_UNROLL_VQSIGNNBEST 1 #define TM_UNROLL__SPXAUTOCORR 1 #define TM_UNROLL_COMPUTERMS16 1 #define TM_UNROLL_COMPUTEIMPULSERESPONSE 1 #define TM_UNROLL_QMFSYNTH 1 #define TM_UNROLL_PITCHGAINSEARCH3TAPVQ 1 #define TM_UNROLL_OPENLOOPNBESTPITCH 1 #define TM_UNROLL_FILTERBANKCOMPUTEBANK32 1 #define TM_UNROLL_FILTERBANKCOMPUTEPSD16 1 #define TM_UNROLL_SPEEXPREPROCESSRUN 1 #define TM_UNROLL_PREPROCESSANALYSIS 1 #define TM_UNROLL_UPDATENOISEPROB 1 #define TM_UNROLL_COMPUTEGAINFLOOR 1 #define TM_UNROLL_SPEEXECHOGETRESIDUAL 1 #define TM_UNROLL_SPEEXECHOCANCELLATION 1 #define TM_UNROLL_FILTERDCNOTCH16 1 #define TM_UNROLL_MDFINNERPRODUCT 1 #define TM_UNROLL_SPECTRALMULACCUM 1 #define TM_UNROLL_MDFADJUSTPROP 1 #endif #endif
#ifndef __AF_RESAMPLE_H_ #define __AF_RESAMPLE_H_ af_priv_t* af_open_resample(int rate, int nch, int format, int bps); int af_init_resample(af_priv_t* af,af_data_t *data); void af_uninit_resample(af_priv_t* af); #endif
/* * 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 <https://www.gnu.org/licenses/>. * * Copyright (C) 2018 Ell */ #include "config.h" #include <stdio.h> #include <string.h> #include "gegl.h" #include "buffer/gegl-compression.h" #define SUCCESS 0 #define FAILURE -1 static gpointer load_png (const gchar *path, const Babl *format, gint *n) { GeglNode *node; GeglNode *node_source; GeglNode *node_sink; GeglBuffer *buffer = NULL; gpointer data; node = gegl_node_new (); node_source = gegl_node_new_child (node, "operation", "gegl:load", "path", path, NULL); node_sink = gegl_node_new_child (node, "operation", "gegl:buffer-sink", "buffer", &buffer, NULL); gegl_node_link (node_source, node_sink); gegl_node_process (node_sink); g_object_unref (node); *n = gegl_buffer_get_width (buffer) * gegl_buffer_get_height (buffer); data = g_malloc (*n * babl_format_get_bytes_per_pixel (format)); gegl_buffer_get (buffer, NULL, 1.0, format, data, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); g_object_unref (buffer); return data; } gint main (gint argc, gchar **argv) { const Babl *format; gint bpp; gchar *path; gpointer data; gint n; gint size; guint8 *compressed; gint max_compressed_size; guint8 *decompressed; const gchar signature[] = "test-gegl-compression"; const gchar **algorithms; gint i; gint result = SUCCESS; gegl_init (&argc, &argv); format = babl_format ("R'G'B'A u8"); bpp = babl_format_get_bytes_per_pixel (format); path = g_build_filename (g_getenv ("ABS_TOP_SRCDIR"), "tests", "compositions", "data", "car-stack.png", NULL); data = load_png (path, format, &n); size = n * bpp; g_free (path); max_compressed_size = 2 * n * bpp; compressed = g_malloc (max_compressed_size + sizeof (signature)); decompressed = g_malloc (size); algorithms = gegl_compression_list (); for (i = 0; algorithms[i]; i++) { const GeglCompression *compression = gegl_compression (algorithms[i]); gint compressed_size; gint trunc_size; printf ("%s: ", algorithms[i]); fflush (stdout); memset (compressed, 0, max_compressed_size); memset (decompressed, 0, size); if (! gegl_compression_compress (compression, format, data, n, compressed, &compressed_size, max_compressed_size)) { goto fail; } if (! gegl_compression_decompress (compression, format, decompressed, n, compressed, compressed_size)) { goto fail; } if (memcmp (data, decompressed, size)) goto fail; printf ("pass (%d%%)\n", (100 * compressed_size + size / 2) / size); printf ("%s (trunc.): ", algorithms[i]); fflush (stdout); trunc_size = compressed_size / 2; memcpy (compressed + trunc_size, signature, sizeof (signature)); if (gegl_compression_compress (compression, format, data, n, compressed, &compressed_size, trunc_size)) { goto fail; } if (memcmp (compressed + trunc_size, signature, sizeof (signature))) goto fail; printf ("pass\n"); continue; fail: printf ("FAIL\n"); result = FAILURE; } g_free (algorithms); g_free (compressed); g_free (decompressed); g_free (data); gegl_exit (); return result; }
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: android/libcore/luni/src/main/java/java/nio/ByteBuffer.java // #ifndef _JavaNioByteBuffer_H_ #define _JavaNioByteBuffer_H_ @class IOSByteArray; @class JavaNioByteOrder; @class JavaNioCharBuffer; @class JavaNioDoubleBuffer; @class JavaNioFloatBuffer; @class JavaNioIntBuffer; @class JavaNioLongBuffer; @class JavaNioShortBuffer; #include "J2ObjC_header.h" #include "java/lang/Comparable.h" #include "java/nio/Buffer.h" @interface JavaNioByteBuffer : JavaNioBuffer < JavaLangComparable > { @public JavaNioByteOrder *order__; } + (JavaNioByteBuffer *)allocateWithInt:(jint)capacity OBJC_METHOD_FAMILY_NONE; + (JavaNioByteBuffer *)allocateDirectWithInt:(jint)capacity OBJC_METHOD_FAMILY_NONE; + (JavaNioByteBuffer *)wrapWithByteArray:(IOSByteArray *)array; + (JavaNioByteBuffer *)wrapWithByteArray:(IOSByteArray *)array withInt:(jint)start withInt:(jint)byteCount; - (instancetype)initWithInt:(jint)capacity withLong:(jlong)effectiveDirectAddress; - (IOSByteArray *)array; - (jint)arrayOffset; - (JavaNioCharBuffer *)asCharBuffer; - (JavaNioDoubleBuffer *)asDoubleBuffer; - (JavaNioFloatBuffer *)asFloatBuffer; - (JavaNioIntBuffer *)asIntBuffer; - (JavaNioLongBuffer *)asLongBuffer; - (JavaNioByteBuffer *)asReadOnlyBuffer; - (JavaNioShortBuffer *)asShortBuffer; - (JavaNioByteBuffer *)compact; - (jint)compareToWithId:(JavaNioByteBuffer *)otherBuffer; - (JavaNioByteBuffer *)duplicate; - (jboolean)isEqual:(id)other; - (jbyte)get; - (JavaNioByteBuffer *)getWithByteArray:(IOSByteArray *)dst; - (JavaNioByteBuffer *)getWithByteArray:(IOSByteArray *)dst withInt:(jint)dstOffset withInt:(jint)byteCount; - (jbyte)getWithInt:(jint)index; - (jchar)getChar; - (jchar)getCharWithInt:(jint)index; - (jdouble)getDouble; - (jdouble)getDoubleWithInt:(jint)index; - (jfloat)getFloat; - (jfloat)getFloatWithInt:(jint)index; - (jint)getInt; - (jint)getIntWithInt:(jint)index; - (jlong)getLong; - (jlong)getLongWithInt:(jint)index; - (jshort)getShort; - (jshort)getShortWithInt:(jint)index; - (jboolean)hasArray; - (NSUInteger)hash; - (jboolean)isDirect; - (jboolean)isValid; - (JavaNioByteOrder *)order; - (JavaNioByteBuffer *)orderWithJavaNioByteOrder:(JavaNioByteOrder *)byteOrder; - (IOSByteArray *)protectedArray; - (jint)protectedArrayOffset; - (jboolean)protectedHasArray; - (JavaNioByteBuffer *)putWithByte:(jbyte)b; - (JavaNioByteBuffer *)putWithByteArray:(IOSByteArray *)src; - (JavaNioByteBuffer *)putWithByteArray:(IOSByteArray *)src withInt:(jint)srcOffset withInt:(jint)byteCount; - (JavaNioByteBuffer *)putWithJavaNioByteBuffer:(JavaNioByteBuffer *)src; - (JavaNioByteBuffer *)putWithInt:(jint)index withByte:(jbyte)b; - (JavaNioByteBuffer *)putCharWithChar:(jchar)value; - (JavaNioByteBuffer *)putCharWithInt:(jint)index withChar:(jchar)value; - (JavaNioByteBuffer *)putDoubleWithDouble:(jdouble)value; - (JavaNioByteBuffer *)putDoubleWithInt:(jint)index withDouble:(jdouble)value; - (JavaNioByteBuffer *)putFloatWithFloat:(jfloat)value; - (JavaNioByteBuffer *)putFloatWithInt:(jint)index withFloat:(jfloat)value; - (JavaNioByteBuffer *)putIntWithInt:(jint)value; - (JavaNioByteBuffer *)putIntWithInt:(jint)index withInt:(jint)value; - (JavaNioByteBuffer *)putLongWithLong:(jlong)value; - (JavaNioByteBuffer *)putLongWithInt:(jint)index withLong:(jlong)value; - (JavaNioByteBuffer *)putShortWithShort:(jshort)value; - (JavaNioByteBuffer *)putShortWithInt:(jint)index withShort:(jshort)value; - (JavaNioByteBuffer *)slice; @end J2OBJC_EMPTY_STATIC_INIT(JavaNioByteBuffer) J2OBJC_FIELD_SETTER(JavaNioByteBuffer, order__, JavaNioByteOrder *) CF_EXTERN_C_BEGIN FOUNDATION_EXPORT JavaNioByteBuffer *JavaNioByteBuffer_allocateWithInt_(jint capacity); FOUNDATION_EXPORT JavaNioByteBuffer *JavaNioByteBuffer_allocateDirectWithInt_(jint capacity); FOUNDATION_EXPORT JavaNioByteBuffer *JavaNioByteBuffer_wrapWithByteArray_(IOSByteArray *array); FOUNDATION_EXPORT JavaNioByteBuffer *JavaNioByteBuffer_wrapWithByteArray_withInt_withInt_(IOSByteArray *array, jint start, jint byteCount); CF_EXTERN_C_END J2OBJC_TYPE_LITERAL_HEADER(JavaNioByteBuffer) #endif // _JavaNioByteBuffer_H_
#ifndef WS2812_h #define WS2812_h #include <SmingCore.h> // Byte triples in the buffer are interpreted as R G B values and sent to the hardware as G R B. void ICACHE_FLASH_ATTR ws2812_writergb(uint8_t gpio, char *buffer, size_t length); #endif
/** @defgroup adc_defines ADC Defines * * @brief <b>Defined Constants and Types for the STM32L4xx Analog to Digital * Converter</b> * * @ingroup STM32L4xx_defines * * @version 1.0.0 * * @date 24 Oct 2015 * * LGPL License Terms @ref lgpl_license */ /* * This file is part of the libopencm3 project. * * Copyright (C) 2015 Karl Palsson <karlp@tweak.net.au> * * 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/>. */ #ifndef LIBOPENCM3_ADC_H #define LIBOPENCM3_ADC_H #include <libopencm3/stm32/common/adc_common_v2.h> #include <libopencm3/stm32/common/adc_common_v2_multi.h> /** @defgroup adc_reg_base ADC register base addresses * @ingroup adc_defines * *@{*/ #define ADC1 ADC1_BASE #define ADC2 ADC2_BASE #define ADC3 ADC3_BASE /**@}*/ /** @defgroup adc_channel ADC Channel Numbers * @ingroup adc_defines * *@{*/ #define ADC_CHANNEL_VREF 0 #define ADC_CHANNEL_TEMP 17 #define ADC_CHANNEL_VBAT 18 /**@}*/ /* ADC_CR Values ------------------------------------------------------------*/ /* DEEPPWD: Deep power down */ #define ADC_CR_DEEPPWD (1 << 29) /* ADVREGEN: Voltage regulator enable bit */ #define ADC_CR_ADVREGEN (1 << 28) /* ADC_CFGR1 Values ---------------------------------------------------------*/ /** ALIGN: Data alignment */ #define ADC_CFGR1_ALIGN (1 << 5) /* EXTSEL[2:0]: External trigger selection for regular group */ #define ADC_CFGR1_EXTSEL_SHIFT 6 #define ADC_CFGR1_EXTSEL_MASK (0xf << ADC_CFGR1_EXTSEL_SHIFT) #define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT) /****************************************************************************/ /* ADC_SMPRx ADC Sample Time Selection for Channels */ /** @defgroup adc_sample ADC Sample Time Selection values @ingroup adc_defines @{*/ #define ADC_SMPR_SMP_2DOT5CYC 0x0 #define ADC_SMPR_SMP_6DOT5CYC 0x1 #define ADC_SMPR_SMP_12DOT5CYC 0x2 #define ADC_SMPR_SMP_24DOT5CYC 0x3 #define ADC_SMPR_SMP_47DOT5CYC 0x4 #define ADC_SMPR_SMP_92DOT5CYC 0x5 #define ADC_SMPR_SMP_247DOT5CYC 0x6 #define ADC_SMPR_SMP_640DOT5CYC 0x7 /**@}*/ BEGIN_DECLS END_DECLS #endif
/*********************************************************************** This file is part of the LidarFormat project source files. LidarFormat is an open source library for efficiently handling 3D point clouds with a variable number of attributes at runtime. Homepage: http://code.google.com/p/lidarformat Copyright: Institut Geographique National & CEMAGREF (2009) Author: Adrien Chauve Contributors: Nicolas David, Olivier Tournaire, Bruno Vallet LidarFormat 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. LidarFormat 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 LidarFormat. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************/ #pragma once #include "LidarFormat/LidarFileIO.h" namespace Lidar { class PlyMetaDataIO : public MetaDataIO { public: virtual ~PlyMetaDataIO(){} virtual boost::shared_ptr<cs::LidarDataType> load(const std::string& filename); static bool Register(); friend boost::shared_ptr<PlyMetaDataIO> createPlyMetaDataReader(); private: PlyMetaDataIO(){} static bool m_isRegistered; }; }
// // UILabel+SFAddition.h // SimpleFramework // // Created by yangzexin on 13-7-29. // Copyright (c) 2013年 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @interface UILabel (SFAddition) - (CGFloat)fitHeightByTextUsingCurrentFontWithMaxNumOfLines:(NSInteger)maxNumOfLines; - (CGFloat)fitHeightByTextUsingCurrentFontWithMaxHeight:(CGFloat)maxHeight; @end
// // JEditLeadPlanVC.h // JieXinIphone // // Created by Jeffrey on 14-4-30. // Copyright (c) 2014年 sunboxsoft. All rights reserved. // #import "JAdminLeadPlanVC.h" @interface JEditLeadPlanVC : JAdminLeadPlanVC -(id)editLeadPlan:(NSString*)title type:(NSString*)type person:(NSArray*)person time:(NSArray*)time address:(NSString*)address remark:(NSString*)remark id:(NSString*)canlendarId; @end
/* * Copyright 2012 ZXing 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. */ #import <CoreVideo/CoreVideo.h> #import "ZXLuminanceSource.h" @class ZXImage; @interface ZXCGImageLuminanceSource : ZXLuminanceSource { CGImageRef image; unsigned char *data; int left; int top; } + (CGImageRef)createImageFromBuffer:(CVImageBufferRef)buffer; + (CGImageRef)createImageFromBuffer:(CVImageBufferRef)buffer left:(size_t)left top:(size_t)top width:(size_t)width height:(size_t)height; - (id)initWithZXImage:(ZXImage *)image left:(size_t)left top:(size_t)top width:(size_t)width height:(size_t)height; - (id)initWithZXImage:(ZXImage *)image; - (id)initWithCGImage:(CGImageRef)image left:(size_t)left top:(size_t)top width:(size_t)width height:(size_t)height; - (id)initWithCGImage:(CGImageRef)image; - (id)initWithBuffer:(CVPixelBufferRef)buffer left:(size_t)left top:(size_t)top width:(size_t)width height:(size_t)height; - (id)initWithBuffer:(CVPixelBufferRef)buffer; - (CGImageRef)image; @end
#ifndef __NATIVEWIN_H__ #define __NATIVEWIN_H__ #include <EGL/egl.h> void OnNativeWinResize(int width, int height); void OnNativeWinMouseMove(int mousex, int mousey, bool lbutton); bool OpenNativeDisplay(EGLNativeDisplayType* nativedisp_out); void CloseNativeDisplay(EGLNativeDisplayType nativedisp); bool CreateNativeWin(EGLNativeDisplayType nativedisp, int width, int height, int visid, EGLNativeWindowType* nativewin_out); void DestroyNativeWin(EGLNativeDisplayType nativedisp, EGLNativeWindowType nativewin); bool UpdateNativeWin(EGLNativeDisplayType nativedisp, EGLNativeWindowType nativewin); #endif // __NATIVEWIN_H__
/** @file A brief file description @section license License Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /**************************************************************************** ink_time.h Timing routines for libts ****************************************************************************/ #pragma once #include <chrono> #include "tscore/ink_platform.h" #include "tscore/ink_defs.h" #include "tscore/ink_hrtime.h" /*===========================================================================* Data Types *===========================================================================*/ using ink_time_t = time_t; using ts_clock = std::chrono::system_clock; using ts_time = ts_clock::time_point; using ts_hr_clock = std::chrono::high_resolution_clock; using ts_hr_time = ts_hr_clock::time_point; using ts_seconds = std::chrono::seconds; using ts_milliseconds = std::chrono::milliseconds; /// Equivalent of 0 for @c ts_time. This should be used as the default initializer. static constexpr ts_time TS_TIME_ZERO; /*===========================================================================* Prototypes *===========================================================================*/ #define UNDEFINED_TIME ((time_t)0) double ink_time_wall_seconds(); int cftime_replacement(char *s, int maxsize, const char *format, const time_t *clock); #define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock) ink_time_t convert_tm(const struct tm *tp); inkcoreapi char *ink_ctime_r(const ink_time_t *clock, char *buf); inkcoreapi struct tm *ink_localtime_r(const ink_time_t *clock, struct tm *res); /*===========================================================================* Inline Stuffage *===========================================================================*/ #if defined(freebsd) || defined(openbsd) inline int ink_timezone() { struct timeval tp; struct timezone tzp; ink_assert(!gettimeofday(&tp, &tzp)); return tzp.tz_minuteswest * 60; } #else // non-freebsd, non-openbsd for the else inline int ink_timezone() { return timezone; } #endif /* #if defined(freebsd) || defined(openbsd) */
/* * 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/waf/WAF_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace WAF { namespace Model { class AWS_WAF_API GetChangeTokenResult { public: GetChangeTokenResult(); GetChangeTokenResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); GetChangeTokenResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline const Aws::String& GetChangeToken() const{ return m_changeToken; } /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline void SetChangeToken(const Aws::String& value) { m_changeToken = value; } /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline void SetChangeToken(Aws::String&& value) { m_changeToken = std::move(value); } /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline void SetChangeToken(const char* value) { m_changeToken.assign(value); } /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline GetChangeTokenResult& WithChangeToken(const Aws::String& value) { SetChangeToken(value); return *this;} /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline GetChangeTokenResult& WithChangeToken(Aws::String&& value) { SetChangeToken(std::move(value)); return *this;} /** * <p>The <code>ChangeToken</code> that you used in the request. Use this value in * a <code>GetChangeTokenStatus</code> request to get the current status of the * request. </p> */ inline GetChangeTokenResult& WithChangeToken(const char* value) { SetChangeToken(value); return *this;} private: Aws::String m_changeToken; }; } // namespace Model } // namespace WAF } // namespace Aws
// Copyright (c) 2018, Arm Limited and affiliates. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #ifndef UTIL_CRC32C_ARM64_H #define UTIL_CRC32C_ARM64_H #include <inttypes.h> #if defined(__aarch64__) || defined(__AARCH64__) #ifdef __ARM_FEATURE_CRC32 #define HAVE_ARM64_CRC #include <arm_acle.h> extern uint32_t crc32c_arm64(uint32_t crc, unsigned char const *data, unsigned len); extern uint32_t crc32c_runtime_check(void); #endif #endif #endif
#ifndef FIBERPROCESSING_H #define FIBERPROCESSING_H #include <string> #include <cmath> #include <memory> #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <numeric> #include <algorithm> #include <vtkCellArray.h> #include <vtkPolyLine.h> #include <vtkVersion.h> #include <itkSpatialObjectReader.h> #include <itkSpatialObjectWriter.h> #include "dtitypes.h" #ifndef vtkFloatingPointType #define vtkFloatingPointType double #endif struct parametrized_distance_struct { double dist ; double x ; double y ; double z ; }; class fiberprocessing{ public: fiberprocessing(); ~fiberprocessing(); std::string takeoffExtension(std::string filename); std::string takeoffPath(std::string filename); std::string ExtensionofFile(std::string filename); //Main functions void fiberprocessing_main(std::string& input_file,std::string& output_file,bool planeautoOn, std::string plane_file, bool worldspace, std::string auto_plane_origin, bool useNonCrossingFibers , double bandwidth , bool removeCleanFibers, bool removeNanFibers, const char* TargetScalarName="") ; std::vector< std::vector<double> > get_arc_length_parametrized_fiber(std::string param_name); void Write_parametrized_fiber(std::string output_parametrized_fiber_file);//Writes output parametrized fiber file without resampling the fibers void Write_parametrized_fiber_avg_position_and_arclength(std::string input_file, std::string output_parametrized_fiber_file, double step_size) ; private: void arc_length_parametrization(GroupType::Pointer group); //IO functions bool read_plane_details(std::string plane_str); void writeFiberFile(const std::string & filename, GroupType::Pointer fibergroup); GroupType::Pointer readFiberFile(std::string filename); //Helper functions void find_plane(GroupType::Pointer group, std::string auto_plane_origin); bool Siequals(std::string a, std::string b); double find_min_dist(); double find_max_dist(); void sort_parameter(); itk::Vector<double, 3> get_plane_origin(); itk::Vector<double, 3> get_plane_normal(); vtkSmartPointer<vtkPolyData> RemoveNonCrossingFibers(std::string Filename); vtkSmartPointer<vtkPolyData> RemoveNanFibers(std::string Filename); double SQ2(double x) {return x*x;}; static bool sortFunction(parametrized_distance_struct i , parametrized_distance_struct j ); double DistanceToPlane(itk::Point<double , 3> point) ; int CheckFiberOrientation( DTIPointListType &pointlist , int &count_opposite ) ; void ParametrizesEntireFiber(DTIPointListType &pointlist , int flag_orientation ) ; int ParametrizesHalfFiber(DTIPointListType &pointlist , DTIPointListType::iterator &endit, int increment, int displacement ) ; void ComputeArcLength(DTIPointListType::iterator &beginit , DTIPointListType::iterator &endit , itk::Point<double,3> p2 , int increment , int displacement , double min_distance ) ; void AddValueParametrization( DTIPointListType::iterator &pit , itk::Point<double,3> p1 , double distance ) ; double Find_First_Point(DTIPointListType &pointlist , int displacement , DTIPointListType::iterator &pit_first ) ; itk::Point< double , 3> SpatialPosition(itk::Point<double, 3> position ) ; //Variables itk::Vector<double, 3> plane_origin, plane_normal; itk::Point<double, 3> closest_point; //all --> contain all the dti info in the order of FA, MD FRO, l2, l3, AD(l1), RD, GA std::vector< std::vector<double> > all; std::vector< std::vector<parametrized_distance_struct> > parametrized_position; double closest_d; itk::Vector<double,3> m_Spacing ; itk::Vector<double,3> m_Offset ; double m_Bandwidth ; bool m_WorldSpace ; const char* m_scalarName; }; #endif
// Copyright 2011-2021 Google LLC // // 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 FUNCTION_H_ #define FUNCTION_H_ #include <cstdint> #include "third_party/absl/container/btree_map.h" #include "third_party/absl/container/node_hash_set.h" #include "third_party/zynamics/binexport/basic_block.h" #include "third_party/zynamics/binexport/edge.h" #include "third_party/zynamics/binexport/util/types.h" class CallGraph; class Function; class FlowGraph; using Functions = absl::btree_map<Address, Function*>; class Function { public: using Edges = std::vector<FlowGraphEdge>; enum FunctionType : uint8_t { TYPE_NONE = 123, TYPE_STANDARD = 0, TYPE_LIBRARY = 1, TYPE_IMPORTED = 2, TYPE_THUNK = 3, TYPE_INVALID = 4, }; enum Name { MANGLED = 0, DEMANGLED = 1, }; static const char* GetTypeName(FunctionType type); explicit Function(Address entry_point); Function(const Function&) = delete; Function& operator=(const Function&) = delete; ~Function(); // Deletes basic blocks and edges, but leaves entry point and name intact. void Clear(); void AddBasicBlock(BasicBlock* basic_block); void AddEdge(const FlowGraphEdge& edge); void SortGraph(); void FixEdges(); // Returns the set of loop edges as determined by the Dominator Tree algorithm // by Lengauer and Tarjan. Edges will be returned sorted by source address, // which is the same order they are stored in the graph itself. void GetBackEdges(std::vector<Edges::const_iterator>* back_edges) const; Address GetEntryPoint() const; void SetType(FunctionType type); // Returns the function type (if assigned) as-is if raw is set to true. If // raw is false or the function has not been assigned any type, extra // heuristics are applied; returning TYPE_THUNK for functions with entry // point address 0, THUNK_IMPORTED if it has no basic blocks and // TYPE_STANDARD otherwise. // TODO(cblichmann): Split into two functions: GetType() and GetRawType(). FunctionType GetType(bool raw) const; bool IsImported() const; std::string GetModuleName() const; void SetModuleName(const std::string& name); void SetName(const std::string& name, const std::string& demangled_name); std::string GetName(Name type) const; bool HasRealName() const; const Edges& GetEdges() const; const BasicBlocks& GetBasicBlocks() const; const BasicBlock* GetBasicBlockForAddress(Address address) const; void Render(std::ostream* stream, const CallGraph& call_graph, const FlowGraph& flow_graph) const; int GetLibraryIndex() const { return library_index_; } void SetLibraryIndex(int library_index) { library_index_ = library_index; } double GetMdIndex() const { return md_index_; } void SetMdIndex(double md_index) { md_index_ = md_index; } private: int GetBasicBlockIndexForAddress(Address address) const; BasicBlock* GetMutableBasicBlockForAddress(Address address); using StringCache = absl::node_hash_set<std::string>; static StringCache string_cache_; static int instance_count_; Address entry_point_; BasicBlocks basic_blocks_; Edges edges_; std::string name_; std::string demangled_name_; const std::string* module_name_; FunctionType type_; int library_index_; double md_index_; }; #endif // FUNCTION_H_
#pragma once #include "source/extensions/filters/network/thrift_proxy/metadata.h" #include "source/extensions/filters/network/thrift_proxy/thrift.h" namespace Envoy { namespace Extensions { namespace NetworkFilters { namespace ThriftProxy { enum class FilterStatus { // Continue filter chain iteration. Continue, // Stop iterating over filters in the filter chain. Iteration must be explicitly restarted via // continueDecoding(). StopIteration }; class DecoderEventHandler { public: virtual ~DecoderEventHandler() = default; /** * Indicates the start of a Thrift transport frame was detected. Unframed transports generate * simulated start messages. * @param metadata MessageMetadataSharedPtr describing as much as is currently known about the * message */ virtual FilterStatus transportBegin(MessageMetadataSharedPtr metadata) PURE; /** * Indicates the end of a Thrift transport frame was detected. Unframed transport generate * simulated complete messages. */ virtual FilterStatus transportEnd() PURE; /** * Indicates raw bytes after metadata in a Thrift transport frame was detected. * Filters should not modify data except for the router. * @param data data to send as passthrough * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus passthroughData(Buffer::Instance& data) PURE; /** * Indicates that the start of a Thrift protocol message was detected. * @param metadata MessageMetadataSharedPtr describing the message * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus messageBegin(MessageMetadataSharedPtr metadata) PURE; /** * Indicates that the end of a Thrift protocol message was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus messageEnd() PURE; /** * Indicates that the start of a Thrift protocol struct was detected. * @param name the name of the struct, if available * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus structBegin(absl::string_view name) PURE; /** * Indicates that the end of a Thrift protocol struct was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus structEnd() PURE; /** * Indicates that the start of Thrift protocol struct field was detected. * @param name the name of the field, if available * @param field_type the type of the field * @param field_id the field id * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus fieldBegin(absl::string_view name, FieldType& field_type, int16_t& field_id) PURE; /** * Indicates that the end of a Thrift protocol struct field was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus fieldEnd() PURE; /** * A struct field, map key, map value, list element or set element was detected. * @param value type value of the field * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus boolValue(bool& value) PURE; virtual FilterStatus byteValue(uint8_t& value) PURE; virtual FilterStatus int16Value(int16_t& value) PURE; virtual FilterStatus int32Value(int32_t& value) PURE; virtual FilterStatus int64Value(int64_t& value) PURE; virtual FilterStatus doubleValue(double& value) PURE; virtual FilterStatus stringValue(absl::string_view value) PURE; /** * Indicates the start of a Thrift protocol map was detected. * @param key_type the map key type * @param value_type the map value type * @param size the number of key-value pairs * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus mapBegin(FieldType& key_type, FieldType& value_type, uint32_t& size) PURE; /** * Indicates that the end of a Thrift protocol map was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus mapEnd() PURE; /** * Indicates the start of a Thrift protocol list was detected. * @param elem_type the list value type * @param size the number of values in the list * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus listBegin(FieldType& elem_type, uint32_t& size) PURE; /** * Indicates that the end of a Thrift protocol list was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus listEnd() PURE; /** * Indicates the start of a Thrift protocol set was detected. * @param elem_type the set value type * @param size the number of values in the set * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus setBegin(FieldType& elem_type, uint32_t& size) PURE; /** * Indicates that the end of a Thrift protocol set was detected. * @return FilterStatus to indicate if filter chain iteration should continue */ virtual FilterStatus setEnd() PURE; }; using DecoderEventHandlerSharedPtr = std::shared_ptr<DecoderEventHandler>; } // namespace ThriftProxy } // namespace NetworkFilters } // namespace Extensions } // namespace Envoy
#ifndef __SK_TYPE_DEF_H__ #define __SK_TYPE_DEF_H__ /** * Describes how to interpret the alpha compoent of a pixel. */ enum SkAlphaType { /** * All pixels should be treated as opaque, regardless of the value stored * in their alpha field. Used for legacy images that wrote 0 or garbarge * in their alpha field, but intended the RGB to be treated as opaque. */ kIgnore_SkAlphaType, /** * All pixels are stored as opaque. This differs slightly from kIgnore in * that kOpaque has correct "opaque" values stored in the pixels, while * kIgnore may not, but in both cases the caller should treat the pixels * as opaque. */ kOpaque_SkAlphaType, /** * All pixels have their alpha premultiplied in their color components. * This is the natural format for the rendering target pixels. */ kPremul_SkAlphaType, /** * All pixels have their color components stored without any regard to the * alpha. e.g. this is the default configuration for PNG images. * * This alpha-type is ONLY supported for input images. Rendering cannot * generate this on output. */ kUnpremul_SkAlphaType, kLastEnum_SkAlphaType = kUnpremul_SkAlphaType }; /** * Describes how to interpret the components of a pixel. * * kN32_SkColorType is an alias for whichever 32bit ARGB format is the "native" * form for skia's blitters. Use this if you don't have a swizzle preference * for 32bit pixels. */ enum SkColorType { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType, kIndex_8_SkColorType, kGray_8_SkColorType, kLastEnum_SkColorType = kGray_8_SkColorType, //#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) // kN32_SkColorType = kBGRA_8888_SkColorType, //#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) // kN32_SkColorType = kRGBA_8888_SkColorType, //#else // #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order" //#endif }; #endif
/* * this file (combined.c) is malloc.c, free.c, and realloc.c, combined into * one file, because the malloc.o in libc defined malloc, realloc, and free, * and libc sometimes invokes realloc, which can greatly confuse things * in the linking process... * * $Id: combined.c,v 1.1 1993/10/26 06:52:17 cgd Exp $ */ #include "malloc.c" #include "free.c" #include "realloc.c"
// Modifications copyright (C) 2017, Baidu.com, Inc. // Copyright 2017 The Apache Software Foundation // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #ifndef BDG_PALO_BE_SRC_COMMON_UTIL_THRIFT_CLIENT_H #define BDG_PALO_BE_SRC_COMMON_UTIL_THRIFT_CLIENT_H #include <string> #include <ostream> #include <sstream> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <boost/shared_ptr.hpp> #include <thrift/Thrift.h> #include <thrift/transport/TSocket.h> #include <thrift/transport/TBufferTransports.h> #include <thrift/protocol/TBinaryProtocol.h> #include "common/logging.h" #include "common/status.h" #include "util/thrift_server.h" #include "gen_cpp/Types_types.h" namespace palo { template<class InterfaceType> class ThriftClient; // Super class for templatized thrift clients. class ThriftClientImpl { public: virtual ~ThriftClientImpl() { close(); } const std::string& ipaddress() { return _ipaddress; } int port() { return _port; } // Open the connection to the remote server. May be called // repeatedly, is idempotent unless there is a failure to connect. Status open(); // Retry the Open num_retries time waiting wait_ms milliseconds between retries. Status open_with_retry(int num_retries, int wait_ms); // close the connection with the remote server. May be called // repeatedly. Status close(); // Set the connect timeout void set_conn_timeout(int ms) { _socket->setConnTimeout(ms); } // Set the receive timeout void set_recv_timeout(int ms) { _socket->setRecvTimeout(ms); } // Set the send timeout void set_send_timeout(int ms) { _socket->setSendTimeout(ms); } protected: ThriftClientImpl(const std::string& ipaddress, int port) : _ipaddress(ipaddress), _port(port), _socket(new apache::thrift::transport::TSocket(ipaddress, port)) { } private: template<class InterfaceType> friend class ThriftClient; std::string _ipaddress; int _port; // All shared pointers, because Thrift requires them to be boost::shared_ptr<apache::thrift::transport::TSocket> _socket; boost::shared_ptr<apache::thrift::transport::TTransport> _transport; boost::shared_ptr<apache::thrift::protocol::TBinaryProtocol> _protocol; }; // Utility client to a Thrift server. The parameter type is the // Thrift interface type that the server implements. template <class InterfaceType> class ThriftClient : public ThriftClientImpl { public: ThriftClient(const std::string& ipaddress, int port); ThriftClient( const std::string& ipaddress, int port, ThriftServer::ServerType server_type); // Returns the object used to actually make RPCs against the remote server InterfaceType* iface() { return _iface.get(); } private: boost::shared_ptr<InterfaceType> _iface; }; template <class InterfaceType> ThriftClient<InterfaceType>::ThriftClient( const std::string& ipaddress, int port) : ThriftClientImpl(ipaddress, port) { _transport.reset(new apache::thrift::transport::TBufferedTransport(_socket)); _protocol.reset(new apache::thrift::protocol::TBinaryProtocol(_transport)); _iface.reset(new InterfaceType(_protocol)); } template <class InterfaceType> ThriftClient<InterfaceType>::ThriftClient( const std::string& ipaddress, int port, ThriftServer::ServerType server_type) : ThriftClientImpl(ipaddress, port), _iface(new InterfaceType(_protocol)) { switch (server_type) { case ThriftServer::NON_BLOCKING: // The Nonblocking server is disabled at this time. There are // issues with the framed protocol throwing negative frame size errors. LOG(WARNING) << "Nonblocking server usage is experimental"; _transport.reset(new apache::thrift::transport::TFramedTransport(_socket)); break; case ThriftServer::THREAD_POOL: case ThriftServer::THREADED: _transport.reset(new apache::thrift::transport::TBufferedTransport(_socket)); break; default: std::stringstream error_msg; error_msg << "Unsupported server type: " << server_type; LOG(ERROR) << error_msg.str(); DCHECK(false); break; } _protocol.reset(new apache::thrift::protocol::TBinaryProtocol(_transport)); _iface.reset(new InterfaceType(_protocol)); } } #endif
/** * Class for the LogonUser call. * * Copyright 2013 Thincast Technologies GmbH * Copyright 2013 DI (FH) Martin Haimberger <martin.haimberger@thincast.com> * * 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 __CALL_IN_LOGON_USER_H_ #define __CALL_IN_LOGON_USER_H_ #include <winpr/crt.h> #include <string> #include "CallFactory.h" #include "CallIn.h" namespace freerds { class CallInLogonUser: public CallIn { public: CallInLogonUser(); virtual ~CallInLogonUser(); virtual unsigned long getCallType(); virtual int decodeRequest(); virtual int encodeResponse(); virtual int doStuff(); private: int authenticateUser(); int getAuthSession(); int getUserSession(); std::string mUserName; std::string mDomainName; std::string mPassword; long mWidth; long mHeight; long mColorDepth; std::string mClientName; std::string mClientAddress; long mClientBuildNumber; long mClientProductId; long mClientHardwareId; long mClientProtocolType; int mAuthStatus; UINT32 mConnectionId; std::string mPipeName; UINT32 m_RequestId; FDSAPI_LOGON_USER_REQUEST m_Request; UINT32 m_ResponseId; FDSAPI_LOGON_USER_RESPONSE m_Response; }; FACTORY_REGISTER_DWORD(CallFactory, CallInLogonUser, FDSAPI_LOGON_USER_REQUEST_ID); } #endif //__CALL_IN_LOGON_USER_H_
/*========================================================================= * * Copyright NumFOCUS * * 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.txt * * 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 itkYenThresholdCalculator_h #define itkYenThresholdCalculator_h #include "itkHistogramThresholdCalculator.h" namespace itk { /** *\class YenThresholdCalculator * \brief Computes the Yen's threshold for an image. * * Implements Yen thresholding method * 1) Yen J.C., Chang F.J., and Chang S. (1995) "A New Criterion * for Automatic Multilevel Thresholding" IEEE Trans. on Image * Processing, 4(3): 370-378 * 2) Sezgin M. and Sankur B. (2004) "Survey over Image Thresholding * Techniques and Quantitative Performance Evaluation" Journal of * Electronic Imaging, 13(1): 146-165 * http://citeseer.ist.psu.edu/sezgin04survey.html * * M. Emre Celebi * 06.15.2007 * * This class is templated over the input histogram type. * \warning This calculator assumes that the input histogram has only one dimension. * * \author Richard Beare * \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France. * * This implementation was taken from the Insight Journal paper: * https://hdl.handle.net/10380/3279 or * http://www.insight-journal.org/browse/publication/811 * * \ingroup Operators * \ingroup ITKThresholding */ template <typename THistogram, typename TOutput = double> class ITK_TEMPLATE_EXPORT YenThresholdCalculator : public HistogramThresholdCalculator<THistogram, TOutput> { public: ITK_DISALLOW_COPY_AND_ASSIGN(YenThresholdCalculator); /** Standard class type aliases. */ using Self = YenThresholdCalculator; using Superclass = HistogramThresholdCalculator<THistogram, TOutput>; using Pointer = SmartPointer<Self>; using ConstPointer = SmartPointer<const Self>; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(YenThresholdCalculator, HistogramThresholdCalculator); /** Type definition for the input image. */ using HistogramType = THistogram; using OutputType = TOutput; protected: YenThresholdCalculator() = default; ~YenThresholdCalculator() override = default; void GenerateData() override; }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION # include "itkYenThresholdCalculator.hxx" #endif #endif
// // GetMessageFromWXResp+responseWithTextOrMediaMessage.h // SDKSample // // Created by Jeason on 15/7/14. // // #import "WXApiObject.h" #import <UIKit/UIKit.h> @interface GetMessageFromWXResp (responseWithTextOrMediaMessage) + (GetMessageFromWXResp *)responseWithText:(NSString *)text OrMediaMessage:(WXMediaMessage *)message bText:(BOOL)bText; @end
#include "esp_log.h" #include "driver/uart.h" #include "minmea.h" #define GPS_TX_PIN (34) static char tag[] = "gps"; char *readLine(uart_port_t uart) { static char line[256]; int size; char *ptr = line; while(1) { size = uart_read_bytes(uart, (unsigned char *)ptr, 1, portMAX_DELAY); if (size == 1) { if (*ptr == '\n') { ptr++; *ptr = 0; return line; } ptr++; } // End of read a character } // End of loop } // End of readLine void doGPS() { ESP_LOGD(tag, ">> doGPS"); uart_config_t myUartConfig; myUartConfig.baud_rate = 9600; myUartConfig.data_bits = UART_DATA_8_BITS; myUartConfig.parity = UART_PARITY_DISABLE; myUartConfig.stop_bits = UART_STOP_BITS_1; myUartConfig.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; myUartConfig.rx_flow_ctrl_thresh = 120; uart_param_config(UART_NUM_1, &myUartConfig); uart_set_pin(UART_NUM_1, UART_PIN_NO_CHANGE, // TX GPS_TX_PIN, // RX UART_PIN_NO_CHANGE, // RTS UART_PIN_NO_CHANGE // CTS ); uart_driver_install(UART_NUM_1, 2048, 2048, 10, 17, NULL); while(1) { char *line = readLine(UART_NUM_1); //ESP_LOGD(tag, "%s", line); switch(minmea_sentence_id(line, false)) { case MINMEA_SENTENCE_RMC: ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_RMC"); struct minmea_sentence_rmc frame; if (minmea_parse_rmc(&frame, line)) { ESP_LOGD(tag, "$xxRMC: raw coordinates and speed: (%d/%d,%d/%d) %d/%d", frame.latitude.value, frame.latitude.scale, frame.longitude.value, frame.longitude.scale, frame.speed.value, frame.speed.scale); ESP_LOGD(tag, "$xxRMC fixed-point coordinates and speed scaled to three decimal places: (%d,%d) %d", minmea_rescale(&frame.latitude, 1000), minmea_rescale(&frame.longitude, 1000), minmea_rescale(&frame.speed, 1000)); ESP_LOGD(tag, "$xxRMC floating point degree coordinates and speed: (%f,%f) %f", minmea_tocoord(&frame.latitude), minmea_tocoord(&frame.longitude), minmea_tofloat(&frame.speed)); } else { ESP_LOGD(tag, "$xxRMC sentence is not parsed\n"); } break; case MINMEA_SENTENCE_GGA: //ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_GGA"); break; case MINMEA_SENTENCE_GSV: //ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_GSV"); break; default: //ESP_LOGD(tag, "Sentence - other"); break; } } } // doGPS
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2020 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 Dan Larkin-York /// @author Copyright 2017, ArangoDB GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #pragma once #include <chrono> #include <rocksdb/db.h> #include <rocksdb/options.h> #include <rocksdb/utilities/transaction.h> #include <rocksdb/utilities/transaction_db.h> #include "Basics/StringBuffer.h" #include "Cache/Manager.h" #include "Cache/TransactionalCache.h" namespace arangodb { namespace cache { class TransactionalStore { public: struct Document { std::uint64_t key; std::uint64_t timestamp; std::uint64_t sequence; Document(); Document(std::uint64_t k); void advance(); void clear(); bool empty() const; }; struct Transaction { arangodb::cache::Transaction* cache; rocksdb::Transaction* rocks; Transaction(arangodb::cache::Transaction* c, rocksdb::Transaction* r); }; public: TransactionalStore(Manager* manager); ~TransactionalStore(); Cache* cache(); TransactionalStore::Transaction* beginTransaction(bool readOnly); bool commit(TransactionalStore::Transaction* tx); bool rollback(TransactionalStore::Transaction* tx); bool insert(TransactionalStore::Transaction* tx, Document const& document); bool update(TransactionalStore::Transaction* tx, Document const& document); bool remove(TransactionalStore::Transaction* tx, std::uint64_t key); Document lookup(TransactionalStore::Transaction* tx, std::uint64_t key); private: static std::atomic<std::uint32_t> _sequence; Manager* _manager; std::shared_ptr<Cache> _cache; arangodb::basics::StringBuffer _directory; std::uint32_t _id; rocksdb::TransactionDB* _db; rocksdb::ReadOptions _readOptions; rocksdb::WriteOptions _writeOptions; rocksdb::TransactionOptions _txOptions; }; }; // end namespace cache }; // end namespace arangodb
/* * Copyright 1992 Network Computing Devices * * 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, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, Network Computing Devices */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <X11/Xlibint.h> #include <X11/extensions/XLbx.h> #include <X11/extensions/lbxproto.h> #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> static XExtensionInfo _lbx_info_data; static XExtensionInfo *lbx_info = &_lbx_info_data; static const char *lbx_extension_name = LBXNAME; #define LbxCheckExtension(dpy,i,val) \ XextCheckExtension (dpy, i, lbx_extension_name, val) static int close_display(Display *dpy, XExtCodes *codes); static char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n); static /* const */ XExtensionHooks lbx_extension_hooks = { NULL, /* create_gc */ NULL, /* copy_gc */ NULL, /* flush_gc */ NULL, /* free_gc */ NULL, /* create_font */ NULL, /* free_font */ close_display, /* close_display */ NULL, /* wire_to_event */ NULL, /* event_to_wire */ NULL, /* error */ error_string, /* error_string */ }; static const char *lbx_error_list[] = { "BadLbxClient", /* BadLbxClient */ }; static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name, &lbx_extension_hooks, LbxNumberEvents, NULL) static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info) static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name, LbxNumberErrors, lbx_error_list) Bool XLbxQueryExtension ( Display *dpy, int *requestp, int *event_basep, int *error_basep) { XExtDisplayInfo *info = find_display (dpy); if (XextHasExtension(info)) { *requestp = info->codes->major_opcode; *event_basep = info->codes->first_event; *error_basep = info->codes->first_error; return True; } else { return False; } } int XLbxGetEventBase(Display *dpy) { XExtDisplayInfo *info = find_display (dpy); if (XextHasExtension(info)) { return info->codes->first_event; } else { return -1; } } Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion) { XExtDisplayInfo *info = find_display (dpy); xLbxQueryVersionReply rep; register xLbxQueryVersionReq *req; LbxCheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(LbxQueryVersion, req); req->reqType = info->codes->major_opcode; req->lbxReqType = X_LbxQueryVersion; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *majorVersion = rep.majorVersion; *minorVersion = rep.minorVersion; UnlockDisplay(dpy); SyncHandle(); return True; } /* all other requests will run after Xlib has lost the wire ... */
// // ExtremeGeocoder.h // // // Created by yangzexin on 12-10-11. // // #import <Foundation/Foundation.h> #import "SFGeocoder.h" @interface SFExtremeGeocoder : NSObject <SFGeocoder> - (id)initWithGeocoders:(NSArray *)gecoders; @end
/* * Copyright (c) 2017 Linaro Limited * * SPDX-License-Identifier: Apache-2.0 */ #ifndef __DT_BINDING_ST_MEM_H #define __DT_BINDING_ST_MEM_H #define __SIZE_K(x) (x * 1024) #if defined(CONFIG_SOC_STM32F103X8) #define DT_FLASH_SIZE __SIZE_K(64) #define DT_SRAM_SIZE __SIZE_K(20) #elif defined(CONFIG_SOC_STM32F103XB) #define DT_FLASH_SIZE __SIZE_K(128) #define DT_SRAM_SIZE __SIZE_K(20) #elif defined(CONFIG_SOC_STM32F103XE) #define DT_FLASH_SIZE __SIZE_K(512) #define DT_SRAM_SIZE __SIZE_K(64) #elif defined(CONFIG_SOC_STM32F107XC) #define DT_FLASH_SIZE __SIZE_K(256) #define DT_SRAM_SIZE __SIZE_K(64) #elif defined(CONFIG_SOC_STM32F303XC) #define DT_FLASH_SIZE __SIZE_K(256) #define DT_SRAM_SIZE __SIZE_K(40) #elif defined(CONFIG_SOC_STM32F334X8) #define DT_FLASH_SIZE __SIZE_K(64) #define DT_SRAM_SIZE __SIZE_K(12) #elif defined(CONFIG_SOC_STM32F373XC) #define DT_FLASH_SIZE __SIZE_K(256) #define DT_SRAM_SIZE __SIZE_K(32) #elif defined(CONFIG_SOC_STM32F401XE) #define DT_FLASH_SIZE __SIZE_K(512) #define DT_SRAM_SIZE __SIZE_K(96) #elif defined(CONFIG_SOC_STM32F407XG) #define DT_FLASH_SIZE __SIZE_K(1024) #define DT_SRAM_SIZE __SIZE_K(192) #elif defined(CONFIG_SOC_STM32F411XE) #define DT_FLASH_SIZE __SIZE_K(512) #define DT_SRAM_SIZE __SIZE_K(128) #elif defined(CONFIG_SOC_STM32F412ZG) #define DT_FLASH_SIZE __SIZE_K(1024) #define DT_SRAM_SIZE __SIZE_K(256) #elif defined(CONFIG_SOC_STM32F413XH) #define DT_FLASH_SIZE __SIZE_K(1536) #define DT_SRAM_SIZE __SIZE_K(320) #elif defined(CONFIG_SOC_STM32F429XI) #define DT_FLASH_SIZE __SIZE_K(2048) #define DT_SRAM_SIZE __SIZE_K(256) #elif defined(CONFIG_SOC_STM32F469XI) #define DT_FLASH_SIZE __SIZE_K(2048) #define DT_SRAM_SIZE __SIZE_K(384) #elif defined(CONFIG_SOC_STM32L475XG) #define DT_FLASH_SIZE __SIZE_K(1024) #define DT_SRAM_SIZE __SIZE_K(96) #elif defined(CONFIG_SOC_STM32L476XG) #define DT_FLASH_SIZE __SIZE_K(1024) #define DT_SRAM_SIZE __SIZE_K(96) #elif defined(CONFIG_SOC_STM32L496XG) #define DT_FLASH_SIZE __SIZE_K(1024) #define DT_SRAM_SIZE __SIZE_K(320) #elif defined(CONFIG_SOC_STM32L432XC) #define DT_FLASH_SIZE __SIZE_K(256) #define DT_SRAM_SIZE __SIZE_K(64) #else #error "Flash and RAM sizes not defined for this chip" #endif #endif /* __DT_BINDING_ST_MEM_H */
/**** Copyright 2005-2007, Moshe Looks and Novamente LLC 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 dorepeat //dorepeat(n) foo //repeats foo n times //maybe its mean to other people use this, but its certainly nicer that typing //for (int i=0;i<n;++i) when you never use i! #define __DOREPEAT_CONCAT_3_( a, b ) a##b #define __DOREPEAT_CONCAT_2_( a, b ) __DOREPEAT_CONCAT_3_( a, b ) #define __DOREPEAT_CONCAT( a, b ) __DOREPEAT_CONCAT_2_( a, b ) #define __DOREPEAT_UNIQUE_NAME __DOREPEAT_CONCAT( DOREPEAT_UNIQUE_NAME_, __LINE__ ) #define dorepeat(N) \ for (unsigned int __DOREPEAT_UNIQUE_NAME=N; __DOREPEAT_UNIQUE_NAME>0;--__DOREPEAT_UNIQUE_NAME) #endif
#pragma once #include <stdint.h> #include "il2cpp-config.h" #include "object-internals.h" struct Il2CppObject; struct Il2CppDelegate; struct Il2CppReflectionType; struct Il2CppReflectionMethod; struct Il2CppReflectionField; struct Il2CppArray; struct Il2CppException; struct Il2CppReflectionModule; struct Il2CppAssembly; struct Il2CppAssemblyName; struct Il2CppAppDomain; namespace il2cpp { namespace icalls { namespace mscorlib { namespace System { namespace Diagnostics { class LIBIL2CPP_CODEGEN_API Debugger { public: static bool IsAttached_internal(); #if NET_4_0 static bool IsLogging(); static void Log(int32_t level, Il2CppString* category, Il2CppString* message); #endif }; } /* namespace Diagnostics */ } /* namespace System */ } /* namespace mscorlib */ } /* namespace icalls */ } /* namespace il2cpp */
#pragma once #include <cstdint> #include <list> #include <memory> #include "envoy/event/deferred_deletable.h" #include "envoy/event/timer.h" #include "envoy/http/codec.h" #include "envoy/http/conn_pool.h" #include "envoy/network/connection.h" #include "envoy/stats/timespan.h" #include "envoy/upstream/upstream.h" #include "common/common/linked_object.h" #include "common/http/codec_client.h" #include "common/http/codec_wrappers.h" #include "common/http/conn_pool_base_legacy.h" #include "absl/types/optional.h" namespace Envoy { namespace Http { namespace Legacy { namespace Http1 { /** * A connection pool implementation for HTTP/1.1 connections. * NOTE: The connection pool does NOT do DNS resolution. It assumes it is being given a numeric IP * address. Higher layer code should handle resolving DNS on error and creating a new pool * bound to a different IP address. */ class ConnPoolImpl : public ConnectionPool::Instance, public Legacy::ConnPoolImplBase { public: ConnPoolImpl(Event::Dispatcher& dispatcher, Upstream::HostConstSharedPtr host, Upstream::ResourcePriority priority, const Network::ConnectionSocket::OptionsSharedPtr& options, const Network::TransportSocketOptionsSharedPtr& transport_socket_options); ~ConnPoolImpl() override; // ConnectionPool::Instance Http::Protocol protocol() const override { return Http::Protocol::Http11; } void addDrainedCallback(DrainedCb cb) override; void drainConnections() override; bool hasActiveConnections() const override; ConnectionPool::Cancellable* newStream(ResponseDecoder& response_decoder, ConnectionPool::Callbacks& callbacks) override; Upstream::HostDescriptionConstSharedPtr host() const override { return host_; }; // ConnPoolImplBase void checkForDrained() override; protected: struct ActiveClient; struct StreamWrapper : public RequestEncoderWrapper, public ResponseDecoderWrapper, public StreamCallbacks { StreamWrapper(ResponseDecoder& response_decoder, ActiveClient& parent); ~StreamWrapper() override; // StreamEncoderWrapper void onEncodeComplete() override; // StreamDecoderWrapper void decodeHeaders(ResponseHeaderMapPtr&& headers, bool end_stream) override; void onPreDecodeComplete() override {} void onDecodeComplete() override; // Http::StreamCallbacks void onResetStream(StreamResetReason, absl::string_view) override { parent_.parent_.onDownstreamReset(parent_); } void onAboveWriteBufferHighWatermark() override {} void onBelowWriteBufferLowWatermark() override {} ActiveClient& parent_; bool encode_complete_{}; bool close_connection_{}; bool decode_complete_{}; }; using StreamWrapperPtr = std::unique_ptr<StreamWrapper>; struct ActiveClient : ConnPoolImplBase::ActiveClient, LinkedObject<ActiveClient>, public Network::ConnectionCallbacks, public Event::DeferredDeletable { ActiveClient(ConnPoolImpl& parent); ~ActiveClient() override; void onConnectTimeout() override; // Network::ConnectionCallbacks void onEvent(Network::ConnectionEvent event) override { parent_.onConnectionEvent(*this, event); } void onAboveWriteBufferHighWatermark() override {} void onBelowWriteBufferLowWatermark() override {} ConnPoolImpl& parent_; CodecClientPtr codec_client_; Upstream::HostDescriptionConstSharedPtr real_host_description_; StreamWrapperPtr stream_wrapper_; uint64_t remaining_requests_; }; using ActiveClientPtr = std::unique_ptr<ActiveClient>; void attachRequestToClient(ActiveClient& client, ResponseDecoder& response_decoder, ConnectionPool::Callbacks& callbacks); virtual CodecClientPtr createCodecClient(Upstream::Host::CreateConnectionData& data) PURE; void createNewConnection(); void onConnectionEvent(ActiveClient& client, Network::ConnectionEvent event); void onDownstreamReset(ActiveClient& client); void onResponseComplete(ActiveClient& client); void onUpstreamReady(); void processIdleClient(ActiveClient& client, bool delay); Event::Dispatcher& dispatcher_; std::list<ActiveClientPtr> ready_clients_; std::list<ActiveClientPtr> busy_clients_; std::list<DrainedCb> drained_callbacks_; const Network::ConnectionSocket::OptionsSharedPtr socket_options_; const Network::TransportSocketOptionsSharedPtr transport_socket_options_; Event::TimerPtr upstream_ready_timer_; bool upstream_ready_enabled_{false}; }; /** * Production implementation of the ConnPoolImpl. */ class ProdConnPoolImpl : public ConnPoolImpl { public: ProdConnPoolImpl(Event::Dispatcher& dispatcher, Upstream::HostConstSharedPtr host, Upstream::ResourcePriority priority, const Network::ConnectionSocket::OptionsSharedPtr& options, const Network::TransportSocketOptionsSharedPtr& transport_socket_options) : ConnPoolImpl(dispatcher, host, priority, options, transport_socket_options) {} // ConnPoolImpl CodecClientPtr createCodecClient(Upstream::Host::CreateConnectionData& data) override; }; } // namespace Http1 } // namespace Legacy } // namespace Http } // namespace Envoy
/* xpmap.h */ /* mmap() style cross-platform development wrappers */ /* $Id: xpmap.h,v 1.4 2014/02/10 09:20:44 deuce Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * 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. * * See the GNU Lesser General Public License for more details: lgpl.txt or * * http://www.fsf.org/copyleft/lesser.html * * * * Anonymous FTP access to the most recent released source is available at * * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * * * * Anonymous CVS access to the development source and modification history * * is available at cvs.synchro.net:/cvsroot/sbbs, example: * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * * (just hit return, no password is necessary) * * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * * * * For Synchronet coding style and modification guidelines, see * * http://www.synchro.net/source.html * * * * You are encouraged to submit any modifications (preferably in Unix diff * * format) via e-mail to mods@synchro.net * * * * Note: If this box doesn't appear square, then you need to fix your tabs. * ****************************************************************************/ #ifndef _XPMAP_H #define _XPMAP_H #include "gen_defs.h" #include "wrapdll.h" enum xpmap_type { XPMAP_READ, XPMAP_WRITE, XPMAP_COPY }; #if defined(__unix__) #include <sys/mman.h> struct xpmapping { void *addr; int fd; size_t size; }; #elif defined(_WIN32) struct xpmapping { void *addr; HANDLE fd; HANDLE md; uint64_t size; }; #else #error "Need mmap wrappers." #endif DLLEXPORT struct xpmapping* DLLCALL xpmap(const char *filename, enum xpmap_type type); DLLEXPORT void DLLCALL xpunmap(struct xpmapping *map); #endif
/* * THE UNICODE TEST SUITE FOR CINDER: https://github.com/arielm/Unicode * COPYRIGHT (C) 2013, ARIEL MALKA ALL RIGHTS RESERVED. * * THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE MODIFIED BSD LICENSE: * https://github.com/arielm/Unicode/blob/master/LICENSE.md */ #pragma once #include "GlyphData.h" #include "ReloadableTexture.h" #include "chronotext/InputSource.h" #include "hb.h" #include <map> class ActualFont { public: struct Glyph { ReloadableTexture *texture; ci::Vec2f offset; ci::Vec2f size; float tx1; float ty1; float tx2; float ty2; Glyph() : texture(NULL) {} Glyph(ReloadableTexture *texture, ci::Vec2f offset, ci::Vec2f size) : texture(texture), offset(offset), size(size) { tx1 = 0; ty1 = 0; tx2 = size.x / texture->getWidth(); ty2 = size.y / texture->getHeight(); } }; struct Metrics { float height; float ascent; float descent; float strikethroughOffset; float underlineOffset; float lineThickness; }; float baseSize; bool useMipmap; int padding; ci::Vec2f scale; Metrics metrics; hb_font_t *hbFont; ActualFont(std::shared_ptr<FreetypeHelper> ftHelper, chr::InputSourceRef source, float baseSize, bool useMipmap, int padding); ~ActualFont(); Glyph* getGlyph(uint32_t codepoint); void clearGlyphCache(); void unloadTextures(); protected: std::shared_ptr<FreetypeHelper> ftHelper; FT_Face ftFace; std::map<uint32_t, std::unique_ptr<Glyph>> glyphCache; std::vector<std::unique_ptr<ReloadableTexture>> standaloneTextures; Glyph* createGlyph(uint32_t codepoint); };
/* raw os - Copyright (C) Lingjun Chen(jorya_txj). This file is part of raw os. raw os is free software; you can redistribute it 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. raw os 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 Lesser General Public License along with this program. if not, write email to jorya.txj@gmail.com --- A special exception to the LGPL can be applied should you wish to distribute a combined work that includes raw os, without being obliged to provide the source code for any proprietary components. See the file exception.txt for full details of how and when the exception can be applied. */ /* 2012-4 Created by jorya_txj * xxxxxx please added here */ #ifndef RAW_BLOCK_H #define RAW_BLOCK_H typedef struct MEM_POOL { RAW_COMMON_BLOCK_OBJECT common_block_obj; /* Define the number of available memory blocks in the pool. */ RAW_U32 raw_block_pool_available; RAW_U32 block_size; /* Define the head pointer of the available block pool. */ RAW_U8 *raw_block_pool_available_list; } MEM_POOL; RAW_U16 raw_block_pool_create(MEM_POOL *pool_ptr, RAW_U8 *name_ptr, RAW_U32 block_size, RAW_VOID *pool_start, RAW_U32 pool_size); RAW_U16 raw_block_allocate(MEM_POOL *pool_ptr, RAW_VOID **block_ptr); RAW_U16 raw_block_release(MEM_POOL *pool_ptr, RAW_VOID *block_ptr); #endif
/**************************************************************************** * Copyright (c) 2012, the Konoha project authors. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ #include "konoha2/konoha2.h" int main(int argc, const char *argv[]) { assert(sizeof(kObject) <= 64); assert(sizeof(knh_Fmethod) == sizeof(void*)); assert(sizeof(float) <= sizeof(void*)); assert(sizeof(kint_t) == sizeof(kfloat_t)); assert(sizeof(kint_t) == sizeof(void*)); assert(sizeof(ksfp_t) == sizeof(krbp_t) * 2); assert(sizeof(krbp_t) == sizeof(void*)); assert(sizeof(intptr_t) == sizeof(kint_t)); assert(sizeof(kshort_t) * 2 == sizeof(intptr_t)); fprintf(stderr, "%ld\n", sizeof(kObject)); return 0; }
/* $Date$ $RCSfile$ $Revision$ */ #ifndef CHELSIO_TP_H #define CHELSIO_TP_H #include "common.h" #define TP_MAX_RX_COALESCING_SIZE 16224U struct tp_mib_statistics { /* IP */ u32 ipInReceive_hi; u32 ipInReceive_lo; u32 ipInHdrErrors_hi; u32 ipInHdrErrors_lo; u32 ipInAddrErrors_hi; u32 ipInAddrErrors_lo; u32 ipInUnknownProtos_hi; u32 ipInUnknownProtos_lo; u32 ipInDiscards_hi; u32 ipInDiscards_lo; u32 ipInDelivers_hi; u32 ipInDelivers_lo; u32 ipOutRequests_hi; u32 ipOutRequests_lo; u32 ipOutDiscards_hi; u32 ipOutDiscards_lo; u32 ipOutNoRoutes_hi; u32 ipOutNoRoutes_lo; u32 ipReasmTimeout; u32 ipReasmReqds; u32 ipReasmOKs; u32 ipReasmFails; u32 reserved[8]; /* TCP */ u32 tcpActiveOpens; u32 tcpPassiveOpens; u32 tcpAttemptFails; u32 tcpEstabResets; u32 tcpOutRsts; u32 tcpCurrEstab; u32 tcpInSegs_hi; u32 tcpInSegs_lo; u32 tcpOutSegs_hi; u32 tcpOutSegs_lo; u32 tcpRetransSeg_hi; u32 tcpRetransSeg_lo; u32 tcpInErrs_hi; u32 tcpInErrs_lo; u32 tcpRtoMin; u32 tcpRtoMax; }; struct petp; struct tp_params; struct petp *t1_tp_create(adapter_t *adapter, struct tp_params *p); void t1_tp_destroy(struct petp *tp); void t1_tp_intr_disable(struct petp *tp); void t1_tp_intr_enable(struct petp *tp); void t1_tp_intr_clear(struct petp *tp); int t1_tp_intr_handler(struct petp *tp); void t1_tp_get_mib_statistics(adapter_t *adap, struct tp_mib_statistics *tps); void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable); void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable); int t1_tp_set_coalescing_size(struct petp *tp, unsigned int size); int t1_tp_reset(struct petp *tp, struct tp_params *p, unsigned int tp_clk); #endif
#ifndef SYSTEM_SAM4S_H_INCLUDED #define SYSTEM_SAM4S_H_INCLUDED #ifdef __cplusplus extern "C" { #endif #include <stdint.h> extern uint32_t SystemCoreClock ; /* System Clock Frequency (Core Clock) */ /** * @brief Setup the microcontroller system. * Initialize the System and update the SystemCoreClock variable. */ void SystemInit( void ) ; /** * @brief Updates the SystemCoreClock with current core Clock * retrieved from cpu registers. */ void SystemCoreClockUpdate( void ) ; /** * Initialize flash. */ void SystemInitFlash( uint32_t dw_clk ) ; #ifdef __cplusplus } #endif #endif /* SYSTEM_SAM4S_H_INCLUDED */
/** * @file * @brief TODO * * @date 24.02.10 * @author Eldar Abusalimov */ #include <unistd.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <stdint.h> #include <framework/mod/api.h> static void print_usage(void) { printf("Usage: lsmod [-qdlhp:n:]\n"); } static void mod_print(const struct mod *mod) { int enabled = mod->priv->flags & 0x1; // XXX fix later printf(" %c %s.%s ", enabled ? '*' : ' ', mod_pkg_name(mod), mod_name(mod)); } int main(int argc, char **argv) { const struct mod *mod, *dep; const char *substr_package = NULL, *substr_name = NULL; int print_deps = 0, show_label = 0; int opt; while (-1 != (opt = getopt(argc, argv, "qdlhp:n:"))) { switch (opt) { case 'd': print_deps = 1; break; case 'h': print_usage(); return 0; case 'p': substr_package = optarg; break; case 'n': substr_name = optarg; break; case 'l': show_label = 1; break; case '?': break; default: return -EINVAL; } } printf("\n"); mod_foreach(mod) { if ((substr_package && !strstr(mod_pkg_name(mod), substr_package)) || (substr_name && !strstr(mod_name(mod), substr_name))) { continue; } mod_print(mod); printf("\n"); if (show_label) { printf("\n\tlabel:%x:%x:%x:%x\n", (uint32_t)mod_label(mod)->text.vma, (uint32_t)mod_label(mod)->data.vma, (uint32_t)mod_label(mod)->bss.vma, (uint32_t)mod_label(mod)->rodata.vma); } if (print_deps) { printf("\n\t-> "); mod_foreach_requires(dep, mod) { mod_print(dep); } printf("\n\t<- "); mod_foreach_provides(dep, mod) { mod_print(dep); } printf("\n"); } } return 0; }
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #include "CIMFixtureBase.h" class UNIX_PrintInputTrayFixture : public CIMFixtureBase { public: UNIX_PrintInputTrayFixture(); ~UNIX_PrintInputTrayFixture(); virtual void Run(); };
/* * Copyright (c) Citrix Systems, 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef XEN_VMPP_DECL_H #define XEN_VMPP_DECL_H typedef void *xen_vmpp; struct xen_vmpp_set; struct xen_vmpp_record; struct xen_vmpp_record_set; struct xen_vmpp_record_opt; struct xen_vmpp_record_opt_set; #endif
// address: 0x104f4 int main(int argc, char *argv[], char *envp[]) { unsigned int local0; // m[o6 - 12] int local1; // m[o6 - 412] unsigned int local2; // m[o6 - 4] int o0; // r8 __isoc99_scanf(); local2 = 0; while ((int)local2 < (int)local0) { __isoc99_scanf(); local2++; } o0 = sumarray1(&local1, local0); printf("Sum = %ld\n", o0); return 0; } // address: 0x105a4 __size32 sumarray1(void *param1, unsigned int param2) { __size32 g2; // r2 unsigned int local0; // m[o6 - 4] void *o0; // r8 local0 = 0; while ((int)local0 < (int)param2) { g2 = *(param1 + local0 * 4); sum.1953 = g2 + sum.1953; local0++; } o0 = sumarray2(param1, param2 - 1); sum.1953 = o0 + sum.1953; return sum.1953; } // address: 0x10660 __size32 sumarray2(void *param1, unsigned int param2) { __size32 g2; // r2 unsigned int local0; // m[o6 - 4] void *o0; // r8 local0 = 0; while ((int)local0 < (int)param2) { g2 = *(param1 + local0 * 4); sum.1962 = g2 + sum.1962; local0++; } o0 = sumarray3(param1, param2 - 2); sum.1962 = o0 + sum.1962; return sum.1962; } // address: 0x1071c __size32 sumarray3(void *param1, unsigned int param2) { __size32 g2; // r2 unsigned int local0; // m[o6 - 4] local0 = 0; while ((int)local0 < (int)param2) { g2 = *(param1 + local0 * 4); sum.1971 = g2 + sum.1971; local0++; } return sum.1971; }
/* * Copyright (c) The Shogun Machine Learning Toolbox * Written (w) 2015 Wu Lin * 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. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of the Shogun Development Team. * */ #ifndef MINIMIZER_H #define MINIMIZER_H #include <shogun/lib/config.h> #include <shogun/base/SGObject.h> namespace shogun { /** @brief The minimizer base class. * */ class Minimizer: public SGObject { public: /** Do minimization and get the optimal value * * @return optimal value */ virtual float64_t minimize()=0; virtual ~Minimizer() {} }; } #endif
//##################################################################### // Class Zero //##################################################################### #pragma once #include <iostream> namespace geode { struct Zero { explicit operator bool() const { return false; } Zero operator-() const { return Zero(); } Zero operator-(const Zero) const { return Zero(); } Zero operator+(const Zero) const { return Zero(); } Zero operator*(const Zero) const { return Zero(); } template<class T> Zero operator*=(const T&) { return Zero(); } template<class T> Zero operator/=(const T&) { return Zero(); } Zero operator+=(const Zero) { return Zero(); } Zero operator-=(const Zero) { return Zero(); } Zero inverse() const { return Zero(); } bool operator==(const Zero) const { return true; } bool operator!=(const Zero) const { return false; } bool positive_semidefinite() const { return true; } }; static inline bool operator<(const float x,const Zero) { return x<0; } static inline bool operator<(const double x,const Zero) { return x<0; } static inline bool operator>(const float x,const Zero) { return x>0; } static inline bool operator>(const double x,const Zero) { return x>0; } template<class T> static inline const T& operator+(const T& x, const Zero) { return x; } template<class T> static inline const T& operator+(const Zero, const T& x) { return x; } template<class T> static inline const T& operator-(const T& x,const Zero) { return x; } template<class T> static inline T operator-(const Zero, const T& x) { return -x; } template<class T> static inline Zero operator*(const Zero,const T&) { return Zero(); } template<class T> static inline Zero operator*(const T&, const Zero) { return Zero(); } static inline std::ostream& operator<<(std::ostream& output, const Zero) { return output<<'0'; } }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54b.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-54b.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: memmove * BadSink : Copy data to string using memmove * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* 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 CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54c_badSink(char * data); void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54b_badSink(char * data) { CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54c_goodG2BSink(char * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54b_goodG2BSink(char * data) { CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_54c_goodG2BSink(data); } #endif /* OMITGOOD */
#ifndef ZFLYEMNEURONFILTERTASKMANAGER_H #define ZFLYEMNEURONFILTERTASKMANAGER_H #include <QVector> #include "zmultitaskmanager.h" #include "ztask.h" class ZFlyEmNeuron; class ZFlyEmNeuronFilter; class ZFlyEmNeuronFilterTask : public ZTask { Q_OBJECT public: ZFlyEmNeuronFilterTask(); inline void setTest(ZFlyEmNeuron *neuron) { m_testNeuron = neuron; } inline ZFlyEmNeuron* getResult() const { return m_result; } inline void setFilter(const ZFlyEmNeuronFilter *filter) { m_filter = filter; } void execute(); private: ZFlyEmNeuron *m_testNeuron; const ZFlyEmNeuronFilter *m_filter; ZFlyEmNeuron *m_result; }; class ZFlyEmNeuronFilterTaskManager : public ZMultiTaskManager { public: ZFlyEmNeuronFilterTaskManager(QObject *parent = NULL); const QVector<ZFlyEmNeuron*>& getResult() { return m_filterResult; } protected: void prepare(); void postProcess(); private: QVector<ZFlyEmNeuron*> m_filterResult; }; #endif // ZFLYEMNEURONFILTERTASKMANAGER_H
// // OCHamcrest - NSObject_HCSelfDescribingValue.h // Copyright 2009 www.hamcrest.org. See LICENSE.txt // // Created by: Jon Reid // // Mac #import <Foundation/Foundation.h> @protocol HCDescription; /** This category allows any object to satisfy the HCSelfDescribing protocol. */ @interface NSObject (HCSelfDescribingValue) /** Generates a description of the object. @param description The description to be appended to. */ - (void) describeTo:(id<HCDescription>)description; @end
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _MITK_MITK_REGISTRATION_WRAPPER_MAPPER_BASE_H #define _MITK_MITK_REGISTRATION_WRAPPER_MAPPER_BASE_H #include <vtkSmartPointer.h> #include <mitkVtkMapper.h> #include <mitkLocalStorageHandler.h> #include "MitkMatchPointRegistrationExports.h" class vtkPropAssembly; class vtkPolyDataMapper; class vtkPolyData; class vtkColorTransferFunction; class vtkActor; namespace mitk { /**Base class for all mapper that visualize a registration object.*/ class MITKRegistrationWrapperMapperBase : public VtkMapper { public: mitkClassMacro(MITKRegistrationWrapperMapperBase, VtkMapper); //========== essential implementation for mapper ========== virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false ); static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper); virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer); //========================================================= virtual bool GetGeometryDescription(mitk::BaseRenderer *renderer, mitk::BaseGeometry::ConstPointer& gridDesc, unsigned int& gridFrequ) const = 0; virtual bool RendererGeometryIsOutdated(mitk::BaseRenderer *renderer, const itk::TimeStamp& time) const = 0; /**Internal class to store all informations and helper needed by a mapper to provide the render data for a certain renderer.*/ class MITKMATCHPOINTREGISTRATION_EXPORT RegWrapperLocalStorage : public mitk::Mapper::BaseLocalStorage { public: vtkSmartPointer<vtkPolyData> m_DeformedGridData; vtkSmartPointer<vtkPolyData> m_StartGridData; vtkSmartPointer<vtkActor> m_DeformedGridActor; vtkSmartPointer<vtkPolyDataMapper> m_DeformedGridMapper; vtkSmartPointer<vtkActor> m_StartGridActor; vtkSmartPointer<vtkPolyDataMapper> m_StartGridMapper; vtkSmartPointer<vtkPropAssembly> m_RegAssembly; vtkSmartPointer<vtkColorTransferFunction> m_LUT; /** \brief Timestamp of last update of stored data. */ itk::TimeStamp m_LastUpdateTime; /** \brief Constructor of the local storage. Do as much actions as possible in here to avoid double executions. */ RegWrapperLocalStorage(); ~RegWrapperLocalStorage() { } }; /** \brief This member holds all three LocalStorages for the 3D render window(s). */ mitk::LocalStorageHandler<RegWrapperLocalStorage> m_LSH; protected: MITKRegistrationWrapperMapperBase(); virtual ~MITKRegistrationWrapperMapperBase(); private: }; } // end namespace mitk #endif /* MITKRegistrationWrapperMapperBase_H_HEADER_INCLUDED */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_06.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE193.label.xml Template File: sources-sink-06.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Point data to a buffer that does not have space for a NULL terminator * GoodSource: Point data to a buffer that includes space for a NULL terminator * Sink: ncpy * BadSink : Copy string to data using strncpy() * Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif /* MAINTENANCE NOTE: The length of this string should equal the 10 */ #define SRC_STRING "AAAAAAAAAA" /* The variable below is declared "const", so a tool should be able * to identify that reads of this will always give its initialized value. */ static const int STATIC_CONST_FIVE = 5; #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_06_bad() { char * data; char dataBadBuffer[10]; char dataGoodBuffer[10+1]; if(STATIC_CONST_FIVE==5) { /* FLAW: Set a pointer to a buffer that does not leave room for a NULL terminator when performing * string copies in the sinks */ data = dataBadBuffer; data[0] = '\0'; /* null terminate */ } { char source[10+1] = SRC_STRING; /* Copy length + 1 to include NUL terminator from source */ /* POTENTIAL FLAW: data may not have enough space to hold source */ strncpy(data, source, strlen(source) + 1); printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */ static void goodG2B1() { char * data; char dataBadBuffer[10]; char dataGoodBuffer[10+1]; if(STATIC_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Set a pointer to a buffer that leaves room for a NULL terminator when performing * string copies in the sinks */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ } { char source[10+1] = SRC_STRING; /* Copy length + 1 to include NUL terminator from source */ /* POTENTIAL FLAW: data may not have enough space to hold source */ strncpy(data, source, strlen(source) + 1); printLine(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBadBuffer[10]; char dataGoodBuffer[10+1]; if(STATIC_CONST_FIVE==5) { /* FIX: Set a pointer to a buffer that leaves room for a NULL terminator when performing * string copies in the sinks */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ } { char source[10+1] = SRC_STRING; /* Copy length + 1 to include NUL terminator from source */ /* POTENTIAL FLAW: data may not have enough space to hold source */ strncpy(data, source, strlen(source) + 1); printLine(data); } } void CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_06_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_06_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_06_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_MEDIA_AUDIO_MUTING_SESSION_H_ #define CONTENT_BROWSER_MEDIA_AUDIO_MUTING_SESSION_H_ #include "base/unguessable_token.h" #include "content/common/content_export.h" #include "media/mojo/mojom/audio_stream_factory.mojom.h" #include "mojo/public/cpp/bindings/associated_remote.h" namespace content { class CONTENT_EXPORT AudioMutingSession { public: explicit AudioMutingSession(const base::UnguessableToken& group_id); AudioMutingSession(const AudioMutingSession&) = delete; AudioMutingSession& operator=(const AudioMutingSession&) = delete; ~AudioMutingSession(); void Connect(media::mojom::AudioStreamFactory* factory); private: const base::UnguessableToken group_id_; mojo::AssociatedRemote<media::mojom::LocalMuter> muter_; }; } // namespace content #endif // CONTENT_BROWSER_MEDIA_AUDIO_MUTING_SESSION_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE690_NULL_Deref_From_Return__int_malloc_65b.c Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml Template File: source-sinks-65b.tmpl.c */ /* * @description * CWE: 690 Unchecked Return Value To NULL Pointer * BadSource: malloc Allocate data using malloc() * Sinks: * GoodSink: Check to see if the data allocation failed and if not, use data * BadSink : Don't check for NULL and use data * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE690_NULL_Deref_From_Return__int_malloc_65b_badSink(int * data) { /* FLAW: Initialize memory buffer without checking to see if the memory allocation function failed */ data[0] = 5; printIntLine(data[0]); free(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G uses the BadSource with the GoodSink */ void CWE690_NULL_Deref_From_Return__int_malloc_65b_goodB2GSink(int * data) { /* FIX: Check to see if the memory allocation function was successful before initializing the memory buffer */ if (data != NULL) { data[0] = 5; printIntLine(data[0]); free(data); } } #endif /* OMITGOOD */
// Version: $Id$ // // // Commentary: // // // Change Log: // // // Code: #pragma once #include "dtkComposerExport.h" #include "dtkComposerMetaType.h" #include <QtCore> class dtkComposerNode; class dtkComposerTransmitterPrivate; class dtkComposerTransmitterLink; class dtkComposerTransmitterLinkList; class dtkComposerTransmitterVariant; // ///////////////////////////////////////////////////////////////// // dtkComposerTransmitter interface // ///////////////////////////////////////////////////////////////// class DTKCOMPOSER_EXPORT dtkComposerTransmitter { public: enum Kind { Emitter, Receiver, Proxy, ProxyLoop, ProxyVariant }; public: enum DataTransmission { AutoCopy, Copy, Reference }; public: typedef QList<int> TypeList; public: dtkComposerTransmitter(dtkComposerNode *parent = 0); virtual ~dtkComposerTransmitter(void); #pragma mark - #pragma mark Mandatory specific properties public: virtual Kind kind(void) const = 0; virtual QString kindName(void) const = 0; #pragma mark - #pragma mark Static properties public: void setParentNode(dtkComposerNode *parent); dtkComposerNode *parentNode(void) const; public: void setDataTransmission(DataTransmission value); DataTransmission dataTransmission(void) const; public: void setRequired(bool required); bool required(void); #pragma mark - #pragma mark Dynamic behaviour public: virtual void clearData(void); public: bool isEmpty(void) const; public: bool active(void); virtual void setActive(bool active); void activateEmitter(dtkComposerTransmitter *emitter); public: virtual bool enableCopy(void); public: void setTypeList(const TypeList& list); TypeList typeList(void) const; public: virtual QVariant variant(void); virtual QVariantList allData(void); #pragma mark - #pragma mark Connection management public: void appendNext(dtkComposerTransmitter *transmitter); void removeNext(dtkComposerTransmitter *transmitter); void appendPrevious(dtkComposerTransmitter *transmitter); void removePrevious(dtkComposerTransmitter *transmitter); public: virtual bool connect(dtkComposerTransmitter *transmitter); virtual bool disconnect(dtkComposerTransmitter *transmitter); virtual bool enableConnection(dtkComposerTransmitter *transmitter); public: void appendReceiver(dtkComposerTransmitter *receiver); void removeReceiver(dtkComposerTransmitter *receiver); public: int receiverCount(void); #pragma mark - #pragma mark Link management public: typedef QMultiHash<dtkComposerTransmitter *, dtkComposerTransmitterLink *> LinkMap; public: virtual LinkMap leftLinks(dtkComposerTransmitter *transmitter, dtkComposerTransmitterLinkList list); virtual LinkMap rightLinks(dtkComposerTransmitter *transmitter, dtkComposerTransmitterLinkList list); public: static bool onTransmittersConnected(dtkComposerTransmitter *source, dtkComposerTransmitter *destination, dtkComposerTransmitterLinkList& valid_links, dtkComposerTransmitterLinkList& invalid_links); static bool onTransmittersDisconnected(dtkComposerTransmitter *source, dtkComposerTransmitter *destination, dtkComposerTransmitterLinkList& invalid_links); public: template <typename T> friend class dtkComposerTransmitterHandler; friend class dtkComposerTransmitterHandlerVariant; private: friend QDebug operator << (QDebug debug, const dtkComposerTransmitter& transmitter); friend QDebug operator << (QDebug debug, dtkComposerTransmitter *transmitter); protected: dtkComposerTransmitterPrivate *d; }; // ///////////////////////////////////////////////////////////////// // Debug operators // ///////////////////////////////////////////////////////////////// QDebug operator << (QDebug debug, const dtkComposerTransmitter& transmitter); QDebug operator << (QDebug debug, dtkComposerTransmitter *transmitter); // ///////////////////////////////////////////////////////////////// // dtkComposerTransmitterLink declaration // ///////////////////////////////////////////////////////////////// class dtkComposerTransmitterLinkPrivate; class DTKCOMPOSER_EXPORT dtkComposerTransmitterLink { public: dtkComposerTransmitterLink(dtkComposerTransmitter *source, dtkComposerTransmitter *destination); ~dtkComposerTransmitterLink(void); public: dtkComposerTransmitter *source(); dtkComposerTransmitter *destination(); private: dtkComposerTransmitterLinkPrivate *d; }; // ///////////////////////////////////////////////////////////////// // dtkComposerTransmitterLinkList declaration // ///////////////////////////////////////////////////////////////// class DTKCOMPOSER_EXPORT dtkComposerTransmitterLinkList : public QList<dtkComposerTransmitterLink *> {}; // // dtkComposerTransmitter.h ends here
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cpy_65b.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml Template File: sources-sink-65b.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sinks: cpy * BadSink : Copy string to data using strcpy * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cpy_65b_badSink(char * data) { { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ strcpy(data, source); printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cpy_65b_goodG2BSink(char * data) { { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ strcpy(data, source); printLine(data); } } #endif /* OMITGOOD */
/* * libjingle * Copyright 2004--2010, Google Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef TALK_SOUND_SOUNDDEVICELOCATOR_H_ #define TALK_SOUND_SOUNDDEVICELOCATOR_H_ #include <string> #include "talk/base/constructormagic.h" namespace cricket { // A simple container for holding the name of a device and any additional id // information needed to locate and open it. Implementations of // SoundSystemInterface must subclass this to add any id information that they // need. class SoundDeviceLocator { public: virtual ~SoundDeviceLocator() {} // Human-readable name for the device. const std::string &name() const { return name_; } // Makes a duplicate of this locator. virtual SoundDeviceLocator *Copy() const = 0; protected: explicit SoundDeviceLocator(const std::string &name) : name_(name) {} explicit SoundDeviceLocator(const SoundDeviceLocator &that) : name_(that.name_) {} std::string name_; private: DISALLOW_ASSIGN(SoundDeviceLocator); }; } // namespace cricket #endif // TALK_SOUND_SOUNDDEVICELOCATOR_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81.h Label Definition File: CWE195_Signed_to_Unsigned_Conversion_Error.label.xml Template File: sources-sink-81.tmpl.h */ /* * @description * CWE: 195 Signed to Unsigned Conversion Error * BadSource: fscanf Read data from the console using fscanf() * GoodSource: Positive integer * Sinks: memmove * BadSink : Copy strings using memmove() with the length of data * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference * * */ #include "std_testcase.h" namespace CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81 { class CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81_base { public: /* pure virtual function */ virtual void action(int data) const = 0; }; #ifndef OMITBAD class CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81_bad : public CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81_base { public: void action(int data) const; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81_goodG2B : public CWE195_Signed_to_Unsigned_Conversion_Error__fscanf_memmove_81_base { public: void action(int data) const; }; #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_VIEWS_ASH_USER_ACTION_HANDLER_H_ #define CHROME_BROWSER_UI_VIEWS_ASH_USER_ACTION_HANDLER_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/aura/client/user_action_client.h" class UserActionHandler : public aura::client::UserActionClient { public: UserActionHandler(); virtual ~UserActionHandler(); // aura::client::UserActionClient overrides: virtual bool OnUserAction( aura::client::UserActionClient::Command command) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UserActionHandler); }; #endif // CHROME_BROWSER_UI_VIEWS_ASH_USER_ACTION_HANDLER_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fwrite_13.c Label Definition File: CWE253_Incorrect_Check_of_Function_Return_Value.label.xml Template File: point-flaw-13.tmpl.c */ /* * @description * CWE: 253 Incorrect Check of Return Value * Sinks: fwrite * GoodSink: Correctly check if fwrite() failed * BadSink : Incorrectly check if fwrite() failed * Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifndef OMITBAD void CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fwrite_13_bad() { if(GLOBAL_CONST_FIVE==5) { /* FLAW: fwrite() might fail, in which case the return value will not be equal to strlen(data), * but we are checking to see if the return value is less than 0 */ if (fwrite((wchar_t *)L"string", sizeof(wchar_t), wcslen(L"string"), stdout) < 0) { printLine("fwrite failed!"); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(GLOBAL_CONST_FIVE!=5) instead of if(GLOBAL_CONST_FIVE==5) */ static void good1() { if(GLOBAL_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: check for the correct return value */ if (fwrite((wchar_t *)L"string", sizeof(wchar_t), wcslen(L"string"), stdout) != wcslen(L"string")) { printLine("fwrite failed!"); } } } /* good2() reverses the bodies in the if statement */ static void good2() { if(GLOBAL_CONST_FIVE==5) { /* FIX: check for the correct return value */ if (fwrite((wchar_t *)L"string", sizeof(wchar_t), wcslen(L"string"), stdout) != wcslen(L"string")) { printLine("fwrite failed!"); } } } void CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fwrite_13_good() { good1(); good2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fwrite_13_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fwrite_13_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/**************************************************************************** * * Copyright (c) 2006 Dave Hylands <dhylands@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms of BSD * license. * * See README and COPYING for more details. * ****************************************************************************/ #include <avr/io.h> #include <stdio.h> #include "Hardware.h" #include "Timer.h" #include "UART.h" uint8_t gADC[ 8 ]; int main(void) { int i; int led = 0; FILE *u0; FILE *u1; InitHardware(); // The first handle opened for read goes to stdin, and the first handle // opened for write goes to stdout. So u0 is stdin, stdout, and stderr #if defined( __AVR_LIBC_VERSION__ ) u0 = fdevopen( UART0_PutCharStdio, UART0_GetCharStdio ); u1 = fdevopen( UART1_PutCharStdio, NULL ); #else u0 = fdevopen( UART0_PutCharStdio, UART0_GetCharStdio, 0 ); u1 = fdevopen( UART1_PutCharStdio, NULL, 0 ); #endif printf( "*****\n" ); printf( "***** Flash-LED program\n" ); printf( "*****\n" ); fprintf( u1, "***** Output written to UART1 *****\n" ); while( 1 ) { // Turn all of the LEDs off LED_OFF( RED ); LED_OFF( BLUE ); LED_OFF( YELLOW ); switch ( led ) { case 0: LED_ON( RED ); printf( "R " ); break; case 1: LED_ON( BLUE ); printf( "B " ); break; case 2: LED_ON( YELLOW ); printf( "Y " ); break; } if ( ++led > 2 ) { led = 0; } // Tick rate is 100/sec so waiting for 100 waits for 1 sec for ( i = 0; i < 100; i++ ) { WaitForTimer0Rollover(); if ( UART0_IsCharAvailable() ) { char ch = getchar(); printf( "Read: '%c'\n", ch ); if ( ch == ' ' ) { printf( "*** Press a key to continue\n" ); ch = getchar(); printf( "*** Continuing...\n" ); } } } } return 0; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE506_Embedded_Malicious_Code__w32_email_02.c Label Definition File: CWE506_Embedded_Malicious_Code__w32.badonly.label.xml Template File: point-flaw-badonly-02.tmpl.c */ /* * @description * CWE: 506 Embedded Malicious Code * Sinks: email * BadSink : Send an e-mail * BadOnly (No GoodSink) * Flow Variant: 02 Control flow: if(1) * * */ #include "std_testcase.h" #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CRLF "\r\n" #define MAIL_SERVER "smtp.gmail.com" #ifndef OMITBAD void CWE506_Embedded_Malicious_Code__w32_email_02_bad() { if(1) { { WSADATA wsaData; int wsaDataInit = 0; struct sockaddr_in service; struct hostent *hostIP; SOCKET connectSocket = INVALID_SOCKET; char recBuffer[4096] = ""; char msgBuffer[255] = ""; do { if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } hostIP = gethostbyname(MAIL_SERVER); memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr = *((struct in_addr*)*hostIP->h_addr_list); service.sin_port = htons(25); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* FLAW: Send an e-mail */ /* Receive initial response from SMTP server */ if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } /* Send HELO */ sprintf(msgBuffer, "HELO %s%s", MAIL_SERVER, CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } /* Send MAIL FROM: <sender@mydomain.com> */ sprintf(msgBuffer, "MAIL FROM:<%s>%s", "sender@example.com", CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } /* Send RCPT TO: <receiver@domain.com> */ sprintf(msgBuffer, "RCPT TO:<%s>%s", "receiver@example.com", CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } /* Send DATA */ sprintf(msgBuffer, "DATA%s", CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } sprintf(msgBuffer, "%s%s", "Shhh, I'm sending some bad stuff!", CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } /* Send blank line and a period */ sprintf(msgBuffer, "%s.%s", CRLF, CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } /* Send QUIT */ sprintf(msgBuffer, "QUIT%s", CRLF); if (send(connectSocket, msgBuffer, strlen(msgBuffer), 0) <= 0) { break; } if (recv(connectSocket, recBuffer, sizeof(recBuffer), 0) <= 0) { break; } } while (0); if (connectSocket != INVALID_SOCKET) { closesocket(connectSocket); } if (wsaDataInit) { WSACleanup(); } } } } #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__w32_email_02_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
//===-- MICmdCmdSupportList.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // Overview: CMICmdCmdSupportListFeatures interface. // // To implement new MI commands derive a new command class from the // command base // class. To enable the new command for interpretation add the new // command class // to the command factory. The files of relevance are: // MICmdCommands.cpp // MICmdBase.h / .cpp // MICmdCmd.h / .cpp // For an introduction to adding a new command see // CMICmdCmdSupportInfoMiCmdQuery // command class as an example. #pragma once // In-house headers: #include "MICmdBase.h" //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "list-features". // This command does not follow the MI documentation exactly. //-- class CMICmdCmdSupportListFeatures : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdSupportListFeatures(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; // From CMICmnBase /* dtor */ ~CMICmdCmdSupportListFeatures() override; };
/* * include/asm-s390/cache.h * * S390 version * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation * * Derived from "include/asm-i386/cache.h" * Copyright (C) 1992, Linus Torvalds */ #ifndef __ARCH_S390_CACHE_H #define __ARCH_S390_CACHE_H #define L1_CACHE_BYTES 256 #define L1_CACHE_SHIFT 8 #define ARCH_KMALLOC_MINALIGN 8 #endif
#ifndef LIBETPAN_CONFIG_H #define LIBETPAN_CONFIG_H #ifdef WIN32 # define PATH_MAX 512 // Windows API security level # define SECURITY_WIN32 # ifdef __cplusplus # define PropVariantInit __inline PropVariantInit # pragma warning( push ) # pragma warning( disable : 4005 4141 ) # endif # include <tchar.h> # include <stdio.h> # include <string.h> # include <io.h> # include <Winsock2.h> # ifdef __cplusplus # pragma warning( pop ) # undef PropVariantInit # endif # if !defined(snprintf) # define snprintf _snprintf # endif # if !defined(strncasecmp) # define strncasecmp _strnicmp # endif # if !defined(strcasecmp) # define strcasecmp _stricmp # endif /* use Windows Types */ # if !defined(ssize_t) typedef SSIZE_T ssize_t; # endif # if !defined(uint16_t) typedef UINT16 uint16_t; # endif # if !defined(int16_t) typedef INT16 int16_t; # endif # if !defined(uint32_t) typedef UINT32 uint32_t; # endif # if !defined(int32_t) typedef INT32 int32_t; # endif # if !defined(pid_t) typedef DWORD pid_t; # endif # if !defined(caddr_t) typedef void * caddr_t; # endif /* avoid config.h*/ # define CONFIG_H #endif // WIN32 #include <limits.h> #ifdef _MSC_VER # define MMAP_UNAVAILABLE # define inline __inline #else # include <sys/param.h> #endif #define MAIL_DIR_SEPARATOR '/' #define MAIL_DIR_SEPARATOR_S "/" #ifdef _MSC_VER # ifdef LIBETPAN_DLL # define LIBETPAN_EXPORT __declspec(dllexport) # else # define LIBETPAN_EXPORT __declspec(dllimport) # endif #else # define LIBETPAN_EXPORT #endif /* REENTRANT under WINDOWS */ #ifndef LIBETPAN_REENTRANT # define LIBETPAN_REENTRANT 1 #endif #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef AnimationNodeTiming_h #define AnimationNodeTiming_h #include "bindings/core/v8/Nullable.h" #include "bindings/core/v8/ScriptWrappable.h" #include "core/animation/AnimationNode.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" namespace blink { class AnimationNodeTiming : public RefCountedWillBeGarbageCollectedFinalized<AnimationNodeTiming>, public ScriptWrappable { public: static PassRefPtrWillBeRawPtr<AnimationNodeTiming> create(AnimationNode* parent); double delay(); double endDelay(); String fill(); double iterationStart(); double iterations(); void getDuration(String propertyName, Nullable<double>& element0, String& element1); double playbackRate(); String direction(); String easing(); void setDelay(double); void setEndDelay(double); void setFill(String); void setIterationStart(double); void setIterations(double); bool setDuration(String name, double duration); void setPlaybackRate(double); void setDirection(String); void setEasing(String); void trace(Visitor*); private: RefPtrWillBeMember<AnimationNode> m_parent; explicit AnimationNodeTiming(AnimationNode*); }; } // namespace blink #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE400_Resource_Exhaustion__connect_socket_fwrite_54c.c Label Definition File: CWE400_Resource_Exhaustion.label.xml Template File: sources-sinks-54c.tmpl.c */ /* * @description * CWE: 400 Resource Exhaustion * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Assign count to be a relatively small number * Sinks: fwrite * GoodSink: Write to a file count number of times, but first validate count * BadSink : Write to a file count number of times * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #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 IP_ADDRESS "127.0.0.1" #define CHAR_ARRAY_SIZE (3 * sizeof(count) + 2) #define SENTENCE "This is the sentence we are printing to the file. " #ifndef OMITBAD /* bad function declaration */ void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(int count); void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_badSink(int count) { CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_badSink(count); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(int count); void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodG2BSink(int count) { CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodG2BSink(count); } /* goodB2G uses the BadSource with the GoodSink */ void CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(int count); void CWE400_Resource_Exhaustion__connect_socket_fwrite_54c_goodB2GSink(int count) { CWE400_Resource_Exhaustion__connect_socket_fwrite_54d_goodB2GSink(count); } #endif /* OMITGOOD */
#ifndef __ALEMBIC_SPLINE_TOPO_MODIFIER__H #define __ALEMBIC_SPLINE_TOPO_MODIFIER__H #include "AlembicDefinitions.h" #include "AlembicNames.h" #include "AlembicSplineUtilities.h" #include "resource.h" class AlembicSplineTopoModifier : public Modifier { public: IParamBlock2 *pblock; // Parameters in first block: enum { ID_PATH, ID_IDENTIFIER, ID_TIME, /* ID_TOPOLOGY,*/ ID_GEOMETRY, // ID_GEOALPHA, // ID_NORMALS, // ID_UVS, ID_MUTED, ID_IGNORE_SUBFRAME_SAMPLES }; static IObjParam *ip; static AlembicSplineTopoModifier *editMod; AlembicSplineTopoModifier(); ~AlembicSplineTopoModifier(); // From Animatable virtual Class_ID ClassID() { return ALEMBIC_SPLINE_TOPO_MODIFIER_CLASSID; } void GetClassName(TSTR &s) { s = _T(ALEMBIC_SPLINE_TOPO_MODIFIER_NAME); } CONST_2013 TCHAR *GetObjectName() { return _T(ALEMBIC_SPLINE_TOPO_MODIFIER_NAME); } void DeleteThis() { delete this; } RefTargetHandle Clone(RemapDir &remap); void EnumAuxFiles(AssetEnumCallback &nameEnum, DWORD flags); // From Modifier ChannelMask ChannelsUsed() { return TOPO_CHANNEL | GEOM_CHANNEL | TEXMAP_CHANNEL; } ChannelMask ChannelsChanged() { return TOPO_CHANNEL | GEOM_CHANNEL | TEXMAP_CHANNEL; } Class_ID InputType() { return genericShapeClassID; } void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node); // Interval LocalValidity(TimeValue t) { return GetValidity(t); } // Interval GetValidity (TimeValue t); BOOL DependOnTopology(ModContext &mc) { return FALSE; } // From BaseObject CreateMouseCallBack *GetCreateMouseCallBack() { return NULL; } void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev); void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next); int NumParamBlocks() { return 1; } IParamBlock2 *GetParamBlock(int i) { return pblock; } IParamBlock2 *GetParamBlockByID(short id) { return (pblock->ID() == id) ? pblock : NULL; } int NumRefs() { return 1; } RefTargetHandle GetReference(int i) { return pblock; } int NumSubs() { return 1; } Animatable *SubAnim(int i) { return GetReference(i); } TSTR SubAnimName(int i) { return _T("IDS_PROPS"); } #if (crate_Max_Version >= 2015) RefResult NotifyRefChanged(const Interval &changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message, BOOL propagate); #else RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message); #endif private: virtual void SetReference(int i, RefTargetHandle rtarg) { pblock = (IParamBlock2 *)rtarg; } private: std::string m_CachedAbcFile; }; class AlembicSplineTopoModifierClassDesc : public ClassDesc2 { public: AlembicSplineTopoModifierClassDesc() {} ~AlembicSplineTopoModifierClassDesc() {} int IsPublic() { return TRUE; } const TCHAR *ClassName() { return _T(ALEMBIC_SPLINE_TOPO_MODIFIER_NAME); } SClass_ID SuperClassID() { return OSM_CLASS_ID; } void *Create(BOOL loading = FALSE) { return new AlembicSplineTopoModifier(); } Class_ID ClassID() { return ALEMBIC_SPLINE_TOPO_MODIFIER_CLASSID; } const TCHAR *Category() { return EXOCORTEX_ALEMBIC_CATEGORY; } const TCHAR *InternalName() { return _T(ALEMBIC_SPLINE_TOPO_MODIFIER_SCRIPTNAME); } // returns fixed parsable name (scripter-visible name) HINSTANCE HInstance() { return hInstance; // returns owning module handle } }; ClassDesc2 *GetAlembicSplineTopoModifierClassDesc(); #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_snprintf_12.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml Template File: sources-sink-12.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sink: snprintf * BadSink : Copy string to data using snprintf * Flow Variant: 12 Control flow: if(globalReturnsTrueOrFalse()) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define SNPRINTF _snprintf #else #define SNPRINTF snprintf #endif #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_snprintf_12_bad() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; if(globalReturnsTrueOrFalse()) { /* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination * buffer in various memory copying functions using a "large" source buffer. */ data = dataBadBuffer; data[0] = '\0'; /* null terminate */ } else { /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ } { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ SNPRINTF(data, 100, "%s", source); printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() - use goodsource and badsink by changing the "if" so that * both branches use the GoodSource */ static void goodG2B() { char * data; char dataBadBuffer[50]; char dataGoodBuffer[100]; if(globalReturnsTrueOrFalse()) { /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ } else { /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; data[0] = '\0'; /* null terminate */ } { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ SNPRINTF(data, 100, "%s", source); printLine(data); } } void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_snprintf_12_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_snprintf_12_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_snprintf_12_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#include "erfa.h" void eraEceq06(double date1, double date2, double dl, double db, double *dr, double *dd) /* ** - - - - - - - - - - ** e r a E c e q 0 6 ** - - - - - - - - - - ** ** Transformation from ecliptic coordinates (mean equinox and ecliptic ** of date) to ICRS RA,Dec, using the IAU 2006 precession model. ** ** Given: ** date1,date2 double TT as a 2-part Julian date (Note 1) ** dl,db double ecliptic longitude and latitude (radians) ** ** Returned: ** dr,dd double ICRS right ascension and declination (radians) ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) No assumptions are made about whether the coordinates represent ** starlight and embody astrometric effects such as parallax or ** aberration. ** ** 3) The transformation is approximately that from ecliptic longitude ** and latitude (mean equinox and ecliptic of date) to mean J2000.0 ** right ascension and declination, with only frame bias (always ** less than 25 mas) to disturb this classical picture. ** ** Called: ** eraS2c spherical coordinates to unit vector ** eraEcm06 J2000.0 to ecliptic rotation matrix, IAU 2006 ** eraTrxp product of transpose of r-matrix and p-vector ** eraC2s unit vector to spherical coordinates ** eraAnp normalize angle into range 0 to 2pi ** eraAnpm normalize angle into range +/- pi ** ** Copyright (C) 2013-2019, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rm[3][3], v1[3], v2[3], a, b; /* Spherical to Cartesian. */ eraS2c(dl, db, v1); /* Rotation matrix, ICRS equatorial to ecliptic. */ eraEcm06(date1, date2, rm); /* The transformation from ecliptic to ICRS. */ eraTrxp(rm, v1, v2); /* Cartesian to spherical. */ eraC2s(v2, &a, &b); /* Express in conventional ranges. */ *dr = eraAnp(a); *dd = eraAnpm(b); } /*---------------------------------------------------------------------- ** ** ** Copyright (C) 2013-2019, NumFOCUS Foundation. ** All rights reserved. ** ** This library is derived, with permission, from the International ** Astronomical Union's "Standards of Fundamental Astronomy" library, ** available from http://www.iausofa.org. ** ** The ERFA version is intended to retain identical functionality to ** the SOFA library, but made distinct through different function and ** file names, as set out in the SOFA license conditions. The SOFA ** original has a role as a reference standard for the IAU and IERS, ** and consequently redistribution is permitted only in its unaltered ** state. The ERFA version is not subject to this restriction and ** therefore can be included in distributions which do not support the ** concept of "read only" software. ** ** Although the intent is to replicate the SOFA API (other than ** replacement of prefix names) and results (with the exception of ** bugs; any that are discovered will be fixed), SOFA is not ** responsible for any errors found in this version of the library. ** ** If you wish to acknowledge the SOFA heritage, please acknowledge ** that you are using a library derived from SOFA, rather than SOFA ** itself. ** ** ** TERMS AND CONDITIONS ** ** 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 Standards Of Fundamental Astronomy Board, ** the International Astronomical Union 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. ** */