text
stringlengths
4
6.14k
/* Copyright (c) 2013, Tom van der Woerdt */ #include <openssl/sha.h> #include <stdlib.h> #include <string.h> #include "txpool.h" int bp_txpool_init(bp_txpool_s *pool, int size) { pool->size = size; pool->pos = 0; pool->transactions = malloc(size * sizeof(bp_txpool_tx_s)); memset(pool->transactions, 0, size * sizeof(bp_txpool_tx_s)); return 0; } void bp_txpool_deinit(bp_txpool_s *pool) { int i; for (i = 0; i < pool->size; i++) { if (pool->transactions[i].data) { free(pool->transactions[i].data); } } free(pool->transactions); } int bp_txpool_addtx(bp_txpool_s *pool, char *tx, size_t tx_len) { bp_txpool_tx_s *entry = &pool->transactions[pool->pos]; if (entry->data) free(entry->data); entry->data = tx; entry->length = tx_len; unsigned char hash1[SHA256_DIGEST_LENGTH]; unsigned char hash2[SHA256_DIGEST_LENGTH]; SHA256((unsigned char*)tx, tx_len, hash1); SHA256(hash1, SHA256_DIGEST_LENGTH, hash2); memcpy(entry->hash, hash2, 32); entry->checksum = *(unsigned int*)(hash2); pool->pos = (pool->pos + 1) % pool->size; return 0; } int bp_txpool_addtx_copy(bp_txpool_s *pool, char *tx, size_t tx_len) { char *copy = malloc(tx_len); memcpy(copy, tx, tx_len); return bp_txpool_addtx(pool, copy, tx_len); } bp_txpool_tx_s *bp_txpool_gettx(bp_txpool_s *pool, char *hash) { // TODO: This is just horrible. int i; for (i = 0; i < pool->size; i++) { if (memcmp(pool->transactions[i].hash, hash, 32) == 0) { return &pool->transactions[i]; } } return NULL; }
#ifndef __ATKUniversalDelay__ #define __ATKUniversalDelay__ #include "IPlug_include_in_plug_hdr.h" #include <ATK/Core/InPointerFilter.h> #include <ATK/Core/OutPointerFilter.h> #include <ATK/Delay/UniversalFixedDelayLineFilter.h> class ATKUniversalDelay : public IPlug { public: ATKUniversalDelay(IPlugInstanceInfo instanceInfo); ~ATKUniversalDelay(); void Reset(); void OnParamChange(int paramIdx); void ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames); private: ATK::InPointerFilter<double> inFilter; ATK::UniversalFixedDelayLineFilter<double> delayFilter; ATK::OutPointerFilter<double> outFilter; }; #endif
#ifndef __PHYSICS_CONTROLLER #define __PHYSICS_CONTROLLER #include "GameObject.h" #include <map> #include <vector> #include <btBulletDynamicsCommon.h> #include "GraphosMotionState.h" namespace Graphos { namespace Physics { class PhysicsController { public: enum CollisionShape { G_SPHERE, G_CUBE }; struct PhysicsConfig { CollisionShape collisionShape; Math::Vector3 collisionDimensions; Math::Vector3 initialInertia; gFloat mass; gFloat restitution; gFloat friction; gFloat rollingFriction; PhysicsConfig() : mass( 0.0f ), restitution( 1.0f ), friction( 0.5f ), rollingFriction( 0.4f ){}; }; static void Initialize( void ); static void Shutdown( void ); static void CreatePhysicsObject( GraphosMotionState* gms, PhysicsConfig* physConfig, Math::Vector3* shootVec = NULL); static PhysicsController& Get( void ) { static PhysicsController instance; return instance; } static void StepPhysics( float timeStep, int maxSubSteps=1, float fixedTimeStep=(1.f/60.f) ); private: PhysicsController( void ) { } PhysicsController( const PhysicsController& ); void operator=( const PhysicsController& ); static btVector3 ToBulletVec3( const Math::Vector3& ); static btDefaultCollisionConfiguration* collisionConfiguration; static btCollisionDispatcher* dispatcher; static btBroadphaseInterface* overlappingPairCache; static btSequentialImpulseConstraintSolver* solver; static btDiscreteDynamicsWorld* dynamicsWorld; //static vector<btRigidBody> }; } } #endif//__PHYSICS_CONTROLLER
static VALUE <%=c_func(1)%>(VALUE mod, VALUE prefix) { long len; if (TYPE(prefix) != T_STRING) { rb_raise(rb_eTypeError,"argument must be string"); } if (blas_prefix) { free(blas_prefix); } len = RSTRING_LEN(prefix); blas_prefix = malloc(len+1); strcpy(blas_prefix, StringValueCStr(prefix)); return prefix; }
/****************************************************************** * * CyberX3D for C++ * * Copyright (C) Satoshi Konno 1996-2007 * * File: ExtrusionNode.h * ******************************************************************/ #ifndef _CX3D_EXTRUSIONNODE_H_ #define _CX3D_EXTRUSIONNODE_H_ #include <cybergarage/x3d/Geometry3DNode.h> namespace CyberX3D { class ExtrusionNode : public Geometry3DNode { SFString *useField; SFString *defField; SFBool *beginCapField; SFBool *endCapField; SFBool *convexField; SFFloat *creaseAngleField; SFBool *ccwField; SFBool *solidField; MFRotation *orientationField; MFVec2f *scaleField; MFVec2f *crossSectionField; MFVec3f *spineField; public: ExtrusionNode(); virtual ~ExtrusionNode(); //////////////////////////////////////////////// // BeginCap //////////////////////////////////////////////// SFBool *getBeginCapField() const; SFString *getDEF() const; SFString *getUSE() const; void setBeginCap(bool value); void setBeginCap(int value); bool getBeginCap() const; //////////////////////////////////////////////// // EndCap //////////////////////////////////////////////// SFBool *getEndCapField() const; void setEndCap(bool value); void setEndCap(int value); bool getEndCap() const; //////////////////////////////////////////////// // Convex //////////////////////////////////////////////// SFBool *getConvexField() const; void setConvex(bool value); void setConvex(int value); bool getConvex() const; //////////////////////////////////////////////// // CCW //////////////////////////////////////////////// SFBool *getCCWField() const; void setCCW(bool value); void setCCW(int value); bool getCCW() const; //////////////////////////////////////////////// // Solid //////////////////////////////////////////////// SFBool *getSolidField() const; void setSolid(bool value); void setSolid(int value); bool getSolid() const; //////////////////////////////////////////////// // CreaseAngle //////////////////////////////////////////////// SFFloat *getCreaseAngleField() const; void setCreaseAngle(float value); float getCreaseAngle() const; //////////////////////////////////////////////// // orientation //////////////////////////////////////////////// MFRotation *getOrientationField() const; void addOrientation(float value[]); void addOrientation(float x, float y, float z, float angle); int getNOrientations() const; void getOrientation(int index, float value[]) const; //////////////////////////////////////////////// // scale //////////////////////////////////////////////// MFVec2f *getScaleField() const; void addScale(float value[]); void addScale(float x, float z); int getNScales() const; void getScale(int index, float value[]) const; //////////////////////////////////////////////// // crossSection //////////////////////////////////////////////// MFVec2f *getCrossSectionField() const; void addCrossSection(float value[]); void addCrossSection(float x, float z); int getNCrossSections() const; void getCrossSection(int index, float value[]) const; //////////////////////////////////////////////// // spine //////////////////////////////////////////////// MFVec3f *getSpineField() const; void addSpine(float value[]); void addSpine(float x, float y, float z); int getNSpines() const; void getSpine(int index, float value[]) const; //////////////////////////////////////////////// // List //////////////////////////////////////////////// ExtrusionNode *next() const; ExtrusionNode *nextTraversal() const; //////////////////////////////////////////////// // functions //////////////////////////////////////////////// bool isChildNodeType(Node *node) const; void initialize(); void uninitialize(); void update(); //////////////////////////////////////////////// // BoundingBox //////////////////////////////////////////////// void recomputeBoundingBox(); //////////////////////////////////////////////// // recomputeDisplayList //////////////////////////////////////////////// void recomputeDisplayList(); //////////////////////////////////////////////// // Polygons //////////////////////////////////////////////// int getNPolygons() const; //////////////////////////////////////////////// // Infomation //////////////////////////////////////////////// void outputContext(std::ostream &printStream, const char *indentString) const; }; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84.h Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-84.tmpl.h */ /* * @description * CWE: 78 OS Command Injection * BadSource: file Read input from a file * GoodSource: Fixed string * Sinks: w32spawnl * BadSink : execute command with wspawnl * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif namespace CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84 { #ifndef OMITBAD class CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_bad { public: CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_bad(wchar_t * dataCopy); ~CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_bad(); private: wchar_t * data; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_goodG2B { public: CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_goodG2B(wchar_t * dataCopy); ~CWE78_OS_Command_Injection__wchar_t_file_w32spawnl_84_goodG2B(); private: wchar_t * data; }; #endif /* OMITGOOD */ }
#import <Foundation/Foundation.h> @class PB_AS_Component; @class PB_AS_LocalizedDescription; @interface PB_AS_Settings : NSObject { PB_AS_Component * component_; NSMutableDictionary * settingsDictionary_; NSMutableArray * localizedDescriptions_; } - (id) initWithComponent:(PB_AS_Component *) inComponent; + (id) settingsWithComponent:(PB_AS_Component *) inComponent; - (void) notifySettingsChanged; - (NSDictionary *) descriptionDictionaryForLanguage:(NSString *) inLanguage; - (void) setDescriptionDictionary:(NSDictionary *) inDictionary forLanguage:(NSString *) inLanguage; // Display Information - (id) displayInformationForKey:(NSString *) inKey; - (void) setDisplayInformation:(NSString *) inString forKey:(NSString *) inKey; - (NSString *) displayName; - (void) setDisplayName:(NSString *) inString; - (NSString *) identifier; - (void) setIdentifier:(NSString *) inString; - (NSString *) getInfoString; - (void) setGetInfoString:(NSString *) inString; - (NSString *) shortVersion; - (void) setShortVersion:(NSString *) inString; - (NSString *) iconFile; - (void) setIconFile:(NSString *) inString; // Version - (NSNumber *) majorVersion; - (void) setMajorVersion:(NSNumber *) inMajorVersion; - (NSNumber *) minorVersion; - (void) setMinorVersion:(NSNumber *) inMinorVersion; // Attributes Specific to Packages - (NSNumber *) optionForKey:(NSString *) inKey; - (void) setOption:(NSNumber *) inNumber forKey:(NSString *) inKey; - (NSNumber *) restart; - (void) setRestart:(NSNumber *) inNumber; - (NSNumber *) authorization; - (void) setAuthorization:(NSNumber *) inNumber; - (NSNumber *) optionForKey:(NSString *) inKey; - (void) setOption:(NSNumber *) inNumber forKey:(NSString *) inKey; - (NSNumber *) required; - (void) setRequired:(NSNumber *) inNumber; - (NSNumber *) rootVolumeOnly; - (void) setRootVolumeOnly:(NSNumber *) inNumber; - (NSNumber *) overwriteDirectoryPermissions; - (void) setOverwriteDirectoryPermissions:(NSNumber *) inNumber; - (NSNumber *) updateInstalledLanguagesOnly; - (void) setUpdateInstalledLanguagesOnly:(NSNumber *) inNumber; - (NSNumber *) relocatable; - (void) setRelocatable:(NSNumber *) inNumber; - (NSNumber *) installFatBinaries; - (void) setInstallFatBinaries:(NSNumber *) inNumber; - (NSNumber *) allowRevertToPreviousVersions; - (void) setAllowRevertToPreviousVersions:(NSNumber *) inNumber; - (NSNumber *) followSymbolicLinks; - (void) setFollowSymbolicLinks:(NSNumber *) inNumber; // Localized Descriptions - (NSArray *) localizedDescriptions; - (void) setLocalizedDescriptions: (NSArray *) inLocalizations; - (id) valueWithName:(NSString *)name inPropertyWithKey:(NSString *) inKey; - (id) valueAtIndex:(unsigned)index inPropertyWithKey:(NSString *) inKey; - (void) replaceValueAtIndex:(unsigned)index inPropertyWithKey:(NSString *) inKey withValue:(id)value; - (void) insertValue:(id)value atIndex:(unsigned)index inPropertyWithKey:(NSString *) inKey; - (void) removeValueAtIndex:(unsigned)index fromPropertyWithKey:(NSString *) inKey; - (void) insertValue:(id)value inPropertyWithKey:(NSString *) inKey; @end
#if !defined(SCREEN_H) #define SCREEN_H void terminal_writestring(const char* data); void terminal_rewriteprev(const char* data); void terminal_rewriteago(const char* data, size_t lines); void terminal_clear(); void init_screen(); #endif
#include <stdlib.h> int hideme(int x) { return x; } int main(int argc, char **argv) { int r = rand(); int s = hideme(r); return (r <= s); }
#include <stdlib.h> int main(int argc, char **argv) { int x; double r = argc; if (!(0 > r)) { x = 7; } else { x = 42; } return x; }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*\ ______]|]]]]|]__]|]]]]|]__]|]]]]]|]__]|]]]]|]__]|]__]|]__]|]]]]|]_______,_______ _____]|]__]|]__]|]_______]|]___]|]__]|]__]|]___]|]_]|]__]|]__]|]_______, ,______ ____]|]__]|]__]|]]]]|]__]|]]]]]|]__]|]__]|]____]|]]|]__]|]__]|]_______, ,_____ ___]|]____________]|]__]|]________]|]__________]|]|]__]|]____________, -R- ,____ __]|]____________]|]__]|]________]|]___________]||]__]|]____________, | ,___ _]|]_______]|]]]]|]__]|]]]]]|]__]|]____________]|]__]|]____________, , , , , ,__ || | \*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* This software is released under the BSD License. | | Copyright (c) 2009, Kevin P. Barry [the resourcerver project] | All rights reserved. | | Redistribution and use in source and binary forms, with or without | modification, are permitted provided that the following conditions are met: | | - Redistributions of source code must retain the above copyright notice, this | list of conditions and the following disclaimer. | | - Redistributions in binary form must reproduce the above copyright notice, | this list of conditions and the following disclaimer in the documentation | and/or other materials provided with the distribution. | | - Neither the name of the Resourcerver Project nor the names of its | contributors may be used to endorse or promote products derived from this | software without specific prior written permission. | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | POSSIBILITY OF SUCH DAMAGE. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifndef rsvp_rqconfig_thread_h #define rsvp_rqconfig_thread_h #ifdef __cplusplus extern "C" { #endif #include "rsvp-rqconfig-hook.h" #include "thread-macro.h" #include "../api/command.h" extern int rsvp_rqconfig_thread_request_configure(const struct rqconfig_source_info*, text_info); extern int rsvp_rqconfig_thread_request_deconfigure(const struct rqconfig_source_info*, text_info); #ifdef __cplusplus } #endif #endif /*rsvp_rqconfig_thread_h*/
/* SPDX-License-Identifier: BSD-3-Clause */ #include <stdio.h> #include "tools/fapi/tss2_template.h" static char *path; /* Parse commandline parameters */ static bool on_option(char key, char *value) { switch (key) { case 'p': path = value; break; } return true; } /* Define possible commandline parameters */ static bool tss2_tool_onstart(tpm2_options **opts) { struct option topts[] = { {"path", required_argument, NULL, 'p'} }; return (*opts = tpm2_options_new ("p:", ARRAY_LEN(topts), topts, on_option, NULL, 0)) != NULL; } /* Execute specific tool */ static int tss2_tool_onrun (FAPI_CONTEXT *fctx) { if (!path) { fprintf (stderr, "No path to the entity provided, use --path\n"); return -1; } /* Execute FAPI command with passed arguments */ TSS2_RC r = Fapi_Delete(fctx, path); if (r != TSS2_RC_SUCCESS){ LOG_PERR ("Fapi_Delete", r); return 1; } return 0; } TSS2_TOOL_REGISTER("delete", tss2_tool_onstart, tss2_tool_onrun, NULL)
/* * ntpq.h - definitions of interest to ntpq */ #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #include "ntp_fp.h" #include "ntp.h" #include "ntp_stdlib.h" #include "ntp_string.h" #include "ntp_malloc.h" #include "ntp_assert.h" #include "ntp_control.h" #include "lib_strbuf.h" /* * Maximum number of arguments */ #define MAXARGS 4 /* * Limit on packets in a single response. Increasing this value to * 96 will marginally speed "mrulist" operation on lossless networks * but it has been observed to cause loss on WiFi networks and with * an IPv6 go6.net tunnel over UDP. That loss causes the request * row limit to be cut in half, and it grows back very slowly to * ensure forward progress is made and loss isn't triggered too quickly * afterward. While the lossless case gains only marginally with * MAXFRAGS == 96, the lossy case is a lot slower due to the repeated * timeouts. Empirally, MAXFRAGS == 32 avoids most of the routine loss * on both the WiFi and UDP v6 tunnel tests and seems a good compromise. * This suggests some device in the path has a limit of 32 ~512 byte UDP * packets in queue. * Lowering MAXFRAGS may help with particularly lossy networks, but some * ntpq commands may rely on the longtime value of 24 implicitly, * assuming a single multipacket response will be large enough for any * needs. In contrast, the "mrulist" command is implemented as a series * of requests and multipacket responses to each. */ #define MAXFRAGS 32 /* * Error codes for internal use */ #define ERR_UNSPEC 256 #define ERR_INCOMPLETE 257 #define ERR_TIMEOUT 258 #define ERR_TOOMUCH 259 /* * Flags for forming descriptors. */ #define OPT 0x80 /* this argument is optional, or'd with type */ #define NO 0x0 #define NTP_STR 0x1 /* string argument */ #define NTP_UINT 0x2 /* unsigned integer */ #define NTP_INT 0x3 /* signed integer */ #define NTP_ADD 0x4 /* IP network address */ #define IP_VERSION 0x5 /* IP version */ #define NTP_ADP 0x6 /* IP address and port */ #define NTP_LFP 0x7 /* NTP timestamp */ #define NTP_MODE 0x8 /* peer mode */ #define NTP_2BIT 0x9 /* leap bits */ /* * Arguments are returned in a union */ typedef union { const char *string; long ival; u_long uval; sockaddr_u netnum; } arg_v; /* * Structure for passing parsed command line */ struct parse { const char *keyword; arg_v argval[MAXARGS]; size_t nargs; }; /* * ntpdc includes a command parser which could charitably be called * crude. The following structure is used to define the command * syntax. */ struct xcmd { const char *keyword; /* command key word */ void (*handler) (struct parse *, FILE *); /* command handler */ u_char arg[MAXARGS]; /* descriptors for arguments */ const char *desc[MAXARGS]; /* descriptions for arguments */ const char *comment; }; /* * Structure to hold association data */ struct association { associd_t assid; u_short status; }; /* * mrulist terminal status interval */ #define MRU_REPORT_SECS 5 /* * var_format is used to override cooked formatting for selected vars. */ typedef struct var_format_tag { const char * varname; u_short fmt; } var_format; typedef struct chost_tag chost; struct chost_tag { const char *name; int fam; }; extern chost chosts[]; extern int interactive; /* are we prompting? */ extern int old_rv; /* use old rv behavior? --old-rv */ extern u_int assoc_cache_slots;/* count of allocated array entries */ extern u_int numassoc; /* number of cached associations */ extern u_int numhosts; extern void grow_assoc_cache(void); extern void asciize (int, char *, FILE *); extern int getnetnum (const char *, sockaddr_u *, char *, int); extern void sortassoc (void); extern void show_error_msg (int, associd_t); extern int dogetassoc (FILE *); extern int doquery (int, associd_t, int, size_t, const char *, u_short *, size_t *, const char **); extern int doqueryex (int, associd_t, int, size_t, const char *, u_short *, size_t *, const char **, int); extern const char * nntohost (sockaddr_u *); extern const char * nntohost_col (sockaddr_u *, size_t, int); extern const char * nntohostp (sockaddr_u *); extern int decodets (char *, l_fp *); extern int decodeuint (char *, u_long *); extern int nextvar (size_t *, const char **, char **, char **); extern int decodetime (char *, l_fp *); extern void printvars (size_t, const char *, int, int, int, FILE *); extern int decodeint (char *, long *); extern void makeascii (size_t, const char *, FILE *); extern const char * trunc_left (const char *, size_t); extern const char * trunc_right(const char *, size_t); typedef int/*BOOL*/ (*Ctrl_C_Handler)(void); extern int/*BOOL*/ push_ctrl_c_handler(Ctrl_C_Handler); extern int/*BOOL*/ pop_ctrl_c_handler(Ctrl_C_Handler);
/* module : clock.c version : 1.9 date : 01/19/20 */ #ifndef CLOCK_C #define CLOCK_C /** clock : -> I Pushes the integer value of current CPU usage in milliseconds. */ void do_clock(void) { COMPILE; do_push(clock() - startclock); } #endif
#ifndef __PVT_3P_IFACE_H #define __PVT_3P_IFACE_H #include "bs_common.h" #include "bs_object_base.h" #include "conf.h" #include BS_FORCE_PLUGIN_IMPORT() #include "table_iface.h" #include BS_STOP_PLUGIN_IMPORT() #include <list> namespace blue_sky { /** * \brief pvt_base */ class pvt_base; class pvt_oil; class pvt_dead_oil; class pvt_gas; class pvt_water; class BS_API_PLUGIN pvt_3p_iface : public objbase { public: typedef pvt_base pvt_base_t; //!< type of base pvt class typedef pvt_oil pvt_oil_t; //!< pvt_oil type typedef pvt_dead_oil pvt_dead_oil_t; //!< pvt_dead_oil type typedef pvt_gas pvt_gas_t; //!< pvt_gas type typedef pvt_water pvt_water_t; //!< pvt_water type typedef smart_ptr <pvt_base_t, true> sp_pvt_t; //!< smart_ptr to pvt_base type typedef smart_ptr <pvt_dead_oil_t, true> sp_pvt_oil; //!< smart_ptr to pvt_dead_oil type typedef smart_ptr <pvt_dead_oil_t, true> sp_pvt_dead_oil; //!< smart_ptr to pvt_dead_oil type typedef smart_ptr <pvt_gas_t, true> sp_pvt_gas; //!< smart_ptr to pvt_gas type typedef smart_ptr <pvt_water_t, true> sp_pvt_water; //!< smart_ptr to pvt_water type typedef std::vector< sp_pvt_t > sp_pvt_array_t; //!< type for array of pvt_base objects typedef std::vector< sp_pvt_oil > sp_pvt_oil_array_t; //!< type for array of pvt_dead_oil objects typedef std::vector< sp_pvt_dead_oil > sp_pvt_dead_oil_array_t; //!< type for array of pvt_dead_oil objects typedef std::vector< sp_pvt_gas > sp_pvt_gas_array_t; //!< type for array of pvt_gas objects typedef std::vector< sp_pvt_water > sp_pvt_water_array_t; //!< type for array of pvt_water objects typedef std::vector< double > stdv_double; //typedef smart_ptr <pvt_dummy_iface, true> sp_pvt_dummy_iface; /** * \brief destructor */ virtual ~pvt_3p_iface () {} virtual t_long get_n_pvt_regions () const = 0; virtual BS_SP (pvt_dead_oil) get_pvt_oil (const t_long index_pvt_region) const = 0; virtual BS_SP (pvt_gas) get_pvt_gas (const t_long index_pvt_region) const = 0; virtual BS_SP (pvt_water) get_pvt_water (const t_long index_pvt_region) const = 0; virtual sp_pvt_dead_oil_array_t & get_pvt_oil_array () = 0; virtual sp_pvt_gas_array_t & get_pvt_gas_array () = 0; virtual sp_pvt_water_array_t & get_pvt_water_array () = 0; virtual std::list <BS_SP (table_iface)> get_tables_list (t_long pvt_fluid_type) const = 0; virtual void init_pvt_arrays (const t_long n_pvt_regions_, bool is_oil, bool is_gas, bool is_water) = 0; virtual BS_SP (table_iface) get_table (t_long index_pvt_region, t_long pvt_fluid_type) const = 0; //! get density data to fill in virtual BS_SP (table_iface) get_density_table (t_long index_pvt_region) const = 0; virtual std::list <BS_SP( table_iface)> get_density_list () const = 0; //! get density data to fill in virtual spv_float get_density () const = 0; //! set density to pvt internal data virtual void set_density_to_pvt_internal () = 0; //! build pvt internal tables virtual void init_pvt_calc_data (t_float atm_p, t_float min_p, t_float max_p, t_float n_intervals) = 0; }; } // namespace blue_sky #endif // __PVT_3P_IFACE_H
/*========================================================================= Program: Visualization Toolkit Module: vtkUnsignedCharArray.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkUnsignedCharArray - dynamic, self-adjusting array of unsigned char // .SECTION Description // vtkUnsignedCharArray is an array of values of type unsigned char. // It provides methods for insertion and retrieval of values and will // automatically resize itself to hold new data. #ifndef __vtkUnsignedCharArray_h #define __vtkUnsignedCharArray_h // Tell the template header how to give our superclass a DLL interface. #if !defined(__vtkUnsignedCharArray_cxx) # define VTK_DATA_ARRAY_TEMPLATE_TYPE unsigned char #endif #include "vtkCommonCoreExport.h" // For export macro #include "vtkDataArray.h" #include "vtkDataArrayTemplate.h" // Real Superclass // Fake the superclass for the wrappers. #define vtkDataArray vtkDataArrayTemplate<unsigned char> class VTKCOMMONCORE_EXPORT vtkUnsignedCharArray : public vtkDataArray #undef vtkDataArray { public: static vtkUnsignedCharArray* New(); vtkTypeMacro(vtkUnsignedCharArray,vtkDataArray); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Get the data type. int GetDataType() { return VTK_UNSIGNED_CHAR; } // Description: // Copy the tuple value into a user-provided array. void GetTupleValue(vtkIdType i, unsigned char* tuple) { this->RealSuperclass::GetTupleValue(i, tuple); } // Description: // Set the tuple value at the ith location in the array. void SetTupleValue(vtkIdType i, const unsigned char* tuple) { this->RealSuperclass::SetTupleValue(i, tuple); } // Description: // Insert (memory allocation performed) the tuple into the ith location // in the array. void InsertTupleValue(vtkIdType i, const unsigned char* tuple) { this->RealSuperclass::InsertTupleValue(i, tuple); } // Description: // Insert (memory allocation performed) the tuple onto the end of the array. vtkIdType InsertNextTupleValue(const unsigned char* tuple) { return this->RealSuperclass::InsertNextTupleValue(tuple); } // Description: // Get the data at a particular index. unsigned char GetValue(vtkIdType id) { return this->RealSuperclass::GetValue(id); } // Description: // Set the data at a particular index. Does not do range checking. Make sure // you use the method SetNumberOfValues() before inserting data. void SetValue(vtkIdType id, unsigned char value) { this->RealSuperclass::SetValue(id, value); } // Description: // Specify the number of values for this object to hold. Does an // allocation as well as setting the MaxId ivar. Used in conjunction with // SetValue() method for fast insertion. void SetNumberOfValues(vtkIdType number) { this->RealSuperclass::SetNumberOfValues(number); } // Description: // Insert data at a specified position in the array. void InsertValue(vtkIdType id, unsigned char f) { this->RealSuperclass::InsertValue(id, f); } // Description: // Insert data at the end of the array. Return its location in the array. vtkIdType InsertNextValue(unsigned char f) { return this->RealSuperclass::InsertNextValue(f); } // Description: // Get the range of array values for the given component in the // native data type. unsigned char *GetValueRange(int comp) { return this->RealSuperclass::GetValueRange(comp); } //BTX void GetValueRange(unsigned char range[2], int comp) { this->RealSuperclass::GetValueRange(range, comp); } //ETX // Description: // Get the range of array values for the 0th component in the // native data type. unsigned char *GetValueRange() { return this->RealSuperclass::GetValueRange(0); } //BTX void GetValueRange(unsigned char range[2]) { this->RealSuperclass::GetValueRange(range, 0); } //ETX // Description: // Get the minimum data value in its native type. static unsigned char GetDataTypeValueMin() { return VTK_UNSIGNED_CHAR_MIN; } // Description: // Get the maximum data value in its native type. static unsigned char GetDataTypeValueMax() { return VTK_UNSIGNED_CHAR_MAX; } // Description: // Get the address of a particular data index. Make sure data is allocated // for the number of items requested. Set MaxId according to the number of // data values requested. unsigned char* WritePointer(vtkIdType id, vtkIdType number) { return this->RealSuperclass::WritePointer(id, number); } // Description: // Get the address of a particular data index. Performs no checks // to verify that the memory has been allocated etc. unsigned char* GetPointer(vtkIdType id) { return this->RealSuperclass::GetPointer(id); } // Description: // This method lets the user specify data to be held by the array. The // array argument is a pointer to the data. size is the size of // the array supplied by the user. Set save to 1 to keep the class // from deleting the array when it cleans up or reallocates memory. // The class uses the actual array provided; it does not copy the data // from the suppled array. void SetArray(unsigned char* array, vtkIdType size, int save) { this->RealSuperclass::SetArray(array, size, save); } void SetArray(unsigned char* array, vtkIdType size, int save, int deleteMethod) { this->RealSuperclass::SetArray(array, size, save, deleteMethod); } protected: vtkUnsignedCharArray(vtkIdType numComp=1); ~vtkUnsignedCharArray(); private: //BTX typedef vtkDataArrayTemplate<unsigned char> RealSuperclass; //ETX vtkUnsignedCharArray(const vtkUnsignedCharArray&); // Not implemented. void operator=(const vtkUnsignedCharArray&); // Not implemented. }; #endif
#include <stdio.h> #include <phabos/mm.h> #include <apps/shell.h> static int free_main(int argc, char **argv) { unsigned long total; unsigned long used; unsigned long cached; unsigned long free; struct mm_usage *usage = mm_get_usage(); total = (unsigned long) atomic_get(&usage->total); used = (unsigned long) atomic_get(&usage->used); cached = (unsigned long) atomic_get(&usage->cached); free = total - used; printf(" %12s %12s %12s %12s\n", "total", "used", "free", "cache"); printf("Mems: %12lu %12lu %12lu %12lu\n", total, used, free, cached); return 0; } __shell_command__ struct shell_command free_command = { .name = "free", .description = "Get memory usage statistics", .entry = free_main, };
// SDLImageFieldName.h // #import "SDLEnum.h" /** The name that identifies the filed. Used in DisplayCapabilities. @since SmartDeviceLink 3.0 */ typedef SDLEnum SDLImageFieldName SDL_SWIFT_ENUM; /** The image field for SoftButton */ extern SDLImageFieldName const SDLImageFieldNameSoftButtonImage; /** The first image field for Choice. */ extern SDLImageFieldName const SDLImageFieldNameChoiceImage; /** The scondary image field for Choice. */ extern SDLImageFieldName const SDLImageFieldNameChoiceSecondaryImage; /** The image field for vrHelpItem. */ extern SDLImageFieldName const SDLImageFieldNameVoiceRecognitionHelpItem; /** The image field for Turn. */ extern SDLImageFieldName const SDLImageFieldNameTurnIcon; /** The image field for the menu icon in SetGlobalProperties. */ extern SDLImageFieldName const SDLImageFieldNameMenuIcon; /** The image field for AddCommand. * */ extern SDLImageFieldName const SDLImageFieldNameCommandIcon; /** The image field for the app icon (set by setAppIcon). */ extern SDLImageFieldName const SDLImageFieldNameAppIcon; /** The primary image field for Show. * */ extern SDLImageFieldName const SDLImageFieldNameGraphic; /** The secondary image field for Show. * */ extern SDLImageFieldName const SDLImageFieldNameSecondaryGraphic; /** The primary image field for ShowConstant TBT. * */ extern SDLImageFieldName const SDLImageFieldNameShowConstantTBTIcon; /** The secondary image field for ShowConstant TBT. */ extern SDLImageFieldName const SDLImageFieldNameShowConstantTBTNextTurnIcon; /** The optional image of a destination / location @since SDL 4.0 */ extern SDLImageFieldName const SDLImageFieldNameLocationImage;
/* $OpenBSD: strcat.c,v 1.4 1998/06/27 01:21:04 mickey Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/ static char *rcsid = "$OpenBSD: strcat.c,v 1.4 1998/06/27 01:21:04 mickey Exp $"; #endif /* LIBC_SCCS and not lint */ #if !defined(_KERNEL) && !defined(_STANDALONE) #include <string.h> #else #include <lib/libkern/libkern.h> #endif char * strcat(s, append) register char *s; register const char *append; { char *save = s; for (; *s; ++s); while ((*s++ = *append++) != '\0'); return(save); }
/***************************************************************************** Copyright (c) 2011, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function zpptrf * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_zpptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap ) { if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zpptrf", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zpp_nancheck( n, ap ) ) { return -4; } #endif return LAPACKE_zpptrf_work( matrix_order, uplo, n, ap ); }
#pragma once #ifndef STARTUPPOPUP_H #define STARTUPPOPUP_H #include "toonzqt/dvdialog.h" #include "toonzqt/doublefield.h" #include "toonzqt/intfield.h" #include "toonzqt/filefield.h" #include "toonzqt/camerasettingswidget.h" #include <QPushButton> #include <QLabel> #include <QCheckBox> #include <QGroupBox> // forward declaration class QLabel; class QComboBox; class StartupLabel; //============================================================================= // LevelCreatePopup //----------------------------------------------------------------------------- class StartupPopup final : public DVGui::Dialog { Q_OBJECT DVGui::LineEdit *m_nameFld; DVGui::FileField *m_pathFld; QLabel *m_widthLabel; QLabel *m_heightLabel; QLabel *m_fpsLabel; QLabel *m_resXLabel; QLabel *m_resTextLabel; QLabel *m_dpiLabel; QLabel *m_sceneNameLabel; DVGui::DoubleLineEdit *m_dpiFld; DVGui::MeasuredDoubleLineEdit *m_widthFld; DVGui::MeasuredDoubleLineEdit *m_heightFld; DVGui::DoubleLineEdit *m_fpsFld; DVGui::DoubleLineEdit *m_resXFld; DVGui::DoubleLineEdit *m_resYFld; QList<QString> m_sceneNames; QList<TFilePath> m_projectPaths; QCheckBox *m_showAtStartCB; QComboBox *m_projectsCB; QComboBox *m_unitsCB; QPushButton *m_loadOtherSceneButton; QPushButton *m_newProjectButton; QComboBox *m_presetCombo; QPushButton *m_addPresetBtn, *m_removePresetBtn; CameraSettingsWidget *m_cameraSettingsWidget; double m_dpi; int m_xRes, m_yRes; const int RECENT_SCENES_MAX_COUNT = 10; bool m_updating = false; QString m_presetListFile; QGroupBox *m_projectBox; QGroupBox *m_sceneBox; QGroupBox *m_recentBox; QVBoxLayout *m_recentSceneLay; QVector<StartupLabel *> m_recentNamesLabels; public: StartupPopup(); protected: void showEvent(QShowEvent *) override; void loadPresetList(); void savePresetList(); void refreshRecentScenes(); QString aspectRatioValueToString(double value, int width = 0, int height = 0); double aspectRatioStringToValue(const QString &s); bool parsePresetString(const QString &str, QString &name, int &xres, int &yres, double &fx, double &fy, QString &xoffset, QString &yoffset, double &ar, bool forCleanup = false); public slots: void onRecentSceneClicked(int index); void onCreateButton(); void onShowAtStartChanged(int index); void updateProjectCB(); void onProjectChanged(int index); void onNewProjectButtonPressed(); void onLoadSceneButtonPressed(); void onSceneChanged(); void updateResolution(); void updateSize(); void onDpiChanged(); void addPreset(); void removePreset(); void onPresetSelected(const QString &str); void onCameraUnitChanged(int index); }; class StartupLabel : public QLabel { Q_OBJECT public: explicit StartupLabel(const QString &text = "", QWidget *parent = 0, int index = -1); ~StartupLabel(); QString m_text; int m_index; signals: void wasClicked(int index); protected: void mousePressEvent(QMouseEvent *event); }; #endif // STARTUPPOPUP_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82.h Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-82.tmpl.h */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * BadSink : execute command with wexecvp * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif namespace CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82 { class CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82_base { public: /* pure virtual function */ virtual void action(wchar_t * data) = 0; }; #ifndef OMITBAD class CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82_bad : public CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82_base { public: void action(wchar_t * data); }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82_goodG2B : public CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execvp_82_base { public: void action(wchar_t * data); }; #endif /* OMITGOOD */ }
// Copyright 2020 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_RENDERER_SUBRESOURCE_REDIRECT_LOGIN_ROBOTS_DECIDER_AGENT_H_ #define CHROME_RENDERER_SUBRESOURCE_REDIRECT_LOGIN_ROBOTS_DECIDER_AGENT_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "chrome/renderer/subresource_redirect/public_resource_decider_agent.h" #include "chrome/renderer/subresource_redirect/robots_rules_parser.h" #include "url/gurl.h" #include "url/origin.h" namespace subresource_redirect { // The decider agent implementation that allows subresource redirect compression // based on robots rules on non-logged-in pages. Currently only handles // mainframes. // TODO(crbug.com/1149853): Add the logged-in checks. class LoginRobotsDeciderAgent : public PublicResourceDeciderAgent { public: LoginRobotsDeciderAgent( blink::AssociatedInterfaceRegistry* associated_interfaces, content::RenderFrame* render_frame); ~LoginRobotsDeciderAgent() override; LoginRobotsDeciderAgent(const LoginRobotsDeciderAgent&) = delete; LoginRobotsDeciderAgent& operator=(const LoginRobotsDeciderAgent&) = delete; private: friend class SubresourceRedirectLoginRobotsDeciderAgentTest; friend class SubresourceRedirectLoginRobotsURLLoaderThrottleTest; // content::RenderFrameObserver: void ReadyToCommitNavigation( blink::WebDocumentLoader* document_loader) override; void PreloadSubresourceOptimizationsForOrigins( const std::vector<blink::WebSecurityOrigin>& origins) override; // mojom::SubresourceRedirectHintsReceiver: void SetCompressPublicImagesHints( mojom::CompressPublicImagesHintsPtr images_hints) override; void SetLoggedInState(bool is_logged_in) override; // PublicResourceDeciderAgent: absl::optional<SubresourceRedirectResult> ShouldRedirectSubresource( const GURL& url, ShouldRedirectDecisionCallback callback) override; void RecordMetricsOnLoadFinished( const GURL& url, int64_t content_length, SubresourceRedirectResult redirect_result) override; void NotifyIneligibleBlinkDisallowedSubresource() override; // Callback invoked when should redirect check result is available. void OnShouldRedirectSubresourceResult( ShouldRedirectDecisionCallback callback, RobotsRulesParser::CheckResult check_result); bool IsMainFrame() const; // Creates and starts the fetch of robots rules for |origin| if the rules are // not available. |rules_receive_timeout| is the timeout value for receiving // the fetched rules. void CreateAndFetchRobotsRules(const url::Origin& origin, const base::TimeDelta& rules_receive_timeout); // Current state of the redirect compression that should be used for the // current navigation. SubresourceRedirectResult redirect_result_ = SubresourceRedirectResult::kUnknown; // Tracks the count of subresource redirect allowed checks that happened for // the current navigation. This is used in having a different robots rules // fetch timeout for the first k subresources. size_t num_should_redirect_checks_ = 0; // Saves whether the upcoming navigation is logged-in. This is updated via the // SetLoggedInState() mojo which is sent just before the navigation is // committed in the browser process, and used in ReadyToCommitNavigation() // when the navigation is committed in the renderer process. Value of // absl::nullopt means logged-in state hasn't arrived from the browser. This // value should be reset after each navigation commit, so that it won't get // accidentally reused for subsequent navigations. absl::optional<bool> is_pending_navigation_loggged_in_; THREAD_CHECKER(thread_checker_); // Used to get a weak pointer to |this|. base::WeakPtrFactory<LoginRobotsDeciderAgent> weak_ptr_factory_{this}; }; } // namespace subresource_redirect #endif // CHROME_RENDERER_SUBRESOURCE_REDIRECT_LOGIN_ROBOTS_DECIDER_AGENT_H_
#ifndef AUDIO_H #define AUDIO_H #include <SDL/SDL.h> #include <SDL/SDL_mixer.h> int initAudio(); Mix_Music* loadAudioFile(const char*); int playAudio(Mix_Music*,int); bool isAudioPlaying(); void unloadAudioFile(Mix_Music*); void stopAllAudio(); void closeAudio(); void setAudioPlaying(bool); void pauseAudio(); void resumeAudio(); #endif
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ #include <string> #include "chrome/browser/extensions/extension_function.h" namespace extensions { class SystemDisplayGetInfoFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION("system.display.getInfo", SYSTEM_DISPLAY_GETINFO); protected: virtual ~SystemDisplayGetInfoFunction() {} virtual bool RunImpl() OVERRIDE; }; class SystemDisplaySetDisplayPropertiesFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION("system.display.setDisplayProperties", SYSTEM_DISPLAY_SETDISPLAYPROPERTIES); protected: virtual ~SystemDisplaySetDisplayPropertiesFunction() {} virtual bool RunImpl() OVERRIDE; }; } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_
// // MOPLoadCommand.h // MachOParse // // Created by Sam Marshall on 9/26/13. // Copyright (c) 2013 Sam Marshall. All rights reserved. // #import <Foundation/Foundation.h> @interface MOPLoadCommand : NSObject @property (nonatomic, readwrite) uint32_t cmdType; @property (nonatomic, readwrite) uint32_t cmdSize; @property (nonatomic, strong) NSData *cmdData; + (uint32_t)commandSize:(NSData *)data; - (instancetype)initWithCommand:(NSData *)data; - (id)generateCommandClass; @end
#include "io.h" unsigned char inportb(unsigned short port) { unsigned char value; asm volatile ("inb %1, %0" : "=a" (value) : "dN" (port)); return value; } unsigned short inports(unsigned short port) { unsigned short value; asm volatile ("inw %1, %0" : "=a" (value) : "dN" (port)); return value; } unsigned int inportl(unsigned short port) { unsigned int value; asm volatile ("inl %%dx, %%eax" : "=a" (value) : "dN" (port)); return value; } void outportb(unsigned short port, unsigned char data) { __asm__ __volatile__ ("outb %1, %0" : : "dN" (port), "a" (data)); } void outports(unsigned short port, unsigned short data) { asm volatile ("outw %1, %0" : : "dN" (port), "a" (data)); } void outportl(unsigned short port, unsigned int data) { asm volatile ("outl %%eax, %%dx" : : "dN" (port), "a" (data)); }
#ifdef COMMENT Proprietary Rand Corporation, 1981. Further distribution of this software subject to the terms of the Rand license agreement. #endif #include "libg.h" char *getlogn(uid) { static char name[20]; register char *np, *bp; if (getubuf(uid)<=0) return(NULSTR); np = name; bp = u_buf; while( (*np++ = *bp++) != ':'); *--np = '\0'; return(name); }
/* * Copyright (c) 2008,2009, Yale Laboratory of Networked Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Yale University nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef P4P_LOGGING_H #define P4P_LOGGING_H #include <p4p/detail/compiler.h> namespace p4p { /** * Enumerated type indicating the available log levels. */ enum LogLevel { LOG_TRACE, /**< Lots of internal information (e.g., internal steps of peer selection) */ LOG_DEBUG, /**< Some debug information (e.g, peer events, peer selection results, fetched P4P data) */ LOG_INFO, /**< Informational program-level events (e.g., update manager status) */ LOG_WARN, /**< Warnings only */ LOG_ERROR, /**< Errors only */ LOG_NONE, /**< No logs (this is the default) */ }; /** * Set the logging level * * @param value New logging level */ p4p_common_cpp_EXPORT void setLogLevel(LogLevel value); /** * Retrieve the current logging level * * @returns Current logging level */ p4p_common_cpp_EXPORT LogLevel getLogLevel(); /** * Indicate if desired logging level is enabled * * @returns True if logging is enabled at the specified level */ p4p_common_cpp_EXPORT bool isLogEnabled(LogLevel value); /** * Log a message at the trace level * * @param msg Message to log * @param ... Additional parameters */ p4p_common_cpp_EXPORT void logTrace(const char* msg, ...); /** * Log a message at the debug level * * @param msg Message to log * @param ... Additional parameters */ p4p_common_cpp_EXPORT void logDebug(const char* msg, ...); /** * Log a message at the info level * * @param msg Message to log * @param ... Additional parameters */ p4p_common_cpp_EXPORT void logInfo(const char* msg, ...); /** * Log a message at the warning level * * @param msg Message to log * @param ... Additional parameters */ p4p_common_cpp_EXPORT void logWarn(const char* msg, ...); /** * Log a message at the error level * * @param msg Message to log * @param ... Additional parameters */ p4p_common_cpp_EXPORT void logError(const char* msg, ...); /** * Typedef for callback function used to output log messages. The callback * function simply takes the LogLevel at which the message is logged, * and the message itself. */ typedef void (*LogOutputCallback)(LogLevel level, const char* msg); /** * Use a custom callback function used to log messages. Without calling * this function, log messages are written to Standard Error. * * @param callback The callback function to be used for logging messages */ p4p_common_cpp_EXPORT void setLogOutputCallback(LogOutputCallback callback); /** * The default callback function used to log messages. This implementation * simply logs messages to standard error. Each message is prefixed with * an indication of the level at which the message was logged. * * @param level Level at which the message was logged * @param msg Log message itself (null-terminated string) */ p4p_common_cpp_EXPORT void logOutputCallbackStdErr(LogLevel level, const char* msg); }; #define P4P_LOG_TRACE(streamArg) \ if (isLogEnabled(LOG_TRACE)) \ { \ std::ostringstream str; \ str << streamArg; \ p4p::logTrace(str.str().c_str()); \ } #define P4P_LOG_DEBUG(streamArg) \ if (isLogEnabled(LOG_DEBUG)) \ { \ std::ostringstream str; \ str << streamArg; \ p4p::logDebug(str.str().c_str()); \ } #define P4P_LOG_INFO(streamArg) \ if (isLogEnabled(LOG_INFO)) \ { \ std::ostringstream str; \ str << streamArg; \ p4p::logInfo(str.str().c_str()); \ } #define P4P_LOG_ERROR(streamArg) \ if (isLogEnabled(LOG_ERROR)) \ { \ std::ostringstream str; \ str << streamArg; \ p4p::logError(str.str().c_str()); \ } #endif
/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * Copyright (c) 1994 John S. Dyson * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 * $FreeBSD$ */ #ifndef _MACHINE_VMPARAM_H_ #define _MACHINE_VMPARAM_H_ 1 /* * Machine dependent constants for 386. */ /* * Virtual memory related constants, all in bytes */ #define MAXTSIZ (128UL*1024*1024) /* max text size */ #ifndef DFLDSIZ #define DFLDSIZ (128UL*1024*1024) /* initial data size limit */ #endif #ifndef MAXDSIZ #define MAXDSIZ (512UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ #define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ #endif #ifndef MAXSSIZ #define MAXSSIZ (64UL*1024*1024) /* max stack size */ #endif #ifndef SGROWSIZ #define SGROWSIZ (128UL*1024) /* amount to grow stack */ #endif /* * The physical address space is densely populated. */ #define VM_PHYSSEG_DENSE /* * The number of PHYSSEG entries must be one greater than the number * of phys_avail entries because the phys_avail entry that spans the * largest physical address that is accessible by ISA DMA is split * into two PHYSSEG entries. */ #define VM_PHYSSEG_MAX 17 /* * Create two free page pools. Since the i386 kernel virtual address * space does not include a mapping onto the machine's entire physical * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default * pool, VM_FREEPOOL_DEFAULT. */ #define VM_NFREEPOOL 2 #define VM_FREEPOOL_CACHE 1 #define VM_FREEPOOL_DEFAULT 0 #define VM_FREEPOOL_DIRECT 0 /* * Create two free page lists: VM_FREELIST_DEFAULT is for physical * pages that are above the largest physical address that is * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages * that are below that address. */ #define VM_NFREELIST 2 #define VM_FREELIST_DEFAULT 0 #define VM_FREELIST_ISADMA 1 /* * The largest allocation size is 2MB under PAE and 4MB otherwise. */ #ifdef PAE #define VM_NFREEORDER 10 #else #define VM_NFREEORDER 11 #endif /* * Enable superpage reservations: 1 level. */ #ifndef VM_NRESERVLEVEL #define VM_NRESERVLEVEL 1 #endif /* * Level 0 reservations consist of 512 pages under PAE and 1024 pages * otherwise. */ #ifndef VM_LEVEL_0_ORDER #ifdef PAE #define VM_LEVEL_0_ORDER 9 #else #define VM_LEVEL_0_ORDER 10 #endif #endif /* * Kernel physical load address. */ #ifndef KERNLOAD #if defined(XEN) && !defined(XEN_PRIVILEGED_GUEST) #define KERNLOAD 0 #else #define KERNLOAD (1 << PDRSHIFT) #endif #endif /* !defined(KERNLOAD) */ /* * Virtual addresses of things. Derived from the page directory and * page table indexes from pmap.h for precision. * Because of the page that is both a PD and PT, it looks a little * messy at times, but hey, we'll do anything to save a page :-) */ #ifdef XEN #define VM_MAX_KERNEL_ADDRESS HYPERVISOR_VIRT_START #else #define VM_MAX_KERNEL_ADDRESS VADDR(KPTDI+NKPDE-1, NPTEPG-1) #endif #define VM_MIN_KERNEL_ADDRESS VADDR(PTDPTDI, PTDPTDI) #define KERNBASE VADDR(KPTDI, 0) #define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) #define UPT_MIN_ADDRESS VADDR(PTDPTDI, 0) #define VM_MAXUSER_ADDRESS VADDR(PTDPTDI, 0) #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) #define USRSTACK SHAREDPAGE #define VM_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) #define VM_MIN_ADDRESS ((vm_offset_t)0) /* virtual sizes (bytes) for various kernel submaps */ #ifndef VM_KMEM_SIZE #define VM_KMEM_SIZE (12 * 1024 * 1024) #endif /* * How many physical pages per KVA page allocated. * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX) * is the total KVA space allocated for kmem_map. */ #ifndef VM_KMEM_SIZE_SCALE #define VM_KMEM_SIZE_SCALE (3) #endif /* * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX #define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) #endif /* initial pagein size of beginning of executable file */ #ifndef VM_INITIAL_PAGEIN #define VM_INITIAL_PAGEIN 16 #endif #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ #ifndef VM_MAX_AUTOTUNE_MAXUSERS #define VM_MAX_AUTOTUNE_MAXUSERS 384 #endif #endif /* _MACHINE_VMPARAM_H_ */
/* * This software is Copyright (c) 2012 Lukas Odzioba <lukas dot odzioba at gmail dot com> * and Copyright (c) 2013-2014 magnum * and it is hereby released to the general public under the following terms: * Redistribution and use in source and binary forms, with or without modification, are permitted. */ #ifdef HAVE_CUDA #if FMT_EXTERNS_H extern struct fmt_main fmt_cuda_wpapsk; #elif FMT_REGISTERS_H john_register_one(&fmt_cuda_wpapsk); #else #include <string.h> #include <assert.h> #include "arch.h" #include "formats.h" #include "common.h" #include "misc.h" #include "cuda_wpapsk.h" #include "cuda_common.h" #include "memdbg.h" #define FORMAT_LABEL "wpapsk-cuda" #define FORMAT_NAME "WPA/WPA2 PSK" #define ALGORITHM_NAME "PBKDF2-SHA1 CUDA" #define BENCHMARK_COMMENT "" #define BENCHMARK_LENGTH -1 ///#define WPAPSK_DEBUG extern wpapsk_password *inbuffer; extern wpapsk_hash *outbuffer; extern wpapsk_salt currentsalt; extern hccap_t hccap; extern mic_t *mic; extern void wpapsk_gpu(wpapsk_password *, wpapsk_hash *, wpapsk_salt *, int); extern void *salt(char *ciphertext); static void done() { MEM_FREE(inbuffer); MEM_FREE(outbuffer); MEM_FREE(mic); } static void init(struct fmt_main *self) { ///Allocate memory for hashes and passwords inbuffer = (wpapsk_password *) mem_calloc(MAX_KEYS_PER_CRYPT * sizeof(wpapsk_password)); outbuffer = (wpapsk_hash *) mem_alloc(MAX_KEYS_PER_CRYPT * sizeof(wpapsk_hash)); check_mem_allocation(inbuffer, outbuffer); mic = (mic_t *) mem_alloc(MAX_KEYS_PER_CRYPT * sizeof(mic_t)); ///Initialize CUDA cuda_init(); } static int crypt_all(int *pcount, struct db_salt *salt) { int count = *pcount; if (new_keys || strcmp(last_ssid, hccap.essid)) { wpapsk_gpu(inbuffer, outbuffer, &currentsalt, count); new_keys = 0; strcpy(last_ssid, hccap.essid); } wpapsk_postprocess(count); return count; } struct fmt_main fmt_cuda_wpapsk = { { FORMAT_LABEL, FORMAT_NAME, ALGORITHM_NAME, BENCHMARK_COMMENT, BENCHMARK_LENGTH, PLAINTEXT_LENGTH, BINARY_SIZE, BINARY_ALIGN, SALT_SIZE, SALT_ALIGN, MIN_KEYS_PER_CRYPT, MAX_KEYS_PER_CRYPT, FMT_CASE | FMT_OMP, #if FMT_MAIN_VERSION > 11 { NULL }, #endif tests }, { init, done, fmt_default_reset, fmt_default_prepare, valid, fmt_default_split, binary, salt, #if FMT_MAIN_VERSION > 11 { NULL }, #endif fmt_default_source, { binary_hash_0, fmt_default_binary_hash_1, fmt_default_binary_hash_2, fmt_default_binary_hash_3, fmt_default_binary_hash_4, fmt_default_binary_hash_5, fmt_default_binary_hash_6 }, fmt_default_salt_hash, set_salt, set_key, get_key, clear_keys, crypt_all, { get_hash_0, get_hash_1, get_hash_2, get_hash_3, get_hash_4, get_hash_5, get_hash_6 }, cmp_all, cmp_one, cmp_exact } }; #endif /* plugin stanza */ #endif /* HAVE_CUDA */
#ifndef __RESOURCEEDITORQT__LANDSCAPEEDITORCONTROLSPLACEHOLDER__ #define __RESOURCEEDITORQT__LANDSCAPEEDITORCONTROLSPLACEHOLDER__ #include <QWidget> #include "DAVAEngine.h" #include "LandscapeEditorPanels/LandscapeEditorBasePanel.h" class CustomColorsPanel; class RulerToolPanel; class TilemaskEditorPanel; class HeightmapEditorPanel; class LandscapeEditorControlsPlaceholder : public QWidget { Q_OBJECT public: explicit LandscapeEditorControlsPlaceholder(QWidget* parent = 0); ~LandscapeEditorControlsPlaceholder(); void SetPanel(LandscapeEditorBasePanel* panel); void RemovePanel(); public slots: void SceneActivated(DAVA::SceneEditor2* scene); void SceneDeactivated(DAVA::SceneEditor2* scene); void OnOpenGLInitialized(); private slots: void EditorToggled(DAVA::SceneEditor2* scene); private: DAVA::SceneEditor2* activeScene; LandscapeEditorBasePanel* currentPanel; CustomColorsPanel* customColorsPanel; RulerToolPanel* rulerToolPanel; TilemaskEditorPanel* tilemaskEditorPanel; HeightmapEditorPanel* heightmapEditorPanel; void InitUI(); void ConnectToSignals(); void CreatePanels(); void UpdatePanels(); }; #endif /* defined(__RESOURCEEDITORQT__LANDSCAPEEDITORCONTROLSPLACEHOLDER__) */
/* * Copyright (c) 2009 Will Drewry <redpig@dataspill.org>. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file or at http://github.org/redpig/patient0. * vim:tw=80:ts=2:et:sw=2 */ #include <assert.h> #include <dlfcn.h> #include <fcntl.h> #include <libkern/OSByteOrder.h> #include <mach/mach_init.h> #include <mach/vm_prot.h> #include <mach/vm_map.h> #include <mach-o/dyld.h> #include <mach-o/getsect.h> #include <mach-o/nlist.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <patient0/log.h> #include <patient0/mach_jump.h> #include <patient0/mach_jump/jump_table.h> #include <patient0/mach_jump/image_info.h> #include <patient0/mach_jump/lazy_symbol.h> #include <patient0/mach_jump/clobber.h> static bool mach_jump_initialized = false; bool mach_jump_init() { if (mach_jump_initialized) return true; mach_jump_initialized = jump_table_init() && linkedit_init() && lazy_symbol_init(); return mach_jump_initialized; } bool mach_jump_patch(const char *symbol, void *replacement_fn) { intptr_t entry = lazy_symbol_stub(symbol); if (!entry && (entry = jump_table_find_by_symbol_address(NULL, symbol)) < 0) { return false; } p0_logf(P0_INFO, "patching %s @ %p with %p\n", symbol, entry, replacement_fn); return jump_table_patch(entry, replacement_fn); } bool mach_jump_unpatch(const char *symbol) { intptr_t entry = lazy_symbol_stub(symbol); void *real_func = dlsym(RTLD_DEFAULT, symbol); if (!entry && (entry = jump_table_find_by_symbol_address(NULL, symbol)) < 0) { p0_logf(P0_ERR, "symbol not found in jump table"); return false; } if (!real_func) { p0_logf(P0_ERR, "symbol not found by dlsym()"); return false; } return jump_table_patch(entry, real_func); } bool mach_jump_framework_unpatch(const char *framework, const char *symbol, void *replacement) { intptr_t entry = 0; void *real_func = dlsym(RTLD_DEFAULT, symbol); jump_table_t table = { 0 }; if (!jump_table_get_table(framework, &table)) { p0_logf(P0_ERR, "failed to acquire jump table for '%s'", framework); return false; } if (table.addr == 0) { p0_logf(P0_ERR, "framework '%s' mapped at PAGE_ZERO. Unlikely.", framework); return false; } entry = jump_table_find(&table, (intptr_t)replacement); if (entry == -1) { p0_logf(P0_ERR, "failed to find address '%p' in table", replacement); return false; } return jump_table_patch(entry, real_func); } bool mach_jump_framework_patch(const char *framework, const char *symbol, void *replacement) { jump_table_t table = { 0 }; void *addr = dlsym(RTLD_DEFAULT, symbol); intptr_t entry = 0; if (!jump_table_get_table(framework, &table)) { p0_logf(P0_ERR, "failed to acquire jump table for '%s'", framework); return false; } if (table.addr == 0) { p0_logf(P0_ERR, "framework '%s' mapped at PAGE_ZERO. Unlikely.", framework); return false; } entry = jump_table_find(&table, (intptr_t)addr); if (entry == -1) { p0_logf(P0_ERR, "failed to find address '%p' in table", addr); return false; } if (!jump_table_patch(entry, replacement)) { p0_logf(P0_INFO, "failed to patch '%p' for '%s' in '%s'", entry, symbol, framework); return false; } return true; } /* Attempts to patch the jump table of all accessible dyld_images */ bool mach_jump_patch_loads(const char *symbol, void *replacement) { void *addr = dlsym(RTLD_DEFAULT, symbol); intptr_t entry = 0; const uint32_t images = _dyld_image_count(); uint32_t image; for (image = 0; image < images; ++image) { jump_table_t table = { 0 }; if (!jump_table_get_indexed_table(image, &table)) { p0_logf(P0_ERR, "failed to acquire jump table for '%d'", image); continue; } p0_logf(P0_INFO, "acquired table for '%d'", image); if (table.addr == 0) { p0_logf(P0_WARN, "image '%d' mapped at PAGE_ZERO. Unlikely.", image); continue; } entry = jump_table_find(&table, (intptr_t)addr); if (entry == -1) { p0_logf(P0_WARN, "failed to find address '%p' in table", addr); continue; } p0_logf(P0_INFO, "found entry in '%d'", image); if (!jump_table_patch(entry, replacement)) { p0_logf(P0_WARN, "failed to patch '%p' for '%s' in '%d'", entry, symbol, image); continue; } p0_logf(P0_INFO, "patched '%s' in '%d'", symbol, image); } return true; } /* Patches all images noted by dyld */ bool mach_jump_patch_images(const char *symbol, void *replacement) { void *addr = dlsym(RTLD_DEFAULT, symbol); intptr_t entry = 0; const uint32_t images = image_info_count(); uint32_t image; for (image = 0; image < images; ++image) { jump_table_t table = { 0 }; if (!image_info_jump_table(image, &table)) { p0_logf(P0_ERR, "failed to acquire jump table for '%d'", image); continue; } p0_logf(P0_INFO, "acquired table for '%d'", image); if (table.addr == 0) { p0_logf(P0_WARN, "image '%d' mapped at PAGE_ZERO. Unlikely.", image); continue; } entry = jump_table_find(&table, (intptr_t)addr); if (entry == -1) { p0_logf(P0_WARN, "failed to find address '%p' in table", addr); continue; } p0_logf(P0_INFO, "found entry in '%d'", image); if (!jump_table_patch(entry, replacement)) { p0_logf(P0_WARN, "failed to patch '%p' for '%s' in '%d'", entry, symbol, image); continue; } p0_logf(P0_INFO, "patched '%s' in '%d'", symbol, image); } return true; }
/* * PlyWriter.h * * Copyright (C) 2017 by MegaMol Team * Alle Rechte vorbehalten. */ #ifndef MEGAMOL_DATATOOLS_IO_PLYWRITER_H_INCLUDED #define MEGAMOL_DATATOOLS_IO_PLYWRITER_H_INCLUDED #pragma once #include "geometry_calls_gl/CallTriMeshDataGL.h" #include "mmcore/AbstractDataWriter.h" #include "mmcore/CallerSlot.h" #include "mmcore/param/ParamSlot.h" #include "vislib/sys/FastFile.h" namespace megamol { namespace datatools_gl { namespace io { class PlyWriter : public core::AbstractDataWriter { public: /** * Answer the name of this module. * * @return The name of this module. */ static const char* ClassName(void) { return "PlyWriter"; } /** * Answer a human readable description of this module. * * @return A human readable description of this module. */ static const char* Description(void) { return "Polygon file format (.ply) file writer"; } /** * Answers whether this module is available on the current system. * * @return 'true' if the module is available, 'false' otherwise. */ static bool IsAvailable(void) { return true; } /** * Disallow usage in quickstarts * * @return false */ static bool SupportQuickstart(void) { return false; } /** Ctor. */ PlyWriter(void); /** Dtor. */ virtual ~PlyWriter(void); protected: /** * Implementation of 'Create'. * * @return 'true' on success, 'false' otherwise. */ virtual bool create(void); /** * Implementation of 'Release'. */ virtual void release(void); /** * The main function * * @return True on success */ virtual bool run(void); /** * Function querying the writers capabilities * * @param call The call to receive the capabilities * * @return True on success */ virtual bool getCapabilities(core::DataWriterCtrlCall& call); private: /** The file name of the file to be written */ core::param::ParamSlot filenameSlot; /** The frame ID of the frame to be written */ core::param::ParamSlot frameIDSlot; /** The slot asking for data. */ core::CallerSlot meshDataSlot; }; } /* end namespace io */ } // namespace datatools_gl } /* end namespace megamol */ #endif // !MEGAMOL_DATATOOLS_IO_PLYWRITER_H_INCLUDED
// Copyright (c) 2009-2021 The Regents of the University of Michigan // This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. // Maintainer: unassigned #ifndef __BOND_EVALUATOR_COULOMB_H__ #define __BOND_EVALUATOR_COULOMB_H__ #ifndef __HIPCC__ #include <string> #endif #include "hoomd/HOOMDMath.h" /*! \file EvaluatorSpecialPairCoulomb.h \brief Defines the bond evaluator class for Coulomb interactions This is designed to be used e.g. for the scaled 1-4 interaction in all-atom force fields such as GROMOS or OPLS. It implements Coulombs law, as both LJ and Coulomb interactions are scaled by the same amount in the OPLS force field for 1-4 interactions. Thus it is intended to be used along with special_pair.LJ. */ // need to declare these class methods with __device__ qualifiers when building in nvcc // DEVICE is __host__ __device__ when included in nvcc and blank when included into the host // compiler #ifdef __HIPCC__ #define DEVICE __device__ #else #define DEVICE #endif struct special_coulomb_params { Scalar alpha; Scalar r_cutsq; #ifdef ENABLE_HIP //! Set CUDA memory hints void set_memory_hint() const { // default implementation does nothing } #endif #ifndef __HIPCC__ special_coulomb_params() : alpha(0.), r_cutsq(0.) { } special_coulomb_params(pybind11::dict v) { alpha = v["alpha"].cast<Scalar>(); r_cutsq = 0.; } pybind11::dict asDict() { pybind11::dict v; v["alpha"] = alpha; return v; } #endif } #ifdef SINGLE_PRECISION __attribute__((aligned(8))); #else __attribute__((aligned(16))); #endif //! Class for evaluating the Coulomb bond potential /*! See the EvaluatorPairLJ class for the meaning of the parameters */ class EvaluatorSpecialPairCoulomb { public: //! Define the parameter type used by this pair potential evaluator typedef special_coulomb_params param_type; //! Constructs the pair potential evaluator /*! \param _rsq Squared distance between the particles \param _params Per type pair parameters of this potential */ DEVICE EvaluatorSpecialPairCoulomb(Scalar _rsq, const param_type& _params) : rsq(_rsq), scale(_params.alpha), rcutsq(_params.r_cutsq) { } //! Coulomb doesn't use diameter DEVICE static bool needsDiameter() { return false; } //! Accept the optional diameter values /*! \param di Diameter of particle i \param dj Diameter of particle j */ DEVICE void setDiameter(Scalar di, Scalar dj) { } //! Coulomb use charge DEVICE static bool needsCharge() { return true; } //! Accept the optional charge values /*! \param qi Charge of particle i \param qj Charge of particle j */ DEVICE void setCharge(Scalar qi, Scalar qj) { qiqj = qi * qj; } //! Evaluate the force and energy /*! \param force_divr Output parameter to write the computed force divided by r. \param bond_eng Output parameter to write the computed bond energy \return True if they are evaluated or false if the bond energy is not defined. Based on EvaluatorSpecialPairLJ which returns true regardless whether it is evaluated or not. */ DEVICE bool evalForceAndEnergy(Scalar& force_divr, Scalar& bond_eng) { // compute the force divided by r in force_divr if (rsq < rcutsq && qiqj != 0) { Scalar r1inv = Scalar(1.0) / fast::sqrt(rsq); Scalar r2inv = Scalar(1.0) / rsq; Scalar r3inv = r2inv * r1inv; Scalar scaledQ = qiqj * scale; force_divr = scaledQ * r3inv; bond_eng = scaledQ * r1inv; } return true; } #ifndef __HIPCC__ //! Get the name of this potential /*! \returns The potential name. */ static std::string getName() { return std::string("coul"); } #endif protected: Scalar rsq; //!< Stored rsq from the constructor Scalar qiqj; //!< product of charges from setCharge(qa, qb) Scalar scale; //!< scaling factor to apply to Coulomb interaction Scalar rcutsq; //!< Stored rcutsq from the constructor }; #endif // __BOND_EVALUATOR_COULOMB_H__
/* * ==================================================== * Copyright (C) 1998 by Cygnus Solutions. All rights reserved. * * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* Fast version of pow using Intel float instructions. float _f_powf (float x, float y); Function calculates x to power of y. The function optimizes the case where x is >0.0 and y is finite. In such a case, there is no error checking or setting of errno. All other cases defer to normal powf() function which will set errno as normal. */ #include <math.h> #include <ieeefp.h> #include "f_math.h" float _f_powf (float x, float y) { /* following sequence handles the majority of cases for pow() */ if (x > 0.0 && check_finitef(y)) { float result; /* calculate x ** y as 2 ** (y log2(x)). On Intel, can only raise 2 to an integer or a small fraction, thus, we have to perform two steps 2**integer portion * 2**fraction. */ asm ("flds 8(%%ebp); fyl2x; fld %%st; frndint; fsub %%st,%%st(1);" \ "fxch; fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1);"\ "fmulp" : "=t" (result) : "0" (y)); return result; } else /* all other strange cases, defer to normal pow() */ return powf (x,y); }
/*****************************************************************************/ /** * @file GFData.h * @author Naohisa Sakamoto */ /*****************************************************************************/ #ifndef KVS__GF_DATA_H_INCLUDE #define KVS__GF_DATA_H_INCLUDE #include <iostream> #include <kvs/FileFormatBase> #include <kvs/Indent> #include "FlowData.h" #include "MeshData.h" #include "BoundaryData.h" namespace kvs { /*===========================================================================*/ /** * @brief GF file format class. */ /*===========================================================================*/ class GFData : public kvs::FileFormatBase { public: typedef kvs::FileFormatBase BaseClass; private: kvs::gf::MeshData m_mesh_data; ///< GF mesh data kvs::gf::FlowData m_flow_data; ///< GF flow data kvs::gf::BoundaryData m_boundary_data; ///< GF doundary condition data public: static bool CheckExtension( const std::string& filename ); public: GFData(); GFData( const std::string& filename ); GFData( const std::string& mesh_file, const std::string& flow_file, const std::string& boundary_file = "" ); const kvs::gf::FlowData& flowData() const; const kvs::gf::MeshData& meshData() const; const kvs::gf::BoundaryData& boundaryData() const; void print( std::ostream& os, const kvs::Indent& indent = kvs::Indent(0) ) const; bool read( const std::string& filename ); bool read( const std::string& mesh_file, const std::string& flow_file, const std::string& boundary_file = "" ); private: bool write( const std::string& filename ); }; } // end of namespace kvs #endif // KVS__GF_DATA_H_INCLUDE
/* * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, * Berkeley, CA, 94704. Attention: Intel License Inquiry. * Or * UC Berkeley EECS Computer Science Division, 387 Soda Hall #1776, * Berkeley, CA, 94707. Attention: P2 Group. * * DESCRIPTION: * */ #ifndef __PLANNER_CONTEXT_H__ #define __PLANNER_CONTEXT_H__ #include <iostream> #include <ostream> #include <map> #include "compileContext.h" #include "value.h" #include "commonTable.h" #include "tuple.h" #include "val_str.h" #include "val_int64.h" #include "element.h" #include "elementRegistry.h" namespace compile { namespace planner { class Exception : public compile::Context::Exception { public: Exception(string msg) : compile::Context::Exception(msg) {}; }; class Context : public compile::Context { public: /** Context Constructor: ** Arg 1: Name of the element ** Arg 2: Name of the main dataflow ** Arg 3: Name of the internal strand input element ** Arg 4: Name of the internal strand output element ** Arg 5: Name of the external strand output element */ Context(string, string, string, string, string); Context(TuplePtr args); virtual ~Context(); const char *class_name() const { return "planner::Context";} DECLARE_PUBLIC_ELEMENT_INITS private: string _mainDataflowName; string _internalStrandInputElement; string _internalStrandOutputElement; string _externalStrandOutputElement; long _nameCounter; // Used to create unique graph names std::map<string, ValuePtr> programEvents; int initialize(); /** Helper data structure used to describe the ports * characteristics of subgraphs created by the * event, condition, and action portions of a rule */ typedef struct PortDesc { int inputs; char* inProc; char* inFlow; int outputs; char* outProc; char* outFlow; } PortDesc; TuplePtr program(CommonTable::ManagerPtr catalog, TuplePtr rule); void rule(CommonTable::ManagerPtr catalog, TuplePtr rule); void ruleTerms(CommonTable::ManagerPtr catalog, TuplePtr rule, TuplePtrList& terms); PortDesc event(ostringstream& oss, string indent, TuplePtr rule, CommonTable::ManagerPtr catalog, TuplePtrList& terms); PortDesc condition(ostringstream& oss, string indent, TuplePtr rule, CommonTable::ManagerPtr catalog, TuplePtrList& terms); PortDesc action(ostringstream& oss, string indent, TuplePtr rule, CommonTable::ManagerPtr catalog, TuplePtrList& terms); PortDesc insertEvent(ostringstream& oss, string indent, TuplePtr rule, CommonTable::ManagerPtr catalog, TuplePtr head, TuplePtr event); ListPtr canonicalizeSelection(TuplePtrList& selections, ListPtr schema); ListPtr canonicalizeAssign(TuplePtrList& assigns, ListPtr schema); string probe(ostringstream& oss, string indent, CommonTable::ManagerPtr catalog, TuplePtr probe, ListPtr tupleSchema, bool filter); string assign(ostringstream& oss, string indent, CommonTable::ManagerPtr catalog, TuplePtr assign, ListPtr &tupleSchema); string select(ostringstream& oss, string indent, CommonTable::ManagerPtr catalog, TuplePtr select, ListPtr tupleSchema); /** Given a predicate name and modifier, returns true * if the predicate is to be watched and false otherwise. * An empty string modifier refers to a regular watch statement. */ bool watched(string name, string mod); DECLARE_PRIVATE_ELEMENT_INITS }; } } #endif /* __PLANNER_CONTEXT_H__ */
/**ARGS: source -ULINUX */ /**SYSCODE: = 1 | 32 */ #if (defined UNIX && defined PYGMALION) || (defined LINUX && defined ABELONE) || (defined MACOSX && defined ABYSSINIA) extern int i; #endif #if (defined UNIX && defined PYGMALION) || (defined MACOSX && defined ABYSSINIA) extern int j; #endif
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ #define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_ #include <string> #include <vector> #include "app/gfx/native_widget_types.h" #include "base/string16.h" #include "build/build_config.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" #include "webkit/glue/plugins/webplugin_2d_device_delegate.h" #include "webkit/glue/plugins/webplugin_3d_device_delegate.h" class FilePath; class GURL; struct NPObject; namespace WebKit { class WebInputEvent; struct WebCursorInfo; } namespace gfx { class Rect; } namespace webkit_glue { class WebPlugin; class WebPluginResourceClient; // This is the interface that a plugin implementation needs to provide. class WebPluginDelegate : public WebPlugin2DDeviceDelegate, public WebPlugin3DDeviceDelegate { public: virtual ~WebPluginDelegate() {} // Initializes the plugin implementation with the given (UTF8) arguments. // Note that the lifetime of WebPlugin must be longer than this delegate. // If this function returns false the plugin isn't started and shouldn't be // called again. If this method succeeds, then the WebPlugin is valid until // PluginDestroyed is called. // The load_manually parameter if true indicates that the plugin data would // be passed from webkit. if false indicates that the plugin should download // the data. This also controls whether the plugin is instantiated as a full // page plugin (NP_FULL) or embedded (NP_EMBED). virtual bool Initialize(const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, WebPlugin* plugin, bool load_manually) = 0; // Called when the WebPlugin is being destroyed. This is a signal to the // delegate that it should tear-down the plugin implementation and not call // methods on the WebPlugin again. virtual void PluginDestroyed() = 0; // Update the geometry of the plugin. This is a request to move the // plugin, relative to its containing window, to the coords given by // window_rect. Its contents should be clipped to the coords given // by clip_rect, which are relative to the origin of the plugin // window. The clip_rect is in plugin-relative coordinates. virtual void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) = 0; // Tells the plugin to paint the damaged rect. |canvas| is only used for // windowless plugins. virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) = 0; // Tells the plugin to print itself. virtual void Print(gfx::NativeDrawingContext hdc) = 0; // Informs the plugin that it now has focus. This is only called in // windowless mode. virtual void SetFocus() = 0; // For windowless plugins, gives them a user event like mouse/keyboard. // Returns whether the event was handled. This is only called in windowsless // mode. See NPAPI NPP_HandleEvent for more information. virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo* cursor) = 0; // Gets the NPObject associated with the plugin for scripting. virtual NPObject* GetPluginScriptableObject() = 0; // Receives notification about a resource load that the plugin initiated // for a frame. virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, intptr_t notify_data) = 0; // Returns the process id of the process that is running the plugin. virtual int GetProcessId() = 0; // The result, UTF-8 encoded, of the script execution is returned via this // function. virtual void SendJavaScriptStream(const GURL& url, const std::string& result, bool success, bool notify_needed, intptr_t notify_data) = 0; // Receives notification about data being available. virtual void DidReceiveManualResponse(const GURL& url, const std::string& mime_type, const std::string& headers, uint32 expected_length, uint32 last_modified) = 0; // Receives the data. virtual void DidReceiveManualData(const char* buffer, int length) = 0; // Indicates end of data load. virtual void DidFinishManualLoading() = 0; // Indicates a failure in data receipt. virtual void DidManualLoadFail() = 0; // Only supported when the plugin is the default plugin. virtual void InstallMissingPlugin() = 0; // Creates a WebPluginResourceClient instance and returns the same. virtual WebPluginResourceClient* CreateResourceClient( unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t stream) = 0; }; } // namespace webkit_glue #endif // WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H_
#ifndef __STD_ADT_COPY_H__ #define __STD_ADT_COPY_H__ template<typename T> void STL_CopyPtrArray(CStdPtrArray<T> &aryOriginal, CStdPtrArray<T> &aryNew) { int iCount, iIndex; T *lpObject = NULL; try { aryNew.RemoveAll(); iCount = aryOriginal.GetSize(); for(iIndex=0; iIndex<iCount; iIndex++) { if(aryOriginal[iIndex]) lpObject = dynamic_cast<T *>(aryOriginal[iIndex]->Clone()); else lpObject = NULL; aryNew.Add(lpObject); } } catch(StdUtils::CStdErrorInfo oError) { if(lpObject) delete lpObject; StdUtils::Std_RelayError(oError, __FILE__, __LINE__); } catch(...) { if(lpObject) delete lpObject; StdUtils::Std_ThrowError(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError, __FILE__, __LINE__, ""); } } #endif // __STD_ADT_COPY_H__
/* ----------------------------------------------------------------------- * * * Copyright 2004-2006 H. Peter Anvin - All Rights Reserved * * Modified by Ryan Hope for use in eINIT - 2008. * Copyright 2008 Ryan Hope - All Rights Reserved * * 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. * * ----------------------------------------------------------------------- */ /* * run_init(consoledev, realroot) * * This function should be called as the last thing in kinit, * from initramfs, it does the following: * * - Delete all files in the initramfs; * - Remounts /real-root onto the root filesystem; * - Chroots; * - Opens /dev/console; * - Spawns the specified init program (with arguments.) * * On failure, returns a human-readable error message. */ #include <alloca.h> #include <assert.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sys/mount.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/vfs.h> #include "run-init.h" /* Make it possible to compile on glibc by including constants that the always-behind shipped glibc headers may not include. Classic example on why the lack of ABI headers screw us up. */ #ifndef TMPFS_MAGIC # define TMPFS_MAGIC 0x01021994 #endif #ifndef RAMFS_MAGIC # define RAMFS_MAGIC 0x858458f6 #endif #ifndef MS_MOVE # define MS_MOVE 8192 #endif static int nuke(const char *what); static int nuke_dirent(int len, const char *dir, const char *name, dev_t me) { int bytes = len + strlen(name) + 2; char path[bytes]; int xlen; struct stat st; xlen = snprintf(path, bytes, "%s/%s", dir, name); assert(xlen < bytes); if (lstat(path, &st)) return ENOENT; /* Return 0 since already gone? */ if (st.st_dev != me) return 0; /* DO NOT recurse down mount points!!!!! */ return nuke(path); } /* Wipe the contents of a directory, but not the directory itself */ static int nuke_dir(const char *what) { int len = strlen(what); DIR *dir; struct dirent *d; int err = 0; struct stat st; if (lstat(what, &st)) return errno; if (!S_ISDIR(st.st_mode)) return ENOTDIR; if (!(dir = opendir(what))) { /* EACCES means we can't read it. Might be empty and removable; if not, the rmdir() in nuke() will trigger an error. */ return (errno == EACCES) ? 0 : errno; } while ((d = readdir(dir))) { /* Skip . and .. */ if (d->d_name[0] == '.' && (d->d_name[1] == '\0' || (d->d_name[1] == '.' && d->d_name[2] == '\0'))) continue; err = nuke_dirent(len, what, d->d_name, st.st_dev); if (err) { closedir(dir); return err; } } closedir(dir); return 0; } static int nuke(const char *what) { int rv; int err = 0; rv = unlink(what); if (rv < 0) { if (errno == EISDIR) { /* It's a directory. */ err = nuke_dir(what); if (!err) err = rmdir(what) ? errno : err; } else { err = errno; } } if (err) { errno = err; return err; } else { return 0; } } const char *run_init(const char *realroot) { struct stat rst, cst, ist; struct statfs sfs; int confd; /* First, change to the new root directory */ if (chdir(realroot)) return "chdir to new root"; /* This is a potentially highly destructive program. Take some extra precautions. */ /* Make sure the current directory is not on the same filesystem as the root directory */ if (stat("/", &rst) || stat(".", &cst)) return "stat"; if (rst.st_dev == cst.st_dev) return "current directory on the same filesystem as the root"; /* The initramfs should have /init */ if (stat("/init", &ist) || !S_ISREG(ist.st_mode)) return "can't find /init on initramfs"; /* Make sure we're on a ramfs */ if (statfs("/", &sfs)) return "statfs /"; if (sfs.f_type != RAMFS_MAGIC && sfs.f_type != TMPFS_MAGIC) return "rootfs not a ramfs or tmpfs"; /* Okay, I think we should be safe... */ /* Delete rootfs contents */ if (nuke_dir("/")) return "nuking initramfs contents"; /* Overmount the root */ if (mount(".", "/", NULL, MS_MOVE, NULL)) return "overmounting root"; /* chroot, chdir */ if (chroot(".") || chdir("/")) return "chroot"; /* Open /dev/console */ if ((confd = open("/dev/console", O_RDWR)) < 0) return "opening console"; dup2(confd, 0); dup2(confd, 1); dup2(confd, 2); close(confd); /* Spawn init */ //execv(init, initargs); return "ok"; /* Failed to spawn init */ }
/* * ClusteredPoller * * Created by Jakob Borg. * Copyright 2011 Nym Networks. See LICENSE for terms. */ #ifndef DATABASE_H #define DATABASE_H /** @file database.h Database writer thread. */ struct rtgconf; /** Thread context (parameters) for the database threads. */ struct database_ctx { struct rtgconf *config; /**< RTG.conf object. */ }; /** * Main loop for database thread. * @param ptr A pointer to a database_ctx object. * @return NULL */ void *database_run(void *ptr); #endif /* DATABASE_H */
/* * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. 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 CSSFontSelector_h #define CSSFontSelector_h #include "core/CoreExport.h" #include "core/css/FontFaceCache.h" #include "core/css/FontLoader.h" #include "platform/fonts/FontSelector.h" #include "platform/fonts/GenericFontFamilySettings.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" namespace blink { class CSSFontSelectorClient; class Document; class FontDescription; class CORE_EXPORT CSSFontSelector : public FontSelector { public: static CSSFontSelector* create(Document* document) { return new CSSFontSelector(document); } ~CSSFontSelector() override; unsigned version() const override { return m_fontFaceCache.version(); } PassRefPtr<FontData> getFontData(const FontDescription&, const AtomicString&) override; void willUseFontData(const FontDescription&, const AtomicString& family, UChar32) override; void willUseRange(const FontDescription&, const AtomicString& familyName, const FontDataForRangeSet&) override; bool isPlatformFontAvailable(const FontDescription&, const AtomicString& family); #if !ENABLE(OILPAN) void clearDocument(); #endif void fontFaceInvalidated(); // FontCacheClient implementation void fontCacheInvalidated() override; void registerForInvalidationCallbacks(CSSFontSelectorClient*); #if !ENABLE(OILPAN) void unregisterForInvalidationCallbacks(CSSFontSelectorClient*); #endif Document* document() const { return m_document; } FontFaceCache* fontFaceCache() { return &m_fontFaceCache; } FontLoader* fontLoader() { return m_fontLoader.get(); } const GenericFontFamilySettings& genericFontFamilySettings() const { return m_genericFontFamilySettings; } void updateGenericFontFamilySettings(Document&); DECLARE_VIRTUAL_TRACE(); protected: explicit CSSFontSelector(Document*); void dispatchInvalidationCallbacks(); private: // FIXME: Oilpan: Ideally this should just be a traced Member but that will // currently leak because ComputedStyle and its data are not on the heap. // See crbug.com/383860 for details. WeakMember<Document> m_document; // FIXME: Move to Document or StyleEngine. FontFaceCache m_fontFaceCache; HeapHashSet<WeakMember<CSSFontSelectorClient>> m_clients; Member<FontLoader> m_fontLoader; GenericFontFamilySettings m_genericFontFamilySettings; }; } // namespace blink #endif // CSSFontSelector_h
/************************************************************************ ** This file is part of the network simulator Shawn. ** ** Copyright (C) 2004-2007 by the SwarmNet (www.swarmnet.de) project ** ** Shawn is free software; you can redistribute it and/or modify it ** ** under the terms of the BSD License. Refer to the shawn-licence.txt ** ** file in the root of the Shawn source tree for further details. ** ************************************************************************/ #pragma warning( disable : 4290 ) #ifndef __SHAWN_APPS_TCPIP_SOCKET_H #define __SHAWN_APPS_TCPIP_SOCKET_H #ifdef SHAWN #include <shawn_config.h> #include "_apps_enable_cmake.h" #ifdef ENABLE_TCPIP #define BUILD_TCPIP #endif #else #define BUILD_TCPIP #endif #ifdef BUILD_TCPIP // Get Storage #ifdef SHAWN #include <apps/tcpip/storage.h> #else #include "storage.h" #endif #ifdef SHAWN namespace shawn { class SimulationController; } // Dummy function is called when Shawn Simulation starts. Does nothing up to now. extern "C" void init_tcpip( shawn::SimulationController& ); #endif // Disable exception handling warnings #ifdef _MSC_VER #pragma warning( disable : 4290 ) #endif #include <string> #include <map> #include <vector> #include <list> #include <deque> #include <iostream> #include <cstddef> struct in_addr; namespace tcpip { class SocketException: public std::exception { private: std::string what_; public: SocketException(std::string what) throw() { what_ = what; //std::cerr << "tcpip::SocketException: " << what << std::endl << std::flush; } virtual const char* what() const throw() { return what_.c_str(); } ~SocketException() throw() { } }; class Socket { friend class Response; public: /// Constructor that prepare to connect to host:port Socket(std::string host, int port); /// Constructor that prepare for accepting a connection on given port Socket(int port); /// Destructor ~Socket(); /// Connects to host_:port_ void connect() throw( SocketException); /// Wait for a incoming connection to port_ void accept() throw( SocketException); void send(const std::vector<unsigned char>& buffer) throw( SocketException); void sendExact(const Storage&) throw( SocketException); /// Receive up to \p bufSize available bytes from Socket::socket_ std::vector<unsigned char> receive(int bufSize = 2048) throw( SocketException); /// Receive a complete TraCI message from Socket::socket_ bool receiveExact(Storage&) throw( SocketException); void close(); int port(); void set_blocking(bool) throw( SocketException); bool is_blocking() throw(); bool has_client_connection() const; // If verbose, each send and received data is written to stderr bool verbose() { return verbose_; } void set_verbose(bool newVerbose) { verbose_ = newVerbose; } protected: /// Length of the message length part of a TraCI message static const int lengthLen; /// Receive \p len bytes from Socket::socket_ void receiveComplete(unsigned char* const buffer, std::size_t len) const; /// Receive up to \p len available bytes from Socket::socket_ size_t recvAndCheck(unsigned char* const buffer, std::size_t len) const; /// Print \p label and \p buffer to stderr if Socket::verbose_ is set void printBufferOnVerbose(const std::vector<unsigned char> buffer, const std::string& label) const; private: void init(); void BailOnSocketError(std::string) const throw( SocketException); #ifdef WIN32 std::string GetWinsockErrorString(int err) const; #endif bool atoaddr(std::string, struct in_addr& addr); bool datawaiting(int sock) const throw(); std::string host_; int port_; int socket_; int server_socket_; bool blocking_; bool verbose_; #ifdef WIN32 static bool init_windows_sockets_; static bool windows_sockets_initialized_; static int instance_count_; #endif }; } // namespace tcpip #endif // BUILD_TCPIP #endif /*----------------------------------------------------------------------- * Source $Source: $ * Version $Revision: 612 $ * Date $Date: 2011-06-14 15:16:52 +0200 (Tue, 14 Jun 2011) $ *----------------------------------------------------------------------- * $Log:$ *-----------------------------------------------------------------------*/
/* * Copyright (C) 2019 The Android Open Source Project * * 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 SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_HEAP_GRAPH_MODULE_H_ #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_HEAP_GRAPH_MODULE_H_ #include "perfetto/base/build_config.h" #include "src/trace_processor/importers/proto/heap_graph_tracker.h" #include "src/trace_processor/importers/proto/proto_importer_module.h" #include "src/trace_processor/timestamped_trace_piece.h" #include "protos/perfetto/trace/trace_packet.pbzero.h" namespace perfetto { namespace trace_processor { class HeapGraphModule : public ProtoImporterModule { public: explicit HeapGraphModule(TraceProcessorContext* context); void ParsePacket(const protos::pbzero::TracePacket::Decoder& decoder, const TimestampedTracePiece& ttp, uint32_t field_id) override; void NotifyEndOfFile() override; private: void ParseHeapGraph(uint32_t seq_id, int64_t ts, protozero::ConstBytes); void ParseDeobfuscationMapping(protozero::ConstBytes); void DeobfuscateClass(base::Optional<StringPool::Id> package_name_id, StringPool::Id obfuscated_class_id, const protos::pbzero::ObfuscatedClass::Decoder& cls); TraceProcessorContext* context_; }; } // namespace trace_processor } // namespace perfetto #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_HEAP_GRAPH_MODULE_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_ITEM_H_ #define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_ITEM_H_ #include "ui/gfx/native_widget_types.h" namespace download { class DownloadItem; } namespace gfx { class Image; } // Helper function for download views to use when acting as a drag source for a // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| // is only required for Mac OS X, elsewhere it can be NULL. void DragDownloadItem(const download::DownloadItem* download, gfx::Image* icon, gfx::NativeView view); #endif // CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_ITEM_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ #include <string> #include <vector> #include "base/compiler_specific.h" #include "content/renderer/media/media_stream_dependency_factory.h" namespace content { class MockVideoSource : public webrtc::VideoSourceInterface { public: MockVideoSource(); virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual MediaSourceInterface::SourceState state() const OVERRIDE; virtual cricket::VideoCapturer* GetVideoCapturer() OVERRIDE; virtual void AddSink(cricket::VideoRenderer* output) OVERRIDE; virtual void RemoveSink(cricket::VideoRenderer* output) OVERRIDE; // Changes the state of the source to live and notifies the observer. void SetLive(); // Changes the state of the source to ended and notifies the observer. void SetEnded(); protected: virtual ~MockVideoSource(); private: webrtc::ObserverInterface* observer_; MediaSourceInterface::SourceState state_; }; class MockLocalVideoTrack : public webrtc::VideoTrackInterface { public: MockLocalVideoTrack(std::string label, webrtc::VideoSourceInterface* source); virtual void AddRenderer(webrtc::VideoRendererInterface* renderer) OVERRIDE; virtual void RemoveRenderer( webrtc::VideoRendererInterface* renderer) OVERRIDE; virtual cricket::VideoRenderer* FrameInput() OVERRIDE; virtual std::string kind() const OVERRIDE; virtual std::string label() const OVERRIDE; virtual bool enabled() const OVERRIDE; virtual TrackState state() const OVERRIDE; virtual bool set_enabled(bool enable) OVERRIDE; virtual bool set_state(TrackState new_state) OVERRIDE; virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual webrtc::VideoSourceInterface* GetSource() const OVERRIDE; protected: virtual ~MockLocalVideoTrack(); private: bool enabled_; std::string label_; scoped_refptr<webrtc::VideoSourceInterface> source_; }; class MockLocalAudioTrack : public webrtc::AudioTrackInterface { public: explicit MockLocalAudioTrack(const std::string& label) : enabled_(false), label_(label) { } virtual std::string kind() const OVERRIDE; virtual std::string label() const OVERRIDE; virtual bool enabled() const OVERRIDE; virtual TrackState state() const OVERRIDE; virtual bool set_enabled(bool enable) OVERRIDE; virtual bool set_state(TrackState new_state) OVERRIDE; virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; protected: virtual ~MockLocalAudioTrack() {} private: bool enabled_; std::string label_; }; // A mock factory for creating different objects for // RTC MediaStreams and PeerConnections. class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { public: MockMediaStreamDependencyFactory(); virtual ~MockMediaStreamDependencyFactory(); virtual scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(const std::string& config, webrtc::PeerConnectionObserver* observer) OVERRIDE; virtual scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(const webrtc::JsepInterface::IceServers& ice_servers, const webrtc::MediaConstraintsInterface* constraints, WebKit::WebFrame* frame, webrtc::PeerConnectionObserver* observer) OVERRIDE; virtual scoped_refptr<webrtc::VideoSourceInterface> CreateVideoSource( int video_session_id, bool is_screencast, const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; virtual scoped_refptr<webrtc::LocalMediaStreamInterface> CreateLocalMediaStream(const std::string& label) OVERRIDE; virtual scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack(const std::string& label, webrtc::VideoSourceInterface* source) OVERRIDE; virtual scoped_refptr<webrtc::LocalAudioTrackInterface> CreateLocalAudioTrack(const std::string& label, webrtc::AudioDeviceModule* audio_device) OVERRIDE; virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( const std::string& sdp) OVERRIDE; virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( const std::string& type, const std::string& sdp) OVERRIDE; virtual webrtc::IceCandidateInterface* CreateIceCandidate( const std::string& sdp_mid, int sdp_mline_index, const std::string& sdp) OVERRIDE; virtual bool EnsurePeerConnectionFactory() OVERRIDE; virtual bool PeerConnectionFactoryCreated() OVERRIDE; virtual void SetAudioDeviceSessionId(int session_id) OVERRIDE; MockVideoSource* last_video_source() { return last_video_source_; } private: bool mock_pc_factory_created_; scoped_refptr <MockVideoSource> last_video_source_; DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); }; } // namespace content #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
/* -- MAGMA (version 1.3.0) -- Univ. of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver @date November 2014 @author Azzam Haidar */ #ifndef MAGMA_THREADSETTING_H #define MAGMA_THREADSETTING_H #ifdef __cplusplus extern "C" { #endif /***************************************************************************//** * Internal routines **/ void magma_set_lapack_numthreads(magma_int_t numthreads); magma_int_t magma_get_lapack_numthreads(); magma_int_t magma_get_parallel_numthreads(); /***************************************************************************/ #ifdef __cplusplus } #endif #endif // MAGMA_THREADSETTING_H
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <ABI42_0_0React/ABI42_0_0RCTComponent.h> #import <UIKit/UIKit.h> /** * Protocol used to dispatch commands in `ABI42_0_0RCTRefreshControlManager.h`. * This is in order to support commands for both Paper and Fabric components * during migration. */ @protocol ABI42_0_0RCTRefreshableProtocol - (void)setRefreshing:(BOOL)refreshing; @end
// 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_RESOURCE_REQUEST_BLOCKED_REASON_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_RESOURCE_REQUEST_BLOCKED_REASON_H_ namespace blink { // If updating this enum, also update DevTools protocol usages. // Contact devtools owners for help. enum class ResourceRequestBlockedReason { kOther, kCSP, kMixedContent, kOrigin, kInspector, kSubresourceFilter, kContentType, kCollapsedByClient, kCoepFrameResourceNeedsCoepHeader, kCoopSandboxedIFrameCannotNavigateToCoopPage, kCorpNotSameOrigin, kCorpNotSameOriginAfterDefaultedToSameOriginByCoep, kCorpNotSameSite, }; } // namespace blink #endif
// ********************************************************************************** // // BSD License. // This file is part of upnpx. // // Copyright (c) 2010-2011, Bruno Keymolen, email: bruno.keymolen@gmail.com // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. // Neither the name of "Bruno Keymolen" 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. // // ********************************************************************************** #import <Foundation/Foundation.h> #import "BasicUPnPDevice.h" #import "SoapActionsLayer3Forwarding1.h" /* * Services: * O - Layer3Forwarding:1 */ @interface InternetGateway2Device : BasicUPnPDevice { SoapActionsLayer3Forwarding1 *mLayer3Forwarding; } -(SoapActionsLayer3Forwarding1*)layer3Forwarding; -(BasicUPnPService*)layer3ForwardingService; @end
// 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_WEB_RESOURCE_NOTIFICATION_PROMO_H_ #define CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_ #include <string> #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "googleurl/src/gurl.h" namespace base { class DictionaryValue; class ListValue; } class PrefService; class Profile; // Helper class for PromoResourceService that parses promo notification info // from json or prefs. class NotificationPromo { public: static GURL PromoServerURL(); explicit NotificationPromo(Profile* profile); ~NotificationPromo(); // Initialize from json/prefs. void InitFromJson(const base::DictionaryValue& json); void InitFromPrefs(); // Can this promo be shown? bool CanShow() const; // Calculates promo notification start time with group-based time slice // offset. double StartTimeForGroup() const; double EndTime() const; // Helpers for NewTabPageHandler. void HandleClosed(); bool HandleViewed(); // returns true if views exceeds maximum allowed. bool new_notification() const { return new_notification_; } // Register preferences. static void RegisterUserPrefs(PrefService* prefs); private: // For testing. friend class NotificationPromoTest; // Check if this promo notification is new based on start/end times, // and trigger events accordingly. void CheckForNewNotification(); // Actions on receiving a new promo notification. void OnNewNotification(); // Flush data members to prefs for storage. void WritePrefs(); // Tests group_ against max_group_. // When max_group_ is 0, all groups pass. bool ExceedsMaxGroup() const; // Tests views_ against max_views_. // When max_views_ is 0, we don't cap the number of views. bool ExceedsMaxViews() const; // True if this promo is not targeted to G+ users, or if this is a G+ user. bool IsGPlusRequired() const; Profile* profile_; PrefService* prefs_; std::string promo_text_; #if defined(OS_ANDROID) std::string promo_text_long_; std::string promo_action_type_; scoped_ptr<base::ListValue> promo_action_args_; #endif double start_; double end_; int num_groups_; int initial_segment_; int increment_; int time_slice_; int max_group_; // When max_views_ is 0, we don't cap the number of views. int max_views_; int group_; int views_; bool closed_; bool gplus_required_; bool new_notification_; DISALLOW_COPY_AND_ASSIGN(NotificationPromo); }; #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_H_
// Copyright 2015 The Cobalt Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef COBALT_BINDINGS_TESTING_STRINGIFIER_ANONYMOUS_OPERATION_INTERFACE_H_ #define COBALT_BINDINGS_TESTING_STRINGIFIER_ANONYMOUS_OPERATION_INTERFACE_H_ #include <string> #include "cobalt/script/wrappable.h" #include "testing/gmock/include/gmock/gmock.h" namespace cobalt { namespace bindings { namespace testing { class StringifierAnonymousOperationInterface : public script::Wrappable { public: MOCK_METHOD0(AnonymousStringifier, std::string()); DEFINE_WRAPPABLE_TYPE(StringifierAnonymousOperationInterface); }; } // namespace testing } // namespace bindings } // namespace cobalt #endif // COBALT_BINDINGS_TESTING_STRINGIFIER_ANONYMOUS_OPERATION_INTERFACE_H_
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */ /* See cxx source for full Copyright notice */ /* $Id$ */ #ifndef AliAnalysisTRDEfficiency_H #define AliAnalysisTRDEfficiency_H #include "AliAnalysisTaskSE.h" //#include "AliKFConversionPhoton.h" #include "THnSparse.h" class AliAnalysisTRDEfficiency : public AliAnalysisTaskSE { public: AliAnalysisTRDEfficiency(); AliAnalysisTRDEfficiency(const char *name); virtual ~AliAnalysisTRDEfficiency(); virtual void UserCreateOutputObjects(); virtual Bool_t GetAODConversionGammas(AliAODEvent* fAOD); virtual void UserExec(Option_t* option); virtual void Photons(AliAODEvent* fAOD); //virtual TFile* OpenDigitsFile(TString* inputfile, String* digfile, TString* opt); //virtual void Tracks(AliAODEvent* fAOD); virtual void Terminate(Option_t* option); private: AliAODEvent* fAOD; //! input event TList* fOutputList; //! output list TH1F* fHistPt; //! dummy histogram TFile* file; TList* fConversionGammas; TH1F* fhm1pt2; TH1F* fhNpttr; TH1F* fhNptun; TH1F* fhfA; //include filter bits // v0 // all tracks TH1F* fhR; TH2F* fhRpt; TH1F* fhMv; TH1F* fhvpost; // hqu tracks TH1F* fhRhqu; TH2F* fhRpthqu; TH1F* fhMhqu; TH1F* fhvposthqu; //tracks TH1F* fhtxv; // track->Xv() TH1F* fhtyv; TH1F* fhtzv; // gamma TH1F* fhgpt; TH1F* fhgpttrd; TH2F* fhgRpt; TH2F* fhgRpttrd; // actually hqu but too late to change TH2F* fhgMinvM; // comparing the GetPhotonMass and the GetInvMass functions TH1F* fhgR; TH2F* fhgptM; TH2F* fhgptMhqu; TH2F* fhgptQ; // pt vs photon Quality TH2F* fhgptQhqu; TH2F* fhgetaphi; TH2F* fhgetaphihqu; TH2F* fhgxy; TH2F* fhgxyhqu; // v0 duagther particles TH1F* fhdn; TH1F* fhdpt; // n dimensional THnSparse* fhna; THnSparse* fhnp; THnSparse* fhnhqu; // all of these events have a reconstructed photon THnSparse* fhgevent2; // events with THnSparse* fhgevent3; THnSparse* fhgevent4; THnSparse* fhgevent5; THnSparse* fhgevent6; THnSparse* fhgevent7; THnSparse* fhgevent8; THnSparse* fhgevent9; //event counter TH1F* fhgevent; // event counter TH1F* fhevent; //track the events THnSparse* fhtrckvnt; // track event THnSparse* fhtrckvnthqu;// track hqu event TH1* fhtrvnt; TH1* fhtrvnthqu; TList* lsttrckvnt; TList* lsttrckvnthqu; //AliConversionPhotonCuts fConversionCuts; AliAnalysisTRDEfficiency(const AliAnalysisTRDEfficiency&); // not implemented AliAnalysisTRDEfficiency& operator=(const AliAnalysisTRDEfficiency&); // not implemented ClassDef(AliAnalysisTRDEfficiency, 1); }; #endif
/* * Copyright (C) 2011 Nick Johnson <nickbjohnson4224 at gmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdio.h> #include <ctype.h> #include <string.h> #include "calico.h" int read_move(int *x, int *y) { char buffer[100]; char letter; int number; fgets(buffer, 100, stdin); if (!strcmp(buffer, "exit\n")) { return 1; } else { sscanf(buffer, "%c%d", &letter, &number); } letter = toupper(letter) - 'A'; number = 19 - number; if (letter >= 8) { letter--; } *x = letter; *y = number; return 0; }
/* * Copyright (C) 2011 by Project SESA, Boston University * * 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 <config.h> #include <inttypes.h> #include <lrt/io.h> #include <lrt/assert.h> #include <l0/lrt/types.h> #include <l0/cobj/cobj.h> #include <l0/lrt/pic.h> #include <l0/lrt/trans.h> #include <l0/types.h> #include <l0/sys/trans.h> #include <l0/types.h> #include <l0/cobj/CObjEBB.h> #include <l0/EventMgrPrim.h> #include <l0/cobj/CObjEBBRoot.h> #include <l0/cobj/CObjEBBRootMulti.h> #include <l0/cobj/CObjEBBRootMultiImp.h> #include <l1/MsgMgr.h> #include <l1/L1.h> L1Id theL1Id=0;
// // CustomHelper.h // filterLib // // Created by wysaid on 16/1/11. // Copyright © 2016年 wysaid. All rights reserved. // #ifndef CommonHelper_h #define CommonHelper_h #include "cgeGLFunctions.h" #include "cgeCustomFilters.h" namespace CGE { CGEImageFilterInterface* cgeCreateCustomFilterByType(CustomFilterType type); } #endif /* IFCommonHelper_h */
#include "php_git2.h" #include "php_git2_priv.h" #include "stash.h" static int php_git2_stash_cb(size_t index, const char* message, const git_oid *stash_id, void *payload) { zval *param_index, *param_message,*param_stash_id, *retval_ptr = NULL; php_git2_cb_t *p = (php_git2_cb_t*)payload; long retval = 0; char _oid[GIT2_OID_HEXSIZE] = {0}; GIT2_TSRMLS_SET(p->tsrm_ls) git_oid_fmt(_oid, stash_id); Z_ADDREF_P(p->payload); MAKE_STD_ZVAL(param_index); MAKE_STD_ZVAL(param_message); MAKE_STD_ZVAL(param_stash_id); ZVAL_LONG(param_index, index); ZVAL_STRING(param_message, message, 1); ZVAL_STRING(param_stash_id, _oid, 1); if (php_git2_call_function_v(p->fci, p->fcc TSRMLS_CC, &retval_ptr, 4, &param_index, &param_message, &param_stash_id, &p->payload)) { return GIT_EUSER; } retval = Z_LVAL_P(retval_ptr); zval_ptr_dtor(&retval_ptr); return retval; } /* {{{ proto resource git_stash_save(resource $repo, array $stasher, string $message, long $flags) */ PHP_FUNCTION(git_stash_save) { php_git2_t *_repo = NULL; git_oid out = {0}; zval *repo = NULL, *stasher = NULL; char *message = NULL; int message_len = 0, error = 0; long flags = 0; char buf[GIT2_OID_HEXSIZE] = {0}; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rasl", &repo, &stasher, &message, &message_len, &flags) == FAILURE) { return; } ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); error = git_stash_save(&out, PHP_GIT2_V(_repo, repository), stasher, message, flags); if (php_git2_check_error(error, "git_stash_save" TSRMLS_CC)) { RETURN_FALSE; } git_oid_fmt(buf, &out); RETURN_STRING(buf, 1); } /* }}} */ /* {{{ proto long git_stash_foreach(resource $repo, Callable $callback, $payload) */ PHP_FUNCTION(git_stash_foreach) { int result = 0; zval *repo = NULL, *payload = NULL; php_git2_t *_repo = NULL; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fcc = empty_fcall_info_cache; php_git2_cb_t *cb = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rfz", &repo, &fci, &fcc, &payload) == FAILURE) { return; } ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); if (php_git2_cb_init(&cb, &fci, &fcc, payload TSRMLS_CC)) { RETURN_FALSE; } result = git_stash_foreach(PHP_GIT2_V(_repo, repository), php_git2_stash_cb, cb); php_git2_cb_free(cb); RETURN_LONG(result); } /* }}} */ /* {{{ proto long git_stash_drop(resource $repo, long $index) */ PHP_FUNCTION(git_stash_drop) { int result = 0; zval *repo = NULL; php_git2_t *_repo = NULL; long index = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &repo, &index) == FAILURE) { return; } ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); result = git_stash_drop(PHP_GIT2_V(_repo, repository), index); RETURN_LONG(result); } /* }}} */
// // CIArtworkSequenceSegue.h // International // // Created by Dimitry Bentsionov on 7/31/13. // Copyright (c) 2013 Carnegie Museums. All rights reserved. // #import <UIKit/UIKit.h> @interface CIArtworkSequenceSegue : UIStoryboardSegue @end
#ifndef EXAMPLE_BROWSER_GUI_H #define EXAMPLE_BROWSER_GUI_H #include "../CommonInterfaces/CommonExampleInterface.h" class ExampleBrowserInterface { public: virtual ~ExampleBrowserInterface() {} virtual CommonExampleInterface* getCurrentExample() = 0; virtual bool init(int argc, char* argv[]) = 0; virtual void update(float deltaTime) = 0; virtual bool requestedExit() = 0; }; #endif //EXAMPLE_BROWSER_GUI_H
// // openBciWifiHttpUtils.h // // Helper functions to send http requests to openBciWifi module // // Created by Sean Montgomery on 10/15/17. // // This work is licensed under the MIT License // #pragma once #include "ofMain.h" // ToDo: Integrate http methods into ofxOpenBciWifi static void openBciWifiTcp(string computerIp, int tcpPort, string openBciWifiIp) { // Send desired parameters to setup openBciWifi boards via http post //{ // "ip": "192.168.1.100", // "port" : 3000, // "output" : "json", // "delimiter" : true, // "latency" : 15000, // "timestamps" : false, // "sample_numbers" : true //} string pyCmd = ""; #if defined(TARGET_WIN32) pyCmd = pyCmd + "start "; #endif pyCmd = pyCmd + "python " + ofToDataPath("httpPostJson.py") + " http://" + openBciWifiIp + "/tcp" + " {" + "\\\"ip\\\":\\\"" + computerIp + "\\\"," + "\\\"port\\\":" + ofToString(tcpPort) + "," + "\\\"output\\\":\\\"json\\\"," + "\\\"delimiter\\\":true," + "\\\"latency\\\":10000," + "\\\"timestamps\\\":false," + "\\\"sample_numbers\\\":true" + "}"; #if defined(TARGET_OSX) || defined(TARGET_LINUX) pyCmd = pyCmd + " &"; #endif cout << pyCmd << endl; system(pyCmd.c_str()); } static void openBciWifiStart(string openBciWifiIp) { // Start streaming data string pyCmd = ""; #if defined(TARGET_WIN32) pyCmd = pyCmd + "start "; #endif pyCmd = pyCmd + "python " + ofToDataPath("httpGet.py") + " http://" + openBciWifiIp + "/stream/start"; #if defined(TARGET_OSX) || defined(TARGET_LINUX) pyCmd = pyCmd + " &"; #endif cout << pyCmd << endl; system(pyCmd.c_str()); } static void openBciWifiStop(string openBciWifiIp) { // Stop streaming data string pyCmd = ""; #if defined(TARGET_WIN32) pyCmd = pyCmd + "start "; #endif pyCmd = pyCmd + "python " + ofToDataPath("httpGet.py") + " http://" + openBciWifiIp + "/stream/stop"; #if defined(TARGET_OSX) || defined(TARGET_LINUX) pyCmd = pyCmd + " &"; #endif cout << pyCmd << endl; system(pyCmd.c_str()); } static void openBciWifiSquareWaveOn(string openBciWifiIp) { // Turn on raw data sending from openBci Cyton boards // {'command': '-'} string pyCmd = ""; #if defined(TARGET_WIN32) pyCmd = pyCmd + "start "; #endif pyCmd = pyCmd + "python " + ofToDataPath("httpPostJson.py") + " http://" + openBciWifiIp + "/command" + " {" + "\\\"command\\\":\\\"-\\\"" + "}"; #if defined(TARGET_OSX) || defined(TARGET_LINUX) pyCmd = pyCmd + " &"; #endif cout << pyCmd << endl; system(pyCmd.c_str()); } static void openBciWifiAnalogDataOn(string openBciWifiIp) { // Turn on square wave data sending from openBci Cyton boards // {'command': 'd'} string pyCmd = ""; #if defined(TARGET_WIN32) pyCmd = pyCmd + "start "; #endif pyCmd = pyCmd + "python " + ofToDataPath("httpPostJson.py") + " http://" + openBciWifiIp + "/command" + " {" + "\\\"command\\\":\\\"d\\\"" + "}"; #if defined(TARGET_OSX) || defined(TARGET_LINUX) pyCmd = pyCmd + " &"; #endif cout << pyCmd << endl; system(pyCmd.c_str()); }
// Created by Samvel Khalatyan on Nov 25, 2013 // Copyright (c) 2013 Samvel Khalatyan. All rights reserved // // Use of this source code is governed by a MIT-style license that can be // found in the LICENSE file. #ifndef TOOLS #define TOOLS #include <numeric> #include <string> #include <vector> namespace tools { template<typename T> T sum(const T *from, const T &number_of_elements, T init) // calculate a sum of consequent elements { return std::accumulate(from, from + number_of_elements, init); } // put all arguments but the name of executable into a vector using Args = std::vector<std::string>; using CArgs = std::vector<const char *>; Args arguments(int argc, char *argv[]); CArgs carguments(int argc, char *argv[]); } #endif
/* File: DocumentWindowController.h Abstract: Document's main window controller object for TextEdit. Version: 1.9 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (C) 2013 Apple Inc. All Rights Reserved. */ #import <Cocoa/Cocoa.h> #import "ScalingScrollView.h" @interface DocumentWindowController : NSWindowController <NSLayoutManagerDelegate, NSTextViewDelegate> { IBOutlet ScalingScrollView *scrollView; NSLayoutManager *layoutMgr; BOOL hasMultiplePages; BOOL rulerIsBeingDisplayed; BOOL isSettingSize; } // Convenience initializer. Loads the correct nib automatically. - (id)init; - (NSUInteger)numberOfPages; - (NSView *)documentView; - (void)breakUndoCoalescing; /* Layout orientation sections */ - (NSArray *)layoutOrientationSections; - (IBAction)chooseAndAttachFiles:(id)sender; @end
/* * Copyright (c) 2007, 2008, 2009, 2011, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. */ #include <unistd.h> #include <string.h> #include <vfs/vfs_path.h> #include "posixcompat.h" char *getcwd(char *buf, size_t size) { char *cwd = getenv("PWD"); if(cwd == NULL) { return NULL; } strncpy(buf, cwd, size); return buf; }
#ifndef OFFERACCEPTDIALOGZEC_H #define OFFERACCEPTDIALOGZEC_H #include "walletmodel.h" #include <QDialog> #include <QImage> #include <QLabel> #include "amount.h" class PlatformStyle; class WalletModel; QT_BEGIN_NAMESPACE class QNetworkReply; QT_END_NAMESPACE namespace Ui { class OfferAcceptDialogZEC; } class OfferAcceptDialogZEC : public QDialog { Q_OBJECT public: explicit OfferAcceptDialogZEC(WalletModel* model, const PlatformStyle *platformStyle, QString strAliasPeg, QString alias, QString offer, QString quantity, QString notes, QString title, QString currencyCode, QString sysPrice, QString sellerAlias, QString address, QString arbiter, QWidget *parent=0); ~OfferAcceptDialogZEC(); void CheckPaymentInZEC(); bool getPaymentStatus(); void SetupQRCode(const QString&price); void convertAddress(); private: bool setupEscrowCheckboxState(bool state); WalletModel* walletModel; const PlatformStyle *platformStyle; Ui::OfferAcceptDialogZEC *ui; SendCoinsRecipient info; QString quantity; QString notes; QString qstrPrice; QString title; QString offer; QString arbiter; QString acceptGuid; QString sellerAlias; QString address; QString zaddress; QString multisigaddress; QString alias; QString m_buttonText; QString m_address; double dblPrice; bool offerPaid; QString m_redeemScript; QString priceZec; qint64 m_height; private Q_SLOTS: void on_cancelButton_clicked(); void tryAcceptOffer(); void onEscrowCheckBoxChanged(bool); void acceptOffer(); void acceptEscrow(); void openZECWallet(); void slotConfirmedFinished(QNetworkReply *); void on_escrowEdit_textChanged(const QString & text); }; #endif // OFFERACCEPTDIALOGZEC_H
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_opengl_NVVideoCaptureUtil */ #ifndef _Included_org_lwjgl_opengl_NVVideoCaptureUtil #define _Included_org_lwjgl_opengl_NVVideoCaptureUtil #ifdef __cplusplus extern "C" { #endif /* * Class: org_lwjgl_opengl_NVVideoCaptureUtil * Method: nglBindVideoCaptureDeviceNV * Signature: (Ljava/nio/ByteBuffer;IJ)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglBindVideoCaptureDeviceNV (JNIEnv *, jclass, jobject, jint, jlong); /* * Class: org_lwjgl_opengl_NVVideoCaptureUtil * Method: nglEnumerateVideoCaptureDevicesNV * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglEnumerateVideoCaptureDevicesNV (JNIEnv *, jclass, jobject, jobject, jint); /* * Class: org_lwjgl_opengl_NVVideoCaptureUtil * Method: nglLockVideoCaptureDeviceNV * Signature: (Ljava/nio/ByteBuffer;J)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglLockVideoCaptureDeviceNV (JNIEnv *, jclass, jobject, jlong); /* * Class: org_lwjgl_opengl_NVVideoCaptureUtil * Method: nglQueryVideoCaptureDeviceNV * Signature: (Ljava/nio/ByteBuffer;JILjava/nio/IntBuffer;I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglQueryVideoCaptureDeviceNV (JNIEnv *, jclass, jobject, jlong, jint, jobject, jint); /* * Class: org_lwjgl_opengl_NVVideoCaptureUtil * Method: nglReleaseVideoCaptureDeviceNV * Signature: (Ljava/nio/ByteBuffer;J)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglReleaseVideoCaptureDeviceNV (JNIEnv *, jclass, jobject, jlong); #ifdef __cplusplus } #endif #endif
/* * Copyright © 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Author: * Antti Koskipaa <antti.koskipaa@linux.intel.com> * */ #include "igt.h" #include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <errno.h> #include <unistd.h> #include <time.h> #define TOLERANCE 5 /* percent */ #define BACKLIGHT_PATH "/sys/class/backlight/intel_backlight" #define FADESTEPS 10 #define FADESPEED 100 /* milliseconds between steps */ IGT_TEST_DESCRIPTION("Basic backlight sysfs test"); static int backlight_read(int *result, const char *fname) { int fd; char full[PATH_MAX]; char dst[64]; int r, e; igt_assert(snprintf(full, PATH_MAX, "%s/%s", BACKLIGHT_PATH, fname) < PATH_MAX); fd = open(full, O_RDONLY); if (fd == -1) return -errno; r = read(fd, dst, sizeof(dst)); e = errno; close(fd); if (r < 0) return -e; errno = 0; *result = strtol(dst, NULL, 10); return errno; } static int backlight_write(int value, const char *fname) { int fd; char full[PATH_MAX]; char src[64]; int len; igt_assert(snprintf(full, PATH_MAX, "%s/%s", BACKLIGHT_PATH, fname) < PATH_MAX); fd = open(full, O_WRONLY); if (fd == -1) return -errno; len = snprintf(src, sizeof(src), "%i", value); len = write(fd, src, len); close(fd); if (len < 0) return len; return 0; } static void test_and_verify(int val) { int result; igt_assert(backlight_write(val, "brightness") == 0); igt_assert(backlight_read(&result, "brightness") == 0); /* Check that the exact value sticks */ igt_assert(result == val); igt_assert(backlight_read(&result, "actual_brightness") == 0); /* Some rounding may happen depending on hw. Just check that it's close enough. */ igt_assert(result <= val + val * TOLERANCE / 100 && result >= val - val * TOLERANCE / 100); } static void test_brightness(int max) { test_and_verify(0); test_and_verify(max); test_and_verify(max / 2); } static void test_bad_brightness(int max) { int val; /* First write some sane value */ backlight_write(max / 2, "brightness"); /* Writing invalid values should fail and not change the value */ igt_assert(backlight_write(-1, "brightness") < 0); backlight_read(&val, "brightness"); igt_assert(val == max / 2); igt_assert(backlight_write(max + 1, "brightness") < 0); backlight_read(&val, "brightness"); igt_assert(val == max / 2); igt_assert(backlight_write(INT_MAX, "brightness") < 0); backlight_read(&val, "brightness"); igt_assert(val == max / 2); } static void test_fade(int max) { int i; static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 }; /* Fade out, then in */ for (i = max; i > 0; i -= max / FADESTEPS) { test_and_verify(i); nanosleep(&ts, NULL); } for (i = 0; i <= max; i += max / FADESTEPS) { test_and_verify(i); nanosleep(&ts, NULL); } } igt_main { int max, old; igt_skip_on_simulation(); igt_fixture { /* Get the max value and skip the whole test if sysfs interface not available */ igt_skip_on(backlight_read(&old, "brightness")); igt_assert(backlight_read(&max, "max_brightness") > -1); } igt_subtest("basic-brightness") test_brightness(max); igt_subtest("bad-brightness") test_bad_brightness(max); igt_subtest("fade") test_fade(max); igt_fixture { /* Restore old brightness */ backlight_write(old, "brightness"); } }
#define IA 16807 #define IM 2147483647 #define AM (1.0/IM) #define IQ 127773 #define IR 2836 #define MASK 123459876 float ran0(long *idum) { long k; float ans; *idum ^= MASK; k=(*idum)/IQ; *idum=IA*(*idum-k*IQ)-IR*k; if (*idum < 0) *idum += IM; ans=AM*(*idum); *idum ^= MASK; return ans; } #undef IA #undef IM #undef AM #undef IQ #undef IR #undef MASK
#ifndef XK_CAPTCHA_H #define XK_CAPTCHA_H #include <stdint.h> #include "xk.h" /* * captcha char implementation * * size: 24 rows, 10 cols * char row range: ch1 [3, 13) , ch2 [13, 23) * ch3 [23, 33), ch4 [33, 43) * array subscript: * for 32 bit: for 64 bit: * 6000000007 3000000003 * 6000000007 3000000003 * 6000000007 3000000003 * 6000000007 3000000003 * 6111111117 3000000003 * 6111111117 3000000003 * 6111111117 3000000003 * 6111111117 3000000003 * 6222222227 3111111113 * 6222222227 3111111113 * 6222222227 3111111113 * 6222222227 3111111113 * 6333333337 3111111113 * 6333333337 3111111113 * 6333333337 3111111113 * 6333333337 3111111113 * 6444444447 3222222223 * 6444444447 3222222223 * 6444444447 3222222223 * 6444444447 3222222223 * 6555555557 3222222223 * 6555555557 3222222223 * 6555555557 3222222223 * 6555555557 3222222223 * */ #define XK_CAPTCHA_THRESHOLD 200 #define XK_CAPTCHA_CHARDIFFINF (24 * 10 + 1) #ifdef XK_64BIT /* 64 bit implementation */ #define is_black(x) ((uint64_t) ((x) < XK_CAPTCHA_THRESHOLD)) typedef uint64_t xk_captcha_char[4]; #else /* 32 bit implementation */ #define is_black(x) ((uint32_t) ((x) < XK_CAPTCHA_THRESHOLD)) typedef uint32_t xk_captcha_char[8]; #endif typedef xk_captcha_char xk_captcha[4]; int xk_captcha_char_diff(const xk_captcha_char p1, const xk_captcha_char p2); void xk_captcha_char_setrow(xk_captcha_char p, int row, unsigned char s[]); void xk_captcha_shift_up(xk_captcha_char p); void xk_captcha_shift_down(xk_captcha_char p); void xk_captcha_clear(xk_captcha_char p[]); void xk_captcha_setrow(xk_captcha_char p[], int row, unsigned char s[], int len); #endif
// // SSModalViewController.h // SSToolkit // // Created by Sam Soffes on 7/14/10. // Copyright 2010-2011 Sam Soffes. All rights reserved. // @class SSViewController; @protocol SSModalViewController <NSObject> @required @property (nonatomic, assign) SSViewController *modalParentViewController; @optional - (BOOL)dismissCustomModalOnVignetteTap; - (CGSize)contentSizeForViewInCustomModal; - (CGPoint)originOffsetForViewInCustomModal; @end
// // OATopTextView.h // OsmAnd // // Created by Alexey Kulish on 13/11/2017. // Copyright © 2017 OsmAnd. All rights reserved. // #import <UIKit/UIKit.h> @class OATopTextView; @protocol OATopTextViewListener <NSObject> @required - (void) topTextViewChanged:(OATopTextView *)topTextView; - (void) topTextViewVisibilityChanged:(OATopTextView *)topTextView visible:(BOOL)visible; - (void) topTextViewClicked:(OATopTextView *)topTextView; @end @interface OATopTextView : UIView @property (nonatomic, weak) id<OATopTextViewListener> delegate; - (void) updateTextColor:(UIColor *)textColor textShadowColor:(UIColor *)textShadowColor bold:(BOOL)bold shadowRadius:(float)shadowRadius nightMode:(BOOL)nightMode; - (BOOL) updateInfo; @end
// // MDRadialProgressView.h // MDRadialProgress // // // Copyright (c) 2013 Marco Dinacci. All rights reserved. #import <UIKit/UIKit.h> static NSString *keyThickness = @"theme.thickness"; @class MDRadialProgressTheme; @class MDRadialProgressLabel; @interface MDRadialProgressView : UIView - (id)initWithFrame:(CGRect)frame andTheme:(MDRadialProgressTheme *)theme; // The total number of steps in the progress view. @property (assign, nonatomic) NSUInteger progressTotal; // The number of steps currently completed. @property (assign, nonatomic) NSUInteger progressCounter; // Whether the progress is drawn clockwise (YES) or anticlockwise (NO) @property (assign, nonatomic) BOOL clockwise; // The index of the slice where the first completed step is. @property (assign, nonatomic) NSUInteger startingSlice; // The theme currently used @property (strong, nonatomic) MDRadialProgressTheme *theme; // The label shown in the view's center. @property (strong, nonatomic) MDRadialProgressLabel *label; // The block that is used to update the label text when the progress changes. @property (nonatomic, copy) NSString *(^labelTextBlock)(MDRadialProgressView *progressView); @end
// // ______ _ _ _ _____ _____ _ __ // | ____| | | (_) | | / ____| __ \| |/ / // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ // // // Copyright © 2015 Estimote. All rights reserved. #import <Foundation/Foundation.h> #import "ESTBeaconOperationProtocol.h" #import "ESTSettingOperation.h" #import "ESTSettingEddystoneURLInterval.h" NS_ASSUME_NONNULL_BEGIN /** * ESTBeaconOperationEddystoneURLInterval allows to create read/write operations for Eddystone URL Interval setting of a device. */ @interface ESTBeaconOperationEddystoneURLInterval : ESTSettingOperation <ESTBeaconOperationProtocol> /** * Method allows to create read operation for Eddystone URL Interval setting. * * @param completion Block invoked when the operation is complete. * * @return Initialized object. */ + (instancetype)readOperationWithCompletion:(ESTSettingEddystoneURLIntervalCompletionBlock)completion; /** * Method allows to create write operation for Eddystone URL Interval setting. * * @param setting Setting to be written to a device. * @param completion Block invoked when the operation is complete. * * @return Initialized object. */ + (instancetype)writeOperationWithSetting:(ESTSettingEddystoneURLInterval *)setting completion:(ESTSettingEddystoneURLIntervalCompletionBlock)completion; @end NS_ASSUME_NONNULL_END
#pragma once #include "MemoryTile.h" #include "Lights.h" #define ENABLE_DEBUG_MEMORY_FIELD_HITS 0 class CMemoryField : public ISceneObject { public: CMemoryField(); // ISceneObject interface void Update(float dt) final; void Draw() const final; void Activate(const CRay &ray); unsigned GetTileCount()const; unsigned GetTotalScore()const; private: void GenerateTiles(); void CheckTilesPair(std::pair<size_t, size_t> indicies); CFloatRect GetImageFrameRect(TileImage image)const; CPhongModelMaterial m_material; CTexture2DAtlas m_atlas; std::vector<CMemoryTile> m_tiles; unsigned m_totalScore = 0; #if ENABLE_DEBUG_MEMORY_FIELD_HITS std::vector<glm::vec3> m_hits; #endif };
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import <IDEKit/IDEEditor.h> @class DVTStackView_AppKitAutolayout, IDEDebugGaugeReportTopSection, IDELaunchSession, NSLayoutConstraint, NSScrollView; @interface IDEDebugGaugeReportEditor : IDEEditor { IDELaunchSession *_launchSession; IDEDebugGaugeReportTopSection *_reportTopSection; id <IDEDebugGaugeReportContentDelegate> _contentDelegate; id <IDEDebugGaugeReportTopSectionContentDelegate> _topSectionContentDelegate; double _minimumWidth; NSScrollView *_mainContentScrollView; DVTStackView_AppKitAutolayout *_stackView; NSLayoutConstraint *_stackViewHeightConstraintToBeRemoved; NSLayoutConstraint *_minimumWidthConstraint; } + (void)_profileWithToolIdentifer:(id)arg1 detachOrNew:(unsigned long long)arg2 launchSession:(id)arg3; - (void).cxx_destruct; - (void)_fixUpScrollView; - (void)_handleContentDelegateDidChange; - (void)attachInstrumentsWithToolIdentifer:(id)arg1; @property(retain, nonatomic) id <IDEDebugGaugeReportContentDelegate> contentDelegate; // @synthesize contentDelegate=_contentDelegate; - (id)initWithNibName:(id)arg1 bundle:(id)arg2 document:(id)arg3; - (id)launchSession; - (void)loadView; @property __weak NSScrollView *mainContentScrollView; // @synthesize mainContentScrollView=_mainContentScrollView; @property(readonly) double minimumWidth; // @synthesize minimumWidth=_minimumWidth; @property __weak NSLayoutConstraint *minimumWidthConstraint; // @synthesize minimumWidthConstraint=_minimumWidthConstraint; - (void)primitiveInvalidate; @property __weak DVTStackView_AppKitAutolayout *stackView; // @synthesize stackView=_stackView; @property __weak NSLayoutConstraint *stackViewHeightConstraintToBeRemoved; // @synthesize stackViewHeightConstraintToBeRemoved=_stackViewHeightConstraintToBeRemoved; @end
/// /// Copyright (c) 2020 Dropbox, Inc. All rights reserved. /// #import <Foundation/Foundation.h> @class DBOAuthResult; NS_ASSUME_NONNULL_BEGIN /// Callback block for oauth result. typedef void (^DBOAuthCompletion)(DBOAuthResult *_Nullable); NS_ASSUME_NONNULL_END
// // NSObject+Aspect.h // NSObject+Aspect // // Created by Ryoichi Izumita on 2013/03/03. // Copyright (c) 2013年 Ryoichi Izumita. All rights reserved. // #import <Foundation/Foundation.h> @interface NSObject (Aspect) + (BOOL)injectBlock:(id)block beforeSelector:(SEL)selector; + (BOOL)injectBlock:(id)block afterSelector:(SEL)selector; + (void)separateBeforeBlockFromSelector:(SEL)selector; + (void)separateAfterBlockFromSelector:(SEL)selector; @end
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; int main(int argc , char *argv[] ) { unsigned int input[1] ; unsigned int output[1] ; int randomFuns_i5 ; unsigned int randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 4242424242U) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void megaInit(void) { { } } void RandomFunc(unsigned int input[1] , unsigned int output[1] ) { unsigned int state[1] ; unsigned int local2 ; unsigned int local1 ; unsigned short copy11 ; { state[0UL] = (input[0UL] + 51238316UL) + 274866410U; local1 = 0UL; while (local1 < 1UL) { local2 = 0UL; while (local2 < 1UL) { copy11 = *((unsigned short *)(& state[local2]) + 1); *((unsigned short *)(& state[local2]) + 1) = *((unsigned short *)(& state[local2]) + 0); *((unsigned short *)(& state[local2]) + 0) = copy11; local2 ++; } local1 += 2UL; } output[0UL] = state[0UL] - 724560680UL; } }
// // Created by Andrew Podkovyrin // Copyright © 2019 Dash Core Group. All rights reserved. // // Licensed under the MIT License (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://opensource.org/licenses/MIT // // 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 <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @class DWRecoverModel; @class DWRecoverContentView; @protocol DWRecoverContentViewDelegate <NSObject> - (void)recoverContentView:(DWRecoverContentView *)view showIncorrectWord:(NSString *)incorrectWord; - (void)recoverContentView:(DWRecoverContentView *)view offerToReplaceIncorrectWord:(NSString *)incorrectWord inPhrase:(NSString *)phrase; - (void)recoverContentView:(DWRecoverContentView *)view usedWordsHaveInvalidCount:(NSArray *)words; - (void)recoverContentViewBadRecoveryPhrase:(DWRecoverContentView *)view; - (void)recoverContentViewDidRecoverWallet:(DWRecoverContentView *)view phrase:(NSString *)phrase; - (void)recoverContentViewPerformWipe:(DWRecoverContentView *)view; - (void)recoverContentViewWipeNotAllowed:(DWRecoverContentView *)view; - (void)recoverContentViewWipeNotAllowedPhraseMismatch:(DWRecoverContentView *)view; @end @interface DWRecoverContentView : UIView @property (nonatomic, strong) DWRecoverModel *model; @property (nonatomic, assign) CGSize visibleSize; @property (nullable, nonatomic, copy) NSString *title; @property (nullable, nonatomic, weak) id<DWRecoverContentViewDelegate> delegate; - (void)activateTextView; - (void)continueAction; - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; - (void)appendText:(NSString *)text; - (void)replaceText:(NSString *)target replacement:(NSString *)replacement; @end NS_ASSUME_NONNULL_END
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "ISOperationDelegate-Protocol.h" @class ISURLOperation, NSMutableURLRequest, NSURLResponse; @protocol ISURLOperationDelegate <ISOperationDelegate> @optional - (void)operation:(ISURLOperation *)arg1 willSendRequest:(NSMutableURLRequest *)arg2; - (void)operation:(ISURLOperation *)arg1 didReceiveResponse:(NSURLResponse *)arg2; - (void)operation:(ISURLOperation *)arg1 finishedWithOutput:(id)arg2; @end
#include "Queue.c"
#ifndef WALLETMODEL_H #define WALLETMODEL_H #include <QObject> #include <vector> #include <map> #include "allocators.h" /* for SecureString */ class OptionsModel; class AddressTableModel; class TransactionTableModel; class CWallet; class CKeyID; class CPubKey; class COutput; class COutPoint; class CScript; class CWalletTx; class uint256; class CCoinControl; QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE class SendCoinsRecipient { public: QString address; QString label; qint64 amount; }; /** Interface to Bitcoin wallet from Qt view code. */ class WalletModel : public QObject { Q_OBJECT public: explicit WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0); ~WalletModel(); enum StatusCode // Returned by sendCoins { OK, InvalidAmount, InvalidAddress, AmountExceedsBalance, AmountWithFeeExceedsBalance, DuplicateAddress, TransactionCreationFailed, // Error returned when wallet is still locked TransactionCommitFailed, Aborted }; enum EncryptionStatus { Unencrypted, // !wallet->IsCrypted() Locked, // wallet->IsCrypted() && wallet->IsLocked() Unlocked // wallet->IsCrypted() && !wallet->IsLocked() }; OptionsModel *getOptionsModel(); AddressTableModel *getAddressTableModel(); TransactionTableModel *getTransactionTableModel(); qint64 getBalance() const; qint64 getStake() const; qint64 getUnconfirmedBalance() const; qint64 getImmatureBalance() const; int getNumTransactions() const; EncryptionStatus getEncryptionStatus() const; // Check address for validity bool validateAddress(const QString &address); // Return status record for SendCoins, contains error id + information struct SendCoinsReturn { SendCoinsReturn(StatusCode status=Aborted, qint64 fee=0, QString hex=QString()): status(status), fee(fee), hex(hex) {} StatusCode status; qint64 fee; // is used in case status is "AmountWithFeeExceedsBalance" QString hex; // is filled with the transaction hash if status is "OK" }; // Send coins to a list of recipients SendCoinsReturn sendCoins(const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl=NULL); // Wallet encryption bool setWalletEncrypted(bool encrypted, const SecureString &passphrase); // Passphrase only needed when unlocking bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString()); bool changePassphrase(const SecureString &oldPass, const SecureString &newPass); // Wallet backup bool backupWallet(const QString &filename); // RAI object for unlocking wallet, returned by requestUnlock() class UnlockContext { public: UnlockContext(WalletModel *wallet, bool valid, bool relock); ~UnlockContext(); bool isValid() const { return valid; } // Copy operator and constructor transfer the context UnlockContext(const UnlockContext& obj) { CopyFrom(obj); } UnlockContext& operator=(const UnlockContext& rhs) { CopyFrom(rhs); return *this; } private: WalletModel *wallet; bool valid; mutable bool relock; // mutable, as it can be set to false by copying void CopyFrom(const UnlockContext& rhs); }; UnlockContext requestUnlock(); bool getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const; void getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs); void listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const; bool isLockedCoin(uint256 hash, unsigned int n) const; void lockCoin(COutPoint& output); void unlockCoin(COutPoint& output); void listLockedCoins(std::vector<COutPoint>& vOutpts); private: CWallet *wallet; // Wallet has an options model for wallet-specific options // (transaction fee, for example) OptionsModel *optionsModel; AddressTableModel *addressTableModel; TransactionTableModel *transactionTableModel; // Cache some values to be able to detect changes qint64 cachedBalance; qint64 cachedStake; qint64 cachedUnconfirmedBalance; qint64 cachedImmatureBalance; qint64 cachedNumTransactions; EncryptionStatus cachedEncryptionStatus; int cachedNumBlocks; QTimer *pollTimer; void subscribeToCoreSignals(); void unsubscribeFromCoreSignals(); void checkBalanceChanged(); SendCoinsReturn sendCoinsNormal(const QList<SendCoinsRecipient> &recipients, int64_t balance, int64_t total, const CCoinControl *coinControl=NULL); public slots: /* Wallet status might have changed */ void updateStatus(); /* New transaction, or transaction changed status */ void updateTransaction(const QString &hash, int status); /* New, updated or removed address book entry */ void updateAddressBook(const QString &address, const QString &label, bool isMine, int status); /* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */ void pollBalanceChanged(); signals: // Signal that balance in wallet changed void balanceChanged(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance); // Number of transactions in wallet changed void numTransactionsChanged(int count); // Encryption status of wallet changed void encryptionStatusChanged(int status); // Signal emitted when wallet needs to be unlocked // It is valid behaviour for listeners to keep the wallet locked after this signal; // this means that the unlocking failed or was cancelled. void requireUnlock(); // Asynchronous error notification void error(const QString &title, const QString &message, bool modal); }; #endif // WALLETMODEL_H
/* SCSP LFO handling Part of the SCSP (YMF292-F) emulator package. (not compiled directly, #included from scsp.c) By ElSemi MAME/M1 conversion and cleanup by R. Belmont */ #define LFO_SHIFT 8 struct _LFO { unsigned short phase; UINT32 phase_step; int *table; int *scale; }; #define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v))) //Convert DB to multiply amplitude #define DB(v) LFIX(pow(10.0,v/20.0)) //Convert cents to step increment #define CENTS(v) LFIX(pow(2.0,v/1200.0)) static int PLFO_TRI[256],PLFO_SQR[256],PLFO_SAW[256],PLFO_NOI[256]; static int ALFO_TRI[256],ALFO_SQR[256],ALFO_SAW[256],ALFO_NOI[256]; static float LFOFreq[32]={0.17,0.19,0.23,0.27,0.34,0.39,0.45,0.55,0.68,0.78,0.92,1.10,1.39,1.60,1.87,2.27, 2.87,3.31,3.92,4.79,6.15,7.18,8.60,10.8,14.4,17.2,21.5,28.7,43.1,57.4,86.1,172.3}; static float ASCALE[8]={0.0,0.4,0.8,1.5,3.0,6.0,12.0,24.0}; static float PSCALE[8]={0.0,7.0,13.5,27.0,55.0,112.0,230.0,494}; static int PSCALES[8][256]; static int ASCALES[8][256]; void LFO_Init(void) { int i,s; for(i=0;i<256;++i) { int a,p; // float TL; //Saw a=255-i; if(i<128) p=i; else p=i-256; ALFO_SAW[i]=a; PLFO_SAW[i]=p; //Square if(i<128) { a=255; p=127; } else { a=0; p=-128; } ALFO_SQR[i]=a; PLFO_SQR[i]=p; //Tri if(i<128) a=255-(i*2); else a=(i*2)-256; if(i<64) p=i*2; else if(i<128) p=255-i*2; else if(i<192) p=256-i*2; else p=i*2-511; ALFO_TRI[i]=a; PLFO_TRI[i]=p; //noise //a=lfo_noise[i]; a=rand()&0xff; p=128-a; ALFO_NOI[i]=a; PLFO_NOI[i]=p; } for(s=0;s<8;++s) { float limit=PSCALE[s]; for(i=-128;i<128;++i) { PSCALES[s][i+128]=CENTS(((limit*(float) i)/128.0)); } limit=-ASCALE[s]; for(i=0;i<256;++i) { ASCALES[s][i]=DB(((limit*(float) i)/256.0)); } } } signed int INLINE PLFO_Step(struct _LFO *LFO) { int p; LFO->phase+=LFO->phase_step; #if LFO_SHIFT!=8 LFO->phase&=(1<<(LFO_SHIFT+8))-1; #endif p=LFO->table[LFO->phase>>LFO_SHIFT]; p=LFO->scale[p+128]; return p<<(SHIFT-LFO_SHIFT); } signed int INLINE ALFO_Step(struct _LFO *LFO) { int p; LFO->phase+=LFO->phase_step; #if LFO_SHIFT!=8 LFO->phase&=(1<<(LFO_SHIFT+8))-1; #endif p=LFO->table[LFO->phase>>LFO_SHIFT]; p=LFO->scale[p]; return p<<(SHIFT-LFO_SHIFT); } void LFO_ComputeStep(struct _LFO *LFO,UINT32 LFOF,UINT32 LFOWS,UINT32 LFOS,int ALFO) { float step=(float) LFOFreq[LFOF]*256.0/(float)44100.0; LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step); if(ALFO) { switch(LFOWS) { case 0: LFO->table=ALFO_SAW; break; case 1: LFO->table=ALFO_SQR; break; case 2: LFO->table=ALFO_TRI; break; case 3: LFO->table=ALFO_NOI; break; } LFO->scale=ASCALES[LFOS]; } else { switch(LFOWS) { case 0: LFO->table=PLFO_SAW; break; case 1: LFO->table=PLFO_SQR; break; case 2: LFO->table=PLFO_TRI; break; case 3: LFO->table=PLFO_NOI; break; } LFO->scale=PSCALES[LFOS]; } }
// // SecondTableView.h // NinaPagerView // // Created by RamWire on 16/5/10. // Copyright © 2016年 RamWire. All rights reserved. // #import <UIKit/UIKit.h> @interface SecondTableView : UITableView @end
// // BrowserWrapper.h // passably-connected // // // Created by Yvan Scher on 10/7/14. // Copyright (c) 2014 Yvan Scher. All rights reserved. // #import <MultipeerConnectivity/MultipeerConnectivity.h> @protocol BrowserWrapperDelegate <NSObject> -(void) inviteFoundPeer:(MCPeerID *)foreignPeerID; -(void) failedToBrowse:(NSError *)error; -(void) alertToLostPeer:(MCPeerID *)lostForeignPeerID; @end @interface BrowserWrapper : NSObject <MCNearbyServiceBrowserDelegate>{ } @property (nonatomic, readonly) BOOL browsing; @property (nonatomic) id <BrowserWrapperDelegate> browserDelegate; @property (nonatomic, readonly) MCNearbyServiceBrowser *autobrowser; -(void) stopBrowsing; -(void) restartBrowsing; -(instancetype) startBrowsing:(MCPeerID *)myPeerID; @end
// // CocoaPropertyEnumerator.h // CocoaDebugKit // // Created by Patrick Kladek on 25.04.16. // Copyright (c) 2016 Patrick Kladek. All rights reserved. // #import <Foundation/Foundation.h> @interface CocoaPropertyEnumerator : NSObject - (void)enumeratePropertiesFromClass:(Class)objectClass allowed:(NSArray *)allowed block:(void (^)(NSString *type, NSString *name))callbackBlock; - (NSString *)propertyTypeFromName:(NSString *)name object:(NSObject *)obj; @end
// // DropView.h // AirMock // // Created by 徐 楽楽 on 11/01/30. // Copyright 2011 RakuRaku Technologies. All rights reserved. // #import <Cocoa/Cocoa.h> @interface DropAppView : NSView { NSButton *dropButton; NSBox *box; NSProgressIndicator *indicator; } @property (assign) IBOutlet NSButton *dropButton; @property (assign) IBOutlet NSBox *box; @property (assign) IBOutlet NSProgressIndicator *indicator; - (IBAction)chooseApp:(id)sender; - (BOOL)openFile:(NSString *)file; @end
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #pragma once namespace Js { class JavascriptBoolean sealed : public RecyclableObject { private: Field(BOOL) value; DEFINE_VTABLE_CTOR(JavascriptBoolean, RecyclableObject); public: JavascriptBoolean(BOOL val, StaticType * type) : RecyclableObject(type), value(val) { Assert(type->GetTypeId() == TypeIds_Boolean); } inline BOOL GetValue() { return value; } static Var ToVar(BOOL fValue,ScriptContext* scriptContext); class EntryInfo { public: static FunctionInfo NewInstance; static FunctionInfo ValueOf; static FunctionInfo ToString; }; static Var NewInstance(RecyclableObject* function, CallInfo callInfo, ...); static Var EntryValueOf(RecyclableObject* function, CallInfo callInfo, ...); static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...); static Var OP_LdTrue(ScriptContext* scriptContext); static Var OP_LdFalse(ScriptContext* scriptContext); virtual BOOL Equals(Var other, BOOL* value, ScriptContext * requestContext) override; virtual BOOL GetDiagValueString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext) override; virtual BOOL GetDiagTypeString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext) override; virtual RecyclableObject* ToObject(ScriptContext * requestContext) override; virtual Var GetTypeOfString(ScriptContext * requestContext) override; // should never be called, JavascriptConversion::ToPrimitive() short-circuits and returns input value virtual BOOL ToPrimitive(JavascriptHint hint, Var* value, ScriptContext* requestContext) override {AssertMsg(false, "Boolean ToPrimitive should not be called"); *value = this; return true;} virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override; public: virtual VTableValue DummyVirtualFunctionToHinderLinkerICF() { return VTableValue::VtableJavascriptBoolean; } private: static BOOL Equals(JavascriptBoolean* left, Var right, BOOL* value, ScriptContext * requestContext); static Var TryInvokeRemotelyOrThrow(JavascriptMethod entryPoint, ScriptContext * scriptContext, Arguments & args, int32 errorCode, PCWSTR varName); }; template <> inline bool VarIsImpl<JavascriptBoolean>(RecyclableObject* obj) { return JavascriptOperators::GetTypeId(obj) == TypeIds_Boolean; } }
#ifndef HAAPA_FS_H #define HAAPA_FS_H #include "result.h" typedef struct fs_response { union { struct { long total_space; long free_space; long used_space; }; unsigned long long_max[4]; }; int fs_useless_var; } fs_response; void _fs_reset(); int _fs_update(); Result *fs_total(char *path); Result *fs_free(char *path); Result *fs_used(char *path); #endif
//////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2013 by Rich Sposato // Code covered by the MIT 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. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_MACRO_CONCATENATE_INC_ #define LOKI_MACRO_CONCATENATE_INC_ // $Id$ /** @note This header file provides a common definition of macros used to concatenate names or numbers together into a single name or number. */ #define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2 #define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2) #endif
// // FKFlickrBlogsGetList.h // FlickrKit // // Generated by FKAPIBuilder on 12 Jun, 2013 at 17:19. // Copyright (c) 2013 DevedUp Ltd. All rights reserved. http://www.devedup.com // // DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED #import "FKFlickrAPIMethod.h" typedef enum { FKFlickrBlogsGetListError_InvalidSignature = 96, /* The passed signature was invalid. */ FKFlickrBlogsGetListError_MissingSignature = 97, /* The call required signing but no signature was sent. */ FKFlickrBlogsGetListError_LoginFailedOrInvalidAuthToken = 98, /* The login details or auth token passed were invalid. */ FKFlickrBlogsGetListError_UserNotLoggedInOrInsufficientPermissions = 99, /* The method requires user authentication but the user was not logged in, or the authenticated method call did not have the required permissions. */ FKFlickrBlogsGetListError_InvalidAPIKey = 100, /* The API key passed was not valid or has expired. */ FKFlickrBlogsGetListError_ServiceCurrentlyUnavailable = 105, /* The requested service is temporarily unavailable. */ FKFlickrBlogsGetListError_FormatXXXNotFound = 111, /* The requested response format was not found. */ FKFlickrBlogsGetListError_MethodXXXNotFound = 112, /* The requested method was not found. */ FKFlickrBlogsGetListError_InvalidSOAPEnvelope = 114, /* The SOAP envelope send in the request could not be parsed. */ FKFlickrBlogsGetListError_InvalidXMLRPCMethodCall = 115, /* The XML-RPC request document could not be parsed. */ FKFlickrBlogsGetListError_BadURLFound = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */ } FKFlickrBlogsGetListError; /* Get a list of configured blogs for the calling user. <p>The <code>needspassword</code> attribute indicates whether a call to <code>flickr.blogs.postPhoto</code> for this blog will require a password to be sent. When flickr has a password already stored, <code>needspassword</code> is 0</p> Response: <blogs> <blog id="73" name="Bloxus test" needspassword="0" url="http://remote.bloxus.com/" /> <blog id="74" name="Manila Test" needspassword="1" url="http://flickrtest1.userland.com/" /> </blogs> */ @interface FKFlickrBlogsGetList : NSObject <FKFlickrAPIMethod> /* Optionally only return blogs for a given service id. You can get a list of from <a href="/services/api/flickr.blogs.getServices.html">flickr.blogs.getServices()</a>. */ @property (nonatomic, strong) NSString *service; @end
// // AppDelegate.h // XHFaceRecognizerSDKSimple // // Created by 曾 宪华 on 13-12-26. // Copyright (c) 2013年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // ConfigurationService.h // ScanTest // // Created by jTribe - love your apps on 29/07/12. // // // TODO: why is that a singleton? Could it not just be a set of class methods? #import "JTSingleton.h" @interface JTSettingsService : NSObject + (JTSettingsService*) sharedInstance; + (NSString *) stringForKey:(NSString*)key defaultValue:(NSString*)defaultString; + (NSString *) serverBaseURLStringWithDefault:(NSString*)serverBaseURLString; + (void) addServerBaseURLString:(NSString*)serverBaseURLString; @end
/* * Copyright 2017 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #import <Foundation/Foundation.h> #import "RTCMacros.h" #import "RTCVideoDecoderFactory.h" NS_ASSUME_NONNULL_BEGIN /** This decoder factory include support for all codecs bundled with WebRTC. If using custom * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory. */ RTC_OBJC_EXPORT @interface RTCDefaultVideoDecoderFactory : NSObject <RTCVideoDecoderFactory> @end NS_ASSUME_NONNULL_END
/* * The MIT License (MIT) * * Copyright (c) 2014, Manh Nguyen Tien - manhnt.9@outlook.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef DOCS_H #define DOCS_H #include <QString> #include <QVector> struct baseDoc { baseDoc(); ~baseDoc(); QString name; QString original; QString date; QString group; QString link; QVector <QString> paths; }; class Docs { public: Docs(); ~Docs(); bool import(); bool update(QVector <baseDoc>* vec); QString getError(); QVector <baseDoc> container; private: QString storage; QString errorText; }; #endif // DOCS_H
#pragma once #include <string> #include <vector> #include <set> #include <map> #include <cmath> using namespace std; class User { public: User(int id, string name); int id; string name; vector<User*> followerList; vector<User*> followeeList; }; class Post { public: int id; int postTime; int contentLength; string name; string content; string source; User* user; Post* repostFrom; Post* sourcePost; vector<Post*> retweetList; Post(int id, string name); }; class DataLoader { public: int TIME_STEP; vector<string> newInputs; vector<User*> userList; vector<Post*> postList; vector<int> sourceList; set<string> activeUserSet; map<int, int> sourceMap; map<string, int> userIdMap; map<string, int> postIdMap; DataLoader(); int LoadData(string networkFile, string postFile); int LoadNetwork(string fileDir); int LoadContent(string fileDir); int LoadDiffusion(string fileDir); int GetSourceId(const int key); int GetUserId(const string& key); int GetPostId(const string& key); int GetOrInsertSourceId(const int key); int GetOrInsertUserId(const string& key); int GetOrInsertPostId(const string& key); };
// // SocketIOPacket.h // v0.4.0.1 ARC // // based on // socketio-cocoa https://github.com/fpotter/socketio-cocoa // by Fred Potter <fpotter@pieceable.com> // // using // https://github.com/square/SocketRocket // https://github.com/stig/json-framework/ // // reusing some parts of // /socket.io/socket.io.js // // Created by Philipp Kyeck http://beta-interactive.de // // Updated by // samlown https://github.com/samlown // kayleg https://github.com/kayleg // taiyangc https://github.com/taiyangc // #import <Foundation/Foundation.h> @interface SocketIOPacket : NSObject { NSString *type; NSString *pId; NSString *ack; NSString *name; NSString *data; NSArray *args; NSString *endpoint; NSArray *_types; } @property (nonatomic, copy) NSString *type; @property (nonatomic, copy) NSString *pId; @property (nonatomic, copy) NSString *ack; @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *data; @property (nonatomic, copy) NSString *endpoint; @property (nonatomic, copy) NSArray *args; - (id) initWithType:(NSString *)packetType; - (id) initWithTypeIndex:(int)index; - (id) dataAsJSON; - (NSNumber *) typeAsNumber; - (NSString *) typeForIndex:(int)index; @end
#ifndef SPLITHC_H #define SPLITHC_H #define aConst 10 #endif
#pragma once /* * Copyright (C) 2013 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "DVDDemux.h" #ifdef TARGET_WINDOWS #define __attribute__(dummy_val) #else #include <config.h> #endif class CDemuxStreamAudioCDDA; class CDVDDemuxCDDA : public CDVDDemux { public: CDVDDemuxCDDA(); ~CDVDDemuxCDDA(); bool Open(CDVDInputStream* pInput); void Dispose(); void Reset(); void Abort(); void Flush(); DemuxPacket* Read(); bool SeekTime(int time, bool backwords = false, double* startpts = NULL) { return false; }; void SetSpeed(int iSpeed) {}; int GetStreamLength() ; CDemuxStream* GetStream(int iStreamId); int GetNrOfStreams(); std::string GetFileName(); virtual void GetStreamCodecName(int iStreamId, CStdString &strName); protected: friend class CDemuxStreamAudioCDDA; CDVDInputStream* m_pInput; int64_t m_bytes; CDemuxStreamAudioCDDA *m_stream; };