text
stringlengths 4
6.14k
|
|---|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE506_Embedded_Malicious_Code__w32_file_attrib_modified_02.c
Label Definition File: CWE506_Embedded_Malicious_Code__w32.label.xml
Template File: point-flaw-02.tmpl.c
*/
/*
* @description
* CWE: 506 Embedded Malicious Code
* Sinks: file_attrib_modified
* GoodSink: Do not modify the file's last modified time attribute
* BadSink : Modify the file's last modified time attribute
* Flow Variant: 02 Control flow: if(1) and if(0)
*
* */
#include "std_testcase.h"
#include <windows.h>
/* Note that the FILETIME structure is based on 100-nanosecond intervals.
It is helpful to define the following symbols when working with file times.
http://support.microsoft.com/kb/188768 */
#define _SECOND ((INT64)10000000)
#define _MINUTE (60 * _SECOND)
#define _HOUR (60 * _MINUTE)
#define _DAY (24 * _HOUR)
#ifndef OMITBAD
void CWE506_Embedded_Malicious_Code__w32_file_attrib_modified_02_bad()
{
if(1)
{
{
FILETIME ftModified;
ULONGLONG qwResult;
HANDLE hFile = INVALID_HANDLE_VALUE;
do
{
hFile = CreateFile(TEXT("badFile.txt"),
GENERIC_READ | GENERIC_WRITE, /* needed for SetFileTime to work properly */
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
break;
}
if (GetFileTime(hFile,
NULL,
NULL,
&ftModified) == 0)
{
break;
}
/* adapted from http://support.microsoft.com/kb/188768 */
qwResult = (((ULONGLONG) ftModified.dwHighDateTime) << 32) + ftModified.dwLowDateTime;
/* Subtract 10 days from real last modified date */
qwResult -= 10 * _DAY;
/* Copy result back into ftModified */
ftModified.dwLowDateTime = (DWORD)(qwResult & 0xFFFFFFFF);
ftModified.dwHighDateTime = (DWORD)(qwResult >> 32);
/* FLAW: Modify the file's last modified time */
SetFileTime(hFile,
(LPFILETIME)NULL,
(LPFILETIME)NULL,
&ftModified);
}
while (0);
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
}
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(0) instead of if(1) */
static void good1()
{
if(0)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
HANDLE hFile = CreateFile(TEXT("goodFile.txt"),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
/* FIX: Do not modify the file's attributes */
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
}
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(1)
{
{
HANDLE hFile = CreateFile(TEXT("goodFile.txt"),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
/* FIX: Do not modify the file's attributes */
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
}
}
}
}
void CWE506_Embedded_Malicious_Code__w32_file_attrib_modified_02_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_file_attrib_modified_02_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE506_Embedded_Malicious_Code__w32_file_attrib_modified_02_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE127_Buffer_Underread__char_alloca_loop_53a.c
Label Definition File: CWE127_Buffer_Underread.stack.label.xml
Template File: sources-sink-53a.tmpl.c
*/
/*
* @description
* CWE: 127 Buffer Under-read
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sink: loop
* BadSink : Copy data to string using a loop
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE127_Buffer_Underread__char_alloca_loop_53b_badSink(char * data);
void CWE127_Buffer_Underread__char_alloca_loop_53_bad()
{
char * data;
char * dataBuffer = (char *)ALLOCA(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
CWE127_Buffer_Underread__char_alloca_loop_53b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE127_Buffer_Underread__char_alloca_loop_53b_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char * dataBuffer = (char *)ALLOCA(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
CWE127_Buffer_Underread__char_alloca_loop_53b_goodG2BSink(data);
}
void CWE127_Buffer_Underread__char_alloca_loop_53_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()...");
CWE127_Buffer_Underread__char_alloca_loop_53_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE127_Buffer_Underread__char_alloca_loop_53_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef everything_h
#define everything_h
#include "colors.h"
#include "debugs.h"
#include "maths.h"
#include "matrices.h"
#include "misc.h"
#include "rands.h"
#include "strings.h"
#include "timings.h"
#include "files.h"
#endif
|
/*============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center (DKFZ)
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 USLISTENERFUNCTORS_P_H
#define USLISTENERFUNCTORS_P_H
#include <usServiceEvent.h>
#include <usModuleEvent.h>
#include <algorithm>
#include <cstring>
#ifdef US_HAVE_STD_FUNCTION
#ifdef US_HAVE_FUNCTIONAL_H
#include <functional>
#elif defined(US_HAVE_TR1_FUNCTIONAL_H)
#include <tr1/functional>
#endif
#define US_FUNCTION_TYPE std::function
#elif defined(US_HAVE_TR1_FUNCTION)
#ifdef US_HAVE_TR1_FUNCTIONAL_H
#include <tr1/functional>
#elif defined(US_HAVE_FUNCTIONAL_H)
#include <functional>
#endif
#define US_FUNCTION_TYPE std::tr1::function
#endif
#define US_MODULE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>
#define US_SERVICE_LISTENER_FUNCTOR US_FUNCTION_TYPE<void(const US_PREPEND_NAMESPACE(ServiceEvent)&)>
US_BEGIN_NAMESPACE
template<class X>
US_MODULE_LISTENER_FUNCTOR ModuleListenerMemberFunctor(X* x, void (X::*memFn)(const US_PREPEND_NAMESPACE(ModuleEvent)))
{ return std::bind(std::mem_fn(memFn), x, std::placeholders::_1); }
struct ModuleListenerCompare : std::binary_function<std::pair<US_MODULE_LISTENER_FUNCTOR, void*>,
std::pair<US_MODULE_LISTENER_FUNCTOR, void*>, bool>
{
bool operator()(const std::pair<US_MODULE_LISTENER_FUNCTOR, void*>& p1,
const std::pair<US_MODULE_LISTENER_FUNCTOR, void*>& p2) const
{
return p1.second == p2.second &&
p1.first.target<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>() == p2.first.target<void(const US_PREPEND_NAMESPACE(ModuleEvent)&)>();
}
};
template<class X>
US_SERVICE_LISTENER_FUNCTOR ServiceListenerMemberFunctor(X* x, void (X::*memFn)(const US_PREPEND_NAMESPACE(ServiceEvent)))
{ return std::bind(std::mem_fn(memFn), x, std::placeholders::_1); }
struct ServiceListenerCompare : std::binary_function<US_SERVICE_LISTENER_FUNCTOR, US_SERVICE_LISTENER_FUNCTOR, bool>
{
bool operator()(const US_SERVICE_LISTENER_FUNCTOR& f1,
const US_SERVICE_LISTENER_FUNCTOR& f2) const
{
return f1.target<void(const US_PREPEND_NAMESPACE(ServiceEvent)&)>() == f2.target<void(const US_PREPEND_NAMESPACE(ServiceEvent)&)>();
}
};
US_END_NAMESPACE
US_HASH_FUNCTION_NAMESPACE_BEGIN
US_HASH_FUNCTION_BEGIN(US_SERVICE_LISTENER_FUNCTOR)
void(*targetFunc)(const US_PREPEND_NAMESPACE(ServiceEvent)&) = arg.target<void(const US_PREPEND_NAMESPACE(ServiceEvent)&)>();
void* targetPtr = nullptr;
std::memcpy(&targetPtr, &targetFunc, sizeof(void*));
return US_HASH_FUNCTION(void*, targetPtr);
US_HASH_FUNCTION_END
US_HASH_FUNCTION_NAMESPACE_END
#endif // USLISTENERFUNCTORS_P_H
|
/* Copyright 2018 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.
*/
#include "console.h"
#include "ipi_chip.h"
#include "mdp_ipi_message.h"
#include "queue_policies.h"
#include "registers.h"
#include "task.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_IPI, format, ##args)
#define CPRINTS(format, args...) cprints(CC_IPI, format, ##args)
/* Forwad declaration. */
static struct consumer const event_mdp_consumer;
static void event_mdp_written(struct consumer const *consumer, size_t count);
static struct queue const event_mdp_queue = QUEUE_DIRECT(4,
struct mdp_msg_service, null_producer, event_mdp_consumer);
static struct consumer const event_mdp_consumer = {
.queue = &event_mdp_queue,
.ops = &((struct consumer_ops const) {
.written = event_mdp_written,
}),
};
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
void mdp_common_init(void) {}
void mdp_ipi_task_handler(void *pvParameters) {}
#endif
static void event_mdp_written(struct consumer const *consumer, size_t count)
{
task_wake(TASK_ID_MDP_SERVICE);
}
static void mdp_ipi_handler(int id, void *data, unsigned int len)
{
struct mdp_msg_service cmd;
cmd.id = id;
memcpy(cmd.msg, data, MIN(len, sizeof(cmd.msg)));
/*
* If there is no other IPI handler touch this queue, we don't need to
* interrupt_disable() or task_disable_irq().
*/
if (!queue_add_unit(&event_mdp_queue, &cmd))
CPRINTS("Could not send mdp id: %d to the queue.", id);
}
DECLARE_IPI(IPI_MDP_INIT, mdp_ipi_handler, 0);
DECLARE_IPI(IPI_MDP_FRAME, mdp_ipi_handler, 0);
DECLARE_IPI(IPI_MDP_DEINIT, mdp_ipi_handler, 0);
/* This function renames from mdp_service_entry. */
void mdp_service_task(void *u)
{
struct mdp_msg_service rsv_msg;
size_t size;
mdp_common_init();
while (1) {
/*
* Queue unit is added in IPI handler, which is in ISR context.
* Disable IRQ to prevent a clobbered queue.
*/
ipi_disable_irq(SCP_IRQ_IPC0);
size = queue_remove_unit(&event_mdp_queue, &rsv_msg);
ipi_enable_irq(SCP_IRQ_IPC0);
if (!size)
task_wait_event(-1);
else
mdp_ipi_task_handler(&rsv_msg);
}
}
|
//
// AAMFeedbackTopicsViewController.h
// AAMFeedbackViewController
//
// Created by 深津 貴之 on 11/11/30.
// Copyright (c) 2011年 Art & Mobile. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AAMFeedbackTopicsViewController : UITableViewController {
}
@property(weak, nonatomic) id delegate;
@property(nonatomic) NSInteger selectedIndex;
@property(nonatomic, strong) NSArray *topics;
@end
@protocol AAMFeedbackTopicsViewControllerDelegate <NSObject>
- (void)feedbackTopicsViewController:(AAMFeedbackTopicsViewController *) feedbackTopicsViewController didSelectTopicAtIndex:(NSInteger) selectedIndex;
@end
|
#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/object.h"
#include "kernel/memory.h"
#include "kernel/fcall.h"
#include "kernel/operators.h"
#include "kernel/array.h"
/**
* Simple implementation of authentication through popular social networks.
*
* @package Ice/Auth
* @category Library
* @author Ice Team
* @copyright (c) 2014-2018 Ice Team
* @license http://iceframework.org/license
*/
ZEPHIR_INIT_CLASS(Ice_Auth_Social) {
ZEPHIR_REGISTER_CLASS(Ice\\Auth, Social, ice, auth_social, ice_auth_social_method_entry, 0);
zend_declare_property_null(ice_auth_social_ce, SL("adapter"), ZEND_ACC_PROTECTED TSRMLS_CC);
return SUCCESS;
}
PHP_METHOD(Ice_Auth_Social, getAdapter) {
RETURN_MEMBER(getThis(), "adapter");
}
/**
* Constructor.
*
* @param SocialInterface adapter
*/
PHP_METHOD(Ice_Auth_Social, __construct) {
zval *adapter;
zephir_fetch_params(0, 1, 0, &adapter);
zephir_update_property_this(getThis(), SL("adapter"), adapter TSRMLS_CC);
}
/**
* Call method authenticate() of adater class.
*
* @return boolean
*/
PHP_METHOD(Ice_Auth_Social, authenticate) {
zval *_0;
zend_long ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
_0 = zephir_fetch_nproperty_this(this_ptr, SL("adapter"), PH_NOISY_CC);
ZEPHIR_RETURN_CALL_METHOD(_0, "authenticate", NULL, 0);
zephir_check_call_status();
RETURN_MM();
}
/**
* Retrieve a single key from an adapter.
*
* @param string key The data key
* @param mixed defaultValue The value to return if data key does not exist
* @return mixed
*/
PHP_METHOD(Ice_Auth_Social, get) {
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *key_param = NULL, *defaultValue = NULL, *_0;
zval *key = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &key_param, &defaultValue);
zephir_get_strval(key, key_param);
if (!defaultValue) {
defaultValue = ZEPHIR_GLOBAL(global_null);
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("adapter"), PH_NOISY_CC);
ZEPHIR_RETURN_CALL_METHOD(_0, "get", NULL, 0, key, defaultValue);
zephir_check_call_status();
RETURN_MM();
}
/**
* Call method of this class or methods of adapter class.
*
* @param string method
* @param mixed arguments
* @return mixed
*/
PHP_METHOD(Ice_Auth_Social, __call) {
zval *_0;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *method_param = NULL, *arguments = NULL, *_1;
zval *method = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &method_param, &arguments);
zephir_get_strval(method, method_param);
if (!arguments) {
arguments = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_INIT_VAR(_0);
zephir_create_array(_0, 2, 0 TSRMLS_CC);
ZEPHIR_OBS_VAR(_1);
zephir_read_property_this(&_1, this_ptr, SL("adapter"), PH_NOISY_CC);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(_0, method);
ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, _0, arguments);
zephir_check_call_status();
RETURN_MM();
}
|
/*
* Copyright (c) 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
* $Id: if_arp.h,v 1.1.1.1 2006/05/30 06:12:42 hhzhou Exp $
*/
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
u_short ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_char ar_sha[]; /* sender hardware address */
u_char ar_spa[]; /* sender protocol address */
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
};
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
#ifdef KERNEL
/*
* Structure shared between the ethernet driver modules and
* the address resolution code. For example, each ec_softc or il_softc
* begins with this structure.
*/
struct arpcom {
/*
* The ifnet struct _must_ be at the head of this structure.
*/
struct ifnet ac_if; /* network-visible interface */
u_char ac_enaddr[6]; /* ethernet hardware address */
int ac_multicnt; /* length of ac_multiaddrs list */
};
extern u_char etherbroadcastaddr[6];
#endif
#endif /* !_NET_IF_ARP_H_ */
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "item.h"
struct t_item{
int key;
char str[MAX_STR];
};
int item_compare(Item a, Item b)
{
return a->key - b->key;
}
Item item_scan(FILE *fp)
{
Item new = malloc(sizeof(*new));
if(fp == stdin)
{
printf("\nKey: ");
scanf("%d", &new->key);
printf("String: ");
scanf("%s", new->str);
}
else
{
fscanf(fp, "%d %s", &new->key, new->str);
}
return new;
}
Item item_new(int key, char *str)
{
Item new = malloc(sizeof(*new));
new->key = key;
strcpy(new->str, str);
return new;
}
void item_print(Item a, FILE *fp)
{
fprintf(fp,"%d\t%s\n", a->key, a->str);
}
void item_free(Item a)
{
free(a);
}
|
/*
* Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* 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 WTF_Alignment_h
#define WTF_Alignment_h
#include <wtf/Platform.h>
#include <algorithm>
#include <stdint.h>
namespace WTF {
#if COMPILER(GCC)
#define WTF_ALIGN_OF(type) __alignof__(type)
#define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n)))
#elif COMPILER(MSVC)
#define WTF_ALIGN_OF(type) __alignof(type)
#define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable
#else
#error WTF_ALIGN macros need alignment control.
#endif
#if COMPILER(GCC)
typedef char __attribute__((__may_alias__)) AlignedBufferChar;
#else
typedef char AlignedBufferChar;
#endif
template<size_t size, size_t alignment> struct AlignedBuffer;
template<size_t size> struct AlignedBuffer<size, 1> { AlignedBufferChar buffer[size]; };
template<size_t size> struct AlignedBuffer<size, 2> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 2); };
template<size_t size> struct AlignedBuffer<size, 4> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 4); };
template<size_t size> struct AlignedBuffer<size, 8> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 8); };
template<size_t size> struct AlignedBuffer<size, 16> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 16); };
template<size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); };
template<size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); };
template <size_t size, size_t alignment>
void swap(AlignedBuffer<size, alignment>& a, AlignedBuffer<size, alignment>& b)
{
for (size_t i = 0; i < size; ++i)
std::swap(a.buffer[i], b.buffer[i]);
}
template <uintptr_t mask>
inline bool isAlignedTo(const void* pointer)
{
return !(reinterpret_cast<uintptr_t>(pointer) & mask);
}
}
#endif // WTF_Alignment_h
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE194_Unexpected_Sign_Extension__fscanf_memcpy_15.c
Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml
Template File: sources-sink-15.tmpl.c
*/
/*
* @description
* CWE: 194 Unexpected Sign Extension
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Positive integer
* Sink: memcpy
* BadSink : Copy strings using memcpy() with the length of data
* Flow Variant: 15 Control flow: switch(6)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE194_Unexpected_Sign_Extension__fscanf_memcpy_15_bad()
{
short data;
/* Initialize data */
data = 0;
switch(6)
{
case 6:
/* FLAW: Use a value input from the console using fscanf() */
fscanf (stdin, "%hd", &data);
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign extension could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the switch to switch(5) */
static void goodG2B1()
{
short data;
/* Initialize data */
data = 0;
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
break;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign extension could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the switch */
static void goodG2B2()
{
short data;
/* Initialize data */
data = 0;
switch(6)
{
case 6:
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign extension could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
void CWE194_Unexpected_Sign_Extension__fscanf_memcpy_15_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE194_Unexpected_Sign_Extension__fscanf_memcpy_15_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE194_Unexpected_Sign_Extension__fscanf_memcpy_15_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitk_TubeGraphPicker_h
#define _mitk_TubeGraphPicker_h
#include <MitkTubeGraphExports.h>
#include "mitkCircularProfileTubeElement.h"
#include "mitkTubeGraph.h"
#include "mitkTubeGraphProperty.h"
namespace mitk
{
class MITKTUBEGRAPH_EXPORT TubeGraphPicker
{
public:
/* mitkClassMacro( TubeGraphPicker, BaseDataSource );
itkNewMacro( Self );*/
void SetTubeGraph(const TubeGraph *tubeGraph);
std::pair<mitk::TubeGraph::TubeDescriptorType, mitk::TubeElement *> GetPickedTube(const Point3D pickedPosition);
TubeGraphPicker();
virtual ~TubeGraphPicker();
protected:
Point3D m_WorldPosition;
TubeGraph::Pointer m_TubeGraph;
TubeGraphProperty::Pointer m_TubeGraphProperty;
};
} // namespace
#endif
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
#define CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
#include "base/basictypes.h"
class ChromeProxyConfigService;
class CommandLine;
class PrefProxyConfigTrackerImpl;
class PrefService;
#if defined(OS_CHROMEOS)
namespace chromeos {
class ProxyConfigServiceImpl;
}
#endif // defined(OS_CHROMEOS)
namespace net {
class NetLog;
class ProxyConfigService;
class ProxyService;
class URLRequestContext;
} // namespace net
class ProxyServiceFactory {
public:
// Creates a ProxyConfigService that delivers the system preferences
// (or the respective ChromeOS equivalent).
// The ChromeProxyConfigService returns "pending" until it has been informed
// about the proxy configuration by calling its UpdateProxyConfig method.
static ChromeProxyConfigService* CreateProxyConfigService();
#if defined(OS_CHROMEOS)
static chromeos::ProxyConfigServiceImpl* CreatePrefProxyConfigTracker(
PrefService* pref_service);
#else
static PrefProxyConfigTrackerImpl* CreatePrefProxyConfigTracker(
PrefService* pref_service);
#endif // defined(OS_CHROMEOS)
// Create a proxy service according to the options on command line.
static net::ProxyService* CreateProxyService(
net::NetLog* net_log,
net::URLRequestContext* context,
net::ProxyConfigService* proxy_config_service,
const CommandLine& command_line);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyServiceFactory);
};
#endif // CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
|
// Copyright 2011 Mariano Iglesias <mgiglesias@gmail.com>
#ifndef QUERY_H_
#define QUERY_H_
#include <v8.h>
#include <stdlib.h>
#include <node.h>
#include <node_buffer.h>
#include <node_version.h>
#include <algorithm>
#include <cctype>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include "./node_defs.h"
#include "./connection.h"
#include "./events.h"
#include "./exception.h"
#include "./result.h"
namespace node_db {
class Query : public EventEmitter {
public:
static void Init(v8::Handle<v8::Object> target, v8::Persistent<v8::FunctionTemplate> constructorTemplate);
void setConnection(Connection* connection);
v8::Handle<v8::Value> set(const v8::Arguments& args);
protected:
struct row_t {
char** columns;
unsigned long* columnLengths;
};
struct execute_request_t {
v8::Persistent<v8::Object> context;
Query* query;
Result* result;
std::string* error;
uint16_t columnCount;
bool buffered;
std::vector<row_t*>* rows;
};
Connection* connection;
std::ostringstream sql;
std::vector< v8::Persistent<v8::Value> > values;
bool async;
bool cast;
bool bufferText;
v8::Persistent<v8::Function>* cbStart;
v8::Persistent<v8::Function>* cbExecute;
v8::Persistent<v8::Function>* cbFinish;
Query();
~Query();
static v8::Handle<v8::Value> Select(const v8::Arguments& args);
static v8::Handle<v8::Value> From(const v8::Arguments& args);
static v8::Handle<v8::Value> Join(const v8::Arguments& args);
static v8::Handle<v8::Value> Where(const v8::Arguments& args);
static v8::Handle<v8::Value> And(const v8::Arguments& args);
static v8::Handle<v8::Value> Or(const v8::Arguments& args);
static v8::Handle<v8::Value> Order(const v8::Arguments& args);
static v8::Handle<v8::Value> Limit(const v8::Arguments& args);
static v8::Handle<v8::Value> Add(const v8::Arguments& args);
static v8::Handle<v8::Value> Insert(const v8::Arguments& args);
static v8::Handle<v8::Value> Update(const v8::Arguments& args);
static v8::Handle<v8::Value> Set(const v8::Arguments& args);
static v8::Handle<v8::Value> Delete(const v8::Arguments& args);
static v8::Handle<v8::Value> Sql(const v8::Arguments& args);
static v8::Handle<v8::Value> Execute(const v8::Arguments& args);
static uv_async_t g_async;
static void uvExecute(uv_work_t* uvRequest);
static void uvExecuteFinished(uv_work_t* uvRequest);
void executeAsync(execute_request_t* request);
static void freeRequest(execute_request_t* request, bool freeAll = true);
std::string fieldName(v8::Local<v8::Value> value) const throw(Exception&);
std::string tableName(v8::Local<v8::Value> value, bool escape = true) const throw(Exception&);
v8::Handle<v8::Value> addCondition(const v8::Arguments& args, const char* separator);
v8::Local<v8::Object> row(Result* result, row_t* currentRow) const;
virtual std::string parseQuery() const throw(Exception&);
virtual std::vector<std::string::size_type> placeholders(std::string* parsed) const throw(Exception&);
virtual Result* execute() const throw(Exception&);
std::string value(v8::Local<v8::Value> value, bool inArray = false, bool escape = true, int precision = -1) const throw(Exception&);
private:
static bool gmtDeltaLoaded;
static int gmtDelta;
std::string fromDate(const double timeStamp) const throw(Exception&);
};
}
#endif // QUERY_H_
|
/* mos_timer.c */
/*
Copyright (c) 2012 by Jason Cheung <yujiecheung@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 Jason Cheung 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.
*/
#include "mos.h"
#if (MOS_CFG_MAX_TIMER_COUNT)
static struct tag_mos_timer g_mos_timer[MOS_CFG_MAX_TIMER_COUNT];
static struct tag_mos_timer_table g_mos_timer_table;
static struct tag_mos_timer *mos_add_timer_to_table(void)
{
struct tag_mos_timer *new_timer = g_mos_timer_table.free;
mos_enter_sys_critical();
if (MOS_NULL != new_timer) {
g_mos_timer_table.free = new_timer->next;
new_timer->next = g_mos_timer_table.timer;
new_timer->event_ptr = MOS_NULL;
new_timer->elapse = 0;
new_timer->elapse_current = 0;
g_mos_timer_table.timer = new_timer;
}
mos_exit_sys_critical();
return new_timer;
}
static int mos_remove_timer_from_table(struct tag_mos_timer *timer)
{
struct tag_mos_timer *timer_prev = g_mos_timer_table.timer;
int result = MOS_FAIL;
mos_enter_sys_critical();
if (MOS_NULL != timer) {
if (timer_prev == timer) {
g_mos_timer_table.timer = g_mos_timer_table.timer->next;
timer->next = g_mos_timer_table.free;
g_mos_timer_table.free = timer;
result = MOS_SUCCESS;
} else {
while (MOS_NULL != timer_prev->next) {
if (timer_prev->next == timer) {
timer_prev->next = timer->next;
timer->next = g_mos_timer_table.free;
g_mos_timer_table.free = timer;
result = MOS_SUCCESS;
break;
}
timer_prev = timer_prev->next;
}
}
}
mos_exit_sys_critical();
return result;
}
/*------------------------------------------------------------------------------
public
*/
void mos_create_timer_table(void)
{
mos_int_t i;
struct tag_mos_timer *timer = g_mos_timer;
struct tag_mos_timer *timer_next = timer;
mos_enter_sys_critical();
timer_next++;
for (i = 0; i < (MOS_CFG_MAX_TIMER_COUNT - 1); i++) {
(timer++)->next = timer_next++;
}
timer->next = MOS_NULL;
g_mos_timer_table.timer = MOS_NULL;
g_mos_timer_table.free = g_mos_timer;
mos_exit_sys_critical();
}
void *mos_set_timer(void *event_ptr, unsigned int elapse)
{
struct tag_mos_timer *timer = MOS_NULL;
mos_enter_sys_critical();
/* (((unsigned int)-1) - MOS_TICK_ISR_ELAPSE) is to prevent overflow. */
if ((MOS_NULL != event_ptr) && (0 < elapse) &&
((((unsigned int)-1) - MOS_CFG_TICK) > elapse)) {
timer = mos_add_timer_to_table();
if (MOS_NULL != timer) {
timer->event_ptr = (struct tag_mos_event *)event_ptr;
timer->elapse = (mos_uint16_t)elapse;
}
}
mos_exit_sys_critical();
return (void *)timer;
}
int mos_kill_timer(void *timer)
{
return mos_remove_timer_from_table((struct tag_mos_timer *)timer);
}
void mos_timer_tick(void)
{
struct tag_mos_timer *timer = g_mos_timer_table.timer;
while (MOS_NULL != timer) {
/* called every tick. */
timer->elapse_current += MOS_CFG_TICK;
if (timer->elapse_current >= timer->elapse) {
mos_set_event((void *)(timer->event_ptr));
timer->elapse_current = 0;
}
timer = timer->next;
}
}
#endif /* MOS_CFG_MAX_TIMER_COUNT */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83.h
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__new_delete_array.label.xml
Template File: sources-sinks-83.tmpl.h
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: Allocate data using new
* GoodSource: Allocate data using new []
* Sinks:
* GoodSink: Deallocate data using delete
* BadSink : Deallocate data using delete []
* Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack
*
* */
#include "std_testcase.h"
namespace CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83
{
#ifndef OMITBAD
class CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_bad
{
public:
CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_bad(long * dataCopy);
~CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_bad();
private:
long * data;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodG2B
{
public:
CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodG2B(long * dataCopy);
~CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodG2B();
private:
long * data;
};
class CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodB2G
{
public:
CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodB2G(long * dataCopy);
~CWE762_Mismatched_Memory_Management_Routines__new_delete_array_long_83_goodB2G();
private:
long * data;
};
#endif /* OMITGOOD */
}
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef VIEWS_WIDGET_WIDGET_DELEGATE_H_
#define VIEWS_WIDGET_WIDGET_DELEGATE_H_
#pragma once
namespace views {
// WidgetDelegate interface
// Handles events on Widgets in context-specific ways.
class WidgetDelegate {
public:
virtual ~WidgetDelegate() {}
// Called whenever the widget is activated or deactivated.
// TODO(beng): This should be consolidated with
// WindowDelegate::OnWindowActivationChanged().
virtual void OnWidgetActivated(bool active) {}
// Called whenever the widget's position changes.
virtual void OnWidgetMove() {}
// Called with the display changes (color depth or resolution).
virtual void OnDisplayChanged() {}
// Called when the work area (the desktop area minus task bars,
// menu bars, etc.) changes in size.
virtual void OnWorkAreaChanged() {}
};
} // namespace views
#endif // VIEWS_WIDGET_WIDGET_DELEGATE_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int64_t_fscanf_add_65b.c
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-65b.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: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE190_Integer_Overflow__int64_t_fscanf_add_65b_badSink(int64_t data)
{
{
/* POTENTIAL FLAW: Adding 1 to data could cause an overflow */
int64_t result = data + 1;
printLongLongLine(result);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE190_Integer_Overflow__int64_t_fscanf_add_65b_goodG2BSink(int64_t data)
{
{
/* POTENTIAL FLAW: Adding 1 to data could cause an overflow */
int64_t result = data + 1;
printLongLongLine(result);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE190_Integer_Overflow__int64_t_fscanf_add_65b_goodB2GSink(int64_t data)
{
/* FIX: Add a check to prevent an overflow from occurring */
if (data < LLONG_MAX)
{
int64_t result = data + 1;
printLongLongLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
#endif /* OMITGOOD */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_32.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml
Template File: sources-sink-32.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: cat
* BadSink : Copy string to data using wcscat
* Flow Variant: 32 Data flow using two pointers to the same value within the same function
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_32_bad()
{
wchar_t * data;
wchar_t * *dataPtr1 = &data;
wchar_t * *dataPtr2 = &data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
{
wchar_t * data = *dataPtr1;
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = L'\0'; /* null terminate */
*dataPtr1 = data;
}
{
wchar_t * data = *dataPtr2;
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */
wcscat(data, source);
printWLine(data);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
wchar_t * data;
wchar_t * *dataPtr1 = &data;
wchar_t * *dataPtr2 = &data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
{
wchar_t * data = *dataPtr1;
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
*dataPtr1 = data;
}
{
wchar_t * data = *dataPtr2;
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */
wcscat(data, source);
printWLine(data);
}
}
}
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_32_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_32_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_32_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__char_environment_vfprintf_61b.c
Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml
Template File: sources-vasinks-61b.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: environment Read input from an environment variable
* GoodSource: Copy a fixed string into data
* Sinks: vfprintf
* GoodSink: vfprintf with a format string
* BadSink : vfprintf without a format string
* Flow Variant: 61 Data flow: data returned from one function to another in different source files
*
* */
#include <stdarg.h>
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#define ENV_VARIABLE "ADD"
#ifdef _WIN32
#define GETENV getenv
#else
#define GETENV getenv
#endif
#ifndef OMITBAD
char * CWE134_Uncontrolled_Format_String__char_environment_vfprintf_61b_badSource(char * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
char * CWE134_Uncontrolled_Format_String__char_environment_vfprintf_61b_goodG2BSource(char * data)
{
/* FIX: Use a fixed string that does not contain a format specifier */
strcpy(data, "fixedstringtest");
return data;
}
/* goodB2G() uses the BadSource with the GoodSink */
char * CWE134_Uncontrolled_Format_String__char_environment_vfprintf_61b_goodB2GSource(char * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
#endif /* OMITGOOD */
|
/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkVMVisualizer_DEFINED
#define SkVMVisualizer_DEFINED
#include <unordered_map>
#include <vector>
#include "include/core/SkSpan.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/private/SkBitmaskEnum.h"
#include "include/private/SkChecksum.h"
#include "include/private/SkTHash.h"
#include "src/core/SkOpts.h"
#include "src/sksl/SkSLOutputStream.h"
#include "src/sksl/tracing/SkVMDebugTrace.h"
namespace skvm::viz {
enum InstructionFlags : uint8_t {
kNormal = 0x00,
kHoisted = 0x01,
kDead = 0x02,
};
struct MachineCommand {
size_t address;
SkString label;
SkString command;
SkString extra;
};
struct Instruction {
InstructionFlags kind = InstructionFlags::kNormal;
// Machine commands range (for disassembling):
size_t startCode = 0;
size_t endCode = 0;
int instructionIndex; // index in the actual instructions list
int duplicates = 0; // number of duplicates;
// -1 means it's a duplicate itself; 0 - it does not have dups
skvm::Instruction instruction;
bool operator == (const Instruction& o) const;
SkString classes() const;
};
struct InstructionHash {
uint32_t operator()(const Instruction& i) const;
};
class Visualizer {
public:
explicit Visualizer(SkSL::SkVMDebugTrace* debugInfo)
: fDebugInfo(debugInfo), fOutput(nullptr) {}
~Visualizer() = default;
void dump(SkWStream* output, const char* code);
void markAsDeadCode(std::vector<bool>& live, const std::vector<int>& newIds);
void finalize(const std::vector<skvm::Instruction>& all,
const std::vector<skvm::OptimizedInstruction>& optimized);
void addInstructions(std::vector<skvm::Instruction>& program);
void markAsDuplicate(int origin, int id) {
++fInstructions[origin].duplicates;
}
void addInstruction(Instruction skvm);
void addMachineCommands(int id, size_t start, size_t end);
SkString V(int reg) const;
private:
void parseDisassembler(SkWStream* output, const char* code);
void dumpInstruction(int id) const;
void dumpHead() const;
void dumpTail() const;
void formatVV(const char* op, int v1, int v2) const;
void formatPV(const char* op, int imm, int v1) const;
void formatPVV(const char* op, int imm, int v1, int v2) const;
void formatPVVVV(const char* op, int imm, int v1, int v2, int v3, int v4) const;
void formatA_(int id, const char* op) const;
void formatA_P(int id, const char* op, int imm) const;
void formatA_PH(int id, const char* op, int immA, int immB) const;
void formatA_PHH(int id, const char* op, int immA, int immB, int immC) const;
void formatA_PHV(int id, const char* op, int immA, int immB, int v) const;
void formatA_S(int id, const char* op, int imm) const;
void formatA_V(int id, const char* op, int v) const;
void formatA_VV(int id, const char* op, int v1, int v2) const;
void formatA_VVV(int id, const char* op, int v1, int v2, int v3) const;
void formatA_VC(int id, const char* op, int v, int imm) const;
void writeText(const char* format, ...) const SK_PRINTF_LIKE(2, 3);
SkSL::SkVMDebugTrace* fDebugInfo;
SkTHashMap<Instruction, size_t, InstructionHash> fIndex;
SkTArray<Instruction> fInstructions;
SkWStream* fOutput;
SkTHashMap<int, size_t> fToDisassembler;
SkTArray<MachineCommand> fAsm;
mutable size_t fAsmLine = 0;
size_t fAsmStart = 0;
size_t fAsmEnd = 0;
};
} // namespace skvm::viz
namespace sknonstd {
template <> struct is_bitmask_enum<skvm::viz::InstructionFlags> : std::true_type {};
} // namespace sknonstd
#endif // SkVMVisualizer_DEFINED
|
// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); 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.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Samuel Hornus, Olivier Devillers
#ifndef CGAL_INTERVAL_LINEAR_ALGEBRA_H
#define CGAL_INTERVAL_LINEAR_ALGEBRA_H
#include <CGAL/Interval_nt.h>
#include <CGAL/predicates/sign_of_determinant.h>
namespace CGAL {
namespace internal
{
template<class Matrix>
Sign // The matrix is row major: M[i] represents row i.
/*
FIXME : the function DOES MODIFY the matrix M, but calling functions
assume M is not modified --> BUGS. (e.g. Side_of_oriented_subsphere)
*/
sign_of_determinantDxD_with_interval_arithmetic(Matrix & M)
// attempts to compute the determinant using interval arithmetic
{
typedef Interval_nt<false> NT; // Field number type
int sign = 1;
int curdim = M.dimension().first;
for(int col = 0; col < curdim; ++col)
{
int pivot_line = -1;
NT pivot = 0.0;
for(int l = col; l < curdim; ++l)
{
NT candidate = CGAL::abs(M[l][col]);
if( CGAL::certainly(0.0 < candidate) )
if( pivot.inf() < candidate.inf() )
{
pivot_line = l;
pivot = candidate;
}
}
if( -1 == pivot_line )
{
throw CGAL::Uncertain_conversion_exception("undecidable interval computation of determinant");
}
// if the pivot value is negative, invert the sign
if( M[pivot_line][col] < 0.0 )
sign = - sign;
// put the pivot cell on the diagonal
if( pivot_line > col )
{
std::swap(M[col], M[pivot_line]); // this takes constant time with std::vector<>
sign = - sign;
}
// using matrix-line operations, set zero in all cells below the pivot cell.
// This costs roughly (curdim-col-1)^2 mults and adds, because we don't actually
// compute the zeros below the pivot cell
NT denom = NT(1.0) / M[col][col];
for(int line = col + 1; line < curdim; ++line)
{
NT numer = M[line][col] * denom;
for (int c = col + 1; c < curdim; ++c)
M[line][c] -= numer * M[col][c];
}
}
return Sign(sign);
}
} // end of namespace internal
template<>
inline
Sign
Linear_algebraCd<Interval_nt_advanced>::sign_of_determinant(const Matrix & M)
{
switch( M.dimension().first )
{
case 2:
return CGAL::sign_of_determinant( M(0,0), M(0,1),
M(1,0), M(1,1));
break;
case 3:
return CGAL::sign_of_determinant( M(0,0), M(0,1), M(0,2),
M(1,0), M(1,1), M(1,2),
M(2,0), M(2,1), M(2,2));
break;
case 4:
return CGAL::sign_of_determinant( M(0,0), M(0,1), M(0,2), M(0,3),
M(1,0), M(1,1), M(1,2), M(1,3),
M(2,0), M(2,1), M(2,2), M(2,3),
M(3,0), M(3,1), M(3,2), M(3,3));
break;
default:
return internal::sign_of_determinantDxD_with_interval_arithmetic(const_cast<Matrix &>(M));
break;
}
}
} //namespace CGAL
#endif // CGAL_INTERVAL_LINEAR_ALGEBRA_H
|
/*
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
* Copyright (C) 2005 Eric Seidel <eric@webkit.org>
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* 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 FEMorphology_h
#define FEMorphology_h
#include "core/platform/graphics/filters/Filter.h"
#include "core/platform/graphics/filters/FilterEffect.h"
namespace WebCore {
enum MorphologyOperatorType {
FEMORPHOLOGY_OPERATOR_UNKNOWN = 0,
FEMORPHOLOGY_OPERATOR_ERODE = 1,
FEMORPHOLOGY_OPERATOR_DILATE = 2
};
class FEMorphology : public FilterEffect {
public:
static PassRefPtr<FEMorphology> create(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
MorphologyOperatorType morphologyOperator() const;
bool setMorphologyOperator(MorphologyOperatorType);
float radiusX() const;
bool setRadiusX(float);
float radiusY() const;
bool setRadiusY(float);
virtual SkImageFilter* createImageFilter(SkiaImageFilterBuilder*);
virtual void determineAbsolutePaintRect();
virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
virtual TextStream& externalRepresentation(TextStream&, int indention) const;
struct PaintingData {
Uint8ClampedArray* srcPixelArray;
Uint8ClampedArray* dstPixelArray;
int width;
int height;
int radiusX;
int radiusY;
};
static const int s_minimalArea = (300 * 300); // Empirical data limit for parallel jobs
struct PlatformApplyParameters {
FEMorphology* filter;
int startY;
int endY;
PaintingData* paintingData;
};
static void platformApplyWorker(PlatformApplyParameters*);
inline void platformApply(PaintingData*);
inline void platformApplyGeneric(PaintingData*, const int yStart, const int yEnd);
private:
FEMorphology(Filter*, MorphologyOperatorType, float radiusX, float radiusY);
virtual void applySoftware() OVERRIDE;
virtual bool applySkia() OVERRIDE;
MorphologyOperatorType m_type;
float m_radiusX;
float m_radiusY;
};
} // namespace WebCore
#endif // FEMorphology_h
|
//
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file at the top level of the distribution
// and at http://projectchrono.org/license-chrono.txt.
//
#ifndef CHTHREADSPOSIX_H
#define CHTHREADSPOSIX_H
#include <string>
#include "chrono/core/ChApiCE.h"
#include "chrono/parallel/ChThreadsFunct.h"
#include "chrono/collision/bullet/LinearMath/btAlignedObjectArray.h"
// macOS platform-specific headers:
#if defined(__APPLE__)
#include <fcntl.h>
#include <sys/stat.h>
#include <cerrno>
#endif
// UNIX - LINUX platform specific:
#include <pthread.h>
#include <semaphore.h>
namespace chrono {
typedef unsigned int uint32_t;
struct ChThreadStatePOSIX {
uint32_t m_taskId;
uint32_t m_commandId;
uint32_t m_status;
ChThreadFunc m_userThreadFunc; // user function
void* m_userPtr; // user data
void* m_lsMemory; // initialized using PosixLocalStoreMemorySetupFunc
pthread_t thread;
#if defined(__APPLE__)
sem_t* startSemaphore;
#else
sem_t startSemaphore;
#endif
sem_t* mainSemaphore;
unsigned long threadUsed;
};
class ChApi ChThreadsPOSIX {
btAlignedObjectArray<ChThreadStatePOSIX> m_activeSpuStatus;
btAlignedObjectArray<void*> m_completeHandles;
std::string uniqueName;
// this semaphore will signal, if and how many threads are finished with their work
#if defined(__APPLE__)
sem_t* mainSemaphore;
#else
sem_t mainSemaphore;
#endif
public:
/// Constructor: create and initialize N threads.
ChThreadsPOSIX(ChThreadConstructionInfo& threadConstructionInfo);
/// Destructor: cleanup/shutdown
virtual ~ChThreadsPOSIX();
void makeThreads(ChThreadConstructionInfo& threadInfo);
virtual void sendRequest(uint32_t uiCommand, void* uiUserPtr, unsigned int threadId);
virtual void waitForResponse(unsigned int* puiArgument0, unsigned int* puiArgument1);
virtual void startSPU();
virtual void stopSPU();
virtual void flush();
virtual int getNumberOfThreads() { return m_activeSpuStatus.size(); }
virtual std::string getUniqueName() { return uniqueName; }
};
typedef ChThreadsPOSIX ChThreadsPlatformImplementation;
} // end namespace chrono
#endif
|
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
if (argc < 3) {
printf("not enough arguments\n");
return 1;
}
FILE *fp_h = fopen(argv[1], "w");
if (!fp_h) {
printf("can't open %s\n", argv[1]);
return 2;
}
FILE *fp_c = fopen(argv[2], "w");
if (!fp_c) {
fclose(fp_h);
printf("can't open %s\n", argv[2]);
return 2;
}
fprintf(fp_h,
"// generated file, all changes will be lost\n"
"#ifndef FPP_GENERATED_IMG_RESOURCES_H\n"
"#define FPP_GENERATED_IMG_RESOURCES_H\n"
"\n"
"#include <stddef.h>\n"
"\n"
"struct resource_image_s {\n"
" const char *name;\n"
" size_t len;\n"
" const char *data;\n"
"};\n"
"\n"
"extern struct resource_image_s resource_image[];\n"
"extern size_t resource_image_count;\n"
"\n"
"#endif\n");
fclose(fp_h);
fprintf(fp_c,
"// generated file, all changes will be lost\n"
"#include \"%s\"\n"
"\n", argv[1]);
fprintf(fp_c, "size_t resource_image_count = %d;\n", argc - 3);
fprintf(fp_c, "struct resource_image_s resource_image[] = {\n");
for (int k = 3; k < argc; k ++) {
unsigned char buf[4096];
char *fname = strdup(argv[k]);
char *bname = basename(fname);
fprintf(fp_c, "{ .name = \"%s\",\n", bname);
fprintf(fp_c, " .data = \"");
size_t fsize = 0;
FILE *tmp = fopen(fname, "rb");
if (!tmp) {
printf("can't open %s\n", fname);
free(fname);
goto err_1;
}
while (!feof(tmp)) {
size_t read_bytes = fread(buf, 1, sizeof(buf), tmp);
for (size_t j = 0; j < read_bytes; j ++)
fprintf(fp_c, "\\x%02x", buf[j]);
fsize += read_bytes;
}
fclose(tmp);
fprintf(fp_c, "\",\n");
fprintf(fp_c, " .len = %u\n", (unsigned int)fsize);
fprintf(fp_c, "},\n");
free(fname);
}
fprintf(fp_c, "};\n");
fclose(fp_c);
return 0;
err_1:
fclose(fp_c);
return 3;
}
|
/*
*
* Copyright (C) 1993-2011, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmqrdb
*
* Author: Marco Eichelberg
*
* Purpose: class DcmQueryRetrieveMoveContext
*
*/
#ifndef DCMQRCBM_H
#define DCMQRCBM_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmnet/dimse.h"
#include "dcmtk/dcmqrdb/qrdefine.h"
class DcmQueryRetrieveDatabaseHandle;
class DcmQueryRetrieveOptions;
class DcmQueryRetrieveConfig;
class DcmQueryRetrieveDatabaseStatus;
/** this class maintains the context information that is passed to the
* callback function called by DIMSE_moveProvider.
*/
class DCMTK_DCMQRDB_EXPORT DcmQueryRetrieveMoveContext
{
public:
/** constructor
* @param handle reference to database handle
* @param options options for the Q/R service
* @param cfg configuration for the Q/R service
* @param priorstatus prior DIMSE status
* @param assoc pointer to DIMSE association
* @param msgid DIMSE message ID
* @param pr DIMSE priority
*/
DcmQueryRetrieveMoveContext(
DcmQueryRetrieveDatabaseHandle& handle,
const DcmQueryRetrieveOptions& options,
const DcmQueryRetrieveConfig *cfg,
DIC_US priorstatus,
T_ASC_Association *assoc,
DIC_US msgid,
T_DIMSE_Priority pr)
: dbHandle(handle)
, options_(options)
, priorStatus(priorstatus)
, origAssoc(assoc)
, subAssoc(NULL)
, config(cfg)
, assocStarted(OFFalse)
, origMsgId(msgid)
// , origAETitle()
// , origHostName()
, priority(pr)
, ourAETitle()
// , dstAETitle()
, failedUIDs(NULL)
, nRemaining(0)
, nCompleted(0)
, nFailed(0)
, nWarning(0)
{
origAETitle[0] = '\0';
origHostName[0] = '\0';
dstAETitle[0] = '\0';
}
/** callback handler called by the DIMSE_storeProvider callback function.
* @param cancelled (in) flag indicating whether a C-CANCEL was received
* @param request original move request (in)
* @param requestIdentifiers original move request identifiers (in)
* @param responseCount move response count (in)
* @param response move response (out)
* @param stDetail status detail for move response (out)
* @param responseIdentifiers move response identifiers (out)
*/
void callbackHandler(
/* in */
OFBool cancelled, T_DIMSE_C_MoveRQ *request,
DcmDataset *requestIdentifiers, int responseCount,
/* out */
T_DIMSE_C_MoveRSP *response, DcmDataset **stDetail,
DcmDataset **responseIdentifiers);
/** set the AEtitle under which this application operates
* @param ae AEtitle, is copied into this object.
*/
void setOurAETitle(const char *ae)
{
if (ae) ourAETitle = ae; else ourAETitle.clear();
}
private:
/// private undefined copy constructor
DcmQueryRetrieveMoveContext(const DcmQueryRetrieveMoveContext& other);
/// private undefined assignment operator
DcmQueryRetrieveMoveContext& operator=(const DcmQueryRetrieveMoveContext& other);
void addFailedUIDInstance(const char *sopInstance);
OFCondition performMoveSubOp(DIC_UI sopClass, DIC_UI sopInstance, char *fname);
OFCondition buildSubAssociation(T_DIMSE_C_MoveRQ *request);
OFCondition closeSubAssociation();
void moveNextImage(DcmQueryRetrieveDatabaseStatus * dbStatus);
void failAllSubOperations(DcmQueryRetrieveDatabaseStatus * dbStatus);
void buildFailedInstanceList(DcmDataset ** rspIds);
OFBool mapMoveDestination(
const char *origPeer, const char *origAE,
const char *dstAE, char *dstPeer, int *dstPort);
OFCondition addAllStoragePresentationContexts(T_ASC_Parameters *params);
/// reference to database handle
DcmQueryRetrieveDatabaseHandle& dbHandle;
/// reference to Q/R service options
const DcmQueryRetrieveOptions& options_;
/// prior DIMSE status
DIC_US priorStatus;
/// pointer to original association on which the C-MOVE-RQ was received
T_ASC_Association *origAssoc; /* association of requestor */
/// pointer to sub-association for outgoing C-STORE-RQ
T_ASC_Association *subAssoc; /* sub-association */
/// pointer to Q/R configuration
const DcmQueryRetrieveConfig *config;
/// true if the association was started
OFBool assocStarted;
/// message id of request
DIC_US origMsgId;
/// title of requestor
DIC_AE origAETitle;
/// hostname of move requestor
DIC_NODENAME origHostName;
/// priority of move request
T_DIMSE_Priority priority;
/// our current title
OFString ourAETitle;
/// destination title for move
DIC_AE dstAETitle;
/// instance UIDs of failed store sub-ops
char *failedUIDs;
/// number of remaining sub-operations
DIC_US nRemaining;
/// number of completed sub-operations
DIC_US nCompleted;
/// number of failed sub-operations
DIC_US nFailed;
/// number of completed sub-operations that causes warnings
DIC_US nWarning;
};
#endif
|
/*-
* BSD LICENSE
*
* Copyright(c) 2017 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:
*
* * 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 copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _RTE_CRYPTODEV_PCI_H_
#define _RTE_CRYPTODEV_PCI_H_
#include <rte_pci.h>
#include "rte_cryptodev.h"
/**
* Initialisation function of a crypto driver invoked for each matching
* crypto PCI device detected during the PCI probing phase.
*
* @param dev The dev pointer is the address of the *rte_cryptodev*
* structure associated with the matching device and which
* has been [automatically] allocated in the
* *rte_crypto_devices* array.
*
* @return
* - 0: Success, the device is properly initialised by the driver.
* In particular, the driver MUST have set up the *dev_ops* pointer
* of the *dev* structure.
* - <0: Error code of the device initialisation failure.
*/
typedef int (*cryptodev_pci_init_t)(struct rte_cryptodev *dev);
/**
* Finalisation function of a driver invoked for each matching
* PCI device detected during the PCI closing phase.
*
* @param dev The dev pointer is the address of the *rte_cryptodev*
* structure associated with the matching device and which
* has been [automatically] allocated in the
* *rte_crypto_devices* array.
*
* * @return
* - 0: Success, the device is properly finalised by the driver.
* In particular, the driver MUST free the *dev_ops* pointer
* of the *dev* structure.
* - <0: Error code of the device initialisation failure.
*/
typedef int (*cryptodev_pci_uninit_t)(struct rte_cryptodev *dev);
/**
* @internal
* Wrapper for use by pci drivers as a .probe function to attach to a crypto
* interface.
*/
int
rte_cryptodev_pci_generic_probe(struct rte_pci_device *pci_dev,
size_t private_data_size,
cryptodev_pci_init_t dev_init);
/**
* @internal
* Wrapper for use by pci drivers as a .remove function to detach a crypto
* interface.
*/
int
rte_cryptodev_pci_generic_remove(struct rte_pci_device *pci_dev,
cryptodev_pci_uninit_t dev_uninit);
#endif /* _RTE_CRYPTODEV_PCI_H_ */
|
/**********************************************************************
utf_32le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 "regenc.h"
static OnigCodePoint utf32le_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc);
static int
utf32le_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e,
OnigEncoding enc)
{
if (e < p) {
return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
}
else if (e-p < 4) {
return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(4-(int)(e-p));
}
else {
OnigCodePoint c = utf32le_mbc_to_code(p, e, enc);
if (!UNICODE_VALID_CODEPOINT_P(c))
return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(4);
}
}
static int
utf32le_is_mbc_newline(const UChar* p, const UChar* end,
OnigEncoding enc ARG_UNUSED)
{
if (p + 3 < end) {
if (*p == 0x0a && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0)
return 1;
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
if ((*p == 0x0b ||*p == 0x0c ||*p == 0x0d || *p == 0x85)
&& *(p+1) == 0x00 && (p+2) == 0x00 && *(p+3) == 0x00)
return 1;
if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28)
&& *(p+2) == 0x00 && *(p+3) == 0x00)
return 1;
#endif
}
return 0;
}
static OnigCodePoint
utf32le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
{
return (OnigCodePoint )(((p[3] * 256 + p[2]) * 256 + p[1]) * 256 + p[0]);
}
static int
utf32le_code_to_mbclen(OnigCodePoint code ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
{
return 4;
}
static int
utf32le_code_to_mbc(OnigCodePoint code, UChar *buf,
OnigEncoding enc ARG_UNUSED)
{
UChar* p = buf;
*p++ = (UChar ) (code & 0xff);
*p++ = (UChar )((code & 0xff00) >> 8);
*p++ = (UChar )((code & 0xff0000) >>16);
*p++ = (UChar )((code & 0xff000000) >>24);
return 4;
}
static int
utf32le_mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* fold,
OnigEncoding enc)
{
const UChar* p = *pp;
if (ONIGENC_IS_ASCII_CODE(*p) && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) {
if (*p == 0x49) {
*fold++ = 0x31;
*fold++ = 0x01;
}
}
else {
#endif
*fold++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
*fold++ = 0;
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
}
#endif
*fold++ = 0;
*fold = 0;
*pp += 4;
return 4;
}
else
return onigenc_unicode_mbc_case_fold(enc, flag, pp,
end, fold);
}
#if 0
static int
utf32le_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
const UChar* p = *pp;
(*pp) += 4;
if (*(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
int c, v;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
return TRUE;
}
c = *p;
v = ONIGENC_IS_UNICODE_ISO_8859_1_BIT_CTYPE(c,
(BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
if (c >= 0xaa && c <= 0xba)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
return FALSE;
}
#endif
static UChar*
utf32le_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end,
OnigEncoding enc ARG_UNUSED)
{
ptrdiff_t rem;
if (s <= start) return (UChar* )s;
rem = (int )((s - start) % 4);
return (UChar* )(s - rem);
}
static int
utf32le_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[],
OnigEncoding enc)
{
return onigenc_unicode_get_case_fold_codes_by_str(enc,
flag, p, end, items);
}
OnigEncodingDefine(utf_32le, UTF_32LE) = {
utf32le_mbc_enc_len,
"UTF-32LE", /* name */
4, /* max byte length */
4, /* min byte length */
utf32le_is_mbc_newline,
utf32le_mbc_to_code,
utf32le_code_to_mbclen,
utf32le_code_to_mbc,
utf32le_mbc_case_fold,
onigenc_unicode_apply_all_case_fold,
utf32le_get_case_fold_codes_by_str,
onigenc_unicode_property_name_to_ctype,
onigenc_unicode_is_code_ctype,
onigenc_utf16_32_get_ctype_code_range,
utf32le_left_adjust_char_head,
onigenc_always_false_is_allowed_reverse_match,
0,
ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("UCS-4LE", "UTF-32LE")
|
// Copyright (c) 2010-2011 Zipline Games, Inc. All Rights Reserved.
// http://getmoai.com
#ifndef ZL_H
#define ZL_H
#include <zlcore/pch.h>
#include <zlcore/zl_mutex.h>
#ifdef __cplusplus
extern "C" {
#endif
//================================================================//
// zl_stat
//================================================================//
typedef struct zl_stat {
int mExists;
int mIsDir;
unsigned long long mTimeCreated; // Time created (in seconds from cardinal date)
unsigned long long mTimeModified; // Time last modified (in seconds from cardinal date)
unsigned long long mTimeViewed; // Time last viewed (in seconds from cardinal date)
size_t mSize; // Yeah, that
} zl_stat;
//================================================================//
// zlcore
//================================================================//
typedef void ZLDIR;
typedef void ZLFILE;
typedef void ZL_TLSF_POOL;
extern ZLFILE* zl_stderr;
extern ZLFILE* zl_stdin;
extern ZLFILE* zl_stdout;
//----------------------------------------------------------------//
extern int zl_affirm_path ( const char* path );
extern int zl_chdir ( const char* path );
extern void zl_cleanup ( void );
extern void zl_dir_close ( ZLDIR* dir );
extern char const* zl_dir_entry_name ( ZLDIR* dir );
extern int zl_dir_entry_is_subdir ( ZLDIR* dir );
extern ZLDIR* zl_dir_open ( void );
extern int zl_dir_read_entry ( ZLDIR* dir );
extern int zl_get_stat ( char const* path, zl_stat* filestat );
extern char* zl_getcwd ( char* buffer, size_t length );
extern void zl_init ( void );
extern int zl_mkdir ( const char* path );
extern int zl_mount_virtual ( const char* virtualPath, const char* archive );
extern int zl_rmdir ( const char* path );
//================================================================//
// stdlib
//================================================================//
//----------------------------------------------------------------//
extern void* zl_calloc ( size_t num, size_t size );
extern void zl_free ( void* ptr );
extern void* zl_malloc ( size_t size );
extern void* zl_realloc ( void* ptr, size_t size );
extern ZL_TLSF_POOL* zl_tlsf_create_pool ( size_t bytes );
extern void zl_tlsf_destroy_pool ( ZL_TLSF_POOL* opaque );
extern ZL_TLSF_POOL* zl_tlsf_get_pool ( void );
extern void zl_tlsf_set_pool ( ZL_TLSF_POOL* opaque );
//================================================================//
// stdio
//================================================================//
//----------------------------------------------------------------//
extern void zl_clearerr ( ZLFILE* fp );
extern int zl_fclose ( ZLFILE* fp );
extern int zl_feof ( ZLFILE* fp );
extern int zl_ferror ( ZLFILE* fp );
extern int zl_fflush ( ZLFILE* fp );
extern int zl_fgetc ( ZLFILE* fp );
extern int zl_fgetpos ( ZLFILE* fp, fpos_t* position );
extern char* zl_fgets ( char* string, int length, ZLFILE* fp );
extern int zl_fileno ( ZLFILE* fp );
extern ZLFILE* zl_fopen ( const char* filename, const char* mode );
extern int zl_fprintf ( ZLFILE* fp, const char * format, ... );
extern int zl_fputc ( int c, ZLFILE* fp );
extern int zl_fputs ( const char* string, ZLFILE* fp );
extern size_t zl_fread ( void* buffer, size_t size, size_t count, ZLFILE* fp );
extern ZLFILE* zl_freopen ( const char* filename, const char* mode, ZLFILE* fp );
extern int zl_fscanf ( ZLFILE* fp, const char* format, ... );
extern int zl_fseek ( ZLFILE* fp, long offset, int origin );
extern int zl_fsetpos ( ZLFILE* fp, const fpos_t * pos );
extern long zl_ftell ( ZLFILE* fp );
extern size_t zl_fwrite ( const void* data, size_t size, size_t count, ZLFILE* fp );
extern int zl_getc ( ZLFILE* fp );
extern int zl_getwc ( ZLFILE* fp );
extern int zl_pclose ( ZLFILE* fp );
extern ZLFILE* zl_popen ( const char *command, const char *mode );
extern int zl_putc ( int character, ZLFILE* fp );
extern int zl_remove ( const char* path );
extern int zl_rename ( const char* oldname, const char* newname );
extern void zl_rewind ( ZLFILE* fp );
extern void zl_setbuf ( ZLFILE* fp, char* buffer );
extern int zl_setvbuf ( ZLFILE* fp, char* buffer, int mode, size_t size );
extern ZLFILE* zl_tmpfile ( void );
extern char* zl_tmpnam ( char* str );
extern int zl_ungetc ( int character, ZLFILE* fp );
extern int zl_vfprintf ( ZLFILE* fp, const char* format, va_list arg );
extern int zl_vfscanf ( ZLFILE* fp, const char* format, va_list arg );
#ifdef MOAI_COMPILER_MSVC
extern errno_t zl_fopen_s ( ZLFILE** fp, const char* filename, const char* mode );
extern int zl_fseeki64 ( ZLFILE* fp, __int64 offset, int origin );
#endif
#ifdef __cplusplus
}
#endif
#endif
|
//
// BRAppleWatchSharedConstants.h
// BreadWallet
//
// Created by Henry on 10/27/15.
// Copyright (c) 2015 Aaron Voisine <voisine@gmail.com>
// Copyright © 2016 Litecoin Association <loshan1212@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "BRAppleWatchData.h"
#define AW_SESSION_RESPONSE_KEY @"AW_SESSION_RESPONSE_KEY"
#define AW_SESSION_REQUEST_TYPE @"AW_SESSION_REQUEST_TYPE"
#define AW_SESSION_QR_CODE_BITS_KEY @"AW_QR_CODE_BITS_KEY"
#define AW_SESSION_REQUEST_DATA_TYPE_KEY @"AW_SESSION_REQUEST_DATA_TYPE_KEY"
#define AW_APPLICATION_CONTEXT_KEY @"AW_APPLICATION_CONTEXT_KEY"
#define AW_QR_CODE_BITS_KEY @"AW_QR_CODE_BITS_KEY"
#define AW_PHONE_NOTIFICATION_KEY @"AW_PHONE_NOTIFICATION_KEY"
#define AW_PHONE_NOTIFICATION_TYPE_KEY @"AW_PHONE_NOTIFICATION_TYPE_KEY"
typedef enum {
AWSessionRquestDataTypeApplicationContextData,
AWSessionRquestDataTypeQRCodeBits
} AWSessionRquestDataType;
typedef enum {
AWSessionRquestTypeDataUpdateNotification,
AWSessionRquestTypeFetchData,
AWSessionRquestTypeQRCodeBits
} AWSessionRquestType;
typedef enum {
AWPhoneNotificationTypeTxReceive
} AWPhoneNotificationType;
|
#include <stdlib.h>
#include <time.h>
#include "item.h"
#include "list.h"
static int N = 10;
int main(void) {
link h;
srand(time(NULL));
h = list_init(N);
list_show(h);
h = list_sort(h);
list_show(h);
return 0;
}
|
//
// Created by Dani Postigo on 1/29/14.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@interface NSButton (DPKit)
- (void) addTarget: (id) target action: (SEL) selector;
@end
|
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@class WebViewDelegate;
@interface ContentView : NSView {
IBOutlet WebView* webView;
WebViewDelegate* delegate;
}
- (void) triggerEvent:(NSString *)type;
@property (retain) WebView* webView;
@property (retain) WebViewDelegate* delegate;
@end
|
/*!
* \file ConcertDesign.h
*
* \brief It contain declarations for ConcertDesgin to be defined
*
*
* Compiler g++
*
* \author amarjeet singh kapoor
*
*/
#ifndef _CONCERTDESIGN_H
#define _CONCERTDESIGN_H
#include"header.h"
class CodeType{
public:
string code;
string section;
vector<int> member_id;
void print();
};
class ConcreteDesign{
public:
string code;
vector<CodeType> cty;
void print();
};
#endif
|
//
// PKShortVideoWriter.h
// DevelopWriterDemo
//
// Created by jiangxincai on 16/1/14.
// Copyright © 2016年 pepsikirk. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class PKShortVideoRecorder;
@protocol PKShortVideoRecorderDelegate <NSObject>
@required
- (void)recorderDidBeginRecording:(PKShortVideoRecorder *)recorder;
- (void)recorderDidEndRecording:(PKShortVideoRecorder *)recorder;
- (void)recorder:(PKShortVideoRecorder *)recorder didFinishRecordingToOutputFilePath:(nullable NSString *)outputFilePath error:(nullable NSError *)error;
@end
@class AVCaptureVideoPreviewLayer;
@interface PKShortVideoRecorder : NSObject
@property (nonatomic, weak) id<PKShortVideoRecorderDelegate> delegate;
- (instancetype)initWithOutputFilePath:(NSString *)outputFilePath outputSize:(CGSize)outputSize;
- (void)startRunning;
- (void)stopRunning;
- (void)startRecording;
- (void)stopRecording;
- (void)swapFrontAndBackCameras;
- (AVCaptureVideoPreviewLayer *)previewLayer;
@end
NS_ASSUME_NONNULL_END
|
/*
Copyright (c) 2013 GoPivotal, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#ifndef NN_INT_INCLUDED
#define NN_INT_INCLUDED
#if defined NN_HAVE_WINDOWS
/* Old versions of MSVC don't ship with stdint.h header file.
Thus, we have to define fix-sized integer type ourselves. */
#ifndef int8_t
typedef __int8 int8_t;
#endif
#ifndef uint8_t
typedef unsigned __int8 uint8_t;
#endif
#ifndef int16_t
typedef __int16 int16_t;
#endif
#ifndef uint16_t
typedef unsigned __int16 uint16_t;
#endif
#ifndef int32_t
typedef __int32 int32_t;
#endif
#ifndef uint32_t
typedef unsigned __int32 uint32_t;
#endif
#ifndef int64_t
typedef __int64 int64_t;
#endif
#ifndef uint64_t
typedef unsigned __int64 uint64_t;
#endif
#elif defined NN_HAVE_SOLARIS || defined NN_HAVE_OPENVMS
/* Solaris and OpenVMS don't have standard stdint.h header, rather the fixed
integer types are defined in inttypes.h. */
#include <inttypes.h>
#else
/* Fully POSIX-compliant platforms have fixed integer types defined
in stdint.h. */
#include <stdint.h>
#endif
#endif
|
#ifndef __HTTP_CLIENT_H__
#define __HTTP_CLIENT_H__
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "network/HttpClient.h"
class HttpClientTest : public cocos2d::Layer
{
public:
HttpClientTest();
virtual ~HttpClientTest();
void toExtensionsMainLayer(cocos2d::Object *sender);
//Menu Callbacks
void onMenuGetTestClicked(cocos2d::Object *sender);
void onMenuPostTestClicked(cocos2d::Object *sender);
void onMenuPostBinaryTestClicked(cocos2d::Object *sender);
void onMenuPutTestClicked(cocos2d::Object *sender);
void onMenuDeleteTestClicked(cocos2d::Object *sender);
//Http Response Callback
void onHttpRequestCompleted(network::HttpClient *sender, network::HttpResponse *response);
private:
cocos2d::LabelTTF* _labelStatusCode;
};
void runHttpClientTest();
#endif //__HTTPREQUESTHTTP_H
|
#ifndef _MFnStringData
#define _MFnStringData
//
//-
// ==========================================================================
// Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors. All
// rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its
// licensors, which is protected by U.S. and Canadian federal copyright law
// and by international treaties.
//
// The Data may not be disclosed or distributed to third parties or be
// copied or duplicated, in whole or in part, without the prior written
// consent of Autodesk.
//
// The copyright notices in the Software and this entire statement,
// including the above license grant, this restriction and the following
// disclaimer, must be included in all copies of the Software, in whole
// or in part, and all derivative works of the Software, unless such copies
// or derivative works are solely in the form of machine-executable object
// code generated by a source language processor.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
// AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED
// WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF
// NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
// OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO
// EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST
// REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR
// CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS
// BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.
// ==========================================================================
//+
//
// CLASS: MFnStringData
//
// *****************************************************************************
//
// CLASS DESCRIPTION (MFnStringData)
//
// MFnStringData allows the creation and manipulation of MString data objects
// for use in the dependency graph.
//
// If a user written dependency node either accepts or produces MString, then
// this class is used to extract or create the data that comes from or goes to
// other dependency graph nodes. The MDataHandle::type method will return
// kStringData when data of this type is present. To access it, the
// MDataHandle::data method is used to get an MObject for the data and this
// should then be used to initialize an instance of MFnStringData.
//
// *****************************************************************************
#if defined __cplusplus
// *****************************************************************************
// INCLUDED HEADER FILES
#include <maya/MFnData.h>
// *****************************************************************************
// DECLARATIONS
class MString;
class MStringArray;
// *****************************************************************************
// CLASS DECLARATION (MFnStringData)
/// String function set for dependency node data
/**
Create and manipulate MString dependency node data
*/
#ifdef _WIN32
#pragma warning(disable: 4522)
#endif // _WIN32
class OPENMAYA_EXPORT MFnStringData : public MFnData
{
declareMFn(MFnStringData, MFnData);
public:
///
MString string( MStatus* ReturnStatus = NULL ) const;
///
MStatus set( const MString& newString );
///
MObject create( const MString& str, MStatus* ReturnStatus = NULL );
///
MObject create( MStatus* ReturnStatus = NULL );
protected:
// No protected members
private:
// No private members
};
#ifdef _WIN32
#pragma warning(default: 4522)
#endif // _WIN32
// *****************************************************************************
#endif /* __cplusplus */
#endif /* _MFnStringData */
|
/*
Copyright 2009-2013 Urban Airship Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided withthe distribution.
THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** Required for building a location provider */
#import "UALocationCommonValues.h"
@protocol UALocationProviderProtocol <NSObject>
@required
/**
* Required location manager for any location services.
*/
@property (nonatomic, retain) CLLocationManager *locationManager;
/**
* The distance filter.
*/
@property (nonatomic, assign) CLLocationDistance distanceFilter;
/**
* The desired accuracy.
*/
@property (nonatomic, assign) CLLocationAccuracy desiredAccuracy;
/**
* Current status of the location provider.
*/
@property (nonatomic, assign) UALocationProviderStatus serviceStatus;
/**
* This is a required parameter on the CLLocationManager and is presented to the user for authentication.
*/
@property (nonatomic, copy) NSString *provider;
/**
* The UALocationProviderDelegate that will receive updates.
*/
@property (nonatomic, assign) id delegate;
/**
* The purpose associated with the CLLocationManager that is displayed to the user when
* permission for location services is required.
*/
- (NSString *)purpose;
- (void)setPurpose:(NSString *)newPurpose;
/**
* Starts updating location.
*/
- (void)startReportingLocation;
/**
* Stops providing location updates.
*/
- (void)stopReportingLocation;
@end
|
#ifndef MAIN_H
#define MAIN_H
extern const char *dns_client_socket_path, *base_dir;
extern struct mail_storage_service_ctx *storage_service;
extern struct anvil_client *anvil;
void listener_client_destroyed(void);
#endif
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
#include <sys/types.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned long long timelib_ull;
typedef signed long long timelib_sll;
# define TIMELIB_LL_CONST(n) n ## ll
typedef struct ttinfo
{
int32_t offset;
int isdst;
unsigned int abbr_idx;
unsigned int isstdcnt;
unsigned int isgmtcnt;
} ttinfo;
typedef struct tlinfo
{
int32_t trans;
int32_t offset;
} tlinfo;
typedef struct tlocinfo
{
char country_code[3];
double latitude;
double longitude;
char *comments;
} tlocinfo;
typedef struct timelib_tzinfo
{
char *name;
uint32_t ttisgmtcnt;
uint32_t ttisstdcnt;
uint32_t leapcnt;
uint32_t timecnt;
uint32_t typecnt;
uint32_t charcnt;
int32_t *trans;
unsigned char *trans_idx;
ttinfo *type;
char *timezone_abbr;
tlinfo *leap_times;
unsigned char bc;
tlocinfo location;
} timelib_tzinfo;
typedef struct timelib_special {
unsigned int type;
timelib_sll amount;
} timelib_special;
typedef struct timelib_rel_time {
timelib_sll y, m, d; /* Years, Months and Days */
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
int weekday; /* Stores the day in 'next monday' */
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
int first_last_day_of;
int invert; /* Whether the difference should be inverted */
timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
timelib_special special;
unsigned int have_weekday_relative, have_special_relative;
} timelib_rel_time;
typedef struct timelib_time_offset {
int32_t offset;
unsigned int leap_secs;
unsigned int is_dst;
char *abbr;
timelib_sll transistion_time;
} timelib_time_offset;
typedef struct timelib_time {
timelib_sll y, m, d; /* Year, Month, Day */
timelib_sll h, i, s; /* Hour, mInute, Second */
double f; /* Fraction */
int z; /* GMT offset in minutes */
char *tz_abbr; /* Timezone abbreviation (display only) */
timelib_tzinfo *tz_info; /* Timezone structure */
signed int dst; /* Flag if we were parsing a DST zone */
timelib_rel_time relative;
timelib_sll sse; /* Seconds since epoch */
unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
unsigned int zone_type; /* 1 time offset,
* 3 TimeZone identifier,
* 2 TimeZone abbreviation */
} timelib_time;
typedef struct timelib_error_message {
int position;
char character;
char *message;
} timelib_error_message;
typedef struct timelib_error_container {
int warning_count;
struct timelib_error_message *warning_messages;
int error_count;
struct timelib_error_message *error_messages;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
char *name;
int type;
float gmtoffset;
char *full_tz_name;
} timelib_tz_lookup_table;
typedef struct _timelib_tzdb_index_entry {
char *id;
unsigned int pos;
} timelib_tzdb_index_entry;
typedef struct _timelib_tzdb {
char *version;
int index_size;
const timelib_tzdb_index_entry *index;
const unsigned char *data;
} timelib_tzdb;
#define TIMELIB_ZONETYPE_OFFSET 1
#define TIMELIB_ZONETYPE_ABBR 2
#define TIMELIB_ZONETYPE_ID 3
#define SECS_PER_ERA TIMELIB_LL_CONST(12622780800)
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
/* 400*365 days + 97 leap days */
#define DAYS_PER_LYEAR_PERIOD 146097
#define YEARS_PER_LYEAR_PERIOD 400
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
#define TIMELIB_DEBUG(s) if (0) { s }
#endif
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Android\0.18.8\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Object.h>
#include <Uno.Recti.h>
namespace g{namespace Android{namespace android{namespace text{struct LayoutDLRAlignment;}}}}
namespace g{namespace Android{namespace android{namespace text{struct StaticLayout;}}}}
namespace g{namespace Android{namespace android{namespace text{struct TextPaint;}}}}
namespace g{namespace Fuse{namespace Android{struct TextControlLayout;}}}
namespace g{namespace Fuse{namespace Controls{struct TextControl;}}}
namespace g{
namespace Fuse{
namespace Android{
// internal sealed extern class TextControlLayout :799
// {
uType* TextControlLayout_typeof();
void TextControlLayout__ctor__fn(TextControlLayout* __this);
void TextControlLayout__Dispose_fn(TextControlLayout* __this);
void TextControlLayout__get_Layout_fn(TextControlLayout* __this, ::g::Android::android::text::StaticLayout** __retval);
void TextControlLayout__set_Layout_fn(TextControlLayout* __this, ::g::Android::android::text::StaticLayout* value);
void TextControlLayout__Measure_fn(TextControlLayout* __this, ::g::Fuse::Controls::TextControl* Control, float* wrapWidth);
void TextControlLayout__New1_fn(TextControlLayout** __retval);
void TextControlLayout__get_Paint_fn(TextControlLayout* __this, ::g::Android::android::text::TextPaint** __retval);
void TextControlLayout__set_Paint_fn(TextControlLayout* __this, ::g::Android::android::text::TextPaint* value);
void TextControlLayout__get_PixelBounds_fn(TextControlLayout* __this, ::g::Uno::Recti* __retval);
void TextControlLayout__set_PixelBounds_fn(TextControlLayout* __this, ::g::Uno::Recti* value);
void TextControlLayout__TextAlignmentToAndroidLayoutAlignment_fn(TextControlLayout* __this, int* textAlignment, ::g::Android::android::text::LayoutDLRAlignment** __retval);
struct TextControlLayout : uObject
{
uStrong< ::g::Android::android::text::StaticLayout*> _Layout;
uStrong< ::g::Android::android::text::TextPaint*> _Paint;
::g::Uno::Recti _PixelBounds;
void ctor_();
void Dispose();
::g::Android::android::text::StaticLayout* Layout();
void Layout(::g::Android::android::text::StaticLayout* value);
void Measure(::g::Fuse::Controls::TextControl* Control, float wrapWidth);
::g::Android::android::text::TextPaint* Paint();
void Paint(::g::Android::android::text::TextPaint* value);
::g::Uno::Recti PixelBounds();
void PixelBounds(::g::Uno::Recti value);
::g::Android::android::text::LayoutDLRAlignment* TextAlignmentToAndroidLayoutAlignment(int textAlignment);
static TextControlLayout* New1();
};
// }
}}} // ::g::Fuse::Android
|
//
// IMUIMacros.h
// JLWeChat
//
// Created by jimneylee on 14-5-19.
// Copyright (c) 2014年 jimneylee. All rights reserved.
//
#ifndef JLWeChat_IMUIMacros_h
#define JLWeChat_IMUIMacros_h
// APP 主色调
#define APP_MAIN_COLOR RGBCOLOR(33.f, 40.f, 42.f)
// 搜索框激活时背景色
#define SEARCH_ACTIVE_BG_COLOR RGBCOLOR(201, 201, 206)
#define TABLEVIEW_GROUP_BG_COLOR RGBCOLOR(240, 239, 246)
// Cell布局
#define CELL_PADDING_10 10
#define CELL_PADDING_8 8
#define CELL_PADDING_6 6
#define CELL_PADDING_4 4
#define CELL_PADDING_2 2
// Screen Size
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
// Line Color
#define LINE_COLOR RGBCOLOR(240, 240, 240)
// 消息页面Cell固定高度
#define MESSAGE_MAIN_ROW_HEIGHT 68.f
// 通讯录页面Cell固定高度
#define ADDRESS_BOOK_ROW_HEIGHT 55.f
// group头部高度
#define GROUP_SECTION_HEADER_HEIGHT 20.f
#endif
|
//
// GADMediatedNativeAdNotificationSource.h
// Google Mobile Ads SDK
//
// Copyright 2015 Google Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <GoogleMobileAds/GoogleMobileAdsDefines.h>
#import <GoogleMobileAds/Mediation/GADMediatedNativeAd.h>
GAD_ASSUME_NONNULL_BEGIN
/// Used by mediation adapters to notify the Google Mobile Ads SDK about events occurring in the
/// lifecycle of a GADMediatedNativeAd.
@interface GADMediatedNativeAdNotificationSource : NSObject
/// Called by the adapter when it has registered an impression on the tracked view. Adapter should
/// only call this method if -[GADMAdNetworkAdapter handlesUserImpressions] returns YES.
+ (void)mediatedNativeAdDidRecordImpression:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Called by the adapter when it has registered a user click on the tracked view. Adapter should
/// only call this method if -[GADMAdNetworkAdapter handlesUserClicks] returns YES.
+ (void)mediatedNativeAdDidRecordClick:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Must be called by the adapter just before mediatedNativeAd has opened an in-app modal screen.
+ (void)mediatedNativeAdWillPresentScreen:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Must be called by the adapter just before the in app modal screen opened by mediatedNativeAd is
/// dismissed.
+ (void)mediatedNativeAdWillDismissScreen:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Must be called by the adapter after the in app modal screen opened by mediatedNativeAd is
/// dismissed.
+ (void)mediatedNativeAdDidDismissScreen:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Must be called by the adapter just before mediatedNativeAd causes another app (such as a browser
/// or the App Store) to take input focus.
+ (void)mediatedNativeAdWillLeaveApplication:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Called by the adapter when native video playback has begun or resumed.
+ (void)mediatedNativeAdDidPlayVideo:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Called by the adapter when native video playback has paused.
+ (void)mediatedNativeAdDidPauseVideo:(id<GADMediatedNativeAd>)mediatedNativeAd;
/// Called by the adapter when native video playback has ended.
+ (void)mediatedNativeAdDidEndVideoPlayback:(id<GADMediatedNativeAd>)mediatedNativeAd;
@end
GAD_ASSUME_NONNULL_END
|
/*
* 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.
*/
/*
* Description:
* What is this file about?
*
* Revision history:
* xxxx-xx-xx, author, first version
* xxxx-xx-xx, author, fix bug about xxx
*/
# pragma once
# include <dsn/dist/cluster_scheduler.h>
# include <unordered_map>
using namespace ::dsn::service;
namespace dsn
{
namespace dist
{
DEFINE_TASK_CODE(LPC_K8S_CREATE,TASK_PRIORITY_COMMON, THREAD_POOL_SCHEDULER_LONG)
DEFINE_TASK_CODE(LPC_K8S_DELETE,TASK_PRIORITY_COMMON, THREAD_POOL_SCHEDULER_LONG)
class kubernetes_cluster_scheduler
: public cluster_scheduler, public clientlet
{
public:
kubernetes_cluster_scheduler();
virtual error_code initialize() override;
virtual void schedule(
std::shared_ptr<deployment_unit>& unit
) override;
void unschedule(
std::shared_ptr<deployment_unit>& unit
)override;
virtual cluster_type::type type() const override
{
return cluster_type::cstype_kubernetes;
}
static void deploy_k8s_unit(void* context, int argc, const char** argv, dsn_cli_reply* reply);
static void deploy_k8s_unit_cleanup(dsn_cli_reply reply);
static void undeploy_k8s_unit(void* context, int argc, const char** argv, dsn_cli_reply* reply);
static void undeploy_k8s_unit_cleanup(dsn_cli_reply reply);
private:
void create_pod(std::string& name,std::function<void(error_code, rpc_address)>& deployment_callback, std::string& local_package_directory);
void delete_pod(std::string& name,std::function<void(error_code, const std::string&)>& undeployment_callback, std::string& local_package_directory);
using deploy_map = std::unordered_map<std::string, std::shared_ptr<deployment_unit> >;
std::string _run_path;
dsn_handle_t _k8s_state_handle;
dsn_handle_t _k8s_deploy_handle;
dsn_handle_t _k8s_undeploy_handle;
deploy_map _deploy_map;
zlock _lock;
};
}
}
|
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
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 __EAGLVIEW_MAC_H__
#define __EAGLVIEW_MAC_H__
#include <Cocoa/Cocoa.h>
#include "ccConfig.h"
//PROTOCOLS:
@protocol MacEventDelegate <NSObject>
// Mouse
- (void)mouseDown:(NSEvent *)theEvent;
- (void)mouseUp:(NSEvent *)theEvent;
- (void)mouseMoved:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
- (void)rightMouseDown:(NSEvent*)event;
- (void)rightMouseDragged:(NSEvent*)event;
- (void)rightMouseUp:(NSEvent*)event;
- (void)otherMouseDown:(NSEvent*)event;
- (void)otherMouseDragged:(NSEvent*)event;
- (void)otherMouseUp:(NSEvent*)event;
- (void)scrollWheel:(NSEvent *)theEvent;
- (void)mouseEntered:(NSEvent *)theEvent;
- (void)mouseExited:(NSEvent *)theEvent;
// Keyboard
- (void)keyDown:(NSEvent *)theEvent;
- (void)keyUp:(NSEvent *)theEvent;
- (void)flagsChanged:(NSEvent *)theEvent;
// Touches
- (void)touchesBeganWithEvent:(NSEvent *)event;
- (void)touchesMovedWithEvent:(NSEvent *)event;
- (void)touchesEndedWithEvent:(NSEvent *)event;
- (void)touchesCancelledWithEvent:(NSEvent *)event;
#if CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD
- (void)queueEvent:(NSEvent*)event selector:(SEL)selector;
#endif
@end
/** MacGLView
Only available for Mac OS X
*/
@interface EAGLView : NSOpenGLView {
id<MacEventDelegate> eventDelegate_;
BOOL isFullScreen_;
NSWindow *fullScreenWindow_;
// cache
NSWindow *windowGLView_;
NSView *superViewGLView_;
NSRect originalWinRect_; // Original size and position
float frameZoomFactor_;
}
@property (nonatomic, readwrite, assign) id<MacEventDelegate> eventDelegate;
// whether or not the view is in fullscreen mode
@property (nonatomic, readonly) BOOL isFullScreen;
@property (nonatomic, readwrite) float frameZoomFactor;
// initializes the MacGLView with a frame rect and an OpenGL context
- (id) initWithFrame:(NSRect)frameRect shareContext:(NSOpenGLContext*)context;
/** uses and locks the OpenGL context */
-(void) lockOpenGLContext;
/** unlocks the openGL context */
-(void) unlockOpenGLContext;
/** returns the depth format of the view in BPP */
- (NSUInteger) depthFormat;
- (void) setFrameZoomFactor:(float)frameZoomFactor;
// get the view object
+(id) sharedEGLView;
-(int) getWidth;
-(int) getHeight;
-(void) swapBuffers;
-(void) setFullScreen:(BOOL)fullscreen;
@end
#endif // __EAGLVIEW_MAC_H__
|
//
// Dweet_ios.h
// Dweet-ios
//
// Created by Tim Buick on 2015-06-10.
// Copyright (c) 2015 PBJ Studios. All rights reserved.
//
#import <Foundation/Foundation.h>
#define DDBG(x,...) if (debugLevel!=0 && x<=debugLevel) NSLog(__VA_ARGS__)
// debug levels
enum {
NO_DEBUG=0,
SHOW_ERRORS=1,
SHOW_ALL=2,
};
// return codes
enum {
DWEET_STILL_PENDING=1,
DWEET_SUCCESS=0,
NO_NETWORK=-1,
COULD_NOT_CONNECT_TO_DWEETIO=-2,
DWEET_DID_NOT_RETURN_VALID_JSON=-3,
DWEET_JSON_FORMAT_UNEXPECTED=-4,
DWEET_RESPONSE_IS_FAILED=-5,
COULD_NOT_CONNECT_TO_LOCKED_THING=-6,
COULD_NOT_GENERATE_JSON_FROM_DATA=-7,
CONNECTION_ERROR=-8,
NOT_CONNECTED_TO_THING=-1000,
};
@interface Dweet_ios : NSObject <NSURLConnectionDelegate> {
NSString *thingName;
NSMutableDictionary *thingProcesses;
NSMutableDictionary *thingProcessData;
NSMutableDictionary *thingCallbacks;
NSMutableDictionary *thingCallbackTargets;
}
// global shared instance for Dweet_ios object
+ (Dweet_ios *)sharedInstance;
// set the NSLog debug level using enum from above
+ (void) setDebugLevel:(NSInteger)level;
+(void)sendDweet:(NSDictionary*)data toThing:(NSString*)thing lockedWithKey:(NSString*)key withCallback:(SEL)callback onTarget:(id)target overwriteData:(BOOL)overwrite;
// currently connected thing
@property (nonatomic, retain) NSString *thingName;
@property (nonatomic, retain) NSMutableDictionary *thingProcesses;
@property (nonatomic, retain) NSMutableDictionary *thingProcessData;
@property (nonatomic, retain) NSMutableDictionary *thingCallbacks;
@property (nonatomic, retain) NSMutableDictionary *thingCallbackTargets;
@end
|
#ifndef POP_FADE_H
#define POP_FADE_H
void pop_fade() {
unsigned long thiscolour;
if (ranamount >NUM_LEDS) ranamount = NUM_LEDS; // Make sure we're at least utilizing ALL the LED's.
int idex = random16(0, ranamount);
if (idex < NUM_LEDS) { // Only the lowest probability twinkles will do.
boolcolours ? thiscolour = random(0, 0xffffff) : thiscolour = colours[random16(0, numcolours)];
int barlen = random16(1,maxbar);
for (int i = 0; i <barlen; i++)
if (idex+i < NUM_LEDS) leds[idex+i] = thiscolour; // Make sure we don't overshoot the array.
}
nscale8(leds,NUM_LEDS,fadeval); // Fade the entire array. Or for just a few LED's, use nscale8(&leds[2], 5, fadeval);
}
#endif
|
//
// Copyright 2011-2014 Orbotix Inc. All rights reserved.
//
/*! @file */
#import <Foundation/Foundation.h>
#import "RKDeviceCommand.h"
/*!
* @brief Class to encapsulate a set heading command and it's parameters.
*
* Class that encapsulates a calibrate command used to set the 0° heading.
* Thus, if you send a Set Heading command with parameter 0, then whichever way Sphero
* is facing is now 0 degrees.
*
* Also, calling this command with Stabilizatoin off, also adjusts Sphero's idea of roll,
* pitch, and yaw. The orientation will now be 0,0,0 when the this command is called.
*
* @sa RKSetHeadingResponse
* @sa RKBackLEDOutputCommand
* @sa RKRollCommand
*/
@interface RKSetHeadingCommand : RKDeviceCommand
/*!
* The angle that will be added to the current heading when setting
* the new 0° point. The value is in degrees.
*/
@property ( nonatomic, readonly ) float heading;
/*!
* Initializer for a RKSetHeadingCommand object.
* @param heading Typically this should be 0.0, but setting it will add to the current heading
* when setting the new 0° point. The value is in degrees.
* @return The initialized object.
*/
- (instancetype) initWithHeading:(float) heading;
+ (instancetype) commandWithHeading:(float) heading;
+ (instancetype) command;
@end
|
/*
* Copyright (C) 2006-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
namespace WebCore {
enum class EditorInsertAction {
Typed,
Pasted,
Dropped,
};
} // namespace WebCore
|
/*
* CGGeometry.h
* Foundation
*
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
CGGeometry is not a part of Foundation. The reason _CGGeometry.h exists, and is in Foundation, is that CPGeometry and CGGeometry both use the same code so the shared basis needs to be in the lowest layer. If for some reason Cappuccino was ever reimplemented such that CPRect !== CGRect etc, this class could be removed and CPGeometry.j and CGGeometry.j updated with relevant functions without breaking any client code.
*/
#define _CGPointMake(x_, y_) { x:x_, y:y_ }
#define _CGPointMakeCopy(aPoint) _CGPointMake(aPoint.x, aPoint.y)
#define _CGPointMakeZero() _CGPointMake(0.0, 0.0)
#define _CGPointEqualToPoint(lhsPoint, rhsPoint) (lhsPoint.x == rhsPoint.x && lhsPoint.y == rhsPoint.y)
#define _CGStringFromPoint(aPoint) ("{" + aPoint.x + ", " + aPoint.y + "}")
#define _CGSizeMake(width_, height_) { width:width_, height:height_ }
#define _CGSizeMakeCopy(aSize) _CGSizeMake(aSize.width, aSize.height)
#define _CGSizeMakeZero() _CGSizeMake(0.0, 0.0)
#define _CGSizeEqualToSize(lhsSize, rhsSize) (lhsSize.width == rhsSize.width && lhsSize.height == rhsSize.height)
#define _CGStringFromSize(aSize) ("{" + aSize.width + ", " + aSize.height + "}")
#define _CGRectMake(x, y, width, height) { origin: _CGPointMake(x, y), size: _CGSizeMake(width, height) }
#define _CGRectMakeZero() _CGRectMake(0.0, 0.0, 0.0, 0.0)
#define _CGRectMakeCopy(aRect) _CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height)
#define _CGRectCreateCopy(aRect) _CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height)
#define _CGRectEqualToRect(lhsRect, rhsRect) (_CGPointEqualToPoint(lhsRect.origin, rhsRect.origin) && _CGSizeEqualToSize(lhsRect.size, rhsRect.size))
#define _CGStringFromRect(aRect) ("{" + _CGStringFromPoint(aRect.origin) + ", " + _CGStringFromSize(aRect.size) + "}")
#define _CGRectOffset(aRect, dX, dY) _CGRectMake(aRect.origin.x + dX, aRect.origin.y + dY, aRect.size.width, aRect.size.height)
#define _CGRectInset(aRect, dX, dY) _CGRectMake(aRect.origin.x + dX, aRect.origin.y + dY, aRect.size.width - 2 * dX, aRect.size.height - 2 * dY)
/*!
Slow:
var theInsetRect = _CGRectInsetByInset([self bounds], [self contentInset]);
Fast:
var aRect = [self bounds],
anInset = [self contentInset],
theInsetRect = _CGRectInsetByInset(aRect, anInset);
*/
#define _CGRectInsetByInset(aRect, anInset) _CGRectMake((aRect).origin.x + (anInset).left, (aRect).origin.y + (anInset).top, (aRect).size.width - (anInset).left - (anInset).right, (aRect).size.height - (anInset).top - (anInset).bottom)
#define _CGRectGetHeight(aRect) (aRect.size.height)
#define _CGRectGetMaxX(aRect) (aRect.origin.x + aRect.size.width)
#define _CGRectGetMaxY(aRect) (aRect.origin.y + aRect.size.height)
#define _CGRectGetMidX(aRect) (aRect.origin.x + (aRect.size.width) / 2.0)
#define _CGRectGetMidY(aRect) (aRect.origin.y + (aRect.size.height) / 2.0)
#define _CGRectGetMinX(aRect) (aRect.origin.x)
#define _CGRectGetMinY(aRect) (aRect.origin.y)
#define _CGRectGetWidth(aRect) (aRect.size.width)
#define _CGRectIsEmpty(aRect) (aRect.size.width <= 0.0 || aRect.size.height <= 0.0)
#define _CGRectIsNull(aRect) (aRect.size.width <= 0.0 || aRect.size.height <= 0.0)
#define _CGRectContainsPoint(aRect, aPoint) (aPoint.x >= _CGRectGetMinX(aRect) && aPoint.y >= _CGRectGetMinY(aRect) && aPoint.x < _CGRectGetMaxX(aRect) && aPoint.y < _CGRectGetMaxY(aRect))
#define _CGInsetMake(_top, _right, _bottom, _left) { top:(_top), right:(_right), bottom:(_bottom), left:(_left) }
#define _CGInsetMakeCopy(anInset) _CGInsetMake(anInset.top, anInset.right, anInset.bottom, anInset.left)
#define _CGInsetMakeInvertedCopy(anInset) _CGInsetMake(-anInset.top, -anInset.right, -anInset.bottom, -anInset.left)
#define _CGInsetMakeZero() _CGInsetMake(0, 0, 0, 0)
#define _CGInsetIsEmpty(anInset) ((anInset).top === 0 && (anInset).right === 0 && (anInset).bottom === 0 && (anInset).left === 0)
#define _CGInsetEqualToInset(lhsInset, rhsInset) ((lhsInset).top === (rhsInset).top && (lhsInset).right === (rhsInset).right && (lhsInset).bottom === (rhsInset).bottom && (lhsInset).left === (rhsInset).left)
// DEPRECATED
#define _CGPointCreateCopy(aPoint) _CGPointMake(aPoint.x, aPoint.y)
#define _CGSizeCreateCopy(aSize) _CGSizeMake(aSize.width, aSize.height)
|
#ifndef REGTEST
#include <windows.h>
#include <threads.h>
#include <stdlib.h>
extern struct _PDCLIB_tss * _PDCLIB_tss_first;
void tss_delete( tss_t key )
{
struct _PDCLIB_tss * prev = NULL;
struct _PDCLIB_tss * cur = _PDCLIB_tss_first;
while(cur) {
if(cur == key) {
if(prev) {
prev->_Next = key->_Next;
} else {
_PDCLIB_tss_first = key->_Next;
}
TlsFree(key->_Key);
free(key);
return;
}
}
// Not actually a TSS key
abort();
}
#endif
#ifdef TEST
#include <_PDCLIB_test.h>
/* Tested in tss_get.c */
int main( void )
{
return TEST_RESULTS;
}
#endif
|
/*
* Copyright (C) 2006 Cooper Street Innovations Inc.
* Charles Eidsness <charles@cooper-street.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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#ifndef DEVICE_H
#define DEVICE_H
#include <data.h>
#include "matrix.h"
#include "control.h"
typedef struct _device device_;
int deviceResistorConfig(device_ *r, double *resistance);
int deviceInductorConfig(device_ *r, double *inductance);
int deviceCapacitorConfig(device_ *r, double *capacitance);
int deviceTLineConfig(device_ *r, double *Z0, double *Td, double *loss);
int deviceTLineWConfig(device_ *r, int *M, double *len,
double **L0, double **C0, double **R0, double **G0, double **Rs,
double **Gd, double *fgd, double *fK);
int deviceCurrentSourceConfig(device_ *r, double *dc, char type,
double *args[7]);
int deviceVoltageSourceConfig(device_ *r, double *dc, char type,
double *args[7]);
int deviceNonlinearVoltageConfig(device_ *r, char *equation);
int deviceNonlinearCurrentConfig(device_ *r, char *equation);
int deviceNonlinearCapacitorConfig(device_ *r, char *equation);
int deviceVICurveConfig(device_ *r, double **vi, int *viLength, char viType,
double **ta, int *taLength, char taType);
typedef int (*deviceCallback_)(double *xN, void *private);
int deviceCallbackVoltageConfig(device_ *r, char *vars[], double values[],
double derivs[], int numVars, deviceCallback_ callback, void *private);
int deviceCallbackCurrentConfig(device_ *r, char *vars[], double values[],
double derivs[], int numVars, deviceCallback_ callback, void *private);
/* Operating Point */
int deviceLoad(device_ *r, void *data);
int deviceLinearize(device_ *r, int *linear);
/* Transient Analysis */
int deviceInitStep(device_ *r, void *data);
int deviceStep(device_ *r, int *breakPoint);
int deviceMinStep(device_ *r, double *minStep);
int deviceNextStep(device_ *r, double *nextStep);
int deviceIntegrate(device_ *r, void *data);
listAddReturn_ deviceCheckDuplicate(device_ *old, device_ *new);
int devicePrint(device_ *r, void *data);
int deviceDestroy(device_ *r);
device_ * deviceNew2Pins(matrix_ *matrix, control_ *control, char *refdes,
char *pNode, char *nNode);
device_ * deviceNew3Pins(matrix_ *matrix, control_ *control, char *refdes,
char *pNode, char *nNode, char *cNode);
device_ * deviceNew4Pins(matrix_ *matrix, control_ *control, char *refdes,
char *pNodeLeft, char *nNodeLeft, char *pNodeRight, char *nNodeRight);
device_ * deviceNewNPins(matrix_ *matrix, control_ *control, char *refdes,
char *nodes[], int nNodes);
#endif
|
/*
* ProFTPD - mod_auth_otp
* Copyright (c) 2015 TJ Saunders
*
* 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, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, TJ Saunders and other respective copyright holders
* give permission to link this program with OpenSSL, and distribute the
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*/
#ifndef MOD_AUTH_OTP_OTP_H
#define MOD_AUTH_OTP_OTP_H
#include "mod_auth_otp.h"
/* Following the recommendation of RFC 6238, Section 5.2 */
#define AUTH_OTP_TOTP_TIMESTEP_SECS 30
/* Generate an OTP using the algorithm specified in RFC 4226 (HOTP). */
int auth_otp_hotp(pool *p, const unsigned char *key, size_t key_len,
unsigned long counter, unsigned int *code);
/* Generate an OTP using the algorithm specified in RFC 6238 (TOTP).
*
* Note that RFC 6238 defines support using SHA1, SHA256, or SHA512;
* the algo argument here indicates which one to use.
*/
int auth_otp_totp(pool *p, const unsigned char *key, size_t key_len,
unsigned long ts, unsigned int algo, unsigned int *code);
#endif /* MOD_AUTH_OTP_OTP_H */
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/mmio.h>
#include <console/console.h>
#include <delay.h>
#include <soc/clock.h>
#include <soc/iomap.h>
#include <soc/usb.h>
#define CRPORT_TX_OVRD_DRV_LO 0x1002
#define CRPORT_RX_OVRD_IN_HI 0x1006
#define CRPORT_TX_ALT_BLOCK 0x102d
static u32 *const tcsr_usb_sel = (void *)0x1a4000b0;
struct usb_qc_phy {
u32 ipcat;
u32 ctrl;
u32 general_cfg;
u32 ram1;
u32 hs_phy_ctrl;
u32 param_ovrd;
u32 chrg_det_ctrl;
u32 chrg_det_output;
u32 alt_irq_en;
u32 hs_phy_irq_stat;
u32 cgctl;
u32 dbg_bus;
u32 ss_phy_ctrl;
u32 ss_phy_param1;
u32 ss_phy_param2;
u32 crport_data_in;
u32 crport_data_out;
u32 crport_cap_addr;
u32 crport_cap_data;
u32 crport_ack_read;
u32 crport_ack_write;
};
check_member(usb_qc_phy, crport_ack_write, 0x50);
static struct usb_qc_phy * const usb_host1_phy = (void *)USB_HOST1_PHY_BASE;
static struct usb_qc_phy * const usb_host2_phy = (void *)USB_HOST2_PHY_BASE;
struct usb_dwc3 {
u32 sbuscfg0;
u32 sbuscfg1;
u32 txthrcfg;
u32 rxthrcfg;
u32 ctl;
u32 evten;
u32 sts;
u8 reserved0[4];
u32 snpsid;
u32 gpio;
u32 uid;
u32 uctl;
u64 buserraddr;
u64 prtbimap;
u8 reserved1[32];
u32 dbgfifospace;
u32 dbgltssm;
u32 dbglnmcc;
u32 dbgbmu;
u32 dbglspmux;
u32 dbglsp;
u32 dbgepinfo0;
u32 dbgepinfo1;
u64 prtbimap_hs;
u64 prtbimap_fs;
u8 reserved2[112];
u32 usb2phycfg;
u8 reserved3[60];
u32 usb2i2cctl;
u8 reserved4[60];
u32 usb2phyacc;
u8 reserved5[60];
u32 usb3pipectl;
u8 reserved6[60];
};
check_member(usb_dwc3, usb3pipectl, 0x1c0);
static struct usb_dwc3 * const usb_host1_dwc3 = (void *)USB_HOST1_DWC3_BASE;
static struct usb_dwc3 * const usb_host2_dwc3 = (void *)USB_HOST2_DWC3_BASE;
static void setup_dwc3(struct usb_dwc3 *dwc3)
{
write32(&dwc3->usb3pipectl,
0x1 << 31 | /* assert PHY soft reset */
0x1 << 25 | /* (default) U1/U2 exit fail -> recovery? */
0x1 << 24 | /* (default) activate PHY low power states */
0x1 << 19 | /* (default) PHY low power delay value */
0x1 << 18 | /* (default) activate PHY low power delay */
0x1 << 1 | /* (default) Tx deemphasis value */
0x1 << 0); /* (default) elastic buffer mode */
write32(&dwc3->usb2phycfg,
0x1 << 31 | /* assert PHY soft reset */
0x9 << 10 | /* (default) PHY clock turnaround 8-bit UTMI+ */
0x1 << 8 | /* (default) enable PHY sleep in L1 */
0x1 << 6); /* (default) enable PHY suspend */
write32(&dwc3->ctl,
0x2 << 19 | /* (default) suspend clock scaling */
0x1 << 16 | /* retry SS three times before HS downgrade */
0x1 << 12 | /* port capability HOST */
0x1 << 11 | /* assert core soft reset */
0x1 << 10 | /* (default) sync ITP to refclk */
0x1 << 2); /* U2 exit after 8us LFPS (instead of 248ns) */
write32(&dwc3->uctl,
0x32 << 22 | /* (default) reference clock period in ns */
0x1 << 15 | /* (default) XHCI compliant device addressing */
0x10 << 0); /* (default) devices time out after 32us */
udelay(5);
clrbits32(&dwc3->ctl, 0x1 << 11); /* deassert core soft reset */
clrbits32(&dwc3->usb2phycfg, 0x1 << 31); /* PHY soft reset */
clrbits32(&dwc3->usb3pipectl, 0x1 << 31); /* PHY soft reset */
}
static void setup_phy(struct usb_qc_phy *phy)
{
write32(&phy->ss_phy_ctrl,
0x1 << 24 | /* Indicate VBUS power present */
0x1 << 8 | /* Enable USB3 ref clock to prescaler */
0x1 << 7 | /* assert SS PHY reset */
0x19 << 0); /* (default) reference clock multiplier */
write32(&phy->hs_phy_ctrl,
0x1 << 26 | /* (default) unclamp DPSE/DMSE VLS */
0x1 << 25 | /* (default) select freeclk for utmi_clk */
0x1 << 24 | /* (default) unclamp DMSE VLS */
0x1 << 21 | /* (default) enable UTMI clock */
0x1 << 20 | /* set OTG VBUS as valid */
0x1 << 18 | /* use ref clock from core */
0x1 << 17 | /* (default) unclamp DPSE VLS */
0x1 << 11 | /* force xo/bias/pll to stay on in suspend */
0x1 << 9 | /* (default) unclamp IDHV */
0x1 << 8 | /* (default) unclamp VLS (again???) */
0x1 << 7 | /* (default) unclamp HV VLS */
0x7 << 4 | /* select frequency (no idea which one) */
0x1 << 1); /* (default) "retention enable" */
write32(&phy->ss_phy_param1,
0x6e << 20 | /* full TX swing amplitude */
0x20 << 14 | /* (default) 6dB TX deemphasis */
0x17 << 8 | /* 3.5dB TX deemphasis */
0x9 << 3); /* (default) LoS detector level */
write32(&phy->general_cfg, 0x1 << 2); /* set XHCI 1.00 compliance */
udelay(5);
clrbits32(&phy->ss_phy_ctrl, 0x1 << 7); /* deassert SS PHY reset */
}
static void crport_handshake(void *capture_reg, void *acknowledge_bit, u32 data)
{
int usec = 100;
if (capture_reg)
write32(capture_reg, data);
write32(acknowledge_bit, 0x1 << 0);
while (read32(acknowledge_bit) && --usec)
udelay(1);
if (!usec)
printk(BIOS_ERR, "CRPORT handshake timed out (0x%08x)\n", data);
}
static void crport_write(struct usb_qc_phy *phy, u16 addr, u16 data)
{
crport_handshake(&phy->crport_data_in, &phy->crport_cap_addr, addr);
crport_handshake(&phy->crport_data_in, &phy->crport_cap_data, data);
crport_handshake(NULL, &phy->crport_ack_write, 0);
}
static void tune_phy(struct usb_qc_phy *phy)
{
crport_write(phy, CRPORT_RX_OVRD_IN_HI,
0x1 << 11 | /* Set RX_EQ override? */
0x4 << 8 | /* Set RX_EQ to 4? */
0x1 << 7); /* Enable RX_EQ override */
crport_write(phy, CRPORT_TX_OVRD_DRV_LO,
0x1 << 14 | /* Enable amplitude (override?) */
0x17 << 7 | /* Set TX deemphasis to 23 */
0x6e << 0); /* Set amplitude to 110 */
crport_write(phy, CRPORT_TX_ALT_BLOCK,
0x1 << 7); /* ALT block? ("partial RX reset") */
}
void setup_usb_host1(void)
{
printk(BIOS_INFO, "Setting up USB HOST1 controller...\n");
setbits32(tcsr_usb_sel, 1 << 0); /* Select DWC3 controller */
setup_phy(usb_host1_phy);
setup_dwc3(usb_host1_dwc3);
tune_phy(usb_host1_phy);
}
void setup_usb_host2(void)
{
printk(BIOS_INFO, "Setting up USB HOST2 controller...\n");
setbits32(tcsr_usb_sel, 1 << 1); /* Select DWC3 controller */
setup_phy(usb_host2_phy);
setup_dwc3(usb_host2_dwc3);
tune_phy(usb_host2_phy);
}
|
/*************************************************************************************************/
/* AIT ISP Host API */
/* All rights reserved by Alpah Image Technology Corp */
/*-----------------------------------------------------------------------------------------------*/
/* File name: AIT_ISP_spi_ctl.c */
/* Description: ISP Host API SPI routines abstraction layer */
/* */
/* Version 0.01 20141209 */
/*************************************************************************************************/
#include "AIT_ISP_spi_ctl.h"
/*************************************************************************************************/
/* SPI Implementation */
/*************************************************************************************************/
extern void SetVenusRegB(uint16 Addr, uint8 Val);
extern void SetVenusRegW(uint16 Addr, uint16 Val);
extern void SetVenusMultiBytes(uint8* dataPtr, uint16 startAddr, uint16 length);
extern uint8 GetVenusRegB(uint16 Addr);
extern uint16 GetVenusRegW(uint16 Addr);
extern void GetVenusMultiBytes(uint8* dataPtr, uint16 startAddr, uint16 length);
void transmit_byte_via_SPI(uint16 addr, uint8 data)
{
/* The code is platform dependent. It should be implemented by platform porting. */
SetVenusRegB(addr, data);
}
void transmit_word_via_SPI(uint16 addr, uint16 data)
{
/* The code is platform dependent. It should be implemented by platform porting. */
SetVenusRegW(addr, data);
}
void transmit_multibytes_via_SPI(uint8* ptr, uint16 addr, uint16 length)
{
/* The code is platform dependent. It should be implemented by platform porting. */
SetVenusMultiBytes(ptr, addr, length);
}
uint8 receive_byte_via_SPI(uint16 addr)
{
// uint8 receive_byte_value = 0;
/* The code is platform dependent. It should be implemented by platform porting. */
/* return GetVenusRegB(addr); or receive_byte_value = GetVenusRegB(addr); */
// return receive_byte_value;
return GetVenusRegB(addr);
}
uint16 receive_word_via_SPI(uint16 addr)
{
// uint16 receive_word_value = 0;
/* The code is platform dependent. It should be implemented by platform porting. */
/* return GetVenusRegW(addr); or receive_word_value = GetVenusRegW(addr); */
// return receive_word_value;
return GetVenusRegW(addr);
}
void receive_multibytes_via_SPI(uint8* ptr, uint16 addr, uint16 length)
{
/* The code is platform dependent. It should be implemented by platform porting. */
GetVenusMultiBytes(ptr, addr, length);
}
|
/* r3964 linediscipline for linux
*
* -----------------------------------------------------------
* Copyright by
* Philips Automation Projects
* Kassel (Germany)
* http://www.pap-philips.de
* -----------------------------------------------------------
* This software may be used and distributed according to the terms of
* the GNU General Public License, incorporated herein by reference.
*
* Author:
* L. Haag
*
* $Log: n_r3964.h,v $
* Revision 1.1 2011/07/05 17:15:49 ian
* First commit of linux kernel 2.6.29 for the ts4700
*
* Revision 1.4 2005/12/21 19:54:24 Kurt Huwig <kurt huwig de>
* Fixed HZ usage on 2.6 kernels
* Removed unnecessary include
*
* Revision 1.3 2001/03/18 13:02:24 dwmw2
* Fix timer usage, use spinlocks properly.
*
* Revision 1.2 2001/03/18 12:53:15 dwmw2
* Merge changes in 2.4.2
*
* Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2
* This'll screw the version control
*
* Revision 1.6 1998/09/30 00:40:38 dwmw2
* Updated to use kernel's N_R3964 if available
*
* Revision 1.4 1998/04/02 20:29:44 lhaag
* select, blocking, ...
*
* Revision 1.3 1998/02/12 18:58:43 root
* fixed some memory leaks
* calculation of checksum characters
*
* Revision 1.2 1998/02/07 13:03:17 root
* ioctl read_telegram
*
* Revision 1.1 1998/02/06 19:19:43 root
* Initial revision
*
*
*/
#ifndef __LINUX_N_R3964_H__
#define __LINUX_N_R3964_H__
/* line disciplines for r3964 protocol */
#ifdef __KERNEL__
#include <linux/param.h>
/*
* Common ascii handshake characters:
*/
#define STX 0x02
#define ETX 0x03
#define DLE 0x10
#define NAK 0x15
/*
* Timeouts (from milliseconds to jiffies)
*/
#define R3964_TO_QVZ ((550)*HZ/1000)
#define R3964_TO_ZVZ ((220)*HZ/1000)
#define R3964_TO_NO_BUF ((400)*HZ/1000)
#define R3964_NO_TX_ROOM ((100)*HZ/1000)
#define R3964_TO_RX_PANIC ((4000)*HZ/1000)
#define R3964_MAX_RETRIES 5
#endif
/*
* Ioctl-commands
*/
#define R3964_ENABLE_SIGNALS 0x5301
#define R3964_SETPRIORITY 0x5302
#define R3964_USE_BCC 0x5303
#define R3964_READ_TELEGRAM 0x5304
/* Options for R3964_SETPRIORITY */
#define R3964_MASTER 0
#define R3964_SLAVE 1
/* Options for R3964_ENABLE_SIGNALS */
#define R3964_SIG_ACK 0x0001
#define R3964_SIG_DATA 0x0002
#define R3964_SIG_ALL 0x000f
#define R3964_SIG_NONE 0x0000
#define R3964_USE_SIGIO 0x1000
/*
* r3964 operation states:
*/
#ifdef __KERNEL__
enum { R3964_IDLE,
R3964_TX_REQUEST, R3964_TRANSMITTING,
R3964_WAIT_ZVZ_BEFORE_TX_RETRY, R3964_WAIT_FOR_TX_ACK,
R3964_WAIT_FOR_RX_BUF,
R3964_RECEIVING, R3964_WAIT_FOR_BCC, R3964_WAIT_FOR_RX_REPEAT
};
/*
* All open file-handles are 'clients' and are stored in a linked list:
*/
struct r3964_message;
struct r3964_client_info {
spinlock_t lock;
struct pid *pid;
unsigned int sig_flags;
struct r3964_client_info *next;
struct r3964_message *first_msg;
struct r3964_message *last_msg;
struct r3964_block_header *next_block_to_read;
int msg_count;
};
#endif
/* types for msg_id: */
enum {R3964_MSG_ACK=1, R3964_MSG_DATA };
#define R3964_MAX_MSG_COUNT 32
/* error codes for client messages */
#define R3964_OK 0 /* no error. */
#define R3964_TX_FAIL -1 /* transmission error, block NOT sent */
#define R3964_OVERFLOW -2 /* msg queue overflow */
/* the client gets this struct when calling read(fd,...): */
struct r3964_client_message {
int msg_id;
int arg;
int error_code;
};
#define R3964_MTU 256
#ifdef __KERNEL__
struct r3964_block_header;
/* internal version of client_message: */
struct r3964_message {
int msg_id;
int arg;
int error_code;
struct r3964_block_header *block;
struct r3964_message *next;
};
/*
* Header of received block in rx_buf/tx_buf:
*/
struct r3964_block_header
{
unsigned int length; /* length in chars without header */
unsigned char *data; /* usually data is located
immediately behind this struct */
unsigned int locks; /* only used in rx_buffer */
struct r3964_block_header *next;
struct r3964_client_info *owner; /* =NULL in rx_buffer */
};
/*
* If rx_buf hasn't enough space to store R3964_MTU chars,
* we will reject all incoming STX-requests by sending NAK.
*/
#define RX_BUF_SIZE 4000
#define TX_BUF_SIZE 4000
#define R3964_MAX_BLOCKS_IN_RX_QUEUE 100
#define R3964_PARITY 0x0001
#define R3964_FRAME 0x0002
#define R3964_OVERRUN 0x0004
#define R3964_UNKNOWN 0x0008
#define R3964_BREAK 0x0010
#define R3964_CHECKSUM 0x0020
#define R3964_ERROR 0x003f
#define R3964_BCC 0x4000
#define R3964_DEBUG 0x8000
struct r3964_info {
spinlock_t lock;
struct tty_struct *tty;
unsigned char priority;
unsigned char *rx_buf; /* ring buffer */
unsigned char *tx_buf;
wait_queue_head_t read_wait;
//struct wait_queue *read_wait;
struct r3964_block_header *rx_first;
struct r3964_block_header *rx_last;
struct r3964_block_header *tx_first;
struct r3964_block_header *tx_last;
unsigned int tx_position;
unsigned int rx_position;
unsigned char last_rx;
unsigned char bcc;
unsigned int blocks_in_rx_queue;
struct r3964_client_info *firstClient;
unsigned int state;
unsigned int flags;
struct timer_list tmr;
int nRetry;
};
#endif
#endif
|
/* This file is part of the KDE project
* Copyright 2007 Marijn Kruisselbrink <m.Kruisselbrink@student.tue.nl>
*
* 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 ADDDOTCOMMAND_H
#define ADDDOTCOMMAND_H
#include <QUndoCommand>
namespace MusicCore {
class Chord;
}
class MusicShape;
class AddDotCommand : public QUndoCommand {
public:
AddDotCommand(MusicShape* shape, MusicCore::Chord* chord);
virtual void redo();
virtual void undo();
private:
MusicShape* m_shape;
MusicCore::Chord* m_chord;
};
#endif // ADDDOTCOMMAND_H
|
/*
* drivers/amlogic/amports/arch/regs/hhi_regs.h
*
* Copyright (C) 2015 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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.
*
*/
#ifndef HHI_REGS_HEADER_
#define HHI_REGS_HEADER_
#define HHI_GCLK_MPEG0 0x1050
#define HHI_GCLK_MPEG1 0x1051
#define HHI_GCLK_MPEG2 0x1052
#define HHI_GCLK_OTHER 0x1054
#define HHI_GCLK_AO 0x1055
#define HHI_VID_CLK_DIV 0x1059
#define HHI_MPEG_CLK_CNTL 0x105d
#define HHI_AUD_CLK_CNTL 0x105e
#define HHI_VID_CLK_CNTL 0x105f
#define HHI_AUD_CLK_CNTL2 0x1064
/*add from M8m2*/
#define HHI_VID_CLK_CNTL2 0x1065
/**/
#define HHI_VID_DIVIDER_CNTL 0x1066
#define HHI_SYS_CPU_CLK_CNTL 0x1067
#define HHI_MALI_CLK_CNTL 0x106c
#define HHI_MIPI_PHY_CLK_CNTL 0x106e
#define HHI_VPU_CLK_CNTL 0x106f
#define HHI_OTHER_PLL_CNTL 0x1070
#define HHI_OTHER_PLL_CNTL2 0x1071
#define HHI_OTHER_PLL_CNTL3 0x1072
#define HHI_HDMI_CLK_CNTL 0x1073
#define HHI_DEMOD_CLK_CNTL 0x1074
#define HHI_SATA_CLK_CNTL 0x1075
#define HHI_ETH_CLK_CNTL 0x1076
#define HHI_CLK_DOUBLE_CNTL 0x1077
#define HHI_VDEC_CLK_CNTL 0x1078
#define HHI_VDEC2_CLK_CNTL 0x1079
/*add from M8M2*/
#define HHI_VDEC3_CLK_CNTL 0x107a
#define HHI_VDEC4_CLK_CNTL 0x107b
#endif
|
/*
* ChromeOS EC multi-function device
*
* Copyright (C) 2012 Google, Inc
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*/
#ifndef __LINUX_MFD_CROS_EC_H
#define __LINUX_MFD_CROS_EC_H
#include <linux/notifier.h>
#include <linux/mfd/cros_ec_commands.h>
#include <linux/mfd/cros_ec_dev.h>
/*
* Command interface between EC and AP, for LPC, I2C and SPI interfaces.
*/
enum {
EC_MSG_TX_HEADER_BYTES = 3,
EC_MSG_TX_TRAILER_BYTES = 1,
EC_MSG_TX_PROTO_BYTES = EC_MSG_TX_HEADER_BYTES +
EC_MSG_TX_TRAILER_BYTES,
EC_MSG_RX_PROTO_BYTES = 3,
/* Max length of messages */
EC_MSG_BYTES = EC_PROTO2_MAX_PARAM_SIZE +
EC_MSG_TX_PROTO_BYTES,
};
/**
* struct cros_ec_device - Information about a ChromeOS EC device
*
* @ec_name: name of EC device (e.g. 'chromeos-ec')
* @phys_name: name of physical comms layer (e.g. 'i2c-4')
* @dev: Device pointer
* @was_wake_device: true if this device was set to wake the system from
* sleep at the last suspend
* @cmd_xfer: send command to EC and get response
* Returns the number of bytes received if the communication succeeded, but
* that doesn't mean the EC was happy with the command. The caller
* should check msg.result for the EC's result code.
* @cmd_read_mem: direct read of the EC memory-mapped region, if supported
* @offset is within EC_LPC_ADDR_MEMMAP region.
* @bytes: number of bytes to read. zero means "read a string" (including
* the trailing '\0'). At most only EC_MEMMAP_SIZE bytes can be read.
* Caller must ensure that the buffer is large enough for the result when
* reading a string.
*
* @priv: Private data
* @irq: Interrupt to use
* @din: input buffer (for data from EC)
* @dout: output buffer (for data to EC)
* \note
* These two buffers will always be dword-aligned and include enough
* space for up to 7 word-alignment bytes also, so we can ensure that
* the body of the message is always dword-aligned (64-bit).
* We use this alignment to keep ARM and x86 happy. Probably word
* alignment would be OK, there might be a small performance advantage
* to using dword.
* @din_size: size of din buffer to allocate (zero to use static din)
* @dout_size: size of dout buffer to allocate (zero to use static dout)
* @parent: pointer to parent device (e.g. i2c or spi device)
* @wake_enabled: true if this device can wake the system from sleep
*/
struct cros_ec_device {
/* These are used by other drivers that want to talk to the EC */
const char *ec_name;
const char *phys_name;
struct device *dev;
bool was_wake_device;
struct class *cros_class;
int (*cmd_xfer)(struct cros_ec_device *ec,
struct cros_ec_command *msg);
int (*cmd_readmem)(struct cros_ec_device *ec, unsigned int offset,
unsigned int bytes, void *dest);
/* These are used to implement the platform-specific interface */
void *priv;
int irq;
uint8_t *din;
uint8_t *dout;
int din_size;
int dout_size;
struct device *parent;
bool wake_enabled;
};
/**
* cros_ec_suspend - Handle a suspend operation for the ChromeOS EC device
*
* This can be called by drivers to handle a suspend event.
*
* ec_dev: Device to suspend
* @return 0 if ok, -ve on error
*/
int cros_ec_suspend(struct cros_ec_device *ec_dev);
/**
* cros_ec_resume - Handle a resume operation for the ChromeOS EC device
*
* This can be called by drivers to handle a resume event.
*
* @ec_dev: Device to resume
* @return 0 if ok, -ve on error
*/
int cros_ec_resume(struct cros_ec_device *ec_dev);
/**
* cros_ec_prepare_tx - Prepare an outgoing message in the output buffer
*
* This is intended to be used by all ChromeOS EC drivers, but at present
* only SPI uses it. Once LPC uses the same protocol it can start using it.
* I2C could use it now, with a refactor of the existing code.
*
* @ec_dev: Device to register
* @msg: Message to write
*/
int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
struct cros_ec_command *msg);
/**
* cros_ec_remove - Remove a ChromeOS EC
*
* Call this to deregister a ChromeOS EC, then clean up any private data.
*
* @ec_dev: Device to register
* @return 0 if ok, -ve on error
*/
int cros_ec_remove(struct cros_ec_device *ec_dev);
/**
* cros_ec_register - Register a new ChromeOS EC, using the provided info
*
* Before calling this, allocate a pointer to a new device and then fill
* in all the fields up to the --private-- marker.
*
* @ec_dev: Device to register
* @return 0 if ok, -ve on error
*/
int cros_ec_register(struct cros_ec_device *ec_dev);
#endif /* __LINUX_MFD_CROS_EC_H */
|
#include "../generic/wrappers.c"
long lens_get_focus_pos()
{
return _GetFocusLensSubjectDistance();
}
long lens_get_focus_pos_from_lens()
{
return _GetFocusLensSubjectDistanceFromLens();
}
long lens_get_target_distance()
{
return _GetCurrentTargetDistance();
//return 0;
}
|
/*
* Enterprise specific IPFIX Information Elements and lookup functions
* Copyright (C) 2014 Oliver Gasser
*
* 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.
*
*/
#include <string.h>
#include <stdio.h>
#include "ipfix_names.h"
#include "ipfix.h"
#include "ipfix_iana.h"
#include "ipfix_iana.c"
#ifdef __cplusplus
extern "C" {
#endif
struct ipfix_identifier ipfixids[] = {
{ PSAMP_TYPEID_ipHeaderPacketSection, PSAMP_LENGTH_ipHeaderPacketSection, 0, "ipHeaderPacketSection" },
{ PSAMP_TYPEID_ipPayloadPacketSection, PSAMP_LENGTH_ipPayloadPacketSection, 0, "ipPayloadPacketSection" },
{ PSAMP_TYPEID_observationTimeSeconds, PSAMP_LENGTH_observationTimeSeconds, 0, "observationTimeSeconds" },
{ PSAMP_TYPEID_observationTimeMilliseconds, PSAMP_LENGTH_observationTimeMilliseconds, 0, "observationTimeMilliseconds" },
{ PSAMP_TYPEID_observationTimeMicroseconds, PSAMP_LENGTH_observationTimeMicroseconds, 0, "observationTimeMicroseconds" },
/* Vermont PEN */
{ IPFIX_ETYPEID_frontPayload, 0, IPFIX_PEN_vermont, "frontPayload" },
{ IPFIX_ETYPEID_frontPayload, 0, IPFIX_PEN_vermont|IPFIX_PEN_reverse, "revFrontPayload" },
//{ IPFIX_ETYPEID_frontPayload|IPFIX_ETYPE_reverse_bit, 0, IPFIX_PEN_vermont, "revFrontPayload" },
{ IPFIX_ETYPEID_frontPayloadLen, IPFIX_ELENGTH_frontPayloadLen, IPFIX_PEN_vermont, "frontPayloadLen" },
{ IPFIX_ETYPEID_frontPayloadLen, IPFIX_ELENGTH_frontPayloadLen, IPFIX_PEN_vermont|IPFIX_PEN_reverse, "revFrontPayloadLen" },
//{ IPFIX_ETYPEID_frontPayloadLen|IPFIX_ETYPE_reverse_bit, IPFIX_ELENGTH_frontPayloadLen, IPFIX_PEN_vermont, "revFrontPayloadLen" },
{ IPFIX_ETYPEID_maxPacketGap, IPFIX_ELENGTH_maxPacketGap, IPFIX_PEN_vermont, "maxPacketGap" },
{ IPFIX_ETYPEID_maxPacketGap, IPFIX_ELENGTH_maxPacketGap, IPFIX_PEN_vermont|IPFIX_PEN_reverse, "revMaxPacketGap" },
// { IPFIX_ETYPEID_maxPacketGap|IPFIX_ETYPE_reverse_bit, IPFIX_ELENGTH_maxPacketGap, IPFIX_PEN_vermont, "revMaxPacketGap" },
{ IPFIX_ETYPEID_frontPayloadPktCount, IPFIX_ELENGTH_frontPayloadPktCount, IPFIX_PEN_vermont, "frontPayloadPktCount" },
{ IPFIX_ETYPEID_frontPayloadPktCount, IPFIX_ELENGTH_frontPayloadPktCount, IPFIX_PEN_vermont|IPFIX_PEN_reverse, "frontPayloadPktCount" },
// { IPFIX_ETYPEID_frontPayloadPktCount|IPFIX_ETYPE_reverse_bit, IPFIX_ELENGTH_frontPayloadPktCount, IPFIX_PEN_vermont, "frontPayloadPktCount" },
{ IPFIX_ETYPEID_dpaFlowCount, IPFIX_ELENGTH_dpaFlowCount, IPFIX_PEN_vermont, "dpaFlowCount" },
{ IPFIX_ETYPEID_dpaForcedExport, IPFIX_ELENGTH_dpaForcedExport, IPFIX_PEN_vermont, "dpaForcedExport" },
{ IPFIX_ETYPEID_dpaReverseStart, IPFIX_ELENGTH_dpaReverseStart, IPFIX_PEN_vermont, "dpaReverseStart" },
{ IPFIX_ETYPEID_transportOctetDeltaCount, IPFIX_ELENGTH_transportOctetDeltaCount, IPFIX_PEN_vermont, "transportOctetDeltaCount" },
{ IPFIX_ETYPEID_transportOctetDeltaCount, IPFIX_ELENGTH_transportOctetDeltaCount, IPFIX_PEN_vermont|IPFIX_PEN_reverse, "revTransportOctetDeltaCount" },
// { IPFIX_ETYPEID_transportOctetDeltaCount|IPFIX_ETYPE_reverse_bit, IPFIX_ELENGTH_transportOctetDeltaCount, IPFIX_PEN_vermont, "revTransportOctetDeltaCount" },
{ IPFIX_ETYPEID_anonymisationType, IPFIX_ELENGTH_anonymisationType, IPFIX_PEN_vermont, "anonymisationType" },
};
/* lookup a certain ipfix ID into its name */
const struct ipfix_identifier * ipfix_id_lookup(uint16_t id, uint32_t pen)
{
uint32_t i;
// Search IANA IPFIX IDs
for (i=0; i<sizeof(ipfixids_iana)/sizeof(struct ipfix_identifier); i++) {
if (ipfixids_iana[i].id==id && ipfixids_iana[i].pen==pen) {
return &ipfixids_iana[i];
}
}
// Search other IPFIX IDs
for (i=0; i<sizeof(ipfixids)/sizeof(struct ipfix_identifier); i++) {
if (ipfixids[i].id==id && ipfixids[i].pen==pen) {
return &ipfixids[i];
}
}
return NULL;
}
/*
lookup an ipfix name into its ID
int because we need -1 for "not found"
*/
const struct ipfix_identifier* ipfix_name_lookup(const char *name)
{
uint32_t i;
// Search IANA IPFIX IDs
for (i=0; i<sizeof(ipfixids_iana)/sizeof(struct ipfix_identifier); i++) {
if (strcasecmp(name, ipfixids_iana[i].name)==0) {
return &ipfixids_iana[i];
}
}
// Search other IPFIX IDs
for (i=0; i<sizeof(ipfixids)/sizeof(struct ipfix_identifier); i++) {
if (strcasecmp(name, ipfixids[i].name)==0) {
return &ipfixids[i];
}
}
/* not found */
return NULL;
}
#ifdef __cplusplus
}
#endif
|
/*
* Compressed RAM block device
*
* Copyright (C) 2008, 2009, 2010 Nitin Gupta
*
* This code is released using a dual license strategy: BSD/GPL
* You can choose the licence that better fits your requirements.
*
* Released under the terms of 3-clause BSD License
* Released under the terms of GNU General Public License Version 2.0
*
* Project home: http://compcache.googlecode.com
*/
#ifndef _ZRAM_DRV_H_
#define _ZRAM_DRV_H_
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include "../zsmalloc/zsmalloc.h"
/*
* Some arbitrary value. This is just to catch
* invalid value for num_devices module parameter.
*/
static const unsigned max_num_devices = 32;
/*-- Configurable parameters */
/*
* Pages that compress to size greater than this are stored
* uncompressed in memory.
*/
static const size_t max_zpage_size = PAGE_SIZE / 4 * 3;
/*
* NOTE: max_zpage_size must be less than or equal to:
* ZS_MAX_ALLOC_SIZE. Otherwise, zs_malloc() would
* always return failure.
*/
/*-- End of configurable params */
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT)
#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT)
#define ZRAM_LOGICAL_BLOCK_SHIFT 12
#define ZRAM_LOGICAL_BLOCK_SIZE (1 << ZRAM_LOGICAL_BLOCK_SHIFT)
#define ZRAM_SECTOR_PER_LOGICAL_BLOCK \
(1 << (ZRAM_LOGICAL_BLOCK_SHIFT - SECTOR_SHIFT))
/* Flags for zram pages (table[page_no].flags) */
enum zram_pageflags {
/* Page consists entirely of zeros */
ZRAM_ZERO,
__NR_ZRAM_PAGEFLAGS,
};
/*-- Data structures */
/* Allocated for each disk page */
struct table {
unsigned long handle;
u16 size; /* object size (excluding header) */
u8 count; /* object ref count (not yet used) */
u8 flags;
} __attribute__((aligned(4)));
/*
* All 64bit fields should only be manipulated by 64bit atomic accessors.
* All modifications to 32bit counter should be protected by zram->lock.
*/
struct zram_stats {
atomic64_t compr_size; /* compressed size of pages stored */
atomic64_t num_reads; /* failed + successful */
atomic64_t num_writes; /* --do-- */
atomic64_t failed_reads; /* should NEVER! happen */
atomic64_t failed_writes; /* can happen when memory is too low */
atomic64_t invalid_io; /* non-page-aligned I/O requests */
atomic64_t notify_free; /* no. of swap slot free notifications */
u32 pages_zero; /* no. of zero filled pages */
u32 pages_stored; /* no. of pages currently stored */
u32 good_compress; /* % of pages with compression ratio<=50% */
u32 bad_compress; /* % of pages with compression ratio>=75% */
};
struct zram_meta {
struct table *table;
struct zs_pool *mem_pool;
};
struct zram_slot_free {
unsigned long index;
struct zram_slot_free *next;
};
struct zram {
struct zram_meta *meta;
struct rw_semaphore lock; /* protect compression buffers, table,
* 32bit stat counters against concurrent
* notifications, reads and writes */
struct work_struct free_work; /* handle pending free request */
struct zram_slot_free *slot_free_rq; /* list head of free request */
struct request_queue *queue;
struct gendisk *disk;
int init_done;
/* Prevent concurrent execution of device init, reset and R/W request */
struct rw_semaphore init_lock;
/*
* This is the limit on amount of *uncompressed* worth of data
* we can store in a disk.
*/
u64 disksize; /* bytes */
spinlock_t slot_free_lock;
struct zram_stats stats;
};
#endif
|
/*
* print.c - library routines for printing ASN.1 values.
*
* Copyright (C) 1992 Michael Sample and the University of British Columbia
*
* This library is free software; you can redistribute it and/or
* modify it provided that this copyright/license information is retained
* in original form.
*
* If you modify this file, you must clearly indicate your changes.
*
* This source code 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.
*
* $Header: /baseline/SNACC/c-lib/src/print.c,v 1.8 2004/01/22 20:03:12 nicholar Exp $
*
*/
#include "config.h"
#include "asn-config.h"
#include "print.h"
void
Indent PARAMS ((f, i),
FILE *f _AND_
unsigned int i)
{
for (; i > 0; i--)
fputs (" ", f);
}
void Asn1DefaultErrorHandler PARAMS ((str, severity),
char* str ESNACC_UNUSED _AND_
int severity ESNACC_UNUSED)
{
/* fprintf(stderr,"%s",str); DAD - temp removing for now*/
}
static Asn1ErrorHandler asn1CurrentErrorHandler = Asn1DefaultErrorHandler;
void
Asn1Error PARAMS ((str),
char* str)
{
(*asn1CurrentErrorHandler)(str,1);
}
void
Asn1Warning PARAMS ((str),
char* str)
{
(*asn1CurrentErrorHandler)(str,0);
}
Asn1ErrorHandler
Asn1InstallErrorHandler PARAMS ((handler),
Asn1ErrorHandler handler)
{
Asn1ErrorHandler former = asn1CurrentErrorHandler;
asn1CurrentErrorHandler = handler;
return former;
}
|
#pragma once
/*
* Copyright (C) 2012-2013 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "IFileDirectory.h"
namespace XFILE
{
class CAPKDirectory : public IFileDirectory
{
public:
CAPKDirectory() {};
virtual ~CAPKDirectory() {};
virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
virtual bool ContainsFiles(const CStdString& strPath);
virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
virtual bool Exists(const char* strPath);
};
}
|
/*
* Copyright (c) 2020 SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may
* find current contact information at www.novell.com.
*/
#ifndef STORAGE_TMPFS_H
#define STORAGE_TMPFS_H
#include "storage/Filesystems/Filesystem.h"
namespace storage
{
/**
* Class to represent a tmpfs.
*
* The Tmpfs object should always have MountPoint as child. So when deleting the
* MountPoint also delete the Tmpfs.
*
* Also see doc/tmpfs.md.
*/
class Tmpfs : public Filesystem
{
public:
/**
* Create a device of type Tmpfs.
*
* @see Device::create(Devicegraph*)
*/
static Tmpfs* create(Devicegraph* devicegraph);
static Tmpfs* load(Devicegraph* devicegraph, const xmlNode* node);
/**
* Get all Tmpfses.
*/
static std::vector<Tmpfs*> get_all(Devicegraph* devicegraph);
/**
* @copydoc get_all()
*/
static std::vector<const Tmpfs*> get_all(const Devicegraph* devicegraph);
public:
class Impl;
Impl& get_impl();
const Impl& get_impl() const;
virtual Tmpfs* clone() const override;
protected:
Tmpfs(Impl* impl);
};
/**
* Checks whether device points to a Tmpfs.
*
* @throw NullPointerException
*/
bool is_tmpfs(const Device* device);
/**
* Converts pointer to Device to pointer to Tmpfs.
*
* @return Pointer to Tmpfs.
* @throw DeviceHasWrongType, NullPointerException
*/
Tmpfs* to_tmpfs(Device* device);
/**
* @copydoc to_tmpfs(Device*)
*/
const Tmpfs* to_tmpfs(const Device* device);
}
#endif
|
#ifndef __GESENT3D_H__
#define __GESENT3D_H__
#include "gecurv3d.h"
#include "gekvec.h"
#include "gept3dar.h"
#include "gevec3d.h"
#include "gepnt3d.h"
#include "gept3dar.h"
#include "..\inc\zgesent3d.h"
#ifndef AcGeContext
#define AcGeContext ZcGeContext
#endif //#ifndef AcGeContext
#ifndef AcGeCurve3d
#define AcGeCurve3d ZcGeCurve3d
#endif //#ifndef AcGeCurve3d
#ifndef AcGeKnotVector
#define AcGeKnotVector ZcGeKnotVector
#endif //#ifndef AcGeKnotVector
#ifndef AcGePoint3d
#define AcGePoint3d ZcGePoint3d
#endif //#ifndef AcGePoint3d
#ifndef AcGeSplineEnt3d
#define AcGeSplineEnt3d ZcGeSplineEnt3d
#endif //#ifndef AcGeSplineEnt3d
#ifndef AcGeTol
#define AcGeTol ZcGeTol
#endif //#ifndef AcGeTol
#ifndef Adesk
#define Adesk ZSoft
#endif //#ifndef Adesk
#endif //#ifndef __GESENT3D_H__
|
/* Support for GCC on PowerPC using WindISS simulator.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC WindISS)");
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "%(lib_windiss)"
#undef STARTFILE_DEFAULT_SPEC
#define STARTFILE_DEFAULT_SPEC "%(startfile_windiss)"
#undef ENDFILE_DEFAULT_SPEC
#define ENDFILE_DEFAULT_SPEC "%(endfile_windiss)"
#undef LINK_START_DEFAULT_SPEC
#define LINK_START_DEFAULT_SPEC "%(link_start_windiss)"
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_windiss)"
#undef CRTSAVRES_DEFAULT_SPEC
#define CRTSAVRES_DEFAULT_SPEC ""
#undef WCHAR_TYPE
#define WCHAR_TYPE "short unsigned int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 16
|
/*
* Copyright (c) 2004, Bull SA. All rights reserved.
* Created by: Laurent.Vivier@bull.net
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*/
/*
* assertion:
*
* The list array may contain NULL elements which shall be ignored.
*
* method:
*
* - Open a file for writing
* - Create an lio list with NULL elements
* - submit list to lio_listio
* - Check that NULL elements are ignored
*
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <aio.h>
#include "posixtest.h"
#define TNAME "lio_listio/4-1.c"
#define NUM_AIOCBS 10
#define BUF_SIZE 1024
int num_received = 0;
int received_all = 0;
void
sigrt1_handler(int signum, siginfo_t *info, void *context)
{
num_received++;
}
void
sigrt2_handler(int signum, siginfo_t *info, void *context)
{
received_all = 1;
}
int main()
{
char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
char *bufs;
struct sigaction action;
struct sigevent event;
int errors = 0;
int ret;
int err;
int i;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE);
if (bufs == NULL) {
printf (TNAME " Error at malloc(): %s\n", strerror (errno));
close (fd);
exit(PTS_UNRESOLVED);
}
/* Put NULL elements in list */
for (i=0; i<NUM_AIOCBS; i++)
aiocbs[i] = NULL;
/* Queue up a bunch of aio writes */
for (i=1; i<NUM_AIOCBS-1; i++) {
if (i == 3)
continue;
aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb));
memset(aiocbs[i], 0, sizeof(struct aiocb));
aiocbs[i]->aio_fildes = fd;
aiocbs[i]->aio_offset = 0;
aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE];
aiocbs[i]->aio_nbytes = BUF_SIZE;
aiocbs[i]->aio_lio_opcode = LIO_WRITE;
/* Use SIRTMIN+1 for individual completions */
aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1;
aiocbs[i]->aio_sigevent.sigev_value.sival_int = i;
}
/* Use SIGRTMIN+2 for list completion */
event.sigev_notify = SIGEV_SIGNAL;
event.sigev_signo = SIGRTMIN+2;
event.sigev_value.sival_ptr = NULL;
/* Setup handler for individual operation completion */
action.sa_sigaction = sigrt1_handler;
sigemptyset(&action.sa_mask);
action.sa_flags = SA_SIGINFO|SA_RESTART;
sigaction(SIGRTMIN+1, &action, NULL);
/* Setup handler for list completion */
action.sa_sigaction = sigrt2_handler;
sigemptyset(&action.sa_mask);
action.sa_flags = SA_SIGINFO|SA_RESTART;
sigaction(SIGRTMIN+2, &action, NULL);
/* Submit request list */
ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event);
if (ret) {
printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno));
for (i=1; i<NUM_AIOCBS-1; i++) {
if (i == 3)
continue;
free (aiocbs[i]);
}
free (bufs);
close (fd);
exit (PTS_FAIL);
}
/* Wait until list completion */
while (received_all == 0)
sleep (1);
/* Check we only received NUM_AIOCBS-3 notifications */
if (num_received != NUM_AIOCBS-3) {
printf(TNAME " Error did not receive the right number of notifications\n");
for (i=1; i<NUM_AIOCBS-1; i++) {
if (i == 3)
continue;
free (aiocbs[i]);
}
free (bufs);
close (fd);
exit (PTS_FAIL);
}
/* Check return code and free things */
for (i=1; i<NUM_AIOCBS-1; i++) {
if (i == 3)
continue;
err = aio_error(aiocbs[i]);
ret = aio_return(aiocbs[i]);
if ((err != 0) && (ret != BUF_SIZE)) {
printf(TNAME " req %d: error = %d - return = %d\n", i, err, ret);
errors++;
}
free (aiocbs[i]);
}
free (bufs);
close(fd);
if (errors != 0)
exit (PTS_FAIL);
printf (TNAME " PASSED\n");
return PTS_PASS;
}
|
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
* GPL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
#ifndef EXPORT_SYMTAB
# define EXPORT_SYMTAB
#endif
#define DEBUG_SUBSYSTEM S_FILTER
#include <lvfs.h>
struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *ctxt, __u64 id,
__u32 gen, __u64 gr, void *data)
{
return ctxt->cb_ops.l_fid2dentry(id, gen, gr, data);
}
EXPORT_SYMBOL(lvfs_fid2dentry);
|
/***************************************************************************
* 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. *
* *
* copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
* copyright (C) 2004-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef CPPHEADERCODEACCESSORMETHOD_H
#define CPPHEADERCODEACCESSORMETHOD_H
#include "codeaccessormethod.h"
#include <QString>
class CodeClassField;
class CPPHeaderCodeAccessorMethod : public CodeAccessorMethod
{
Q_OBJECT
public:
/**
* Empty Constructor
*/
CPPHeaderCodeAccessorMethod (CodeClassField * field, CodeAccessorMethod::AccessorType type);
/**
* Empty Destructor
*/
virtual ~CPPHeaderCodeAccessorMethod ();
/**
* Must be called before this object is usable
*/
void update();
virtual void updateMethodDeclaration();
virtual void updateContent();
private:
};
#endif // CPPHEADERCODEACCESSORMETHOD_H
|
/* Misfit Model 3D
*
* Copyright (c) 2004-2007 Kevin Worcester
*
* 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.
*
* See the COPYING file for full license text.
*/
#ifndef __MESH_H
#define __MESH_H
#include <vector>
class Model;
// The Mesh class contains a subset of model data. The purpose is to
// force model data to conform to some restrictions which do not
// apply to MM3D models. Examples of this include some model formats
// which don't allow vertices to belong to more one texture group
// or have different normals for different faces that use them.
//
// Use mesh_create_list() to build meshes from a model
class Mesh
{
public:
// Rules for creating a mesh. If the option value is 0, all criteria
// are ignored; a single mesh containing all vertices and faces will
// be constructed. Including any option below will cause multiple
// meshes to be created and vertices to be duplicated as necessary.
enum _Option_e
{
MO_UV = 0x0001, // Mesh vertices must have only one UV coord
MO_Normal = 0x0002, // Mesh vertices must have only one normal
MO_Group = 0x0100, // Mesh faces must belong to the same group
MO_Material = 0x0200, // Mesh faces must have the same material
MO_All = 0xffff, // All of the above
MO_MAX
};
typedef enum _Option_e OptionE;
// There is an entry in a VertexList for each vertex that is
// used by the mesh. The index is the vertex number in the mesh,
// the value is the vertex number in the model plus other
// vertex-specific data (uvs, normals, etc)
class Vertex
{
public:
int v; // model vertex number
float norm[3]; // normal
float uv[2]; // texture coords
};
typedef std::vector< Vertex > VertexList;
class Face
{
public:
int modelTri; // triangle that this face was built from
int v[3]; // vertex index (in Mesh's vertices list)
float norm[3]; // face normal
float vnorm[3][3]; // vertex normals
float uv[3][2]; // texture coords (per triangle vertex)
};
typedef std::vector< Face > FaceList;
int options; // options this mesh was created with
int group; // group that this mesh was built from (or -1 if none)
VertexList vertices; // list of model vertices used by the mesh
FaceList faces; // list of mesh faces
void clear();
void addTriangle( Model * m, int triangle );
int addVertex( Model * model, int triangle, int vertexIndex );
};
typedef std::vector< Mesh > MeshList;
void mesh_create_list( MeshList & meshes, Model * model, int options = Mesh::MO_All );
int mesh_list_vertex_count( const MeshList & meshes );
int mesh_list_face_count( const MeshList & meshes );
// Convert a mesh vertex or triangle index to a model index
int mesh_list_model_vertex( const MeshList & meshes, int meshVertex );
int mesh_list_model_triangle( const MeshList & meshes, int meshTriangle );
// Convert a model vertex or triangle index to a mesh index
int mesh_list_mesh_vertex( const MeshList & meshes, int modelVertex );
int mesh_list_mesh_triangle( const MeshList & meshes, int modelTriangle );
#endif // __MESH_H
|
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
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 St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "mysys_priv.h"
#ifdef HAVE_SYS_MMAN_H
/*
system msync() only syncs mmap'ed area to fs cache.
fsync() is required to really sync to disc
*/
int my_msync(int fd, void *addr, size_t len, int flags)
{
msync(addr, len, flags);
return my_sync(fd, MYF(0));
}
#elif defined(_WIN32)
#ifndef FILE_DAX_VOLUME
#define FILE_DAX_VOLUME 0x20000000
#endif
static SECURITY_ATTRIBUTES mmap_security_attributes=
{sizeof(SECURITY_ATTRIBUTES), 0, TRUE};
void *my_mmap(void *addr, size_t len, int prot,
int flags, File fd, my_off_t offset)
{
HANDLE hFileMap;
LPVOID ptr;
HANDLE hFile= (HANDLE)my_get_osfhandle(fd);
DBUG_ENTER("my_mmap");
DBUG_PRINT("mysys", ("map fd: %d", fd));
if (hFile == INVALID_HANDLE_VALUE)
DBUG_RETURN(MAP_FAILED);
hFileMap=CreateFileMapping(hFile, &mmap_security_attributes,
PAGE_READWRITE, 0, (DWORD) len, NULL);
if (hFileMap == 0)
DBUG_RETURN(MAP_FAILED);
ptr=MapViewOfFile(hFileMap,
prot & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ,
(DWORD)(offset >> 32), (DWORD)offset, len);
/*
MSDN explicitly states that it's possible to close File Mapping Object
even when a view is not unmapped - then the object will be held open
implicitly until unmap, as every view stores internally a handler of
a corresponding File Mapping Object
*/
CloseHandle(hFileMap);
if (flags & MAP_SYNC)
{
DWORD filesystemFlags;
if (!GetVolumeInformationByHandleW(hFile, NULL, 0, NULL, NULL,
&filesystemFlags, NULL, 0) ||
!(filesystemFlags & FILE_DAX_VOLUME))
{
UnmapViewOfFile(ptr);
ptr= NULL;
}
}
if (ptr)
{
DBUG_PRINT("mysys", ("mapped addr: %p", ptr));
DBUG_RETURN(ptr);
}
DBUG_RETURN(MAP_FAILED);
}
int my_munmap(void *addr, size_t len)
{
DBUG_ENTER("my_munmap");
DBUG_PRINT("mysys", ("unmap addr: %p", addr));
DBUG_RETURN(UnmapViewOfFile(addr) ? 0 : -1);
}
int my_msync(int fd, void *addr, size_t len, int flags)
{
return FlushViewOfFile(addr, len) &&
FlushFileBuffers(my_get_osfhandle(fd)) ? 0 : -1;
}
#else
#warning "no mmap!"
#endif
|
#include "../../../src/devicehosting/controlpoint/hcontrolpoint_configuration.h"
|
/* Abiword
* Copyright (C) 2002 Christian Biesinger <cbiesinger@web.de>
*
* 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.
*/
/** @file
* Contains decryption routines for StarOffice files */
#include <string.h> // for memcpy
#include "ut_types.h"
#include "ut_string_class.h"
/** Decryptor for .sdw files */
class SDWCryptor {
public:
/** Maximum length of the password */
enum { maxPWLen = 16 };
/** Intializes the cryptor. The arguments are used to verify
* that the password is correct. A date and time of zero tells
* the cryptor to not use these values.
* If you give aDate and aTime, you really should also give aFilePass -
* results might not be what you expect otherwise
* @param aDate The date given in the file header
* @param aTime Time from file header. */
SDWCryptor(UT_uint32 aDate = 0, UT_uint32 aTime = 0, const UT_uint8* aFilePass = NULL);
~SDWCryptor();
/** Sets date and time for verifying the password */
void SetDateTime(UT_uint32 aDate, UT_uint32 aTime) { mDate = aDate; mTime = aTime; }
/** Sets the password that will be used for decrypting. Even if the password
* is invalid, the current password will be modified.
* @param aPassword The password to use
* @param aFilePass The password given in the file header to
* check if the given password is correct or NULL if no check should be
* performed.
* @return true on success (also if aFilePass is NULL),
* false on failure (e.g. invalid password) */
bool SetPassword(const char* aPassword);
/** Decrypts a given string.
* @param aEncrypted The string to decrypt
* @param aBuffer Decrypted string will be put here. Needs to be at least
* strlen(aEncrypted) bytes large. Can be the same as aEncrypted.
* @param aLen Length of the string to be encrypted, if 0 or not given
* strlen(aEncrypted) is used. */
void Decrypt(const char* aEncrypted, char* aBuffer, UT_uint32 aLen = 0) const;
/** Encrypts a string. Works the same as SDWCryptor::Decrypt */
void Encrypt(const char* aDecrypted, char* aBuffer, UT_uint32 aLen = 0) const { Decrypt(aDecrypted, aBuffer, aLen); }
protected:
UT_uint32 mDate;
UT_uint32 mTime;
char mPassword[maxPWLen];
UT_uint8 mFilePass[maxPWLen];
};
|
/*
* Copyright (C) 2005 Jimi Xenidis <jimix@watson.ibm.com>, IBM Corporation
*
* 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
*
* $Id$
*/
#include <test.h>
#include <hcall.h>
#define MAX_CRQ_SLOTS 64
static struct crq_maintenance cm[MAX_CRQ_SLOTS];
static sval
crq_transfer(struct crq_maintenance *cm, uval32 liobn, uval32 lpid, uval role)
{
sval rc;
uval rets[3];
rc = hcall_resource_transfer(rets, INTR_SRC, liobn, 0, 0, lpid);
assert(rc == H_Success,
"could not transfer CRQ (0x%x) to lpid=0x%x: err=%d\n",
liobn, lpid, (int)rc);
if (H_Success != rc) {
/* failure */
if (ROLE_SERVER == role) {
cm->cm_owner_server = 0;
} else {
cm->cm_owner_client = 0;
}
}
return rc;
}
struct crq_maintenance *
crq_create(uval lpid, uval role, uval dma_sz)
{
uval i = 0;
struct crq_maintenance *res = NULL;
while (i < MAX_CRQ_SLOTS) {
if (ROLE_SERVER == role) {
if (0 == cm[i].cm_owner_server) {
cm[i].cm_owner_server = lpid;
res = &cm[i];
break;
}
} else {
if (0 == cm[i].cm_owner_client) {
cm[i].cm_owner_client = lpid;
res = &cm[i];
break;
}
}
i++;
}
if (NULL != res) {
uval rc;
res->cm_slot = i;
assert((0 == res->cm_liobn_server && 0 == res->cm_liobn_client)
|| (0 != res->cm_liobn_server &&
0 != res->cm_liobn_client),
"crq maintenanc structure is in bad state.\n");
/* have liobn values assigned to it already? */
if (0 == res->cm_liobn_server && 0 == res->cm_liobn_server) {
uval rets[3];
uval32 liobn;
/* need to acquire the liobn numbers */
rc = hcall_vio_ctl(rets, HVIO_ACQUIRE, HVIO_CRQ,
dma_sz);
assert(rc == H_Success, "could not allocate CRQ\n");
if (rc == H_Success) {
dma_sz = rets[2];
if (dma_sz == 0) {
/* out of memory ? release
* everything */
rc = hcall_vio_ctl(NULL, HVIO_RELEASE,
rets[0], 0);
assert(rc == H_Success,
"could not release CRQ for "
"1st partition\n");
rc = hcall_vio_ctl(NULL, HVIO_RELEASE,
rets[1], 0);
assert(rc == H_Success,
"could not release CRQ for "
"2nd partition\n");
} else {
res->cm_liobn_server = rets[0];
res->cm_liobn_client = rets[1];
res->cm_dma_sz = dma_sz;
/* I am claiming the server
* side first */
if (ROLE_SERVER == role) {
liobn = res->cm_liobn_server;
} else {
liobn = res->cm_liobn_client;
}
if (lpid != H_SELF_LPID) {
/* need to transfer
* this resource
* here */
rc = crq_transfer(res, liobn,
lpid, role);
}
if (H_Success != rc) {
res = NULL;
}
}
}
} else {
uval32 liobn;
/*
* The vlan has already been acquired, so now
* let me transfer it to the partition that's
* supposed to use it
*/
if (ROLE_SERVER == role) {
liobn = res->cm_liobn_server;
} else {
liobn = res->cm_liobn_client;
}
/* need to transfer this resource here */
rc = crq_transfer(res, liobn, lpid, role);
if (H_Success != rc) {
res = NULL;
}
}
}
return res;
}
/* Should be called upon destruction of a partition - not tested */
void
crq_release(uval32 lpid)
{
uval i = 0;
/*
* Drop all ownership claims of CRQ resources that this
* partiton used to own
*/
while (i < MAX_CRQ_SLOTS) {
uval found = 0;
/*
* in any case, leave the liobn values untouched!!
* cannot re-claim the resource.
*/
if (lpid == cm[i].cm_owner_server) {
cm[i].cm_owner_server = 0;
found = 1;
} else if (lpid == cm[i].cm_owner_client) {
cm[i].cm_owner_client = 0;
found = 1;
}
/*
* CRQ does not have any owner anymore? Completely
* release it then.
*/
if (1 == found &&
0 == cm[i].cm_owner_client && 0 == cm[i].cm_owner_server) {
uval rc;
rc = hcall_vio_ctl(NULL, HVIO_RELEASE,
cm[i].cm_liobn_server, 0);
assert(rc == H_Success,
"could not release CRQ for 1st partition\n");
rc = hcall_vio_ctl(NULL, HVIO_RELEASE,
cm[i].cm_liobn_client, 0);
assert(rc == H_Success,
"could not release CRQ for 2nd partition\n");
cm[i].cm_liobn_server = 0;
cm[i].cm_liobn_client = 0;
}
i++;
}
}
|
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
#endif
/* GCC 4.1.[01] miscompiles __weak */
#ifdef __KERNEL__
# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
# error Your version of gcc miscompiles the __weak directive
# endif
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#if __GNUC_MINOR__ >= 3
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
Early snapshots of gcc 4.3 don't support this and we can't detect this
in the preprocessor, but we can live with this because they're unreleased.
Maketime probing would be overkill here.
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
* Fixed in GCC 4.8.2 and later versions.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#if GCC_VERSION <= 40801
# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#else
# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
#endif
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#if __GNUC_MINOR__ >= 5
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*
* Early snapshots of gcc 4.5 don't support this and we can't detect
* this in the preprocessor, but we can live with this because they're
* unreleased. Really, we need to have autoconf for the kernel.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
#endif
#endif
#if __GNUC_MINOR__ >= 6
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
#endif
#if __GNUC_MINOR__ > 0
#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
#endif
#if __GNUC_MINOR__ >= 4 && !defined(__CHECKER__)
#define __compiletime_warning(message) __attribute__((warning(message)))
#define __compiletime_error(message) __attribute__((error(message)))
#endif
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
*/
/*
* Cross Partition Memory (XPMEM) structures and macros.
*/
#ifndef _XPMEM_H
#define _XPMEM_H
#include <lwk/types.h>
#include <arch/ioctl.h>
/* Well-known XPMEM segids */
#define XPMEM_MAX_WK_SEGID 31
#define XPMEM_GIT_ROOT_SEGIDS 25
/*
* basic argument type definitions
*/
typedef int64_t xpmem_segid_t; /* segid returned from xpmem_make() */
typedef int64_t xpmem_apid_t; /* apid returned from xpmem_get() */
typedef int64_t xpmem_domid_t;
struct xpmem_addr {
xpmem_apid_t apid; /* apid that represents memory */
off_t offset; /* offset into apid's memory */
};
#define XPMEM_MAXADDR_SIZE (size_t)(-1L)
#define XPMEM_MAXNAME_SIZE 128
/*
* path to XPMEM device
*/
#define XPMEM_DEV_PATH "/dev/xpmem"
/*
* The following are the possible XPMEM related errors.
*/
#define XPMEM_ERRNO_NOPROC 2004 /* unknown thread due to fork() */
/*
* flags for segment permissions
*/
#define XPMEM_RDONLY 0x1
#define XPMEM_RDWR 0x2
/*
* Valid permit_type values for xpmem_make()/xpmem_get().
*/
#define XPMEM_PERMIT_MODE 0x1
#define XPMEM_GLOBAL_MODE 0x2
/* Valid flags for xpmem_make_hobbes() */
#define XPMEM_MEM_MODE 0x1
#define XPMEM_SIG_MODE 0x2
#define XPMEM_REQUEST_MODE 0x4
/* Valid flags for xpmem_attach() */
#define XPMEM_NOCACHE_MODE 0x1
/*
* ioctl() commands used to interface to the kernel module.
*/
#define XPMEM_IOC_MAGIC 'x'
#define XPMEM_CMD_VERSION _IO(XPMEM_IOC_MAGIC, 0)
#define XPMEM_CMD_MAKE _IO(XPMEM_IOC_MAGIC, 1)
#define XPMEM_CMD_REMOVE _IO(XPMEM_IOC_MAGIC, 2)
#define XPMEM_CMD_GET _IO(XPMEM_IOC_MAGIC, 3)
#define XPMEM_CMD_RELEASE _IO(XPMEM_IOC_MAGIC, 4)
#define XPMEM_CMD_SIGNAL _IO(XPMEM_IOC_MAGIC, 5)
#define XPMEM_CMD_ATTACH _IO(XPMEM_IOC_MAGIC, 6)
#define XPMEM_CMD_DETACH _IO(XPMEM_IOC_MAGIC, 7)
#define XPMEM_CMD_FORK_BEGIN _IO(XPMEM_IOC_MAGIC, 8)
#define XPMEM_CMD_FORK_END _IO(XPMEM_IOC_MAGIC, 9)
#define XPMEM_CMD_GET_DOMID _IO(XPMEM_IOC_MAGIC, 10)
/*
* Structures used with the preceding ioctl() commands to pass data.
*/
struct xpmem_cmd_make {
uint64_t vaddr;
size_t size;
int flags;
int permit_type;
int64_t permit_value;
xpmem_segid_t segid; /* returned on success */
int fd;
};
struct xpmem_cmd_remove {
xpmem_segid_t segid;
};
struct xpmem_cmd_get {
xpmem_segid_t segid;
int flags;
int permit_type;
int64_t permit_value;
xpmem_apid_t apid; /* returned on success */
};
struct xpmem_cmd_release {
xpmem_apid_t apid;
};
struct xpmem_cmd_signal {
xpmem_apid_t apid;
};
struct xpmem_cmd_attach {
xpmem_apid_t apid;
off_t offset;
size_t size;
uint64_t vaddr;
int fd;
int flags;
};
struct xpmem_cmd_detach {
uint64_t vaddr;
};
struct xpmem_cmd_domid {
xpmem_domid_t domid;
};
#endif /* _XPMEM_H */
|
/*
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __ardour_dspstats_window_h__
#define __ardour_dspstats_window_h__
#include "ardour_window.h"
class DspStatisticsGUI;
class DspStatisticsWindow : public ArdourWindow
{
public:
DspStatisticsWindow ();
~DspStatisticsWindow ();
void set_session (ARDOUR::Session*);
protected:
void on_show ();
void on_hide ();
private:
DspStatisticsGUI* ui;
};
#endif
|
/* mkhdimage.c, for the Linux DOS emulator
*
* cheesy program to create an hdimage header
*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#ifdef __linux__
#include <getopt.h>
#endif
#include <errno.h>
#include <string.h>
int sectors = 17, heads = 4, cylinders = 40, header_size = 128;
static void usage(void)
{
fprintf(stderr, "mkhdimage [-h <heads>] [-s <sectors>] [-c|-t <cylinders>]\n");
}
int
main(int argc, char **argv)
{
int c;
int pos = 0;
while ((c = getopt(argc, argv, "h:s:t:c:s:")) != EOF) {
switch (c) {
case 'h':
heads = atoi(optarg);
break;
case 's':
sectors = atoi(optarg);
break;
case 'c': /* cylinders */
case 't': /* tracks */
cylinders = atoi(optarg);
break;
default:
fprintf(stderr, "Unknown option '%c'\n", c);
usage();
exit(1);
}
}
#define WRITE(fd, ptr, size) ({ int w_tmp=0; \
do { w_tmp=write(fd,ptr,size); } while ((w_tmp == -1) && (errno == EINTR)); \
if (w_tmp == -1) \
fprintf(stderr, "WRITE ERROR: %d, *%s* in file %s, line %d\n", \
errno, strerror(errno), __FILE__, __LINE__); \
w_tmp; })
pos += WRITE(STDOUT_FILENO, "DOSEMU", 7);
pos += WRITE(STDOUT_FILENO, &heads, 4);
pos += WRITE(STDOUT_FILENO, §ors, 4);
pos += WRITE(STDOUT_FILENO, &cylinders, 4);
pos += WRITE(STDOUT_FILENO, &header_size, 4);
{
char tmp[256];
memset(tmp, 0, 256);
pos += WRITE(STDOUT_FILENO, tmp, header_size - pos);
fprintf(stderr, "Pos now is %d\n", pos);
}
return 0;
}
|
/*
* This file is part of the coreboot project.
*
* Copyright 2017 Google Inc.
*
* 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; version 2 of the License.
*
* 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.
*/
#include <intelblocks/sd.h>
#include "chip.h"
int sd_fill_soc_gpio_info(struct acpi_gpio* gpio, struct device *dev)
{
config_t *config = dev->chip_info;
if (!config->sdcard_cd_gpio)
return -1;
gpio->type = ACPI_GPIO_TYPE_INTERRUPT;
gpio->pull = ACPI_GPIO_PULL_NONE;
gpio->irq.mode = ACPI_IRQ_EDGE_TRIGGERED;
gpio->irq.polarity = ACPI_IRQ_ACTIVE_BOTH;
gpio->irq.shared = ACPI_IRQ_SHARED;
gpio->irq.wake = ACPI_IRQ_WAKE;
gpio->interrupt_debounce_timeout = 10000; /* 100ms */
gpio->pin_count = 1;
gpio->pins[0] = config->sdcard_cd_gpio;
return 0;
}
|
#pragma once
/*
* Copyright 2010-2016 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../Engine/State.h"
#include "Globe.h"
namespace OpenXcom
{
class Base;
class Window;
class Text;
class TextEdit;
class TextButton;
class Globe;
/**
* Window used to input a name for a new base.
* Player's first Base uses this screen
* additional bases use ConfirmNewBaseState
*/
class BaseNameState : public State
{
private:
Base *_base;
Globe *_globe;
Window *_window;
Text *_txtTitle;
TextEdit *_edtName;
TextButton *_btnOk;
bool _first;
bool _fixedLocation;
public:
/// Creates the Base Name state.
BaseNameState(Base *base, Globe *globe, bool first, bool fixedLocation);
/// Cleans up the Base Name state.
~BaseNameState();
/// Handler for clicking the OK button.
void btnOkClick(Action *action);
/// Handler for changing text on the Name edit.
void edtNameChange(Action *action);
};
}
|
/*
*
* Author: Thomas Pasquier <thomas.pasquier@bristol.ac.uk>
*
* Copyright (C) 2015-2016 University of Cambridge
* Copyright (C) 2016-2017 Harvard University
* Copyright (C) 2017-2018 University of Cambridge
* Copyright (C) 2018-202O University of Bristol
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
*/
#define MAX_JSON_BUFFER_EXP 13
#define MAX_JSON_BUFFER_LENGTH ((1 << MAX_JSON_BUFFER_EXP)*sizeof(uint8_t))
#define BUFFER_LENGTH (MAX_JSON_BUFFER_LENGTH-strnlen(buffer, MAX_JSON_BUFFER_LENGTH))
extern __thread char buffer[MAX_JSON_BUFFER_LENGTH];
extern char date[256];
extern pthread_rwlock_t date_lock;
// ideally should be derived from jiffies
static void update_time( void ){
struct tm tm;
struct timeval tv;
pthread_rwlock_wrlock(&date_lock);
gettimeofday(&tv, NULL);
gmtime_r(&tv.tv_sec, &tm);
strftime(date, 30,"%Y:%m:%dT%H:%M:%S", &tm);
pthread_rwlock_unlock(&date_lock);
}
static inline void __add_attribute(const char* name, bool comma){
if(comma){
strncat(buffer, ",\"", BUFFER_LENGTH);
}else{
strncat(buffer, "\"", BUFFER_LENGTH);
}
strncat(buffer, name, BUFFER_LENGTH);
strncat(buffer, "\":", BUFFER_LENGTH);
}
static inline void __add_uint32_attribute(const char* name, const uint32_t value, bool comma){
char tmp[32];
__add_attribute(name, comma);
strncat(buffer, utoa(value, tmp, DECIMAL), BUFFER_LENGTH);
}
static inline void __add_int32_attribute(const char* name, const int32_t value, bool comma){
char tmp[32];
__add_attribute(name, comma);
strncat(buffer, itoa(value, tmp, DECIMAL), BUFFER_LENGTH);
}
static inline void __add_uint32hex_attribute(const char* name, const uint32_t value, bool comma){
char tmp[32];
__add_attribute(name, comma);
strncat(buffer, "\"0x", BUFFER_LENGTH);
strncat(buffer, utoa(value, tmp, HEX), BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_uint64_attribute(const char* name, const uint64_t value, bool comma){
char tmp[64];
__add_attribute(name, comma);
strncat(buffer, "\"", BUFFER_LENGTH);
strncat(buffer, ulltoa(value, tmp, DECIMAL), BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_uint64hex_attribute(const char* name, const uint64_t value, bool comma){
char tmp[64];
__add_attribute(name, comma);
strncat(buffer, "\"", BUFFER_LENGTH);
strncat(buffer, ulltoa(value, tmp, HEX), BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_int64_attribute(const char* name, const int64_t value, bool comma){
char tmp[64];
__add_attribute(name, comma);
strncat(buffer, "\"", BUFFER_LENGTH);
strncat(buffer, lltoa(value, tmp, DECIMAL), BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_string_attribute(const char* name, const char* value, bool comma){
if(value[0]=='\0'){ // value is not set
return;
}
__add_attribute(name, comma);
strncat(buffer, "\"", BUFFER_LENGTH);
strncat(buffer, value, BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_date_attribute(bool comma){
__add_attribute("cf:date", comma);
strncat(buffer, "\"", BUFFER_LENGTH);
pthread_rwlock_rdlock(&date_lock);
strncat(buffer, date, BUFFER_LENGTH);
pthread_rwlock_unlock(&date_lock);
strncat(buffer, "\"", BUFFER_LENGTH);
}
#define UUID_STR_SIZE 37
static inline char* uuid_to_str(uint8_t* uuid, char* str, size_t size){
if(size<37){
snprintf(str, size, "UUID-ERROR");
return str;
}
snprintf(str, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid[0], uuid[1], uuid[2], uuid[3]
, uuid[4], uuid[5]
, uuid[6], uuid[7]
, uuid[8], uuid[9]
, uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
return str;
}
static inline void __add_ipv4(uint32_t ip, uint32_t port){
char tmp[8];
strncat(buffer, uint32_to_ipv4str(ip), BUFFER_LENGTH);
strncat(buffer, ":", BUFFER_LENGTH);
strncat(buffer, utoa(htons(port), tmp, DECIMAL), BUFFER_LENGTH);
}
static inline void __add_ipv4_attribute(const char* name, const uint32_t ip, const uint32_t port, bool comma){
char tmp[64];
__add_attribute(name, comma);
strncat(buffer, "\"", BUFFER_LENGTH);
__add_ipv4(ip, port);
strncat(buffer, "\"", BUFFER_LENGTH);
}
static inline void __add_machine_id(uint32_t value, bool comma){
char tmp[32];
__add_attribute("cf:machine_id", comma);
strncat(buffer, "\"cf:", BUFFER_LENGTH);
strncat(buffer, utoa(value, tmp, DECIMAL), BUFFER_LENGTH);
strncat(buffer, "\"", BUFFER_LENGTH);
}
|
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2015, Atmel 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:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/
#ifndef _HAMMING_
#define _HAMMING_
#include <stdint.h>
/*------------------------------------------------------------------------------
* Defines
*------------------------------------------------------------------------------*/
/**
* These are the possible errors when trying to verify a block of data encoded
* using a Hamming code:
*
* \section Errors
* - HAMMING_ERROR_SINGLEBIT
* - HAMMING_ERROR_ECC
* - HAMMING_ERROR_MULTIPLEBITS
*/
/** A single bit was incorrect but has been recovered. */
#define HAMMING_ERROR_SINGLEBIT 1
/** The original code has been corrupted. */
#define HAMMING_ERROR_ECC 2
/** Multiple bits are incorrect in the data and they cannot be corrected. */
#define HAMMING_ERROR_MULTIPLEBITS 3
/*------------------------------------------------------------------------------
* Exported functions
*------------------------------------------------------------------------------*/
void hamming_compute_256x(const uint8_t *data, uint32_t size, uint8_t *code);
extern uint8_t hamming_verify_256x(uint8_t *data, uint32_t size,
const uint8_t *code);
#endif /* _HAMMING_ */
|
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QImage>
#include <QPointer>
#include <QWidget>
#include <memory>
QT_BEGIN_NAMESPACE
class QLabel;
class QSettings;
QT_END_NAMESPACE
namespace Welcome {
namespace Internal {
struct Item
{
QString pointerAnchorObjectName;
QString title;
QString brief;
QString description;
};
class IntroductionWidget : public QWidget
{
Q_OBJECT
public:
explicit IntroductionWidget(QWidget *parent = nullptr);
static void askUserAboutIntroduction(QWidget *parent, QSettings *settings);
protected:
bool event(QEvent *e) override;
bool eventFilter(QObject *obj, QEvent *ev) override;
void paintEvent(QPaintEvent *ev) override;
void keyPressEvent(QKeyEvent *ke) override;
void mouseReleaseEvent(QMouseEvent *me) override;
private:
void finish();
void step();
void setStep(uint index);
void resizeToParent();
QWidget *m_textWidget;
QLabel *m_stepText;
QLabel *m_continueLabel;
QImage m_borderImage;
QString m_bodyCss;
std::vector<Item> m_items;
QPointer<QWidget> m_stepPointerAnchor;
uint m_step = 0;
};
} // namespace Internal
} // namespace Welcome
|
/*! @file RoboPedestrianState.h
@brief RoboPedestrian State
@author Jason Kulk, Aaron Wong
Copyright (c) 2010 Jason Kulk
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This file 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 NUbot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ENVIRONMENTALEMOTIONSSTATE_H
#define ENVIRONMENTALEMOTIONSSTATE_H
#include "Behaviour/BehaviourState.h"
class EnvironmentalProvider;
#include "debug.h"
class EnvironmentalEmotionsState : public BehaviourState
{
public:
EnvironmentalEmotionsState(EnvironmentalEmotionsProvider* parent) : m_parent(parent) {};
virtual ~EnvironmentalEmotionsState() {};
virtual BehaviourState* nextState() = 0;
virtual void doState() = 0;
protected:
EnvironmentalEmotionsProvider* m_parent;
};
#endif
|
#pragma once
#include "Score.h"
#include "ofxXmlSettings.h"
class Ranking: public ofxXmlSettings
{
public:
Ranking(void);
void saveXmlScore(Score score);
void loadXmlRanking();
Score getMaxScore(void);
private:
int numberOfSavedPoints;
vector<Score> rank;
};
|
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight 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 software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "drivers/io.h"
#include "drivers/pwm_output.h"
#include "pg/beeper_dev.h"
#include "sound_beeper.h"
#ifdef USE_BEEPER
static IO_t beeperIO = DEFIO_IO(NONE);
static bool beeperInverted = false;
static uint16_t beeperFrequency = 0;
#ifdef USE_PWM_OUTPUT
static pwmOutputPort_t beeperPwm;
static uint16_t freqBeep = 0;
static void pwmWriteBeeper(bool on)
{
if (!beeperPwm.io) {
return;
}
if (on) {
*beeperPwm.channel.ccr = (PWM_TIMER_1MHZ / freqBeep) / 2;
beeperPwm.enabled = true;
} else {
*beeperPwm.channel.ccr = 0;
beeperPwm.enabled = false;
}
}
static void pwmToggleBeeper(void)
{
pwmWriteBeeper(!beeperPwm.enabled);
}
static void beeperPwmInit(const ioTag_t tag, uint16_t frequency)
{
const timerHardware_t *timer = timerAllocate(tag, OWNER_BEEPER, 0);
IO_t beeperIO = IOGetByTag(tag);
if (beeperIO && timer) {
beeperPwm.io = beeperIO;
IOInit(beeperPwm.io, OWNER_BEEPER, 0);
#if defined(STM32F1)
IOConfigGPIO(beeperPwm.io, IOCFG_AF_PP);
#else
IOConfigGPIOAF(beeperPwm.io, IOCFG_AF_PP, timer->alternateFunction);
#endif
freqBeep = frequency;
pwmOutConfig(&beeperPwm.channel, timer, PWM_TIMER_1MHZ, PWM_TIMER_1MHZ / freqBeep, (PWM_TIMER_1MHZ / freqBeep) / 2, 0);
*beeperPwm.channel.ccr = 0;
beeperPwm.enabled = false;
}
}
#endif
#endif
void systemBeep(bool onoff)
{
#ifdef USE_BEEPER
if (beeperFrequency == 0) {
IOWrite(beeperIO, beeperInverted ? onoff : !onoff);
}
#ifdef USE_PWM_OUTPUT
else {
pwmWriteBeeper(onoff);
}
#endif
#else
UNUSED(onoff);
#endif
}
void systemBeepToggle(void)
{
#ifdef USE_BEEPER
if (beeperFrequency == 0) {
IOToggle(beeperIO);
}
#ifdef USE_PWM_OUTPUT
else {
pwmToggleBeeper();
}
#endif
#endif
}
void beeperInit(const beeperDevConfig_t *config)
{
#ifdef USE_BEEPER
beeperFrequency = config->frequency;
if (beeperFrequency == 0) {
beeperIO = IOGetByTag(config->ioTag);
beeperInverted = config->isInverted;
if (beeperIO) {
IOInit(beeperIO, OWNER_BEEPER, 0);
IOConfigGPIO(beeperIO, config->isOpenDrain ? IOCFG_OUT_OD : IOCFG_OUT_PP);
}
systemBeep(false);
}
#ifdef USE_PWM_OUTPUT
else {
const ioTag_t beeperTag = config->ioTag;
beeperPwmInit(beeperTag, beeperFrequency);
}
#endif
#else
UNUSED(config);
#endif
}
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM nsIProxiedChannel.idl
*/
#ifndef __gen_nsIProxiedChannel_h__
#define __gen_nsIProxiedChannel_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIProxyInfo; /* forward declaration */
/* starting interface: nsIProxiedChannel */
#define NS_IPROXIEDCHANNEL_IID_STR "6238f134-8c3f-4354-958f-dfd9d54a4446"
#define NS_IPROXIEDCHANNEL_IID \
{0x6238f134, 0x8c3f, 0x4354, \
{ 0x95, 0x8f, 0xdf, 0xd9, 0xd5, 0x4a, 0x44, 0x46 }}
/**
* An interface for accessing the proxy info that a channel was
* constructed with.
*
* @see nsIProxiedProtocolHandler
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsIProxiedChannel : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPROXIEDCHANNEL_IID)
/**
* Gets the proxy info the channel was constructed with. null or a
* proxyInfo with type "direct" mean no proxy.
*
* The returned proxy info must not be modified.
*/
/* readonly attribute nsIProxyInfo proxyInfo; */
NS_SCRIPTABLE NS_IMETHOD GetProxyInfo(nsIProxyInfo * *aProxyInfo) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIProxiedChannel, NS_IPROXIEDCHANNEL_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIPROXIEDCHANNEL \
NS_SCRIPTABLE NS_IMETHOD GetProxyInfo(nsIProxyInfo * *aProxyInfo);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIPROXIEDCHANNEL(_to) \
NS_SCRIPTABLE NS_IMETHOD GetProxyInfo(nsIProxyInfo * *aProxyInfo) { return _to GetProxyInfo(aProxyInfo); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIPROXIEDCHANNEL(_to) \
NS_SCRIPTABLE NS_IMETHOD GetProxyInfo(nsIProxyInfo * *aProxyInfo) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetProxyInfo(aProxyInfo); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsProxiedChannel : public nsIProxiedChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROXIEDCHANNEL
nsProxiedChannel();
private:
~nsProxiedChannel();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsProxiedChannel, nsIProxiedChannel)
nsProxiedChannel::nsProxiedChannel()
{
/* member initializers and constructor code */
}
nsProxiedChannel::~nsProxiedChannel()
{
/* destructor code */
}
/* readonly attribute nsIProxyInfo proxyInfo; */
NS_IMETHODIMP nsProxiedChannel::GetProxyInfo(nsIProxyInfo * *aProxyInfo)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIProxiedChannel_h__ */
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "InformationElements"
* found in "../asn/InformationElements.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#include "GSM-MS-RadioAccessCapability.h"
int
GSM_MS_RadioAccessCapability_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size >= 1 && size <= 64)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using OCTET_STRING,
* so here we adjust the DEF accordingly.
*/
static void
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_OCTET_STRING.free_struct;
td->print_struct = asn_DEF_OCTET_STRING.print_struct;
td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder;
td->der_encoder = asn_DEF_OCTET_STRING.der_encoder;
td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder;
td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder;
td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder;
td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_OCTET_STRING.per_constraints;
td->elements = asn_DEF_OCTET_STRING.elements;
td->elements_count = asn_DEF_OCTET_STRING.elements_count;
td->specifics = asn_DEF_OCTET_STRING.specifics;
}
void
GSM_MS_RadioAccessCapability_free(asn_TYPE_descriptor_t *td,
void *struct_ptr, int contents_only) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only);
}
int
GSM_MS_RadioAccessCapability_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
asn_dec_rval_t
GSM_MS_RadioAccessCapability_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const void *bufptr, size_t size, int tag_mode) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}
asn_enc_rval_t
GSM_MS_RadioAccessCapability_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}
asn_dec_rval_t
GSM_MS_RadioAccessCapability_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const char *opt_mname, const void *bufptr, size_t size) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}
asn_enc_rval_t
GSM_MS_RadioAccessCapability_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
asn_dec_rval_t
GSM_MS_RadioAccessCapability_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
}
asn_enc_rval_t
GSM_MS_RadioAccessCapability_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) {
GSM_MS_RadioAccessCapability_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
}
static asn_per_constraints_t asn_PER_type_GSM_MS_RadioAccessCapability_constr_1 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */,
0, 0 /* No PER value map */
};
static ber_tlv_tag_t asn_DEF_GSM_MS_RadioAccessCapability_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
};
asn_TYPE_descriptor_t asn_DEF_GSM_MS_RadioAccessCapability = {
"GSM-MS-RadioAccessCapability",
"GSM-MS-RadioAccessCapability",
GSM_MS_RadioAccessCapability_free,
GSM_MS_RadioAccessCapability_print,
GSM_MS_RadioAccessCapability_constraint,
GSM_MS_RadioAccessCapability_decode_ber,
GSM_MS_RadioAccessCapability_encode_der,
GSM_MS_RadioAccessCapability_decode_xer,
GSM_MS_RadioAccessCapability_encode_xer,
GSM_MS_RadioAccessCapability_decode_uper,
GSM_MS_RadioAccessCapability_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_GSM_MS_RadioAccessCapability_tags_1,
sizeof(asn_DEF_GSM_MS_RadioAccessCapability_tags_1)
/sizeof(asn_DEF_GSM_MS_RadioAccessCapability_tags_1[0]), /* 1 */
asn_DEF_GSM_MS_RadioAccessCapability_tags_1, /* Same as above */
sizeof(asn_DEF_GSM_MS_RadioAccessCapability_tags_1)
/sizeof(asn_DEF_GSM_MS_RadioAccessCapability_tags_1[0]), /* 1 */
&asn_PER_type_GSM_MS_RadioAccessCapability_constr_1,
0, 0, /* No members */
0 /* No specifics */
};
|
/*
* Image.h
*
* Author: ROBOTIS
*
*/
#ifndef _IMAGE_H_
#define _IMAGE_H_
namespace Robot
{
class Image
{
private:
protected:
public:
static const int YUV_PIXEL_SIZE = 4;
static const int RGB_PIXEL_SIZE = 3;
static const int HSV_PIXEL_SIZE = 4;
unsigned char *m_ImageData; /* pointer to aligned image data */
int m_Width; /* image width in pixels */
int m_Height; /* image height in pixels */
int m_PixelSize; /* pixel size in bytes */
int m_NumberOfPixels; /* number of pixels */
int m_WidthStep; /* size of aligned image row in bytes */
int m_ImageSize; /* image data size in bytes (=image->m_Height*image->m_WidthStep) */
unsigned int *y_table;
Image(int width, int height, int pixelsize);
virtual ~Image();
Image& operator = (Image &img);
};
class FrameBuffer
{
private:
protected:
public:
Image *m_YUVFrame;
Image *m_RGBFrame;
Image *m_HSVFrame;
FrameBuffer(int width, int height);
virtual ~FrameBuffer();
};
}
#endif
|
/*
auditory/syslatency.h
Measures latency of the whole system, i.e. signal delay, transduction,
RELACS - Relaxed ELectrophysiological data Acquisition, Control, and Stimulation
Copyright (C) 2002-2015 Jan Benda <jan.benda@uni-tuebingen.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
RELACS 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 _RELACS_AUDITORY_SYSLATENCY_H_
#define _RELACS_AUDITORY_SYSLATENCY_H_ 1
#include <relacs/repro.h>
#include <relacs/array.h>
#include <relacs/map.h>
#include <relacs/eventlist.h>
#include <relacs/multiplot.h>
#include <relacs/ephys/traces.h>
#include <relacs/acoustic/traces.h>
using namespace relacs;
namespace auditory {
/*!
\class SysLatency
\brief [RePro] Measures latency of the whole system, i.e. signal delay, transduction,
synapses, axonal delay, ...
\author Jan Benda
\par Options
- Stimulus
- \c rate=100Hz: Target firing rate (\c number)
- \c pwaves=10: Number of cycles of pertubation (\c integer)
- \c pintensity=10dB: Intensity of pertubations (\c number)
- \c minpintensity=4dB: Minimum intensity of pertubations (\c number)
- \c carrierfreq=5kHz: Frequency of carrier (\c number)
- \c usebestfreq=true: Use the cell's best frequency (\c boolean)
- \c ramp=2ms: Ramp of stimulus (\c number)
- \c duration=600ms: Duration of stimulus (\c number)
- \c pause=600ms: Pause (\c number)
- \c repeats=10: Number of stimulus repetitions (\c integer)
- \c side=left: Speaker (\c string)
- Analysis
- \c skipwin=100ms: Initial portion of stimulus not used for analysis (\c number)
- \c analysewin=10ms: Window used for ISI analysis (\c number)
- \c maxlat=10ms: Maximum latency (\c number)
- \c latstep=0.1ms: Resolution of latency (\c number)
- \c coincwin=0.5ms: Window width for coincident spikes (\c number)
\version 1.5 (Jan 10, 2008)
*/
class SysLatency : public RePro, public ephys::Traces, public acoustic::Traces
{
Q_OBJECT
public:
/*! Constructor. */
SysLatency( void );
/*! Destructor. */
~SysLatency( void );
virtual int main( void );
void saveSpikes( Options &header, const EventList &spikes );
void saveTrigger( Options &header, const ArrayD &trigger );
void saveCoincidentSpikes( Options &header, const MapD &coincidentspikes );
void savePRC( Options &header, const MapD &prc );
void save( double carrierfrequency, int side, double pduration,
double intensity,
const EventList &spikes, const ArrayD &trigger,
const MapD &coincidentspikes, const MapD &prc,
double spikewidth, double latency, double latencysd,
int maxcoincidence, double coinclatency,
double offset, double slope, double meanrate );
/*! Plot data. */
void plot( const MapD &coincidentspikes, const MapD &prc,
double coinclatency, double offset, double slope,
double meanrate );
/*! Analyze data. */
void analyze( double duration, double skipwin, double analysewin,
double pduration, double coincwin,
double maxlatency, double latencystep,
EventList &spikes, const ArrayD &trigger,
MapD &coincidentspikes, MapD &prc,
double &spikewidth, double &latency, double &latencysd,
int &maxcoincidence, double &coinclatency,
double &offset, double &slope, double &meanrate );
protected:
int coincidentSpikes( double coincwin, double latency, double offset,
const EventList &spikes, const ArrayD &trigger );
void phaseResponse( double duration, double skipwin, double analysewin,
double latency, const EventList &spikes,
const ArrayD &trigger, MapD &prc );
MultiPlot P;
};
}; /* namespace auditory */
#endif /* ! _RELACS_AUDITORY_SYSLATENCY_H_ */
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <codecompletion.h>
#include <clang-c/Index.h>
#include <QVector>
#include <iosfwd>
namespace ClangBackEnd {
class UnsavedFile;
class CodeCompletionsExtractor
{
public:
CodeCompletionsExtractor(const UnsavedFile &unsavedFile,
CXCodeCompleteResults *cxCodeCompleteResults);
CodeCompletionsExtractor(CodeCompletionsExtractor&) = delete;
CodeCompletionsExtractor &operator=(CodeCompletionsExtractor&) = delete;
CodeCompletionsExtractor(CodeCompletionsExtractor&&) = delete;
CodeCompletionsExtractor &operator=(CodeCompletionsExtractor&&) = delete;
bool next();
bool peek(const Utf8String &name);
CodeCompletions extractAll(bool onlyFunctionOverloads);
const CodeCompletion ¤tCodeCompletion() const;
private:
void extractCompletionKind();
void extractText();
void extractMethodCompletionKind();
void extractMacroCompletionKind();
void extractPriority();
void extractAvailability();
void extractHasParameters();
void extractBriefComment();
void extractCompletionChunks();
void extractRequiredFixIts();
void adaptPriority();
void decreasePriorityForNonAvailableCompletions();
void decreasePriorityForDestructors();
void decreasePriorityForSignals();
void decreasePriorityForQObjectInternals();
void decreasePriorityForOperators();
void handleCompletions(CodeCompletions &codeCompletions, bool onlyFunctionOverloads);
bool hasText(const Utf8String &text, CXCompletionString cxCompletionString) const;
private:
CodeCompletion currentCodeCompletion_;
const UnsavedFile &unsavedFile;
CXCompletionResult currentCxCodeCompleteResult{CXCursor_UnexposedDecl, nullptr};
CXCodeCompleteResults *cxCodeCompleteResults = nullptr;
uint cxCodeCompleteResultIndex = 0;
};
std::ostream &operator<<(std::ostream &os, const CodeCompletionsExtractor &extractor);
} // namespace ClangBackEnd
|
/*
* GMAMEUI
*
* Copyright 2010 Andrew Burton <adb@iinet.net.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
#ifndef __GMAMEUI_LISTOUTPUT_H__
#define __GMAMEUI_LISTOUTPUT_H__
#include "mame-exec.h"
#include "rom_entry.h"
G_BEGIN_DECLS
/* Preferences object */
#define GMAMEUI_TYPE_LISTOUTPUT (gmameui_listoutput_get_type ())
#define GMAMEUI_LISTOUTPUT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GMAMEUI_TYPE_LISTOUTPUT, GMAMEUIListOutput))
#define GMAMEUI_LISTOUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GMAMEUI_TYPE_LISTOUTPUT, GMAMEUIListOutputClass))
#define GMAMEUI_IS_LISTOUTPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GMAMEUI_TYPE_LISTOUTPUT))
#define GMAMEUI_IS_LISTOUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GMAMEUI_TYPE_LISTOUTPUT))
#define GMAMEUI_LISTOUTPUT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GMAMEUI_TYPE_LISTOUTPUT, GMAMEUIListOutputClass))
typedef struct _GMAMEUIListOutput GMAMEUIListOutput;
typedef struct _GMAMEUIListOutputClass GMAMEUIListOutputClass;
typedef struct _GMAMEUIListOutputPrivate GMAMEUIListOutputPrivate;
struct _GMAMEUIListOutput {
GObject parent;
GMAMEUIListOutputPrivate *priv;
/* define public instance variables here */
};
struct _GMAMEUIListOutputClass {
GObjectClass parent;
/* define vtable methods and signals here */
/* Signal prototypes */
//void (* listoutput_start) (GMAMEUIListOutput *parser);
//void (* listoutput_finish) (GMAMEUIListOutput *parser);
};
/* Preferences */
enum
{
PROP_LISTOUTPUT_0,
/* UI preferences */
NUM_LISTOUTPUT_PROPERTIES
};
GType gmameui_listoutput_get_type (void);
GMAMEUIListOutput* gmameui_listoutput_new (void);
void gmameui_listoutput_set_exec (GMAMEUIListOutput *parser, MameExec *exec);
gboolean gmameui_listoutput_parse (GMAMEUIListOutput *parser);
gboolean gmameui_listoutput_parse_stop (GMAMEUIListOutput *parser);
MameRomEntry* gmameui_listoutput_parse_rom (GMAMEUIListOutput *parser, MameExec *exec, MameRomEntry *rom);
gboolean gmameui_listoutput_generate_rom_hash (GMAMEUIListOutput *parser, MameExec *exec);
G_END_DECLS
#endif /* __GMAMEUI_LISTOUTPUT_H__ */
|
/*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "common.h"
#include "core/DataSerialiser.h"
#include <memory>
#include <set>
#include <string>
struct GameStateSnapshot_t;
struct GameStateSpriteChange_t
{
enum
{
REMOVED,
ADDED,
MODIFIED,
EQUAL
};
struct Diff_t
{
size_t offset;
size_t length;
const char* structname;
const char* fieldname;
uint64_t valueA;
uint64_t valueB;
};
uint8_t changeType;
uint8_t spriteIdentifier;
uint8_t miscIdentifier;
uint32_t spriteIndex;
std::vector<Diff_t> diffs;
};
struct GameStateCompareData_t
{
uint32_t tick;
uint32_t srand0Left;
uint32_t srand0Right;
std::vector<GameStateSpriteChange_t> spriteChanges;
};
/*
* Interface to create and capture game states. It only allows to have 32 active snapshots
* the oldest snapshot will be removed from the buffer. Never store the snapshot pointer
* as it may become invalid at any time when a snapshot is created, rather Link the snapshot
* to a specific tick which can be obtained by that later again assuming its still valid.
*/
interface IGameStateSnapshots
{
virtual ~IGameStateSnapshots() = default;
/*
* Removes all existing entries and starts over.
*/
virtual void Reset() = 0;
/*
* Creates a new empty snapshot, oldest snapshot will be removed.
*/
virtual GameStateSnapshot_t& CreateSnapshot() = 0;
/*
* Links the snapshot to a specific game tick.
*/
virtual void LinkSnapshot(GameStateSnapshot_t & snapshot, uint32_t tick, uint32_t srand0) = 0;
/*
* This will fill the snapshot with the current game state in a compact form.
*/
virtual void Capture(GameStateSnapshot_t & snapshot) = 0;
/*
* Returns the snapshot for a given tick in the history, nullptr if not found.
*/
virtual const GameStateSnapshot_t* GetLinkedSnapshot(uint32_t tick) const = 0;
/*
* Serialisation of GameStateSnapshot_t
*/
virtual void SerialiseSnapshot(GameStateSnapshot_t & snapshot, DataSerialiser & serialiser) const = 0;
/*
* Compares two states resulting GameStateCompareData_t with all mismatches stored.
*/
virtual GameStateCompareData_t Compare(const GameStateSnapshot_t& base, const GameStateSnapshot_t& cmp) const = 0;
/*
* Writes the GameStateCompareData_t into the specified file as readable text.
*/
virtual bool LogCompareDataToFile(const std::string& fileName, const GameStateCompareData_t& cmpData) const = 0;
};
std::unique_ptr<IGameStateSnapshots> CreateGameStateSnapshots();
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../inc/MarlinConfigPre.h"
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
#include "leds/leds.h"
#endif
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS) || ENABLED(CASE_LIGHT_USE_NEOPIXEL)
#define CASELIGHT_USES_BRIGHTNESS 1
#endif
class CaseLight {
public:
#if CASELIGHT_USES_BRIGHTNESS
static uint8_t brightness;
#endif
static bool on;
static void update(const bool sflag);
static inline void update_brightness() { update(false); }
static inline void update_enabled() { update(true); }
private:
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
static LEDColor color;
#endif
};
extern CaseLight caselight;
|
/* Test file for mpfr_asinh.
Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by the AriC and Caramel projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MPFR 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 the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <stdio.h>
#include <stdlib.h>
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_asinh
#include "tgeneric.c"
static void
special (void)
{
mpfr_t x, y, z;
mpfr_init (x);
mpfr_init (y);
MPFR_SET_INF(x);
mpfr_set_ui (y, 1, MPFR_RNDN);
mpfr_asinh (x, y, MPFR_RNDN);
if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
{
printf ("Inf flag not clears in asinh!\n");
exit (1);
}
MPFR_SET_NAN(x);
mpfr_asinh (x, y, MPFR_RNDN);
if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
{
printf ("NAN flag not clears in asinh!\n");
exit (1);
}
/* asinh(+0) = +0, asinh(-0) = -0 */
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_asinh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_asinh(+0) <> +0\n");
exit (1);
}
mpfr_neg (x, x, MPFR_RNDN);
mpfr_asinh (y, x, MPFR_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_asinh(-0) <> -0\n");
exit (1);
}
MPFR_SET_NAN(x);
mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
printf ("Error: mpfr_asinh(NaN) <> NaN\n");
exit (1);
}
mpfr_set_inf (x, 1);
mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: mpfr_asinh(+Inf) <> +Inf\n");
exit (1);
}
mpfr_set_inf (x, -1);
mpfr_asinh (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: mpfr_asinh(-Inf) <> -Inf\n");
exit (1);
}
mpfr_set_prec (x, 32);
mpfr_set_prec (y, 32);
mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1");
mpfr_asinh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "0.10100110010010101101010011011101E-1");
if (!mpfr_equal_p (x, y))
{
printf ("Error: mpfr_asinh (1)\n");
exit (1);
}
mpfr_set_str_binary (x, "-.10110011011010111110010001100001");
mpfr_asinh (x, x, MPFR_RNDN);
mpfr_set_str_binary (y, "-.10100111010000111001011100110011");
if (!mpfr_equal_p (x, y))
{
printf ("Error: mpfr_asinh (2)\n");
exit (1);
}
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
mpfr_set_str_binary (x, "0.111001101100000110011001010000101");
mpfr_asinh (y, x, MPFR_RNDZ);
mpfr_init2 (z, 43);
mpfr_set_str_binary (z, "0.1100111101010101101010101110000001000111001");
if (!mpfr_equal_p (y, z))
{
printf ("Error: mpfr_asinh (3)\n");
exit (1);
}
mpfr_set_prec (x, 53);
mpfr_set_prec (y, 2);
mpfr_set_str (x, "1.8000000000009@-6", 16, MPFR_RNDN);
mpfr_asinh (y, x, MPFR_RNDZ);
mpfr_set_prec (z, 2);
mpfr_set_str (z, "1.0@-6", 16, MPFR_RNDN);
if (!mpfr_equal_p (y, z))
{
printf ("Error: mpfr_asinh (4)\n");
exit (1);
}
mpfr_clear (x);
mpfr_clear (y);
mpfr_clear (z);
}
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
special ();
test_generic (2, 100, 25);
data_check ("data/asinh", mpfr_asinh, "mpfr_asinh");
bad_cases (mpfr_asinh, mpfr_sinh, "mpfr_asinh", 256, -128, 29,
4, 128, 800, 40);
tests_end_mpfr ();
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "baseenginedebugclient.h"
namespace QmlDebug {
class QmlDebugConnection;
class QMLDEBUG_EXPORT DeclarativeEngineDebugClient : public BaseEngineDebugClient
{
Q_OBJECT
public:
explicit DeclarativeEngineDebugClient(QmlDebugConnection *conn);
quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
const QVariant &bindingExpression,
bool isLiteralValue,
QString source, int line);
quint32 resetBindingForObject(int objectDebugId, const QString &propertyName);
quint32 setMethodBody(int objectDebugId, const QString &methodName,
const QString &methodBody);
protected:
void messageReceived(const QByteArray &data);
};
} // namespace QmlDebug
|
/*
* Include files
*/
#include "../pblas.h"
#include "../PBpblas.h"
#include "../PBtools.h"
#include "../PBblacs.h"
#include "../PBblas.h"
//WCC:add
// To disable warnings generated by gcc-9.
void wcc_Cigebs2d(int ConTxt, char *scope, char *top, int m, int n, char *A,
int lda)
{
Cigebs2d(ConTxt, scope, top, m, n, (int*) A, lda);
}
void wcc_Cigebr2d(int ConTxt, char *scope, char *top, int m, int n, char *A,
int lda, int rsrc, int csrc)
{
Cigebr2d(ConTxt, scope, top, m, n, (int*) A, lda, rsrc, csrc);
}
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef MANAGEDEFINITIONSDIALOG_H
#define MANAGEDEFINITIONSDIALOG_H
#include "ui_managedefinitionsdialog.h"
#include "highlightdefinitionmetadata.h"
#include <QtCore/QList>
namespace TextEditor {
namespace Internal {
class ManageDefinitionsDialog : public QDialog
{
Q_OBJECT
public:
explicit ManageDefinitionsDialog(const QList<HighlightDefinitionMetaData> &metaDataList,
const QString &path,
QWidget *parent = 0);
protected:
void changeEvent(QEvent *e);
private slots:
void downloadDefinitions();
void selectAll();
void clearSelection();
void invertSelection();
private:
void populateDefinitionsWidget();
QList<HighlightDefinitionMetaData> m_definitionsMetaData;
QString m_path;
Ui::ManageDefinitionsDialog ui;
};
} // namespace Internal
} // namespace TextEditor
#endif // MANAGEDEFINITIONSDIALOG_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.