text
stringlengths
4
6.14k
#ifndef _TIME_H #define _TIME_H #ifndef _TIME_T #define _TIME_T typedef long time_t; // 从GMT 1970 年1 月1 日开始的以秒计数的时间(日历时间)。 #endif #ifndef _SIZE_T #define _SIZE_T typedef unsigned int size_t; #endif #define CLOCKS_PER_SEC 100 // 系统时钟滴答频率,100HZ。 typedef long clock_t; // 从进程开始系统经过的时钟滴答数。 struct tm { int tm_sec; // 秒数 [0,59]。 int tm_min; // 分钟数 [ 0,59]。 int tm_hour; // 小时数 [0,59]。 int tm_mday; // 1 个月的天数 [0,31]。 int tm_mon; // 1 年中月份 [0,11]。 int tm_year; // 从1900 年开始的年数。 int tm_wday; // 1 星期中的某天 [0,6](星期天 =0)。 int tm_yday; // 1 年中的某天 [0,365]。 int tm_isdst; // 夏令时标志。 }; // 以下是有关时间操作的函数原型。 // 确定处理器使用时间。返回程序所用处理器时间(滴答数)的近似值。 clock_t clock (void); // 取时间(秒数)。返回从1970.1.1:0:0:0 开始的秒数(称为日历时间)。 time_t time (time_t * tp); // 计算时间差。返回时间time2 与time1 之间经过的秒数。 double difftime (time_t time2, time_t time1); // 将tm 结构表示的时间转换成日历时间。 time_t mktime (struct tm *tp); // 将tm 结构表示的时间转换成一个字符串。返回指向该串的指针。 char *asctime (const struct tm *tp); // 将日历时间转换成一个字符串形式,如“Wed Jun 30 21:49:08:1993\n”。 char *ctime (const time_t * tp); // 将日历时间转换成tm 结构表示的UTC 时间(UTC - 世界时间代码Universal Time Code)。 struct tm *gmtime (const time_t * tp); // 将日历时间转换成tm 结构表示的指定时间区(timezone)的时间。 struct tm *localtime (const time_t * tp); // 将tm 结构表示的时间利用格式字符串fmt 转换成最大长度为smax 的字符串并将结果存储在s 中。 size_t strftime (char *s, size_t smax, const char *fmt, const struct tm *tp); // 初始化时间转换信息,使用环境变量TZ,对zname 变量进行初始化。 // 在与时间区相关的时间转换函数中将自动调用该函数。 void tzset (void); #endif
#ifndef _WIMLIB_WIN32_COMMON_H #define _WIMLIB_WIN32_COMMON_H #include <ntstatus.h> #include <windows.h> #include <winternl.h> #ifdef ERROR # undef ERROR #endif #include "wimlib/types.h" #include "wimlib/win32.h" /* ntdll functions */ extern NTSTATUS (WINAPI *func_NtCreateFile)(PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, PLARGE_INTEGER AllocationSize, ULONG FileAttributes, ULONG ShareAccess, ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength); #ifndef FILE_OPENED # define FILE_OPENED 0x00000001 #endif extern NTSTATUS (WINAPI *func_NtOpenFile) (PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, ULONG ShareAccess, ULONG OpenOptions); extern NTSTATUS (WINAPI *func_NtReadFile) (HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key); extern NTSTATUS (WINAPI *func_NtWriteFile) (HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key); extern NTSTATUS (WINAPI *func_NtQueryInformationFile)(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass); extern NTSTATUS (WINAPI *func_NtQuerySecurityObject)(HANDLE handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG Length, PULONG LengthNeeded); extern NTSTATUS (WINAPI *func_NtQueryDirectoryFile) (HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass, BOOLEAN ReturnSingleEntry, PUNICODE_STRING FileName, BOOLEAN RestartScan); extern NTSTATUS (WINAPI *func_NtQueryVolumeInformationFile) (HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass); extern NTSTATUS (WINAPI *func_NtSetInformationFile)(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass); extern NTSTATUS (WINAPI *func_NtSetSecurityObject)(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor); extern NTSTATUS (WINAPI *func_NtFsControlFile) (HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength); extern NTSTATUS (WINAPI *func_NtClose) (HANDLE Handle); extern DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status); typedef struct _RTLP_CURDIR_REF { LONG RefCount; HANDLE Handle; } RTLP_CURDIR_REF, *PRTLP_CURDIR_REF; typedef struct _RTL_RELATIVE_NAME_U { UNICODE_STRING RelativeName; HANDLE ContainingDirectory; PRTLP_CURDIR_REF CurDirRef; } RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U; extern BOOLEAN (WINAPI *func_RtlDosPathNameToNtPathName_U) (IN PCWSTR DosName, OUT PUNICODE_STRING NtName, OUT PCWSTR *PartName, OUT PRTL_RELATIVE_NAME_U RelativeName); extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus) (IN PCWSTR DosName, OUT PUNICODE_STRING NtName, OUT PCWSTR *PartName, OUT PRTL_RELATIVE_NAME_U RelativeName); extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder) (PCUNICODE_STRING VolumeRootPath); #define FSCTL_SET_PERSISTENT_VOLUME_STATE 0x90238 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED 0x00000001 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION { ULONG VolumeFlags; ULONG FlagMask; ULONG Version; ULONG Reserved; } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION; extern int win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path); extern int win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]); extern void win32_warning(DWORD err, const wchar_t *format, ...) _cold_attribute; extern void win32_error(DWORD err, const wchar_t *format, ...) _cold_attribute; extern void winnt_warning(NTSTATUS status, const wchar_t *format, ...) _cold_attribute; extern void winnt_error(NTSTATUS status, const wchar_t *format, ...) _cold_attribute; #endif /* _WIMLIB_WIN32_COMMON_H */
#ifndef PLEXY_GOOGLEWEATHER_I #define PLEXY_GOOGLEWEATHER_I #include <plexy.h> #include <abstractplugininterface.h> #include <datainterface.h> #include <widgetinterface.h> class VISIBLE_SYM googleweatherInterface : public PlexyDesk::AbstractPluginInterface { Q_OBJECT Q_INTERFACES(PlexyDesk::AbstractPluginInterface) public : googleweatherInterface(QObject *object = 0); PlexyDesk::BasePlugin *instance (); }; #endif
/*===========================================================================*/ /* */ /* This file is part of the SYMPHONY MILP Solver Framework. */ /* */ /* SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and */ /* Laci Ladanyi (ladanyi@us.ibm.com). */ /* */ /* (c) Copyright 2000-2011 Ted Ralphs. All Rights Reserved. */ /* */ /* This software is licensed under the Eclipse Public License. Please see */ /* accompanying file for terms. */ /* */ /*===========================================================================*/ #ifndef _CUT_POOL_PARAMS_H #define _CUT_POOL_PARAMS_H /*===========================================================================*\ * Contains the parameters necessary for the functioning of the cut pool \*===========================================================================*/ typedef struct CP_PARAMS{ int verbosity; int warm_start; char warm_start_file_name[MAX_FILE_NAME_LENGTH +1]; int logging; char log_file_name[MAX_FILE_NAME_LENGTH +1]; int block_size; int max_size; int max_number_of_cuts; int cuts_to_check; int delete_which; int touches_until_deletion; int min_to_delete; int check_which; }cp_params; #endif
/* * Python object definition of the libvhdi disk types * * Copyright (C) 2012-2016, Joachim Metz <joachim.metz@gmail.com> * * Refer to AUTHORS for acknowledgements. * * This software is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this software. If not, see <http://www.gnu.org/licenses/>. */ #include <common.h> #include <types.h> #if defined( HAVE_STDLIB_H ) || defined( HAVE_WINAPI ) #include <stdlib.h> #endif #include "pyvhdi_disk_types.h" #include "pyvhdi_libvhdi.h" #include "pyvhdi_python.h" #include "pyvhdi_unused.h" PyTypeObject pyvhdi_disk_types_type_object = { PyVarObject_HEAD_INIT( NULL, 0 ) /* tp_name */ "pyvhdi.disk_types", /* tp_basicsize */ sizeof( pyvhdi_disk_types_t ), /* tp_itemsize */ 0, /* tp_dealloc */ (destructor) pyvhdi_disk_types_free, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ Py_TPFLAGS_DEFAULT, /* tp_doc */ "pyvhdi disk types object (wraps LIBVHDI_DISK_TYPES)", /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ (initproc) pyvhdi_disk_types_init, /* tp_alloc */ 0, /* tp_new */ 0, /* tp_free */ 0, /* tp_is_gc */ 0, /* tp_bases */ NULL, /* tp_mro */ NULL, /* tp_cache */ NULL, /* tp_subclasses */ NULL, /* tp_weaklist */ NULL, /* tp_del */ 0 }; /* Initializes the type object * Returns 1 if successful or -1 on error */ int pyvhdi_disk_types_init_type( PyTypeObject *type_object ) { PyObject *value_object = NULL; if( type_object == NULL ) { return( -1 ); } type_object->tp_dict = PyDict_New(); if( type_object->tp_dict == NULL ) { return( -1 ); } #if PY_MAJOR_VERSION >= 3 value_object = PyLong_FromLong( LIBVHDI_DISK_TYPE_FIXED ); #else value_object = PyInt_FromLong( LIBVHDI_DISK_TYPE_FIXED ); #endif if( PyDict_SetItemString( type_object->tp_dict, "FIXED", value_object ) != 0 ) { goto on_error; } #if PY_MAJOR_VERSION >= 3 value_object = PyLong_FromLong( LIBVHDI_DISK_TYPE_DYNAMIC ); #else value_object = PyInt_FromLong( LIBVHDI_DISK_TYPE_DYNAMIC ); #endif if( PyDict_SetItemString( type_object->tp_dict, "DYNAMIC", value_object ) != 0 ) { goto on_error; } #if PY_MAJOR_VERSION >= 3 value_object = PyLong_FromLong( LIBVHDI_DISK_TYPE_DIFFERENTIAL ); #else value_object = PyInt_FromLong( LIBVHDI_DISK_TYPE_DIFFERENTIAL ); #endif if( PyDict_SetItemString( type_object->tp_dict, "DIFFERENTIAL", value_object ) != 0 ) { goto on_error; } return( 1 ); on_error: if( type_object->tp_dict != NULL ) { Py_DecRef( type_object->tp_dict ); type_object->tp_dict = NULL; } return( -1 ); } /* Creates a new disk types object * Returns a Python object if successful or NULL on error */ PyObject *pyvhdi_disk_types_new( void ) { pyvhdi_disk_types_t *pyvhdi_disk_types = NULL; static char *function = "pyvhdi_disk_types_new"; pyvhdi_disk_types = PyObject_New( struct pyvhdi_disk_types, &pyvhdi_disk_types_type_object ); if( pyvhdi_disk_types == NULL ) { PyErr_Format( PyExc_MemoryError, "%s: unable to initialize disk types.", function ); goto on_error; } if( pyvhdi_disk_types_init( pyvhdi_disk_types ) != 0 ) { PyErr_Format( PyExc_MemoryError, "%s: unable to initialize disk types.", function ); goto on_error; } return( (PyObject *) pyvhdi_disk_types ); on_error: if( pyvhdi_disk_types != NULL ) { Py_DecRef( (PyObject *) pyvhdi_disk_types ); } return( NULL ); } /* Intializes a disk types object * Returns 0 if successful or -1 on error */ int pyvhdi_disk_types_init( pyvhdi_disk_types_t *pyvhdi_disk_types ) { static char *function = "pyvhdi_disk_types_init"; if( pyvhdi_disk_types == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid disk types.", function ); return( -1 ); } return( 0 ); } /* Frees a disk types object */ void pyvhdi_disk_types_free( pyvhdi_disk_types_t *pyvhdi_disk_types ) { struct _typeobject *ob_type = NULL; static char *function = "pyvhdi_disk_types_free"; if( pyvhdi_disk_types == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid disk types.", function ); return; } ob_type = Py_TYPE( pyvhdi_disk_types ); if( ob_type == NULL ) { PyErr_Format( PyExc_ValueError, "%s: missing ob_type.", function ); return; } if( ob_type->tp_free == NULL ) { PyErr_Format( PyExc_ValueError, "%s: invalid ob_type - missing tp_free.", function ); return; } ob_type->tp_free( (PyObject*) pyvhdi_disk_types ); }
static char rcsid[] = "$Id$"; /* * $TSUKUBA_Release: Omni OpenMP Compiler 3 $ * $TSUKUBA_Copyright: * PLEASE DESCRIBE LICENSE AGREEMENT HERE * $ */ /* error case of reduction 015 : * reduction ¤Ç»ØÄꤵ¤ì¤Æ operation ¤È±é»»¤¬°Û¤Ê¤ë¾ì¹ç¡£ */ #include <omp.h> #include "omni.h" int errors = 0; int thds; int rdct; main () { int i; thds = omp_get_max_threads (); if (thds == 1) { printf ("should be run this program on multi threads.\n"); exit (0); } omp_set_dynamic (0); #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct += 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct -= 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct *= 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct &= 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct |= 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct ^= 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct = rdct && 1; } #pragma omp parallel for reduction(+:rdct) for (i=0; i<thds; i++) { rdct = rdct && 1; } printf ("err_reduction 015 : FAILED, can not compile this program.\n"); return 1; }
/** ****************************************************************************** * @file TIM/TIM_7PWMOutput/stm32f4xx_it.h * @author MCD Application Team * @version V1.4.0 * @date 04-August-2014 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#include "main.h" extern "C" { EXPORT void btConstraintSolver_allSolved(btConstraintSolver* obj, const btContactSolverInfo* __unnamed0, btIDebugDraw* __unnamed1); EXPORT btConstraintSolverType btConstraintSolver_getSolverType(btConstraintSolver* obj); EXPORT void btConstraintSolver_prepareSolve(btConstraintSolver* obj, int __unnamed0, int __unnamed1); EXPORT void btConstraintSolver_reset(btConstraintSolver* obj); EXPORT btScalar btConstraintSolver_solveGroup(btConstraintSolver* obj, btCollisionObject** bodies, int numBodies, btPersistentManifold** manifold, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo* info, btIDebugDraw* debugDrawer, btDispatcher* dispatcher); EXPORT void btConstraintSolver_delete(btConstraintSolver* obj); }
#ifndef ANDROID_NDK_VERSION_H #define ANDROID_NDK_VERSION_H /** * Major vision of this NDK. * * For example: 16 for r16. */ #define __NDK_MAJOR__ 16 /** * Minor vision of this NDK. * * For example: 1 for r16b. */ #define __NDK_MINOR__ 1 /** * Beta vision of this NDK. * * For example: 1 for r16 beta 1, 0 for r16. */ #define __NDK_BETA__ 0 /** * Build number for this NDK. * * For a local development build of the NDK, this is -1. */ #define __NDK_BUILD__ 4479499 /** * Set to 1 if this is a canary build, 0 if not. */ #define __NDK_CANARY__ 0 #endif /* ANDROID_NDK_VERSION_H */
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/redshift/Redshift_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSStreamFwd.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace Redshift { namespace Model { /** * <p>Describes a cluster version, including the parameter group family and * description of the version.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ClusterVersion">AWS * API Reference</a></p> */ class AWS_REDSHIFT_API ClusterVersion { public: ClusterVersion(); ClusterVersion(const Aws::Utils::Xml::XmlNode& xmlNode); ClusterVersion& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; void OutputToStream(Aws::OStream& oStream, const char* location) const; /** * <p>The version number used by the cluster.</p> */ inline const Aws::String& GetClusterVersion() const{ return m_clusterVersion; } /** * <p>The version number used by the cluster.</p> */ inline void SetClusterVersion(const Aws::String& value) { m_clusterVersionHasBeenSet = true; m_clusterVersion = value; } /** * <p>The version number used by the cluster.</p> */ inline void SetClusterVersion(Aws::String&& value) { m_clusterVersionHasBeenSet = true; m_clusterVersion = std::move(value); } /** * <p>The version number used by the cluster.</p> */ inline void SetClusterVersion(const char* value) { m_clusterVersionHasBeenSet = true; m_clusterVersion.assign(value); } /** * <p>The version number used by the cluster.</p> */ inline ClusterVersion& WithClusterVersion(const Aws::String& value) { SetClusterVersion(value); return *this;} /** * <p>The version number used by the cluster.</p> */ inline ClusterVersion& WithClusterVersion(Aws::String&& value) { SetClusterVersion(std::move(value)); return *this;} /** * <p>The version number used by the cluster.</p> */ inline ClusterVersion& WithClusterVersion(const char* value) { SetClusterVersion(value); return *this;} /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline const Aws::String& GetClusterParameterGroupFamily() const{ return m_clusterParameterGroupFamily; } /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline void SetClusterParameterGroupFamily(const Aws::String& value) { m_clusterParameterGroupFamilyHasBeenSet = true; m_clusterParameterGroupFamily = value; } /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline void SetClusterParameterGroupFamily(Aws::String&& value) { m_clusterParameterGroupFamilyHasBeenSet = true; m_clusterParameterGroupFamily = std::move(value); } /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline void SetClusterParameterGroupFamily(const char* value) { m_clusterParameterGroupFamilyHasBeenSet = true; m_clusterParameterGroupFamily.assign(value); } /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline ClusterVersion& WithClusterParameterGroupFamily(const Aws::String& value) { SetClusterParameterGroupFamily(value); return *this;} /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline ClusterVersion& WithClusterParameterGroupFamily(Aws::String&& value) { SetClusterParameterGroupFamily(std::move(value)); return *this;} /** * <p>The name of the cluster parameter group family for the cluster.</p> */ inline ClusterVersion& WithClusterParameterGroupFamily(const char* value) { SetClusterParameterGroupFamily(value); return *this;} /** * <p>The description of the cluster version.</p> */ inline const Aws::String& GetDescription() const{ return m_description; } /** * <p>The description of the cluster version.</p> */ inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } /** * <p>The description of the cluster version.</p> */ inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } /** * <p>The description of the cluster version.</p> */ inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } /** * <p>The description of the cluster version.</p> */ inline ClusterVersion& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} /** * <p>The description of the cluster version.</p> */ inline ClusterVersion& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} /** * <p>The description of the cluster version.</p> */ inline ClusterVersion& WithDescription(const char* value) { SetDescription(value); return *this;} private: Aws::String m_clusterVersion; bool m_clusterVersionHasBeenSet; Aws::String m_clusterParameterGroupFamily; bool m_clusterParameterGroupFamilyHasBeenSet; Aws::String m_description; bool m_descriptionHasBeenSet; }; } // namespace Model } // namespace Redshift } // namespace Aws
#ifndef STRINGS_H #define STRINGS_H #endif /* STRINGS_H */
// // NSString+Contains.h // mage-ios-sdk // // #import <Foundation/Foundation.h> @interface NSString (Contains) - (BOOL)safeContainsString:(NSString*)other; @end
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef DeleteNodeTxn_h__ #define DeleteNodeTxn_h__ #include "EditTxn.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsIContent.h" #include "nsINode.h" #include "nsISupportsImpl.h" #include "nscore.h" class nsEditor; class nsRangeUpdater; /** * A transaction that deletes a single element */ class DeleteNodeTxn : public EditTxn { public: /** initialize the transaction. * @param aElement the node to delete */ nsresult Init(nsEditor* aEditor, nsINode* aNode, nsRangeUpdater* aRangeUpdater); DeleteNodeTxn(); NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTxn, EditTxn) NS_DECL_EDITTXN NS_IMETHOD RedoTransaction(); protected: /** the element to delete */ nsCOMPtr<nsINode> mNode; /** parent of node to delete */ nsCOMPtr<nsINode> mParent; /** next sibling to remember for undo/redo purposes */ nsCOMPtr<nsIContent> mRefNode; /** the editor for this transaction */ nsEditor* mEditor; /** range updater object */ nsRangeUpdater* mRangeUpdater; }; #endif
/* * UnlinkEvent.h * * Created on: May 3, 2012 * Author: augcampos */ #ifndef UNLINKEVENT_H_ #define UNLINKEVENT_H_ #include "BridgeEvent.h" namespace asteriskcpp { /** * An UnlinkEvent is triggered when a link between two voice channels is discontinued, for example, * just before call completion.<p> * It is implemented in <code>channel.c</code> * * @deprecated as of 1.0.0, use {@link org.asteriskjava.manager.event.BridgeEvent} and * {@link BridgeEvent#isUnlink()} instead */ class UnlinkEvent : public BridgeEvent { public: UnlinkEvent(const std::string & values); virtual ~UnlinkEvent(); }; } /* namespace asteriskcpp */ #endif /* UNLINKEVENT_H_ */
/* * ModSecurity, http://www.modsecurity.org/ * Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. * */ #include <iostream> #include <string> #include <vector> #include <list> #include <utility> #ifndef SRC_VARIABLES_REQBODY_ERROR_MSG_H_ #define SRC_VARIABLES_REQBODY_ERROR_MSG_H_ #include "src/variables/variable.h" namespace modsecurity { class Transaction; namespace variables { DEFINE_VARIABLE(ReqbodyErrorMsg, REQBODY_ERROR_MSG, m_variableReqbodyErrorMsg) } // namespace variables } // namespace modsecurity #endif // SRC_VARIABLES_REQBODY_ERROR_MSG_H_
//===--- UnknownSyntax.h - Swift Unknown Syntax Interface -------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_SYNTAX_UNKNOWNSYNTAX_H #define SWIFT_SYNTAX_UNKNOWNSYNTAX_H #include "swift/Syntax/SyntaxData.h" #include "swift/Syntax/Syntax.h" #include <vector> namespace swift { namespace syntax { #pragma mark unknown-syntax API /// A chunk of "unknown" syntax. /// /// Effectively wraps a tree of RawSyntax. /// /// This should not be vended by SyntaxFactory. class UnknownSyntax : public Syntax { friend struct SyntaxFactory; friend class Syntax; virtual void validate() const override; public: UnknownSyntax(const RC<SyntaxData> Root, const SyntaxData *Data) : Syntax(Root, Data) {} /// Get the number of child nodes in this piece of syntax, not including /// tokens. size_t getNumChildren() const; /// Get the Nth child of this piece of syntax. Syntax getChild(const size_t N) const; static bool classof(const Syntax *S) { return S->isUnknown(); } }; } // end namespace syntax } // end namespace swift #endif // SWIFT_SYNTAX_UNKNOWNSYNTAX_H
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/elasticmapreduce/EMR_EXPORTS.h> #include <aws/elasticmapreduce/EMRRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace EMR { namespace Model { /** */ class AWS_EMR_API DescribeReleaseLabelRequest : public EMRRequest { public: DescribeReleaseLabelRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DescribeReleaseLabel"; } Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The target release label to be described.</p> */ inline const Aws::String& GetReleaseLabel() const{ return m_releaseLabel; } /** * <p>The target release label to be described.</p> */ inline bool ReleaseLabelHasBeenSet() const { return m_releaseLabelHasBeenSet; } /** * <p>The target release label to be described.</p> */ inline void SetReleaseLabel(const Aws::String& value) { m_releaseLabelHasBeenSet = true; m_releaseLabel = value; } /** * <p>The target release label to be described.</p> */ inline void SetReleaseLabel(Aws::String&& value) { m_releaseLabelHasBeenSet = true; m_releaseLabel = std::move(value); } /** * <p>The target release label to be described.</p> */ inline void SetReleaseLabel(const char* value) { m_releaseLabelHasBeenSet = true; m_releaseLabel.assign(value); } /** * <p>The target release label to be described.</p> */ inline DescribeReleaseLabelRequest& WithReleaseLabel(const Aws::String& value) { SetReleaseLabel(value); return *this;} /** * <p>The target release label to be described.</p> */ inline DescribeReleaseLabelRequest& WithReleaseLabel(Aws::String&& value) { SetReleaseLabel(std::move(value)); return *this;} /** * <p>The target release label to be described.</p> */ inline DescribeReleaseLabelRequest& WithReleaseLabel(const char* value) { SetReleaseLabel(value); return *this;} /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline const Aws::String& GetNextToken() const{ return m_nextToken; } /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; } /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; } /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); } /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); } /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline DescribeReleaseLabelRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline DescribeReleaseLabelRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} /** * <p>The pagination token. Reserved for future use. Currently set to null.</p> */ inline DescribeReleaseLabelRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;} /** * <p>Reserved for future use. Currently set to null.</p> */ inline int GetMaxResults() const{ return m_maxResults; } /** * <p>Reserved for future use. Currently set to null.</p> */ inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; } /** * <p>Reserved for future use. Currently set to null.</p> */ inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; } /** * <p>Reserved for future use. Currently set to null.</p> */ inline DescribeReleaseLabelRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;} private: Aws::String m_releaseLabel; bool m_releaseLabelHasBeenSet; Aws::String m_nextToken; bool m_nextTokenHasBeenSet; int m_maxResults; bool m_maxResultsHasBeenSet; }; } // namespace Model } // namespace EMR } // namespace Aws
//--------------------------------------------------------------------------- #ifndef ConfigProgStationUnitH #define ConfigProgStationUnitH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Buttons.hpp> //--------------------------------------------------------------------------- class TConfigProgStationForm : public TForm { __published: // IDE-managed Components TGroupBox *GroupBox1; TCheckBox *MultiDisplayTagCheckBox; TCheckBox *DuplicateTagFGenCheckBox; TCheckBox *DuplicateTagGIDCheckBox; TGroupBox *GroupBox2; TEdit *OldHostIDEdit; TLabel *Label1; TLabel *Label2; TEdit *NewHostIDEdit; TCheckBox *AllHostCheckBox; TBitBtn *BitBtn1; TBitBtn *SaveBitBtn; TGroupBox *GroupBox3; TEdit *TempCalibEdit; TLabel *Label3; TRadioButton *TempCalibCRadioButton; TRadioButton *TempCalibFRadioButton; TGroupBox *GroupBox4; TCheckBox *Type01CheckBox; TCheckBox *Type02CheckBox; TCheckBox *Type03CheckBox; TCheckBox *Type04CheckBox; TCheckBox *Type05CheckBox; TCheckBox *Type06CheckBox; TEdit *Type01Edit; TEdit *Type02Edit; TEdit *Type03Edit; TEdit *Type04Edit; TEdit *Type05Edit; TEdit *Type06Edit; TEdit *Type01AbrEdit; TEdit *Type02AbrEdit; TEdit *Type03AbrEdit; TEdit *Type04AbrEdit; TEdit *Type05AbrEdit; TEdit *Type06AbrEdit; TLabel *Label4; TLabel *Label5; TBitBtn *Reset; TLabel *Label6; TLabel *Label7; void __fastcall FormActivate(TObject *Sender); void __fastcall SaveBitBtnClick(TObject *Sender); void __fastcall TempCalibCRadioButtonClick(TObject *Sender); void __fastcall TempCalibFRadioButtonClick(TObject *Sender); void __fastcall Type01CheckBoxClick(TObject *Sender); void __fastcall Type02CheckBoxClick(TObject *Sender); void __fastcall Type03CheckBoxClick(TObject *Sender); void __fastcall Type04CheckBoxClick(TObject *Sender); void __fastcall Type05CheckBoxClick(TObject *Sender); void __fastcall Type06CheckBoxClick(TObject *Sender); void __fastcall ResetClick(TObject *Sender); private: // User declarations public: // User declarations __fastcall TConfigProgStationForm(TComponent* Owner); bool dGIdFlag; bool dFgenFlag; float curTagTempCalibC; AnsiString localTagTypes[7]; AnsiString localTagTypesAbr[7]; bool __fastcall CheckDuplicatTagType(); bool __fastcall CheckDuplicatTagTypeAbr(); }; //--------------------------------------------------------------------------- extern PACKAGE TConfigProgStationForm *ConfigProgStationForm; //--------------------------------------------------------------------------- #endif
/* update - do sync periodically Author: Andy Tanenbaum */ #include <sys/types.h> #include <signal.h> #include <unistd.h> int main(void); int main() { /* Release all (?) open file descriptors. */ close(0); close(1); close(2); /* Release current directory to avoid locking current device. */ chdir("/"); /* Flush the cache every 30 seconds. */ while (1) { sync(); sleep(30); } }
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/waf-regional/WAFRegional_EXPORTS.h> #include <aws/waf-regional/model/RuleGroup.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace WAFRegional { namespace Model { class AWS_WAFREGIONAL_API CreateRuleGroupResult { public: CreateRuleGroupResult(); CreateRuleGroupResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); CreateRuleGroupResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>An empty <a>RuleGroup</a>.</p> */ inline const RuleGroup& GetRuleGroup() const{ return m_ruleGroup; } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline void SetRuleGroup(const RuleGroup& value) { m_ruleGroup = value; } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline void SetRuleGroup(RuleGroup&& value) { m_ruleGroup = std::move(value); } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline CreateRuleGroupResult& WithRuleGroup(const RuleGroup& value) { SetRuleGroup(value); return *this;} /** * <p>An empty <a>RuleGroup</a>.</p> */ inline CreateRuleGroupResult& WithRuleGroup(RuleGroup&& value) { SetRuleGroup(std::move(value)); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline const Aws::String& GetChangeToken() const{ return m_changeToken; } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(const Aws::String& value) { m_changeToken = value; } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(Aws::String&& value) { m_changeToken = std::move(value); } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(const char* value) { m_changeToken.assign(value); } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(const Aws::String& value) { SetChangeToken(value); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(Aws::String&& value) { SetChangeToken(std::move(value)); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(const char* value) { SetChangeToken(value); return *this;} private: RuleGroup m_ruleGroup; Aws::String m_changeToken; }; } // namespace Model } // namespace WAFRegional } // namespace Aws
/*************************************************************************** * * This is an internal header file used to implement the C++ Standard * Library. It should never be #included directly by a program. * * $Id$ * *************************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * * Copyright 2008 Rogue Wave Software, Inc. * **************************************************************************/ #ifndef _RWSTD_RW_META_HELP_H_INCLUDED #define _RWSTD_RW_META_HELP_H_INCLUDED #include <rw/_defs.h> _RWSTD_NAMESPACE (__rw) { // // A compile-time integral constant wrapper. This class template // encapsulates an integer constant value for metaprogramming. // template <class _TypeT, _TypeT _Value> struct __rw_integral_constant { typedef __rw_integral_constant<_TypeT,_Value> type; typedef _TypeT value_type; static const _TypeT value = _Value; }; #ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION template<class _TypeT, _TypeT _Value> const _TypeT __rw_integral_constant<_TypeT, _Value>::value; #endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION // // Synonym for __rw_integral_constant<bool, true> type. // typedef __rw_integral_constant<bool, true> __rw_true_type; // // Synonym for __rw_integral_constant<bool, false> type. // typedef __rw_integral_constant<bool, false> __rw_false_type; // convenience macros #define _RWSTD_BOOL_CONST(B) _RW::__rw_integral_constant<bool, B> } // namespace __rw #endif // _RWSTD_RW_META_HELP_H_INCLUDED
/* Copyright 2017-present the Material Components for iOS 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. */ #import "MDCTextInputControllerDefault.h" /** Material Design compliant outlined background text field from 2017. The logic for 'automagic' error states changes: underline color, underline text color. https://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field The placeholder text is laid out inline. If floating is enabled, it will float to the top of the field when there is content or the field is being edited. The character count is below text. The Material Design guidelines call this 'Floating inline labels.' https://material.io/guidelines/components/text-fields.html#text-fields-labels The background is clear, the corners are rounded, there's a border, there is no underline, and the placeholder is centered vertically in the filled area but does NOT cross the border when floating. */ @interface MDCTextInputControllerOutlinedTextArea : MDCTextInputControllerDefault @end
/*************************************************************************************************/ /*! * \file * * \brief Interface to SMP event handler. * * Copyright (c) 2010-2018 Arm Ltd. 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 SMP_HANDLER_H #define SMP_HANDLER_H #include "wsf_os.h" #ifdef __cplusplus extern "C" { #endif /*! \addtogroup STACK_EVENT * \{ */ /** \name SMP Event Handling * Message passing interface to SMP from other tasks through WSF. */ /**@{*/ /************************************************************************************************** Function Declarations **************************************************************************************************/ /*************************************************************************************************/ /*! * \brief SMP handler init function called during system initialization. * * \param handlerId WSF handler ID for SMP. * * \return None. */ /*************************************************************************************************/ void SmpHandlerInit(wsfHandlerId_t handlerId); /*************************************************************************************************/ /*! * \brief WSF event handler for SMP. * * \param event WSF event mask. * \param pMsg WSF message. * * \return None. */ /*************************************************************************************************/ void SmpHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg); /**@}*/ /*! \} */ /* STACK_SMP_API */ #ifdef __cplusplus }; #endif #endif /* SMP_HANDLER_H */
/* Copyright 2015 Yurii Litvinov and CyberTech Labs Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "systemConsoleInterface.h" namespace trikHal { namespace trik { /// Real implementation of system console. class TrikSystemConsole : public SystemConsoleInterface { public: int system(const QString &command) override; bool startProcess(const QString &processName, const QStringList &arguments) override; bool startProcessSynchronously(const QString &processName, const QStringList &arguments , QString * output = nullptr) override; }; } }
/* * Copyright 2014 The Luvit 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. * */ #include "private.h" static int luv_loop_close(lua_State* L) { int ret = uv_loop_close(luv_loop(L)); if (ret < 0) return luv_error(L, ret); luv_set_loop(L, NULL); lua_pushinteger(L, ret); return 1; } // These are the same order as uv_run_mode which also starts at 0 static const char *const luv_runmodes[] = { "default", "once", "nowait", NULL }; static int luv_run(lua_State* L) { int mode = luaL_checkoption(L, 1, "default", luv_runmodes); luv_ctx_t* ctx = luv_context(L); ctx->mode = mode; int ret = uv_run(ctx->loop, (uv_run_mode)mode); ctx->mode = -1; if (ret < 0) return luv_error(L, ret); lua_pushboolean(L, ret); return 1; } static int luv_loop_mode(lua_State* L) { luv_ctx_t* ctx = luv_context(L); if (ctx->mode == -1) { lua_pushnil(L); } else { lua_pushstring(L, luv_runmodes[ctx->mode]); } return 1; } static int luv_loop_alive(lua_State* L) { int ret = uv_loop_alive(luv_loop(L)); if (ret < 0) return luv_error(L, ret); lua_pushboolean(L, ret); return 1; } static int luv_stop(lua_State* L) { uv_stop(luv_loop(L)); return 0; } static int luv_backend_fd(lua_State* L) { int ret = uv_backend_fd(luv_loop(L)); // -1 is returned when there is no backend fd (like on Windows) if (ret == -1) lua_pushnil(L); else lua_pushinteger(L, ret); return 1; } static int luv_backend_timeout(lua_State* L) { int ret = uv_backend_timeout(luv_loop(L)); lua_pushinteger(L, ret); return 1; } static int luv_now(lua_State* L) { uint64_t now = uv_now(luv_loop(L)); lua_pushinteger(L, now); return 1; } static int luv_update_time(lua_State* L) { uv_update_time(luv_loop(L)); return 0; } static void luv_walk_cb(uv_handle_t* handle, void* arg) { lua_State* L = (lua_State*)arg; luv_handle_t* data = (luv_handle_t*)handle->data; // Sanity check // Most invalid values are large and refs are small, 0x1000000 is arbitrary. assert(data && data->ref < 0x1000000); lua_pushvalue(L, 1); // Copy the function luv_find_handle(L, data); // Get the userdata data->ctx->cb_pcall(L, 1, 0, 0); // Call the function } static int luv_walk(lua_State* L) { luaL_checktype(L, 1, LUA_TFUNCTION); uv_walk(luv_loop(L), luv_walk_cb, L); return 0; } #if LUV_UV_VERSION_GEQ(1, 0, 2) static const char *const luv_loop_configure_options[] = { "block_signal", #if LUV_UV_VERSION_GEQ(1, 39, 0) "metrics_idle_time", #endif NULL }; static int luv_loop_configure(lua_State* L) { uv_loop_t* loop = luv_loop(L); uv_loop_option option = 0; int ret = 0; switch (luaL_checkoption(L, 1, NULL, luv_loop_configure_options)) { case 0: option = UV_LOOP_BLOCK_SIGNAL; break; #if LUV_UV_VERSION_GEQ(1, 39, 0) case 1: option = UV_METRICS_IDLE_TIME; break; #endif default: break; /* unreachable */ } if (option == UV_LOOP_BLOCK_SIGNAL) { // lua_isstring checks for string or number int signal; luaL_argcheck(L, lua_isstring(L, 2), 2, "block_signal option: expected signal as string or number"); signal = luv_parse_signal(L, 2); ret = uv_loop_configure(loop, UV_LOOP_BLOCK_SIGNAL, signal); } else { ret = uv_loop_configure(loop, option); } return luv_result(L, ret); } #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/comprehendmedical/ComprehendMedical_EXPORTS.h> #include <aws/comprehendmedical/ComprehendMedicalRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace ComprehendMedical { namespace Model { /** */ class AWS_COMPREHENDMEDICAL_API DescribePHIDetectionJobRequest : public ComprehendMedicalRequest { public: DescribePHIDetectionJobRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DescribePHIDetectionJob"; } Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline const Aws::String& GetJobId() const{ return m_jobId; } /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline bool JobIdHasBeenSet() const { return m_jobIdHasBeenSet; } /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline void SetJobId(const Aws::String& value) { m_jobIdHasBeenSet = true; m_jobId = value; } /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline void SetJobId(Aws::String&& value) { m_jobIdHasBeenSet = true; m_jobId = std::move(value); } /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline void SetJobId(const char* value) { m_jobIdHasBeenSet = true; m_jobId.assign(value); } /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline DescribePHIDetectionJobRequest& WithJobId(const Aws::String& value) { SetJobId(value); return *this;} /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline DescribePHIDetectionJobRequest& WithJobId(Aws::String&& value) { SetJobId(std::move(value)); return *this;} /** * <p>The identifier that Amazon Comprehend Medical generated for the job. The * <code>StartPHIDetectionJob</code> operation returns this identifier in its * response.</p> */ inline DescribePHIDetectionJobRequest& WithJobId(const char* value) { SetJobId(value); return *this;} private: Aws::String m_jobId; bool m_jobIdHasBeenSet; }; } // namespace Model } // namespace ComprehendMedical } // namespace Aws
// Copyright 2010 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. // This code was generated by google-apis-code-generator 1.5.1 // C++ generator version: 0.1.3 // ---------------------------------------------------------------------------- // NOTE: This file is generated from Google APIs Discovery Service. // Service: // YouTube Data API (youtube/v3) // Generated from: // Version: v3 // Generated by: // Tool: google-apis-code-generator 1.5.1 // C++: 0.1.3 #ifndef GOOGLE_YOUTUBE_API_VIDEO_CONVERSION_PINGS_H_ #define GOOGLE_YOUTUBE_API_VIDEO_CONVERSION_PINGS_H_ #include "googleapis/base/macros.h" #include "googleapis/client/data/jsoncpp_data.h" #include "googleapis/strings/stringpiece.h" #include "google/youtube_api/video_conversion_ping.h" namespace Json { class Value; } // namespace Json namespace google_youtube_api { using namespace googleapis; /** * No description provided. * * @ingroup DataObject */ class VideoConversionPings : public client::JsonCppData { public: /** * Creates a new default instance. * * @return Ownership is passed back to the caller. */ static VideoConversionPings* New(); /** * Standard constructor for an immutable data object instance. * * @param[in] storage The underlying data storage for this instance. */ explicit VideoConversionPings(const Json::Value& storage); /** * Standard constructor for a mutable data object instance. * * @param[in] storage The underlying data storage for this instance. */ explicit VideoConversionPings(Json::Value* storage); /** * Standard destructor. */ virtual ~VideoConversionPings(); /** * Returns a string denoting the type of this data object. * * @return <code>google_youtube_api::VideoConversionPings</code> */ const StringPiece GetTypeName() const { return StringPiece("google_youtube_api::VideoConversionPings"); } /** * Determine if the '<code>pings</code>' attribute was set. * * @return true if the '<code>pings</code>' attribute was set. */ bool has_pings() const { return Storage().isMember("pings"); } /** * Clears the '<code>pings</code>' attribute. */ void clear_pings() { MutableStorage()->removeMember("pings"); } /** * Get a reference to the value of the '<code>pings</code>' attribute. */ const client::JsonCppArray<VideoConversionPing > get_pings() const; /** * Gets a reference to a mutable value of the '<code>pings</code>' property. * * Pings that the app shall fire for a video (authenticated by biscotti * cookie). Each ping has a context, in which the app must fire the ping, and * a url identifying the ping. * * @return The result can be modified to change the attribute value. */ client::JsonCppArray<VideoConversionPing > mutable_pings(); private: void operator=(const VideoConversionPings&); }; // VideoConversionPings } // namespace google_youtube_api #endif // GOOGLE_YOUTUBE_API_VIDEO_CONVERSION_PINGS_H_
// Copyright 2013-2016 Stanford University // // 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 STOKE_SRC_TRANSFORM_WEIGHTED_H #define STOKE_SRC_TRANSFORM_WEIGHTED_H #include <algorithm> #include <cassert> #include <random> #include <set> #include <vector> #include "src/transform/transform.h" namespace stoke { class WeightedTransform : public Transform { public: /** Creates a new transformation helper; guaranteed to pass invariants. */ WeightedTransform(TransformPools& pools) : Transform(pools) { } std::string get_name() const { return "Weighted"; } TransformInfo operator()(Cfg& cfg) { size_t pool_index = gen_() % transform_pool_.size(); size_t tform_index = transform_pool_[pool_index]; Transform* tr = transforms_[tform_index]; auto ti = (*tr)(cfg); ti.move_type = tform_index; return ti; } void undo(Cfg& cfg, const TransformInfo& info) const { transforms_[info.move_type]->undo(cfg, info); } /** Add a transform to the set. */ void insert_transform(Transform* tr, size_t weight = 1) { size_t label = transforms_.size(); transforms_.push_back(tr); for (size_t i = 0; i < weight; ++i) transform_pool_.push_back(label); } /** Get a pointer to a transform at a given index. This is useful to identify what transform was used by looking at the move_type field of TransformInfo(). */ Transform* get_transform(size_t index) const { assert(index < transforms_.size()); return transforms_[index]; } /** Returns the number of transforms available to choose from. */ size_t size() const { return transforms_.size(); } /** Set a seed for the random number generator. */ virtual void set_seed(std::default_random_engine::result_type seed) { for (auto tform : transforms_) tform->set_seed(seed); gen_.seed(seed); } protected: /** Transforms that we have available to use. */ std::vector<Transform*> transforms_; /** Members are indexes into transforms_ vector. The indexes are repeated based on the given weight of the transform. */ std::vector<size_t> transform_pool_; }; } // namespace stoke #endif
/* $Id: hash.h 840 2007-09-09 12:17:42Z michael $ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/hash.h $ * * hashes (associative arrays) * * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at> * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> * * This file is part of LCD4Linux. * * LCD4Linux 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. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef _HASH_H_ #define _HASH_H_ /* struct timeval */ #include <sys/time.h> typedef struct { int size; char *value; struct timeval timestamp; } HASH_SLOT; typedef struct { char *key; int val; } HASH_COLUMN; typedef struct { char *key; int index; int nSlot; HASH_SLOT *Slot; } HASH_ITEM; typedef struct { int sorted; struct timeval timestamp; int nItems; HASH_ITEM *Items; int nColumns; HASH_COLUMN *Columns; char *delimiter; } HASH; void hash_create(HASH * Hash); int hash_age(HASH * Hash, const char *key); void hash_set_column(HASH * Hash, const int number, const char *column); void hash_set_delimiter(HASH * Hash, const char *delimiter); char *hash_get(HASH * Hash, const char *key, const char *column); double hash_get_delta(HASH * Hash, const char *key, const char *column, const int delay); double hash_get_regex(HASH * Hash, const char *key, const char *column, const int delay); void hash_put(HASH * Hash, const char *key, const char *value); void hash_put_delta(HASH * Hash, const char *key, const char *value); void hash_destroy(HASH * Hash); #endif
/** ****************************************************************************** * File Name : DAC.h * Date : 18/01/2015 10:00:30 * Description : This file provides code for the configuration * of the DAC instances. ****************************************************************************** * * COPYRIGHT(c) 2015 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifdef USE_GEN #ifndef __DAC_H #define __DAC_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f3xx_hal.h" //extern DAC_HandleTypeDef hdac; void MX_DAC1_Init(void); void MX_DAC2_Init(void); void DAC_DMA_Reconfig(uint8_t chan, uint32_t *buff, uint32_t len); void DACDisableOutput(void); void DACEnableOutput(void); void DACSetOutputBuffer(void); void DACUnsetOutputBuffer(void); void GeneratingEnable (void); void GeneratingDisable (void); #ifdef __cplusplus } #endif #endif /*__DAC_H */ /** * @} */ /** * @} */ #endif //USE_GEN /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* $FreeBSD: soc2013/dpl/head/contrib/ipfilter/ipsend/.OLD/ip_compat.h 145562 2005-04-25 18:20:15Z darrenr $ */ /* * (C)opyright 1995 by Darren Reed. * * This code may be freely distributed as long as it retains this notice * and is not changed in any way. The author accepts no responsibility * for the use of this software. I hate legaleese, don't you ? * * @(#)ip_compat.h 1.2 12/7/95 */ /* * These #ifdef's are here mainly for linux, but who knows, they may * not be in other places or maybe one day linux will grow up and some * of these will turn up there too. */ #ifndef ICMP_UNREACH # define ICMP_UNREACH ICMP_DEST_UNREACH #endif #ifndef ICMP_SOURCEQUENCH # define ICMP_SOURCEQUENCH ICMP_SOURCE_QUENCH #endif #ifndef ICMP_TIMXCEED # define ICMP_TIMXCEED ICMP_TIME_EXCEEDED #endif #ifndef ICMP_PARAMPROB # define ICMP_PARAMPROB ICMP_PARAMETERPROB #endif #ifndef IPVERSION # define IPVERSION 4 #endif #ifndef IPOPT_MINOFF # define IPOPT_MINOFF 4 #endif #ifndef IPOPT_COPIED # define IPOPT_COPIED(x) ((x)&0x80) #endif #ifndef IPOPT_EOL # define IPOPT_EOL 0 #endif #ifndef IPOPT_NOP # define IPOPT_NOP 1 #endif #ifndef IP_MF # define IP_MF ((u_short)0x2000) #endif #ifndef ETHERTYPE_IP # define ETHERTYPE_IP ((u_short)0x0800) #endif #ifndef TH_FIN # define TH_FIN 0x01 #endif #ifndef TH_SYN # define TH_SYN 0x02 #endif #ifndef TH_RST # define TH_RST 0x04 #endif #ifndef TH_PUSH # define TH_PUSH 0x08 #endif #ifndef TH_ACK # define TH_ACK 0x10 #endif #ifndef TH_URG # define TH_URG 0x20 #endif #ifndef IPOPT_EOL # define IPOPT_EOL 0 #endif #ifndef IPOPT_NOP # define IPOPT_NOP 1 #endif #ifndef IPOPT_RR # define IPOPT_RR 7 #endif #ifndef IPOPT_TS # define IPOPT_TS 68 #endif #ifndef IPOPT_SECURITY # define IPOPT_SECURITY 130 #endif #ifndef IPOPT_LSRR # define IPOPT_LSRR 131 #endif #ifndef IPOPT_SATID # define IPOPT_SATID 136 #endif #ifndef IPOPT_SSRR # define IPOPT_SSRR 137 #endif #ifndef IPOPT_SECUR_UNCLASS # define IPOPT_SECUR_UNCLASS ((u_short)0x0000) #endif #ifndef IPOPT_SECUR_CONFID # define IPOPT_SECUR_CONFID ((u_short)0xf135) #endif #ifndef IPOPT_SECUR_EFTO # define IPOPT_SECUR_EFTO ((u_short)0x789a) #endif #ifndef IPOPT_SECUR_MMMM # define IPOPT_SECUR_MMMM ((u_short)0xbc4d) #endif #ifndef IPOPT_SECUR_RESTR # define IPOPT_SECUR_RESTR ((u_short)0xaf13) #endif #ifndef IPOPT_SECUR_SECRET # define IPOPT_SECUR_SECRET ((u_short)0xd788) #endif #ifndef IPOPT_SECUR_TOPSECRET # define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5) #endif #ifdef linux # if LINUX < 0200 # define icmp icmphdr # define icmp_type type # define icmp_code code # endif /* * From /usr/include/netinet/ip_var.h * !%@#!$@# linux... */ struct ipovly { caddr_t ih_next, ih_prev; /* for protocol sequence q's */ u_char ih_x1; /* (unused) */ u_char ih_pr; /* protocol */ short ih_len; /* protocol length */ struct in_addr ih_src; /* source internet address */ struct in_addr ih_dst; /* destination internet address */ }; typedef struct { __u16 th_sport; __u16 th_dport; __u32 th_seq; __u32 th_ack; # if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\ defined(vax) __u8 th_res:4; __u8 th_off:4; #else __u8 th_off:4; __u8 th_res:4; #endif __u8 th_flags; __u16 th_win; __u16 th_sum; __u16 th_urp; } tcphdr_t; typedef struct { __u16 uh_sport; __u16 uh_dport; __s16 uh_ulen; __u16 uh_sum; } udphdr_t; typedef struct { # if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\ defined(vax) __u8 ip_hl:4; __u8 ip_v:4; # else __u8 ip_hl:4; __u8 ip_v:4; # endif __u8 ip_tos; __u16 ip_len; __u16 ip_id; __u16 ip_off; __u8 ip_ttl; __u8 ip_p; __u16 ip_sum; struct in_addr ip_src; struct in_addr ip_dst; } ip_t; typedef struct { __u8 ether_dhost[6]; __u8 ether_shost[6]; __u16 ether_type; } ether_header_t; typedef struct icmp { u_char icmp_type; /* type of message, see below */ u_char icmp_code; /* type sub code */ u_short icmp_cksum; /* ones complement cksum of struct */ union { u_char ih_pptr; /* ICMP_PARAMPROB */ struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ struct ih_idseq { n_short icd_id; n_short icd_seq; } ih_idseq; int ih_void; } icmp_hun; #define icmp_pptr icmp_hun.ih_pptr #define icmp_gwaddr icmp_hun.ih_gwaddr #define icmp_id icmp_hun.ih_idseq.icd_id #define icmp_seq icmp_hun.ih_idseq.icd_seq #define icmp_void icmp_hun.ih_void union { struct id_ts { n_time its_otime; n_time its_rtime; n_time its_ttime; } id_ts; struct id_ip { ip_t idi_ip; /* options and then 64 bits of data */ } id_ip; u_long id_mask; char id_data[1]; } icmp_dun; #define icmp_otime icmp_dun.id_ts.its_otime #define icmp_rtime icmp_dun.id_ts.its_rtime #define icmp_ttime icmp_dun.id_ts.its_ttime #define icmp_ip icmp_dun.id_ip.idi_ip #define icmp_mask icmp_dun.id_mask #define icmp_data icmp_dun.id_data } icmphdr_t; # define bcopy(a,b,c) memmove(b,a,c) # define bcmp(a,b,c) memcmp(a,b,c) # define ifnet device #else typedef struct udphdr udphdr_t; typedef struct tcphdr tcphdr_t; typedef struct ip ip_t; typedef struct ether_header ether_header_t; #endif #if defined(__SVR4) || defined(__svr4__) # define bcopy(a,b,c) memmove(b,a,c) # define bcmp(a,b,c) memcmp(a,b,c) # define bzero(a,b) memset(a,0,b) #endif
/* ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @file wdg_lld.h * @brief WDG Driver subsystem low level driver header. * * @addtogroup WDG * @{ */ #ifndef _WDG_LLD_H_ #define _WDG_LLD_H_ #if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ /** * @name RLR register definitions * @{ */ #define STM32_IWDG_RL_MASK (0x00000FFF << 0) #define STM32_IWDG_RL(n) ((n) << 0) /** @} */ /** * @name PR register definitions * @{ */ #define STM32_IWDG_PR_MASK (7 << 0) #define STM32_IWDG_PR_4 0U #define STM32_IWDG_PR_8 1U #define STM32_IWDG_PR_16 2U #define STM32_IWDG_PR_32 3U #define STM32_IWDG_PR_64 4U #define STM32_IWDG_PR_128 5U #define STM32_IWDG_PR_256 6U /** @} */ /** * @name WINR register definitions * @{ */ #define STM32_IWDG_WIN_MASK (0x00000FFF << 0) #define STM32_IWDG_WIN(n) ((n) << 0) #define STM32_IWDG_WIN_DISABLED STM32_IWDG_WIN(0x00000FFF) /** @} */ /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** * @name Configuration options * @{ */ /** * @brief IWDG driver enable switch. * @details If set to @p TRUE the support for IWDG is included. * @note The default is @p FALSE. */ #if !defined(STM32_WDG_USE_IWDG) || defined(__DOXYGEN__) #define STM32_WDG_USE_IWDG FALSE #endif /** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if STM32_WDG_USE_IWDG && !STM32_HAS_IWDG #error "IWDG not present in the selected device" #endif #if !STM32_WDG_USE_IWDG #error "WDG driver activated but no xWDG peripheral assigned" #endif #if !defined(STM32_LSI_ENABLED) #error "STM32_LSI_ENABLED not defined" #endif #if (STM32_WDG_USE_IWDG == TRUE) && (STM32_LSI_ENABLED == FALSE) #error "IWDG requires LSI clock" #endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /** * @brief Type of a structure representing an WDG driver. */ typedef struct WDGDriver WDGDriver; /** * @brief Driver configuration structure. * @note It could be empty on some architectures. */ typedef struct { /** * @brief Configuration of the IWDG_PR register. * @details See the STM32 reference manual for details. */ uint32_t pr; /** * @brief Configuration of the IWDG_RLR register. * @details See the STM32 reference manual for details. */ uint32_t rlr; #if STM32_IWDG_IS_WINDOWED || defined(__DOXYGEN__) /** * @brief Configuration of the IWDG_WINR register. * @details See the STM32 reference manual for details. * @note This field is not present in F1, F2, F4, L1 sub-families. */ uint32_t winr; #endif } WDGConfig; /** * @brief Structure representing an WDG driver. */ struct WDGDriver { /** * @brief Driver state. */ wdgstate_t state; /** * @brief Current configuration data. */ const WDGConfig *config; /* End of the mandatory fields.*/ /** * @brief Pointer to the IWDG registers block. */ IWDG_TypeDef *wdg; }; /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #if STM32_WDG_USE_IWDG && !defined(__DOXYGEN__) extern WDGDriver WDGD1; #endif #ifdef __cplusplus extern "C" { #endif void wdg_lld_init(void); void wdg_lld_start(WDGDriver *wdgp); void wdg_lld_stop(WDGDriver *wdgp); void wdg_lld_reset(WDGDriver *wdgp); #ifdef __cplusplus } #endif #endif /* HAL_USE_WDG == TRUE */ #endif /* _WDG_LLD_H_ */ /** @} */
/////////////////////////////////////////////////////////////////////////////// // Name: tests/controls/itemcontainertest.h // Purpose: wxItemContainer unit test // Author: Steven Lamerton // Created: 2010-06-29 // Copyright: (c) 2010 Steven Lamerton /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TESTS_CONTROLS_ITEMCONTAINERTEST_H_ #define _WX_TESTS_CONTROLS_ITEMCONTAINERTEST_H_ class ItemContainerTestCase { public: ItemContainerTestCase() { } virtual ~ItemContainerTestCase() { } protected: // this function must be overridden by the derived classes to return the // text entry object we're testing, typically this is done by creating a // control implementing wxItemContainer interface in setUp() virtual method and // just returning it from here virtual wxItemContainer *GetContainer() const = 0; // and this one must be overridden to return the window which implements // wxItemContainer interface -- usually it will return the same pointer as // GetTestEntry(), just as a different type virtual wxWindow *GetContainerWindow() const = 0; // this should be inserted in the derived class CPPUNIT_TEST_SUITE // definition to run all wxItemContainer tests as part of it #define wxITEM_CONTAINER_TESTS() \ CPPUNIT_TEST( Append ); \ CPPUNIT_TEST( Insert ); \ CPPUNIT_TEST( Count ); \ CPPUNIT_TEST( ItemSelection ); \ CPPUNIT_TEST( FindString ); \ CPPUNIT_TEST( ClientData ); \ CPPUNIT_TEST( VoidData ); \ CPPUNIT_TEST( Set ); \ CPPUNIT_TEST( SetSelection ); \ CPPUNIT_TEST( SetString ); \ WXUISIM_TEST( SimSelect ); void Append(); void Insert(); void Count(); void ItemSelection(); void FindString(); void ClientData(); void VoidData(); void Set(); void SetSelection(); void SetString(); virtual void SimSelect(); private: wxDECLARE_NO_COPY_CLASS(ItemContainerTestCase); }; #endif // _WX_TESTS_CONTROLS_ITEMCONTAINERTEST_H_
/* * Check decoding of migrate_pages syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "tests.h" #include <asm/unistd.h> #ifdef __NR_migrate_pages # include <stdio.h> # include <unistd.h> int main(void) { const long pid = (long) 0xfacefeedffffffff; long rc = syscall(__NR_migrate_pages, pid, 0, 0, 0); printf("migrate_pages(%d, 0, NULL, NULL) = %ld %s (%m)\n", (int) pid, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; } #else SKIP_MAIN_UNDEFINED("__NR_migrate_pages") #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_VIDEO_H264_POC_H_ #define MEDIA_VIDEO_H264_POC_H_ #include <stdint.h> #include "base/macros.h" namespace media { struct H264SPS; struct H264SliceHeader; class MEDIA_EXPORT H264POC { public: H264POC(); ~H264POC(); // Returns the picture order count for a slice. base::Optional<int32_t> ComputePicOrderCnt(const H264SPS* sps, const H264SliceHeader& slice_hdr); // As specified, the POC of a frame with MMCO5 changes (to zero) after // decoding. We instead return 0 immediately, and flag that this has occurred // by returning true here until ComputePicOrderCnt() is called again. // // Frames with MMCO5 do not reorder relative to frames earlier in decode // order, but may reorder relative to frames later in decode order (just like // IDRs). bool IsPendingMMCO5() { return pending_mmco5_; } // Reset computation state. It's best (although not strictly required) to call // this after a seek. void Reset(); private: int32_t ref_pic_order_cnt_msb_; int32_t ref_pic_order_cnt_lsb_; int32_t prev_frame_num_; int32_t prev_frame_num_offset_; bool pending_mmco5_; DISALLOW_COPY_AND_ASSIGN(H264POC); }; } // namespace media #endif // MEDIA_VIDEO_H264_POC_H_
/* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Portions copyright (c) 1999, 2000 * Intel Corporation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. 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, Intel Corporation, and its contributors. * * 4. Neither the name of University, Intel Corporation, or their respective * 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, INTEL CORPORATION 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, * INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*++ Module Name: wcscat.c Abstract: Wide char string concatenation Revision History --*/ #include <wchar.h> wchar_t * wcscat(s, append) register wchar_t *s; register const wchar_t *append; { wchar_t *save = s; for (; *s; ++s); while (*s++ = *append++); return(save); }
#include <csolve.h> #include <stdlib.h> struct s { int x; char * ARRAY y; }; struct t { char * ARRAY one; char * ARRAY two; short z; }; void register_cb(void * VAR(K) s, void * VAR(L) t, void (* START VALIDPTR cb)(void * VAR(K), void * VAR(L))) { cb(s,t); } extern void process_s(struct s *s, struct t *t) OKEXTERN; void main() { struct s s1; struct t t1; register_cb(&s1, &t1, process_s); }
/* * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SVGFEMorphologyElement_h #define SVGFEMorphologyElement_h #include "core/platform/graphics/filters/FEMorphology.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { template<> struct SVGPropertyTraits<MorphologyOperatorType> { static unsigned highestEnumValue() { return FEMORPHOLOGY_OPERATOR_DILATE; } static String toString(MorphologyOperatorType type) { switch (type) { case FEMORPHOLOGY_OPERATOR_UNKNOWN: return emptyString(); case FEMORPHOLOGY_OPERATOR_ERODE: return "erode"; case FEMORPHOLOGY_OPERATOR_DILATE: return "dilate"; } ASSERT_NOT_REACHED(); return emptyString(); } static MorphologyOperatorType fromString(const String& value) { if (value == "erode") return FEMORPHOLOGY_OPERATOR_ERODE; if (value == "dilate") return FEMORPHOLOGY_OPERATOR_DILATE; return FEMORPHOLOGY_OPERATOR_UNKNOWN; } }; class SVGFEMorphologyElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: static PassRefPtr<SVGFEMorphologyElement> create(const QualifiedName&, Document*); void setRadius(float radiusX, float radiusY); private: SVGFEMorphologyElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); static const AtomicString& radiusXIdentifier(); static const AtomicString& radiusYIdentifier(); BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMorphologyElement) DECLARE_ANIMATED_STRING(In1, in1) DECLARE_ANIMATED_ENUMERATION(_operator, _operator, MorphologyOperatorType) DECLARE_ANIMATED_NUMBER(RadiusX, radiusX) DECLARE_ANIMATED_NUMBER(RadiusY, radiusY) END_DECLARE_ANIMATED_PROPERTIES }; } // namespace WebCore #endif
/* * Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef VBOOT_REFERENCE_FUTILITY_H_ #define VBOOT_REFERENCE_FUTILITY_H_ #include <stdint.h> #include "vboot_common.h" #include "gbb_header.h" #include "host_key.h" /* This program */ #define MYNAME "futility" /* Version string (autogenerated) */ extern const char futility_version[]; /* Bitfields indicating the struct/format versions supported by a command */ enum vboot_version { /* * v1.0 is the original structs used since the dawn of time. * v2.0 can verify the firmware in smaller chunks, but there's * no difference in the on-device structs, so it's only * meaningful for the firmware API. Futility doesn't care. */ VBOOT_VERSION_1_0 = 0x00000001, /* * v2.1 uses new and different structs, and is what v2.0 would have * been if someone hadn't started using it before it was ready. */ VBOOT_VERSION_2_1 = 0x00000002, /* * Everything we know about to date. */ VBOOT_VERSION_ALL = 0x00000003, }; /* What's our preferred API & data format? */ enum vboot_version vboot_version; /* Here's a structure to define the commands that futility implements. */ struct futil_cmd_t { const char *const name; int (*const handler) (int argc, char **argv); enum vboot_version version; const char *const shorthelp; void (*longhelp) (const char *cmd); }; /* Macro to define a command */ #define DECLARE_FUTIL_COMMAND(NAME, HANDLER, VERSION, SHORTHELP, LONGHELP) \ const struct futil_cmd_t __cmd_##NAME = { \ .name = #NAME, \ .handler = HANDLER, \ .version = VERSION, \ .shorthelp = SHORTHELP, \ .longhelp = LONGHELP, \ } /* This is the list of pointers to all commands. */ extern const struct futil_cmd_t *const futil_cmds[]; /* Size of an array */ #ifndef ARRAY_SIZE #define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0])) #endif /* Test an important condition at compile time, not run time */ #ifndef BUILD_ASSERT #define _BA1_(cond, line) \ extern int __build_assertion_ ## line[1 - 2*!(cond)] \ __attribute__ ((unused)) #define _BA0_(c, x) _BA1_(c, x) #define BUILD_ASSERT(cond) _BA0_(cond, __LINE__) #endif /* Fatal internal stupidness */ #ifndef DIE #define DIE do { \ fprintf(stderr, MYNAME ": internal error at %s:%d\n", \ __FILE__, __LINE__); \ exit(1); \ } while (0) #endif /* Debug output (off by default) */ extern int debugging_enabled; void Debug(const char *format, ...); /* Returns true if this looks enough like a GBB header to proceed. */ int futil_looks_like_gbb(GoogleBinaryBlockHeader *gbb, uint32_t len); /* * Returns true if the gbb header is valid (and optionally updates *maxlen). * This doesn't verify the contents, though. */ int futil_valid_gbb_header(GoogleBinaryBlockHeader *gbb, uint32_t len, uint32_t *maxlen); /* For GBB v1.2 and later, update the hwid_digest */ void update_hwid_digest(GoogleBinaryBlockHeader *gbb); /* For GBB v1.2 and later, print the stored digest of the HWID (and whether * it's correct). Return true if it is correct. */ int print_hwid_digest(GoogleBinaryBlockHeader *gbb, const char *banner, const char *footer); /* Copies a file or dies with an error message */ void futil_copy_file_or_die(const char *infile, const char *outfile); /* Possible file operation errors */ enum futil_file_err { FILE_ERR_NONE, FILE_ERR_STAT, FILE_ERR_SIZE, FILE_ERR_MMAP, FILE_ERR_MSYNC, FILE_ERR_MUNMAP, FILE_ERR_OPEN, FILE_ERR_CLOSE, FILE_ERR_DIR, FILE_ERR_CHR, FILE_ERR_FIFO, FILE_ERR_SOCK, }; /* Wrapper for mmap/munmap. Skips stupidly large files. */ #define MAP_RO 0 #define MAP_RW 1 enum futil_file_err futil_map_file(int fd, int writeable, uint8_t **buf, uint32_t *len); enum futil_file_err futil_unmap_file(int fd, int writeable, uint8_t *buf, uint32_t len); /* The CPU architecture is occasionally important */ enum arch_t { ARCH_UNSPECIFIED, ARCH_X86, ARCH_ARM, ARCH_MIPS }; #endif /* VBOOT_REFERENCE_FUTILITY_H_ */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE690_NULL_Deref_From_Return__long_malloc_54c.c Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml Template File: source-sinks-54c.tmpl.c */ /* * @description * CWE: 690 Unchecked Return Value To NULL Pointer * BadSource: malloc Allocate data using malloc() * Sinks: * GoodSink: Check to see if the data allocation failed and if not, use data * BadSink : Don't check for NULL and use data * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE690_NULL_Deref_From_Return__long_malloc_54d_badSink(long * data); void CWE690_NULL_Deref_From_Return__long_malloc_54c_badSink(long * data) { CWE690_NULL_Deref_From_Return__long_malloc_54d_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G uses the BadSource with the GoodSink */ void CWE690_NULL_Deref_From_Return__long_malloc_54d_goodB2GSink(long * data); void CWE690_NULL_Deref_From_Return__long_malloc_54c_goodB2GSink(long * data) { CWE690_NULL_Deref_From_Return__long_malloc_54d_goodB2GSink(data); } #endif /* OMITGOOD */
/***************************************************************************** FFTReal.h Copyright (c) 2005 Laurent de Soras --- Legal stuff --- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *Tab=3***********************************************************************/ #if ! defined (FFTReal_HEADER_INCLUDED) #define FFTReal_HEADER_INCLUDED #if defined (_MSC_VER) #pragma once #pragma warning (4 : 4250) // "Inherits via dominance." #endif /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "def.h" #include "DynArray.h" #include "OscSinCos.h" template <class DT> class FFTReal { /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ public: enum { MAX_BIT_DEPTH = 30 }; // So length can be represented as long int typedef DT DataType; explicit FFTReal (long length); virtual ~FFTReal () {} long get_length () const; void do_fft (DataType f [], const DataType x []) const; void do_ifft (const DataType f [], DataType x []) const; void rescale (DataType x []) const; DataType * use_buffer () const; /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ protected: /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: // Over this bit depth, we use direct calculation for sin/cos enum { TRIGO_BD_LIMIT = 12 }; typedef OscSinCos <DataType> OscType; void init_br_lut (); void init_trigo_lut (); void init_trigo_osc (); FORCEINLINE const long * get_br_ptr () const; FORCEINLINE const DataType * get_trigo_ptr (int level) const; FORCEINLINE long get_trigo_level_index (int level) const; inline void compute_fft_general (DataType f [], const DataType x []) const; inline void compute_direct_pass_1_2 (DataType df [], const DataType x []) const; inline void compute_direct_pass_3 (DataType df [], const DataType sf []) const; inline void compute_direct_pass_n (DataType df [], const DataType sf [], int pass) const; inline void compute_direct_pass_n_lut (DataType df [], const DataType sf [], int pass) const; inline void compute_direct_pass_n_osc (DataType df [], const DataType sf [], int pass) const; inline void compute_ifft_general (const DataType f [], DataType x []) const; inline void compute_inverse_pass_n (DataType df [], const DataType sf [], int pass) const; inline void compute_inverse_pass_n_osc (DataType df [], const DataType sf [], int pass) const; inline void compute_inverse_pass_n_lut (DataType df [], const DataType sf [], int pass) const; inline void compute_inverse_pass_3 (DataType df [], const DataType sf []) const; inline void compute_inverse_pass_1_2 (DataType x [], const DataType sf []) const; const long _length; const int _nbr_bits; DynArray <long> _br_lut; DynArray <DataType> _trigo_lut; mutable DynArray <DataType> _buffer; mutable DynArray <OscType> _trigo_osc; /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: FFTReal (); FFTReal (const FFTReal &other); FFTReal & operator = (const FFTReal &other); bool operator == (const FFTReal &other); bool operator != (const FFTReal &other); }; // class FFTReal #include "FFTReal.hpp" #endif // FFTReal_HEADER_INCLUDED /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#ifndef _AVR_TIME_H_ #define _AVR_TIME_H_ #include <stdint.h> void avr_time_init(void); uint32_t avr_time_now(void); #endif
/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkStreamPriv_DEFINED #define SkStreamPriv_DEFINED #include "include/core/SkRefCnt.h" #include "include/core/SkStream.h" class SkData; /** * Copy the provided stream to an SkData variable. * * Note: Assumes the stream is at the beginning. If it has a length, * but is not at the beginning, this call will fail (return NULL). * * @param stream SkStream to be copied into data. * @return The resulting SkData after the copy, nullptr on failure. */ sk_sp<SkData> SkCopyStreamToData(SkStream* stream); /** * Copies the input stream from the current position to the end. * Does not rewind the input stream. */ bool SkStreamCopy(SkWStream* out, SkStream* input); /** A SkWStream that writes all output to SkDebugf, for debugging purposes. */ class SkDebugfStream final : public SkWStream { public: bool write(const void* buffer, size_t size) override; size_t bytesWritten() const override; private: size_t fBytesWritten = 0; }; #endif // SkStreamPriv_DEFINED
/* $NetBSD: modify_c.c,v 1.1.1.2 2014/04/24 12:45:49 pettai Exp $ */ /* * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "kadm5_locl.h" __RCSID("NetBSD"); kadm5_ret_t kadm5_c_modify_principal(void *server_handle, kadm5_principal_ent_t princ, uint32_t mask) { kadm5_client_context *context = server_handle; kadm5_ret_t ret; krb5_storage *sp; unsigned char buf[1024]; int32_t tmp; krb5_data reply; ret = _kadm5_connect(server_handle); if(ret) return ret; sp = krb5_storage_from_mem(buf, sizeof(buf)); if (sp == NULL) { krb5_clear_error_message(context->context); return ENOMEM; } krb5_store_int32(sp, kadm_modify); kadm5_store_principal_ent(sp, princ); krb5_store_int32(sp, mask); ret = _kadm5_client_send(context, sp); krb5_storage_free(sp); if(ret) return ret; ret = _kadm5_client_recv(context, &reply); if(ret) return ret; sp = krb5_storage_from_data (&reply); if (sp == NULL) { krb5_clear_error_message(context->context); krb5_data_free (&reply); return ENOMEM; } krb5_ret_int32(sp, &tmp); krb5_clear_error_message(context->context); krb5_storage_free(sp); krb5_data_free (&reply); return tmp; }
/* Copyright (c) 2012-2015, The Saffire Group 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 Saffire Group 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __OBJECT_STRING_H__ #define __OBJECT_STRING_H__ #include <saffire/objects/object.h> #include <saffire/general/string.h> // Allocate string objects #define STR02OBJ(mystr) object_alloc_instance(Object_String, 2, strlen(mystr), mystr) #define STR2OBJ(mystr) object_alloc_instance(Object_String, 1, mystr) // Return a zero-terminated string #define RETURN_STRING_FROM_CHAR(s) RETURN_OBJECT(STR02OBJ(s)) // Return binary safe string #define RETURN_STRING_FROM_BINSAFE_CHAR(l, s) RETURN_OBJECT(object_alloc_instance(Object_String, 2, l, s)) #define RETURN_STRING(s) RETURN_OBJECT(STR2OBJ(s)) // Returns value inside the string object's t_string #define STROBJ2CHAR0(obj) ((((t_string_object *)obj)->data.value)->val) // Returns length inside the string object's t_string #define STROBJ2CHAR0LEN(obj) ((((t_string_object *)obj)->data.value)->len) typedef struct { t_string *value; // string value md5_byte_t hash[16]; // (MD5) hash of the actual string int needs_hashing; // 1 : string needs hashing, 0 : hash done int iter; // Simple iteration index on the characters char *locale; // Locale } t_string_object_data; typedef struct { SAFFIRE_OBJECT_HEADER t_string_object_data data; SAFFIRE_OBJECT_FOOTER } t_string_object; t_string_object Object_String_struct; #define Object_String (t_object *)&Object_String_struct void object_string_init(void); void object_string_fini(void); int object_string_hash_compare(t_string_object *s1, t_string_object *s2); int object_string_compare(t_string_object *s1, t_string_object *s2); #endif
/* * Copyright (c) 2012 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. */ #ifndef WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_TO_FILE_RENDERER_H_ #define WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_TO_FILE_RENDERER_H_ #include <stdio.h> #include <string.h> #include <list> #include <string> #include "webrtc/base/constructormagic.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/video_engine/include/vie_render.h" namespace webrtc { class CriticalSectionWrapper; class EventWrapper; class ThreadWrapper; }; // namespace webrtc namespace test { struct Frame; }; // namespace test class ViEToFileRenderer: public webrtc::ExternalRenderer { public: ViEToFileRenderer(); virtual ~ViEToFileRenderer(); // Returns false if we fail opening the output filename for writing. bool PrepareForRendering(const std::string& output_path, const std::string& output_filename); // Closes the output file. void StopRendering(); // Deletes the closed output file from the file system. This is one option // after calling StopRendering, the other being KeepOutputFile. This file // renderer will forget about the file after this call and can be used again. bool DeleteOutputFile(); // Renames the closed output file to its previous name with the provided // prefix prepended. This file renderer will forget about the file after this // call and can be used again. bool SaveOutputFile(const std::string& prefix); // Implementation of ExternalRenderer: int FrameSizeChange(unsigned int width, unsigned int height, unsigned int number_of_streams) OVERRIDE; int DeliverFrame(unsigned char* buffer, size_t buffer_size, uint32_t time_stamp, int64_t ntp_time_ms, int64_t render_time, void* handle) OVERRIDE; int DeliverI420Frame(const webrtc::I420VideoFrame& webrtc_frame) OVERRIDE; bool IsTextureSupported() OVERRIDE; const std::string GetFullOutputPath() const; private: typedef std::list<test::Frame*> FrameQueue; // Returns a frame with the specified |buffer_size|. Tries to avoid allocating // new frames by reusing frames from |free_frame_queue_|. test::Frame* NewFrame(size_t buffer_size); static bool RunRenderThread(void* obj); void ForgetOutputFile(); bool ProcessRenderQueue(); FILE* output_file_; std::string output_path_; std::string output_filename_; webrtc::scoped_ptr<webrtc::ThreadWrapper> thread_; webrtc::scoped_ptr<webrtc::CriticalSectionWrapper> frame_queue_cs_; webrtc::scoped_ptr<webrtc::EventWrapper> frame_render_event_; FrameQueue render_queue_; FrameQueue free_frame_queue_; }; #endif // WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_TO_FILE_RENDERER_H_
// 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 CHROME_BROWSER_COCOA_TOOLBAR_VIEW_H_ #define CHROME_BROWSER_COCOA_TOOLBAR_VIEW_H_ #import <Cocoa/Cocoa.h> #import "chrome/browser/cocoa/background_gradient_view.h" // A view that handles any special rendering of the toolbar bar. At // this time it only draws a gradient. Future changes (e.g. themes) // may require new functionality here. @interface ToolbarView : BackgroundGradientView { } @end #endif // CHROME_BROWSER_COCOA_TOOLBAR_VIEW_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__char_fscanf_add_22b.c Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-22b.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: fscanf Read data from the console using fscanf() * GoodSource: Set data to a small, non-zero number (two) * Sinks: add * GoodSink: Ensure there will not be an overflow before adding 1 to data * BadSink : Add 1 to data, which can cause an overflow * Flow Variant: 22 Control flow: Flow controlled by value of a global variable. Sink functions are in a separate file from sources. * * */ #include "std_testcase.h" #ifndef OMITBAD /* The global variable below is used to drive control flow in the sink function */ extern int CWE190_Integer_Overflow__char_fscanf_add_22_badGlobal; void CWE190_Integer_Overflow__char_fscanf_add_22_badSink(char data) { if(CWE190_Integer_Overflow__char_fscanf_add_22_badGlobal) { { /* POTENTIAL FLAW: Adding 1 to data could cause an overflow */ char result = data + 1; printHexCharLine(result); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* The global variables below are used to drive control flow in the sink functions. */ extern int CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G1Global; extern int CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G2Global; extern int CWE190_Integer_Overflow__char_fscanf_add_22_goodG2BGlobal; /* goodB2G1() - use badsource and goodsink by setting the static variable to false instead of true */ void CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G1Sink(char data) { if(CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G1Global) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Add a check to prevent an overflow from occurring */ if (data < CHAR_MAX) { char result = data + 1; printHexCharLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ void CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G2Sink(char data) { if(CWE190_Integer_Overflow__char_fscanf_add_22_goodB2G2Global) { /* FIX: Add a check to prevent an overflow from occurring */ if (data < CHAR_MAX) { char result = data + 1; printHexCharLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } } /* goodG2B() - use goodsource and badsink */ void CWE190_Integer_Overflow__char_fscanf_add_22_goodG2BSink(char data) { if(CWE190_Integer_Overflow__char_fscanf_add_22_goodG2BGlobal) { { /* POTENTIAL FLAW: Adding 1 to data could cause an overflow */ char result = data + 1; printHexCharLine(result); } } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE590_Free_Memory_Not_on_Heap__free_int_static_31.c Label Definition File: CWE590_Free_Memory_Not_on_Heap__free.label.xml Template File: sources-sink-31.tmpl.c */ /* * @description * CWE: 590 Free Memory Not on Heap * BadSource: static Data buffer is declared static on the stack * GoodSource: Allocate memory on the heap * Sinks: * BadSink : Print then free data * Flow Variant: 31 Data flow using a copy of data within the same function * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE590_Free_Memory_Not_on_Heap__free_int_static_31_bad() { int * data; data = NULL; /* Initialize data */ { /* FLAW: data is allocated on the stack and deallocated in the BadSink */ static int dataBuffer[100]; { size_t i; for (i = 0; i < 100; i++) { dataBuffer[i] = 5; } } data = dataBuffer; } { int * dataCopy = data; int * data = dataCopy; printIntLine(data[0]); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { int * data; data = NULL; /* Initialize data */ { /* FIX: data is allocated on the heap and deallocated in the BadSink */ int * dataBuffer = (int *)malloc(100*sizeof(int)); if (dataBuffer == NULL) { printLine("malloc() failed"); exit(1); } { size_t i; for (i = 0; i < 100; i++) { dataBuffer[i] = 5; } } data = dataBuffer; } { int * dataCopy = data; int * data = dataCopy; printIntLine(data[0]); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } } void CWE590_Free_Memory_Not_on_Heap__free_int_static_31_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE590_Free_Memory_Not_on_Heap__free_int_static_31_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE590_Free_Memory_Not_on_Heap__free_int_static_31_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_environment_51b.c Label Definition File: CWE761_Free_Pointer_Not_at_Start_of_Buffer.label.xml Template File: source-sinks-51b.tmpl.c */ /* * @description * CWE: 761 Free Pointer not at Start of Buffer * BadSource: environment Read input from an environment variable * Sinks: * GoodSink: free() memory correctly at the start of the buffer * BadSink : free() memory not at the start of the buffer * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #define SEARCH_CHAR L'S' #ifndef OMITBAD void CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_environment_51b_badSink(wchar_t * data) { /* FLAW: We are incrementing the pointer in the loop - this will cause us to free the * memory block not at the start of the buffer */ for (; *data != L'\0'; data++) { if (*data == SEARCH_CHAR) { printLine("We have a match!"); break; } } free(data); } #endif /* OMITBAD */ #ifndef OMITGOOD void CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_environment_51b_goodB2GSink(wchar_t * data) { { size_t i; /* FIX: Use a loop variable to traverse through the string pointed to by data */ for (i=0; i < wcslen(data); i++) { if (data[i] == SEARCH_CHAR) { printLine("We have a match!"); break; } } free(data); } } #endif /* OMITGOOD */
/* $NetBSD: mapleio.h,v 1.1 2001/05/26 19:04:39 marcus Exp $ */ /*- * Copyright (c) 2001 Marcus Comstedt * 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 Marcus Comstedt. * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _DREAMCAST_DEV_MAPLE_MAPLEIO_H_ #define _DREAMCAST_DEV_MAPLE_MAPLEIO_H_ /* * Maple (maple, mmc) exported interfaces * Ioctls are all in group 'M'. Ioctl number space is partitioned like: * 0-31 generic ioctls (MAPLEIO) */ #include <sys/types.h> #include <sys/ioccom.h> #include <dreamcast/dev/maple/maple.h> /* * Generic ioctls (0 - 31) */ /* get devinfo */ #define MAPLEIO_GDEVINFO _IOR('M', 0, struct maple_devinfo) #endif /* _DREAMCAST_DEV_MAPLE_MAPLEIO_H_ */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE476_NULL_Pointer_Dereference__binary_if_05.c Label Definition File: CWE476_NULL_Pointer_Dereference.pointflaw.label.xml Template File: point-flaw-05.tmpl.c */ /* * @description * CWE: 476 NULL Pointer Dereference * Sinks: binary_if * GoodSink: Do not check for NULL after the pointer has been dereferenced * BadSink : Check for NULL after a pointer has already been dereferenced * Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse) * * */ #include "std_testcase.h" /* The two variables below are not defined as "const", but are never assigned any other value, so a tool should be able to identify that reads of these will always return their initialized values. */ static int staticTrue = 1; /* true */ static int staticFalse = 0; /* false */ #ifndef OMITBAD void CWE476_NULL_Pointer_Dereference__binary_if_05_bad() { if(staticTrue) { { twoIntsStruct *twoIntsStructPointer = NULL; /* FLAW: Using a single & in the if statement will cause both sides of the expression to be evaluated * thus causing a NPD */ if ((twoIntsStructPointer != NULL) & (twoIntsStructPointer->intOne == 5)) { printLine("intOne == 5"); } } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(staticFalse) instead of if(staticTrue) */ static void good1() { if(staticFalse) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { twoIntsStruct *twoIntsStructPointer = NULL; /* FIX: Use && in the if statement so that if the left side of the expression fails then * the right side will not be evaluated */ if ((twoIntsStructPointer != NULL) && (twoIntsStructPointer->intOne == 5)) { printLine("intOne == 5"); } } } } /* good2() reverses the bodies in the if statement */ static void good2() { if(staticTrue) { { twoIntsStruct *twoIntsStructPointer = NULL; /* FIX: Use && in the if statement so that if the left side of the expression fails then * the right side will not be evaluated */ if ((twoIntsStructPointer != NULL) && (twoIntsStructPointer->intOne == 5)) { printLine("intOne == 5"); } } } } void CWE476_NULL_Pointer_Dereference__binary_if_05_good() { good1(); good2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE476_NULL_Pointer_Dereference__binary_if_05_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE476_NULL_Pointer_Dereference__binary_if_05_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE506_Embedded_Malicious_Code__w32_aes_encrypted_payload_08.c Label Definition File: CWE506_Embedded_Malicious_Code__w32.label.xml Template File: point-flaw-08.tmpl.c */ /* * @description * CWE: 506 Embedded Malicious Code * Sinks: aes_encrypted_payload * GoodSink: Use a plaintext payload in a system call * BadSink : Use an AES encrypted payload in a system call * Flow Variant: 08 Control flow: if(staticReturnsTrue()) and if(staticReturnsFalse()) * * */ #include "std_testcase.h" #include <windows.h> #include <wincrypt.h> #pragma comment(lib, "advapi32") #define HASH_INPUT "ABCDEFG123456" /* INCIDENTAL: Hardcoded crypto */ /* The two function below always return the same value, so a tool should be able to identify that calls to the functions will always return a fixed value. */ static int staticReturnsTrue() { return 1; } static int staticReturnsFalse() { return 0; } #ifndef OMITBAD void CWE506_Embedded_Malicious_Code__w32_aes_encrypted_payload_08_bad() { if(staticReturnsTrue()) { { /* FLAW: encrytped "calc.exe" */ BYTE payload[20] = {0xfb, 0x50, 0xe5, 0x8d, 0xc5, 0x4b, 0xdd, 0xe0, 0x26, 0x2b, 0x98, 0x49, 0x73, 0xfb, 0x4c, 0xf6}; DWORD payloadLen = strlen((char *)payload); HCRYPTPROV hCryptProv = 0; HCRYPTHASH hHash = 0; HCRYPTKEY hKey = 0; char hashData[100] = HASH_INPUT; do { /* Aquire a Context */ if(!CryptAcquireContext(&hCryptProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, 0)) { break; } /* Create hash handle */ if(!CryptCreateHash(hCryptProv, CALG_SHA_256, 0, 0, &hHash)) { break; } /* Hash the input string */ if(!CryptHashData(hHash, (BYTE*)hashData, strlen(hashData), 0)) { break; } /* Derive an AES key from the hash */ if(!CryptDeriveKey(hCryptProv, CALG_AES_256, hHash, 0, &hKey)) { break; } /* Decrypt the payload */ if(!CryptDecrypt(hKey, 0, 1, 0, (BYTE *)payload, &payloadLen)) { break; } /* null terminate */ payload[payloadLen] = '\0'; if(system((char*)payload) <= 0) { printLine("command execution failed!"); exit(1); } } while (0); if (hKey) { CryptDestroyKey(hKey); } if (hHash) { CryptDestroyHash(hHash); } if (hCryptProv) { CryptReleaseContext(hCryptProv, 0); } } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(staticReturnsFalse()) instead of if(staticReturnsTrue()) */ static void good1() { if(staticReturnsFalse()) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { /* FIX: plaintext command */ char * payload = "calc.exe"; if(system(payload) <= 0) { printLine("command execution failed!"); exit(1); } } } } /* good2() reverses the bodies in the if statement */ static void good2() { if(staticReturnsTrue()) { { /* FIX: plaintext command */ char * payload = "calc.exe"; if(system(payload) <= 0) { printLine("command execution failed!"); exit(1); } } } } void CWE506_Embedded_Malicious_Code__w32_aes_encrypted_payload_08_good() { good1(); good2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE506_Embedded_Malicious_Code__w32_aes_encrypted_payload_08_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE506_Embedded_Malicious_Code__w32_aes_encrypted_payload_08_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_ #define COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_ #include <map> #include "base/basictypes.h" #include "components/test_runner/web_task.h" #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" namespace blink { class WebRTCPeerConnectionHandlerClient; }; namespace test_runner { class TestInterfaces; class MockWebRTCPeerConnectionHandler : public blink::WebRTCPeerConnectionHandler { public: MockWebRTCPeerConnectionHandler( blink::WebRTCPeerConnectionHandlerClient* client, TestInterfaces* interfaces); ~MockWebRTCPeerConnectionHandler() override; // WebRTCPeerConnectionHandler related methods bool initialize(const blink::WebRTCConfiguration& configuration, const blink::WebMediaConstraints& constraints) override; void createOffer(const blink::WebRTCSessionDescriptionRequest& request, const blink::WebMediaConstraints& constraints) override; void createOffer(const blink::WebRTCSessionDescriptionRequest& request, const blink::WebRTCOfferOptions& options) override; void createAnswer(const blink::WebRTCSessionDescriptionRequest& request, const blink::WebMediaConstraints& constraints) override; void setLocalDescription( const blink::WebRTCVoidRequest& request, const blink::WebRTCSessionDescription& local_description) override; void setRemoteDescription( const blink::WebRTCVoidRequest& request, const blink::WebRTCSessionDescription& remote_description) override; blink::WebRTCSessionDescription localDescription() override; blink::WebRTCSessionDescription remoteDescription() override; bool updateICE(const blink::WebRTCConfiguration& configuration, const blink::WebMediaConstraints& constraints) override; bool addICECandidate(const blink::WebRTCICECandidate& ice_candidate) override; bool addICECandidate(const blink::WebRTCVoidRequest& request, const blink::WebRTCICECandidate& ice_candidate) override; bool addStream(const blink::WebMediaStream& stream, const blink::WebMediaConstraints& constraints) override; void removeStream(const blink::WebMediaStream& stream) override; void getStats(const blink::WebRTCStatsRequest& request) override; blink::WebRTCDataChannelHandler* createDataChannel( const blink::WebString& label, const blink::WebRTCDataChannelInit& init) override; blink::WebRTCDTMFSenderHandler* createDTMFSender( const blink::WebMediaStreamTrack& track) override; void stop() override; // WebTask related methods WebTaskList* mutable_task_list() { return &task_list_; } private: MockWebRTCPeerConnectionHandler(); // UpdateRemoteStreams uses the collection of |local_streams_| to create // remote MediaStreams with the same number of tracks and notifies |client_| // about added and removed streams. It's triggered when setRemoteDescription // is called. void UpdateRemoteStreams(); blink::WebRTCPeerConnectionHandlerClient* client_; bool stopped_; WebTaskList task_list_; blink::WebRTCSessionDescription local_description_; blink::WebRTCSessionDescription remote_description_; int stream_count_; TestInterfaces* interfaces_; typedef std::map<std::string, blink::WebMediaStream> StreamMap; StreamMap local_streams_; StreamMap remote_streams_; DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); }; } // namespace test_runner #endif // COMPONENTS_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H_
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ #define DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ #include <memory> #include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "device/serial/data_stream.mojom.h" #include "device/serial/serial.mojom.h" #include "device/serial/serial_connection_factory.h" #include "device/serial/serial_device_enumerator.h" #include "mojo/public/cpp/bindings/strong_binding.h" namespace device { class SerialServiceImpl : public serial::SerialService { public: SerialServiceImpl(scoped_refptr<SerialConnectionFactory> connection_factory, mojo::InterfaceRequest<serial::SerialService> request); SerialServiceImpl(scoped_refptr<SerialConnectionFactory> connection_factory, std::unique_ptr<SerialDeviceEnumerator> device_enumerator, mojo::InterfaceRequest<serial::SerialService> request); ~SerialServiceImpl() override; static void Create(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, mojo::InterfaceRequest<serial::SerialService> request); static void CreateOnMessageLoop( scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, mojo::InterfaceRequest<serial::SerialService> request); // SerialService overrides. void GetDevices(const GetDevicesCallback& callback) override; void Connect( const mojo::String& path, serial::ConnectionOptionsPtr options, mojo::InterfaceRequest<serial::Connection> connection_request, mojo::InterfaceRequest<serial::DataSink> sink, mojo::InterfaceRequest<serial::DataSource> source, mojo::InterfacePtr<serial::DataSourceClient> source_client) override; private: SerialDeviceEnumerator* GetDeviceEnumerator(); bool IsValidPath(const mojo::String& path); std::unique_ptr<SerialDeviceEnumerator> device_enumerator_; scoped_refptr<SerialConnectionFactory> connection_factory_; mojo::StrongBinding<serial::SerialService> binding_; DISALLOW_COPY_AND_ASSIGN(SerialServiceImpl); }; } // namespace device #endif // DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_ #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include <string> #include "mojo/public/cpp/bindings/struct_traits.h" #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom-shared.h" namespace mojo { template <> struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::UserAgentBrandVersionDataView, ::blink::UserAgentBrandVersion> { static const std::string& brand(const ::blink::UserAgentBrandVersion& data) { return data.brand; } static const std::string& version( const ::blink::UserAgentBrandVersion& data) { return data.version; } static bool Read(blink::mojom::UserAgentBrandVersionDataView data, ::blink::UserAgentBrandVersion* out); }; template <> struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::UserAgentMetadataDataView, ::blink::UserAgentMetadata> { static const blink::UserAgentBrandList& brand_version_list( const ::blink::UserAgentMetadata& data) { return data.brand_version_list; } static const blink::UserAgentBrandList& brand_full_version_list( const ::blink::UserAgentMetadata& data) { return data.brand_full_version_list; } static const std::string& full_version( const ::blink::UserAgentMetadata& data) { return data.full_version; } static const std::string& platform(const ::blink::UserAgentMetadata& data) { return data.platform; } static const std::string& platform_version( const ::blink::UserAgentMetadata& data) { return data.platform_version; } static const std::string& architecture( const ::blink::UserAgentMetadata& data) { return data.architecture; } static const std::string& model(const ::blink::UserAgentMetadata& data) { return data.model; } static const bool& mobile(const ::blink::UserAgentMetadata& data) { return data.mobile; } static const std::string& bitness(const ::blink::UserAgentMetadata& data) { return data.bitness; } static bool Read(blink::mojom::UserAgentMetadataDataView data, ::blink::UserAgentMetadata* out); }; template <> struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::UserAgentOverrideDataView, ::blink::UserAgentOverride> { static const std::string& ua_string_override( const ::blink::UserAgentOverride& data) { return data.ua_string_override; } static const absl::optional<::blink::UserAgentMetadata> ua_metadata_override( const ::blink::UserAgentOverride& data) { return data.ua_metadata_override; } static bool Read(blink::mojom::UserAgentOverrideDataView, ::blink::UserAgentOverride* out); }; } // namespace mojo #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas 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 University of Texas 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. */ #include "blis.h" void bli_trmm_lu_blk_var1( obj_t* alpha, obj_t* a, obj_t* b, obj_t* beta, obj_t* c, trmm_t* cntl ) { obj_t a1, a1_pack; obj_t b_pack; obj_t c1, c1_pack; dim_t i; dim_t b_alg; dim_t mT_trans; // Initialize all pack objects that are passed into packm_init(). bli_obj_init_pack( &a1_pack ); bli_obj_init_pack( &b_pack ); bli_obj_init_pack( &c1_pack ); // If A is [upper] triangular, use the diagonal offset of A to determine // the length of the non-zero region. if ( bli_obj_is_triangular( *a ) ) mT_trans = bli_abs( bli_obj_diag_offset_after_trans( *a ) ) + bli_obj_width_after_trans( *a ); else // if ( bli_obj_is_general( *a ) mT_trans = bli_obj_length_after_trans( *a ); // Scale C by beta (if instructed). bli_scalm_int( beta, c, cntl_sub_scalm( cntl ) ); // Initialize object for packing B. bli_packm_init( b, &b_pack, cntl_sub_packm_b( cntl ) ); // Pack B and scale by alpha (if instructed). bli_packm_int( alpha, b, &b_pack, cntl_sub_packm_b( cntl ) ); // Partition along the m dimension. for ( i = 0; i < mT_trans; i += b_alg ) { // Determine the current algorithmic blocksize. b_alg = bli_determine_blocksize_f( i, mT_trans, a, cntl_blocksize( cntl ) ); // Acquire partitions for A1 and C1. bli_acquire_mpart_t2b( BLIS_SUBPART1, i, b_alg, a, &a1 ); bli_acquire_mpart_t2b( BLIS_SUBPART1, i, b_alg, c, &c1 ); // Initialize objects for packing A1 and C1. bli_packm_init( &a1, &a1_pack, cntl_sub_packm_a( cntl ) ); bli_packm_init( &c1, &c1_pack, cntl_sub_packm_c( cntl ) ); // Pack A1 and scale by alpha (if instructed). bli_packm_int( alpha, &a1, &a1_pack, cntl_sub_packm_a( cntl ) ); // Pack C1 and scale by beta (if instructed). bli_packm_int( beta, &c1, &c1_pack, cntl_sub_packm_c( cntl ) ); // Perform trmm subproblem. bli_trmm_int( BLIS_LEFT, alpha, &a1_pack, &b_pack, beta, &c1_pack, cntl_sub_trmm( cntl ) ); // Unpack C1 (if C1 was packed). bli_unpackm_int( &c1_pack, &c1, cntl_sub_unpackm_c( cntl ) ); } // If any packing buffers were acquired within packm, release them back // to the memory manager. bli_obj_release_pack( &a1_pack ); bli_obj_release_pack( &b_pack ); bli_obj_release_pack( &c1_pack ); }
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2012 Torus Knot Software Ltd 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 __ShaderProgramWriterCG_H__ #define __ShaderProgramWriterCG_H__ #include "OgreShaderProgramWriterManager.h" namespace Ogre { namespace RTShader { /** \addtogroup Core * @{ */ /** \addtogroup RTShader * @{ */ /** CG target language writer implementation. @see ProgramWriter. */ class _OgreRTSSExport CGProgramWriter : public ProgramWriter { // Interface. public: /** Class constructor. @param language The target shader language. */ CGProgramWriter (); /** Class destructor */ virtual ~CGProgramWriter (); /** @see ProgramWriter::writeSourceCode. */ virtual void writeSourceCode (std::ostream& os, Program* program); /** @see ProgramWriter::getTargetLanguage. */ virtual const String& getTargetLanguage () const { return TargetLanguage; } static String TargetLanguage; // Protected methods. protected: /** Initialize string maps. */ void initializeStringMaps (); /** Write the program dependencies. */ void writeProgramDependencies (std::ostream& os, Program* program); /** Write a uniform parameter. */ void writeUniformParameter (std::ostream& os, UniformParameterPtr parameter); /** Write a function parameter. */ void writeFunctionParameter (std::ostream& os, ParameterPtr parameter); /** Write a local parameter. */ void writeLocalParameter (std::ostream& os, ParameterPtr parameter); /** Write a function declaration. */ void writeFunctionDeclaration (std::ostream& os, Function* function, ParameterPtr & colorParameter); /** Write function atom instance. */ void writeAtomInstance (std::ostream& os, FunctionAtom* atom); protected: typedef map<GpuConstantType, const char*>::type GpuConstTypeToStringMap; typedef map<Parameter::Semantic, const char*>::type ParamSemanticToStringMap; // Attributes. protected: GpuConstTypeToStringMap mGpuConstTypeMap; // Map between GPU constant type to string value. ParamSemanticToStringMap mParamSemanticMap; // Map between parameter semantic to string value. }; /** CG program writer factory implementation. @see ProgramWriterFactory */ class _OgreRTSSExport ShaderProgramWriterCGFactory : public ProgramWriterFactory { public: ShaderProgramWriterCGFactory() { mLanguage = "cg"; } virtual ~ShaderProgramWriterCGFactory() {} /** @see ProgramWriterFactory::getTargetLanguage */ virtual const String& getTargetLanguage(void) const { return mLanguage; } /** @see ProgramWriterFactory::create */ virtual ProgramWriter* create(void) { return OGRE_NEW CGProgramWriter(); } private: String mLanguage; }; /** @} */ /** @} */ } } #endif
/* * GlobalClusteringCoefficient.h * * Created on: 12.11.2013 */ #ifndef GLOBALCLUSTERINGCOEFFICIENT_H_ #define GLOBALCLUSTERINGCOEFFICIENT_H_ #include "../graph/Graph.h" namespace NetworKit { /** * @ingroup global */ class GlobalClusteringCoefficient { public: virtual double approximate(const Graph& G, int k); }; } /* namespace NetworKit */ #endif /* GLOBALCLUSTERINGCOEFFICIENT_H_ */
// Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2013-2014 Dogecoin Developers // Copyright (c) 2013-2014 Team Mooncoin // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H #include <map> class uint256; class CBlockIndex; /** Block-chain checkpoints are compiled-in sanity checks. * They are updated every release or three. */ namespace Checkpoints { // Returns true if block passes checkpoint checks bool CheckBlock(int nHeight, const uint256& hash); // Return conservative estimate of total number of blocks, 0 if unknown int GetTotalBlocksEstimate(); // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex); double GuessVerificationProgress(CBlockIndex *pindex); } #endif
#include <stdio.h> #include <stdlib.h> int main(){ int n,m,k,i,a,b,c; scanf("%d",&n); scanf("%d",&m); scanf("%d",&k); a=m; b=0; c=0; for(i=0;i<n;i++){ if(i!=0 && i%k==0){ c=c+2; m=a-(a*c/100);} b=b+m; } printf("%d\n",b); return 0; }
/* * Copyright 2008-2014 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! \file version.h * \brief Cusp version */ #pragma once #include <cusp/detail/config.h> // This is the only cusp header that is guaranteed to // change with every cusp release. // // CUSP_VERSION % 100 is the sub-minor version // CUSP_VERSION / 100 % 1000 is the minor version // CUSP_VERSION / 100000 is the major version #define CUSP_VERSION 600 #define CUSP_MAJOR_VERSION (CUSP_VERSION / 100000) #define CUSP_MINOR_VERSION (CUSP_VERSION / 100 % 1000) #define CUSP_SUBMINOR_VERSION (CUSP_VERSION % 100)
#pragma once #include "ofMain.h" #include "baseScene.h" class RileyArcsRoy : public baseScene { public: void setup(); void update(); void draw(); ofParameter<float> thinWideRatio;//, speed, oscMax; float minWidth, minSpacing, initTime; };
// // SSRatingDemoViewController.h // SSCatalog // // Created by Sam Soffes on 2/3/11. // Copyright 2011 Sam Soffes. All rights reserved. // @interface SSRatingDemoViewController : SSRatingPickerViewController + (NSString *)title; @end
// Copyright (C) 2002-2012 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __C_GUI_SCROLL_BAR_H_INCLUDED__ #define __C_GUI_SCROLL_BAR_H_INCLUDED__ #include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_GUI_ #include "IGUIScrollBar.h" #include "IGUIButton.h" namespace irr { namespace gui { class CGUIScrollBar : public IGUIScrollBar { public: //! constructor CGUIScrollBar(bool horizontal, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle, bool noclip=false); //! destructor virtual ~CGUIScrollBar(); //! called if an event happened. virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; //! draws the element and its children virtual void draw() _IRR_OVERRIDE_; virtual void OnPostRender(u32 timeMs) _IRR_OVERRIDE_; //! gets the maximum value of the scrollbar. virtual s32 getMax() const _IRR_OVERRIDE_; //! sets the maximum value of the scrollbar. virtual void setMax(s32 max) _IRR_OVERRIDE_; //! gets the minimum value of the scrollbar. virtual s32 getMin() const _IRR_OVERRIDE_; //! sets the minimum value of the scrollbar. virtual void setMin(s32 min) _IRR_OVERRIDE_; //! gets the small step value virtual s32 getSmallStep() const _IRR_OVERRIDE_; //! sets the small step value virtual void setSmallStep(s32 step) _IRR_OVERRIDE_; //! gets the large step value virtual s32 getLargeStep() const _IRR_OVERRIDE_; //! sets the large step value virtual void setLargeStep(s32 step) _IRR_OVERRIDE_; //! gets the current position of the scrollbar virtual s32 getPos() const _IRR_OVERRIDE_; //! sets the position of the scrollbar virtual void setPos(s32 pos) _IRR_OVERRIDE_; //! updates the rectangle virtual void updateAbsolutePosition() _IRR_OVERRIDE_; //! Writes attributes of the element. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; private: void refreshControls(); s32 getPosFromMousePos(const core::position2di &p) const; IGUIButton* UpButton; IGUIButton* DownButton; core::rect<s32> SliderRect; bool Dragging; bool Horizontal; bool DraggedBySlider; bool TrayClick; s32 Pos; s32 DrawPos; s32 DrawHeight; s32 Min; s32 Max; s32 SmallStep; s32 LargeStep; s32 DesiredPos; u32 LastChange; video::SColor CurrentIconColor; f32 range () const { return (f32) ( Max - Min ); } }; } // end namespace gui } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ #endif
// // FlashCardListController.h // FlashCards // // Created by Raul Chacon on 12/2/11. // Copyright (c) 2011 Student. All rights reserved. // #import <UIKit/UIKit.h> @class DatabaseModel; @class AddFlashCardController; @class FlashCardModel; /* * FlashCardListController: * table view controller that displays all flash cards for a given subject. */ @interface FlashCardListController : UITableViewController <UITableViewDelegate, UITableViewDataSource> @property (nonatomic, strong) NSMutableArray *flashCards; @property (nonatomic, strong) DatabaseModel *databaseModel; @property (nonatomic, strong) NSMutableString *parentSubjectTitle; // given subject @property (nonatomic, assign) int needsRefresh; // Edit button which allow for insert and update to flash card db table - (IBAction) editButtonPressed:(id)sender; @end
/* * Author: Brian <brian@vamrs.com> * Copyright (c) 2019 Vamrs Corporation. * * SPDX-License-Identifier: MIT */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "mraa_internal.h" #define MRAA_ROCKPI4_GPIO_COUNT 27 #define MRAA_ROCKPI4_I2C_COUNT 3 #define MRAA_ROCKPI4_SPI_COUNT 2 #define MRAA_ROCKPI4_UART_COUNT 2 #define MRAA_ROCKPI4_PWM_COUNT 2 #define MRAA_ROCKPI4_AIO_COUNT 1 #define MRAA_ROCKPI4_PIN_COUNT 40 mraa_board_t * mraa_rockpi4(); #ifdef __cplusplus } #endif
/* * The MIT License (MIT) * * Copyright (c) 2015 Microsoft Corporation * * -=- Robust Distributed System Nucleus (rDSN) -=- * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #pragma once #include <dsn/tool_api.h> namespace dsn { namespace tools { class nativerun : public tool_app { public: nativerun(const char* name) : tool_app(name) { } void install(service_spec& s); virtual void run() override; }; } } // end namespace dsn::tools
// // OSPlasticButtonCell.h // Pixen // // Copyright 2005-2012 Pixen Project. All rights reserved. // @interface OSPlasticButtonCell : NSButtonCell @end
/** In short, mpool is distributed under so called "BSD license", Copyright (c) 2009-2010 Tatsuhiko Kubo <cubicdaiya@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 the authors 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. */ /* written by C99 style */ #include "mpool.h" /** * private function */ static inline bool mpool_extend(mpool_pool_t *p, size_t siz, mpool_t *pool); static inline size_t mpool_align(size_t siz); static inline size_t mpool_decide_create_siz(size_t siz); /** * create memory pool */ mpool_t *mpool_create (size_t siz) { mpool_t *pool; siz = mpool_decide_create_siz(siz); pool = malloc(sizeof(*pool)); if (pool == NULL) { return NULL; } pool->mpool = malloc(sizeof(*pool->mpool)); if (pool->mpool == NULL) { return NULL; } pool->mpool->pool = malloc(siz); if (pool->mpool->pool == NULL) { return NULL; } pool->mpool->next = NULL; pool->begin = pool->mpool->pool; pool->head = pool->mpool; pool->usiz = 0; pool->msiz = siz; return pool; } /** * allocate memory from memory pool */ void *mpool_alloc(size_t siz, mpool_t *pool) { mpool_pool_t **p = &pool->mpool; mpool_pool_t *pp = *p; size_t usiz = mpool_align(pool->usiz + siz); size_t msiz = pool->msiz; void *d = pool->begin; if (usiz > msiz) { if (!mpool_extend(pp, usiz * 2 + 1, pool)) { return NULL; } pool->usiz = 0; pool->msiz = usiz * 2; d = pool->begin; pool->begin += mpool_align(siz); *p = pp->next; } else { pool->usiz = usiz; pool->begin += mpool_align(siz); } return d; } /** * release all memory pool */ void mpool_destroy (mpool_t *pool) { for (mpool_pool_t *cur = pool->head, *next; cur; cur = next){ next = cur->next; MPOOL_FREE(cur->pool); MPOOL_FREE(cur); } MPOOL_FREE(pool); } /* following is private function */ /** * extend memory pool */ static inline bool mpool_extend(mpool_pool_t *p, size_t siz, mpool_t *pool) { siz = mpool_decide_create_siz(siz); mpool_pool_t *pp; pp = malloc(sizeof(*pp)); if (pp == NULL) { return false; } pp->pool = malloc(siz); if (pp->pool == NULL) { return false; } memset(pp->pool, 0, siz); pp->next = NULL; p->next = pp; pool->begin = pp->pool; return true; } /** * align byte boundary */ static inline size_t mpool_align(size_t siz) { return (siz + (MPOOL_ALIGN_SIZE - 1)) & ~(MPOOL_ALIGN_SIZE - 1); } /** * decide mpool size */ static inline size_t mpool_decide_create_siz(size_t siz) { return siz <= 0 ? MPOOL_POOL_SIZ : mpool_align(siz); }
#pragma once #include <string> #include "tnet_http.h" namespace tnet { class WsClient : public nocopyable , public std::enable_shared_from_this<WsClient> { public: WsClient(IOLoop* loop); ~WsClient(); //now only support ip:port void connect(const std::string& url, const WsCallback_t& callback); void connect(const std::string& url, const Headers_t& headers, const WsCallback_t& callback); private: void connect(HttpRequest& request, const WsCallback_t& callback); void onResponse(const HttpConnectorPtr_t&, const HttpResponse&, ResponseEvent, const WsCallback_t&); void onConnect(const HttpConnectorPtr_t& conn, bool connected, const std::string& requestData, const WsCallback_t& callback); private: IOLoop* m_loop; }; }
// // agc_crcf_example.c // // Automatic gain control example demonstrating its transient // response. // #include <stdio.h> #include <stdlib.h> #include <math.h> #include <complex.h> #include <getopt.h> #include "liquid.h" #define OUTPUT_FILENAME "agc_crcf_squelch_example.m" // print usage/help message void usage() { printf("agc_crcf_squelch_example [options]\n"); printf(" -h : print usage\n"); printf(" -b <bandwidth> : AGC bandwidth, b >= 0, default: 0.25\n"); } int main(int argc, char*argv[]) { // options float bt = 0.25f; // agc loop bandwidth int dopt; while((dopt = getopt(argc,argv,"hn:N:s:b:")) != EOF){ switch (dopt) { case 'h': usage(); return 0; case 'b': bt = atof(optarg); break; default: exit(1); } } // validate input if (bt < 0.0f) { fprintf(stderr,"error: %s, bandwidth must be positive\n", argv[0]); exit(1); } unsigned int i; // create agc object, set loop bandwidth, and initialize parameters agc_crcf q = agc_crcf_create(); agc_crcf_set_bandwidth(q, bt); agc_crcf_set_signal_level(q,1e-3f); // initial guess at starting signal level // initialize squelch functionality agc_crcf_squelch_enable(q); // enable squelch agc_crcf_squelch_set_threshold(q, -50); // threshold for detection [dB] agc_crcf_squelch_set_timeout (q, 100); // timeout for hysteresis // initialize arrays unsigned int num_samples = 2000; // total number of samples to run float complex x [num_samples]; // input float complex y [num_samples]; // output float rssi[num_samples]; // received signal strength int mode[num_samples]; // squelch mode // print info printf("automatic gain control // loop bandwidth: %4.2e\n",bt); // generate signal, applying tapering window appropriately for (i=0; i<num_samples; i++) { float gamma = 0.0f; if (i < 500) gamma = 1e-3f; else if (i < 550) gamma = 1e-3f + (1e-2f - 1e-3f)*(0.5f - 0.5f*cosf(M_PI*(float)(i- 500)/50.0f)); else if (i < 1450) gamma = 1e-2f; else if (i < 1500) gamma = 1e-3f + (1e-2f - 1e-3f)*(0.5f + 0.5f*cosf(M_PI*(float)(i-1450)/50.0f)); else gamma = 1e-3f; // apply window to signal x[i] = gamma * cexpf(_Complex_I*2*M_PI*0.0193f*i); } // run agc for (i=0; i<num_samples; i++) { // apply gain agc_crcf_execute(q, x[i], &y[i]); // retrieve signal level [dB] rssi[i] = agc_crcf_get_rssi(q); // get squelch mode mode[i] = agc_crcf_squelch_get_status(q); // print status every so often if ( (i % 100)==0 || i==num_samples-1 || mode[i] == LIQUID_AGC_SQUELCH_RISE || mode[i] == LIQUID_AGC_SQUELCH_FALL) { char mode_str[20] = ""; switch (mode[i]) { case LIQUID_AGC_SQUELCH_ENABLED: sprintf(mode_str,"squelch enabled"); break; case LIQUID_AGC_SQUELCH_RISE: sprintf(mode_str,"signal detected"); break; case LIQUID_AGC_SQUELCH_SIGNALHI: sprintf(mode_str,"signal high"); break; case LIQUID_AGC_SQUELCH_FALL: sprintf(mode_str,"signal falling"); break; case LIQUID_AGC_SQUELCH_SIGNALLO: sprintf(mode_str,"signal low"); break; case LIQUID_AGC_SQUELCH_TIMEOUT: sprintf(mode_str,"signal timed out"); break; case LIQUID_AGC_SQUELCH_DISABLED: sprintf(mode_str,"squelch disabled"); break; default: sprintf(mode_str,"(unknown)"); break; } printf("%4u : %18s (%1u), rssi = %8.2f dB\n", i, mode_str, mode[i], rssi[i]); } } // destroy AGC object agc_crcf_destroy(q); // // export results // FILE* fid = fopen(OUTPUT_FILENAME,"w"); if (!fid) { fprintf(stderr,"error: %s, could not open '%s' for writing\n", argv[0], OUTPUT_FILENAME); exit(1); } fprintf(fid,"%% %s: auto-generated file\n\n",OUTPUT_FILENAME); fprintf(fid,"clear all;\nclose all;\n\n"); fprintf(fid,"n = %u;\n", num_samples); for (i=0; i<num_samples; i++) { fprintf(fid,"x(%4u) = %12.4e + j*%12.4e;\n", i+1, crealf(x[i]), cimagf(x[i])); fprintf(fid,"y(%4u) = %12.4e + j*%12.4e;\n", i+1, crealf(y[i]), cimagf(y[i])); fprintf(fid,"rssi(%4u) = %12.4e;\n", i+1, rssi[i]); fprintf(fid,"mode(%4u) = %d;\n", i+1, mode[i]); } // plot results fprintf(fid,"\n"); fprintf(fid,"figure('position',[100 100 1200 900]);\n"); fprintf(fid,"t = 0:(n-1);\n"); fprintf(fid,"subplot(4,1,1);\n"); fprintf(fid," plot(t, real(x), '-', 'LineWidth',1.2, 'Color',[0 0.2 0.5],...\n"); fprintf(fid," t, imag(x), '-', 'LineWidth',1.2, 'Color',[0 0.5 0.2]);\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('sample index');\n"); fprintf(fid," ylabel('input');\n"); fprintf(fid," axis([0 %u -0.011 0.011]);\n", num_samples); fprintf(fid,"subplot(4,1,2);\n"); fprintf(fid," plot(t, real(y), '-', 'LineWidth',1.2, 'Color',[0 0.2 0.5],...\n"); fprintf(fid," t, imag(y), '-', 'LineWidth',1.2, 'Color',[0 0.5 0.2]);\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('sample index');\n"); fprintf(fid," ylabel('output');\n"); fprintf(fid,"subplot(4,1,3);\n"); fprintf(fid," plot(t,rssi,'-','LineWidth',1.2,'Color',[0.5 0 0]);\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('sample index');\n"); fprintf(fid," ylabel('rssi [dB]');\n"); fprintf(fid,"subplot(4,1,4);\n"); fprintf(fid," plot(t,mode,'-s','LineWidth',1.2,'MarkerSize',4,'Color',[0.5 0 0]);\n"); fprintf(fid," grid on;\n"); fprintf(fid," xlabel('sample index');\n"); fprintf(fid," ylabel('squelch mode');\n"); fprintf(fid," axis([0 %u 0 8]);\n", num_samples); fclose(fid); printf("results written to %s\n", OUTPUT_FILENAME); printf("done.\n"); return 0; }
/****************************************************************************** * The MIT License (MIT) * * Copyright (c) 2017-2018 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. ******************************************************************************/ #pragma once #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" #include "gl_common.h"
#ifndef SRC_NODE_LTTNG_PROVIDER_H_ #define SRC_NODE_LTTNG_PROVIDER_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #define TRACEPOINT_CREATE_PROBES #define TRACEPOINT_DEFINE #include "node_lttng_tp.h" namespace node { #define FOR_ALL_GC_TYPES(APPLY) \ APPLY(kGCTypeScavenge) \ APPLY(kGCTypeMarkSweepCompact) \ APPLY(kGCTypeAll) #define FOR_ALL_GC_CALLBACK_FLAGS(APPLY) \ APPLY(kNoGCCallbackFlags) \ APPLY(kGCCallbackFlagConstructRetainedObjectInfos) \ APPLY(kGCCallbackFlagForced) \ APPLY(kGCCallbackFlagSynchronousPhantomCallbackProcessing) void NODE_HTTP_SERVER_REQUEST(node_lttng_http_server_request_t* req, node_lttng_connection_t* conn, const char *remote, int port, const char *method, const char *url, int fd) { tracepoint(node, http_server_request, req->url, req->method, \ req->forwarded_for); } void NODE_HTTP_SERVER_RESPONSE(node_lttng_connection_t* conn, const char *remote, int port, int fd) { tracepoint(node, http_server_response, port, conn->remote, fd); } void NODE_HTTP_CLIENT_REQUEST(node_lttng_http_client_request_t* req, node_lttng_connection_t* conn, const char *remote, int port, const char *method, const char *url, int fd) { tracepoint(node, http_client_request, req->url, req->method); } void NODE_HTTP_CLIENT_RESPONSE(node_lttng_connection_t* conn, const char *remote, int port, int fd) { tracepoint(node, http_client_response, port, conn->remote, fd); } void NODE_NET_SERVER_CONNECTION(node_lttng_connection_t* conn, const char *remote, int port, int fd) { tracepoint(node, net_server_connection, conn->remote, port, fd, \ conn->buffered); } void NODE_NET_STREAM_END(node_lttng_connection_t* conn, const char *remote, int port, int fd) { tracepoint(node, net_stream_end, conn->remote, port, fd); } void NODE_GC_START(v8::GCType type, v8::GCCallbackFlags flags, v8::Isolate* isolate) { const char* typeStr = "Unknown GC Type"; const char* flagsStr = "Unknown GC Flag"; #define BUILD_IF(f) if (type == v8::GCType::f) { typeStr = #f; } FOR_ALL_GC_TYPES(BUILD_IF); #undef BUILD_IF #define BUILD_IF(f) if (flags == v8::GCCallbackFlags::f) { flagsStr = #f; } FOR_ALL_GC_CALLBACK_FLAGS(BUILD_IF); #undef BUILD_IF tracepoint(node, gc_start, typeStr, flagsStr); } void NODE_GC_DONE(v8::GCType type, v8::GCCallbackFlags flags, v8::Isolate* isolate) { const char* typeStr = "Unknown GC Type"; const char* flagsStr = "Unknown GC Flag"; #define BUILD_IF(f) if (type == v8::GCType::f) { typeStr = #f; } FOR_ALL_GC_TYPES(BUILD_IF); #undef BUILD_IF #define BUILD_IF(f) if (flags == v8::GCCallbackFlags::f) { flagsStr = #f; } FOR_ALL_GC_CALLBACK_FLAGS(BUILD_IF); #undef BUILD_IF tracepoint(node, gc_done, typeStr, flagsStr); } bool NODE_HTTP_SERVER_REQUEST_ENABLED() { return true; } bool NODE_HTTP_SERVER_RESPONSE_ENABLED() { return true; } bool NODE_HTTP_CLIENT_REQUEST_ENABLED() { return true; } bool NODE_HTTP_CLIENT_RESPONSE_ENABLED() { return true; } bool NODE_NET_SERVER_CONNECTION_ENABLED() { return true; } bool NODE_NET_STREAM_END_ENABLED() { return true; } } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_LTTNG_PROVIDER_H_
/* newroot.c Replace the current root with a new one */ #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mount.h> void usage(void) { fprintf(stderr, "Usage: newroot [-i] <block-special>\n"); fprintf(stderr, "-i: copy mfs binary from boot image to memory\n"); exit(1); } int main(int argc, char *argv[]) { int r; char *dev; int mountflags; r = 0; mountflags = 0; /* !read-only */ if (argc != 2 && argc != 3) usage(); if(argc == 2) { dev = argv[1]; } else if(argc == 3) { /* -i flag was supposedly entered. Verify.*/ if(strcmp(argv[1], "-i") != 0) usage(); mountflags |= MS_REUSE; dev = argv[2]; } r = mount(dev, "/", mountflags, NULL, NULL); if (r != 0) { fprintf(stderr, "newroot: mount failed: %s\n",strerror(errno)); exit(1); } return 0; }
#ifdef HAVE_CONFIG_H #include "../ext_config.h" #endif #include <php.h> #include "../php_ext.h" #include "../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/memory.h" #include "kernel/fcall.h" #include "kernel/operators.h" /** * Arithmetic operations */ ZEPHIR_INIT_CLASS(Test_Range) { ZEPHIR_REGISTER_CLASS(Test, Range, test, range, test_range_method_entry, 0); return SUCCESS; } PHP_METHOD(Test_Range, inclusive1) { zval *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_3 = NULL; zval _0, _1, *_2 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, 10); ZEPHIR_CALL_FUNCTION(&_2, "range", &_3, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(_4, _2); RETURN_CTOR(_4); } PHP_METHOD(Test_Range, exclusive1) { zval *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_3 = NULL; zval _0, _1, *_2 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, 10); ZEPHIR_CALL_FUNCTION(&_2, "range", &_3, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(_4, _2); RETURN_CTOR(_4); }
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(C) 2022 Marvell. */ #include "cn10k_worker.h" #include "cnxk_eventdev.h" #include "cnxk_worker.h" #define R(name, flags) \ SSO_CMN_DEQ_SEG_BURST(cn10k_sso_hws_deq_seg_burst_##name, \ cn10k_sso_hws_deq_seg_##name, flags) \ SSO_CMN_DEQ_SEG_BURST(cn10k_sso_hws_reas_deq_seg_burst_##name, \ cn10k_sso_hws_reas_deq_seg_##name, flags | NIX_RX_REAS_F) NIX_RX_FASTPATH_MODES_64_79 #undef R
/* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #include "nrf_drv_adc.h" #include "app_error.h" #include "es_battery_voltage.h" static uint16_t m_batt_lvl_in_milli_volts; #define ADC_REF_VOLTAGE_IN_MILLIVOLTS 600 // /< Reference voltage (in milli volts) used by ADC while doing conversion. #define DIODE_FWD_VOLT_DROP_MILLIVOLTS 270 // /< Typical forward voltage drop of the diode (Part no: SD103ATW-7-F) that is connected in series with the voltage supply. This is the voltage drop when the forward current is 1mA. Source: Data sheet of 'SURFACE MOUNT SCHOTTKY BARRIER DIODE ARRAY' available at www.diodes.com. #define ADC_RES_10BIT 1024 // /< Maximum digital value for 10-bit ADC conversion. #define ADC_PRE_SCALING_COMPENSATION 6 // /< The ADC is configured to use VDD with 1/3 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage. #define ADC_REF_VBG_VOLTAGE_IN_MILLIVOLTS 1200 // /< Value in millivolts for voltage used as reference in ADC conversion on NRF51. #define ADC_INPUT_PRESCALER 3 // /< Input prescaler for ADC convestion on NRF51. static nrf_adc_value_t adc_buf[1]; #define ADC_RESULT_IN_MILLI_VOLTS(ADC_VALUE) \ ((((ADC_VALUE) *ADC_REF_VBG_VOLTAGE_IN_MILLIVOLTS) / ADC_RES_10BIT) * ADC_INPUT_PRESCALER) static void adc_event_handler(nrf_drv_adc_evt_t const * p_event) { if (p_event->type == NRF_DRV_ADC_EVT_DONE) { nrf_adc_value_t adc_result; uint32_t err_code; adc_result = p_event->data.done.p_buffer[0]; err_code = nrf_drv_adc_buffer_convert(p_event->data.done.p_buffer, 1); APP_ERROR_CHECK(err_code); m_batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result) + DIODE_FWD_VOLT_DROP_MILLIVOLTS; } } void es_battery_voltage_init(void) { ret_code_t err_code = nrf_drv_adc_init(NULL, adc_event_handler); APP_ERROR_CHECK(err_code); static nrf_drv_adc_channel_t channel = NRF_DRV_ADC_DEFAULT_CHANNEL( NRF_ADC_CONFIG_INPUT_DISABLED); channel.config.config.input = (uint32_t)NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD; nrf_drv_adc_channel_enable(&channel); err_code = nrf_drv_adc_buffer_convert(&adc_buf[0], 1); APP_ERROR_CHECK(err_code); nrf_drv_adc_sample(); } void es_battery_voltage_get(uint16_t * p_vbatt) { *p_vbatt = m_batt_lvl_in_milli_volts; if (!nrf_adc_is_busy()) { nrf_drv_adc_sample(); } }
/*===========================================================================*/ /* */ /* This file is part of the SYMPHONY Branch, Cut, and Price Library. */ /* */ /* SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and */ /* Laci Ladanyi (ladanyi@us.ibm.com). */ /* */ /* (c) Copyright 2000-2013 Ted Ralphs. All Rights Reserved. */ /* */ /* This software is licensed under the Eclipse Public License. Please see */ /* accompanying file for terms. */ /* */ /*===========================================================================*/ #ifndef _USER_H #define _USER_H /*---------------------------------------------------------------------------*\ * Use this data structure to store the value of any run-time parameters. \*---------------------------------------------------------------------------*/ typedef struct USER_PARAMETERS { /* Name of file containing the instance data */ char infile[MAX_FILE_NAME_LENGTH + 1]; } user_parameters; /*---------------------------------------------------------------------------*\ * Use this data structure to store the instance data after it is read in. \*---------------------------------------------------------------------------*/ typedef struct USER_PROBLEM { int colnum; /* Number of columns in base matrix */ int rownum; /* Number of rows in base matrix */ user_parameters par; /* Parameters */ // number of cones int num_cones; // type of cone 0 for LORENTZ cone and 1 for ROTATED LORENTZ cone int * cone_type; int * cone_size; int ** cone_members; char * is_int; double * curr_solution; } user_problem; #endif
/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __OCP_DMI_H #define __OCP_DMI_H #include <cpu/x86/msr.h> #include <device/device.h> #include <smbios.h> #define TBF "To Be Filled By O.E.M." extern msr_t xeon_sp_ppin[]; /* Override SMBIOS type 11 OEM string 1 to string 6 */ void ocp_oem_smbios_strings(struct device *dev, struct smbios_type11 *t); /* This function allows adding the same repeated string to the table */ int smbios_add_oem_string(u8 *start, const char *str); #endif
#include <time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sched.h> #include <rk_api.h> /* Number of iteration per task */ #define MAX_RESOURCE_SET_NAME_LEN 20 #define MILLISEC_TO_NANOSEC 1000000LL #define NANOSEC_LL 1000000000LL #define NUM_PROCESS 32 int main(int argc, char *argv[]){ int i; int rd; int ret; struct cpu_reserve_attr cpu_attr; struct timespec now; int pid[NUM_PROCESS] = {0,}; int cpuid; long long C, T, D; char R[MAX_RESOURCE_SET_NAME_LEN]; memset(&cpu_attr, 0, sizeof(cpu_attr)); /* Default values */ for (cpuid = 0; cpuid < 2; cpuid++) { //for (cpuid = 0; cpuid < 1; cpuid++) { ret = fork(); if (ret != 0) continue; pid[cpuid] = getpid(); if (cpuid == 0) { C = 5 * MILLISEC_TO_NANOSEC; T = 50 * MILLISEC_TO_NANOSEC; D = 50 * MILLISEC_TO_NANOSEC; } else { C = 110 * MILLISEC_TO_NANOSEC; T = 1000 * MILLISEC_TO_NANOSEC; D = 1000 * MILLISEC_TO_NANOSEC; } //T = D = (100 - cpuid) * MILLISEC_TO_NANOSEC; clock_gettime(CLOCK_REALTIME, &now); //sprintf(R, "RSET%ld", now.tv_nsec / 1000000 + now.tv_sec * 1000); sprintf(R, "RSET%d", getpid()); //printf("Affine CPU : %d\n", cpuid); //printf("Compute Time : %lld\n", C); //printf("Reserve Period : %lld\n", T); //printf("Reserve Deadline: %lld\n", D); cpu_set_t cpus; CPU_ZERO(&cpus); CPU_SET(0, &cpus); cpu_attr.compute_time.tv_sec=(C/NANOSEC_LL); cpu_attr.period.tv_sec=(T/NANOSEC_LL); cpu_attr.deadline.tv_sec=(D/NANOSEC_LL); cpu_attr.blocking_time.tv_sec=0; cpu_attr.start_time.tv_sec=0; cpu_attr.compute_time.tv_nsec=(C%NANOSEC_LL); cpu_attr.period.tv_nsec=(T%NANOSEC_LL); cpu_attr.deadline.tv_nsec=(D%NANOSEC_LL); cpu_attr.blocking_time.tv_nsec=0; cpu_attr.start_time.tv_nsec=0; cpu_attr.reserve_mode.sch_mode = RSV_HARD; cpu_attr.reserve_mode.enf_mode = RSV_HARD; cpu_attr.reserve_mode.rep_mode = RSV_SOFT; cpu_attr.cpunum = 0; //sched_setaffinity(getpid(), sizeof(cpus), &cpus); rd = rk_resource_set_create(R, 1, 1, CPURSV_MIGRATION_DEFAULT); rk_cpu_reserve_create(rd, &cpu_attr); rk_resource_set_attach_process(rd, getpid(), NULL); //while (1); //return; execv("../busyloop", NULL); //rt_wait_for_next_period(); //printf("Resource Set Name is %s and Descriptor is %d\n",R, rd); } sleep(2); printf("## Enter any key to kill all child processes\n"); getchar(); for (cpuid = 0; cpuid < NUM_PROCESS; cpuid++) { kill(pid[cpuid], 9); } return 0; }
// SHE library // Copyright (C) 2012-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef SHE_CLIPBOARD_IMPL_H_INCLUDED #define SHE_CLIPBOARD_IMPL_H_INCLUDED #pragma once #include "base/string.h" #include "she/clipboard.h" #ifdef _MSC_VER #pragma warning(disable:4996) // To void MSVC warning about std::copy() with unsafe arguments #endif namespace she { class ClipboardImpl : public Clipboard { public: ~ClipboardImpl() { } void dispose() override { delete this; } std::string getText() override { std::string text; if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { if (OpenClipboard(win_get_window())) { HGLOBAL hglobal = GetClipboardData(CF_UNICODETEXT); if (hglobal != NULL) { LPWSTR lpstr = static_cast<LPWSTR>(GlobalLock(hglobal)); if (lpstr != NULL) { text = base::to_utf8(lpstr).c_str(); GlobalUnlock(hglobal); } } CloseClipboard(); } } return text; } void setText(const std::string& text) { if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { if (OpenClipboard(win_get_window())) { EmptyClipboard(); if (!text.empty()) { std::wstring wstr = base::from_utf8(text); int len = wstr.size(); HGLOBAL hglobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(WCHAR)*(len+1)); LPWSTR lpstr = static_cast<LPWSTR>(GlobalLock(hglobal)); std::copy(wstr.begin(), wstr.end(), lpstr); GlobalUnlock(hglobal); SetClipboardData(CF_UNICODETEXT, hglobal); } CloseClipboard(); } } } private: std::string m_text; }; } // namespace she #endif
#include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<linux/unistd.h> /* * Test the seek file operation on a file whose name is given as the first * argument. */ int main(int argc, char **argv) { int fd; int rc; if( argc != 2 ) { printf("usage: %s filename\n", argv[0]); exit(2); } fd = open(argv[1], O_RDONLY, 0); if(fd == -1) { perror("test_seek:open"); exit(2); } rc = lseek(fd, 10, SEEK_SET); if( rc == -1 ) { perror("test_seek:lseek"); close(fd); exit(1); } close(fd); exit(0); }
/* * Bittorrent Client using Qt and libtorrent. * Copyright (C) 2016 Vladimir Golovnev <glassez@yandex.ru> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give permission to * link this program with the OpenSSL project's "OpenSSL" library (or with * modified versions of it that use the same license as the "OpenSSL" library), * and distribute the linked executables. You must obey the GNU General Public * License in all respects for all of the code used other than "OpenSSL". If you * modify file(s), you may extend this exception to your version of the file(s), * but you are not obligated to do so. If you do not wish to do so, delete this * exception statement from your version. */ #ifndef CATEGORYFILTERMODEL_H #define CATEGORYFILTERMODEL_H #include <QAbstractItemModel> #include <QHash> #include <QModelIndex> namespace BitTorrent { class TorrentHandle; } class CategoryModelItem; class CategoryFilterModel: public QAbstractItemModel { Q_OBJECT public: explicit CategoryFilterModel(QObject *parent = nullptr); ~CategoryFilterModel(); int columnCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; Qt::ItemFlags flags(const QModelIndex &index) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &index) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; QModelIndex index(const QString &categoryName) const; QString categoryName(const QModelIndex &index) const; private slots: void categoryAdded(const QString &categoryName); void categoryRemoved(const QString &categoryName); void torrentAdded(BitTorrent::TorrentHandle *const torrent); void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent); void torrentCategoryChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldCategory); void subcategoriesSupportChanged(); private: void populate(); QModelIndex index(CategoryModelItem *item) const; CategoryModelItem *findItem(const QString &fullName) const; bool m_isSubcategoriesEnabled; CategoryModelItem *m_rootItem; }; #endif // CATEGORYFILTERMODEL_H
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* APIs between calling firmware and vboot_reference * * DO NOT INCLUDE THE HEADERS BELOW DIRECTLY! ONLY INCLUDE THIS FILE! * * Using vb2api.h as the single point of contact between calling firmware and * vboot allows subsequent refactoring of vboot (renaming of headers, etc.) * without churning other projects' source code. */ #ifndef VBOOT_VB2_API_H_ #define VBOOT_VB2_API_H_ /* Standard APIs */ #include "../2lib/include/2api.h" /* SHA library */ #ifdef NEED_VB2_SHA_LIBRARY #include "../2lib/include/2sha.h" #endif /* * Coreboot should not need access to vboot2 internals. But right now it does. * At least this forces it to do so through a relatively narrow hole so vboot2 * refactoring can continue. * * Please do not rip this into a wider hole, or expect this hole to continue. * * TODO: Make cleaner APIs to this stuff. */ #ifdef NEED_VB20_INTERNALS #include "../2lib/include/2nvstorage_fields.h" #include "../2lib/include/2struct.h" #include "../lib20/include/vb2_struct.h" #endif #endif /* VBOOT_VB2_API_H_ */
/* * ARM-NEON-optimized IDCT functions * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdint.h> #include "libavutil/attributes.h" #include "libavcodec/avcodec.h" #include "libavcodec/idctdsp.h" #include "idct.h" #include "idctdsp_arm.h" void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, int); void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int); void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int); av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, unsigned high_bit_depth) { if (!avctx->lowres && !high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEAUTO || avctx->idct_algo == FF_IDCT_SIMPLENEON) { c->idct_put = ff_simple_idct_put_neon; c->idct_add = ff_simple_idct_add_neon; c->idct = ff_simple_idct_neon; c->perm_type = FF_IDCT_PERM_PARTTRANS; } } c->add_pixels_clamped = ff_add_pixels_clamped_neon; c->put_pixels_clamped = ff_put_pixels_clamped_neon; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon; }
/* gdb-stub.h: FRV GDB stub * * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef __ASM_GDB_STUB_H #define __ASM_GDB_STUB_H #undef GDBSTUB_DEBUG_PROTOCOL #include <asm/ptrace.h> /* * important register numbers in GDB protocol * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55, * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63, * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7, * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15, * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23, * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31, * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39, * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47, * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55, * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63, * - PC, PSR, CCR, CCCR, * - _X132, _X133, _X134 * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3, * - SCR0, SCR1, SCR2, SCR3, * - LR, LCR, * - IACC0H, IACC0L, * - FSR0, * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7, * - ACCG0123, ACCG4567, * - MSR0, MSR1, * - GNER0, GNER1, * - FNER0, FNER1, */ #define GDB_REG_GR(N) (N) #define GDB_REG_FR(N) (64+(N)) #define GDB_REG_PC 128 #define GDB_REG_PSR 129 #define GDB_REG_CCR 130 #define GDB_REG_CCCR 131 #define GDB_REG_TBR 135 #define GDB_REG_BRR 136 #define GDB_REG_DBAR(N) (137+(N)) #define GDB_REG_SCR(N) (141+(N)) #define GDB_REG_LR 145 #define GDB_REG_LCR 146 #define GDB_REG_FSR0 149 #define GDB_REG_ACC(N) (150+(N)) #define GDB_REG_ACCG(N) (158+(N)/4) #define GDB_REG_MSR(N) (160+(N)) #define GDB_REG_GNER(N) (162+(N)) #define GDB_REG_FNER(N) (164+(N)) #define GDB_REG_SP GDB_REG_GR(1) #define GDB_REG_FP GDB_REG_GR(2) #ifndef _LANGUAGE_ASSEMBLY /* * Prototypes */ extern void show_registers_only(struct pt_regs *regs); extern void gdbstub_init(void); extern void gdbstub(int type); extern void gdbstub_exit(int status); extern void gdbstub_io_init(void); extern void gdbstub_set_baud(unsigned baud); extern int gdbstub_rx_char(unsigned char *_ch, int nonblock); extern void gdbstub_tx_char(unsigned char ch); extern void gdbstub_tx_flush(void); extern void gdbstub_do_rx(void); extern asmlinkage void __debug_stub_init_break(void); extern asmlinkage void start_kernel(void); extern asmlinkage void gdbstub_rx_handler(void); extern asmlinkage void gdbstub_rx_irq(void); extern asmlinkage void gdbstub_intercept(void); extern uint32_t __entry_usertrap_table[]; extern uint32_t __entry_kerneltrap_table[]; extern volatile u8 gdbstub_rx_buffer[PAGE_SIZE]; extern volatile u32 gdbstub_rx_inp; extern volatile u32 gdbstub_rx_outp; extern volatile u8 gdbstub_rx_overflow; extern u8 gdbstub_rx_unget; extern void gdbstub_printk(const char *fmt, ...); extern void debug_to_serial(const char *p, int n); extern void console_set_baud(unsigned baud); #ifdef GDBSTUB_DEBUG_PROTOCOL #define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__) #else #define gdbstub_proto(FMT,...) ({ 0; }) #endif #endif /* _LANGUAGE_ASSEMBLY */ #endif /* __ASM_GDB_STUB_H */
#ifndef _INET_DIAG_H_ #define _INET_DIAG_H_ 1 #include <specific_includes/uapi/linux/inet_diag.h> struct sock; struct inet_hashinfo; struct nlattr; struct nlmsghdr; struct sk_buff; struct netlink_callback; struct inet_diag_handler { void (*dump)(struct sk_buff *skb, struct netlink_callback *cb, struct inet_diag_req_v2 *r, struct nlattr *bc); int (*dump_one)(struct sk_buff *in_skb, const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req); void (*idiag_get_info)(struct sock *sk, struct inet_diag_msg *r, void *info); __u16 idiag_type; }; struct inet_connection_sock; int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, struct sk_buff *skb, struct inet_diag_req_v2 *req, struct user_namespace *user_ns, u32 pid, u32 seq, u16 nlmsg_flags, const struct nlmsghdr *unlh); void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, struct netlink_callback *cb, struct inet_diag_req_v2 *r, struct nlattr *bc); int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_skb, const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req); int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); extern int inet_diag_register(const struct inet_diag_handler *handler); extern void inet_diag_unregister(const struct inet_diag_handler *handler); #endif /* _INET_DIAG_H_ */
//===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===// // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines macro telling whether sanitizer tools can/should intercept // given library functions on a given platform. // //===----------------------------------------------------------------------===// #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H #define SANITIZER_PLATFORM_INTERCEPTORS_H #include "sanitizer_internal_defs.h" #if !SANITIZER_WINDOWS # define SI_NOT_WINDOWS 1 # include "sanitizer_platform_limits_posix.h" #else # define SI_NOT_WINDOWS 0 #endif #if SANITIZER_LINUX && !SANITIZER_ANDROID # define SI_LINUX_NOT_ANDROID 1 #else # define SI_LINUX_NOT_ANDROID 0 #endif #if SANITIZER_LINUX # define SI_LINUX 1 #else # define SI_LINUX 0 #endif #if SANITIZER_MAC # define SI_MAC 1 #else # define SI_MAC 0 #endif # define SANITIZER_INTERCEPT_STRCMP 1 # define SANITIZER_INTERCEPT_STRCASECMP SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_READ SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_PREAD SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_WRITE SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_PWRITE SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PREAD64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PWRITE64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_READV SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS #define SANITIZER_INTERCEPT_PREADV SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_PRCTL SI_LINUX # define SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SCANF SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_ISOC99_SCANF SI_LINUX # define SANITIZER_INTERCEPT_FREXP 1 # define SANITIZER_INTERCEPT_FREXPF_FREXPL SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \ SI_MAC || SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_LINUX # define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_WAIT SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_INET SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETADDRINFO SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETNAMEINFO SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETSOCKNAME SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETHOSTBYNAME SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETHOSTBYNAME_R SI_LINUX # define SANITIZER_INTERCEPT_GETSOCKOPT SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_ACCEPT SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_ACCEPT4 SI_LINUX # define SANITIZER_INTERCEPT_MODF SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_RECVMSG SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETPEERNAME SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_IOCTL SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_INET_ATON SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SYSINFO SI_LINUX # define SANITIZER_INTERCEPT_READDIR SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_READDIR64 SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_PTRACE SI_LINUX_NOT_ANDROID && \ (defined(__i386) || defined (__x86_64)) // NOLINT # define SANITIZER_INTERCEPT_SETLOCALE SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GETCWD SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_GET_CURRENT_DIR_NAME SI_LINUX # define SANITIZER_INTERCEPT_STRTOIMAX SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_MBSTOWCS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_MBSNRTOWCS SI_MAC || SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_WCSNRTOMBS SI_MAC || SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX # define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_CONFSTR SI_MAC || SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_STRERROR SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_STRERROR_R SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SCANDIR SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_SCANDIR64 SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_GETGROUPS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_POLL SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_PPOLL SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_WORDEXP SI_MAC || SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_SIGWAIT SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SIGWAITINFO SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_SIGTIMEDWAIT SI_LINUX_NOT_ANDROID # define SANITIZER_INTERCEPT_SIGSETOPS SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SIGPENDING SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_SIGPROCMASK SI_NOT_WINDOWS # define SANITIZER_INTERCEPT_BACKTRACE SI_LINUX_NOT_ANDROID #endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
/******************************************************************************* * * McStas, neutron ray-tracing package * Copyright 1997-2002, All rights reserved * Risoe National Laboratory, Roskilde, Denmark * Institut Laue Langevin, Grenoble, France * * Kernel: cexp.c * * %Identification * Written by: K.N. * Date: Aug 7, 1997 * Origin: Risoe * Release: McStas 1.6 * Version: $Revision$ * * Handle expressions used as arguments to components etc. * *******************************************************************************/ #include <stdarg.h> #include <stdio.h> #include "mccode.h" /* The internal structure implementing a C expression. */ struct cexp { char *s; /* String representation */ int isvalue; /* True if identifier or string/number constant */ int lineno; /* Starting line number, or zero */ }; /* Create an expression from a string representing a value (either identifier, constant number, or constant string). */ static CExp mkvalueexp(char *s) { CExp e; palloc(e); e->s = s; e->isvalue = 1; e->lineno = 0; /* Initially no line number set */ return e; } /* Create an expression from a string not representing a value. */ static CExp mknonvalueexp(char *s) { CExp e; palloc(e); e->s = s; e->isvalue = 0; e->lineno = 0; /* Initially no line number set */ return e; } /******************************************************************************* * Handle identifiers used as arguments to components. * There are two types of identifiers: normal and extern. Normal identifiers * refer to formal arguments of the instrument, and are always of type * double. These can be varied eg. to perform a scan. Extern identifiers refer * to user-supplied C identifiers that is typically put in the declaration and * initialization sections of the instrument definition. * * The final version will distinguish (using a union) between these two types, * and will maintain a mapping from formal parameters of the instrument to * generated names in the generated simulation (the extern names must be * copied unchanged). But in this first version a simpler scheme is used: all * identifier expressions are simply strings, and all normal identifiers refer * to instrument parameters (which have ID_PRE and "ip" prepended). *******************************************************************************/ CExp exp_id(char *id) { return mkvalueexp(str_cat(ID_PRE, "ip", id, NULL)); } CExp exp_extern_id(char *id) { return mkvalueexp(str_dup(id)); } CExp exp_number(char *n) { return mkvalueexp(str_dup(n)); } CExp exp_string(char *s) { char *quoted, *result; quoted = str_quote(s); result = str_cat("\"", s, "\"", NULL); str_free(quoted); return mkvalueexp(result); } CExp exp_ctoken(char *s) { return mknonvalueexp(str_dup(s)); } CExp exp_compound(int n, ...) { char *result, *new; CExp e; va_list ap; char *separator = ""; /* Token separator, initially empty */ va_start(ap, n); result = str_dup(""); while(n-- > 0) { e = va_arg(ap, CExp); new = str_cat(result, separator, e->s, NULL); str_free(result); result = new; separator = " "; /* Now use space separator for rest. */ } return mknonvalueexp(result); } void exp_free(CExp e) { str_free(e->s); memfree(e); } char * exp_tostring(CExp e) { char *s = e->s; if(s == NULL) { s = ""; debugn((DEBUG_HIGH, "exp_tostring(): NULL cexp received.\n")); } return str_dup(s); } void exp_fprint(FILE *f, CExp e) { fputs(e->s, f); } int exp_isvalue(CExp e) { return e->isvalue; } void exp_setlineno(CExp e, int n) { e->lineno = n; } int exp_getlineno(CExp e) { return e->lineno; }
/* This file is part of iprohc. iprohc is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version. iprohc 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 iprohc. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ROHC_IPIP_TUNH_H #define ROHC_IPIP_TUNH_H #include <stdlib.h> #include <stdint.h> #include <stdbool.h> int create_tun(const char *const name, const char *const basedev, int *const tun_itf_id, size_t *const basedev_mtu, size_t *const tun_itf_mtu) __attribute__((warn_unused_result)); bool set_ip4(int iface_index, uint32_t address, uint8_t network); int create_raw(const int fwmark); #endif
/* * libretroshare/src/services/p3banlist.h * * Exchange list of Peers for Banning / Whitelisting. * * Copyright 2011 by Robert Fernie. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License Version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Please report all bugs and problems to "retroshare@lunamutt.com". * */ #ifndef SERVICE_RSBANLIST_HEADER #define SERVICE_RSBANLIST_HEADER #include <string> #include <list> #include <map> #include "serialiser/rsbanlistitems.h" #include "services/p3service.h" #include "retroshare/rsbanlist.h" class p3ServiceControl; class p3NetMgr; class BanList { public: RsPeerId mPeerId; /* from */ time_t mLastUpdate; std::map<struct sockaddr_storage, BanListPeer> mBanPeers; }; //!The RS BanList service. /** * * Exchange list of Banned IP addresses with peers. */ class p3BanList: public RsBanList, public p3Service, public pqiNetAssistPeerShare, public p3Config /*, public pqiMonitor */ { public: p3BanList(p3ServiceControl *sc, p3NetMgr *nm); virtual RsServiceInfo getServiceInfo(); /***** overloaded from RsBanList *****/ virtual bool isAddressAccepted(const struct sockaddr_storage& addr, uint32_t checking_flags,uint32_t *check_result=NULL) ; virtual void getBannedIps(std::list<BanListPeer>& list) ; virtual void getWhiteListedIps(std::list<BanListPeer>& list) ; virtual bool addIpRange(const struct sockaddr_storage& addr,int masked_bytes,uint32_t list_type,const std::string& comment) ; virtual bool removeIpRange(const sockaddr_storage &addr, int masked_bytes, uint32_t list_type); virtual void enableIPFiltering(bool b) ; virtual bool ipFilteringEnabled() ; virtual bool autoRangeEnabled() { return mAutoRangeIps ; } virtual void enableAutoRange(bool b) ; virtual int autoRangeLimit() { return mAutoRangeLimit ; } virtual void setAutoRangeLimit(int b) ; virtual void enableIPsFromFriends(bool b) ; virtual bool IPsFromFriendsEnabled() { return mIPFriendGatheringEnabled ;} virtual void enableIPsFromDHT(bool b) ; virtual bool iPsFromDHTEnabled() { return mIPDHTGatheringEnabled ;} /***** overloaded from pqiNetAssistPeerShare *****/ virtual void updatePeer(const RsPeerId& id, const struct sockaddr_storage &addr, int type, int reason, int time_stamp); /*********************** p3config ******************************/ virtual RsSerialiser *setupSerialiser(); virtual bool saveList(bool &cleanup, std::list<RsItem *>& itemlist); virtual bool loadList(std::list<RsItem *>& load); /***** overloaded from p3Service *****/ /*! * This retrieves all chat msg items and also (important!) * processes chat-status items that are in service item queue. chat msg item requests are also processed and not returned * (important! also) notifications sent to notify base on receipt avatar, immediate status and custom status * : notifyCustomState, notifyChatStatus, notifyPeerHasNewAvatar * @see NotifyBase */ virtual int tick(); virtual int status(); int sendPackets(); bool processIncoming(); bool recvBanItem(RsBanListItem *item); bool addBanEntry(const RsPeerId &peerId, const struct sockaddr_storage &addr, int level, uint32_t reason, time_t time_stamp); void sendBanLists(); int sendBanSet(const RsPeerId& peerid); /*! * Interface stuff. */ /*************** pqiMonitor callback ***********************/ //virtual void statusChange(const std::list<pqipeer> &plist); /************* from p3Config *******************/ //virtual RsSerialiser *setupSerialiser() ; //virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ; //virtual void saveDone(); //virtual bool loadList(std::list<RsItem*>& load) ; private: void getDhtInfo() ; RsMutex mBanMtx; bool acceptedBanSet_locked(const BanListPeer &blp); bool acceptedBanRanges_locked(const BanListPeer &blp); void autoFigureOutBanRanges(); int condenseBanSources_locked(); int printBanSources_locked(std::ostream &out); int printBanSet_locked(std::ostream &out); bool isWhiteListed_locked(const sockaddr_storage &addr); time_t mSentListTime; std::map<RsPeerId, BanList> mBanSources; std::map<struct sockaddr_storage, BanListPeer> mBanSet; std::map<struct sockaddr_storage, BanListPeer> mBanRanges; std::map<struct sockaddr_storage, BanListPeer> mWhiteListedRanges; p3ServiceControl *mServiceCtrl; p3NetMgr *mNetMgr; time_t mLastDhtInfoRequest ; bool mIPFilteringEnabled ; bool mIPFriendGatheringEnabled ; bool mIPDHTGatheringEnabled ; uint32_t mAutoRangeLimit ; bool mAutoRangeIps ; }; #endif // SERVICE_RSBANLIST_HEADER
/* Copyright (C) 2006 - 2012 ScriptDev2 <http://www.scriptdev2.com/> * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DEF_TOC_H #define DEF_TOC_H enum { MAX_ENCOUNTER = 3, TYPE_GRAND_CHAMPIONS = 0, TYPE_ARGENT_CHALLENGE = 1, TYPE_BLACK_KNIGHT = 2, DATA_CHAMPION_1 = 3, DATA_CHAMPION_2 = 4, DATA_CHAMPION_3 = 5, DATA_BLACK_KNIGHT = 6, DATA_BLACK_KNIGHT_MINION = 7, DATA_TOC5_ANNOUNCER = 8, DATA_JAEREN = 9, DATA_ARELAS = 10, DATA_CHAMPIONID_1 = 11, DATA_CHAMPIONID_2 = 12, DATA_CHAMPIONID_3 = 13, DATA_MEMORY = 14, DATA_ARGENT_CHALLENGER = 15, DATA_CHAMPIONS_COUNT = 16, NPC_JACOB = 34705, NPC_AMBROSE = 34702, NPC_COLOSOS = 34701, NPC_JAELYNE = 34657, NPC_LANA = 34703, NPC_MOKRA = 35572, NPC_ERESSEA = 35569, NPC_RUNOK = 35571, NPC_ZULTORE = 35570, NPC_VISCERI = 35617, NPC_EADRIC = 35119, NPC_PALETRESS = 34928, NPC_BLACK_KNIGHT = 35451, NPC_RISEN_JAEREN = 35545, NPC_RISEN_ARELAS = 35564, NPC_JAEREN = 35004, NPC_ARELAS = 35005, MEMORY_ALGALON = 35052, MEMORY_ARCHIMONDE = 35041, MEMORY_CHROMAGGUS = 35033, MEMORY_CYANIGOSA = 35046, MEMORY_DELRISSA = 35043, MEMORY_ECK = 35047, MEMORY_ENTROPIUS = 35044, MEMORY_GRUUL = 35039, MEMORY_HAKKAR = 35034, MEMORY_HEIGAN = 35049, MEMORY_HEROD = 35030, MEMORY_HOGGER = 34942, MEMORY_IGNIS = 35050, MEMORY_ILLIDAN = 35042, MEMORY_INGVAR = 35045, MEMORY_KALITHRESH = 35037, MEMORY_LUCIFRON = 35031, MEMORY_MALCHEZAAR = 35038, MEMORY_MUTANUS = 35029, MEMORY_ONYXIA = 35048, MEMORY_THUNDERAAN = 35032, MEMORY_VANCLEEF = 35028, MEMORY_VASHJ = 35040, MEMORY_VEKNILASH = 35036, MEMORY_VEZAX = 35051, GO_CHAMPIONS_LOOT = 195709, GO_CHAMPIONS_LOOT_H = 195710, GO_EADRIC_LOOT = 195374, GO_EADRIC_LOOT_H = 195375, GO_PALETRESS_LOOT = 195323, GO_PALETRESS_LOOT_H = 195324, DESPAWN_TIME = 300000 }; #endif
#pragma once #include "zacdb.h" #include "zdbmain.h" class ZcDbViewport; #pragma pack (push, 8) class ZcDbAnnotativeObjectPE : public ZcRxObject { public: ZCRX_DECLARE_MEMBERS(ZcDbAnnotativeObjectPE); virtual bool annotative(ZcDbObject* pObject) const = 0; virtual Zcad::ErrorStatus setAnnotative( ZcDbObject* pObject, const bool bAnnotative ) = 0; virtual Zcad::ErrorStatus setFromStyle(ZcDbObject* pObject, bool& bUpdated) = 0; virtual bool forceAnnoAllVisible(ZcDbObject* pObj) const { return false;} ; virtual Zcad::ErrorStatus setForceAnnoAllVisible(ZcDbObject* pObj, bool bForce) const {return Zcad::eNotImplemented;} virtual Zcad::ErrorStatus resetScaleDependentProperties ( ZcDbObject* pObject) {return Zcad::eNotImplemented;} }; class ZcDbPaperOrientationPE : public ZcRxObject { public: ZCRX_DECLARE_MEMBERS(ZcDbPaperOrientationPE); virtual bool paperOrientation(ZcDbObject* pObject) const = 0; virtual Zcad::ErrorStatus setPaperOrientation( ZcDbObject* pObject, const bool bPaperOrientation ) = 0; virtual Zcad::ErrorStatus applyPaperOrientationTransform ( ZcDbObject* pObject, const ZcDbViewport *pVport ) const { return Zcad::eNotImplemented; } }; #pragma pack (pop)
/* *************************************************************************** * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * * (c) Copyright 2002, Ralink Technology, Inc. * * All rights reserved. Ralink's source code is an unpublished work and the * use of a copyright notice does not imply otherwise. This source code * contains confidential trade secret material of Ralink Tech. Any attemp * or participation in deciphering, decoding, reverse engineering or in any * way altering the source code is stricitly prohibited, unless the prior * written consent of Ralink Technology, Inc. is obtained. *************************************************************************** Module Name: client_wds.h Abstract: */ #ifndef __CLIENT_WDS_H__ #define __CLIENT_WDS_H__ #include "client_wds_cmm.h" VOID CliWds_ProxyTabInit( IN PRTMP_ADAPTER pAd); VOID CliWds_ProxyTabDestory( IN PRTMP_ADAPTER pAd); PCLIWDS_PROXY_ENTRY CliWdsEntyAlloc( IN PRTMP_ADAPTER pAd); VOID CliWdsEntyFree( IN PRTMP_ADAPTER pAd, IN PCLIWDS_PROXY_ENTRY pCliWdsEntry); PUCHAR CliWds_ProxyLookup( IN PRTMP_ADAPTER pAd, IN PUCHAR pMac); VOID CliWds_ProxyTabUpdate( IN PRTMP_ADAPTER pAd, IN SHORT Aid, IN PUCHAR pMac); VOID CliWds_ProxyTabMaintain( IN PRTMP_ADAPTER pAd); #endif // __CLIENT_WDS_H__ //
/* * Copyright (C) 2013-2015 DeathCore <http://www.noffearrdeathproject.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DEF_GATE_OF_THE_SETTING_SUN_H_ #define DEF_GATE_OF_THE_SETTING_SUN_H_ #define MAX_ENCOUNTERS 4 enum Creatures { BOSS_COMMANDER_RIMOK = 56636, BOSS_RAIGONN = 56877, BOSS_SABOTEUR = 56906, BOSS_STRIKER_GADOK = 56589, }; enum Objects { }; enum Data { DATA_SABOTEUR = 1, DATA_STRIKER_GADOK = 2, DATA_COMMANDER_RIMOK = 3, DATA_RAIGONN = 4, }; #endif
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org> * * Basic fspick() failure tests. */ #include "tst_test.h" #include "lapi/fsmount.h" #define MNTPOINT "mntpoint" static struct tcase { char *name; int dirfd; const char *pathname; unsigned int flags; int exp_errno; } tcases[] = { {"invalid-fd", -1, MNTPOINT, FSPICK_NO_AUTOMOUNT | FSPICK_CLOEXEC, EBADF}, {"invalid-path", AT_FDCWD, "invalid", FSPICK_NO_AUTOMOUNT | FSPICK_CLOEXEC, ENOENT}, {"invalid-flags", AT_FDCWD, MNTPOINT, 0x10, EINVAL}, }; static void run(unsigned int n) { struct tcase *tc = &tcases[n]; TEST(fspick(tc->dirfd, tc->pathname, tc->flags)); if (TST_RET != -1) { SAFE_CLOSE(TST_RET); tst_res(TFAIL, "%s: fspick() succeeded unexpectedly (index: %d)", tc->name, n); return; } if (tc->exp_errno != TST_ERR) { tst_res(TFAIL | TTERRNO, "%s: fspick() should fail with %s", tc->name, tst_strerrno(tc->exp_errno)); return; } tst_res(TPASS | TTERRNO, "%s: fspick() failed as expected", tc->name); } static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .test = run, .setup = fsopen_supported_by_kernel, .needs_root = 1, .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1, .skip_filesystems = (const char *const []){"fuse", NULL}, };
/* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef FIX_CLASS FixStyle(box/relax,FixBoxRelax) #else #ifndef LMP_FIX_BOX_RELAX_H #define LMP_FIX_BOX_RELAX_H #include "fix.h" namespace LAMMPS_NS { class FixBoxRelax : public Fix { public: FixBoxRelax(class LAMMPS *, int, char **); ~FixBoxRelax(); int setmask(); void init(); double min_energy(double *); void min_store(); void min_clearstore(); void min_pushstore(); void min_popstore(); int min_reset_ref(); void min_step(double, double *); double max_alpha(double *); int min_dof(); int modify_param(int, char **); private: int p_flag[6]; int pstyle,pcouple,allremap; int dimension; double p_target[6],p_current[6]; double vol0,xprdinit,yprdinit,zprdinit; double vmax,pv2e,pflagsum; int kspace_flag; int current_lifo; // LIFO stack pointer double boxlo0[2][3]; // box bounds at start of line search double boxhi0[2][3]; double boxtilt0[2][3]; // xy,xz,yz tilts at start of line search double s0[3]; // scale matrix at start of line search double ds[6]; // increment in scale matrix char *id_temp,*id_press; class Compute *temperature,*pressure; int tflag,pflag; int nrigid; int *rfix; double sigma[6]; // scaled target stress double utsigma[3]; // weighting for upper-tri elements // of modified sigma int sigmamod_flag; // 1 if modified sigma to be used double fdev[6]; // Deviatoric force on cell int deviatoric_flag; // 0 if target stress tensor is hydrostatic double h0[6]; // h_inv of reference (zero strain) box double h0_inv[6]; // h_inv of reference (zero strain) box int nreset_h0; // interval for resetting h0 double p_hydro; // hydrostatic component of target stress void remap(); void couple(); void compute_sigma(); void compute_deviatoric(); double compute_strain_energy(); void compute_press_target(); double compute_scalar(); }; } #endif #endif
/*************************************************************************** file : OsgSky.h created : Mon Aug 21 18:24:02 CEST 2012 copyright : (C) 2012 by Xavier Bertaux email : bertauxx@yahoo.fr version : $Id$ ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef _OSGSKY_H #define _OSGSKY_H #include <vector> #include <string> #include <osg/ref_ptr> #include <osg/MatrixTransform> #include <osg/Node> #include <osg/Switch> #include "OsgCloud.h" #include "OsgDome.h" #include "OsgMoon.h" #include "OsgSun.h" #include "OsgStars.h" using std::vector; class SDCloudLayer; //class SDCloudLayerList; class SDSun; class SDMoon; class SDStars; class SDSkyDome; class SDSky; /*typedef struct { osg::Vec3d pos; double spin; double gst; double sun_dist; double moon_dist; double sun_angle; } SDSkyState; typedef struct { osg::Vec3f sky_color; osg::Vec3f adj_sky_color; osg::Vec3f fog_color; osg::Vec3f cloud_color; double sun_angle, moon_angle; } SDSkyColor;*/ enum NodeMask { BACKGROUND_BIT = (1 << 11), MODEL_BIT = (1 << 12), }; class SDSky { private: typedef std::vector<SDCloudLayer *> layer_list_type; typedef layer_list_type::iterator layer_list_iterator; typedef layer_list_type::const_iterator layer_list_const_iterator; // components of the sky SDSkyDome* dome; SDSun* sun; SDMoon* moon; SDStars* planets; SDStars* stars; layer_list_type cloud_layers; osg::ref_ptr<osg::Group> pre_root, cloud_root; osg::ref_ptr<osg::Switch> pre_selector; osg::ref_ptr<osg::Group> pre_transform; // visibility float visibility; float effective_visibility; float minimum_sky_visibility; int in_cloud; int cur_layer_pos; bool in_puff; double puff_length; double puff_progression; double ramp_up; double ramp_down; // 3D clouds enabled bool clouds_3d_enabled; // 3D cloud density double clouds_3d_density; public: /** Constructor */ SDSky( void ); /** Destructor */ ~SDSky( void ); void build( std::string tex_path, double h_radius, double v_radius, double sun_size, double sun_dist, double moon_size, double moon_dist, int nplanets, osg::Vec3d *planet_data, int nstars, osg::Vec3d *star_data ); bool repaint (osg::Vec3f &sky_color, osg::Vec3f &fog_color, osg::Vec3f &cloud_color, double sun_angle, double moon_angle, int nplanets, osg::Vec3d *planet_data, int nstars, osg::Vec3d *star_data); bool reposition(osg::Vec3 &view_pos, double spin, /*double gst,*/ double dt); void modify_vis( float alt, float time_factor ); osg::Node* getPreRoot() { return pre_root.get(); } osg::Node* getCloudRoot() { return cloud_root.get(); } void texture_path( const std::string& path ); inline void enable() { pre_selector->setValue(0, 1); } inline void disable() { pre_selector->setValue(0, 0); } inline osg::Vec4f get_sun_color() { return sun->get_color(); } inline osg::Vec4f get_scene_color() { return sun->get_scene_color(); } void add_cloud_layer (SDCloudLayer * layer); const SDCloudLayer * get_cloud_layer (int i) const; SDCloudLayer * get_cloud_layer (int i); int get_cloud_layer_count () const; void setMA(double angle) { moon->setMoonAngle(angle); } double getMA() { return moon->getMoonAngle(); } void setMR(double rotation) { moon->setMoonRotation( rotation); } double getMR() { return moon->getMoonRotation(); } void setMRA( double ra ) { moon->setMoonRightAscension( ra ); } double getMRA() { return moon->getMoonRightAscension(); } void setMD( double decl ) { moon->setMoonDeclination( decl ); } double getMD() { return moon->getMoonDeclination(); } void setMDist( double dist ) { moon->setMoonDist(dist); } double getMDist() { return moon->getMoonDist(); } void setSA(double angle) { sun->setSunAngle(angle); } double getSA() { return sun->getSunAngle(); } void setSR(double rotation) { sun->setSunRotation( rotation ); } double getSR() { return sun->getSunRotation(); } void setSRA(double ra) { sun->setSunRightAscension( ra ); } double getSRA() { return sun->getSunRightAscension(); } void setSD( double decl ) { sun->setSunDeclination( decl ); } double getSD() { return sun->getSunDeclination(); } void setSDistance( double dist ) { sun->setSunDistance( dist ); } double getSDistance() { return sun->getSunDistance(); } inline float get_visibility() const { return effective_visibility; } inline void set_visibility( float v ) { effective_visibility = visibility = (v <= 25.0) ? 25.0 : v; } inline SDSun * getSun(){return sun;} inline osg::Vec3f sunposition() {return sun->getSunPosition();} //virtual double get_3dCloudDensity() const; //virtual void set_3dCloudDensity(double density); //virtual float get_3dCloudVisRange() const; //virtual void set_3dCloudVisRange(float vis); }; #endif // _OSGSKY_H
/* * Copyright (c) 2014 Free Software Foundation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GRUB_GLUE_H #define _GRUB_GLUE_H #define GRUB_FILE __FILE__ #define grub_memcmp memcmp #define grub_printf printf #define grub_puts_ puts #include <mach/mach_types.h> #include <i386/vm_param.h> /* Warning: this leaks memory maps for now, do not use it yet for something * else than Mach shutdown. */ vm_offset_t io_map_cached(vm_offset_t phys_addr, vm_size_t size); #endif /* _GRUB_GLUE_H */