text stringlengths 4 6.14k |
|---|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/luni/src/main/java/java/nio/ByteOrder.java
//
#ifndef _JavaNioByteOrder_H_
#define _JavaNioByteOrder_H_
#include "J2ObjC_header.h"
@interface JavaNioByteOrder : NSObject {
@public
jboolean needsSwap_;
}
+ (JavaNioByteOrder *)nativeOrder;
- (NSString *)description;
@end
FOUNDATION_EXPORT BOOL JavaNioByteOrder_initialized;
J2OBJC_STATIC_INIT(JavaNioByteOrder)
CF_EXTERN_C_BEGIN
FOUNDATION_EXPORT JavaNioByteOrder *JavaNioByteOrder_nativeOrder();
FOUNDATION_EXPORT JavaNioByteOrder *JavaNioByteOrder_NATIVE_ORDER_;
J2OBJC_STATIC_FIELD_GETTER(JavaNioByteOrder, NATIVE_ORDER_, JavaNioByteOrder *)
FOUNDATION_EXPORT JavaNioByteOrder *JavaNioByteOrder_BIG_ENDIAN__;
J2OBJC_STATIC_FIELD_GETTER(JavaNioByteOrder, BIG_ENDIAN__, JavaNioByteOrder *)
FOUNDATION_EXPORT JavaNioByteOrder *JavaNioByteOrder_LITTLE_ENDIAN__;
J2OBJC_STATIC_FIELD_GETTER(JavaNioByteOrder, LITTLE_ENDIAN__, JavaNioByteOrder *)
CF_EXTERN_C_END
J2OBJC_TYPE_LITERAL_HEADER(JavaNioByteOrder)
#endif // _JavaNioByteOrder_H_
|
/*
* TMF
* Copyright (C) TMF Team
*
* 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 DF_EQUALIZEHIST_H_
#define DF_EQUALIZEHIST_H_
#include "core/df.h"
#include "tokens/opencv/mat.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <string>
using namespace std;
class EqualizeHist: public df::Actor {
private:
df::InputPort<df::Mat> * input;
df::OutputPort<df::Mat> * output;
static df::ActorRegister<EqualizeHist> reg;
public:
EqualizeHist(const string& name);
virtual void init();
virtual void run();
virtual ~EqualizeHist();
};
#endif /* DF_CVTCOLOR_H_ */
|
/*---------------------------------------------------------------------------*
* <RCS keywords>
*
* C++ Library
*
* Copyright 1992-1994, David Gottner
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice, this permission notice and
* the following disclaimer notice appear unmodified in all copies.
*
* I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL I
* BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Nevertheless, I would like to know about bugs in this library or
* suggestions for improvment. Send bug reports and feedback to
* davegottner@delphi.com.
*---------------------------------------------------------------------------*/
/* Modified to support --help and --version, as well as /? on Windows
* by Georg Brandl. */
#include <Python.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include <pygetopt.h>
#ifdef __cplusplus
extern "C" {
#endif
int _PyOS_opterr = 1; /* generate error messages */
int _PyOS_optind = 1; /* index into argv array */
wchar_t *_PyOS_optarg = NULL; /* optional argument */
int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring)
{
static wchar_t *opt_ptr = L"";
wchar_t *ptr;
wchar_t option;
if (*opt_ptr == '\0') {
if (_PyOS_optind >= argc)
return -1;
#ifdef MS_WINDOWS
else if (wcscmp(argv[_PyOS_optind], L"/?") == 0) {
++_PyOS_optind;
return 'h';
}
#endif
else if (argv[_PyOS_optind][0] != L'-' ||
argv[_PyOS_optind][1] == L'\0' /* lone dash */ )
return -1;
else if (wcscmp(argv[_PyOS_optind], L"--") == 0) {
++_PyOS_optind;
return -1;
}
else if (wcscmp(argv[_PyOS_optind], L"--help") == 0) {
++_PyOS_optind;
return 'h';
}
else if (wcscmp(argv[_PyOS_optind], L"--version") == 0) {
++_PyOS_optind;
return 'V';
}
opt_ptr = &argv[_PyOS_optind++][1];
}
if ( (option = *opt_ptr++) == L'\0')
return -1;
if (option == 'J') {
fprintf(stderr, "-J is reserved for Jython\n");
return '_';
}
if ((ptr = wcschr(optstring, option)) == NULL) {
if (_PyOS_opterr)
fprintf(stderr, "Unknown option: -%c\n", (char)option);
return '_';
}
if (*(ptr + 1) == L':') {
if (*opt_ptr != L'\0') {
_PyOS_optarg = opt_ptr;
opt_ptr = L"";
}
else {
if (_PyOS_optind >= argc) {
if (_PyOS_opterr)
fprintf(stderr,
"Argument expected for the -%c option\n", (char)option);
return '_';
}
_PyOS_optarg = argv[_PyOS_optind++];
}
}
return option;
}
#ifdef __cplusplus
}
#endif
|
/* Framework for Live Image Transformation (FLITr)
* Copyright (c) 2010 CSIR
*
* This file is part of FLITr.
*
* FLITr 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.
*
* FLITr 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 FLITr. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef FIP_DEINTERLACE_H
#define FIP_DEINTERLACE_H
#include <flitr/image_processor.h>
//# Removed this namespace entending for IPF deinterlace to work
namespace flitr{
enum FLITR_DEINTERLACE_METHODS {smoothFilter, linear, interframe};
/*! De-interlaces a video scream. The performance is independent of the number of frames. */
class FLITR_EXPORT FIPDeinterlace : public ImageProcessor{
private:
//Count all the images
unsigned int imageCount = 0;
flitr::Image * imReadPrevious; // = NULL;
float * dataDeinterlacedIm;
flitr::Image * deinterlacedIm;
public:
/*#include "fip_deinterlace.h"! Constructor given the upstream producer.
*@param upStreamProducer The upstream image producer.
*@param images_per_slot The number of images per image slot from the upstream producer.
*@param buffer_size The size of the shared image buffer of the downstream producer.*/
FIPDeinterlace(ImageProducer& upStreamProducer, uint32_t images_per_slot,
uint32_t buffer_size=FLITR_DEFAULT_SHARED_BUFFER_NUM_SLOTS, FLITR_DEINTERLACE_METHODS method = FLITR_DEINTERLACE_METHODS::interframe);
/*! Virtual destructor */
virtual ~FIPDeinterlace();
/*! Method to initialise the object.
*@return Boolean result flag. True indicates successful initialisation.*/
virtual bool init();
/*!Synchronous trigger method. Called automatically by the trigger thread if started.
*@sa ImageProcessor::startTriggerThread*/
virtual bool trigger();
private:
flitr::FLITR_DEINTERLACE_METHODS _method;
/*! The sum images per slot. */
std::vector<float *> resultImageVec_;
/*! Three Consecutive images for Deinterlace filter */
std::vector<float *> currentImageVec_;
/*! Pixel on the same position of the 2 consecutive image */
float * PixelsOnSamePosition = NULL;
/*! The history ring buffer/vector for each image in the slot. */
//std::vector<std::vector<float * > > historyImageVecVec_;
//size_t oldestHistorySlot_;
};
}
#endif //FIP_DEINTERLACE_H
|
/**
* Additional settings for the win32 port.
*/
#define PCAPIF_LIB_QUIET
#define PCAPIF_HANDLE_LINKSTATE 0
#define PCAPIF_FILTER_GROUP_ADDRESSES 0
/* remember to change this MAC address to suit your needs!
the last octet will be increased by netif->num for each netif */
#define LWIP_MAC_ADDR_BASE \
{ \
0x00, 0x01, 0x02, 0x03, 0x04, 0x05 \
}
|
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Types and macros used internally by the heap.
*/
#ifndef _DALVIK_ALLOC_HEAP_INTERNAL
#define _DALVIK_ALLOC_HEAP_INTERNAL
#include <time.h> // for struct timespec
#include "HeapTable.h"
#include "MarkSweep.h"
struct GcHeap {
HeapSource *heapSource;
/* List of heap objects that will require finalization when
* collected. I.e., instance objects
*
* a) whose class definitions override java.lang.Object.finalize()
*
* *** AND ***
*
* b) that have never been finalized.
*
* Note that this does not exclude non-garbage objects; this
* is not the list of pending finalizations, but of objects that
* potentially have finalization in their futures.
*/
LargeHeapRefTable *finalizableRefs;
/* The list of objects that need to have finalize() called
* on themselves. These references are part of the root set.
*
* This table is protected by gDvm.heapWorkerListLock, which must
* be acquired after the heap lock.
*/
LargeHeapRefTable *pendingFinalizationRefs;
/* Linked lists of subclass instances of java/lang/ref/Reference
* that we find while recursing. The "next" pointers are hidden
* in the objects' <code>int Reference.vmData</code> fields.
* These lists are cleared and rebuilt each time the GC runs.
*/
Object *softReferences;
Object *weakReferences;
Object *phantomReferences;
/* The list of Reference objects that need to be cleared and/or
* enqueued. The bottom two bits of the object pointers indicate
* whether they should be cleared and/or enqueued.
*
* This table is protected by gDvm.heapWorkerListLock, which must
* be acquired after the heap lock.
*/
LargeHeapRefTable *referenceOperations;
/* If non-null, the method that the HeapWorker is currently
* executing.
*/
Object *heapWorkerCurrentObject;
Method *heapWorkerCurrentMethod;
/* If heapWorkerCurrentObject is non-null, this gives the time when
* HeapWorker started executing that method. The time value must come
* from dvmGetRelativeTimeUsec().
*
* The "Cpu" entry tracks the per-thread CPU timer (when available).
*/
u8 heapWorkerInterpStartTime;
u8 heapWorkerInterpCpuStartTime;
/* If any fields are non-zero, indicates the next (absolute) time that
* the HeapWorker thread should call dvmHeapSourceTrim().
*/
struct timespec heapWorkerNextTrim;
/* The current state of the mark step.
* Only valid during a GC.
*/
GcMarkContext markContext;
/* GC's card table */
u1* cardTableBase;
size_t cardTableLength;
/* Is the GC running? Used to avoid recursive calls to GC.
*/
bool gcRunning;
/*
* Debug control values
*/
int ddmHpifWhen;
int ddmHpsgWhen;
int ddmHpsgWhat;
int ddmNhsgWhen;
int ddmNhsgWhat;
#if WITH_HPROF
bool hprofDumpOnGc;
const char* hprofFileName;
int hprofFd;
hprof_context_t *hprofContext;
int hprofResult;
bool hprofDirectToDdms;
#endif
};
bool dvmLockHeap(void);
void dvmUnlockHeap(void);
void dvmLogGcStats(size_t numFreed, size_t sizeFreed, size_t gcTimeMs);
void dvmLogMadviseStats(size_t madvisedSizes[], size_t arrayLen);
/*
* Logging helpers
*/
#define HEAP_LOG_TAG LOG_TAG "-heap"
#if LOG_NDEBUG
#define LOGV_HEAP(...) ((void)0)
#define LOGD_HEAP(...) ((void)0)
#else
#define LOGV_HEAP(...) LOG(LOG_VERBOSE, HEAP_LOG_TAG, __VA_ARGS__)
#define LOGD_HEAP(...) LOG(LOG_DEBUG, HEAP_LOG_TAG, __VA_ARGS__)
#endif
#define LOGI_HEAP(...) LOG(LOG_INFO, HEAP_LOG_TAG, __VA_ARGS__)
#define LOGW_HEAP(...) LOG(LOG_WARN, HEAP_LOG_TAG, __VA_ARGS__)
#define LOGE_HEAP(...) LOG(LOG_ERROR, HEAP_LOG_TAG, __VA_ARGS__)
#define QUIET_ZYGOTE_GC 1
#if QUIET_ZYGOTE_GC
#undef LOGI_HEAP
#define LOGI_HEAP(...) \
do { \
if (!gDvm.zygote) { \
LOG(LOG_INFO, HEAP_LOG_TAG, __VA_ARGS__); \
} \
} while (false)
#endif
#define FRACTIONAL_MB(n) (n) / (1024 * 1024), \
((((n) % (1024 * 1024)) / 1024) * 1000) / 1024
#define FRACTIONAL_PCT(n,max) ((n) * 100) / (max), \
(((n) * 1000) / (max)) % 10
#endif // _DALVIK_ALLOC_HEAP_INTERNAL
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/elasticache/ElastiCache_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace ElastiCache
{
namespace Model
{
enum class DestinationType
{
NOT_SET,
cloudwatch_logs,
kinesis_firehose
};
namespace DestinationTypeMapper
{
AWS_ELASTICACHE_API DestinationType GetDestinationTypeForName(const Aws::String& name);
AWS_ELASTICACHE_API Aws::String GetNameForDestinationType(DestinationType value);
} // namespace DestinationTypeMapper
} // namespace Model
} // namespace ElastiCache
} // namespace Aws
|
//
// ActionSheetPicker.h
// ActionSheetPicker
//
// Created by on 13/03/2012.
// Copyright (c) 2012 Club 15CC. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AbstractActionSheetPicker.h"
#import "ActionSheetCustomPickerDelegate.h"
@interface ActionSheetCustomPicker : AbstractActionSheetPicker
{
}
/////////////////////////////////////////////////////////////////////////
#pragma mark - Properties
/////////////////////////////////////////////////////////////////////////
@property(nonatomic, weak) id <ActionSheetCustomPickerDelegate> delegate;
/////////////////////////////////////////////////////////////////////////
#pragma mark - Init Methods
/////////////////////////////////////////////////////////////////////////
/** Designated init */
- (instancetype)initWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin;
- (instancetype)initWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin initialSelections:(NSArray *)initialSelections;
/** Convenience class method for creating an launched */
+ (instancetype)showPickerWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin;
+ (instancetype)showPickerWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin initialSelections:(NSArray *)initialSelections;
@end
|
/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <string>
#include <vector>
#include "LayerGradUtil.h"
#include "paddle/gserver/layers/MKLDNNBase.h"
#include "paddle/gserver/layers/MKLDNNLayer.h"
namespace paddle {
/**
* @brief test the functionality of MKLDNNlayers and MKLDNNActivations
* refer to paddle original function
*/
class MKLDNNTester {
enum {
DNN = 0, // MKLDNN layer
REF = 1, // Reference layer
NUM = 2, // Number of total
};
struct DataIn {
std::vector<std::vector<Argument>> inArgs;
std::vector<std::vector<MatrixPtr>> outGrads;
std::vector<VectorPtr> paraValues;
};
struct DataOut {
std::vector<MatrixPtr> outValues;
std::vector<VectorPtr> paraValues;
};
protected:
std::vector<TestConfig> configs_;
vector<string> layerNames_;
vector<vector<DataLayerPtr>> dataLayers_;
vector<vector<Argument>> datas_;
vector<LayerMap> layerMaps_;
vector<vector<ParameterPtr>> parameters_;
vector<LayerPtr> testLayers_;
LayerPtr refLayer_, dnnLayer_;
/// run some iterations, all the result should pass
size_t iter_;
/// whether to print out the details
bool log_;
/// epsilon
float eps_;
/// input image size, default 1
size_t ih_, iw_;
/// passType, PASS_TRAIN, PASS_TEST or PASS_GC (Gradient Check pass)
PassType passType_;
public:
explicit MKLDNNTester(size_t iter = 3, float epsilon = 1e-4) {
iter_ = iter;
eps_ = epsilon;
log_ = false;
passType_ = PASS_TRAIN;
}
~MKLDNNTester() {}
public:
void run(const TestConfig& dnn,
const TestConfig& ref,
size_t batchSize,
size_t inputImgH = 1,
size_t inputImgW = 1,
PassType passType = PASS_TRAIN,
bool printDetails = false,
size_t iter = 3,
float epsilon = 1e-4);
static void runNetTest(const std::string& configPath,
size_t iter = 2,
float eps = 1e-4);
static void initArgument(DataIn& data,
const std::string& configPath,
size_t iter = 2);
static void getOutResult(const std::string& configPath,
DataIn& in,
DataOut& out,
bool use_mkldnn,
size_t iter = 2);
private:
void reset(const TestConfig& dnn, const TestConfig& ref, size_t batchSize);
void setInputImgSize();
void runOnce();
void randomWgtDatas();
void randomBotDatas();
void randomTopDiffs();
void checkForward();
void checkBackwardData();
void checkBackwardWgts();
// clear specific layer, clear all when id equals NUM
void clearWgtDiffs(size_t id = NUM);
void clearBotDiffs(size_t id = NUM);
void clearTopDatas(size_t id = NUM);
void printTopDatas();
void printMatrix(const MatrixPtr& m);
void printVector(const VectorPtr& v);
void saveWgt(const vector<ParameterPtr>& from, vector<VectorPtr>& to);
void restoreWgt(const vector<VectorPtr>& from, vector<ParameterPtr>& to);
static double compareMatrix(const MatrixPtr& m1, const MatrixPtr& m2);
static double compareVector(const VectorPtr& v1, const VectorPtr& v2);
static void compareResult(DataOut& ref, DataOut& dnn, float eps = 1e-4);
/**
* Get delta percent
* if many(>failRate) wrong(abs(val-ref)/abs(ref) > thres) points
* return the max(diff/ref)
* else return sum(abs(diff)) / sum(abs(ref))
* The return value should be smaller than eps when passing.
*/
static double getDelta(const real* refer,
const real* value,
size_t len,
const float failRate = 1e-3,
const float thres = 0.1);
};
} // namespace paddle
|
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file
* @brief hysteresis filter
*/
#ifndef MODULES_CONTROL_COMMON_HYSTERESIS_FILTER_H_
#define MODULES_CONTROL_COMMON_HYSTERESIS_FILTER_H_
/**
* @namespace apollo::control
* @brief apollo::control
*/
namespace apollo {
namespace control {
class HysteresisFilter {
public:
HysteresisFilter() = default;
void filter(const double input_value, const double threshold,
const double hysteresis_upper, const double hysteresis_lower,
int *state, double *output_value);
private:
int previous_state_ = 0;
};
} // namespace control
} // namespace apollo
#endif // MODULES_CONTROL_COMMON_HYSTERESIS_FILTER_H_
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define SUCCESS 0
//Header field
typedef struct
{
char header_name[4096];
char header_value[4096];
} Request_header;
//HTTP Request Header
typedef struct
{
char http_version[50];
char http_method[50];
char http_uri[4096];
Request_header *headers;
int header_count;
} Request;
Request* parse(char *buffer, int size,int socketFd);
|
//
// YLTest1ViewController.h
// YLSinaBlog
//
// Created by LongMa on 15/11/29.
// Copyright © 2015年 LongMa. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface YLTest1ViewController : UIViewController
@end
|
/*
* Copyright 2013-2015 Guardtime, Inc.
*
* This file is part of the Guardtime client SDK.
*
* 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, CONDITIONS, OR OTHER LICENSES OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* "Guardtime" and "KSI" are trademarks or registered trademarks of
* Guardtime, Inc., and no license to trademarks is granted; Guardtime
* reserves and retains all trademark rights.
*/
#include <stdio.h>
#include <ksi/ksi.h>
static size_t parseCount = 1000000;
int main() {
int res = KSI_UNKNOWN_ERROR;
KSI_CTX *ksi = NULL;
unsigned char raw[0xffff];
unsigned len;
FILE *f = NULL;
time_t start;
time_t end;
size_t count = 0;
KSI_AggregationPdu *pdu = NULL;
unsigned char *serialized = NULL;
unsigned serialized_len;
res = KSI_CTX_new(&ksi);
if (res != KSI_OK) {
fprintf(stderr, "Unable to create KSI context.\n");
goto cleanup;
}
f = fopen("test/resource/tlv/ok-sig-2014-07-01.1-aggr_response.tlv", "rb");
if (f == NULL) {
fprintf(stderr, "Unable to open input.\n");
goto cleanup;
}
len = fread(raw, 1, sizeof(raw), f);
printf("Len = %d\n", len);
res = KSI_AggregationPdu_parse(ksi, raw, len, &pdu);
if (res != KSI_OK) {
KSI_ERR_statusDump(ksi, stderr);
fprintf(stderr, "Failed to parse PDU.\n");
goto cleanup;
}
time(&start);
for (count = 0; count < parseCount; count++) {
res = KSI_AggregationPdu_serialize(pdu, &serialized, &serialized_len);
if (res != KSI_OK) {
KSI_ERR_statusDump(ksi, stderr);
fprintf(stderr, "Failed to serialize PDU.\n");
goto cleanup;
}
KSI_free(serialized);
serialized = NULL;
}
time(&end);
printf("Serialized %llu PDUs in %lld seconds. (one in %0.2f ms)\n", (unsigned long long)parseCount, (unsigned long long)end - start, (double)(end - start) * 1000 / parseCount);
res = KSI_OK;
cleanup:
KSI_free(serialized);
KSI_AggregationPdu_free(pdu);
KSI_CTX_free(ksi);
if (f != NULL) fclose(f);
return res;
}
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkFrequencyDomain1DFilterFunction_h
#define itkFrequencyDomain1DFilterFunction_h
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace itk
{
/** \class FrequencyDomain1DFilterFunction
* \brief
* Class to implment filter functions for FrequencyDomain1DImageFilter
*
* Supports caching of precomputed function values (SetUseCache) for applying
* the function to multiple signals of the same length.
* For the caching to work properly make sure this->Modified gets called in subclasses
* whenever a parmater is changed that changes the function values.
*
* \ingroup FourierTransform
* \ingroup Ultrasound
*/
class FrequencyDomain1DFilterFunction : public Object
{
public:
/** Standard class type alias. */
using Self = FrequencyDomain1DFilterFunction;
using Superclass = Object;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkTypeMacro(FrequencyDomain1DFilterFunction, Object);
itkNewMacro(Self);
/** discrete frequency index such as retunr by FFTW, i.e.
* 0 is DC component
* i / SignalSize * 2*pi is the frequency,
* i.e., first half positive frequencies and
* second half negative frequencies in reverse order.
*/
double
EvaluateIndex(SizeValueType & i) const
{
if (m_UseCache)
{
// TODO: Check for out of bounds?
return m_Cache[i];
}
else
{
return this->EvaluateFrequency(this->GetFrequency(i));
}
}
void
SetSignalSize(const SizeValueType & size)
{
if (this->m_SignalSize != size)
{
this->m_SignalSize = size;
if (this->m_UseCache)
{
this->m_Cache.resize(size);
}
this->Modified();
}
}
SizeValueType
GetSignalSize() const
{
return m_SignalSize;
}
itkSetMacro(UseCache, bool);
itkGetMacro(UseCache, bool);
/**
* Override this function to implement a specific filter.
* The input ranges from -1 to 1
* Default is identity function.
*/
virtual double
EvaluateFrequency(double itkNotUsed(frequency)) const
{
return 1.0;
}
virtual void
Modified() const override
{
// Force a chache update
const_cast<FrequencyDomain1DFilterFunction *>(this)->UpdateCache();
Superclass::Modified();
}
protected:
virtual void
PrintSelf(std::ostream & os, Indent indent) const override
{
Superclass::PrintSelf(os, indent);
os << indent << "SignalSize: " << m_SignalSize << std::endl;
os << indent << "UseCache: " << m_UseCache << std::endl;
os << indent << "CacheSize: " << m_Cache.size() << std::endl;
}
FrequencyDomain1DFilterFunction()
{
m_UseCache = true;
m_SignalSize = 0;
}
private:
double
GetFrequency(SizeValueType & i) const
{
double f = (2.0 * i) / m_SignalSize;
if (f > 1.0)
{
f = f - 2.0;
}
return f;
}
void
UpdateCache()
{
if (this->m_UseCache)
{
for (SizeValueType i = 0; i < m_Cache.size(); i++)
{
this->m_Cache[i] = this->EvaluateFrequency(this->GetFrequency(i));
}
}
}
bool m_UseCache;
std::vector<double> m_Cache;
SizeValueType m_SignalSize;
};
} // namespace itk
#endif // itkFrequencyDomain1DFilterFunction.h
|
//
// NSString+VBBase64.h
// Gongyu
//
// Created by Vision on 16/4/19.
// Copyright © 2016年 VisionBao. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (VBBase64)
+ (NSString *)vb_stringWithBase64EncodedString:(NSString *)string;
- (NSString *)vb_base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth;
- (NSString *)vb_base64EncodedString;
- (NSString *)vb_base64DecodedString;
- (NSData *)vb_base64DecodedData;
@end
|
/*
Copyright 2017 Thomas Krause <thomaskrause@posteo.de>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <annis/iterators.h> // for Iterator
#include <annis/types.h> // for Match
#include <stddef.h> // for size_t
#include <deque> // for deque, deque<>::const_iterator
#include <memory> // for shared_ptr
#include <vector> // for vector
namespace annis { class Operator; } // lines 27-27
namespace annis
{
/**
* A join that checks all combinations of the left and right matches if their are connected.
*
* @param lhsIdx the column of the LHS tuple to join on
* @param rhsIdx the column of the RHS tuple to join on
*/
class NestedLoopJoin : public Iterator
{
public:
NestedLoopJoin(std::shared_ptr<Operator> op,
std::shared_ptr<Iterator> lhs, std::shared_ptr<Iterator> rhs,
size_t lhsIdx, size_t rhsIdx,
bool materializeInner=true,
bool leftIsOuter=true);
virtual ~NestedLoopJoin();
virtual bool next(std::vector<Match>& tuple) override;
virtual void reset() override;
private:
std::shared_ptr<Operator> op;
const bool materializeInner;
const bool leftIsOuter;
bool initialized;
std::vector<Match> matchOuter;
std::vector<Match> matchInner;
std::shared_ptr<Iterator> outer;
std::shared_ptr<Iterator> inner;
const size_t outerIdx;
const size_t innerIdx;
bool firstOuterFinished;
std::deque<std::vector<Match>> innerCache;
std::deque<std::vector<Match>>::const_iterator itInnerCache;
private:
bool fetchNextInner();
};
} // end namespace annis
|
#ifndef GEOLOCATION_RANKER_H_
#define GEOLOCATION_RANKER_H_
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <search-manager/CustomRankTreeParser.h>
#include <common/inttypes.h>
namespace sf1r
{
class NumericPropertyTableBuilder;
class GeoLocationRanker
{
public:
GeoLocationRanker(
double scope,
const std::pair<double, double>& reference,
const boost::shared_ptr<NumericPropertyTableBase>& propertyTable);
~GeoLocationRanker();
double evaluate(docid_t& docid);
inline bool checkScope(double distance) const {
if(scope_ <= 0.0) return true;
return distance <= scope_ ? true : false;
}
inline double getScope() const {
return scope_;
}
private:
double scope_;
std::pair<double, double> reference_;
boost::shared_ptr<NumericPropertyTableBase> propertyTable_;
};
typedef boost::shared_ptr<GeoLocationRanker> GeoLocationRankerPtr;
}
#endif
|
/** @file
@brief Header
@date 2016
@author
Sensics, Inc.
<http://sensics.com/osvr>
*/
// Copyright 2016 Sensics, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
#define INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
// Internal Includes
// - none
// Library/third-party includes
#include <osvr/Util/EigenCoreGeometry.h>
// Standard includes
// - none
namespace osvr {
namespace vbtracker {
template <typename Derived>
inline Eigen::Matrix<typename Derived::Scalar, 3, 3>
skewSymmetricCrossProductMatrix3(Eigen::MatrixBase<Derived> const &vec) {
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
using Scalar = typename Derived::Scalar;
using MatrixType = Eigen::Matrix<Scalar, 3, 3>;
MatrixType ret;
ret << Scalar(0), -(vec[2]), vec[1], // row 0
vec[2], Scalar(0), -(vec[0]), // row 1
-(vec[1]), vec[0], Scalar(0); // row 2
return ret;
}
} // namespace vbtracker
} // namespace osvr
#endif // INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
|
//
// CBLIndex.h
// CouchbaseLite
//
// Copyright (c) 2018 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
CBLIndex represents an index which could be a value index for regular queries or
full-text index for full-text queries (using the match operator).
*/
@interface CBLIndex : NSObject
/** Not available */
- (instancetype) init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
|
/* FBSDKAuthenticationTokenStatusChecker_h */
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright 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 <Foundation/Foundation.h>
@interface FBSDKAuthenticationStatusUtility : NSObject
/**
Fetches the latest authentication status from server. This will invalidate
the current user session if the returned status is not authorized.
*/
+ (void)checkAuthenticationStatus;
@end
|
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(tb_new__doc__,
"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
"--\n"
"\n"
"Create a new traceback object.");
static PyObject *
tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame,
int tb_lasti, int tb_lineno);
static PyObject *
tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "TracebackType", 0};
PyObject *argsbuf[4];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *tb_next;
PyFrameObject *tb_frame;
int tb_lasti;
int tb_lineno;
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf);
if (!fastargs) {
goto exit;
}
tb_next = fastargs[0];
if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
_PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
goto exit;
}
tb_frame = (PyFrameObject *)fastargs[1];
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tb_lasti = _PyLong_AsInt(fastargs[2]);
if (tb_lasti == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(fastargs[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tb_lineno = _PyLong_AsInt(fastargs[3]);
if (tb_lineno == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno);
exit:
return return_value;
}
/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/
|
#ifndef ALI_ECS_REMOVE_TAGS_TYPESH
#define ALI_ECS_REMOVE_TAGS_TYPESH
#include <stdio.h>
#include <string>
#include <vector>
namespace aliyun {
struct EcsRemoveTagsRequestType {
std::string owner_id;
std::string resource_owner_account;
std::string resource_owner_id;
std::string resource_type;
std::string resource_id;
std::string tag1_key;
std::string tag2_key;
std::string tag3_key;
std::string tag4_key;
std::string tag5_key;
std::string tag1_value;
std::string tag2_value;
std::string tag3_value;
std::string tag4_value;
std::string tag5_value;
};
struct EcsRemoveTagsResponseType {
};
} // end namespace
#endif
|
/* The content of this file was generated using the C profile of libCellML 0.2.0. */
#include "model.h"
#include <math.h>
#include <stdlib.h>
const char VERSION[] = "0.3.0";
const char LIBCELLML_VERSION[] = "0.2.0";
const size_t STATE_COUNT = 1;
const size_t VARIABLE_COUNT = 10;
const VariableInfo VOI_INFO = {"x", "dimensionless", "main", VARIABLE_OF_INTEGRATION};
const VariableInfo STATE_INFO[] = {
{"sin", "dimensionless", "deriv_approx_sin", STATE}
};
const VariableInfo VARIABLE_INFO[] = {
{"C", "dimensionless", "main", CONSTANT},
{"deriv_approx_initial_value", "dimensionless", "main", CONSTANT},
{"sin", "dimensionless", "actual_sin", ALGEBRAIC},
{"k2_oPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT},
{"k2Pi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT},
{"kPi_2", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT},
{"kPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT},
{"kPi_32", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT},
{"z", "dimensionless", "parabolic_approx_sin", ALGEBRAIC},
{"sin", "dimensionless", "parabolic_approx_sin", ALGEBRAIC}
};
double * createStatesArray()
{
return malloc(STATE_COUNT*sizeof(double));
}
double * createVariablesArray()
{
return malloc(VARIABLE_COUNT*sizeof(double));
}
void deleteArray(double *array)
{
free(array);
}
void initialiseVariables(double *states, double *variables)
{
variables[0] = 0.75;
variables[1] = 0.0;
variables[3] = 2.0/3.14159265358979;
variables[4] = 2.0*3.14159265358979;
variables[5] = 3.14159265358979/2.0;
variables[6] = 3.14159265358979;
variables[7] = 3.0*3.14159265358979/2.0;
states[0] = variables[1];
}
void computeComputedConstants(double *variables)
{
}
void computeRates(double voi, double *states, double *rates, double *variables)
{
rates[0] = cos(voi);
}
void computeVariables(double voi, double *states, double *rates, double *variables)
{
variables[2] = sin(voi);
variables[8] = (voi < variables[5])?voi*variables[3]-0.5:(voi < variables[6])?(3.14159265358979-voi)*variables[3]-0.5:(voi < variables[7])?(voi-3.14159265358979)*variables[3]-0.5:(variables[4]-voi)*variables[3]-0.5;
variables[9] = (voi < variables[5])?-variables[8]*variables[8]+variables[0]+variables[8]:(voi < variables[6])?-variables[8]*variables[8]+variables[0]+variables[8]:(voi < variables[7])?variables[8]*variables[8]-variables[0]-variables[8]:variables[8]*variables[8]-variables[0]-variables[8];
}
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef MOZ_GR_MALLOC_H
#define MOZ_GR_MALLOC_H
// Override malloc() and friends to call moz_malloc() etc, so that we get
// predictable, safe OOM crashes rather than relying on the code to handle
// allocation failures reliably.
#include "mozilla/mozalloc.h"
#define malloc moz_xmalloc
#define calloc moz_xcalloc
#define realloc moz_xrealloc
#define free moz_free
#endif // MOZ_GR_MALLOC_H
|
/**
* UIDining APSHTTPClient Library
* Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import <Foundation/Foundation.h>
@interface APSHTTPHelper : NSObject
+(NSString *)base64encode:(NSData *)plainText;
+(int)caselessCompareFirstString:(const char *)firstString secondString:(const char *)secondString size:(int)size;
+(BOOL)extractEncodingFromData:(NSData *)inputData result:(NSStringEncoding *)result;
+(NSString *)contentTypeForImageData:(NSData *)data;
+(NSString *)fileMIMEType:(NSString *)file;
+(NSString *)encodeURL:(NSString *)string;
+(void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncoding *)stringEncoding fromContentType:(NSString *)contentType;
+(NSStringEncoding)parseStringEncodingFromHeaders:(NSDictionary *)headers;
@end
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "clipboard.h"
#include "common/clipboard.h"
#include "kubernetes.h"
#include <guacamole/client.h>
#include <guacamole/stream.h>
#include <guacamole/user.h>
int guac_kubernetes_clipboard_handler(guac_user* user, guac_stream* stream,
char* mimetype) {
guac_client* client = user->client;
guac_kubernetes_client* kubernetes_client =
(guac_kubernetes_client*) client->data;
/* Clear clipboard and prepare for new data */
guac_common_clipboard_reset(kubernetes_client->clipboard, mimetype);
/* Set handlers for clipboard stream */
stream->blob_handler = guac_kubernetes_clipboard_blob_handler;
stream->end_handler = guac_kubernetes_clipboard_end_handler;
return 0;
}
int guac_kubernetes_clipboard_blob_handler(guac_user* user,
guac_stream* stream, void* data, int length) {
guac_client* client = user->client;
guac_kubernetes_client* kubernetes_client =
(guac_kubernetes_client*) client->data;
/* Append new data */
guac_common_clipboard_append(kubernetes_client->clipboard, data, length);
return 0;
}
int guac_kubernetes_clipboard_end_handler(guac_user* user,
guac_stream* stream) {
/* Nothing to do - clipboard is implemented within client */
return 0;
}
|
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file EprosimaServer.h
*
*/
#ifndef EPROSIMASERVER_H_
#define EPROSIMASERVER_H_
#include "ClientServerTypes.h"
#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/publisher/Publisher.hpp>
#include <fastdds/dds/publisher/DataWriter.hpp>
#include <fastdds/dds/publisher/DataWriterListener.hpp>
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastdds/dds/subscriber/DataReaderListener.hpp>
#include <fastdds/dds/topic/Topic.hpp>
class EprosimaServer
{
friend class OperationListener;
friend class ResultListener;
public:
EprosimaServer();
virtual ~EprosimaServer();
bool init();
//Serve indefinitely.
void serve();
//Serve for samples operations.
void serve(
uint32_t samples);
private:
eprosima::fastdds::dds::Subscriber* mp_operation_sub;
eprosima::fastdds::dds::DataReader* mp_operation_reader;
eprosima::fastdds::dds::Publisher* mp_result_pub;
eprosima::fastdds::dds::DataWriter* mp_result_writer;
eprosima::fastdds::dds::Topic* mp_operation_topic;
eprosima::fastdds::dds::Topic* mp_result_topic;
eprosima::fastdds::dds::DomainParticipant* mp_participant;
clientserver::Result::RESULTTYPE calculate(
clientserver::Operation::OPERATIONTYPE type,
int32_t num1,
int32_t num2,
int32_t* result);
eprosima::fastdds::dds::TypeSupport mp_resultdatatype;
eprosima::fastdds::dds::TypeSupport mp_operationdatatype;
public:
uint32_t m_n_served;
class OperationListener : public eprosima::fastdds::dds::DataReaderListener
{
public:
OperationListener(
EprosimaServer* up)
: mp_up(up)
{
}
~OperationListener() override
{
}
EprosimaServer* mp_up;
void on_data_available(
eprosima::fastdds::dds::DataReader* reader) override;
clientserver::Operation m_operation;
clientserver::Result m_result;
} m_operationsListener;
class ResultListener : public eprosima::fastdds::dds::DataWriterListener
{
public:
ResultListener(
EprosimaServer* up)
: mp_up(up)
{
}
~ResultListener() override
{
}
EprosimaServer* mp_up;
} m_resultsListener;
};
#endif /* EPROSIMASERVER_H_ */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
#define MOZILLA_A11Y_ARIAGridAccessible_h_
#include "nsIAccessibleTable.h"
#include "HyperTextAccessibleWrap.h"
#include "TableAccessible.h"
#include "TableCellAccessible.h"
#include "xpcAccessibleTable.h"
#include "xpcAccessibleTableCell.h"
namespace mozilla {
namespace a11y {
/**
* Accessible for ARIA grid and treegrid.
*/
class ARIAGridAccessible : public AccessibleWrap,
public xpcAccessibleTable,
public nsIAccessibleTable,
public TableAccessible
{
public:
ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTable
NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
// Accessible
virtual TableAccessible* AsTable() { return this; }
// nsAccessNode
virtual void Shutdown();
// TableAccessible
virtual uint32_t ColCount();
virtual uint32_t RowCount();
virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
virtual bool IsColSelected(uint32_t aColIdx);
virtual bool IsRowSelected(uint32_t aRowIdx);
virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
virtual uint32_t SelectedCellCount();
virtual uint32_t SelectedColCount();
virtual uint32_t SelectedRowCount();
virtual void SelectedCells(nsTArray<Accessible*>* aCells);
virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
virtual void SelectCol(uint32_t aColIdx);
virtual void SelectRow(uint32_t aRowIdx);
virtual void UnselectCol(uint32_t aColIdx);
virtual void UnselectRow(uint32_t aRowIdx);
virtual Accessible* AsAccessible() { return this; }
protected:
/**
* Return true if the given row index is valid.
*/
bool IsValidRow(int32_t aRow);
/**
* Retrn true if the given column index is valid.
*/
bool IsValidColumn(int32_t aColumn);
/**
* Return row accessible at the given row index.
*/
Accessible* GetRowAt(int32_t aRow);
/**
* Return cell accessible at the given column index in the row.
*/
Accessible* GetCellInRowAt(Accessible* aRow, int32_t aColumn);
/**
* Set aria-selected attribute value on DOM node of the given accessible.
*
* @param aAccessible [in] accessible
* @param aIsSelected [in] new value of aria-selected attribute
* @param aNotify [in, optional] specifies if DOM should be notified
* about attribute change (used internally).
*/
nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
bool aNotify = true);
};
/**
* Accessible for ARIA gridcell and rowheader/columnheader.
*/
class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
public nsIAccessibleTableCell,
public TableCellAccessible,
public xpcAccessibleTableCell
{
public:
ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTableCell
NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::)
// Accessible
virtual TableCellAccessible* AsTableCell() { return this; }
virtual void Shutdown();
virtual void ApplyARIAState(uint64_t* aState) const;
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
protected:
/**
* Return a containing row.
*/
Accessible* Row() const
{
Accessible* row = Parent();
return row && row->Role() == roles::ROW ? row : nullptr;
}
/**
* Return a table for the given row.
*/
Accessible* TableFor(Accessible* aRow) const;
/**
* Return index of the given row.
*/
int32_t RowIndexFor(Accessible* aRow) const;
// TableCellAccessible
virtual TableAccessible* Table() const MOZ_OVERRIDE;
virtual uint32_t ColIdx() const MOZ_OVERRIDE;
virtual uint32_t RowIdx() const MOZ_OVERRIDE;
virtual bool Selected() MOZ_OVERRIDE;
};
} // namespace a11y
} // namespace mozilla
#endif
|
// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import "MDCLegacyColorScheme.h" // IWYU pragma: keep
#import "MDCLegacyTonalColorScheme.h" // IWYU pragma: keep
#import "MDCLegacyTonalPalette.h" // IWYU pragma: keep
#import "MDCSemanticColorScheme.h" // IWYU pragma: keep
|
/**********************************************************************
* $Id: ogrgeoconceptdriver.h$
*
* Name: ogrgeoconceptdriver.h
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Implements OGRGeoconceptDriver class.
* Language: C++
*
**********************************************************************
* Copyright (c) 2007, Geoconcept and IGN
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
**********************************************************************/
#include "ogrsf_frmts.h"
#ifndef GEOCONCEPT_OGR_DRIVER_H_INCLUDED_
#define GEOCONCEPT_OGR_DRIVER_H_INCLUDED_
/************************************************************************/
/* OGRGeoconceptDriver */
/************************************************************************/
class OGRGeoconceptDriver : public OGRSFDriver
{
public:
~OGRGeoconceptDriver();
const char* GetName( ) override;
OGRDataSource* Open( const char* pszName, int bUpdate = FALSE ) override;
int TestCapability( const char* pszCap ) override;
OGRDataSource* CreateDataSource( const char* pszName, char** papszOptions = nullptr ) override;
OGRErr DeleteDataSource( const char* pszName ) override;
};
#endif /* GEOCONCEPT_OGR_DRIVER_H_INCLUDED_ */
|
/*
defines.h
This file is part of the Unix driver for Towitoko smartcard readers
Copyright (C) 2000 Carlos Prados <cprados@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef DEFINES_H
#define DEFINES_H
/*
* Get configuration information
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/*
* Boolean constants
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*
* Type definitions
*/
#include <wintypes.h>
#endif /* DEFINES_H */
|
// Copyright (C) 2014 by wubenqi
// Distributable under the terms of either the Apache License (Version 2.0) or
// the GNU Lesser General Public License, as specified in the COPYING file.
//
// By: wubenqi<wubenqi@gmail.com>
//
#ifndef MOD_NET_ZNET_HANDLER_CONTEXT_H_
#define MOD_NET_ZNET_HANDLER_CONTEXT_H_
#include <string>
class ZEngineContext;
namespace zengine {
struct ZNetHandlerContext {
ZNetHandlerContext(ZEngineContext* _context, const std::string& _net_type, const std::string& _instnce_name)
: context(_context),
net_type(_net_type),
instnce_name(_instnce_name) {}
ZEngineContext* context;
std::string net_type;
std::string instnce_name;
};
}
#endif
|
//
// Graph.h
// Week1
//
// Created by Alex Nagelkerke on 29-11-14.
// Copyright (c) 2014 Alex Nagelkerke. All rights reserved.
//
#ifndef __Week1__Graph__
#define __Week1__Graph__
#include <map>
#include <algorithm>
#include <iostream>
#include "Vertex.h"
#include "Edge.h"
#include "Utils.h"
#include "PriotityQueue.h"
#include "Chicken.h"
#include "MainWindow.h"
class Cow;
class Graph{
public:
Graph(MainWindow* main);
Graph(const Graph& rvalue);
std::shared_ptr<Vertex> addVertex(int xpos, int ypos, bool isWall, bool hasPill, bool hasWeapon);
std::shared_ptr<Vertex> addVertex(int xpos, int ypos, bool isWall);
void addEdge(std::shared_ptr<Vertex> from, std::shared_ptr<Vertex> to);
void addEdges(std::shared_ptr<Vertex> from, std::shared_ptr<Vertex> to);
void addEdges(std::shared_ptr<Vertex> from, std::shared_ptr<Vertex> to, int weight);
std::vector<std::vector<std::shared_ptr<Vertex>>> getVertices();
void setVertices(std::shared_ptr<std::vector<std::vector<std::shared_ptr<Vertex>>>> vertices);
int getWidth();
int getHeight();
void setUnits(std::shared_ptr<Chicken> chicken);
std::vector<std::shared_ptr<Vertex>> getRoute(std::shared_ptr<Vertex> start, std::shared_ptr<Vertex> end);
std::vector<std::shared_ptr<Vertex>> getRouteRandom(std::shared_ptr<Vertex> start);
std::vector<std::shared_ptr<Vertex>> getRouteChicken(std::shared_ptr<Vertex> start);
std::shared_ptr<Vertex> getRandomVertex();
private:
static const bool DEBUG_PATH = false;
std::shared_ptr<Chicken> chicken;
std::shared_ptr<std::vector<std::vector<std::shared_ptr<Vertex>>>> vertices;
std::map<std::shared_ptr<Vertex>, std::shared_ptr<Vertex>>* cameFrom;
std::vector<std::shared_ptr<Vertex>> createPath(std::shared_ptr<Vertex> start, std::shared_ptr<Vertex> end);
int calculateHeuristic(std::shared_ptr<Vertex> start, std::shared_ptr<Vertex> end);
MainWindow* main;
};
#endif /* defined(__Week1__Graph__) */
|
/*
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zephyr.h>
#include <nanokernel.h>
#include <device.h>
#include <sensor.h>
#include <misc/printk.h>
#include <stdio.h>
static void do_main(struct device *dev)
{
int ret;
struct sensor_value value_x, value_y, value_z;
while (1) {
ret = sensor_sample_fetch(dev);
if (ret) {
printk("sensor_sample_fetch failed ret %d\n", ret);
return;
}
ret = sensor_channel_get(dev, SENSOR_CHAN_MAGN_X, &value_x);
ret = sensor_channel_get(dev, SENSOR_CHAN_MAGN_Y, &value_y);
ret = sensor_channel_get(dev, SENSOR_CHAN_MAGN_Z, &value_z);
printf("( x y z ) = ( %f %f %f )\n", value_x.dval, value_y.dval, value_z.dval);
task_sleep(sys_clock_ticks_per_sec/20);
}
}
struct device *sensor_search_for_magnetometer()
{
static char *magn_sensors[] = {"bmc150_magn", NULL};
struct device *dev;
int i;
i = 0;
while (magn_sensors[i]) {
dev = device_get_binding(magn_sensors[i]);
if (dev) {
return dev;
}
++i;
}
return NULL;
}
void main(void)
{
struct device *dev;
dev = sensor_search_for_magnetometer();
if (dev) {
printk("Found device is %p, name is %s\n", dev, dev->config->name);
do_main(dev);
} else {
printk("There is no available magnetometer device.\n");
}
}
|
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 7.00.0555 */
/* at Sat Oct 20 11:05:22 2012
*/
/* Compiler settings for SCLT.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, LIBID_SCLTLib,0x979E95C5,0xD70D,0x419F,0xB9,0x38,0x67,0xA4,0x95,0x2E,0xD6,0x28);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif
|
//
// Copyright 2012 Alin Dobra and Christopher Jermaine
//
// 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 _HD_EVENT_PROC_IMP_H_
#define _HD_EVENT_PROC_IMP_H_
#include "DiskIOMessages.h"
#include "EventProcessorImp.h"
#include "EventProcessor.h"
#include <map>
#include <pthread.h>
#include <libgen.h>
#include <cstdio>
#include <cinttypes>
#define READ 1
#define WRITE 2
// forward definition on DiskArray
class DiskArray;
/** Driver for individual hard drives.
The way the class should be used is to put a HDThread on top of
each available disk and to access exclusively the disk through
this object. In this way, only on way to access disks exists so
there is no crazy contention on resources.
Any scheduling policy with respect to ordering of the requests has
to be implemented at higher level. The HDThreads are low leve disk
drivers that just do what told.
To allow signaling of job termination, the HDThreads use a
distributed counter and send a signal when the count reaches 0.
The HDThreads are started and coordinated by the DiskArray
objects. Preferably, there is only one DiskArray object in the
systems but the HDThreads do not make that assumption.
*/
class HDThreadImp : public EventProcessorImp {
static constexpr uint64_t HD_MAGIC_NO = 0x9ddb7d9fcfc8eb78; // the first 8 bytes of "GrokIt" | md5sum
static constexpr int32_t HD_VERSION = 0; // increase in future
public:
/* datastructure for the information in the first "page" of
each stripe. The information is used to identify the stripe
and do other things. Information can only be added to the
struct at the end. The layout of the old version should never
be changed.
*/
struct Header {
uint64_t magic; // magic number that has to match value HD_MAGIC_NO
uint64_t arrayHash; // Has to match the Hash of the disk array
uint64_t offset; // offset of the start of the stripe. Should be at least the size of the header
int32_t stripeId; // ID of this stripe. First ID is 0
int32_t version; // version of the header. If 0, just the bare header. Each version adds features
uint64_t magicCopy; // repetition of the magic # for safety
/* Future versions, add fields after this marker. Do not
change the order or types of above fields */
};
/* function to create a stripe. If stripe cannot be created, the system fails.*/
static void CreateStripe(char* fileName, uint64_t arrayHash, int32_t stripeId, uint64_t offset);
private:
uint64_t fileDescriptor;
Header header;
char *fileName;
bool isReadOnly;
// Statistics
uint64_t frequencyUpdate; // how often to send a message up to the diskArray
uint64_t counter; // how many pages we sent throught the life of the thread
const double alpha; // the factor used to maintain running averages and variance
// the update rule is exp = new*alpha+old_exp * (1-alpha);
// the value should be between 0 and 1. Preferred value 1/frequencyUpdate
double exp; // the expectation of the time/page in seconds
double exp2; // the expectation of the square of the time
DiskArray& diskArray;
void UpdateStatistics(double time);
public:
HDThreadImp(const char *_fileName, uint64_t arrayHash, EventProcessor &_diskArray, uint64_t _frequencyUpdate, bool isReadOnly = false);
virtual ~HDThreadImp();
// which stripe is this?
uint64_t DiskNo(void);
/** Message handler for the MegaJobs (reading/writing pages that form a Chunk)*/
MESSAGE_HANDLER_DECLARATION(ExecuteJob)
friend class HDThread;
};
#endif
|
/*
https://github.com/waynezxcv/Gallop
Copyright (c) 2016 waynezxcv <liuweiself@126.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 <UIKit/UIKit.h>
#import "GallopUtils.h"
@class LWLayout;
@class LWAsyncDisplayLayer;
@class LWAsyncDisplayView;
@class LWTextStorage;
@class LWImageStorage;
@protocol LWAsyncDisplayViewDelegate <NSObject>
@optional
/**
* 通过LWTextStorage的“- (void)lw_addLinkForWholeTextStorageWithData:(id)data linkColor:(UIColor *)linkColor highLightColor:(UIColor *)highLightColor;”方法添加的文字链接,点击时可以在这个代理方法里收到回调。
*
* @param asyncDisplayView LWTextStorage所处的LWAsyncDisplayView
* @param textStorage 点击的那个LWTextStorage对象
* @param data 添加点击链接时所附带的信息。
*/
- (void)lwAsyncDisplayView:(LWAsyncDisplayView *)asyncDisplayView didCilickedTextStorage:(LWTextStorage *)textStorage linkdata:(id)data;
/**
* 点击LWImageStorage时,可以在这个代理方法里收到回调
*
* @param asyncDisplayView LWImageStorage所处的LWAsyncDisplayView
* @param imageStorage 点击的那个LWImageStorage对象
* @param touch 点击事件的UITouch对象
*/
- (void)lwAsyncDisplayView:(LWAsyncDisplayView *)asyncDisplayView didCilickedImageStorage:(LWImageStorage *)imageStorage touch:(UITouch *)touch;
/**
* 可以在这个代理方法里完成额外的绘制任务,相当于UIView的“drawRect:”方法。但是在这里绘制任务的都是在子线程完成的。
*
* @param context CGContextRef对象
* @param size 绘制空间的大小,需要在这个size的范围内绘制
* @param isCancelled 是否取消
*/
- (void)extraAsyncDisplayIncontext:(CGContextRef)context size:(CGSize)size isCancelled:(LWAsyncDisplayIsCanclledBlock)isCancelled;
@end
/**
* 在使用LWHTMLView时,因为解析HTML取得图片时,并不知道图片的大小比例,这个回调用于获取下载完图片后调整UIView的大小。
*
* @param imageStorage LWImageStorage对象
* @param delta 下载完的图片高度与预填充图片高度的差
*/
typedef void(^LWAsyncDisplayViewAutoLayoutCallback)(LWImageStorage* imageStorage ,CGFloat delta);
@interface LWAsyncDisplayView : UIView
@property (nonatomic,weak) id <LWAsyncDisplayViewDelegate> delegate;//代理对象
@property (nonatomic,strong) LWLayout* layout;//布局模型
@property (nonatomic,assign) BOOL displaysAsynchronously;//是否异步绘制,默认是YES
@property (nonatomic,copy) LWAsyncDisplayViewAutoLayoutCallback auotoLayoutCallback;//自动布局回调Block
@end
|
#include <wchar.h>
extern void systray_ready();
extern void systray_menu_item_selected(int menu_id);
int nativeLoop(void);
void quit();
#if defined WIN32
void setIcon(const wchar_t* filename, int length);
void setTitle(const wchar_t* title);
void setTooltip(const wchar_t* tooltip);
void add_or_update_menu_item(int menuId, wchar_t* title, wchar_t* tooltip, short disabled, short checked);
#else
void setIcon(const char* iconBytes, int length);
void setTitle(char* title);
void setTooltip(char* tooltip);
void add_or_update_menu_item(int menuId, char* title, char* tooltip, short disabled, short checked);
#endif
|
/* $NetBSD: trap_netbsd.h,v 1.1.1.1 2008/09/19 20:07:19 christos Exp $ */
/* $srcdir/conf/trap/trap_netbsd.h */
#if __NetBSD_Version__ >= 499002300
#define MOUNT_TRAP(type, mnt, flags, mnt_data) mount(type, mnt->mnt_dir, flags, mnt_data, 0)
#else
#define MOUNT_TRAP(type, mnt, flags, mnt_data) mount(type, mnt->mnt_dir, flags, mnt_data)
#endif
|
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_UTF_H_
#define ART_RUNTIME_UTF_H_
#include "base/macros.h"
#include "base/mutex.h"
#include <stddef.h>
#include <stdint.h>
/*
* All UTF-8 in art is actually modified UTF-8. Mostly, this distinction
* doesn't matter.
*
* See http://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 for the details.
*/
namespace art {
namespace mirror {
template<class T> class PrimitiveArray;
typedef PrimitiveArray<uint16_t> CharArray;
} // namespace mirror
/*
* Returns the number of UTF-16 characters in the given modified UTF-8 string.
*/
size_t CountModifiedUtf8Chars(const char* utf8);
size_t CountModifiedUtf8Chars(const char* utf8, size_t byte_count);
/*
* Returns the number of modified UTF-8 bytes needed to represent the given
* UTF-16 string.
*/
size_t CountUtf8Bytes(const uint16_t* chars, size_t char_count);
/*
* Convert from Modified UTF-8 to UTF-16.
*/
void ConvertModifiedUtf8ToUtf16(uint16_t* utf16_out, const char* utf8_in);
void ConvertModifiedUtf8ToUtf16(uint16_t* utf16_out, size_t out_chars,
const char* utf8_in, size_t in_bytes);
/*
* Compare two modified UTF-8 strings as UTF-16 code point values in a non-locale sensitive manner
*/
ALWAYS_INLINE int CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(const char* utf8_1,
const char* utf8_2);
/*
* Compare a null-terminated modified UTF-8 string with a UTF-16 string (not null-terminated)
* as code point values in a non-locale sensitive manner.
*/
int CompareModifiedUtf8ToUtf16AsCodePointValues(const char* utf8, const uint16_t* utf16,
size_t utf16_length);
/*
* Convert from UTF-16 to Modified UTF-8. Note that the output is _not_
* NUL-terminated. You probably need to call CountUtf8Bytes before calling
* this anyway, so if you want a NUL-terminated string, you know where to
* put the NUL byte.
*/
void ConvertUtf16ToModifiedUtf8(char* utf8_out, size_t byte_count,
const uint16_t* utf16_in, size_t char_count);
/*
* The java.lang.String hashCode() algorithm.
*/
int32_t ComputeUtf16Hash(mirror::CharArray* chars, int32_t offset, size_t char_count)
SHARED_REQUIRES(Locks::mutator_lock_);
int32_t ComputeUtf16Hash(const uint16_t* chars, size_t char_count);
int32_t ComputeUtf16HashFromModifiedUtf8(const char* utf8, size_t utf16_length);
// Compute a hash code of a modified UTF-8 string. Not the standard java hash since it returns a
// uint32_t and hashes individual chars instead of codepoint words.
uint32_t ComputeModifiedUtf8Hash(const char* chars);
/*
* Retrieve the next UTF-16 character or surrogate pair from a UTF-8 string.
* single byte, 2-byte and 3-byte UTF-8 sequences result in a single UTF-16
* character (possibly one half of a surrogate) whereas 4-byte UTF-8 sequences
* result in a surrogate pair. Use GetLeadingUtf16Char and GetTrailingUtf16Char
* to process the return value of this function.
*
* Advances "*utf8_data_in" to the start of the next character.
*
* WARNING: If a string is corrupted by dropping a '\0' in the middle
* of a multi byte sequence, you can end up overrunning the buffer with
* reads (and possibly with the writes if the length was computed and
* cached before the damage). For performance reasons, this function
* assumes that the string being parsed is known to be valid (e.g., by
* already being verified). Most strings we process here are coming
* out of dex files or other internal translations, so the only real
* risk comes from the JNI NewStringUTF call.
*/
uint32_t GetUtf16FromUtf8(const char** utf8_data_in);
/**
* Gets the leading UTF-16 character from a surrogate pair, or the sole
* UTF-16 character from the return value of GetUtf16FromUtf8.
*/
ALWAYS_INLINE uint16_t GetLeadingUtf16Char(uint32_t maybe_pair);
/**
* Gets the trailing UTF-16 character from a surrogate pair, or 0 otherwise
* from the return value of GetUtf16FromUtf8.
*/
ALWAYS_INLINE uint16_t GetTrailingUtf16Char(uint32_t maybe_pair);
} // namespace art
#endif // ART_RUNTIME_UTF_H_
|
/*
* Copyright (C) 2012-2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LOGD_LOG_BUFFER_H__
#define _LOGD_LOG_BUFFER_H__
#include <sys/types.h>
#include <log/log.h>
#include <sysutils/SocketClient.h>
#include <utils/List.h>
#include <private/android_filesystem_config.h>
#include "LogBufferElement.h"
#include "LogTimes.h"
#include "LogStatistics.h"
#include "LogWhiteBlackList.h"
typedef android::List<LogBufferElement *> LogBufferElementCollection;
class LogBuffer {
LogBufferElementCollection mLogElements;
pthread_mutex_t mLogElementsLock;
LogStatistics stats;
bool dgramQlenStatistics;
PruneList mPrune;
unsigned long mMaxSize[LOG_ID_MAX];
public:
LastLogTimes &mTimes;
LogBuffer(LastLogTimes *times);
void log(log_id_t log_id, log_time realtime,
uid_t uid, pid_t pid, pid_t tid,
const char *msg, unsigned short len);
log_time flushTo(SocketClient *writer, const log_time start,
bool privileged,
bool (*filter)(const LogBufferElement *element, void *arg) = NULL,
void *arg = NULL);
void clear(log_id_t id, uid_t uid = AID_ROOT);
unsigned long getSize(log_id_t id);
int setSize(log_id_t id, unsigned long size);
unsigned long getSizeUsed(log_id_t id);
// *strp uses malloc, use free to release.
void formatStatistics(char **strp, uid_t uid, unsigned int logMask);
void enableDgramQlenStatistics() {
stats.enableDgramQlenStatistics();
dgramQlenStatistics = true;
}
void enableStatistics() {
stats.enableStatistics();
}
int initPrune(char *cp) { return mPrune.init(cp); }
// *strp uses malloc, use free to release.
void formatPrune(char **strp) { mPrune.format(strp); }
// helper
char *pidToName(pid_t pid) { return stats.pidToName(pid); }
uid_t pidToUid(pid_t pid) { return stats.pidToUid(pid); }
private:
void maybePrune(log_id_t id);
void prune(log_id_t id, unsigned long pruneRows, uid_t uid = AID_ROOT);
};
#endif // _LOGD_LOG_BUFFER_H__
|
/*
* Copyright 2008-2014 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
#pragma once
#include <aerospike/as_vector.h>
/******************************************************************************
* TYPES
*****************************************************************************/
/**
* @private
* Name value pair.
*/
typedef struct as_name_value_s {
char* name;
char* value;
} as_name_value;
/******************************************************************************
* FUNCTIONS
******************************************************************************/
/**
* @private
* Parse info response buffer into name/value pairs, one for each command.
* The original buffer will be modified with null termination characters to
* delimit each command name and value referenced by the name/value pairs.
*/
void
as_info_parse_multi_response(char* buf, as_vector* /* <as_name_value> */ values);
|
// Copyright (C) 2016 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and The University
// of Manchester.
// All rights reserved.
#ifndef COPASI_CurveHandler
#define COPASI_CurveHandler
#include "copasi/xml/parser/CXMLHandler.h"
class CurveHandler : public CXMLHandler
{
private:
CurveHandler();
public:
/**
* Constructor
* @param CXMLParser & parser
* @param CXMLParserData & data
*/
CurveHandler(CXMLParser & parser, CXMLParserData & data);
/**
* Destructor
*/
virtual ~CurveHandler();
protected:
/**
* Process the start of an element
* @param const XML_Char *pszName
* @param const XML_Char **papszAttrs
* @return CXMLHandler * pHandlerToCall
*/
virtual CXMLHandler * processStart(const XML_Char * pszName,
const XML_Char ** papszAttrs);
/**
* Process the end of an element
* @param const XML_Char *pszName
* @return bool finished
*/
virtual bool processEnd(const XML_Char * pszName);
/**
* Retrieve the structure containing the process logic for the handler.
* @return sElementInfo *
*/
virtual sProcessLogic * getProcessLogic() const;
};
#endif //COPASI_CurveHandler
|
/*-
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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.
*
* citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp
*/
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD: soc2013/dpl/head/lib/libc/string/wcscpy.c 188123 2009-02-03 17:58:20Z danger $");
#include <wchar.h>
wchar_t *
wcscpy(wchar_t * __restrict s1, const wchar_t * __restrict s2)
{
wchar_t *cp;
cp = s1;
while ((*cp++ = *s2++) != L'\0')
;
return (s1);
}
|
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s [name]\n", argv0);
}
int
main(int argc, char *argv[])
{
char host[HOST_NAME_MAX + 1];
argv0 = argv[0], argc--, argv++;
if (!argc) {
if (gethostname(host, sizeof(host)) < 0)
eprintf("gethostname:");
puts(host);
} else if (argc == 1) {
if (sethostname(argv[0], strlen(argv[0])) < 0)
eprintf("sethostname:");
} else {
usage();
}
return fshut(stdout, "<stdout>");
}
|
/*
* Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 BasicShapeFunctions_h
#define BasicShapeFunctions_h
#include "BasicShapes.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
class CSSBasicShape;
class CSSToLengthConversionData;
class CSSPrimitiveValue;
class CSSToLengthConversionData;
class CSSValue;
class RenderStyle;
PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
PassRefPtr<BasicShape> basicShapeForValue(const CSSToLengthConversionData&, const CSSBasicShape*);
float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float);
}
#endif
|
#include <debug.h>
#include <lib/string.h>
static void init_debug_info(struct DebugInfo *info);
static void update_debug_info(struct DebugInfo *info,
struct SymbolTableEntry *stab_entry);
static void get_symbol_name(struct SymbolTableEntry *stab_entry,
char *symbol_name);
/*
* get_debug_info returns the debug information for the case when the instruction
* at the given program counter is being executed.
*/
struct DebugInfo get_debug_info(int pc)
{
struct DebugInfo info;
struct SymbolTableEntry *stab_entry = NULL;
init_debug_info(&info);
stab_entry = (struct SymbolTableEntry *) STAB_BEGIN;
while (stab_entry != STAB_END) {
update_debug_info(&info, stab_entry);
if ((uint32_t) info.source_line_address >= (uint32_t) pc)
break;
stab_entry++;
}
return info;
}
/*
* get_function_bounds finds a function with given name and puts its start
* and end addresses in the given output arguments.
*/
void get_function_bounds(const char *name, int *begin, int *end)
{
struct SymbolTableEntry *stab_entry = NULL;
char symbol_name[NAME_MAX_LENGTH];
*begin = *end = -1;
stab_entry = (struct SymbolTableEntry *) STAB_BEGIN;
while (stab_entry != STAB_END) {
if (stab_entry->n_type == SYMBOL_FUNCTION) {
get_symbol_name(stab_entry, symbol_name);
if (strcmp(symbol_name, name) == 0) {
*begin = stab_entry->n_value;
}
else if (*begin != -1) {
*end = stab_entry->n_value;
break;
}
}
stab_entry++;
}
if (*begin != -1 && *end == -1) {
*end = (int) STAB_END;
}
}
static void init_debug_info(struct DebugInfo *info)
{
info->file[0] = '\0';
info->function[0] = '\0';
info->function_address = 0;
info->arg_count = 0;
info->source_line_number = 0;
info->source_line_address = 0;
}
static void update_debug_info(struct DebugInfo *info,
struct SymbolTableEntry *stab_entry)
{
char symbol_name[NAME_MAX_LENGTH];
get_symbol_name(stab_entry, symbol_name);
switch (stab_entry->n_type) {
case SYMBOL_SOURCE_FILE:
strcpy(info->file, symbol_name);
break;
case SYMBOL_FUNCTION:
strcpy(info->function, symbol_name);
info->function_address = stab_entry->n_value;
info->arg_count = 0;
break;
case SYMBOL_PARAMETER:
strcpy(info->arg_names[info->arg_count], symbol_name);
info->arg_positions[info->arg_count] = stab_entry->n_value;
info->arg_count++;
break;
case SYMBOL_SOURCE_LINE:
info->source_line_address = info->function_address +
stab_entry->n_value;
info->source_line_number = stab_entry->n_desc - 1;
break;
}
}
static void get_symbol_name(struct SymbolTableEntry *stab_entry,
char *symbol_name)
{
const char *symbol_str = STABSTR_BEGIN + stab_entry->n_strx;
strlcpy(symbol_name, symbol_str, NAME_MAX_LENGTH);
strtok(symbol_name, ":");
} |
/*
* Copyright (c) 2002-2003 Luigi Rizzo
* Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp
* Copyright (c) 1994 Ugen J.S.Antsilevich
*
* Idea and grammar partially left from:
* Copyright (c) 1993 Daniel Boulet
*
* Redistribution and use in source forms, with and without modification,
* are permitted provided that this entire comment appears intact.
*
* Redistribution in binary form may occur without any restrictions.
* Obviously, it would be nice if you gave credit where credit is due
* but requiring it would be too onerous.
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
* NEW command line interface for IP firewall facility
*
* $FreeBSD: soc2013/dpl/head/sbin/ipfw/altq.c 220845 2011-04-18 21:18:22Z glebius $
*
* altq interface
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include "ipfw2.h"
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <fcntl.h>
#include <net/if.h> /* IFNAMSIZ */
#include <net/pfvar.h>
#include <netinet/in.h> /* in_addr */
#include <netinet/ip_fw.h>
/*
* Map between current altq queue id numbers and names.
*/
static TAILQ_HEAD(, pf_altq) altq_entries =
TAILQ_HEAD_INITIALIZER(altq_entries);
void
altq_set_enabled(int enabled)
{
int pffd;
pffd = open("/dev/pf", O_RDWR);
if (pffd == -1)
err(EX_UNAVAILABLE,
"altq support opening pf(4) control device");
if (enabled) {
if (ioctl(pffd, DIOCSTARTALTQ) != 0 && errno != EEXIST)
err(EX_UNAVAILABLE, "enabling altq");
} else {
if (ioctl(pffd, DIOCSTOPALTQ) != 0 && errno != ENOENT)
err(EX_UNAVAILABLE, "disabling altq");
}
close(pffd);
}
static void
altq_fetch(void)
{
struct pfioc_altq pfioc;
struct pf_altq *altq;
int pffd;
unsigned int mnr;
static int altq_fetched = 0;
if (altq_fetched)
return;
altq_fetched = 1;
pffd = open("/dev/pf", O_RDONLY);
if (pffd == -1) {
warn("altq support opening pf(4) control device");
return;
}
bzero(&pfioc, sizeof(pfioc));
if (ioctl(pffd, DIOCGETALTQS, &pfioc) != 0) {
warn("altq support getting queue list");
close(pffd);
return;
}
mnr = pfioc.nr;
for (pfioc.nr = 0; pfioc.nr < mnr; pfioc.nr++) {
if (ioctl(pffd, DIOCGETALTQ, &pfioc) != 0) {
if (errno == EBUSY)
break;
warn("altq support getting queue list");
close(pffd);
return;
}
if (pfioc.altq.qid == 0)
continue;
altq = safe_calloc(1, sizeof(*altq));
*altq = pfioc.altq;
TAILQ_INSERT_TAIL(&altq_entries, altq, entries);
}
close(pffd);
}
u_int32_t
altq_name_to_qid(const char *name)
{
struct pf_altq *altq;
altq_fetch();
TAILQ_FOREACH(altq, &altq_entries, entries)
if (strcmp(name, altq->qname) == 0)
break;
if (altq == NULL)
errx(EX_DATAERR, "altq has no queue named `%s'", name);
return altq->qid;
}
static const char *
altq_qid_to_name(u_int32_t qid)
{
struct pf_altq *altq;
altq_fetch();
TAILQ_FOREACH(altq, &altq_entries, entries)
if (qid == altq->qid)
break;
if (altq == NULL)
return NULL;
return altq->qname;
}
void
print_altq_cmd(ipfw_insn_altq *altqptr)
{
if (altqptr) {
const char *qname;
qname = altq_qid_to_name(altqptr->qid);
if (qname == NULL)
printf(" altq ?<%u>", altqptr->qid);
else
printf(" altq %s", qname);
}
}
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_
#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_
#include <string>
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
#include "ui/gfx/image/image_skia.h"
namespace base {
class RefCountedString;
}
namespace extensions {
class WebstoreDataFetcher;
}
namespace net {
class URLRequestContextGetter;
}
namespace chromeos {
class KioskAppDataDelegate;
// Fetches an app's web store data and manages the cached info such as name
// and icon.
class KioskAppData : public base::SupportsWeakPtr<KioskAppData>,
public extensions::WebstoreDataFetcherDelegate {
public:
enum Status {
STATUS_INIT, // Data initialized with app id.
STATUS_LOADING, // Loading data from cache or web store.
STATUS_LOADED, // Data loaded.
STATUS_ERROR, // Failed to load data.
};
KioskAppData(KioskAppDataDelegate* delegate, const std::string& app_id);
virtual ~KioskAppData();
// Loads app data from cache. If there is no cached data, fetches it
// from web store.
void Load();
// Clears locally cached data.
void ClearCache();
// Returns true if web store data fetching is in progress.
bool IsLoading() const;
const std::string& id() const { return id_; }
const std::string& name() const { return name_; }
const gfx::ImageSkia& icon() const { return icon_; }
const base::RefCountedString* raw_icon() const {
return raw_icon_.get();
}
Status status() const { return status_; }
private:
class IconLoader;
class WebstoreDataParser;
void SetStatus(Status status);
// Returns URLRequestContextGetter to use for fetching web store data.
net::URLRequestContextGetter* GetRequestContextGetter();
// Loads the locally cached data. Return false if there is none.
bool LoadFromCache();
// Sets the cached data.
void SetCache(const std::string& name, const base::FilePath& icon_path);
// Callbacks for IconLoader.
void OnIconLoadSuccess(const scoped_refptr<base::RefCountedString>& raw_icon,
const gfx::ImageSkia& icon);
void OnIconLoadFailure();
// Callbacks for WebstoreDataParser
void OnWebstoreParseSuccess(const SkBitmap& icon,
base::DictionaryValue* parsed_manifest);
void OnWebstoreParseFailure();
// Starts to fetch data from web store.
void StartFetch();
// extensions::WebstoreDataFetcherDelegate overrides:
virtual void OnWebstoreRequestFailure() OVERRIDE;
virtual void OnWebstoreResponseParseSuccess(
base::DictionaryValue* webstore_data) OVERRIDE;
virtual void OnWebstoreResponseParseFailure(
const std::string& error) OVERRIDE;
KioskAppDataDelegate* delegate_; // not owned.
Status status_;
std::string id_;
std::string name_;
gfx::ImageSkia icon_;
scoped_refptr<base::RefCountedString> raw_icon_;
scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_;
base::FilePath icon_path_;
DISALLOW_COPY_AND_ASSIGN(KioskAppData);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_
|
//
// QMChatTypes.h
// QMServices
//
// Created by Andrey Ivanov on 29.04.15.
// Copyright (c) 2015 Quickblox Team. All rights reserved.
//
typedef NS_ENUM(NSUInteger, QMMessageType) {
/** Default message type*/
QMMessageTypeText = 0,
QMMessageTypeCreateGroupDialog = 1,
QMMessageTypeUpdateGroupDialog = 2,
QMMessageTypeContactRequest = 4,
QMMessageTypeAcceptContactRequest,
QMMessageTypeRejectContactRequest,
QMMessageTypeDeleteContactRequest
};
typedef NS_ENUM(NSUInteger, QMMessageAttachmentStatus) {
QMMessageAttachmentStatusNotLoaded = 0,
QMMessageAttachmentStatusLoading,
QMMessageAttachmentStatusLoaded,
QMMessageAttachmentStatusError,
};
typedef NS_ENUM(NSUInteger, QMDialogUpdateType) {
QMDialogUpdateTypeNone = 0,
QMDialogUpdateTypePhoto = 1,
QMDialogUpdateTypeName = 2,
QMDialogUpdateTypeOccupants = 3
}; |
#ifndef QMCPLUSPLUS_FFTABLEVECTOR_H
#define QMCPLUSPLUS_FFTABLEVECTOR_H
#include "config.h"
#include "OhmmsPETE/TinyVector.h"
#include "OhmmsPETE/OhmmsVector.h"
// In the future should have a constructor that takes a Vector as an
// argument and then the FFTAbleVector's data is just the data from
// that vector (copy the pointer so that FFTing the data causes the
// data in the original Vector to be transformed.
// also in the future move everything to the base class and just have
// an FFTEngine handed to this by some builder
namespace qmcplusplus
{
// dummy base
template<typename precision>
class FFTAbleVectorBase : public Vector<precision>
{
protected:
int NumPts;
// would like to use precision here, but precision is a complex type
// and this needs to be a real type commensurate with precision
double ForwardNorm;
double BackwardNorm;
public:
FFTAbleVectorBase() : NumPts(1), ForwardNorm(1.0), BackwardNorm(1.0)
{
;
}
virtual ~FFTAbleVectorBase()
{
;
}
FFTAbleVectorBase(const FFTAbleVectorBase& rhs) : Vector<precision>(rhs), NumPts(rhs.NumPts),
ForwardNorm(rhs.ForwardNorm), BackwardNorm(rhs.BackwardNorm)
{
;
}
virtual FFTAbleVectorBase* clone() const = 0;
inline void setForwardNorm(double fn)
{
ForwardNorm = fn;
}
inline void setBackwardNorm(double bn)
{
BackwardNorm = bn;
}
virtual void transformForward() = 0;
virtual void transformBackward() = 0;
};
template<unsigned dimensions, typename precision, template<unsigned, class> class FFTEngine>
class FFTAbleVector : public FFTAbleVectorBase<precision>
{
private:
typedef FFTAbleVectorBase<precision> base;
using base::NumPts;
using base::ForwardNorm;
using base::BackwardNorm;
TinyVector<int, dimensions> SizeDims;
FFTEngine<dimensions, precision> MyEngine;
void initialize(const TinyVector<int, dimensions>& DimSizes)
{
for (int i = 0; i < dimensions; i++)
{
SizeDims[i] = DimSizes[i];
}
for (unsigned i = 0; i < dimensions; i++)
NumPts *= DimSizes[i];
this->resize(NumPts);
MyEngine.initialize(SizeDims.begin(), this->data());
}
/*
typedef T Type_t
typedef C Contianer_t;
typedef Vector<T,C> This_t;
typedef typename Container_t::iterator iterator;
typedef typename Container_t::const_iterator const_iterator;
*/
public:
FFTAbleVector(int sizeDim1, int sizeDim2 = 0, int sizeDim3 = 0, int sizeDim4 = 0,
int sizeDim5 = 0, int sizeDim6 = 0, int sizeDim7 = 0, int sizeDim8 = 0)
{
TinyVector<int, 8> DimSizes;
DimSizes[0] = sizeDim1;
DimSizes[1] = sizeDim2;
DimSizes[2] = sizeDim3;
DimSizes[3] = sizeDim4;
DimSizes[4] = sizeDim5;
DimSizes[5] = sizeDim6;
DimSizes[6] = sizeDim7;
DimSizes[7] = sizeDim8;
initialize(DimSizes);
}
FFTAbleVector(const TinyVector<int, dimensions>& DimSizes)
{
initialize(DimSizes);
}
FFTAbleVector(const FFTAbleVector& rhs) : FFTAbleVectorBase<precision>(rhs)
{
SizeDims = rhs.SizeDims;
MyEngine.initialize(SizeDims.begin(), this->data());
}
FFTAbleVector* clone() const
{
return new FFTAbleVector(*this);
}
inline void transformForward()
{
MyEngine.transformForward(this->data());
(*this) *= ForwardNorm;
}
inline void transformBackward()
{
MyEngine.transformBackward(this->data());
(*this) *= BackwardNorm;
}
};
}
#endif
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import <React/RCTBorderStyle.h>
#import <React/RCTComponent.h>
#import <React/RCTPointerEvents.h>
#import <React/RCTView.h>
@protocol RCTAutoInsetsProtocol;
@class RCTView;
@interface RCTView : UIView
/**
* Accessibility event handlers
*/
@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap;
@property (nonatomic, copy) RCTDirectEventBlock onMagicTap;
/**
* Used to control how touch events are processed.
*/
@property (nonatomic, assign) RCTPointerEvents pointerEvents;
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
withScrollView:(UIScrollView *)scrollView
updateOffset:(BOOL)updateOffset;
/**
* Find the first view controller whose view, or any subview is the specified view.
*/
+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
/**
* Layout direction of the view.
* This is inherited from UIView+React, but we override it here
* to improve perfomance and make subclassing/overriding possible/easier.
*/
@property (nonatomic, assign) UIUserInterfaceLayoutDirection reactLayoutDirection;
/**
* This is an optimization used to improve performance
* for large scrolling views with many subviews, such as a
* list or table. If set to YES, any clipped subviews will
* be removed from the view hierarchy whenever -updateClippedSubviews
* is called. This would typically be triggered by a scroll event
*/
@property (nonatomic, assign) BOOL removeClippedSubviews;
/**
* Hide subviews if they are outside the view bounds.
* This is an optimisation used predominantly with RKScrollViews
* but it is applied recursively to all subviews that have
* removeClippedSubviews set to YES
*/
- (void)updateClippedSubviews;
/**
* Border radii.
*/
@property (nonatomic, assign) CGFloat borderRadius;
@property (nonatomic, assign) CGFloat borderTopLeftRadius;
@property (nonatomic, assign) CGFloat borderTopRightRadius;
@property (nonatomic, assign) CGFloat borderTopStartRadius;
@property (nonatomic, assign) CGFloat borderTopEndRadius;
@property (nonatomic, assign) CGFloat borderBottomLeftRadius;
@property (nonatomic, assign) CGFloat borderBottomRightRadius;
@property (nonatomic, assign) CGFloat borderBottomStartRadius;
@property (nonatomic, assign) CGFloat borderBottomEndRadius;
/**
* Border colors (actually retained).
*/
@property (nonatomic, assign) CGColorRef borderTopColor;
@property (nonatomic, assign) CGColorRef borderRightColor;
@property (nonatomic, assign) CGColorRef borderBottomColor;
@property (nonatomic, assign) CGColorRef borderLeftColor;
@property (nonatomic, assign) CGColorRef borderStartColor;
@property (nonatomic, assign) CGColorRef borderEndColor;
@property (nonatomic, assign) CGColorRef borderColor;
/**
* Border widths.
*/
@property (nonatomic, assign) CGFloat borderTopWidth;
@property (nonatomic, assign) CGFloat borderRightWidth;
@property (nonatomic, assign) CGFloat borderBottomWidth;
@property (nonatomic, assign) CGFloat borderLeftWidth;
@property (nonatomic, assign) CGFloat borderStartWidth;
@property (nonatomic, assign) CGFloat borderEndWidth;
@property (nonatomic, assign) CGFloat borderWidth;
/**
* Border styles.
*/
@property (nonatomic, assign) RCTBorderStyle borderStyle;
/**
* Insets used when hit testing inside this view.
*/
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
@end
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_SERVICE_DELEGATE_H_
#define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_SERVICE_DELEGATE_H_
#import <Foundation/Foundation.h>
@interface ServiceDelegate
: NSObject<NSXPCListenerDelegate, NSUserNotificationCenterDelegate>
@end
#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_SERVICE_DELEGATE_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52a.c
Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml
Template File: sources-vasinks-52a.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: console Read input from the console
* GoodSource: Copy a fixed string into data
* Sinks: w32_vsnprintf
* GoodSink: vsnprintf with a format string
* BadSink : vsnprintf without a format string
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include <stdarg.h>
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifndef OMITBAD
/* bad function declaration */
void CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_badSink(char * data);
void CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgets() */
dataLen = strlen(data);
if (dataLen > 0 && data[dataLen-1] == '\n')
{
data[dataLen-1] = '\0';
}
}
else
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
}
}
CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_goodG2BSink(char * data);
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Use a fixed string that does not contain a format specifier */
strcpy(data, "fixedstringtest");
CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_goodB2GSink(char * data);
static void goodB2G()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgets() */
dataLen = strlen(data);
if (dataLen > 0 && data[dataLen-1] == '\n')
{
data[dataLen-1] = '\0';
}
}
else
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
}
}
CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52b_goodB2GSink(data);
}
void CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52_good()
{
goodG2B();
goodB2G();
}
#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()...");
CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE134_Uncontrolled_Format_String__char_console_w32_vsnprintf_52_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkApproximatingSubdivisionFilter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkApproximatingSubdivisionFilter - generate a subdivision surface using an Approximating Scheme
// .SECTION Description
// vtkApproximatingSubdivisionFilter is an abstract class that defines
// the protocol for Approximating subdivision surface filters.
// .SECTION Thanks
// This work was supported by PHS Research Grant No. 1 P41 RR13218-01
// from the National Center for Research Resources.
#ifndef vtkApproximatingSubdivisionFilter_h
#define vtkApproximatingSubdivisionFilter_h
#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
class vtkCellArray;
class vtkCellData;
class vtkIdList;
class vtkIntArray;
class vtkPoints;
class vtkPointData;
class VTKFILTERSGENERAL_EXPORT vtkApproximatingSubdivisionFilter : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkApproximatingSubdivisionFilter,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set/get the number of subdivisions.
vtkSetMacro(NumberOfSubdivisions,int);
vtkGetMacro(NumberOfSubdivisions,int);
protected:
vtkApproximatingSubdivisionFilter();
~vtkApproximatingSubdivisionFilter() {}
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int GenerateSubdivisionPoints (vtkPolyData *inputDS,
vtkIntArray *edgeData,
vtkPoints *outputPts,
vtkPointData *outputPD) = 0;
void GenerateSubdivisionCells (vtkPolyData *inputDS, vtkIntArray *edgeData,
vtkCellArray *outputPolys,
vtkCellData *outputCD);
int FindEdge (vtkPolyData *mesh, vtkIdType cellId, vtkIdType p1,
vtkIdType p2, vtkIntArray *edgeData, vtkIdList *cellIds);
vtkIdType InterpolatePosition (vtkPoints *inputPts, vtkPoints *outputPts,
vtkIdList *stencil, double *weights);
int NumberOfSubdivisions;
private:
vtkApproximatingSubdivisionFilter(const vtkApproximatingSubdivisionFilter&) VTK_DELETE_FUNCTION;
void operator=(const vtkApproximatingSubdivisionFilter&) VTK_DELETE_FUNCTION;
};
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE252_Unchecked_Return_Value__char_fputs_04.c
Label Definition File: CWE252_Unchecked_Return_Value.label.xml
Template File: point-flaw-04.tmpl.c
*/
/*
* @description
* CWE: 252 Unchecked Return Value
* Sinks: fputs
* GoodSink: Check if fputs() fails
* BadSink : Do not check if fputs() fails
* Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE)
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* The two variables below are declared "const", so a tool should
be able to identify that reads of these will always return their
initialized values. */
static const int STATIC_CONST_TRUE = 1; /* true */
static const int STATIC_CONST_FALSE = 0; /* false */
#ifndef OMITBAD
void CWE252_Unchecked_Return_Value__char_fputs_04_bad()
{
if(STATIC_CONST_TRUE)
{
/* FLAW: Do not check the return value */
fputs("string", stdout);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(STATIC_CONST_FALSE) instead of if(STATIC_CONST_TRUE) */
static void good1()
{
if(STATIC_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: check the return value */
if (fputs("string", stdout) == EOF)
{
printLine("fputs failed!");
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(STATIC_CONST_TRUE)
{
/* FIX: check the return value */
if (fputs("string", stdout) == EOF)
{
printLine("fputs failed!");
}
}
}
void CWE252_Unchecked_Return_Value__char_fputs_04_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()...");
CWE252_Unchecked_Return_Value__char_fputs_04_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE252_Unchecked_Return_Value__char_fputs_04_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/***********************************************************************************************************************
**
** Copyright (c) 2011, 2016 ETH Zurich
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
** following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice, this list of conditions and the
** following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
** following disclaimer in the documentation and/or other materials provided with the distribution.
** * Neither the name of the ETH Zurich nor the names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
**********************************************************************************************************************/
#pragma once
#include "../codereview_api.h"
#include "VisualizationBase/src/declarative/DeclarativeItemBaseStyle.h"
namespace CodeReview
{
class CODEREVIEW_API CodeReviewCommentOverlayStyle : public Super<Visualization::DeclarativeItemBaseStyle>
{
public:
virtual ~CodeReviewCommentOverlayStyle() override;
};
}
|
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008-2014, Shane Liesegang
// 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 any
// 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.
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "DemoGameManager.h"
#include "DemoScreenPathfinding.h"
class DemoScreenImageMap : public DemoScreen, MessageListener
{
public:
DemoScreenImageMap();
virtual void Start();
virtual void Stop();
void PickNewTarget(MazeFinder* mf);
virtual void ReceiveMessage(Message* m);
virtual void Update(float dt);
private:
Vector2List _availableTargets;
};
|
/* $OpenBSD: timeouts.h,v 1.1 2014/08/26 17:47:25 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
*/
/* ====================================================================
* Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 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 acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#ifndef INCLUDED_TIMEOUTS_H
#define INCLUDED_TIMEOUTS_H
/* numbers in us */
#define DGRAM_RCV_TIMEOUT 250000
#define DGRAM_SND_TIMEOUT 250000
#endif /* ! INCLUDED_TIMEOUTS_H */
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_
#define CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_
#include <string>
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
class Profile;
// ThumbnailSource is the gateway between network-level chrome:
// requests for thumbnails and the history backend that serves these.
class DOMUIThemeSource : public ChromeURLDataManager::DataSource {
public:
explicit DOMUIThemeSource(Profile* profile);
// Called when the network layer has requested a resource underneath
// the path we registered.
virtual void StartDataRequest(const std::string& path, int request_id);
virtual std::string GetMimeType(const std::string& path) const;
virtual void SendResponse(int request_id, RefCountedBytes* data);
private:
// Generate and send the CSS for the new tab.
void SendNewTabCSS(int request_id);
// Fetch and send the theme bitmap.
void SendThemeBitmap(int request_id, int resource_id);
// Get the CSS string for the background position on the new tab page for the
// states when the bar is attached or detached.
std::string GetNewTabBackgroundCSS(bool bar_attached);
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(DOMUIThemeSource);
};
#endif // CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BlockPainter_h
#define BlockPainter_h
#include "wtf/Allocator.h"
namespace blink {
struct PaintInfo;
class InlineBox;
class LayoutBlock;
class LayoutBox;
class LayoutFlexibleBox;
class LayoutObject;
class LayoutPoint;
class LayoutRect;
class BlockPainter {
STACK_ALLOCATED();
public:
BlockPainter(const LayoutBlock& block) : m_layoutBlock(block) { }
void paint(const PaintInfo&, const LayoutPoint& paintOffset);
void paintObject(const PaintInfo&, const LayoutPoint&);
void paintChildren(const PaintInfo&, const LayoutPoint&);
void paintChild(const LayoutBox&, const PaintInfo&, const LayoutPoint&);
void paintChildAsInlineBlock(const LayoutBox&, const PaintInfo&, const LayoutPoint&);
void paintOverflowControlsIfNeeded(const PaintInfo&, const LayoutPoint&);
// inline-block elements paint all phases atomically. This function ensures that. Certain other elements
// (grid items, flex items) require this behavior as well, and this function exists as a helper for them.
// It is expected that the caller will call this function independent of the value of paintInfo.phase.
static void paintAsInlineBlock(const LayoutObject&, const PaintInfo&, const LayoutPoint&);
static void paintChildrenOfFlexibleBox(const LayoutFlexibleBox&, const PaintInfo&, const LayoutPoint& paintOffset);
static void paintInlineBox(const InlineBox&, const PaintInfo&, const LayoutPoint& paintOffset);
bool intersectsPaintRect(const PaintInfo&, const LayoutPoint& paintOffset) const;
private:
void paintCarets(const PaintInfo&, const LayoutPoint&);
void paintContents(const PaintInfo&, const LayoutPoint&);
const LayoutBlock& m_layoutBlock;
};
} // namespace blink
#endif // BlockPainter_h
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__wchar_t_declare_loop_09.c
Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml
Template File: sources-sink-09.tmpl.c
*/
/*
* @description
* CWE: 124 Buffer Underwrite
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sink: loop
* BadSink : Copy string to data using a loop
* Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE124_Buffer_Underwrite__wchar_t_declare_loop_09_bad()
{
wchar_t * data;
wchar_t dataBuffer[100];
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
if(GLOBAL_CONST_TRUE)
{
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
{
size_t i;
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
for (i = 0; i < 100; i++)
{
data[i] = source[i];
}
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */
static void goodG2B1()
{
wchar_t * data;
wchar_t dataBuffer[100];
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
if(GLOBAL_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
{
size_t i;
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
for (i = 0; i < 100; i++)
{
data[i] = source[i];
}
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBuffer[100];
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
if(GLOBAL_CONST_TRUE)
{
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
{
size_t i;
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
for (i = 0; i < 100; i++)
{
data[i] = source[i];
}
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
}
}
void CWE124_Buffer_Underwrite__wchar_t_declare_loop_09_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()...");
CWE124_Buffer_Underwrite__wchar_t_declare_loop_09_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE124_Buffer_Underwrite__wchar_t_declare_loop_09_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*This file has been prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
*
* \brief FreeRTOS Led Driver example for AVR32 UC3.
*
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
* - Supported devices: All AVR32 devices can be used.
* - AppNote:
*
* \author Atmel Corporation: http://www.atmel.com \n
* Support and FAQ: http://support.atmel.no/
*
*****************************************************************************/
/* Copyright (c) 2007, 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:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of ATMEL may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND
* SPECIFICALLY 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.
*/
#include <avr32/io.h>
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
#define partstALL_OUTPUTS_OFF ( ( unsigned portCHAR ) 0x00 )
#define partstMAX_OUTPUT_LED ( ( unsigned portCHAR ) 8 )
static volatile unsigned portCHAR ucCurrentOutputValue = partstALL_OUTPUTS_OFF; /*lint !e956 File scope parameters okay here. */
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
LED_Display(partstALL_OUTPUTS_OFF); /* Start with all LEDs off. */
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
unsigned portCHAR ucBit;
if( uxLED >= partstMAX_OUTPUT_LED )
{
return;
}
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
vTaskSuspendAll();
{
if( xValue == pdTRUE )
{
ucCurrentOutputValue |= ucBit;
}
else
{
ucCurrentOutputValue &= ~ucBit;
}
LED_Display(ucCurrentOutputValue);
}
xTaskResumeAll();
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
unsigned portCHAR ucBit;
if( uxLED >= partstMAX_OUTPUT_LED )
{
return;
}
ucBit = ( ( unsigned portCHAR ) 1 ) << uxLED;
vTaskSuspendAll();
{
ucCurrentOutputValue ^= ucBit;
LED_Display(ucCurrentOutputValue);
}
xTaskResumeAll();
}
|
/*
* sensores.h
*
* Copyright 2014 valentin basel <valentin@localhost.localdomain>
*
* 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 <stdio.h>
int ping()
{
int Dato=0;
//Pin del eco en bajo
while (digitalread(24) == LOW)
{
digitalwrite(23, HIGH);//Activa el disparador
Delayus(50);//Espera 50 microsegundos (minimo 10)
digitalwrite(23, LOW);//Desactiva el disparador
}
//Pin de eco en alto hasta que llegue el eco
while (digitalread(24) == HIGH)
{
Dato++;//El contador se incrementa hasta llegar el eco
Delayus(58);//Tiempo en recorrer dos centimetros 1 de ida 1 de vuelta
}
return Dato;
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fscanf_05.c
Label Definition File: CWE253_Incorrect_Check_of_Function_Return_Value.label.xml
Template File: point-flaw-05.tmpl.c
*/
/*
* @description
* CWE: 253 Incorrect Check of Return Value
* Sinks: fscanf
* GoodSink: Correctly check if fwscanf() failed
* BadSink : Incorrectly check if fwscanf() failed
* Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse)
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* The two variables below are not defined as "const", but are never
assigned any other value, so a tool should be able to identify that
reads of these will always return their initialized values. */
static int staticTrue = 1; /* true */
static int staticFalse = 0; /* false */
#ifndef OMITBAD
void CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fscanf_05_bad()
{
if(staticTrue)
{
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() and other variants */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
/* FLAW: fwscanf() might fail, in which case the return value will be EOF (-1), but
* we are checking to see if the return value is 0 */
if (fwscanf(stdin, L"%99s\0", data) == 0)
{
printLine("fwscanf failed!");
}
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(staticFalse) instead of if(staticTrue) */
static void good1()
{
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() and other variants */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
/* FIX: check for the correct return value */
if (fwscanf(stdin, L"%99s\0", data) == EOF)
{
printLine("fwscanf failed!");
}
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(staticTrue)
{
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() and other variants */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
/* FIX: check for the correct return value */
if (fwscanf(stdin, L"%99s\0", data) == EOF)
{
printLine("fwscanf failed!");
}
}
}
}
void CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fscanf_05_good()
{
good1();
good2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fscanf_05_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_fscanf_05_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_
#include <string>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/command_updater_delegate.h"
#include "chrome/browser/ssl/security_state_model.h"
#include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/web_contents_delegate.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/widget/widget_delegate.h"
#include "url/gurl.h"
class CommandUpdater;
class Profile;
class ReloadButton;
class ToolbarModel;
namespace views {
class WebView;
class Widget;
}
namespace chromeos {
class StubBubbleModelDelegate;
// View class which shows the light version of the toolbar and the web contents.
// Light version of the toolbar includes back, forward buttons and location
// bar. Location bar is shown in read only mode, because this view is designed
// to be used for sign in to captive portal on login screen (when Browser
// isn't running).
class SimpleWebViewDialog : public views::ButtonListener,
public views::WidgetDelegateView,
public LocationBarView::Delegate,
public ToolbarModelDelegate,
public CommandUpdaterDelegate,
public content::PageNavigator,
public content::WebContentsDelegate {
public:
explicit SimpleWebViewDialog(Profile* profile);
~SimpleWebViewDialog() override;
// Starts loading.
void StartLoad(const GURL& gurl);
// Inits view. Should be attached to a Widget before call.
void Init();
// Overridden from views::View:
void Layout() override;
// Overridden from views::WidgetDelegate:
views::View* GetContentsView() override;
views::View* GetInitiallyFocusedView() override;
// Implements views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// Implements content::PageNavigator:
content::WebContents* OpenURL(const content::OpenURLParams& params) override;
// Implements content::WebContentsDelegate:
void NavigationStateChanged(content::WebContents* source,
content::InvalidateTypes changed_flags) override;
void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override;
// Implements LocationBarView::Delegate:
content::WebContents* GetWebContents() override;
ToolbarModel* GetToolbarModel() override;
const ToolbarModel* GetToolbarModel() const override;
views::Widget* CreateViewsBubble(
views::BubbleDelegateView* bubble_delegate) override;
PageActionImageView* CreatePageActionImageView(
LocationBarView* owner,
ExtensionAction* action) override;
ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate()
override;
void ShowWebsiteSettings(
content::WebContents* web_contents,
const GURL& url,
const SecurityStateModel::SecurityInfo& security_info) override;
// Implements ToolbarModelDelegate:
content::WebContents* GetActiveWebContents() const override;
// Implements CommandUpdaterDelegate:
void ExecuteCommandWithDisposition(int id, WindowOpenDisposition) override;
private:
friend class SimpleWebViewDialogTest;
void LoadImages();
void UpdateButtons();
void UpdateReload(bool is_loading, bool force);
Profile* profile_;
scoped_ptr<ToolbarModel> toolbar_model_;
scoped_ptr<CommandUpdater> command_updater_;
// Controls
views::ImageButton* back_;
views::ImageButton* forward_;
ReloadButton* reload_;
LocationBarView* location_bar_;
views::WebView* web_view_;
// Contains |web_view_| while it isn't owned by the view.
scoped_ptr<views::WebView> web_view_container_;
scoped_ptr<StubBubbleModelDelegate> bubble_model_delegate_;
DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialog);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPythonOverload.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* Created in June 2010 by David Gobbi, originally in vtkPythonUtil.
*
* This file provides methods for calling overloaded functions
* that are stored in a PyMethodDef table. The arguments are
* checked against the format strings that are stored in the
* documentation fields of the table. For more information,
* see vtkWrapPython_ArgCheckString() in vtkWrapPython.c.
*/
// .NAME vtkPythonOverload
#ifndef vtkPythonOverload_h
#define vtkPythonOverload_h
#include "vtkWrappingPythonCoreModule.h" // For export macro
#include "vtkPython.h"
class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonOverload
{
public:
// Description:
// Check python object against a format character and return a number
// to indicate how well it matches (lower numbers are better).
static int CheckArg(PyObject *arg, const char *format,
const char *classname, int level=0);
// Description:
// Call the method that is the best match for the for the provided
// arguments. The docstrings in the PyMethodDef must provide info
// about the argument types for each method.
static PyObject *CallMethod(PyMethodDef *methods,
PyObject *self, PyObject *args);
// Description:
// Find a method that takes the single arg provided, this is used
// to locate the correct constructor signature for a conversion.
// The docstrings in the PyMethodDef must provide info about the
// argument types for each method.
static PyMethodDef *FindConversionMethod(PyMethodDef *methods,
PyObject *arg);
};
#endif
|
/******************************************************************
*
* CyberX3D for C++
*
* Copyright (C) Satoshi Konno 1996-2007
*
* File: Circle2DNode.h
*
******************************************************************/
#ifndef _CX3D_CIRCLE2D_H_
#define _CX3D_CIRCLE2D_H_
#include <cybergarage/x3d/Geometry2DNode.h>
namespace CyberX3D {
class Circle2DNode : public Geometry2DNode {
SFFloat *radiusField;
public:
Circle2DNode();
virtual ~Circle2DNode();
////////////////////////////////////////////////
// Radius
////////////////////////////////////////////////
SFFloat *getRadiusField() const;
void setRadius(float value);
float getRadius() const;
////////////////////////////////////////////////
// List
////////////////////////////////////////////////
Circle2DNode *next() const;
Circle2DNode *nextTraversal() const;
////////////////////////////////////////////////
// functions
////////////////////////////////////////////////
bool isChildNodeType(Node *node) const;
void initialize();
void uninitialize();
void update();
////////////////////////////////////////////////
// recomputeDisplayList
////////////////////////////////////////////////
#ifdef CX3D_SUPPORT_OPENGL
void recomputeDisplayList();
#endif
////////////////////////////////////////////////
// Infomation
////////////////////////////////////////////////
void outputContext(std::ostream &printStream, const char *indentString) const;
};
}
#endif
|
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#ifdef WITH_JSC_EXTRA_TRACING
#include <JavaScriptCore/JSContextRef.h>
namespace facebook {
namespace react {
void addNativeTracingHooks(JSGlobalContextRef ctx);
} }
#endif
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2012, John Haddon. All rights reserved.
// Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above
// copyright notice, this list of conditions and the following
// disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with
// the distribution.
//
// * Neither the name of John Haddon nor the names of
// any other contributors to this software may be used to endorse or
// promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef GAFFERSCENE_TYPEIDS_H
#define GAFFERSCENE_TYPEIDS_H
namespace GafferScene
{
enum TypeId
{
ScenePlugTypeId = 110501,
SceneNodeTypeId = 110502,
FilterProcessorTypeId = 110503,
SetFilterTypeId = 110504,
SceneProcessorTypeId = 110505,
SceneElementProcessorTypeId = 110506,
PointsTypeTypeId = 110507,
PrimitiveVariableProcessorTypeId = 110508,
DeletePrimitiveVariablesTypeId = 110509,
GroupTypeId = 110510,
ShaderPlugTypeId = 110511,
UDIMQueryTypeId = 110512,
WireframeTypeId = 110513,
ObjectSourceTypeId = 110514,
PlaneTypeId = 110515,
SeedsTypeId = 110516,
InstancerTypeId = 110517,
BranchCreatorTypeId = 110518,
ObjectToSceneTypeId = 110519,
CameraTypeId = 110520,
GlobalsProcessorTypeId = 110521,
OutputsTypeId = 110522,
OptionsTypeId = 110523,
ShaderTypeId = 110524,
ShaderAssignmentTypeId = 110525,
FilterTypeId = 110526,
PathFilterTypeId = 110527,
AttributesTypeId = 110528,
GlobalShaderTypeId = 110529,
ClippingPlaneTypeId = 110530,
TweaksPlugTypeId = 110531,
StandardOptionsTypeId = 110532,
SubTreeTypeId = 110533,
OpenGLAttributesTypeId = 110534,
SceneWriterTypeId = 110535,
SceneReaderTypeId = 110536,
ReverseWindingTypeId = 110537,
LightTypeId = 110538,
StandardAttributesTypeId = 110539,
OpenGLShaderTypeId = 110540,
TransformTypeId = 110541,
ConstraintTypeId = 110542,
AimConstraintTypeId = 110543,
MeshTypeTypeId = 110544,
FilteredSceneProcessorTypeId = 110545,
PruneTypeId = 110546,
FreezeTransformTypeId = 110547,
MeshDistortionTypeId = 110548,
OpenGLRenderTypeId = 110549,
InteractiveRenderTypeId = 110550,
CubeTypeId = 110551,
SphereTypeId = 110552,
TextTypeId = 110553,
MapProjectionTypeId = 110554,
PointConstraintTypeId = 110555,
CustomAttributesTypeId = 110556,
CustomOptionsTypeId = 110557,
MapOffsetTypeId = 110558,
IsolateTypeId = 110559,
AttributeProcessorTypeId = 110560,
DeleteAttributesTypeId = 110561,
UnionFilterTypeId = 110562,
SetVisualiserTypeId = 110563,
LightFilterTypeId = 110564,
ParentConstraintTypeId = 110565,
ParentTypeId = 110566,
PrimitiveVariablesTypeId = 110567,
DuplicateTypeId = 110568,
GridTypeId = 110569,
SetTypeId = 110570,
CoordinateSystemTypeId = 110571,
DeleteGlobalsTypeId = 110572,
DeleteOptionsTypeId = 110573,
DeleteOutputsTypeId = 110574,
ExternalProceduralTypeId = 110575,
ScenePathTypeId = 110576,
MeshToPointsTypeId = 110577,
OrientationTypeId = 110578,
DeleteSetsTypeId = 110579,
ParametersTypeId = 110580,
SceneFilterPathFilterTypeId = 110581,
DeleteObjectTypeId = 110582,
AttributeVisualiserTypeId = 110583,
CopyPrimitiveVariablesTypeId = 110584,
RenderTypeId = 110585,
FilterPlugTypeId = 110586,
ShaderTweaksTypeId = 110587,
TweakPlugTypeId = 110588,
CopyOptionsTypeId = 110589,
LightToCameraTypeId = 110590,
FilterResultsTypeId = 110591,
ObjectProcessorTypeId = 110592,
MeshTangentsTypeId = 110593,
ResamplePrimitiveVariablesTypeId = 110594,
DeleteFacesTypeId = 110595,
DeleteCurvesTypeId = 110596,
DeletePointsTypeId = 110597,
DeformerTypeId = 110598,
CollectScenesTypeId = 110599,
CapsuleTypeId = 110600,
EncapsulateTypeId = 110601,
CopyAttributesTypeId = 110602,
CollectPrimitiveVariablesTypeId = 110603,
PrimitiveVariableExistsTypeId = 110604,
CollectTransformsTypeId = 110605,
CameraTweaksTypeId = 110606,
MergeScenesTypeId = 110607,
ShuffleAttributesTypeId = 110608,
ShufflePrimitiveVariablesTypeId = 110609,
LocaliseAttributesTypeId = 110610,
PrimitiveSamplerTypeId = 110611,
ClosestPointSamplerTypeId = 110612,
CurveSamplerTypeId = 110613,
PreviewGeometryTypeId = 110648,
PreviewProceduralTypeId = 110649,
LastTypeId = 110650
};
} // namespace GafferScene
#endif // GAFFERSCENE_TYPEIDS_H
|
/* Copyright (c) 2013, Rice University
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. Neither the name of Rice University
nor the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* DESC: Fork a bunch of asyncs in a top-level loop
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "hclib.h"
#define H1 1024
#define T1 33
//user written code
void forasync_fct1(void * argv,int idx) {
int *ran=(int *)argv;
assert(ran[idx] == -1);
ran[idx] = idx;
}
void init_ran(int *ran, int size) {
while (size > 0) {
ran[size-1] = -1;
size--;
}
}
void entrypoint(void *arg) {
int *ran = (int *)arg;
// This is ok to have these on stack because this
// code is alive until the end of the program.
init_ran(ran, H1);
hclib_loop_domain_t loop = {0,H1,1,T1};
hclib_start_finish();
hclib_forasync((void *)forasync_fct1,(void*)(ran), 1,&loop,FORASYNC_MODE_RECURSIVE);
hclib_end_finish();
printf("Call Finalize\n");
}
int main (int argc, char ** argv) {
printf("Call Init\n");
int *ran=(int *)malloc(H1*sizeof(int));
char const *deps[] = { "system" };
hclib_launch(entrypoint, ran, deps, 1);
printf("Check results: ");
int i = 0;
while(i < H1) {
assert(ran[i] == i);
i++;
}
printf("OK\n");
return 0;
}
|
#include "hclib.h"
#ifdef __cplusplus
#include "hclib_cpp.h"
#include "hclib_system.h"
#ifdef __CUDACC__
#include "hclib_cuda.h"
#endif
#endif
/**
*
* @file pdpltmg.c
*
* PLASMA auxiliary routines
* PLASMA is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.6.0
* @author Mathieu Faverge
* @date 2010-11-15
* @generated d Tue Jan 7 11:45:12 2014
*
**/
#include "common.h"
#define A(m, n) BLKADDR(A, double, m, n)
/***************************************************************************//**
* Parallel tile matrix generation - dynamic scheduling
**/
typedef struct _pragma35_omp_task {
double (*(*dA_ptr));
int (*m_ptr);
int (*n_ptr);
int (*ldam_ptr);
int (*tempmm_ptr);
int (*tempnn_ptr);
PLASMA_desc (*A_ptr);
unsigned long long (*seed_ptr);
} pragma35_omp_task;
static void *pragma35_omp_task_hclib_async(void *____arg);
void plasma_pdpltmg_quark(PLASMA_desc A, unsigned long long int seed)
{
int m, n;
int ldam;
int tempmm, tempnn;
for (m = 0; m < A.mt; m++) {
tempmm = m == A.mt-1 ? A.m-m*A.mb : A.mb;
ldam = BLKLDD(A, m);
for (n = 0; n < A.nt; n++) {
tempnn = n == A.nt-1 ? A.n-n*A.nb : A.nb;
double *dA = A(m, n);
{
pragma35_omp_task *new_ctx = (pragma35_omp_task *)malloc(sizeof(pragma35_omp_task));
new_ctx->dA_ptr = &(dA);
new_ctx->m_ptr = &(m);
new_ctx->n_ptr = &(n);
new_ctx->ldam_ptr = &(ldam);
new_ctx->tempmm_ptr = &(tempmm);
new_ctx->tempnn_ptr = &(tempnn);
new_ctx->A_ptr = &(A);
new_ctx->seed_ptr = &(seed);
hclib_emulate_omp_task(pragma35_omp_task_hclib_async, new_ctx, ANY_PLACE, 0, 1, (dA) + (0), tempnn*ldam);
} ;
}
}
}
static void *pragma35_omp_task_hclib_async(void *____arg) {
pragma35_omp_task *ctx = (pragma35_omp_task *)____arg;
hclib_start_finish();
CORE_dplrnt((*(ctx->tempmm_ptr)), (*(ctx->tempnn_ptr)), (*(ctx->dA_ptr)), (*(ctx->ldam_ptr)), (*(ctx->A_ptr)).m, (*(ctx->m_ptr))*(*(ctx->A_ptr)).mb, (*(ctx->n_ptr))*(*(ctx->A_ptr)).nb, (*(ctx->seed_ptr))) ; ; hclib_end_finish_nonblocking();
free(____arg);
return NULL;
}
/***************************************************************************//**
* Parallel tile matrix generation - dynamic scheduling
* Same as previous function, without OpenMP pragma. Used to check solution.
**/
void plasma_pdpltmg_seq(PLASMA_desc A, unsigned long long int seed)
{
int m, n;
int ldam;
int tempmm, tempnn;
for (m = 0; m < A.mt; m++) {
tempmm = m == A.mt-1 ? A.m-m*A.mb : A.mb;
ldam = BLKLDD(A, m);
for (n = 0; n < A.nt; n++) {
tempnn = n == A.nt-1 ? A.n-n*A.nb : A.nb;
double *dA = A(m, n);
CORE_dplrnt(tempmm, tempnn, dA, ldam, A.m, m*A.mb, n*A.nb, seed);
}
}
}
|
/*
* Copyright (c) 2012 The Native Client 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 <mach/exception.h>
#include <mach/mach.h>
#include <mach/task.h>
#include <pthread.h>
#include "native_client/src/shared/gio/gio.h"
#include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/trusted/service_runtime/nacl_all_modules.h"
#include "native_client/src/trusted/service_runtime/nacl_app.h"
#include "native_client/src/trusted/service_runtime/nacl_valgrind_hooks.h"
#include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
#include "native_client/src/trusted/service_runtime/osx/mach_exception_handler.h"
#include "native_client/src/trusted/service_runtime/sel_ldr.h"
/*
* This function is provided by OS X's system libraries but the
* headers lack a prototype for it. This function is generated by
* running MIG on /usr/include/mach/exc.defs.
*/
boolean_t exc_server(mach_msg_header_t *request, mach_msg_header_t *reply);
int g_expect_crash;
/*
* exc_server() calls this function, and finds it via dlsym(). We
* need to change the symbol's visibility in order to make it visible
* to dlsym(). For details, see
* http://code.google.com/p/google-breakpad/issues/detail?id=345
*/
__attribute__((visibility("default")))
kern_return_t catch_exception_raise(mach_port_t port,
mach_port_t crashing_thread,
mach_port_t task,
exception_type_t exception_type,
exception_data_t exception_code,
mach_msg_type_number_t code_count) {
UNREFERENCED_PARAMETER(port);
UNREFERENCED_PARAMETER(crashing_thread);
UNREFERENCED_PARAMETER(exception_type);
UNREFERENCED_PARAMETER(exception_code);
UNREFERENCED_PARAMETER(code_count);
CHECK(task == mach_task_self());
CHECK(g_expect_crash);
fprintf(stderr, "Received a trusted crash, as expected\n");
fprintf(stderr, "** intended_exit_status=0\n");
exit(0);
}
void *ExceptionHandlerThread(void *thread_arg) {
mach_port_t handler_port = (mach_port_t) (uintptr_t) thread_arg;
while (1) {
struct {
mach_msg_header_t header;
uint8_t data[256];
} receive;
mach_msg_header_t reply;
kern_return_t rc;
receive.header.msgh_local_port = handler_port;
receive.header.msgh_size = sizeof(receive);
rc = mach_msg(&receive.header,
MACH_RCV_MSG | MACH_RCV_LARGE, 0,
receive.header.msgh_size, handler_port,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
CHECK(rc == KERN_SUCCESS);
CHECK(exc_server(&receive.header, &reply));
exit(1);
}
return NULL;
}
void RegisterExceptionHandler(void) {
mach_port_t task = mach_task_self();
mach_port_t handler_port;
kern_return_t rc;
pthread_t tid;
int err;
/* Use the same mask as Breakpad. */
exception_mask_t exception_mask =
EXC_MASK_BAD_ACCESS |
EXC_MASK_BAD_INSTRUCTION |
EXC_MASK_ARITHMETIC |
EXC_MASK_BREAKPOINT;
rc = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &handler_port);
CHECK(rc == KERN_SUCCESS);
rc = mach_port_insert_right(task, handler_port, handler_port,
MACH_MSG_TYPE_MAKE_SEND);
CHECK(rc == KERN_SUCCESS);
err = pthread_create(&tid, NULL, ExceptionHandlerThread,
(void *) (uintptr_t) handler_port);
CHECK(err == 0);
err = pthread_detach(tid);
CHECK(err == 0);
rc = task_set_exception_ports(mach_task_self(), exception_mask,
handler_port, EXCEPTION_DEFAULT,
THREAD_STATE_NONE);
CHECK(rc == KERN_SUCCESS);
}
int main(int argc, char **argv) {
struct NaClApp app;
struct GioMemoryFileSnapshot gio_file;
/* Register file-local handler first (so it ends up second in the chain). */
if (strcmp(argv[1], "unforwarded_trusted") != 0) {
RegisterExceptionHandler();
}
/* Install untrusted exception catcher after local handler. */
CHECK(NaClInterceptMachExceptions());
if (argc == 2 && strcmp(argv[1], "early_trusted") == 0) {
g_expect_crash = 1;
/* Cause a crash. */
*(volatile int *) 0 = 0;
}
if (argc != 3) {
NaClLog(LOG_FATAL, "Expected 1 or 2 arguments\n");
}
if (strcmp(argv[1], "trusted") == 0) {
g_expect_crash = 1;
} else if (strcmp(argv[1], "unforwarded_trusted") == 0) {
fprintf(stderr, "** intended_exit_status=-10\n");
g_expect_crash = 0;
} else if (strcmp(argv[1], "untrusted") == 0) {
/* Expect the test to crash; untrusted crashes shouldn't be propagated. */
fprintf(stderr, "** intended_exit_status=-10\n");
g_expect_crash = 0;
} else if (strcmp(argv[1], "untrusted_caught") == 0) {
g_expect_crash = 0;
} else {
NaClLog(LOG_FATAL, "1st argument (%s) not recognised\n", argv[1]);
}
NaClAllModulesInit();
NaClFileNameForValgrind(argv[1]);
CHECK(GioMemoryFileSnapshotCtor(&gio_file, argv[2]));
CHECK(NaClAppCtor(&app));
app.enable_exception_handling = 1;
CHECK(NaClAppLoadFile((struct Gio *) &gio_file, &app) == LOAD_OK);
CHECK(NaClAppPrepareToLaunch(&app) == LOAD_OK);
CHECK(NaClCreateMainThread(&app, 0, NULL, NULL));
CHECK(NaClWaitForMainThreadToExit(&app) == 0);
if (g_expect_crash) {
NaClLog(LOG_FATAL, "Did not expect the guest code to exit\n");
return 1;
} else {
fprintf(stderr, "No crashes, as intended.\n");
fprintf(stderr, "** intended_exit_status=0\n");
return 0;
}
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__char_max_add_45.c
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-45.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: max Set data to the max value for char
* 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: 45 Data flow: data passed as a static global variable from one function to another in the same source file
*
* */
#include "std_testcase.h"
static char CWE190_Integer_Overflow__char_max_add_45_badData;
static char CWE190_Integer_Overflow__char_max_add_45_goodG2BData;
static char CWE190_Integer_Overflow__char_max_add_45_goodB2GData;
#ifndef OMITBAD
static void badSink()
{
char data = CWE190_Integer_Overflow__char_max_add_45_badData;
{
/* POTENTIAL FLAW: Adding 1 to data could cause an overflow */
char result = data + 1;
printHexCharLine(result);
}
}
void CWE190_Integer_Overflow__char_max_add_45_bad()
{
char data;
data = ' ';
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = CHAR_MAX;
CWE190_Integer_Overflow__char_max_add_45_badData = data;
badSink();
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSink()
{
char data = CWE190_Integer_Overflow__char_max_add_45_goodG2BData;
{
/* POTENTIAL FLAW: Adding 1 to data could cause an overflow */
char result = data + 1;
printHexCharLine(result);
}
}
static void goodG2B()
{
char data;
data = ' ';
/* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */
data = 2;
CWE190_Integer_Overflow__char_max_add_45_goodG2BData = data;
goodG2BSink();
}
/* goodB2G() uses the BadSource with the GoodSink */
static void goodB2GSink()
{
char data = CWE190_Integer_Overflow__char_max_add_45_goodB2GData;
/* FIX: Add a check to prevent an overflow from occurring */
if (data < CHAR_MAX)
{
char result = data + 1;
printHexCharLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
static void goodB2G()
{
char data;
data = ' ';
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = CHAR_MAX;
CWE190_Integer_Overflow__char_max_add_45_goodB2GData = data;
goodB2GSink();
}
void CWE190_Integer_Overflow__char_max_add_45_good()
{
goodG2B();
goodB2G();
}
#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()...");
CWE190_Integer_Overflow__char_max_add_45_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__char_max_add_45_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright 2016 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 UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_
#define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/animation/ink_drop_ripple_observer.h"
#include "ui/views/animation/ink_drop_state.h"
#include "ui/views/animation/test/test_ink_drop_animation_observer_helper.h"
namespace views {
class InkDropRipple;
namespace test {
// Simple InkDropRippleObserver test double that tracks if InkDropRippleObserver
// methods are invoked and the parameters used for the last invocation.
class TestInkDropRippleObserver
: public InkDropRippleObserver,
public TestInkDropAnimationObserverHelper<InkDropState> {
public:
TestInkDropRippleObserver();
TestInkDropRippleObserver(const TestInkDropRippleObserver&) = delete;
TestInkDropRippleObserver& operator=(const TestInkDropRippleObserver&) =
delete;
~TestInkDropRippleObserver() override;
void set_ink_drop_ripple(InkDropRipple* ink_drop_ripple) {
ink_drop_ripple_ = ink_drop_ripple;
}
InkDropState target_state_at_last_animation_started() const {
return target_state_at_last_animation_started_;
}
InkDropState target_state_at_last_animation_ended() const {
return target_state_at_last_animation_ended_;
}
// InkDropRippleObserver:
void AnimationStarted(InkDropState ink_drop_state) override;
void AnimationEnded(InkDropState ink_drop_state,
InkDropAnimationEndedReason reason) override;
private:
// The type this inherits from. Reduces verbosity in .cc file.
using ObserverHelper = TestInkDropAnimationObserverHelper<InkDropState>;
// The value of InkDropRipple::GetTargetInkDropState() the last time an
// AnimationStarted() event was handled. This is only valid if
// |ink_drop_ripple_| is not null.
InkDropState target_state_at_last_animation_started_ = InkDropState::HIDDEN;
// The value of InkDropRipple::GetTargetInkDropState() the last time an
// AnimationEnded() event was handled. This is only valid if
// |ink_drop_ripple_| is not null.
InkDropState target_state_at_last_animation_ended_ = InkDropState::HIDDEN;
// An InkDropRipple to spy info from when notifications are handled.
InkDropRipple* ink_drop_ripple_;
};
} // namespace test
} // namespace views
#endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68b.c
Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml
Template File: sources-sink-68b.tmpl.c
*/
/*
* @description
* CWE: 124 Buffer Underwrite
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sink: memcpy
* BadSink : Copy string to data using memcpy
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
extern wchar_t * CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68_badData;
extern wchar_t * CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68_goodG2BData;
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68b_badSink()
{
wchar_t * data = CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68_badData;
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(wchar_t));
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68b_goodG2BSink()
{
wchar_t * data = CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_68_goodG2BData;
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with 'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
memcpy(data, source, 100*sizeof(wchar_t));
/* Ensure the destination buffer is null terminated */
data[100-1] = L'\0';
printWLine(data);
}
}
#endif /* OMITGOOD */
|
/*
Copyright (c) 2016, James Sullivan <sullivan.james.f@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the <organization> 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 <COPYRIGHT HOLDER>
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 _SYS_SYSCALL_CONSTANTS_H_
#define _SYS_SYSCALL_CONSTANTS_H_
#include <stddef.h>
#include <machine/regs.h>
#include <sys/proc.h>
#define SYS_MAXARGS 6
typedef struct {
const char *const name;
size_t num_args;
void *fun;
} sysent_t;
extern const sysent_t syscalls[];
typedef struct {
size_t num_args;
reg_t args[SYS_MAXARGS];
} syscall_args_t;
/* Forward declaration of each system call */
#define SYSCALL(name, ...) int sys_##name(int *errno, ##__VA_ARGS__)
SYSCALL(exit, int status); // 0
SYSCALL(fork); // 1
#endif
|
/*
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef PC_ICE_TRANSPORT_H_
#define PC_ICE_TRANSPORT_H_
#include "api/ice_transport_interface.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_checker.h"
namespace webrtc {
// Implementation of IceTransportInterface that does not take ownership
// of its underlying IceTransport. It depends on its creator class to
// ensure that Clear() is called before the underlying IceTransport
// is deallocated.
class IceTransportWithPointer : public IceTransportInterface {
public:
explicit IceTransportWithPointer(cricket::IceTransportInternal* internal)
: creator_thread_(rtc::Thread::Current()), internal_(internal) {
RTC_DCHECK(internal_);
}
cricket::IceTransportInternal* internal() override;
// This call will ensure that the pointer passed at construction is
// no longer in use by this object. Later calls to internal() will return
// null.
void Clear();
protected:
~IceTransportWithPointer() override;
private:
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(IceTransportWithPointer);
const rtc::Thread* creator_thread_;
cricket::IceTransportInternal* internal_ RTC_GUARDED_BY(creator_thread_);
};
} // namespace webrtc
#endif // PC_ICE_TRANSPORT_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__char_console_vfprintf_41.c
Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml
Template File: sources-vasinks-41.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: console Read input from the console
* GoodSource: Copy a fixed string into data
* Sinks: vfprintf
* GoodSink: vfprintf with a format string
* BadSink : vfprintf without a format string
* Flow Variant: 41 Data flow: data passed as an argument from one function to another in the same source file
*
* */
#include <stdarg.h>
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifndef OMITBAD
static void badVaSink(char * data, ...)
{
{
va_list args;
va_start(args, data);
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
vfprintf(stdout, data, args);
va_end(args);
}
}
static void badSink(char * data)
{
badVaSink(data, data);
}
void CWE134_Uncontrolled_Format_String__char_console_vfprintf_41_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgets() */
dataLen = strlen(data);
if (dataLen > 0 && data[dataLen-1] == '\n')
{
data[dataLen-1] = '\0';
}
}
else
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
}
}
badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2BVaSink(char * data, ...)
{
{
va_list args;
va_start(args, data);
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
vfprintf(stdout, data, args);
va_end(args);
}
}
static void goodG2BSink(char * data)
{
goodG2BVaSink(data, data);
}
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Use a fixed string that does not contain a format specifier */
strcpy(data, "fixedstringtest");
goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
static void goodB2GVaSink(char * data, ...)
{
{
va_list args;
va_start(args, data);
/* FIX: Specify the format disallowing a format string vulnerability */
vfprintf(stdout, "%s", args);
va_end(args);
}
}
static void goodB2GSink(char * data)
{
goodB2GVaSink(data, data);
}
static void goodB2G()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgets() */
dataLen = strlen(data);
if (dataLen > 0 && data[dataLen-1] == '\n')
{
data[dataLen-1] = '\0';
}
}
else
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
}
}
goodB2GSink(data);
}
void CWE134_Uncontrolled_Format_String__char_console_vfprintf_41_good()
{
goodG2B();
goodB2G();
}
#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()...");
CWE134_Uncontrolled_Format_String__char_console_vfprintf_41_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE134_Uncontrolled_Format_String__char_console_vfprintf_41_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
#error "Only <bson.h> can be included directly."
#endif
#ifndef BSON_VERSION_H
#define BSON_VERSION_H
/**
* BSON_MAJOR_VERSION:
*
* BSON major version component (e.g. 1 if %BSON_VERSION is 1.2.3)
*/
#define BSON_MAJOR_VERSION (1)
/**
* BSON_MINOR_VERSION:
*
* BSON minor version component (e.g. 2 if %BSON_VERSION is 1.2.3)
*/
#define BSON_MINOR_VERSION (9)
/**
* BSON_MICRO_VERSION:
*
* BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3)
*/
#define BSON_MICRO_VERSION (5)
/**
* BSON_PRERELEASE_VERSION:
*
* BSON prerelease version component (e.g. rc0 if %BSON_VERSION is 1.2.3-rc0)
*/
#define BSON_PRERELEASE_VERSION ()
/**
* BSON_VERSION:
*
* BSON version.
*/
#define BSON_VERSION (1.9.5)
/**
* BSON_VERSION_S:
*
* BSON version, encoded as a string, useful for printing and
* concatenation.
*/
#define BSON_VERSION_S "1.9.5"
/**
* BSON_VERSION_HEX:
*
* BSON version, encoded as an hexadecimal number, useful for
* integer comparisons.
*/
#define BSON_VERSION_HEX (BSON_MAJOR_VERSION << 24 | \
BSON_MINOR_VERSION << 16 | \
BSON_MICRO_VERSION << 8)
/**
* BSON_CHECK_VERSION:
* @major: required major version
* @minor: required minor version
* @micro: required micro version
*
* Compile-time version checking. Evaluates to %TRUE if the version
* of BSON is greater than the required one.
*/
#define BSON_CHECK_VERSION(major,minor,micro) \
(BSON_MAJOR_VERSION > (major) || \
(BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION > (minor)) || \
(BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION == (minor) && \
BSON_MICRO_VERSION >= (micro)))
#endif /* BSON_VERSION_H */
|
/*
* Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <string.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include "internal/sslconf.h"
#include "conf_lcl.h"
/*
* SSL library configuration module placeholder. We load it here but defer
* all decisions about its contents to libssl.
*/
struct ssl_conf_name_st {
/* Name of this set of commands */
char *name;
/* List of commands */
SSL_CONF_CMD *cmds;
/* Number of commands */
size_t cmd_count;
};
struct ssl_conf_cmd_st {
/* Command */
char *cmd;
/* Argument */
char *arg;
};
static struct ssl_conf_name_st *ssl_names;
static size_t ssl_names_count;
static void ssl_module_free(CONF_IMODULE *md)
{
size_t i, j;
if (ssl_names == NULL)
return;
for (i = 0; i < ssl_names_count; i++) {
struct ssl_conf_name_st *tname = ssl_names + i;
OPENSSL_free(tname->name);
for (j = 0; j < tname->cmd_count; j++) {
OPENSSL_free(tname->cmds[j].cmd);
OPENSSL_free(tname->cmds[j].arg);
}
OPENSSL_free(tname->cmds);
}
OPENSSL_free(ssl_names);
ssl_names = NULL;
ssl_names_count = 0;
}
static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
{
size_t i, j, cnt;
int rv = 0;
const char *ssl_conf_section;
STACK_OF(CONF_VALUE) *cmd_lists;
ssl_conf_section = CONF_imodule_get_value(md);
cmd_lists = NCONF_get_section(cnf, ssl_conf_section);
if (sk_CONF_VALUE_num(cmd_lists) <= 0) {
if (cmd_lists == NULL)
CONFerr(CONF_F_SSL_MODULE_INIT, CONF_R_SSL_SECTION_NOT_FOUND);
else
CONFerr(CONF_F_SSL_MODULE_INIT, CONF_R_SSL_SECTION_EMPTY);
ERR_add_error_data(2, "section=", ssl_conf_section);
goto err;
}
cnt = sk_CONF_VALUE_num(cmd_lists);
ssl_module_free(md);
ssl_names = OPENSSL_zalloc(sizeof(*ssl_names) * cnt);
if (ssl_names == NULL)
goto err;
ssl_names_count = cnt;
for (i = 0; i < ssl_names_count; i++) {
struct ssl_conf_name_st *ssl_name = ssl_names + i;
CONF_VALUE *sect = sk_CONF_VALUE_value(cmd_lists, (int)i);
STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value);
if (sk_CONF_VALUE_num(cmds) <= 0) {
if (cmds == NULL)
CONFerr(CONF_F_SSL_MODULE_INIT,
CONF_R_SSL_COMMAND_SECTION_NOT_FOUND);
else
CONFerr(CONF_F_SSL_MODULE_INIT,
CONF_R_SSL_COMMAND_SECTION_EMPTY);
ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value);
goto err;
}
ssl_name->name = OPENSSL_strdup(sect->name);
if (ssl_name->name == NULL)
goto err;
cnt = sk_CONF_VALUE_num(cmds);
ssl_name->cmds = OPENSSL_zalloc(cnt * sizeof(struct ssl_conf_cmd_st));
if (ssl_name->cmds == NULL)
goto err;
ssl_name->cmd_count = cnt;
for (j = 0; j < cnt; j++) {
const char *name;
CONF_VALUE *cmd_conf = sk_CONF_VALUE_value(cmds, (int)j);
struct ssl_conf_cmd_st *cmd = ssl_name->cmds + j;
/* Skip any initial dot in name */
name = strchr(cmd_conf->name, '.');
if (name != NULL)
name++;
else
name = cmd_conf->name;
cmd->cmd = OPENSSL_strdup(name);
cmd->arg = OPENSSL_strdup(cmd_conf->value);
if (cmd->cmd == NULL || cmd->arg == NULL)
goto err;
}
}
rv = 1;
err:
if (rv == 0)
ssl_module_free(md);
return rv;
}
/*
* Returns the set of commands with index |idx| previously searched for via
* conf_ssl_name_find. Also stores the name of the set of commands in |*name|
* and the number of commands in the set in |*cnt|.
*/
const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt)
{
*name = ssl_names[idx].name;
*cnt = ssl_names[idx].cmd_count;
return ssl_names[idx].cmds;
}
/*
* Search for the named set of commands given in |name|. On success return the
* index for the command set in |*idx|.
* Returns 1 on success or 0 on failure.
*/
int conf_ssl_name_find(const char *name, size_t *idx)
{
size_t i;
const struct ssl_conf_name_st *nm;
if (name == NULL)
return 0;
for (i = 0, nm = ssl_names; i < ssl_names_count; i++, nm++) {
if (strcmp(nm->name, name) == 0) {
*idx = i;
return 1;
}
}
return 0;
}
/*
* Given a command set |cmd|, return details on the command at index |idx| which
* must be less than the number of commands in the set (as returned by
* conf_ssl_get). The name of the command will be returned in |*cmdstr| and the
* argument is returned in |*arg|.
*/
void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr,
char **arg)
{
*cmdstr = cmd[idx].cmd;
*arg = cmd[idx].arg;
}
void conf_add_ssl_module(void)
{
CONF_module_add("ssl_conf", ssl_module_init, ssl_module_free);
}
|
/*
* tcbmrom.h
*
* Written by
* Andreas Boose <viceteam@t-online.de>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_TCBMROM_H
#define VICE_TCBMROM_H
#include "types.h"
struct drive_s;
extern void tcbmrom_init(void);
extern void tcbmrom_setup_image(struct drive_s *drive);
extern int tcbmrom_read(unsigned int type, WORD addr, BYTE *data);
extern int tcbmrom_check_loaded(unsigned int type);
extern int tcbmrom_load_1551(void);
#endif
|
//
// WWKViewController.h
// WealthWorksKit
//
// Created by 张建磊 on 08/06/2016.
// Copyright (c) 2016 张建磊. All rights reserved.
//
@import UIKit;
@interface WWKViewController : UIViewController
@end
|
//
// UIImage+BoxBlur.h
// LiveBlurView
//
// Created by Alex Usbergo on 7/3/13.
// Copyright (c) 2013 Alex Usbergo. All rights reserved.
//
// algorithm from: http://indieambitions.com/idevblogaday/perform-blur-vimage-accelerate-framework-tutorial/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+IndieAmbitions+%28Indie+Ambitions%29
#import <UIKit/UIKit.h>
@interface UIImage (BoxBlur)
/* blur the current image with a box blur algoritm */
- (UIImage*)drn_boxblurImageWithBlur:(CGFloat)blur;
/* blur the current image with a box blur algoritm and tint with a color */
- (UIImage*)drn_boxblurImageWithBlur:(CGFloat)blur withTintColor:(UIColor*)tintColor;
- (UIImage *)blurredImageWithRadius:(CGFloat)radius iterations:(NSUInteger)iterations tintColor:(UIColor *)tintColor;
@end |
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _DAEMON_MDNS_H_
#define _DAEMON_MDNS_H_
void setup_mdns(int port);
#endif // _DAEMON_MDNS_H_
|
/*
inet/inet.h
Created: Dec 30, 1991 by Philip Homburg
Copyright 1995 Philip Homburg
*/
#ifndef INET__INET_H
#define INET__INET_H
#define _SYSTEM 1 /* get OK and negative error codes */
#include <sys/types.h>
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioc_file.h>
#include <sys/time.h>
#include <minix/config.h>
#include <minix/type.h>
#define _NORETURN /* Should be non empty for GCC */
typedef int ioreq_t;
#include <minix/const.h>
#include <minix/com.h>
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_hdr.h>
#include <net/gen/eth_io.h>
#include <net/gen/in.h>
#include <net/gen/ip_hdr.h>
#include <net/gen/ip_io.h>
#include <net/gen/icmp.h>
#include <net/gen/icmp_hdr.h>
#include <net/gen/oneCsum.h>
#include <net/gen/psip_hdr.h>
#include <net/gen/psip_io.h>
#include <net/gen/route.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp_hdr.h>
#include <net/gen/tcp_io.h>
#include <net/gen/udp.h>
#include <net/gen/udp_hdr.h>
#include <net/gen/udp_io.h>
#include <net/gen/arp_io.h>
#include <net/ioctl.h>
#include "const.h"
#include "inet_config.h"
#define PUBLIC
#define EXTERN extern
#define PRIVATE static
#define FORWARD static
#define THIS_FILE static char *this_file= __FILE__;
_PROTOTYPE( void panic0, (char *file, int line) );
_PROTOTYPE( void inet_panic, (void) ) _NORETURN;
#define ip_panic(print_list) \
(panic0(this_file, __LINE__), printf print_list, panic())
#define panic() inet_panic()
#if DEBUG
#define ip_warning(print_list) \
( \
printf("warning at %s, %d: ", this_file, __LINE__), \
printf print_list, \
printf("\ninet stacktrace: "), \
util_stacktrace() \
)
#else
#define ip_warning(print_list) ((void) 0)
#endif
#define DBLOCK(level, code) \
do { if ((level) & DEBUG) { where(); code; } } while(0)
#define DIFBLOCK(level, condition, code) \
do { if (((level) & DEBUG) && (condition)) \
{ where(); code; } } while(0)
#if _ANSI
#define ARGS(x) x
#else /* _ANSI */
#define ARGS(x) ()
#endif /* _ANSI */
extern int this_proc;
extern char version[];
#ifndef HZ
EXTERN u32_t system_hz;
#define HZ system_hz
#define HZ_DYNAMIC 1
#endif
#endif /* INET__INET_H */
/*
* $PchId: inet.h,v 1.16 2005/06/28 14:27:54 philip Exp $
*/
|
//
// UITableView+cellIndex.h
// WeiBo
//
// Created by qingyun on 15/6/26.
// Copyright (c) 2015年 qingyun.con. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITableView (cellIndex)
- (NSInteger)cellIndexForIndexPath:(NSIndexPath *)indexPath;
@end
|
//
// AppDelegate.h
// TouchTracker
//
// Created by Zeon Waa on 3/8/17.
// Copyright © 2017 Zeon Waa. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// PXSuccessViewController.h
// ZhonglieApp
//
// Created by 邱思雨 on 15/6/9.
// Copyright (c) 2015年 PX. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PXSuccessViewController : UIViewController
@end
|
/*
* Copyright (c) 2016, Pycom Limited.
*
* This software is licensed under the GNU GPL version 3 or any
* later version, with permitted additional terms. For more information
* see the Pycom Licence v1.0 document supplied with this file, or
* available at https://www.pycom.io/opensource/licensing
*/
#ifndef MPEXCEPTION_H_
#define MPEXCEPTION_H_
extern const char mpexception_os_resource_not_avaliable[];
extern const char mpexception_os_operation_failed[];
extern const char mpexception_os_request_not_possible[];
extern const char mpexception_value_invalid_arguments[];
extern const char mpexception_num_type_invalid_arguments[];
extern void mpexception_init0 (void);
#endif /* MPEXCEPTION_H_ */
|
#include <AT91SAM7S64.h>
#include <interrupt-utils.h>
#include <string.h>
#include <debug-uart.h>
#include <ctype.h>
#include <stdio.h>
#include <dev/cc2420.h>
#include <dev/cc2420_const.h>
#include <dev/spi.h>
#include <dev/leds.h>
#include <sys/process.h>
#include <sys/procinit.h>
#include <sys/autostart.h>
#include <sys/etimer.h>
#include <net/psock.h>
#include <unistd.h>
#include <stepper-steps.h>
#include <stepper.h>
#include <stepper-move.h>
#include "net/mac/nullmac.h"
#include "net/rime.h"
#ifndef RF_CHANNEL
#define RF_CHANNEL 15
#endif
#ifndef WITH_UIP
#define WITH_UIP 1
#endif
#if WITH_UIP
#include "net/uip.h"
#include "net/uip-fw.h"
#include "net/uip-fw-drv.h"
#include "net/uip-over-mesh.h"
static struct uip_fw_netif meshif =
{UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)};
#define UIP_OVER_MESH_CHANNEL 9
#endif /* WITH_UIP */
static rimeaddr_t node_addr = {{0,2}};
extern char __heap_end__;
extern char __heap_start__;
static const uint32_t stepper0_steps_acc[] = MICRO_STEP(0,3);
static const uint32_t stepper0_steps_run[] = MICRO_STEP(0,2);
static const uint32_t stepper0_steps_hold[] = MICRO_STEP(0,1);
static const uint32_t stepper1_steps_acc[] = MICRO_STEP(1,3);
static const uint32_t stepper1_steps_run[] = MICRO_STEP(1,2);
static const uint32_t stepper1_steps_hold[] = MICRO_STEP(1,1);
static StepperAccSeq seq_heap[40];
static void
init_seq_heap()
{
unsigned int i;
for(i = 0; i < sizeof(seq_heap)/sizeof(seq_heap[0]); i++) {
seq_heap[i].next = NULL;
stepper_free_seq(&seq_heap[i]);
}
}
static void
robot_stepper_init()
{
init_seq_heap();
stepper_init(AT91C_BASE_TC0, AT91C_ID_TC0);
*AT91C_PIOA_OER = STEPPER_INHIBIT;
*AT91C_PIOA_MDER = STEPPER_INHIBIT; /* | STEPPER0_IOMASK; */
*AT91C_PIOA_CODR = STEPPER_INHIBIT;
stepper_init_io(1, STEPPER_IOMASK(0), stepper0_steps_acc,
stepper0_steps_run, stepper0_steps_hold,
(sizeof(stepper0_steps_run) / sizeof(stepper0_steps_run[0])));
stepper_init_io(0, STEPPER_IOMASK(1), stepper1_steps_acc,
stepper1_steps_run, stepper1_steps_hold,
(sizeof(stepper1_steps_run) / sizeof(stepper1_steps_run[0])));}
#if 0
/* Wathcdog is already disabled in startup code */
static void
wdt_setup()
{
}
#endif
static void
wdt_reset()
{
*AT91C_WDTC_WDCR = (0xa5<<24) | AT91C_WDTC_WDRSTT;
}
#if 0
static uip_ipaddr_t gw_addr = {{172,16,0,1}};
#endif
int
main()
{
disableIRQ();
disableFIQ();
*AT91C_AIC_IDCR = 0xffffffff;
*AT91C_PMC_PCDR = 0xffffffff;
*AT91C_PMC_PCER = (1 << AT91C_ID_PIOA);
dbg_setup_uart();
printf("Initialising\n");
leds_arch_init();
clock_init();
process_init();
process_start(&etimer_process, NULL);
ctimer_init();
robot_stepper_init();
enableIRQ();
cc2420_init();
cc2420_set_pan_addr(0x2024, 0, &uip_hostaddr.u16[1]);
cc2420_set_channel(RF_CHANNEL);
rime_init(nullmac_init(&cc2420_driver));
printf("CC2420 setup done\n");
rimeaddr_set_node_addr(&node_addr);
#if WITH_UIP
{
uip_ipaddr_t hostaddr, netmask;
uip_init();
uip_ipaddr(&hostaddr, 172,16,
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
uip_ipaddr(&netmask, 255,255,0,0);
uip_ipaddr_copy(&meshif.ipaddr, &hostaddr);
printf("Host addr\n");
uip_sethostaddr(&hostaddr);
uip_setnetmask(&netmask);
uip_over_mesh_set_net(&hostaddr, &netmask);
/* uip_fw_register(&slipif);*/
/*uip_over_mesh_set_gateway_netif(&slipif);*/
uip_fw_default(&meshif);
printf("Mesh init\n");
uip_over_mesh_init(UIP_OVER_MESH_CHANNEL);
printf("uIP started with IP address %d.%d.%d.%d\n",
uip_ipaddr_to_quad(&hostaddr));
}
#endif /* WITH_UIP */
#if WITH_UIP
process_start(&tcpip_process, NULL);
process_start(&uip_fw_process, NULL); /* Start IP output */
#endif /* WITH_UIP */
printf("Heap size: %ld bytes\n", &__heap_end__ - (char*)sbrk(0));
printf("Started\n");
autostart_start(autostart_processes);
printf("Processes running\n");
while(1) {
do {
/* Reset watchdog. */
wdt_reset();
} while(process_run() > 0);
/* Idle! */
/* Stop processor clock */
*AT91C_PMC_SCDR |= AT91C_PMC_PCK;
}
return 0;
}
|
//
// SOMessageInputView.h
// SOMessaging
//
// Created by : arturdev
// Copyright (c) 2014 SocialObjects Software. 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
#import <UIKit/UIKit.h>
#import "SOPlaceholderedTextView.h"
#import "SOMessagingDelegate.h"
#define kAutoResizingMaskAll UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth
@interface SOMessageInputView : UIView
@property (weak, nonatomic) UITableView *tableView;
#pragma mark - Properties
@property (strong, nonatomic) UIImageView *textBgImageView;
@property (strong, nonatomic) SOPlaceholderedTextView *textView;
@property (strong, nonatomic) UIButton *sendButton;
@property (strong, nonatomic) UIButton *mediaButton;
@property (strong, nonatomic) UIView *separatorView;
@property (nonatomic, readonly) BOOL viewIsDragging;
/**
* After setting above properties make sure that you called
* -adjustInputView method for apply changes
*/
@property (nonatomic) CGFloat textInitialHeight;
@property (nonatomic) CGFloat textMaxHeight;
@property (nonatomic) CGFloat textTopMargin;
@property (nonatomic) CGFloat textBottomMargin;
@property (nonatomic) CGFloat textleftMargin;
@property (nonatomic) CGFloat textRightMargin;
//--
@property (weak, nonatomic) id<SOMessagingDelegate> delegate;
#pragma mark - Methods
- (void)adjustInputView;
- (void)adjustPosition;
@end
|
#ifndef __FILTER__H__
#define __FILTER__H__
#include <Python.h>
#include "image_utils.h"
#if PY_MAJOR_VERSION >= 3
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_Check PyLong_Check
#define PyString_Check PyBytes_Check
#define PyString_AsString PyBytes_AsString
#define PyString_Size PyBytes_Size
#endif
#if PY_MAJOR_VERSION >= 3
#define FILTER_MODULE(NAME, DOC) \
static PyMethodDef NAME ## _methods[] = { \
{"apply", NAME ## _apply, METH_VARARGS, DOC}, \
{0, 0, 0, 0} \
}; \
static struct PyModuleDef NAME ## _moduledef = { \
PyModuleDef_HEAD_INIT, \
#NAME, \
DOC, \
-1, \
NAME ## _methods, \
NULL, \
NULL, \
NULL, \
NULL, \
};\
PyMODINIT_FUNC PyInit_ ## NAME(void) { \
return PyModule_Create(&NAME ## _moduledef); \
};
#else
#define FILTER_MODULE(NAME, DOC) \
static PyMethodDef NAME ## _methods[] = { \
{"apply", NAME ## _apply, METH_VARARGS, DOC}, \
{0, 0, 0, 0} \
}; \
PyMODINIT_FUNC init ## NAME(void) { \
Py_InitModule3(#NAME, NAME ## _methods, #NAME " native module"); \
};
#endif
#endif
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Josef Gajdusek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <string.h>
#include "py/objtuple.h"
#include "py/objstr.h"
#include "extmod/misc.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
#include "genhdr/mpversion.h"
#include "esp_mphal.h"
#include "user_interface.h"
STATIC const qstr os_uname_info_fields[] = {
MP_QSTR_sysname, MP_QSTR_nodename,
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
};
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
STATIC mp_obj_tuple_t os_uname_info_obj = {
.base = {&mp_type_attrtuple},
.len = 5,
.items = {
(mp_obj_t)&os_uname_info_sysname_obj,
(mp_obj_t)&os_uname_info_nodename_obj,
NULL,
(mp_obj_t)&os_uname_info_version_obj,
(mp_obj_t)&os_uname_info_machine_obj,
(void *)os_uname_info_fields,
}
};
STATIC mp_obj_t os_uname(void) {
// We must populate the "release" field each time in case it was GC'd since the last call.
const char *ver = system_get_sdk_version();
os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver));
return (mp_obj_t)&os_uname_info_obj;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
STATIC mp_obj_t os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
for (int i = 0; i < n; i++) {
vstr.buf[i] = *WDEV_HWRNG;
}
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom);
// We wrap the mp_uos_dupterm function to detect if a UART is attached or not
mp_obj_t os_dupterm(size_t n_args, const mp_obj_t *args) {
mp_obj_t prev_obj = mp_uos_dupterm_obj.fun.var(n_args, args);
if (mp_obj_get_type(args[0]) == &pyb_uart_type) {
++uart_attached_to_dupterm;
}
if (mp_obj_get_type(prev_obj) == &pyb_uart_type) {
--uart_attached_to_dupterm;
}
return prev_obj;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_dupterm_obj, 1, 2, os_dupterm);
STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) {
(void)obj_in;
mp_hal_signal_dupterm_input();
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify);
STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) },
{ MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) },
{ MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) },
#if MICROPY_PY_OS_DUPTERM
{ MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&os_dupterm_obj) },
{ MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&os_dupterm_notify_obj) },
#endif
#if MICROPY_VFS_FAT
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
{ MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) },
{ MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) },
{ MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) },
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) },
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);
const mp_obj_module_t uos_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&os_module_globals,
};
|
#pragma once
#include "resource.h"
// C RunTime Header Files
#include "CCStdC.h"
#include <string>
#include "SimulatorConfig.h"
class ProjectConfigDialog
{
public:
static bool showModal(HWND hwnd, ProjectConfig *project, const string dialogCaption = string(""), const string buttonCaption = string(""));
~ProjectConfigDialog(void) {
s_sharedInstance = NULL;
}
private:
ProjectConfigDialog(HWND hwnd)
: m_dialogResult(false)
, m_hwnd(hwnd)
, m_hwndDialog(NULL)
{
assert(s_sharedInstance == NULL);
s_sharedInstance = this;
}
static ProjectConfigDialog *sharedInstance(void) {
return s_sharedInstance;
}
static ProjectConfigDialog *s_sharedInstance;
ProjectConfig m_project;
string m_dialogCaption;
string m_buttonCaption;
bool m_dialogResult;
HWND m_hwnd;
HWND m_hwndDialog;
bool showDialog(ProjectConfig *project, const string dialogCaption, const string buttonCaption);
bool checkConfig(void);
void onInitDialog(HWND hwndDialog);
void onSelectProjectDir(void);
void onSelectScriptFile(void);
void onSelectWritablePath(void);
void onScreenSizeChanged(void);
void onScreenDirectionChanged(void);
void onOK(void);
// windows callback
static INT_PTR CALLBACK DialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
static int CALLBACK BrowseFolderCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
// update ui
void updateProjectDir(void);
void updateScriptFile(void);
void updateWritablePath(void);
// helper
const string browseFolder(const string baseDir);
static BOOL DirectoryExists(const string path);
static BOOL FileExists(const string path);
};
|
/*
* Copyright (c) 2010-2011 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef ATH9K_HW_OPS_H
#define ATH9K_HW_OPS_H
#include "hw.h"
/* Hardware core and driver accessible callbacks */
static inline void ath9k_hw_configpcipowersave(struct ath_hw *ah,
bool power_off)
{
if (ah->aspm_enabled != true)
return;
ath9k_hw_ops(ah)->config_pci_powersave(ah, power_off);
}
static inline void ath9k_hw_rxena(struct ath_hw *ah)
{
ath9k_hw_ops(ah)->rx_enable(ah);
}
static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,
u32 link)
{
ath9k_hw_ops(ah)->set_desc_link(ds, link);
}
static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
struct ath9k_channel *chan,
u8 rxchainmask,
bool longcal)
{
return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
}
static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
{
return ath9k_hw_ops(ah)->get_isr(ah, masked);
}
static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds,
struct ath_tx_info *i)
{
return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i);
}
static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds,
struct ath_tx_status *ts)
{
return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
}
static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
struct ath_hw_antcomb_conf *antconf)
{
ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
}
static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
struct ath_hw_antcomb_conf *antconf)
{
ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
}
/* Private hardware call ops */
/* PHY ops */
static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
}
static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
struct ath9k_channel *chan)
{
ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
}
static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
{
if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
return 0;
return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
}
static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
{
if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
return;
ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
}
static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
struct ath9k_channel *chan,
u16 modesIndex)
{
if (!ath9k_hw_private_ops(ah)->set_rf_regs)
return true;
return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
}
static inline void ath9k_hw_init_bb(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
}
static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
}
static inline int ath9k_hw_process_ini(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
}
static inline void ath9k_olc_init(struct ath_hw *ah)
{
if (!ath9k_hw_private_ops(ah)->olc_init)
return;
return ath9k_hw_private_ops(ah)->olc_init(ah);
}
static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
}
static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
{
return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
}
static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
}
static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
{
return ath9k_hw_private_ops(ah)->rfbus_req(ah);
}
static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
{
return ath9k_hw_private_ops(ah)->rfbus_done(ah);
}
static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
{
if (!ath9k_hw_private_ops(ah)->restore_chainmask)
return;
return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
}
static inline bool ath9k_hw_ani_control(struct ath_hw *ah,
enum ath9k_ani_cmd cmd, int param)
{
return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param);
}
static inline void ath9k_hw_do_getnf(struct ath_hw *ah,
int16_t nfarray[NUM_NF_READINGS])
{
ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray);
}
static inline bool ath9k_hw_init_cal(struct ath_hw *ah,
struct ath9k_channel *chan)
{
return ath9k_hw_private_ops(ah)->init_cal(ah, chan);
}
static inline void ath9k_hw_setup_calibration(struct ath_hw *ah,
struct ath9k_cal_list *currCal)
{
ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
}
#endif /* ATH9K_HW_OPS_H */
|
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996
* 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: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /home/repo-0.14/pmacct/include/extract.h,v 1.1.1.1 2006/11/19 15:16:07 paolo Exp $ (LBL)
*/
/* Network to host order macros */
#ifdef LBL_ALIGN
#define EXTRACT_16BITS(p) \
((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
(u_int16_t)*((const u_int8_t *)(p) + 1))
#define EXTRACT_32BITS(p) \
((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
(u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 3))
#else
#define EXTRACT_16BITS(p) \
((u_int16_t)ntohs(*(const u_int16_t *)(p)))
#define EXTRACT_32BITS(p) \
((u_int32_t)ntohl(*(const u_int32_t *)(p)))
#endif
#define EXTRACT_24BITS(p) \
((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 2))
/* Little endian protocol host order macros */
#define EXTRACT_LE_8BITS(p) (*(p))
#define EXTRACT_LE_16BITS(p) \
((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
(u_int16_t)*((const u_int8_t *)(p) + 0))
#define EXTRACT_LE_32BITS(p) \
((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
(u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 0))
|
/* comics-document.h: Implementation of EvDocument for comic book archives
* Copyright (C) 2005, Teemu Tervo <teemu.tervo@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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 __COMICS_DOCUMENT_H__
#define __COMICS_DOCUMENT_H__
#include "ev-document.h"
G_BEGIN_DECLS
#define COMICS_TYPE_DOCUMENT (comics_document_get_type ())
#define COMICS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMICS_TYPE_DOCUMENT, ComicsDocument))
#define COMICS_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMICS_TYPE_DOCUMENT))
typedef struct _ComicsDocument ComicsDocument;
GType comics_document_get_type (void) G_GNUC_CONST;
G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module);
G_END_DECLS
#endif /* __COMICS_DOCUMENT_H__ */
|
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef BUTTERFLY_EC_H
#define BUTTERFLY_EC_H
#define EC_SCI_GPI 13 /* GPIO13 is EC_SCI# */
/* EC SMI sources TODO: MLR- make defines */
#ifndef __ACPI__
extern void butterfly_ec_init(void);
#endif
#endif // BUTTERFLY_EC_H
|
/*
* This file is part of the KDE project
*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file this file is part of the Krita application in koffice
* @author Boudewijn Rempt
* @author comments by hscott
* @since 1.4 or 2005
*/
#ifndef _KIS_ANNOTATION_H_
#define _KIS_ANNOTATION_H_
#include <kis_shared.h>
#include "kis_shared_ptr_vector.h"
#include <QByteArray>
#include <QString>
/**
* @class KisAnnotation A data extension mechanism for Krita.
*
* An annotation can be of something like a QByteArray or a QString or
* a more specific datatype that can be attached to an image (or maybe
* later, if needed, to a layer) and contains data that must be
* associated with an image for purposes of import/export.
*
* Annotations will be saved to krita images and may be exported in
* filetypes that support them.
*
* Examples of annotations are EXIF data and ICC profiles.
*/
class KisAnnotation : public KisShared
{
public:
/**
* creates a new annotation object. The annotation object cannot
* be changed later.
*
* @param type a non-localized string identifying the type of the
* annotation
* @param description a localized string describing the annotation
* @param data a binary blob containing the annotation data
*/
KisAnnotation(const QString & type, const QString & description, const QByteArray & data)
: m_type(type),
m_description(description),
m_annotation(data) {}
/**
* gets a non-localized strin identifying the type of the
* annotation.
* @return a non-localized string identifiying the type of the
* annotation
*/
QString & type() {
return m_type;
}
/**
* gets a localized string describing the type of annotations for
* used interface purposes.
* @return a localized string describing the type of the
* annotations for user interface purposes.
*/
QString & description() {
return m_description;
}
/**
* gets a binary blob representation of this annotation
* @return a binary blob representation of this annotation
*/
QByteArray & annotation() {
return m_annotation;
}
private:
QString m_type;
QString m_description;
QByteArray m_annotation;
};
#endif // _KIS_ANNOTATION_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.